/* ---------- Tokens ---------- */
/* Layout widths: phone < 600px · tablet 600–999px (photo+text splits from 760px) · desktop ≥ 1000px */
:root {
  --bg: #f8f5ef; /* soft warm ivory, one background for the whole page */
  --surface: #fdfcf9; /* cards a shade lighter, never pure white */
  --bg-deep: #2f5d50;
  --bg-deeper: #234539;
  --ink: #1f2a27;
  --muted: #575f5b;
  --line: #e2d9ca;
  --accent: #2f5d50;
  --accent-dark: #234539;
  --accent-soft: #e1e6dc;
  --accent-muted: #9db3a6; /* soft sage, decorative only: dots, borders, underlines (never body text) */

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --container: 1180px;
  --gutter: 16px;
  --header-h: 4.5rem;
  --section-pad: clamp(2.5rem, 5.5vw, 5rem); /* top and bottom of every section, so sections sit 5–10rem apart */
  --band-pad: clamp(4rem, 9vw, 7rem); /* the green contact band */
  --radius: 12px;
  --radius-img: 6px;
  --radius-button: 10px;
}
@media (min-width: 600px) {
  :root { --gutter: 32px; }
}

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

html {
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* keeps the full-bleed media from causing sideways scroll; clip (not hidden) keeps the sticky header working */
  overflow-wrap: break-word; /* last resort: a word too long for the line wraps instead of being cut off at the screen edge */
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
/* capped by the screen width so "Äikäs-Sulander" stays on one line even with a larger phone text size */
h1 { font-size: min(clamp(2.4rem, 5.2vw, 4.25rem), (100vw - 2 * var(--gutter)) / 7.5); line-height: 1.05; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1.2em; }

/* no lone word on a heading's or paragraph's last line (newer browsers; others wrap as usual) */
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
main p { max-width: 62ch; } /* comfortable line length */

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-radius: var(--radius-button);
  transition: background-color 0.2s ease, translate 0.2s ease;
}
.button { padding: 0.8rem 2rem; font-size: 1.05rem; }
@media (hover: hover) {
  .button:hover { background: var(--accent-dark); color: #fff; translate: 0 -1px; }
}

/* ---------- Header ---------- */
/* At the top of the page the bar sits see-through over the banner photo with white text,
   and turns beige once the page scrolls (where scroll-driven animations are supported; otherwise it stays beige). */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  color: var(--ink);
  background: rgba(248, 245, 239, 0.92);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
@supports (animation-timeline: scroll()) {
  .site-header {
    animation: header-solid linear both;
    animation-timeline: scroll(root block);
    animation-range: 0 120px;
  }
  @keyframes header-solid {
    from {
      color: #fff;
      background-color: rgba(248, 245, 239, 0);
      border-bottom-color: transparent;
      -webkit-backdrop-filter: blur(0) saturate(1);
      backdrop-filter: blur(0) saturate(1);
    }
    to {
      color: var(--ink);
      background-color: rgba(248, 245, 239, 0.92);
      border-bottom-color: var(--line);
      -webkit-backdrop-filter: blur(14px) saturate(1.2);
      backdrop-filter: blur(14px) saturate(1.2);
    }
  }
}
.site-header :focus-visible { outline-color: currentColor; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: calc(var(--header-h) - 1px); /* + 1px border = --header-h */
}
.wordmark {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 0.7rem + 1.6vw, 1.35rem);
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  margin-right: auto;
}
.wordmark:hover { color: inherit; opacity: 0.8; }

/* Phones and tablets: a menu button that opens the links as a dropdown panel (native popover: closes on outside tap and Esc).
   Shown only where popover is supported, so older browsers never get a button that does nothing. */
