@import url("../fonts/fonts.css");

/* ---------------------------------------------------------------- tokens */
:root {
  --ink: #1c1e24;          /* softened off-black rather than pure #000 */
  --ink-soft: #4a4d55;
  --ink-muted: #767a84;
  --bg: #ffffff;
  --bg-alt: #f4f4f4;
  --line: #e2e3e6;
  --accent: #5c78be;
  --accent-dark: #435a97;

  --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1200px;
  --header-h: 86px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .06);
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; margin: 0; line-height: 1.2; }
p { margin: 0 0 .9em; }
ul { margin: 0 0 .9em; padding-left: 1.15rem; }
li { margin-bottom: .2em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: #000; color: #fff; padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- header */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center;
  background: transparent;
  transition: background-color .25s ease, box-shadow .25s ease, backdrop-filter .25s ease;
}
.site-header.is-stuck {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}

.header-inner { display: flex; align-items: center; gap: 28px; width: 100%; }

.lang-switch { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.lang-switch a {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 15.5px; font-weight: 700; color: var(--ink); letter-spacing: .02em;
}
.lang-switch a[aria-current="true"] { color: var(--accent); }
.lang-switch a:hover { color: var(--accent); text-decoration: none; }
.lang-switch svg { width: 23px; height: 17px; border-radius: 2px; display: block; }

.header-mail {
  font-family: var(--font-head); font-weight: 700; font-size: 19px;
  color: var(--ink); white-space: nowrap;
}
.header-mail:hover { color: var(--accent); text-decoration: none; }

.site-nav { margin-left: auto; }
.site-nav ul { display: flex; gap: 32px; list-style: none; margin: 0; padding: 0; }
.site-nav a { font-size: 17.5px; font-weight: 600; color: var(--ink); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.nav-toggle {
  display: none; margin-left: auto;
  width: 48px; height: 48px; padding: 0;
  background: none; border: 0; cursor: pointer; color: var(--ink);
}
.nav-toggle svg { width: 28px; height: 28px; margin: 0 auto; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }

/* ------------------------------------------------------------------ hero */
main { padding-top: var(--header-h); }

.hero { text-align: center; padding: 88px 0 32px; }
.hero h1 { font-size: clamp(34px, 5vw, 50px); letter-spacing: -.02em; line-height: 1.15; }
.hero .tagline {
  font-family: var(--font-head); font-weight: 600; line-height: 1.5;
  font-size: clamp(16.5px, 1.7vw, 20px);
  max-width: 44ch; margin: 26px auto 0;
}

.hero-actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 42px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 24px; border-radius: 999px;
  font-family: var(--font-head); font-weight: 600; font-size: 15.5px;
  border: 1.5px solid var(--ink); background: var(--ink); color: #fff;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --------------------------------------------------------------- section */
.section { padding: 60px 0; scroll-margin-top: calc(var(--header-h) + 8px); }
.section > .wrap > h2 { font-size: clamp(27px, 3.3vw, 35px); margin-bottom: 28px; }
.section--alt { background: var(--bg-alt); padding: 62px 0 74px; }

/* ------------------------------------------------------------------ about */
.about-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 42px; align-items: start;
}
.about-media figure { margin: 0; }
.about-media img { border-radius: var(--radius); width: 100%; }
.about-media figcaption { font-size: 13.5px; color: var(--ink-muted); margin-top: 8px; line-height: 1.5; }
.about-text h2 { font-size: clamp(27px, 3.3vw, 35px); margin-bottom: 18px; }

.contact-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line);
}
.social { display: flex; align-items: center; gap: 14px; }
/* icons are black, and grow into the accent colour on hover — as on the old site */
.social a { color: var(--ink); display: inline-flex; transition: color .2s ease, transform .2s ease; }
.social a:hover, .social a:focus-visible { color: var(--accent); transform: scale(1.12); }
.social svg { width: 27px; height: 27px; }
.contact-mail { font-family: var(--font-head); font-weight: 700; font-size: 16.5px; color: var(--ink); }
.contact-mail:hover { color: var(--accent); text-decoration: none; }

