@layer tokens, base, layout, components, motion, responsive;

/* Self-hosted so the first paint owes nothing to a third party */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
                 U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url("/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                 U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@layer tokens {
  :root {
    /* Deep-water blues through rain-glass, with teal as the live signal */
    --ink:      #091318;
    --ink-2:    #0E1B22;
    --ink-3:    #13242D;
    --ink-4:    #1A3340;
    --paper:    #E6EDF0;
    --mist:     #8CA3AC;

    --glass:    #9FD4E3;   /* rain on glass — hairlines, the rain itself */
    --cyan:     #5EC4D9;   /* live signal — active states, data */
    --teal:     #2E9AAC;   /* mid blue-green — logo, fills */
    --deep:     #17556B;   /* deep water — chart grounds */
    --brass:    #C08A4A;   /* one warm counterpoint, used twice */

    --rule:     color-mix(in oklab, var(--glass) 15%, transparent);
    --rule-2:   color-mix(in oklab, var(--glass) 8%, transparent);
    --rule-3:   color-mix(in oklab, var(--cyan) 28%, transparent);

    --gutter: clamp(1.25rem, 5vw, 5.5rem);
    --measure: 62ch;
    --max: 1440px;
    --labelw: 13rem;

    --t-fast: 180ms cubic-bezier(.2,.6,.2,1);
    --t-med:  420ms cubic-bezier(.2,.6,.2,1);
    --t-slow: 900ms cubic-bezier(.16,.84,.26,1);
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }

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

  body {
    margin: 0;
    background: var(--ink);
    color: var(--paper);
    font-family: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: clamp(1rem, .96rem + .2vw, 1.0625rem);
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }

  h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.035em; line-height: 1.02; text-wrap: balance; }
  p { margin: 0; text-wrap: pretty; }
  ul, ol { margin: 0; padding: 0; list-style: none; }

  a { color: inherit; text-decoration: none; }

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

  ::selection { background: var(--brass); color: var(--ink); }

  .skip {
    position: fixed; top: .5rem; left: .5rem; z-index: 100;
    padding: .6rem 1rem; background: var(--paper); color: var(--ink);
    font-weight: 600; transform: translateY(-200%);
  }
  .skip:focus { transform: none; }
}

@layer layout {
  /* The window: blurred world plus refracting droplets, behind everything */
  #rain {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
  }

  .hero { position: relative; }

  /* Sections sit on their own ground so the running water stays readable
     behind them without washing out body copy. */
  .band, .contact {
    position: relative; z-index: 1;
  }
  .band::before, .contact::before {
    content: ""; position: absolute; inset-block: 0;
    left: 50%; width: 100vw; transform: translateX(-50%);
    background: linear-gradient(180deg,
      color-mix(in oklab, var(--ink) 55%, transparent),
      color-mix(in oklab, var(--ink) 88%, transparent) 18%,
      color-mix(in oklab, var(--ink) 88%, transparent) 82%,
      color-mix(in oklab, var(--ink) 55%, transparent));
    z-index: -1; pointer-events: none;
  }
  .band--inset::before {
    background: linear-gradient(180deg,
      color-mix(in oklab, var(--ink-2) 72%, transparent),
      color-mix(in oklab, var(--ink-2) 94%, transparent) 16%,
      color-mix(in oklab, var(--ink-2) 94%, transparent) 84%,
      color-mix(in oklab, var(--ink-2) 72%, transparent));
  }

  .masthead, main, .footer {
    position: relative; z-index: 1;
    max-width: var(--max); margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .masthead {
    display: flex; align-items: center; justify-content: space-between;
    gap: 2rem; padding-block: 1.75rem;
  }

  .hero { padding-block: clamp(5rem, 16vh, 11rem) clamp(6rem, 18vh, 12rem); }

  .band { padding-block: clamp(4.5rem, 11vh, 8.5rem); }

  /* The ::before ground does the fill, so the band itself stays transparent
     and the water behind it keeps showing through at the seams. */
  .band--inset {
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
  }

  .band__head { max-width: var(--measure); margin-bottom: clamp(2.5rem, 5vw, 4rem); }
  .band__head h2 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem); }
  .band__head p { margin-top: 1.1rem; color: var(--mist); font-size: 1.0625rem; }

  /* Inside <main>, which already supplies max-width and the gutter */
  .contact {
    padding-block: clamp(5rem, 13vh, 9rem);
  }

  .footer {
    display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem;
    justify-content: space-between;
    padding-block: 2rem 2.5rem;
    border-top: 1px solid var(--rule-2);
    color: var(--mist); font-size: .875rem;
  }
}