.site-nav { display: none; }
@supports selector(:popover-open) {
  .site-nav { display: block; }
}
.menu-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px; /* line the icon up with the page edge */
  padding: 0;
  border: 0;
  border-radius: var(--radius-button);
  background: none;
  color: inherit;
  cursor: pointer;
}
.menu-icon-close,
.site-header:has(.nav:popover-open) .menu-icon-open { display: none; }
.site-header:has(.nav:popover-open) .menu-icon-close { display: block; }

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  letter-spacing: 0.02em;
}
@media (max-width: 999px) {
  .nav:popover-open {
    position: fixed;
    inset: var(--header-h) 0 auto;
    width: auto;
    height: auto;
    max-height: calc(100svh - var(--header-h));
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem var(--gutter) 0.75rem;
    background: var(--bg);
    color: var(--ink);
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav::backdrop { background: rgba(18, 28, 25, 0.3); }
  .nav li + li { border-top: 1px solid var(--line); }
  .nav a { display: flex; min-height: 52px; font-size: 1.1rem; }
  .nav a:hover { color: var(--accent); }
}
@media (max-width: 999px) and (prefers-reduced-motion: no-preference) {
  .nav:popover-open { transition: opacity 0.2s ease, translate 0.2s ease; }
  @starting-style {
    .nav:popover-open { opacity: 0; translate: 0 -8px; }
  }
}

/* Desktop: no button, the same list sits in the bar as a row of links */
@media (min-width: 1000px) {
  .site-nav { display: block; }
  .menu-button { display: none; }
  .nav[popover] {
    display: flex;
    align-items: center;
    gap: 0 0.25rem;
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    overflow: visible;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
  }
  .nav a { padding: 0 0.5rem; font-size: 0.95rem; opacity: 0.85; }
  .nav a:hover { color: inherit; opacity: 1; text-decoration: underline; text-decoration-color: var(--accent-muted); text-decoration-thickness: 2px; }
}
@media (min-width: 1200px) {
  .header-inner { gap: 2rem; }
  .wordmark { font-size: 1.6rem; }
  .nav a { padding: 0 0.6rem; font-size: 0.97rem; }
}

/* ---------- Hero ---------- */
/* A full-screen street photo with the text on top of it, at the bottom left.
   It slides up under the see-through header, so before scrolling the photo fills the whole screen (svh: Safari's height with toolbars showing).
   If a very short screen can't fit the text, the banner grows with it. */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  margin-top: calc(-1 * var(--header-h));
  padding-top: var(--header-h);
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg-deeper); /* shows while the photo loads */
  color: #fff;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%; /* keeps the rock, the stairs and the street in view on narrow phones */
}
/* the photo is busy, so a soft dark wash keeps the text readable: darkest behind the text, lighter elsewhere.
   A top band keeps the white header text readable over the bright sky.
   Phones: the 30rem stop is measured from the bottom so it always covers the text block, even on short screens. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(18, 28, 25, 0.68) 0, rgba(18, 28, 25, 0) 10rem),
    linear-gradient(to top, rgba(18, 28, 25, 0.88) 0, rgba(18, 28, 25, 0.72) 30rem, rgba(18, 28, 25, 0.3) 100%);
}
@media (min-width: 760px) {
  .hero::after {
    background:
      linear-gradient(to bottom, rgba(18, 28, 25, 0.68) 0, rgba(18, 28, 25, 0) 10rem),
      linear-gradient(to right, rgba(18, 28, 25, 0.8) 0%, rgba(18, 28, 25, 0.6) 40%, rgba(18, 28, 25, 0.1) 75%),
      linear-gradient(to top, rgba(18, 28, 25, 0.5) 0%, rgba(18, 28, 25, 0) 60%);
  }
}
.hero-inner { width: 100%; }
.hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 40rem;
  padding: 2.5rem 0 2.25rem;
}
@media (min-width: 760px) {
  .hero-text { padding: 4rem 0 4.5rem; }
}
.hero :focus-visible { outline-color: #fff; }

/* two rows: "Psykoterapeutti" / "Psykoterapian erikoispsykologi". Each is one concept and never breaks mid-phrase:
   on phones the size is capped by the screen width so the longer row fits even with a larger phone text size. */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: min(0.75rem, (100vw - 2 * var(--gutter)) / 19.5); /* phones */
  font-weight: 600;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.25rem;
}
.eyebrow span { display: block; }
.eyebrow-sep { display: none !important; } /* the dot only separated the two phrases on one row */
@media (min-width: 600px) {
  .eyebrow { font-size: 0.8rem; letter-spacing: 0.14em; }
}
/* a phrase that stays together: it moves to the next line as one piece, and only wraps inside if it's wider than the whole line */
.nowrap { display: inline-block; text-decoration: inherit; }

