/* ==========================================================================
   Ondaline — Waterline
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  --paper: #EEF1EC;
  --paper-2: #E1E6E0;
  --ink: #1A2BD8;
  --ink-soft: #4D59C4;
  --rule: #B9C0EA;
  --flood: #1A2BD8;
  --flood-deep: #1220B0;
  --flood-rule: #6F7BF0;
  --on-flood: #FFFFFF;
  --on-flood-soft: #C7CEFF;
  --accent: #FFAE1F;
  --on-accent: #0B1040;
  --focus-paper: #1A2BD8;
  --focus-flood: #FFAE1F;

  --p1-ground: #D9F2EC; --p1-ink: #1A2BD8; --p1-spot: #008E7C;
  --p2-ground: #1A102E; --p2-ink: #FFAE1F; --p2-spot: #FF4F7B; --p2-star: #FFE9C4;
  --p3-ground: #12492F; --p3-ink: #EAF4D3; --p3-spot: #F5B8CC;
  --p4-ground: #EE4B2B; --p4-ink: #FFF1E2; --p4-spot: #2A120C;
  --p5-ground: #0B0B16; --p5-ink: #F2F0FF; --p5-spot: #B9A4FF;
  --p6-ground: #FFC733; --p6-ink: #0E1330; --p6-spot: #FFFFFF;

  --hero-air: var(--ink);
  --hero-sub: var(--paper);

  --font-sans: "Archivo", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px; --s10: 72px;
  --bw: 1.5px;
  --bw-heavy: 3px;

  --dur-press: 120ms;
  --dur-state: 240ms;
  --dur-move: 480ms;
  --dur-sheet: 640ms;
  --dur-settle: 600ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --ease-bob: cubic-bezier(0.34, 1.45, 0.64, 1);

  /* layout (folded defaults) */
  --m: 20px;
  --ml: max(var(--m), env(safe-area-inset-left));
  --mr: max(var(--m), env(safe-area-inset-right));
  --pt: calc(env(safe-area-inset-top) + 16px);
  --pb: calc(env(safe-area-inset-bottom) + 16px);
  --sb: env(safe-area-inset-bottom);

  /* type sizes (folded) */
  --fs-hull-xl: 34px;
  --fs-hull-l: 30px;
  --fs-hull-m: 22px;
  --fs-lead: 27px; --lh-lead: 1.08;
  --fs-statement: 22px; --lh-statement: 1.14;
  --fs-table: 56px;
  --fs-title: 16px;
  --fs-body: 15px; --lh-body: 1.45;
  --fs-body-s: 13px; --lh-body-s: 1.4;
  --fs-button: 13px;
  --fs-meter: 11px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0A0E36;
    --paper-2: #141A52;
    --ink: #E6EAFF;
    --ink-soft: #A3ACEC;
    --rule: #2B3478;
    --flood: #2538F0;
    --flood-deep: #1826B8;
    --flood-rule: #7381FF;
    --on-flood: #FFFFFF;
    --on-flood-soft: #D2D7FF;
    --accent: #FFB52E;
    --on-accent: #0B1040;
    --focus-paper: #FFB52E;
    --focus-flood: #FFB52E;
    --p1-ground: #C5E9E1; --p1-ink: #1A2BD8; --p1-spot: #008E7C;
    --p2-ground: #1A102E; --p2-ink: #FFAE1F; --p2-spot: #FF4F7B; --p2-star: #FFE9C4;
    --p3-ground: #12492F; --p3-ink: #EAF4D3; --p3-spot: #F5B8CC;
    --p4-ground: #EE4B2B; --p4-ink: #FFF1E2; --p4-spot: #2A120C;
    --p5-ground: #0B0B16; --p5-ink: #F2F0FF; --p5-spot: #B9A4FF;
    --p6-ground: #F5BC2B; --p6-ink: #0E1330; --p6-spot: #FFFFFF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0A0E36;
  --paper-2: #141A52;
  --ink: #E6EAFF;
  --ink-soft: #A3ACEC;
  --rule: #2B3478;
  --flood: #2538F0;
  --flood-deep: #1826B8;
  --flood-rule: #7381FF;
  --on-flood: #FFFFFF;
  --on-flood-soft: #D2D7FF;
  --accent: #FFB52E;
  --on-accent: #0B1040;
  --focus-paper: #FFB52E;
  --focus-flood: #FFB52E;
  --p1-ground: #C5E9E1; --p1-ink: #1A2BD8; --p1-spot: #008E7C;
  --p2-ground: #1A102E; --p2-ink: #FFAE1F; --p2-spot: #FF4F7B; --p2-star: #FFE9C4;
  --p3-ground: #12492F; --p3-ink: #EAF4D3; --p3-spot: #F5B8CC;
  --p4-ground: #EE4B2B; --p4-ink: #FFF1E2; --p4-spot: #2A120C;
  --p5-ground: #0B0B16; --p5-ink: #F2F0FF; --p5-spot: #B9A4FF;
  --p6-ground: #F5BC2B; --p6-ink: #0E1330; --p6-spot: #FFFFFF;
  color-scheme: dark;
}