@layer components {
  /* --- brand ------------------------------------------------------- */
  .brand { display: inline-flex; align-items: center; gap: .7rem; }
  .brand__mark { width: 22px; height: 26px; color: var(--paper); flex: none; }
  .brand__word {
    font-size: 1.0625rem; font-weight: 700;
    letter-spacing: -0.04em;
  }

  .masthead__nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.25rem); }
  .masthead__nav a { font-size: .9375rem; color: var(--mist); transition: color var(--t-fast); }
  .masthead__nav a:hover { color: var(--paper); }
  .masthead__cta {
    color: var(--paper) !important;
    border: 1px solid var(--rule);
    padding: .5rem 1.1rem; border-radius: 999px;
    transition: border-color var(--t-fast), background-color var(--t-fast);
  }
  .masthead__cta:hover { border-color: var(--glass); background: color-mix(in oklab, var(--glass) 8%, transparent); }

  /* --- hero -------------------------------------------------------- */
  .hero__line {
    font-size: clamp(2.6rem, 1.1rem + 6.4vw, 6.5rem);
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 0.98;
    max-width: 17ch;
  }
  .hero__line span.rise { display: block; }
  .hero__line--quiet { color: var(--mist); }

  .hero__sub {
    margin-top: clamp(1.75rem, 3vw, 2.5rem);
    max-width: 54ch;
    font-size: clamp(1.0625rem, 1rem + .35vw, 1.3125rem);
    color: var(--mist);
    line-height: 1.52;
  }

  .hero__actions { margin-top: clamp(2rem, 4vw, 3rem); }
  .hero__actions > span { display: flex; flex-wrap: wrap; gap: .85rem; }

  .hero__meta {
    margin-top: clamp(3rem, 7vw, 5rem);
    padding-top: 0;
    max-width: 40ch;
    color: var(--mist); font-size: .9375rem;
  }

  .btn {
    display: inline-flex; align-items: center;
    padding: .9rem 1.6rem; border-radius: 999px;
    background: var(--paper); color: var(--ink);
    font-weight: 600; font-size: .9375rem; letter-spacing: -0.01em;
    transition: transform var(--t-fast), background-color var(--t-fast);
  }
  .btn:hover { transform: translateY(-2px); background: #fff; }

  .btn--ghost {
    background: transparent; color: var(--paper);
    border: 1px solid var(--rule);
  }
  .btn--ghost:hover { background: color-mix(in oklab, var(--glass) 8%, transparent); border-color: var(--glass); }

  /* --- service rows ------------------------------------------------ */
  .rows { border-top: 1px solid var(--rule); }
  .row { border-bottom: 1px solid var(--rule); }

  .row__head {
    all: unset;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
    align-items: start; gap: clamp(1rem, 4vw, 3.5rem);
    width: 100%; padding-block: clamp(1.6rem, 3vw, 2.4rem);
    cursor: pointer;
    transition: opacity var(--t-fast);
  }
  .row__head:focus-visible { outline: 2px solid var(--glass); outline-offset: -4px; }

  .row__title {
    font-size: clamp(1.25rem, .95rem + 1.1vw, 1.875rem);
    font-weight: 600; letter-spacing: -0.03em; line-height: 1.12;
  }
  .row__blurb { color: var(--mist); font-size: 1rem; line-height: 1.5; padding-top: .2rem; }

  .row__sign { position: relative; width: 15px; height: 15px; margin-top: .55rem; flex: none; }
  .row__sign::before, .row__sign::after {
    content: ""; position: absolute; inset: 0; margin: auto;
    background: var(--glass);
  }
  .row__sign::before { width: 15px; height: 1.5px; }
  .row__sign::after  { width: 1.5px; height: 15px; transition: transform var(--t-med), opacity var(--t-med); }

  .row__head[aria-expanded="true"] .row__sign::after { transform: scaleY(0); opacity: 0; }
  .row__head[aria-expanded="true"] .row__title { color: var(--glass); }

  .row__body { overflow: hidden; }
  .row__inner {
    display: grid;
    /* third track matches the sign column in .row__head so prose aligns to the blurb */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 15px;
    gap: 1rem clamp(1rem, 4vw, 3.5rem);
    padding-bottom: clamp(1.75rem, 3.5vw, 2.75rem);
  }
  .row__inner > p {
    grid-column: 2;
    max-width: var(--measure);
    color: var(--mist);
    margin: 0;
  }

  /* --- figures ----------------------------------------------------- */
  .figures {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: clamp(1.5rem, 3vw, 2rem);
    margin: 0 0 clamp(3rem, 6vw, 4.5rem);
    padding-block: 0 clamp(1.75rem, 3vw, 2.25rem);
  }
  .figures dt { color: var(--mist); font-size: .875rem; letter-spacing: 0; }
  .figures dd {
    margin: .5rem 0 0;
    font-size: clamp(2.1rem, 1.3rem + 2.6vw, 3.25rem);
    font-weight: 600; letter-spacing: -0.045em; line-height: 1;
    color: var(--glass);
  }
  .figures div:last-child dd { color: var(--brass); }

  .prose { max-width: var(--measure); }
  .prose p + p { margin-top: 1.15rem; }
  .prose p { color: var(--mist); }

  /* --- approach ---------------------------------------------------- */
  /* Six terms: a deliberate 3x2, stepping to 2x3 then 1 column */
  .terms {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(2.25rem, 4vw, 3.5rem) clamp(2rem, 4vw, 4rem);
  }
  .term { padding-top: 1.4rem; border-top: 1px solid var(--rule); }
  .term h3 { font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.025em; }
  .term p { margin-top: .75rem; color: var(--mist); max-width: 42ch; }

  /* --- scale switcher + topology ----------------------------------- */
  .scaler__switch {
    position: relative; display: inline-flex; gap: .25rem;
    padding: .3rem; margin-bottom: clamp(2rem, 4vw, 3rem);
    border: 1px solid var(--rule); border-radius: 999px;
    background: color-mix(in oklab, var(--ink) 60%, transparent);
  }
  .scaler__switch button {
    all: unset; position: relative; z-index: 1;
    padding: .6rem 1.15rem; border-radius: 999px; cursor: pointer;
    font-size: .9375rem; font-weight: 500; color: var(--mist);
    transition: color var(--t-fast);
    white-space: nowrap;
  }
  .scaler__switch button:hover { color: var(--paper); }
  .scaler__switch button[aria-selected="true"] { color: var(--ink); font-weight: 600; }
  .scaler__switch button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
  .scaler__thumb {
    position: absolute; z-index: 0; top: .3rem; bottom: .3rem; left: .3rem;
    width: 0; border-radius: 999px;
    background: linear-gradient(120deg, var(--cyan), var(--glass));
    transition: transform var(--t-med), width var(--t-med);
  }

  .scaler__stage {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem); align-items: start;
  }
  .topo { width: 100%; height: auto; overflow: visible; }
  .topo__links path {
    stroke: url(#linkGrad); stroke-width: 1.4;
    opacity: 0; transition: opacity var(--t-med);
  }
  .topo__links path.on { opacity: 1; }
  .topo g.node {
    opacity: 0; transform-box: fill-box; transform-origin: center;
    transition: opacity var(--t-med), transform var(--t-med);
  }
  .topo g.node.on { opacity: 1; }
  .topo g.node rect, .topo g.node circle {
    fill: var(--ink-3); stroke: var(--rule-3); stroke-width: 1;
  }
  .topo g.node.core rect { fill: var(--deep); stroke: var(--cyan); }
  /* The SaaS tier is where the business actually runs, so it reads brightest */
  .topo g.node.saas rect {
    fill: color-mix(in oklab, var(--teal) 26%, var(--ink-2));
    stroke: var(--cyan); stroke-opacity: .55;
  }
  .topo g.node text {
    fill: var(--mist); font-size: 11px; font-weight: 500;
    text-anchor: middle; letter-spacing: 0;
  }
  .topo g.node.core text, .topo g.node.saas text { fill: var(--paper); }

  .topo__layers text {
    fill: var(--cyan); font-size: 10.5px; font-weight: 600;
    text-anchor: middle; opacity: .85;
  }
  .topo__layers line { stroke: var(--rule); stroke-width: 1; }

  .scaler__panel[hidden] { display: none; }
  .scaler__lede { color: var(--paper); font-size: 1.0625rem; line-height: 1.5; max-width: 46ch; }
  .ticks { margin-top: 1.5rem; display: grid; gap: .7rem; }
  .ticks li {
    position: relative; padding-left: 1.6rem;
    color: var(--mist); font-size: .9375rem; line-height: 1.45;
  }
  .ticks li::before {
    content: ""; position: absolute; left: 0; top: .5em;
    width: 9px; height: 1.5px; background: var(--cyan);
  }

  /* --- tech stack --------------------------------------------------- */
  .stack {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: clamp(2rem, 4vw, 3rem) clamp(2rem, 4vw, 4rem);
  }
  .stack__group { padding-top: 1.3rem; border-top: 1px solid var(--rule); }
  .stack__group h3 {
    font-size: 1.0625rem; font-weight: 600; color: var(--glass);
    letter-spacing: -0.02em; margin-bottom: 1.1rem;
  }
  .chips { display: flex; flex-wrap: wrap; gap: .45rem; }
  .chips li {
    padding: .4rem .8rem; border-radius: 999px;
    border: 1px solid var(--rule-2);
    background: color-mix(in oklab, var(--ink-2) 70%, transparent);
    color: var(--mist); font-size: .875rem; line-height: 1.2;
    transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
  }
  .chips li:hover {
    color: var(--paper); border-color: var(--rule-3);
    background: color-mix(in oklab, var(--cyan) 10%, transparent);
  }

  .vendors {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: clamp(1.5rem, 4vw, 3rem);
    margin-top: clamp(2.5rem, 5vw, 4rem); padding-top: clamp(2rem, 4vw, 3rem);
  }
  .vendors img { height: 30px; width: auto; opacity: .72; filter: grayscale(1); transition: opacity var(--t-fast), filter var(--t-fast); }
  .vendors img:hover { opacity: 1; filter: none; }

  /* --- workflow explorer -------------------------------------------- */
  .wf {
    display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 3.5rem); align-items: start;
  }
  .wf__list { display: grid; gap: .5rem; }
  .wf__tab {
    all: unset; box-sizing: border-box; display: block; cursor: pointer;
    padding: .9rem 1.1rem; border-radius: 10px;
    border: 1px solid var(--rule-2);
    transition: border-color var(--t-fast), background-color var(--t-fast);
  }
  .wf__tab:hover { border-color: var(--rule-3); background: color-mix(in oklab, var(--cyan) 6%, transparent); }
  .wf__tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
  .wf__tab[aria-pressed="true"] {
    border-color: var(--cyan);
    background: color-mix(in oklab, var(--cyan) 12%, transparent);
  }
  .wf__tabName { display: block; font-size: .9375rem; font-weight: 600; color: var(--paper); }
  .wf__tabMeta { display: block; margin-top: .25rem; font-size: .8125rem; color: var(--mist); }
  .wf__tab[aria-pressed="true"] .wf__tabMeta { color: var(--glass); }

  .wf__summary { color: var(--paper); font-size: 1.0625rem; line-height: 1.5; max-width: 58ch; }

  .wf__deltas {
    display: flex; flex-wrap: wrap; gap: clamp(1.5rem, 4vw, 3.5rem);
    margin: 1.75rem 0 2rem; padding: 0;
  }
  .wf__deltas span { display: block; font-size: .8125rem; color: var(--mist); margin-bottom: .3rem; }
  .wf__deltas strong { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.015em; }
  .wf__deltas .was { color: var(--mist); text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--mist) 50%, transparent); }
  .wf__deltas .now { color: var(--cyan); }

  .wf__steps { display: grid; gap: 0; counter-reset: wfstep; }
  .wf__steps li {
    position: relative; display: grid;
    grid-template-columns: 10.5rem minmax(0, 1fr);
    gap: 1rem; align-items: baseline;
    padding: .7rem 0 .7rem 1.6rem;
    border-left: 1px solid var(--rule);
    opacity: 0; transform: translateX(-6px);
  }
  .wf__steps.in li {
    opacity: 1; transform: none;
    transition: opacity 420ms ease var(--d), transform 420ms ease var(--d);
  }
  .wf__steps li::before {
    content: ""; position: absolute; left: -4.5px; top: 1.25rem;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ink); border: 1.5px solid var(--cyan);
  }
  .wf__steps li:last-child::after {
    content: ""; position: absolute; left: -1px; top: 1.4rem; bottom: 0;
    width: 1px; background: var(--ink);
  }
  .wf__sys {
    font-size: .8125rem; font-weight: 600; color: var(--glass);
    padding: .2rem .6rem; border-radius: 5px;
    background: color-mix(in oklab, var(--teal) 18%, transparent);
    justify-self: start;
  }
  .wf__act { font-size: .9375rem; color: var(--mist); line-height: 1.45; }

  .wf__prompt {
    margin-top: 2rem; border: 1px solid var(--rule);
    border-radius: 12px; overflow: hidden;
    background: color-mix(in oklab, var(--ink) 70%, #000);
  }
  .wf__promptHead {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--rule-2);
    background: color-mix(in oklab, var(--cyan) 7%, transparent);
  }
  .wf__promptHead h4 { margin: 0; font-size: .875rem; font-weight: 600; color: var(--glass); letter-spacing: 0; }
  .wf__copy {
    all: unset; cursor: pointer; white-space: nowrap;
    font-size: .8125rem; font-weight: 600; color: var(--cyan);
    padding: .35rem .8rem; border-radius: 999px;
    border: 1px solid var(--rule-3);
    transition: background-color var(--t-fast);
  }
  .wf__copy:hover { background: color-mix(in oklab, var(--cyan) 14%, transparent); }
  .wf__copy:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
  .wf__prompt pre {
    margin: 0; padding: 1.1rem; overflow-x: auto;
    max-height: 22rem; overflow-y: auto;
  }
  .wf__prompt code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: .8125rem; line-height: 1.6; color: var(--paper);
    white-space: pre-wrap; word-break: break-word;
  }

  /* --- gantt -------------------------------------------------------- */
  .gantt { display: grid; gap: 0; }
  .gantt__scale {
    display: grid; grid-template-columns: var(--labelw) 1fr;
    gap: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--rule);
    color: var(--mist); font-size: .8125rem;
  }
  .gantt__weeks { display: grid; grid-template-columns: repeat(3, 1fr); }
  .gantt__weeks span { border-left: 1px solid var(--rule-2); padding-left: .6rem; }
  .gantt__weeks span:first-child { border-left: 0; padding-left: 0; }

  .gantt__row {
    display: grid; grid-template-columns: var(--labelw) 1fr;
    gap: 1rem; align-items: center;
    padding-block: .6rem; border-bottom: 1px solid var(--rule-2);
    transition: background-color var(--t-fast);
  }
  .gantt__row:hover { background: color-mix(in oklab, var(--cyan) 6%, transparent); }
  .gantt__name { font-size: .9375rem; color: var(--paper); font-weight: 500; }
  .gantt__lane { position: relative; height: 34px; }
  /* One rule per working day: a single-line gradient tiled 15 times.
     A repeating-gradient here would re-tile inside each tile. */
  .gantt__lane::before {
    content: ""; position: absolute; inset: 0;
    background-image: linear-gradient(90deg, var(--rule-2) 0 1px, transparent 1px);
    background-size: calc(100% / 15) 100%;
  }
  .gantt__bar {
    position: absolute; top: 6px; bottom: 6px;
    border-radius: 4px;
    background: linear-gradient(100deg, var(--deep), var(--teal));
    transform-origin: left center; transform: scaleX(0);
    transition: transform 620ms cubic-bezier(.16,.84,.26,1), filter var(--t-fast);
    cursor: default;
  }
  .gantt.in .gantt__bar { transform: scaleX(1); }
  .gantt__row:hover .gantt__bar { filter: brightness(1.35); }
  .gantt__bar[data-key="security"] { background: linear-gradient(100deg, var(--teal), var(--cyan)); }
  .gantt__days {
    font-size: .8125rem; color: var(--mist); white-space: nowrap;
    padding-left: .6rem;
  }
  .gantt__detail {
    grid-column: 2; font-size: .875rem; color: var(--mist);
    max-width: 62ch; padding-bottom: .4rem;
    opacity: 0; height: 0; overflow: hidden;
    transition: opacity var(--t-fast);
  }
  .gantt__row:hover .gantt__detail,
  .gantt__row:focus-within .gantt__detail { opacity: 1; height: auto; padding-top: .4rem; }
  .gantt__note { margin-top: 1.75rem; color: var(--mist); font-size: .9375rem; max-width: var(--measure); }

  /* --- cost calculator ---------------------------------------------- */
  .calc { display: grid; gap: clamp(2rem, 4vw, 3rem); }
  .calc__control { max-width: 46rem; }
  .calc__control label { display: block; font-size: .9375rem; color: var(--mist); margin-bottom: 1rem; }

  .calc__control input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--cyan) var(--pct, 12%), var(--rule) var(--pct, 12%));
    cursor: pointer;
  }
  .calc__control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--paper); border: 3px solid var(--cyan);
    cursor: grab;
  }
  .calc__control input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--paper); border: 3px solid var(--cyan); cursor: grab;
  }
  .calc__control input[type="range"]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 6px; }

  #hoursOut {
    display: block; margin-top: 1rem;
    font-size: clamp(1.5rem, 1rem + 1.8vw, 2.25rem);
    font-weight: 600; letter-spacing: -0.035em; color: var(--cyan);
  }
  .calc__hint { margin-top: .5rem; color: var(--mist); font-size: .875rem; }

  .calc__bars { display: grid; gap: 1.25rem; max-width: 56rem; }
  .calc__bar { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: 1rem; align-items: center; }
  .calc__barLabel { font-size: .9375rem; color: var(--mist); }
  .calc__track { height: 30px; background: color-mix(in oklab, var(--glass) 6%, transparent); border-radius: 4px; overflow: hidden; }
  .calc__track i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width var(--t-med); }
  .calc__bar--nr .calc__track i { background: linear-gradient(90deg, var(--teal), var(--cyan)); }
  .calc__bar--ih .calc__track i { background: linear-gradient(90deg, var(--ink-4), var(--mist)); }
  .calc__val { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; min-width: 6.5rem; text-align: right; }
  .calc__bar--nr .calc__val { color: var(--cyan); }
  .calc__bar--ih .calc__val { color: var(--paper); }

  /* Past the crossover hiring is the better answer, so the emphasis moves with it.
     The brand colour should never sit on the more expensive option. */
  .calc__bars.hire .calc__bar--nr .calc__track i { background: linear-gradient(90deg, var(--ink-4), #4A5C64); }
  .calc__bars.hire .calc__bar--nr .calc__val { color: var(--mist); }
  .calc__bars.hire .calc__bar--ih .calc__track i { background: linear-gradient(90deg, #8A6433, var(--brass)); }
  .calc__bars.hire .calc__bar--ih .calc__val { color: var(--brass); }

  .calc__verdict {
    font-size: clamp(1.0625rem, 1rem + .5vw, 1.375rem);
    line-height: 1.45; max-width: 54ch; color: var(--paper);
    padding-left: 1.1rem; border-left: 2px solid var(--cyan);
  }
  .calc__verdict strong { color: var(--cyan); font-weight: 600; }
  .calc__verdict.hire { border-left-color: var(--brass); }
  .calc__verdict.hire strong { color: var(--brass); }

  .calc__assump {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem clamp(1.5rem, 3vw, 3rem);
    padding-top: 1.75rem;
  }
  .calc__assump dt { font-size: .8125rem; color: var(--cyan); margin-bottom: .35rem; }
  .calc__assump dd { margin: 0; font-size: .9375rem; color: var(--mist); line-height: 1.45; }
  .calc__source { font-size: .8125rem; color: var(--mist); max-width: var(--measure); opacity: .8; }

  /* --- contact ----------------------------------------------------- */
  .contact h2 {
    font-size: clamp(2.1rem, 1.1rem + 4.2vw, 4.5rem);
    line-height: 1.02;
  }
  .contact > p {
    margin-top: 1.5rem; max-width: 52ch; color: var(--mist);
    font-size: clamp(1rem, .96rem + .3vw, 1.1875rem);
  }
  .mail {
    display: inline-block; margin-top: clamp(2.25rem, 5vw, 3.5rem);
    font-size: clamp(1.25rem, .9rem + 1.6vw, 2.25rem);
    font-weight: 600; letter-spacing: -0.035em;
    color: var(--brass);
    padding-bottom: .25rem;
    background-image: linear-gradient(var(--brass), var(--brass));
    background-size: 100% 1px; background-position: 0 100%; background-repeat: no-repeat;
    transition: background-size var(--t-med);
  }
  .mail:hover { background-size: 0% 1px; }
  .contact__meta { margin-top: 2.5rem; color: var(--mist); font-size: .9375rem; }
}

@layer motion {
  /* One orchestrated arrival: lines clip up in sequence, then nothing else moves on scroll */
  .rise { display: block; overflow: hidden; }
  .rise > span { display: block; }

  @media (prefers-reduced-motion: no-preference) {
    .rise > span {
      transform: translateY(105%);
      opacity: 0;
      animation: rise var(--t-slow) forwards;
      animation-delay: calc(var(--i, 0) * 85ms + 120ms);
    }
    @keyframes rise {
      to { transform: translateY(0); opacity: 1; }
    }

    .row__body { transition: height var(--t-med); }
  }
}

@layer responsive {
  @media (width <= 980px) {
    .scaler__stage { grid-template-columns: minmax(0, 1fr); }
    .topo { max-width: 620px; }
    .wf { grid-template-columns: minmax(0, 1fr); }
    .wf__list { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  }

  @media (width <= 900px) {

    :root { --labelw: 9rem; }
    .gantt__name { font-size: .875rem; }
    .gantt__days { display: none; }
    .calc__bar { grid-template-columns: 1fr auto; }
    .calc__bar .calc__track { grid-column: 1 / -1; grid-row: 2; }

    .row__head {
      grid-template-columns: minmax(0, 1fr) auto;
      gap: .75rem 1.5rem;
      align-items: center;
    }
    .row__blurb { grid-column: 1 / -1; padding-top: 0; font-size: .9375rem; }
    .row__sign { margin-top: 0; }
    .row__inner { grid-template-columns: minmax(0, 1fr); }
    .row__inner > p { grid-column: 1; }
  }

  @media (width <= 1080px) {
    .terms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  @media (width <= 680px) {
    .terms { grid-template-columns: minmax(0, 1fr); }
  }

  @media (width <= 680px) {
    .scaler__switch { display: grid; grid-template-columns: 1fr; width: 100%; border-radius: 14px; }
    .scaler__switch button { text-align: center; }
    .scaler__thumb { display: none; }
    .scaler__switch button[aria-selected="true"] {
      background: linear-gradient(120deg, var(--cyan), var(--glass)); color: var(--ink);
    }
    :root { --labelw: 7.5rem; }
    .gantt__detail { grid-column: 1 / -1; }

    .wf__steps li { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
    .wf__deltas { gap: 1.25rem; }

    .masthead { flex-wrap: wrap; gap: .85rem; }
    .masthead__nav {
      width: 100%; flex-wrap: wrap; justify-content: flex-start;
      gap: .5rem .9rem;
    }
    .masthead__nav a { font-size: .8125rem; }
    .masthead__cta { padding: .4rem .85rem; margin-left: auto; }

    .hero__line { max-width: none; letter-spacing: -0.04em; }
    .hero__actions > span { flex-direction: column; align-items: stretch; }
    .btn { justify-content: center; }

    .footer { flex-direction: column; gap: .5rem; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn:hover { transform: none; }
  }
}

/* ===================================================================
   Same Tuesday morning — the two-state illustration
=================================================================== */
@layer components {
  .scene__bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: clamp(1.25rem, 2.5vw, 2rem);
  }

  .scene__switch {
    position: relative; display: inline-flex; gap: .25rem; padding: .3rem;
    border: 1px solid var(--rule); border-radius: 999px;
    background: color-mix(in oklab, var(--ink) 55%, transparent);
  }
  .scene__switch button {
    all: unset; position: relative; z-index: 1; cursor: pointer;
    padding: .55rem 1.1rem; border-radius: 999px; white-space: nowrap;
    font-size: .9375rem; font-weight: 500; color: var(--mist);
    transition: color var(--t-fast);
  }
  .scene__switch button:hover { color: var(--paper); }
  .scene__switch button[aria-selected="true"] { color: var(--ink); font-weight: 600; }
  .scene__switch button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
  .scene__thumb {
    position: absolute; z-index: 0; top: .3rem; bottom: .3rem; left: .3rem; width: 0;
    border-radius: 999px; background: linear-gradient(120deg, var(--cyan), var(--glass));
    transition: transform var(--t-med), width var(--t-med);
  }

  .scene__sound {
    all: unset; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
    padding: .5rem .95rem; border-radius: 999px; border: 1px solid var(--rule-2);
    font-size: .8125rem; color: var(--mist);
    transition: color var(--t-fast), border-color var(--t-fast);
  }
  .scene__sound:hover { color: var(--paper); border-color: var(--rule-3); }
  .scene__sound:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
  .scene__sound .waves { opacity: 0; transition: opacity var(--t-fast); }
  .scene__sound .slash { opacity: .8; transition: opacity var(--t-fast); }
  .scene__sound[aria-pressed="true"] { color: var(--cyan); border-color: var(--rule-3); }
  .scene__sound[aria-pressed="true"] .waves { opacity: 1; }
  .scene__sound[aria-pressed="true"] .slash { opacity: 0; }

  .scene__stage {
    position: relative; border-radius: 14px; overflow: hidden;
    border: 1px solid var(--rule);
    background: var(--ink);
  }
  .scene__svg { display: block; width: 100%; height: auto; }

  .sc { transition: opacity 760ms cubic-bezier(.4,0,.2,1); }
  .sc--calm  { opacity: 0; }
  [data-state="calm"] .sc--chaos { opacity: 0; }
  [data-state="calm"] .sc--calm  { opacity: 1; }

  /* chaos: the pile keeps arriving */
  .cards rect { transform-box: fill-box; transform-origin: center; }
  .card { opacity: 0; }
  [data-state="chaos"] .card {
    animation: cardIn 620ms cubic-bezier(.2,.9,.3,1) forwards;
    animation-delay: var(--d);
  }
  @keyframes cardIn {
    from { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(.86); }
    to   { opacity: 1; transform: none; }
  }
  .counter__n { fill: #B4473C; font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
  .counter__l { fill: var(--mist); font-size: 13px; }
  [data-state="chaos"] .err { animation: errBlink 1.5s steps(1) infinite; }
  @keyframes errBlink { 0%,72% { opacity: 1; } 73%,100% { opacity: .28; } }

  /* calm: nothing hurries */
  .steam path { stroke-dasharray: 3 7; }
  [data-state="calm"] .steam path { animation: steam 4.4s linear infinite; animation-delay: var(--d); }
  @keyframes steam { to { stroke-dashoffset: -40; } }

  [data-state="calm"] .firewash { animation: fire 5.5s ease-in-out infinite; }
  @keyframes fire { 0%,100% { opacity: .82; } 43% { opacity: 1; } 68% { opacity: .9; } }

  [data-state="calm"] .dog { animation: breathe 4.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
  @keyframes breathe { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.018); } }

  .zzz path { opacity: 0; }
  [data-state="calm"] .zzz path { animation: zzz 5.2s ease-out infinite; animation-delay: var(--d); }
  @keyframes zzz {
    0% { opacity: 0; transform: translate(0,0) scale(.7); }
    18% { opacity: .5; }
    70%,100% { opacity: 0; transform: translate(14px,-34px) scale(1.1); }
  }

  [data-state="calm"] .pad { animation: padDown 11s ease-in-out infinite; transform-box: fill-box; transform-origin: 0% 50%; }
  @keyframes padDown {
    0%,52% { transform: none; }
    66%,94% { transform: translate(-16px, 46px) rotate(-14deg); }
    100% { transform: none; }
  }
  [data-state="calm"] .arm { animation: armDown 11s ease-in-out infinite; }
  @keyframes armDown {
    0%,52% { transform: none; }
    66%,94% { transform: translate(-10px, 26px); }
    100% { transform: none; }
  }
  .padlines rect { transform-box: fill-box; transform-origin: left center; }
  [data-state="calm"] .padlines rect { animation: typeIn 11s ease-out infinite; animation-delay: var(--d); }
  @keyframes typeIn {
    0%,3% { transform: scaleX(0); opacity: 0; }
    12%,58% { transform: scaleX(1); opacity: 1; }
    64%,100% { transform: scaleX(1); opacity: .25; }
  }
  [data-state="calm"] .padchips rect { animation: chipTap 11s ease-out infinite; animation-delay: var(--d); }
  @keyframes chipTap {
    0%,30% { fill: #214852; }
    36%,50% { fill: #5EC4D9; }
    58%,100% { fill: #214852; }
  }

  .glints line { stroke-linecap: round; }
  [data-state="calm"] .glints line { animation: glint 7s ease-in-out infinite; animation-delay: var(--d); }
  @keyframes glint { 0%,100% { opacity: .1; } 50% { opacity: .42; } }

  [data-state="calm"] .wetglass .wd { animation: wdRun var(--t) linear infinite; animation-delay: var(--d); }
  @keyframes wdRun {
    0% { transform: translateY(0); opacity: 0; }
    8% { opacity: .55; }
    92% { opacity: .5; }
    100% { transform: translateY(var(--dy)); opacity: 0; }
  }

  .scene__cap {
    margin-top: 1.25rem; max-width: 62ch; color: var(--mist);
    font-size: .9375rem; line-height: 1.55; min-height: 3em;
  }

  @media (prefers-reduced-motion: reduce) {
    .card, .zzz path, .padlines rect { opacity: 1 !important; animation: none !important; }
    .sc, .pad, .arm, .dog, .firewash, .steam path, .glints line,
    .wetglass .wd, .err, .padchips rect { animation: none !important; }
  }
}