.hero h1 { color: #fff; margin-bottom: 0.4em; }
.hero h1 span { display: block; }
.lead {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  max-width: 30ch;
  margin-bottom: 1.75rem;
}
/* cream button: the green one would disappear on the dark photo */
.hero .button {
  width: 100%; /* phones: thumb-friendly full-width button */
  background: var(--surface);
  color: var(--accent-dark);
}
@media (hover: hover) {
  .hero .button:hover { background: #fff; color: var(--accent-dark); }
}
@media (min-width: 600px) {
  .hero .button { width: auto; }
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}
.badges li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}
.badges svg { flex: none; color: #fff; }

/* soft fade-in on load, only when motion is welcome */
@media (prefers-reduced-motion: no-preference) {
  .hero-text > * { animation: fade-up 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero-text > :nth-child(2) { animation-delay: 0.08s; }
  .hero-text > :nth-child(3) { animation-delay: 0.16s; }
  .hero-text > :nth-child(4) { animation-delay: 0.24s; }
  .hero-text > :nth-child(5) { animation-delay: 0.32s; }
  .hero-bg { animation: fade-in 0.8s ease both; }
  @keyframes fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* ---------- Sections ---------- */
/* one continuous ivory background: sections are separated by space, not colour blocks */
.section,
.space { padding-block: var(--section-pad); }
/* anchor offset for the sticky header comes from html { scroll-padding-top } above */

.narrow { max-width: 52rem; }
.intro {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Photo + text (Minusta, Yhteystiedot) ---------- */
.split {
  display: grid;
  gap: 2rem;
  align-items: center;
}
.split-photo {
  width: 100%;
  max-width: 480px; /* tablets in one column: keep the portrait from getting huge */
}
.split-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-img);
}
.split-photo--muotokuva img { object-position: 50% 25%; } /* head and shoulders: ~4–87% visible at 4:5, ~3–92% at 3:4 */
.split-photo--sohva img { object-position: 50% 30%; } /* head and shoulders: ~5–88% visible */
.split-reverse .split-photo { order: 2; } /* contact: details first, photo after */

@media (min-width: 760px) {
  .split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2.5rem, 6vw, 6rem);
  }
  .split-reverse { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .split-reverse .split-photo { justify-self: end; }
  .split-photo { max-width: 440px; }
  .split-photo img { aspect-ratio: 3 / 4; }
}
@media (min-width: 1000px) {
  .split { grid-template-columns: 440px minmax(0, 1fr); }
  .split-reverse { grid-template-columns: minmax(0, 1fr) 440px; }
}

.pullquote {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.4;
  color: var(--accent);
  margin: 1.75rem 0 2rem;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent-muted);
}

/* ---------- Työotteeni steps ---------- */
.steps {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: grid;
  gap: 1rem;
}
.steps li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  transition: translate 0.25s ease, border-color 0.25s ease;
}
@media (hover: hover) {
  .steps li:hover { translate: 0 -3px; border-color: var(--accent-muted); }
}
.steps p { margin: 0; color: var(--muted); }
/* a small round number badge */
.step-number {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 1.1rem;
}
.steps h3 { margin-bottom: 0.4em; }
/* tablets: number on the left, text on the right */
@media (min-width: 600px) {
  .steps li {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    column-gap: 1.25rem;
    padding: 1.75rem;
  }
  .step-number { grid-row: span 2; margin-bottom: 0; }
}
@media (min-width: 1000px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 3rem; }
  .steps li { display: block; padding: 2rem 1.75rem; }
  .step-number { margin-bottom: 1.1rem; }
}

