@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }

  /* Layout: narrow editorial column (max 1040px), text/illustration pairs alternating sides,
     grey bands for the "boxed" sections of the leiska, illustrations always on white. */
  :root {
    --bg: #ffffff;
    --bg-band: #f4f4f4;
    --fg: #000000;
    --fg-soft: #333333;
    --line: #cccccc;
    --grey-dark: #999999;
    --yellow: #ffc40c;
    --red: #fb6729;
    --green: #71c599;
    --font-head: "Montserrat", "Helvetica Neue", Arial, sans-serif;
    --font-body: Georgia, "Times New Roman", serif;
    --gutter-l: max(16px, env(safe-area-inset-left, 0px));
    --gutter-r: max(16px, env(safe-area-inset-right, 0px));
    --maxw: 1040px;
    color-scheme: light;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: clamp(16px, 15.5px + .15vw, 17px);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  img { max-width: 100%; height: auto; display: block; }
  a { color: inherit; }
  h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }
  p { margin: 0; }

  .wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding-left: var(--gutter-l);
    padding-right: var(--gutter-r);
  }

  /* ---------- Header ---------- */
  .site-header {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid transparent;
  }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
  .site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: clamp(10px, 1.6vw, 22px);
  }
  .brand { --logo-w: clamp(92px, 84px + 2.5vw, 112px); display: grid; gap: 2px; justify-items: start; }
  .logo img { width: var(--logo-w); }
  /* Factors from measured glyph edges: the text spans exactly the "sofus" wordmark. */
  .tagline {
    font-family: var(--font-head);
    font-weight: 500;
    font-size: calc(var(--logo-w) * .12674);
    margin-left: calc(var(--logo-w) * -.0093);
    line-height: 1.2;
    white-space: nowrap;
  }
  .menu-btn {
    background: none; border: 0; padding: 10px; margin: -5px -6px -5px 0; cursor: pointer;
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px;
  }
  .menu-btn span { display: block; height: 3px; background: var(--fg); border-radius: 1px; transition: transform .2s, opacity .2s; }
  .menu-btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
  .menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  .site-nav {
    border-top: 1px solid var(--line);
    background: var(--bg);
  }
  .site-nav ul {
    list-style: none; margin: 0; padding: 0;
    padding-block: 12px;
    display: flex; flex-wrap: wrap; gap: 4px 28px;
  }
  .site-nav a {
    font-family: var(--font-head); font-weight: 500; font-size: 15px;
    text-decoration: none; padding: 12px 0; display: inline-block;
    border-bottom: 2px solid transparent;
  }
  .site-nav a:hover, .site-nav a:focus-visible { border-bottom-color: var(--yellow); outline: none; }

  /* ---------- Hero / intro pairs ---------- */
  .intro { padding-block: clamp(8px, 3vw, 32px) 8px; }
  .pair {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 32px clamp(28px, 5vw, 56px);
    align-items: center;
    padding-block: 36px;
  }
  .pair.img-left { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .pair.img-left .pair-text { order: 2; }
  .pair.img-left .pair-img { order: 1; }
  .pair-text { display: grid; gap: 22px; min-width: 0; }
  .pair-text h1, .pair-text h2 { font-size: clamp(20px, 19px + .3vw, 22px); }
  .pair-text h1 + p, .pair-text h2 + p { margin-top: 6px; }
  .pair-img { display: flex; justify-content: center; }
  .pair-img img { width: 100%; max-width: 380px; }
  .pair-img img.smaller { max-width: 285px; }

  /* Service block: the 2nd paragraph of each intro section is a Sofus service.
     Marked with a coloured rule + label so it reads as an offer, not as more context. */
  .service {
    border-left: 4px solid var(--service-color, var(--yellow));
    padding: 6px 0 6px 20px;
    display: grid; gap: 6px;
  }
  .service h3 { font-size: 17px; }
  .service.c-yellow { --service-color: var(--yellow); }
  .service.c-green  { --service-color: var(--green); }
  .service.c-red    { --service-color: var(--red); }

  /* ---------- Grey bands ---------- */
  .band { background: var(--bg-band); }
  .band .wrap { padding-block: clamp(28px, 5vw, 44px); }
  .band-grid {
    display: grid;
    grid-template-columns: clamp(160px, 22vw, 180px) minmax(0, 1fr);
    gap: 24px clamp(24px, 4vw, 40px);
    align-items: start;
  }
  .band h2 { font-size: clamp(22px, 20px + .6vw, 26px); }
  .band-head { display: grid; gap: 18px; justify-items: start; }
  .band-icon { width: clamp(84px, 12vw, 120px); height: auto; }
  .band-section { margin-block: 20px; }

  .courses { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
  .courses li { display: grid; gap: 4px; padding-left: 18px; position: relative; }
  .courses li::before { content: ""; position: absolute; left: 0; top: .6em; width: 8px; height: 8px; background: var(--fg); border-radius: 50%; }
  .courses .when { color: var(--fg-soft); }
  .cta {
    font-family: var(--font-head); font-weight: 500; font-size: 14px;
    text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
    border-bottom: 2px solid var(--yellow); padding-bottom: 1px; width: fit-content;
    position: relative;
  }
  .cta::before { content: ""; position: absolute; inset: -10px 0; }
  .cta:hover, .cta:focus-visible { background: var(--yellow); outline: none; }
  .cta::after { content: "→"; }

  .posts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: clamp(24px, 3vw, 32px); }
  .post { display: grid; gap: 10px; align-content: start; min-width: 0; }
  .post h3 { font-size: 17px; }
  .post .meta { font-family: var(--font-head); font-size: 13px; font-weight: 500; color: var(--fg-soft); }

  /* ---------- Team ---------- */
  .team .wrap { padding-block: clamp(32px, 5vw, 48px) clamp(20px, 3vw, 32px); }
  .team h2 { font-size: clamp(22px, 20px + .6vw, 26px); margin-bottom: 14px; }
  .team-lead { max-width: 100%; margin-bottom: 32px; text-wrap: balance; }
  .people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 3vw, 32px); list-style: none; margin: 0; padding: 0; }
  .person { display: grid; gap: 6px; align-content: start; }
  .person .photo {
    aspect-ratio: 3 / 4; max-width: 100%;
    background: var(--bg-band);
    overflow: hidden; position: relative;
  }
  .person .photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .person .name { font-family: var(--font-head); font-weight: 700; font-size: 15px; }
  .person .phone { font-family: var(--font-head); font-size: clamp(13px, 10px + .6vw, 15px); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .person .phone a { display: block; padding-block: 8px; margin-block: -6px; text-decoration: none; }
  .person .phone a:hover, .person .phone a:focus-visible { text-decoration: underline; }

  /* ---------- Mission ---------- */
  .mission .wrap { padding-block: 32px 56px; }
  .mission .pair { padding-block: 0; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .mission h2 { font-size: clamp(20px, 19px + .3vw, 22px); margin-bottom: 10px; }
  .mission p { max-width: 66ch; }
  .mission .pair-img img { max-width: 360px; }

  /* ---------- Contact ---------- */
  .contact .wrap { padding-block: 40px 48px; }
  .contact-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
  .contact h2 { font-size: clamp(22px, 20px + .6vw, 26px); margin-bottom: 14px; }
  .contact address { font-style: normal; display: grid; gap: 4px; }
  .social { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
  .social a {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-head); font-weight: 500; font-size: 14px;
    text-decoration: none; background: var(--bg); border: 2px solid var(--fg);
    padding: 7px 14px 7px 10px; border-radius: 999px; min-height: 44px;
  }
  .social a:hover, .social a:focus-visible { background: var(--yellow); border-color: var(--yellow); outline: none; }
  .social .ico { width: 20px; height: 20px; display: inline-flex; }
  .social .ico svg { width: 100%; height: 100%; }

  .site-footer .wrap {
    padding-block: 18px 28px;
    display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
    font-family: var(--font-head); font-size: 12px; color: var(--fg-soft);
  }

  /* ---------- Responsive ---------- */
  /* Wide screens: grey bands stop at the column edges instead of running full-bleed. */
  @media (min-width: 1040px) {
    .band { background: none; }
    .band .wrap {
      background: var(--bg-band);
      max-width: calc(var(--maxw) - 32px);
      padding-inline: 32px;
    }
  }
  /* Wide screens: nav always visible, no hamburger. */
  @media (min-width: 900px) {
    .site-header .wrap { justify-content: flex-start; gap: 20px; }
    .menu-btn { display: none; }
    .site-nav, .site-nav[hidden] {
      display: block; position: absolute; top: 0; bottom: 0;
      right: max(0px, calc((100vw - var(--maxw)) / 2));
      border: 0; background: transparent;
    }
    .site-nav .wrap { height: 100%; padding-block: 0; max-width: none; margin: 0; }
    .site-nav ul { padding: 0; gap: 24px; }
    .site-nav a { padding-block: 6px; }
  }
  /* Phones: question, illustration, then the service as its own card. */
  @media (max-width: 639px) {
    .pair, .pair.img-left, .mission .pair { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .pair, .pair.img-left { padding-block: 24px 32px; }
    .pair-text { display: contents; }
    .pair .pair-text > div:first-child { order: 1; }
    .pair .pair-img, .pair.img-left .pair-img { order: 2; }
    .pair .service { order: 3; }
    .pair-img img { max-width: min(78%, 260px); }
    .pair-img img.smaller { max-width: 170px; }
    .mission .pair-img img { max-width: min(100%, 320px); }
    .pair-text h1, .pair-text h2, .mission h2 { font-size: 22px; margin-bottom: 8px; }
    .service { background: var(--bg-band); border-left-width: 5px; padding: 16px 16px 18px; }
    .service h3 { font-size: 18px; }

    .band-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .band-head { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; }

    /* Full-screen menu */
    .site-nav:not([hidden]) {
      position: fixed; inset: 0; top: var(--header-h, 56px);
      z-index: 30; overflow-y: auto;
    }
    .site-nav ul { width: 100%; flex-direction: column; flex-wrap: nowrap; gap: 0; padding-block: 0; }
    .site-nav li { border-bottom: 1px solid var(--line); }
    .site-nav li:last-child { border-bottom: 0; }
    .site-nav a { font-size: 22px; font-weight: 700; padding-block: 16px; display: block; }

    /* Team as rows with a call button */
    .people { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .person { grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 16px; align-content: center; }
    .person .photo { grid-row: 1 / 3; }
    .person .name { font-size: 16px; align-self: end; }
    .person .phone { font-size: 15px; align-self: start; }
    .phone-label { display: none; }
    .person .phone a {
      display: inline-flex; align-items: center; min-height: 44px; margin: 0;
      padding: 0 14px; border: 2px solid var(--fg); border-radius: 999px; font-weight: 500;
    }
  }
  /* Landscape phones: the sticky header would eat a quarter of the screen. */
  @media (max-height: 500px) {
    .site-header { position: relative; top: 0; }
  }
  /* Oppimisen laboratorio: title across the top of the band, icon on the left (top right on phones). */
  .band-lab .wrap { padding-top: clamp(20px, 2.5vw, 28px); }
  .band-lab h2 { margin-bottom: clamp(14px, 2vw, 22px); }
  @media (max-width: 639px) {
    .band-lab .wrap { position: relative; }
    .band-lab h2 { padding-right: 80px; }
    .band-lab .band-head { position: absolute; top: 16px; right: var(--gutter-r); }
    .band-lab .band-icon { width: 64px; }
  }

  /* Kirjoitettua: heading and each post as separate grey boxes. */
  .band.band-section { background: none; }
  .band.band-section .wrap { background: none; padding: 0; }
  .band-section .band-grid { gap: 12px; align-items: stretch; }
  .band-section .posts { gap: 12px; }
  .band-section .band-head, .band-section .post { background: var(--bg-band); padding: clamp(20px, 3vw, 28px) 20px; }
  .band-section .band-head { padding-left: var(--gutter-l); align-content: start; }
  .band-section .post { grid-template-rows: auto auto 1fr auto; align-content: stretch; }
  @media (max-width: 639px) {
    .band-section .band-head { padding-right: var(--gutter-r); align-content: center; }
    .band-section .post { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
  }
  @media (min-width: 640px) {
    .band-section .band-grid { grid-template-columns: clamp(180px, 24vw, 200px) minmax(0, 1fr); }
  }
  @media (min-width: 1040px) {
    .band-section .band-grid { grid-template-columns: 240px minmax(0, 1fr); }
    .band-section .band-head { padding-left: 32px; }
    .band-section .post { padding-inline: 24px; }
  }
  html { scroll-behavior: smooth; scroll-padding-top: 100px; }
  @media (max-height: 500px) { html { scroll-padding-top: 16px; } }
  @media (prefers-reduced-motion: reduce) {
    .menu-btn span { transition: none; }
    html { scroll-behavior: auto; }
  }

/* ---------- Subpage template ---------- */
.back { display: inline-block; margin-top: clamp(4px, 1vw, 12px); padding-block: 10px; font-family: var(--font-head); font-weight: 500; font-size: 14px; text-decoration: none; }
.back:hover, .back:focus-visible { text-decoration: underline; }
.page-head {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px clamp(28px, 5vw, 56px); align-items: center;
  padding-block: clamp(8px, 2vw, 20px) clamp(24px, 4vw, 40px);
}
.page-head.no-img { grid-template-columns: minmax(0, 1fr); }
.page-head-text { display: grid; gap: 8px; }
.eyebrow { font-family: var(--font-head); font-weight: 500; font-size: 14px; color: var(--fg-soft); }
.page-head h1 { font-size: clamp(27px, 22px + 1.6vw, 38px); }
.page-subtitle { font-family: var(--font-head); font-weight: 500; font-size: clamp(17px, 16px + .3vw, 19px); line-height: 1.35; }
/* Illustrations are 2000 px squares with wide white margins: the frame crops them to the drawing. */
.page-img { position: relative; overflow: hidden; width: 100%; justify-self: center; }
.page-img img { position: absolute; max-width: none; height: auto; }
.crop-brains { max-width: 300px; aspect-ratio: 1380 / 840; }
.crop-brains img { width: 144.9%; left: -24.6%; top: -71.4%; }
.crop-bulb { max-width: 200px; aspect-ratio: 1120 / 1115; }
.crop-bulb img { width: 178.6%; left: -42%; top: -41.3%; }

.page-body {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px clamp(28px, 5vw, 56px); align-items: start;
  padding-bottom: clamp(40px, 6vw, 72px);
}
.prose { display: grid; gap: 16px; min-width: 0; }
.prose p, .prose ul { max-width: 66ch; }
.prose .prose-lead { font-family: var(--font-head); font-weight: 700; font-size: clamp(18px, 17px + .3vw, 20px); line-height: 1.35; }
.prose h2 { font-size: clamp(20px, 19px + .3vw, 22px); margin-top: 12px; }
.prose ul { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

.facts { background: var(--bg-band); padding: 24px; display: grid; gap: 18px; position: sticky; top: 120px; }
.facts dl { margin: 0; display: grid; gap: 14px; }
.facts dt { font-family: var(--font-head); font-weight: 700; font-size: 13px; }
.facts dd { margin: 0; line-height: 1.45; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 999px;
  background: var(--yellow); color: var(--fg); text-align: center; text-decoration: none;
  font-family: var(--font-head); font-weight: 700; font-size: 15px; line-height: 1.25;
}
.button:hover, .button:focus-visible { background: var(--fg); color: var(--bg); outline: none; }
.signup-end { display: none; }
@media (max-width: 639px) {
  .page-head, .page-body { grid-template-columns: minmax(0, 1fr); }
  .page-img { order: -1; justify-self: start; }
  .crop-brains { max-width: 230px; }
  .crop-bulb { max-width: 130px; }
  .facts { order: -1; position: static; padding: 18px var(--gutter-r) 20px var(--gutter-l); margin-inline: calc(var(--gutter-l) * -1) calc(var(--gutter-r) * -1); }
  .signup-end { display: grid; gap: 12px; margin-top: 12px; }
}
@media (max-height: 500px) { .facts { position: static; } }