/* -------------------------------------------------------------- education */
.edu-list { list-style: none; margin: 0; padding: 0; }
.edu-item {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.edu-item:last-child { border-bottom: 0; }
.edu-logo {
  width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0;
  object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 3px;
}
.edu-item .tl-mono { width: 42px; height: 42px; }
.edu-body { min-width: 0; }
.edu-years { font-weight: 700; }
.edu-note { display: block; color: var(--ink-muted); font-size: 15px; }

.edu-proof { margin-top: 30px; }
.edu-proof h3 { font-size: 19px; margin-bottom: 6px; }
.edu-proof > p { color: var(--ink-soft); max-width: 62ch; }
.cert-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; }
.cert-row a {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.cert-row a:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.cert-row img { width: 132px; border-radius: 4px; }
.cert-row span { display: block; text-align: center; font-size: 13.5px; color: var(--ink-muted); margin-top: 7px; }

/* ----------------------------------------------------------------- skills */
.skills-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 44px; align-items: start; }
/* the skill groups themselves flow into two columns so the list stays compact */
.skills-grid > div:first-child {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0 34px; align-items: start;
}
.skill-block { margin-bottom: 26px; }
.skill-block h3 { font-size: 17px; margin-bottom: 7px; }
.skills-media img { border-radius: var(--radius); }
.skills-media figcaption { font-size: 13.5px; color: var(--ink-muted); margin-top: 8px; }
.skills-media figure { margin: 0; }

.course-block { margin-top: 34px; }
.course-block > h3 { font-size: 19px; margin-bottom: 4px; }
.course-block > p { color: var(--ink-soft); max-width: 70ch; }
.course-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 34px; margin-top: 14px; }
.course-groups h4 { font-family: var(--font-head); font-weight: 600; font-size: 15.5px; margin: 0 0 5px; }
.course-groups ul { font-size: 15.5px; }
.thesis { margin-top: 16px; font-size: 15.5px; color: var(--ink-soft); }

/* ---------------------------------------------------------------- hobbies */
.hobbies-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 42px; align-items: start; }
.hobbies-media figure { margin: 0; }
.hobbies-media img { border-radius: var(--radius); }
.hobbies-media figcaption { font-size: 13.5px; color: var(--ink-muted); margin-top: 8px; }

.press { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.press h3 { font-size: 17px; margin-bottom: 9px; }
.press ul { list-style: none; padding: 0; margin: 0; }
.press li { margin-bottom: 10px; }
.press a { font-weight: 500; }
.press .press-meta { display: block; font-size: 14px; color: var(--ink-muted); }

/* -------------------------------------------------------------- timeline */
.timeline-head { text-align: center; margin-bottom: 46px; }
.timeline-head h2 { font-size: clamp(27px, 3.3vw, 35px); }
.timeline-head p { color: var(--ink-soft); margin: 6px 0 0; }

.timeline { position: relative; max-width: 980px; margin: 0 auto; }
.timeline::before {
  content: ""; position: absolute; top: 6px; bottom: 6px; left: 50%;
  width: 2px; margin-left: -1px; background: var(--ink);
}

.tl-item { position: relative; width: 50%; padding: 0 0 40px 44px; margin-left: 50%; }
.tl-item--left { padding: 0 44px 40px 0; margin-left: 0; }
.tl-item::before {
  content: ""; position: absolute; top: 7px; left: -7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); border: 3px solid var(--bg-alt);
}
.tl-item--left::before { left: auto; right: -7px; }