/* ---------- Vastaanotto (room photo) ---------- */
/* a picture-style rectangle, never cropped: the whole room shows on every screen */
.space-photo img {
  /* as wide as the content, but never taller than the visible screen */
  width: min(100%, calc((100vh - var(--header-h) - 3rem) * 16 / 9));
  width: min(100%, calc((100svh - var(--header-h) - 3rem) * 16 / 9));
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-img);
  background: var(--accent-soft);
}
.space-text {
  display: grid;
  gap: 0.5rem 4rem;
  margin-top: 2rem;
}
.space-text h2 { margin-bottom: 0.25em; }
.space-text > div > p:not(.space-address) {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.space-address {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--accent);
}
.space-address svg { flex: none; }
.space-address a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}
@media (min-width: 1000px) {
  .space-text {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    align-items: start;
    margin-top: 3rem;
  }
}

/* ---------- CV timelines ---------- */
.cv {
  display: grid;
  gap: 2.5rem;
  margin-top: 2.5rem;
}
@media (min-width: 1000px) {
  .cv { grid-template-columns: 1fr 1fr; gap: 5rem; margin-top: 3.5rem; }
}
.cv h3 {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
}
/* phones: one column, line and dots on the left */
.timeline {
  position: relative;
  display: grid;
  gap: 0.1rem;
  margin: 0;
  padding-left: 1.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 4px;
  width: 1px;
  background: var(--line);
}
.timeline dt {
  position: relative;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 0.97rem;
  line-height: 1.6;
}
.timeline dt::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: -1.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-muted);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline dd { margin: 0 0 1.25rem; line-height: 1.5; }
.timeline dd strong { display: block; font-weight: 600; }
.timeline dd > span { color: var(--muted); font-size: 0.95rem; }

/* from 600px: years on the left, line and dots between years and text */
@media (min-width: 600px) {
  .timeline {
    grid-template-columns: 6.5rem 1fr;
    gap: 1.5rem 2rem;
    padding-left: 0;
  }
  .timeline::before { left: 7.5rem; }
  .timeline dt { text-align: right; }
  .timeline dt::before { left: auto; right: calc(-1rem - 5px); }
  .timeline dd { margin-bottom: 0; }
}

/* ---------- Contact ---------- */
.section-contact {
  padding-block: var(--band-pad);
  background: var(--bg-deep);
  color: #fff;
  overflow-x: clip;
}
.section-contact h2 { color: #fff; }
.section-contact p { font-size: 1.15rem; }
.section-contact :focus-visible { outline-color: #fff; }

.contact {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
}
.contact li {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.contact li:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
.contact li > div { min-width: 0; } /* lets the text column shrink so long lines wrap instead of overflowing */
.contact-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.contact-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.8);
}
/* a plain text box (not flex) so a long line can wrap; the padding keeps a one-line link a 44px tap target */
.contact a {
  display: inline-block;
  padding-block: max(0px, (44px - 1.7em) / 2);
  line-height: 1.7;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 600;
  color: #fff;
  overflow-wrap: break-word; /* last resort only; the email breaks before "@" via <wbr> */
}
.contact a:hover { color: #fff; text-decoration-color: var(--accent-muted); text-decoration-thickness: 2px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-deeper);
  color: rgba(255, 255, 255, 0.85);
  padding: 1.25rem 0;
  font-size: 0.92rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
}
.site-footer p { margin: 0; }
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #fff;
  font-weight: 600;
}
.site-footer a:hover { color: #fff; text-decoration-color: var(--accent-muted); text-decoration-thickness: 2px; }
.site-footer :focus-visible { outline-color: #fff; }

/* ---------- Motion: scroll reveal ---------- */
/* Everything is fully visible by default; the reveal only applies where supported and welcome. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
    @keyframes reveal {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: none; }
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