@media (min-width: 560px) {
  :root {
    --m: 28px;
    --pt: calc(env(safe-area-inset-top) + 20px);
    --pb: calc(env(safe-area-inset-bottom) + 24px);
    --fs-hull-xl: 46px;
    --fs-hull-l: 40px;
    --fs-hull-m: 24px;
    --fs-lead: 38px; --lh-lead: 1.05;
    --fs-statement: 32px; --lh-statement: 1.1;
    --fs-table: 76px;
    --fs-title: 18px;
    --fs-body: 16px; --lh-body: 1.5;
    --fs-body-s: 14px; --lh-body-s: 1.45;
    --fs-button: 14px;
    --fs-meter: 12px;
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-synthesis: none;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-tap-highlight-color: transparent;
}
p, h1, h2, h3, ol, ul, dl, dd, figure, pre, address { margin: 0; padding: 0; }
ol, ul { list-style: none; }
address { font-style: normal; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
input, textarea { font: inherit; color: inherit; }
canvas { display: block; }
svg { display: block; }

.on-paper { --fg: var(--ink); --fg-soft: var(--ink-soft); --line: var(--rule); --line-strong: var(--ink); --focus: var(--focus-paper); --bg: var(--paper); color: var(--fg); }
.on-flood { --fg: var(--on-flood); --fg-soft: var(--on-flood-soft); --line: var(--flood-rule); --line-strong: var(--on-flood); --focus: var(--focus-flood); --bg: var(--flood); color: var(--fg); }

:focus-visible { outline: 3px solid var(--focus, var(--focus-paper)); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- 3. Type ---------- */
.meter {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--fs-meter);
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.soft { color: var(--fg-soft); }
.hull-xl, .hull-l, .hull-m {
  font-family: var(--font-sans);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.02em;
  text-rendering: optimizeLegibility;
  text-wrap: balance;
}
.hull-xl { font-size: var(--fs-hull-xl); line-height: 0.96; }
.hull-l { font-size: var(--fs-hull-l); line-height: 1; }
.hull-m { font-size: var(--fs-hull-m); line-height: 1.1; font-stretch: 112%; font-weight: 700; letter-spacing: -0.01em; text-transform: lowercase; }
.lead {
  font-weight: 500;
  font-stretch: 100%;
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  letter-spacing: -0.015em;
  text-wrap: balance;
  text-rendering: optimizeLegibility;
}
.lead em { font-style: italic; font-weight: 500; }
.table-xl {
  font-weight: 900;
  font-stretch: 62%;
  font-size: var(--fs-table);
  line-height: 0.9;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums lining-nums;
}
.table-xl small { font-size: 50%; font-weight: 900; vertical-align: 0.62em; line-height: 0; }
.title { font-weight: 700; font-stretch: 110%; font-size: var(--fs-title); line-height: 1.2; text-wrap: balance; }
.body { font-size: var(--fs-body); line-height: var(--lh-body); text-wrap: pretty; max-width: 62ch; }
.body-s { font-size: var(--fs-body-s); line-height: var(--lh-body-s); letter-spacing: 0.005em; text-wrap: pretty; }

/* ---------- 4. Shared components ---------- */
.meter-row { display: flex; align-items: center; justify-content: space-between; height: 44px; gap: 8px; }
.meter-row__end { display: flex; align-items: center; gap: 8px; }

.round {
  position: relative;
  flex: none;
  width: 44px; height: 44px;
  border-radius: 999px;
  display: inline-grid; place-items: center;
  color: var(--fg);
  transition: transform var(--dur-state) var(--ease-bob), opacity var(--dur-state);
}
.round::before {
  content: ""; position: absolute; inset: 2px; border-radius: 999px;
  box-shadow: inset 0 0 0 var(--bw) var(--line-strong);
  transition: background-color var(--dur-state) var(--ease-out);
}
.round svg { position: relative; width: 16px; height: 16px; transition: transform var(--dur-state) var(--ease-out), color var(--dur-state); }
.round:active { transform: scale(0.92); transition-duration: var(--dur-press); transition-timing-function: ease-out; }
.round:disabled { opacity: 0.35; pointer-events: none; }
@media (hover: hover) {
  .round:hover::before { background: var(--fg); }
  .round:hover svg { color: var(--bg); }
}
.theme-toggle svg { transform: rotate(var(--rot, 0deg)); }

.pill {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 var(--bw) var(--line-strong);
  color: var(--fg);
  font-weight: 700; font-stretch: 112%; font-size: var(--fs-button); line-height: 1;
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  transition: transform var(--dur-state) var(--ease-bob), background-color var(--dur-state) var(--ease-out), color var(--dur-state) var(--ease-out);
}
.pill .arrow { width: 14px; height: 14px; }
.pill:active { transform: scale(0.96); transition-duration: var(--dur-press); transition-timing-function: ease-out; }
@media (hover: hover) {
  .pill:not(.pill--primary):hover { background: var(--fg); color: var(--bg); }
}
.pill--primary {
  height: 48px; padding: 0 24px;
  background: var(--accent); color: var(--on-accent);
  box-shadow: none;
}
.pill--primary .pill__label { display: inline-block; text-align: center; transition: font-stretch var(--dur-state) var(--ease-out); }
@media (hover: hover) { .pill--primary:hover .pill__label { font-stretch: 125%; } }
.pill--primary:focus-visible { outline-color: var(--focus-flood); }

.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 var(--bw) var(--line-strong);
  color: var(--fg);
  font-weight: 700; font-size: var(--fs-button); line-height: 1; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  transition: background-color var(--dur-state) var(--ease-out), color var(--dur-state) var(--ease-out), box-shadow var(--dur-state) var(--ease-out), transform var(--dur-state) var(--ease-bob);
}
.chip::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }
.chip__l { font-stretch: 100%; transition: font-stretch var(--dur-state) var(--ease-out); }
.chip__n { font-family: var(--font-mono); font-weight: 400; font-size: 10px; line-height: 1; letter-spacing: 0.04em; position: relative; top: -5px; vertical-align: baseline; }
.chip[aria-pressed="true"] { background: var(--on-flood); color: var(--flood); box-shadow: inset 0 0 0 var(--bw) var(--on-flood); }
.chip[aria-pressed="true"] .chip__l { font-stretch: 118%; }
.chip:active { transform: scale(0.96); transition-duration: var(--dur-press); }
@media (hover: hover) { .chip[aria-pressed="false"]:hover { box-shadow: inset 0 0 0 2.5px var(--line-strong); } }

.rule { display: block; width: 100%; height: 16px; overflow: visible; flex: none; }
.rule path { fill: none; stroke: var(--line-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rule--heavy path { stroke-width: 3; }

.mask { overflow: hidden; }
.roll { display: inline-block; overflow: hidden; vertical-align: top; height: 1.2em; }
.roll > span { display: inline-block; }

/* ---------- 5. Screens scaffold ---------- */
#screens {
  height: 100vh; height: 100dvh;
  overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior: none;
  scrollbar-width: none;
}
#screens::-webkit-scrollbar { display: none; }
#screens.is-locked { overflow: hidden; }
.screen {
  position: relative;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  overflow: clip;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.screen--work, .screen--studio .slab { background: var(--flood); }
.screen--work { background: var(--flood); }

/* ---------- 6. Screen 1: Home ---------- */
.screen--home { --y2: 61vh; }
.hero { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; background: var(--paper); }
.home__meter { position: absolute; top: var(--pt); left: var(--ml); right: var(--mr); z-index: 2; }
.tide {
  position: absolute; right: var(--mr); top: calc(var(--y2) - 25px);
  color: var(--on-flood-soft); text-align: right; z-index: 1; pointer-events: none;
}
.tide__k, .tide__v { display: block; }
.home__lower {
  position: absolute; left: var(--ml); right: var(--mr);
  top: 64%; top: calc(var(--y2) + 24px);
  z-index: 1; pointer-events: none;
  background: transparent;
}
.home__lower .lead { max-width: 340px; color: var(--on-flood); }
.home__lead .ln { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.home__lead .ln > span { display: block; }
.home__para { margin-top: 12px; max-width: 330px; color: var(--on-flood-soft); }
.practice { display: none; }
.home__bottom {
  position: absolute; left: var(--ml); right: var(--mr); bottom: var(--pb);
  height: 48px; display: flex; align-items: center; justify-content: space-between; z-index: 2;
  background: transparent;
}
.home__bottom .soft { color: var(--on-flood-soft); }
@media (max-width: 559.98px) and (max-height: 640px) {
  .home__para2 { display: none; }
}

/* ---------- 7. Screen 2: Work ---------- */
.screen--work {
  display: grid;
  grid-template-columns: var(--ml) minmax(0, 1fr) 44px 8px 44px var(--mr);
  grid-template-rows: var(--pt) 44px 4px 40px 12px minmax(0, 1fr) 12px 44px var(--pb);
}
.work__meter { display: contents; }
.work__label { grid-area: 2 / 2 / 3 / 3; align-self: center; }
.counter { grid-area: 2 / 3 / 3 / 6; justify-self: end; align-self: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.screen--work [data-prev] { grid-area: 8 / 3 / 9 / 4; }
.screen--work [data-next] { grid-area: 8 / 5 / 9 / 6; }
.filters { grid-area: 4 / 2 / 5 / 6; display: flex; gap: 8px; align-items: center; min-width: 0; }
.stage { display: none; }

.track {
  grid-area: 6 / 1 / 7 / -1;
  position: relative;
  min-height: 0;
  display: flex; gap: 12px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--ml);
  padding-inline: var(--ml);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }
.track::after { content: ""; flex: 0 0 56px; }
.card {
  flex: 0 0 calc(100vw - 88px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex; flex-direction: column;
  min-height: 0;
}
.plate { position: relative; background: var(--plate-ground); border-radius: 0; }
.plate > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.card__plate { flex: 1 1 auto; min-height: 180px; transform-origin: 50% 50%; }
.card__caption { flex: none; height: 110px; padding-top: 12px; }
.card__meta { color: var(--on-flood); }
.card__title { margin-top: 6px; white-space: nowrap; font-stretch: 100%; transition: font-stretch var(--dur-move) var(--ease-out); }
.card.is-current .card__title { font-stretch: 125%; }
.card__n { display: none; }
.card__line { margin-top: 8px; max-width: 340px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--on-flood-soft); }

.card__open {
  position: absolute; inset: 0; width: 100%; height: 100%;
  --focus: var(--plate-ui);
  z-index: 2;
}
.card__open:focus-visible { outline: 3px solid var(--plate-ui); outline-offset: -6px; }
.card:not(.is-current) .card__open { visibility: hidden; }
.card__select { display: none; }

.disc {
  position: absolute; right: 12px; bottom: 12px;
  width: 48px; height: 48px; border-radius: 999px;
  background: var(--plate-ui);
  transition: transform var(--dur-state) var(--ease-bob);
}
.disc::before, .disc::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 2px; margin: -1px 0 0 -9px;
  background: var(--plate-ground);
}
.disc::after { transform: rotate(90deg); }
.disc--x::before { transform: rotate(45deg); }
.disc--x::after { transform: rotate(-45deg); }
.card:not(.is-current) .disc { transform: scale(0); transition-duration: var(--dur-press); transition-timing-function: ease-in; }
.card__open:active .disc { transform: scale(0.92); }
@media (hover: hover) { .card__open:hover .disc { transform: scale(1.08); } }

.sheet-buoy { display: none; }

.scrubber { grid-area: 8 / 2 / 9 / 3; position: relative; margin-right: 12px; min-width: 0; height: 44px; }
.scrubber__svg { position: absolute; inset: 0; width: 100%; height: 44px; overflow: visible; }
.scrubber__line { fill: none; stroke: var(--on-flood); stroke-width: 1.5; }
.scrubber__dot { fill: var(--on-flood); stroke: var(--on-flood); stroke-width: 0; transition: fill var(--dur-state), stroke var(--dur-state); }
.scrubber__dot.is-out { fill: transparent; stroke: var(--on-flood-soft); stroke-width: 1.5; }
.scrubber__dot.is-hover { r: 4.5; }
.scrubber__buoy { fill: var(--accent); }
.scrubber__hits { position: absolute; inset: 0; }
.scrubber__hit { position: absolute; top: 0; height: 44px; border-radius: 999px; }
.scrubber__hit:disabled { cursor: default; }

@media (max-width: 559.98px) and (max-height: 640px) {
  .card__caption { height: 92px; }
  .card__line { -webkit-line-clamp: 1; }
}

/* ---------- 8. Screen 3: Studio ---------- */
.screen--studio { display: flex; flex-direction: column; background: var(--paper); }
.studio__paper {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  padding: var(--pt) var(--mr) 0 var(--ml);
}
.studio__paper > * { flex: none; }
.statement { margin-top: 4px; font-size: var(--fs-statement); line-height: var(--lh-statement); max-width: 34ch; }
.stats { display: flex; gap: 24px; align-items: flex-end; height: 67px; }
.stat { display: flex; flex-direction: column; }
.stat .meter { margin-top: 4px; color: var(--ink-soft); }
.stats address { margin-left: auto; text-align: right; color: var(--ink); }
.services__label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.services ol > li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-rows: 20px auto; align-content: start;
  height: 46px; padding-top: 6px;
}
.services ol > li + li { border-top: var(--bw) solid var(--rule); }
.services li .meter { grid-row: 1 / 3; color: var(--ink-soft); line-height: 20px; }
.services li .title { line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.services li .body-s { line-height: 16px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.approach__label { color: var(--ink-soft); line-height: 13px; margin-bottom: 6px; }
.approach li { font-size: var(--fs-body-s); line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); }
.approach li .meter { color: var(--ink-soft); margin-right: 4px; }
.approach li .title { font-size: inherit; font-stretch: 100%; font-weight: 700; color: var(--ink); line-height: inherit; }
.studio__flex { flex: 1 1 auto !important; min-height: 8px; }

.clients {
  position: relative; height: 32px; overflow: hidden;
  border-top: var(--bw) solid var(--ink); border-bottom: var(--bw) solid var(--ink);
  margin-bottom: 9px;
  color: var(--ink);
}
.clients__label {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 1;
  display: flex; align-items: center;
  padding-right: 12px; background: var(--paper); border-right: var(--bw) solid var(--ink);
}
.clients__strip {
  position: absolute; left: 0; top: 0; bottom: 0;
  display: flex; align-items: center; white-space: nowrap;
  padding-left: 92px;
  will-change: transform;
}
.clients__run { white-space: nowrap; }
.clients__run::after { content: ""; }
.clients__strip { animation: marquee var(--marquee-dur, 40s) linear infinite; animation-play-state: paused; }
.screen--studio.is-current .clients__strip { animation-play-state: running; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(var(--marquee-shift, -50%)); } }

.slab-spacer { height: calc(153px + var(--sb)); }

/* slab — folded */
.slab {
  position: absolute; left: 0; right: 0; bottom: 0;
  top: calc(env(safe-area-inset-top) + 64px);
  z-index: 4;
  pointer-events: none;
  background: transparent !important;
  --slab-closed: calc(100% - 153px - var(--sb));
}
.slab__water {
  position: absolute; inset: 0;
  background: var(--flood);
  transform: translateY(var(--slab-closed));
  transition: transform 480ms var(--ease-in-out);
  pointer-events: auto;
}
.slab.is-open .slab__water { transform: translateY(0); transition: transform var(--dur-sheet) var(--ease-out); }
.slab__surface { position: absolute; left: 0; top: -20px; width: 100%; height: 40px; pointer-events: none; }
.slab__sheet {
  position: absolute; left: 0; right: 0; top: 0;
  bottom: calc(153px + var(--sb));
  padding: 20px var(--mr) 12px var(--ml);
  overflow-y: auto;
  visibility: hidden; opacity: 0;
  transition: opacity 200ms, visibility 0s 480ms;
}
.slab.is-open .slab__sheet { visibility: visible; opacity: 1; transition: opacity 300ms 160ms, visibility 0s; }
.draft__head { display: flex; align-items: center; justify-content: space-between; height: 44px; margin-bottom: 8px; }
.draft__head .meter { color: var(--on-flood); }
.slab__reach {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(153px + var(--sb));
  padding: 16px var(--mr) calc(16px + var(--sb)) var(--ml);
  pointer-events: auto;
}
.reach__row { position: relative; display: flex; align-items: center; height: 44px; gap: 8px; }
.email { user-select: all; -webkit-user-select: all; color: var(--on-flood); white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.reach__row .copy-email { margin-left: auto; }
.copied { color: var(--on-flood); opacity: 0; transition: opacity 160ms; white-space: nowrap; }
.copied.is-on { opacity: 1; }
.copy-email .ic-tick { opacity: 0; }
.copy-email.is-done .ic-tick { opacity: 1; }
.copy-email.is-done .ic-copy { opacity: 0; }
.copy-email svg * { transition: opacity 160ms; }
.slab__address { margin-top: 4px; line-height: 13px; color: var(--on-flood-soft); }
.reach__actions { margin-top: 12px; height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reach__note { text-align: right; color: var(--on-flood-soft); }
.slab.is-open .reach__actions { visibility: hidden; }

/* form */
.draft__grid { display: flex; flex-direction: column; gap: 8px; }
.field { position: relative; display: flex; flex-direction: column; }
.field label { color: var(--on-flood-soft); line-height: 13px; margin-bottom: 6px; }
.field input, .field textarea {
  display: block; width: 100%;
  background: transparent; border: 0; border-radius: 0;
  border-bottom: var(--bw) solid var(--on-flood-soft);
  padding: 0; margin: 0;
  height: 36px;
  font-family: var(--font-sans); font-weight: 400; font-size: 16px; line-height: 1.45;
  color: var(--on-flood); caret-color: var(--accent);
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-state), box-shadow var(--dur-state);
}
.field textarea { height: auto; resize: none; padding-top: 6px; min-height: 70px; }
.field input:focus, .field textarea:focus { border-bottom-color: var(--accent); box-shadow: 0 1.5px 0 0 var(--accent); }
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus-flood); outline-offset: 3px; }
@media (hover: hover) { .field input:hover, .field textarea:hover { border-bottom-color: var(--on-flood); } }
.field.is-invalid input, .field.is-invalid textarea { border-bottom-color: var(--accent); box-shadow: 0 1.5px 0 0 var(--accent); }
.field__err { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; color: var(--on-flood); animation: fadein 160ms both; }
.field__err i {
  flex: none; width: 14px; height: 14px; border-radius: 999px; margin-top: 2px;
  background: var(--accent); color: var(--on-accent);
  font-style: normal; font-weight: 900; font-size: 10px; line-height: 14px; text-align: center;
}
@keyframes fadein { from { opacity: 0; } }
.draft__actions { margin-top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.draft__note { color: var(--on-flood-soft); max-width: 34ch; }

.draft__done { display: flex; flex-direction: column; gap: 12px; animation: fadein 240ms both; }
.done__title { color: var(--on-flood); text-transform: none; }
.done__title:focus { outline: none; }
.done__help { color: var(--on-flood-soft); margin-top: 6px; }
.done__box {
  background: var(--flood-deep); color: var(--on-flood);
  padding: 12px; margin: 0;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  user-select: text; -webkit-user-select: text;
  max-height: 150px; overflow-y: auto;
}
.done__actions { display: flex; gap: 12px; align-items: center; }

/* ---------- 9. Detail overlay ---------- */
.detail {
  position: fixed; inset: 0; z-index: 50;
  background: var(--paper);
  overscroll-behavior: contain;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.detail.is-travel { background: transparent; }
.detail__slot { flex: 1 1 auto; min-height: 170px; }
.detail__hero {
  position: absolute; top: 0; left: 0; width: 100%;
  height: var(--hero-h, 38%);
  z-index: 1;
}
.detail__close {
  position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: max(12px, env(safe-area-inset-right));
  width: 48px; height: 48px; border-radius: 999px; z-index: 3;
  --focus: var(--plate-ui);
}
.detail__close .disc { right: 0; bottom: 0; transition: background-color var(--dur-state); }
.detail__close .disc::before, .detail__close .disc::after { transition: background-color var(--dur-state); }
.detail__close:focus-visible { outline: 3px solid var(--plate-ui); outline-offset: 3px; }
.detail__sheet {
  position: relative; z-index: 2; flex: none;
  background: var(--paper);
  padding: 16px var(--mr) var(--pb) var(--ml);
  display: flex; flex-direction: column;
}
.detail__lip {
  position: absolute; left: 0; bottom: 100%; width: 100%; height: 28px;
  fill: var(--paper);
  transform: scaleY(0); transform-origin: 50% 100%;
  margin-bottom: -1px;
}
.detail__head .meter { color: var(--ink-soft); }
.detail__head .mask { margin-top: 6px; padding-bottom: 2px; }
.detail__head .hull-xl { color: var(--ink); white-space: nowrap; }
.detail__head .hull-xl:focus { outline: none; }

.detail__body { display: flex; flex-direction: column; }
.steps { order: 1; position: relative; margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 3px; }
.panels { order: 2; margin-top: 14px; }
.detail__aside { order: 3; margin-top: 14px; }
.step {
  position: relative;
  height: 40px; text-align: left; padding: 0 4px 0 0;
  color: var(--ink-soft);
  transition: color var(--dur-state);
  --focus: var(--focus-paper);
}
.step[aria-current="step"] { color: var(--ink); }
@media (hover: hover) { .step:hover { color: var(--ink); } }
.steps__bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--rule); }
.steps__bar > i {
  position: absolute; left: 0; top: 0; height: 3px; width: calc(100% / 3);
  background: var(--ink);
  transform: translateX(calc(var(--step, 0) * 100%));
  transition: transform var(--dur-state) var(--ease-out);
}
.panel { height: 110px; overflow-y: auto; color: var(--ink); }
.panel .body { font-size: 15px; line-height: 1.45; }
.detail__figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.figure {
  position: relative; overflow: hidden;
  height: 84px; padding: 10px 12px;
  background: var(--paper-2);
  display: flex; flex-direction: column; justify-content: space-between;
}
.figure__flood { position: absolute; inset: 0; background: var(--ink); transform: translateY(101%); }
.figure .table-xl, .figure .meter { position: relative; transition: color var(--dur-state); }
.figure .table-xl { color: var(--ink); white-space: nowrap; }
.figure .meter { color: var(--ink-soft); white-space: nowrap; }
.detail.is-outcome .figure__flood { transform: translateY(0); }
.detail.is-outcome .figure .table-xl, .detail.is-outcome .figure .meter { color: var(--paper); }
.detail__facts { display: none; }
.detail__nav { margin-top: 14px; height: 44px; display: flex; align-items: center; justify-content: space-between; }
.detail__nav .meter { color: var(--ink); font-variant-numeric: tabular-nums; }
.detail__nav .pill .mask { display: block; }
.detail__nav .pill__label { display: block; }
@media (max-width: 559.98px) and (max-height: 640px) {
  .figure { height: 72px; }
  .figure .table-xl { font-size: 46px; }
  .panel { height: 96px; }
}

/* ==========================================================================
   UNFOLDED (>= 560px)
   ========================================================================== */
@media (min-width: 560px) {
  /* Screen 1 */
  .tide { top: calc(var(--y2) - 79px); width: 164px; text-align: left; white-space: nowrap; }
  .tide__k, .tide__v { display: inline; }
  .home__lower {
    top: calc(var(--y2) + 32px);
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 12px;
  }
  .home__text { grid-column: 1 / 5; }
  .home__lower .lead { max-width: none; }
  .home__lead .ln > span { white-space: nowrap; }
  .home__para { margin-top: 16px; max-width: 340px; }
  .practice { display: block; grid-column: 5 / 7; }
  .practice__label { color: var(--on-flood-soft); margin-bottom: 8px; }
  .practice__list li {
    display: flex; align-items: center; height: 32px;
    border-top: var(--bw) solid var(--flood-rule);
    font-size: 14px; font-weight: 500; color: var(--on-flood);
  }
  .practice__list li .meter { width: 28px; flex: none; color: var(--on-flood-soft); }

  /* Screen 2 */
  .screen--work {
    grid-template-columns: var(--ml) minmax(0, 1fr) auto 16px 44px 8px 44px var(--mr);
    grid-template-rows: var(--pt) 44px 4px 40px 16px minmax(0, 1fr) 20px auto var(--pb);
  }
  .counter { grid-area: 2 / 3 / 3 / 4; }
  .screen--work [data-prev] { grid-area: 2 / 5 / 3 / 6; }
  .screen--work [data-next] { grid-area: 2 / 7 / 3 / 8; }
  .filters { grid-area: 4 / 2 / 5 / 8; }
  .stage { grid-area: 6 / 2 / 7 / 8; display: flex; flex-direction: column; min-height: 0; }
  .stage__plate { flex: 1 1 auto; min-height: 200px; cursor: pointer; touch-action: pan-y; transition: transform var(--dur-state) var(--ease-bob); }
  .stage__plate:active { transform: scale(0.99); transition-duration: var(--dur-press); }
  .stage__caption {
    flex: none; height: 110px; margin-top: 12px;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 12px;
    grid-template-rows: auto 48px auto; align-content: start;
  }
  .stage__caption [data-stage-meta] { grid-column: 1 / -1; color: var(--on-flood); }
  .stage__titlemask { grid-column: 1 / 5; grid-row: 2; align-self: center; padding: 2px 0; }
  .stage__titlemask .hull-l { white-space: nowrap; font-stretch: 125%; }
  .stage__open { grid-column: 5 / 7; grid-row: 2; justify-self: end; align-self: center; }
  .stage__open .pill__label { min-width: 9.6em; }
  .stage__caption [data-stage-line] { grid-column: 1 / 5; grid-row: 3; max-width: 376px; color: var(--on-flood-soft); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  .track {
    grid-area: 8 / 2 / 9 / 8;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
    grid-auto-rows: min-content;
    overflow: visible;
    scroll-snap-type: none; padding: 0;
    height: 276px;
    transition: height 400ms var(--ease-out);
  }
  .track::after { display: none; }
  .card { flex: none; min-width: 0; }
  .card__plate { flex: none; height: 104px; min-height: 0; transform: none !important; transition: transform var(--dur-state) var(--ease-out), outline-color var(--dur-state); outline: 3px solid transparent; outline-offset: 3px; }
  .screen--work.is-three .track { height: 168px; }
  .screen--work.is-three .card__plate { height: 140px; }
  .card.is-current .card__plate { outline-color: var(--on-flood); }
  .card__open { display: none; }
  .card__select { display: block; position: absolute; inset: 0; width: 100%; height: 100%; --focus: var(--focus-flood); z-index: 2; }
  .card__select:focus-visible { outline: 3px solid var(--focus-flood); outline-offset: 8px; }
  @media (hover: hover) { .card:not(.is-current) .card__plate:hover { transform: translateY(-2px) !important; } }
  .card__select:active { transform: scale(0.97); }
  .card__caption { height: 22px; padding-top: 0; margin-top: 6px; opacity: 1 !important; display: flex; align-items: center; position: relative; }
  .card__meta, .card__line { display: none !important; }
  .card__title {
    margin: 0; display: flex; align-items: center; min-width: 0;
    font-size: var(--fs-body-s); line-height: 22px; font-weight: 500; font-stretch: 100%; letter-spacing: 0;
    color: var(--on-flood);
    transition: font-stretch var(--dur-state) var(--ease-out), font-weight var(--dur-state);
  }
  .card.is-current .card__title { font-stretch: 118%; font-weight: 700; }
  .card__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card__n { display: inline-block; width: 26px; flex: none; color: var(--on-flood-soft); font-weight: 400; font-stretch: 100%; }
  .sheet-buoy {
    display: block; position: absolute; left: 0; top: 0;
    width: 12px; height: 12px; border-radius: 999px; background: var(--accent);
    pointer-events: none;
  }
  .scrubber { display: none; }

  /* Screen 3 */
  .studio__paper { padding-bottom: 12px; }
  .statement { max-width: none; }
  .ledger { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 12px; height: 247px; }
  .rule--ledger { display: none; }
  .stats { grid-column: 1 / 3; flex-direction: column; align-items: flex-start; gap: 12px; height: auto; }
  .stat { height: 86px; justify-content: flex-end; }
  .stats address { margin-left: 0; margin-top: 4px; text-align: left; }
  .services { grid-column: 3 / 7; }
  .services__label { position: static !important; width: auto; height: auto; overflow: visible; clip-path: none; color: var(--ink-soft); line-height: 13px; margin-bottom: 6px; display: block; }
  .services ol > li { height: 76px; padding-top: 8px; grid-template-columns: 28px minmax(0, 1fr); align-content: start; }
  .services li .title { line-height: 22px; }
  .services ol > li { grid-template-rows: 22px auto; }
  .services li .body-s { white-space: normal; line-height: 1.45; margin-top: 2px; }
  .approach__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .approach ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; height: 105px; }
  .approach li { display: flex; flex-direction: column; white-space: normal; overflow: visible; line-height: 1.45; font-size: 14px; }
  .approach li .meter { margin: 0 0 4px; line-height: 1.2; }
  .approach li .title { font-size: 18px; font-stretch: 110%; line-height: 1.2; margin-bottom: 4px; text-transform: none; }
  .approach li .title::first-letter { text-transform: uppercase; }
  .ap__c { display: none; }
  .ap__t { display: block; }
  .clients { height: 36px; margin-bottom: 0; }
  .slab-spacer { display: none; }

  .slab {
    position: relative; inset: auto; top: auto; z-index: 2;
    flex: none;
    height: calc(276px + var(--sb));
    padding: 20px var(--mr) calc(24px + var(--sb)) var(--ml);
    display: flex; flex-direction: column;
    background: var(--flood) !important;
    pointer-events: auto;
  }
  .slab__water { display: contents; }
  .slab__sheet {
    position: static; order: 2; padding: 0; overflow: visible;
    visibility: visible !important; opacity: 1 !important; transition: none;
    margin-top: 12px;
  }
  .draft__head { display: none; }
  .slab__reach { position: static; order: 1; height: auto; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .reach__row { flex: none; min-width: 0; }
  .reach__row .email { overflow: visible; }
  .reach__row .copy-email { margin-left: 0; }
  .copied { order: 3; }
  .slab__address { margin: 0; text-align: right; flex: 0 1 190px; min-width: 0; line-height: 1.3; }
  .reach__actions { display: none; }
  .draft { display: flex; flex-direction: column; }
  .draft__grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 6px;
    height: 116px;
  }
  .f-name { grid-column: 1; grid-row: 1; }
  .f-email { grid-column: 1; grid-row: 2; }
  .f-msg { grid-column: 2; grid-row: 1 / 3; }
  .f-msg textarea { height: 97px; min-height: 0; }
  .field__err { position: absolute; left: 0; right: 0; top: 100%; z-index: 2; margin-top: 2px; background: var(--flood); }
  .draft__actions { margin-top: 12px; height: 48px; flex-direction: row; align-items: center; justify-content: space-between; }
  .draft__done {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 12px;
    grid-template-rows: 116px 48px;
  }
  .done__box { max-height: 116px; height: 116px; }
  .done__actions { grid-column: 1 / -1; justify-content: flex-end; }

  /* Detail */
  .detail__slot { min-height: 200px; }
  .detail__sheet { padding-top: 24px; }
  .detail__body {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 12px;
    margin-top: 20px; align-items: start;
  }
  .steps, .panels { display: contents; }
  .steps__bar { display: none; }
  .detail__aside { grid-column: 1 / 3; grid-row: 1 / 7; margin: 0; }
  .step { grid-column: 3 / 7; height: 35px; border-top: var(--bw-heavy) solid var(--rule); transition: color var(--dur-state), border-color var(--dur-state); }
  .step[aria-current="step"] { border-top-color: var(--ink); }
  .step[data-step="0"] { grid-row: 1; }
  .step[data-step="1"] { grid-row: 3; margin-top: 14px; }
  .step[data-step="2"] { grid-row: 5; margin-top: 14px; }
  .panel { grid-column: 3 / 7; height: auto; overflow: visible; color: var(--ink-soft); transition: color var(--dur-state); }
  .panel.is-active { color: var(--ink); }
  .panel[data-panel="0"] { grid-row: 2; }
  .panel[data-panel="1"] { grid-row: 4; }
  .panel[data-panel="2"] { grid-row: 6; }
  .detail__figures { grid-template-columns: 1fr; }
  .figure { height: 120px; }
  .figure .meter { white-space: normal; }
  .detail__facts { display: block; margin-top: 16px; }
  .detail__facts > div { display: flex; align-items: center; height: 32px; border-top: var(--bw) solid var(--rule); }
  .detail__facts dt { width: 64px; flex: none; color: var(--ink-soft); }
  .detail__facts dd { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .detail__nav { margin-top: 16px; }
}

@media (min-width: 560px) and (max-height: 840px) {
  .home__para2 { display: none; }
  .home__lower .lead { font-size: 34px; }
  .stage__caption { height: 68px; }
  .stage__caption [data-stage-line] { display: none; }
  .card__plate { height: 88px; }
  .screen--work.is-three .card__plate { height: 120px; }
  .track { height: 244px; }
  .screen--work.is-three .track { height: 148px; }
  .detail__facts { display: none; }
  .figure { height: 100px; }
  .figure .table-xl { font-size: 64px; }
  .approach li .ap__t { display: none; }
  .approach ol { height: 44px; }
  .statement { font-size: 28px; }
  .field input { height: 30px; }
  .draft__grid { height: 104px; }
  .f-msg textarea { height: 85px; }
  .done__box { height: 104px; max-height: 104px; }
  .draft__done { grid-template-rows: 104px 48px; }
  .slab { height: calc(264px + var(--sb)); }
}

@media (max-width: 559.98px) and (max-height: 640px) {
  .services li .body-s { display: none; }
  .services ol > li { height: 28px; padding-top: 4px; }
  .statement { font-size: 20px; }
  .stats { height: 57px; }
  .stat .table-xl { font-size: 46px; }
  .approach li { line-height: 18px; }
}

/* ---------- 10. Refold / choreography helpers ---------- */
.fx-xfade { animation: xfade 320ms var(--ease-out) both; }
@keyframes xfade { from { opacity: 0.4; transform: translateY(8px); } }
.fx-fade { animation: fade06 160ms linear both; }
@keyframes fade06 { from { opacity: 0.6; } }

/* page load (screen 1) — all keyframes with backwards fill: resting state is final */
.js:not(.rm) .home__meter { animation: meterIn 300ms var(--ease-out) 100ms backwards; }
@keyframes meterIn { from { opacity: 0; transform: translateY(-8px); } }
.js:not(.rm) .home__lead .ln > span { animation: lineUp 400ms var(--ease-out) 600ms backwards; }
.js:not(.rm) .home__lead .ln + .ln > span { animation-delay: 660ms; }
@keyframes lineUp { from { transform: translateY(100%); } }
.js:not(.rm) .home__para { animation: paraIn 300ms var(--ease-out) 800ms backwards; }
@keyframes paraIn { from { opacity: 0; transform: translateY(8px); } }
.js:not(.rm) .home__bottom { animation: fadeOnly 300ms linear 900ms backwards; }
.js:not(.rm) .home__bottom .arrow--down { animation: dip 600ms var(--ease-in-out) 1200ms 2; }
.js:not(.rm) .practice, .js:not(.rm) .tide { animation: fadeOnly 300ms linear 800ms backwards; }
@keyframes fadeOnly { from { opacity: 0; } }
@keyframes dip { 50% { transform: translateY(4px); } }

/* first arrival on screen 2 */
.screen--work.is-arrive .chip { animation: chipIn 240ms var(--ease-out) backwards; }
.screen--work.is-arrive .chip:nth-child(2) { animation-delay: 40ms; }
.screen--work.is-arrive .chip:nth-child(3) { animation-delay: 80ms; }
.screen--work.is-arrive .chip:nth-child(4) { animation-delay: 120ms; }
@keyframes chipIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 11. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .round, .pill, .chip, .disc, .card__plate, .stage__plate { transition-property: background-color, color, box-shadow, outline-color, opacity !important; }
  .round:active, .pill:active, .chip:active, .card__select:active, .stage__plate:active { transform: none; }
  .card__title, .chip__l, .pill__label { transition: none !important; }
  .steps__bar > i { transition: none; }
  .figure__flood { transition: none !important; }
  .slab__water { transition: none !important; }
  .slab__sheet { transition: opacity 160ms, visibility 0s !important; }
  #screens { animation: fade06 160ms linear both; }
  .clients__strip { animation: none !important; position: static; display: block; white-space: normal; padding: 0 !important; transform: none !important; }
  .clients { display: flex; align-items: center; }
  .clients__label { position: static; display: inline; padding: 0; border: 0; background: none; margin-right: 8px; font-size: 10px; line-height: 1.5; }
  .clients__dup { display: none; }
  .clients__run { white-space: normal; font-size: 10px; line-height: 1.5; letter-spacing: 0.04em; }
  .clients { display: block; padding-top: 0; font-size: 10px; line-height: 14px; }
  .clients__label, .clients__run { line-height: 14px !important; font-size: 10px !important; letter-spacing: 0.01em !important; }
  .clients__strip, .clients__label { display: inline; }
}