/* each entry is a native <details>: header always visible, the rest expands */
.tl-details {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 16px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.tl-details[open] { box-shadow: var(--shadow); }
.tl-details:hover { border-color: #cfd2d8; }

.tl-summary {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; cursor: pointer; list-style: none;
}
.tl-summary::-webkit-details-marker { display: none; }
.tl-summary::marker { content: ""; }
.tl-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

.tl-titles { flex: 1; min-width: 0; }
.tl-summary:hover h3, .tl-summary:hover .tl-chevron { color: var(--accent); }

.tl-chevron {
  width: 22px; height: 22px; flex-shrink: 0; color: var(--ink-muted);
  transition: transform .2s ease, color .2s ease;
}
.tl-details[open] .tl-chevron { transform: rotate(180deg); }

.tl-body { padding: 2px 0 16px; }
.tl-body > :last-child { margin-bottom: 0; }

.tl-logo {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 2px;
}
.tl-mono {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--ink); color: #fff;
  font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: -.02em;
}
.tl-item h3 { font-size: clamp(20px, 2.2vw, 24px); transition: color .18s ease; }
.tl-role { display: block; font-weight: 600; font-size: 16px; margin: 4px 0 0; color: var(--ink); }
.tl-date { display: block; font-style: italic; font-weight: 600; font-size: 14.5px; margin: 1px 0 0; color: var(--ink-muted); }
.tl-item p, .tl-item ul { font-size: 16px; }
/* bullet lists stay left-aligned even in a right-aligned card, as on the old site */
.tl-item ul { text-align: left; }

/* project cards inside a timeline entry */
.projects { display: grid; gap: 12px; margin: 16px 0 4px; text-align: left; }
.project {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
}
.project img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.project-body { min-width: 0; flex: 1; }
.project-body h4 { font-family: var(--font-head); font-weight: 700; font-size: 16px; margin: 0 0 2px; }
.project-body p { font-size: 15px; margin: 0; color: var(--ink-soft); }

.project-links { display: flex; gap: 9px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.project-links a { color: var(--ink-soft); display: inline-flex; transition: color .2s ease, transform .2s ease; }
.project-links a:hover, .project-links a:focus-visible { color: var(--accent); transform: scale(1.15); }
.project-links svg { width: 18px; height: 18px; }

/* client reference grid */
.refs { margin-top: 18px; text-align: left; }
.refs > h4 { font-family: var(--font-head); font-weight: 700; font-size: 16px; margin: 0 0 10px; }
.ref-grid { display: grid; gap: 12px; }
.ref-card {
  display: block; background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ref-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.ref-card .ref-body { padding: 13px 16px 15px; text-align: left; }
.ref-card h5 { font-family: var(--font-head); font-weight: 700; font-size: 15.5px; margin: 0 0 3px; color: var(--ink); }
.ref-card p { font-size: 14px; margin: 0; color: var(--ink-soft); line-height: 1.5; }
.ref-result { display: block; margin-top: 6px; font-weight: 600; color: var(--accent); font-size: 14px; }

/* ---------------------------------------------------------------- footer */
.site-footer { padding: 26px 0 30px; border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer p { margin: 0; font-size: 14.5px; color: var(--ink-muted); }

/* ------------------------------------------------------------------- a11y */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ responsive */

/* the Finnish nav labels are long, so give the header some air before it wraps */
@media (max-width: 1120px) {
  .header-inner { gap: 20px; }
  .site-nav ul { gap: 22px; }
  .site-nav a { font-size: 16px; }
  .header-mail { font-size: 17px; }
}

@media (max-width: 900px) {
  .about-grid, .skills-grid, .hobbies-grid { grid-template-columns: 1fr; gap: 28px; }
  .skills-media, .hobbies-media { order: -1; }

  .nav-toggle { display: block; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
    margin: 0; display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 8px 24px 18px; }
  .site-nav li { border-bottom: 1px solid var(--line); }
  .site-nav li:last-child { border-bottom: 0; }
  .site-nav a { display: block; padding: 16px 0; font-size: 18.5px; }

  .header-mail { font-size: 16.5px; }

  /* single-column timeline */
  .timeline::before { left: 7px; margin-left: 0; }
  .tl-item, .tl-item--left {
    width: 100%; margin-left: 0; padding: 0 0 34px 34px; text-align: left;
  }
  .tl-item::before, .tl-item--left::before { left: 0; right: auto; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  .hero { padding: 44px 0 4px; }
  .section { padding: 40px 0; }
  .header-mail { display: none; }
  .cert-row img { width: 118px; }
}

@media print {
  .site-header, .hero-actions, .nav-toggle { display: none; }
  main { padding-top: 0; }
  .section--alt { background: none; }
  a { color: #000; text-decoration: underline; }
}
