/* ============================================================================
   Aqualion Digital — "The Custody Line"
   One ribbon carries the company. Every claim is drawn at the distance it has
   actually travelled: solid where it is documented, looped where it points
   inward, half-woven where it is being built, unwoven thread where nothing has
   been decided. Status is carried by geometry and weight, never by colour
   alone and never by low-contrast text.

   The ribbon is ONE tiled SVG spine, not per-section rails: a rail per section
   resets the tile phase at every boundary and the joins show. Generated art
   lives in assets/world/; DESIGN.md records the parameters.
   ========================================================================= */

@font-face {
  font-family: "Piazzolla";
  src: url("../fonts/Piazzolla-Variable.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("../fonts/Satoshi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("../fonts/Satoshi-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ground — cool document stock, deliberately not archival buff */
  --stock:   #F4F7FA;
  --stock-2: #E9EFF5;
  --deep:    #061D46;

  /* ink — navy, never grey */
  --ink:     #0A1E3D;
  --ink-2:   #33507A;

  /* the line */
  --ribbon:  #0D64AC;
  --lit:     #39B1D7;
  --thread:  #9FB4C8;
  --rule:    #C7D6E2;

  --font-ledger: "Piazzolla", Georgia, "Times New Roman", serif;
  --font-body:   "Satoshi", ui-sans-serif, system-ui, -apple-system, sans-serif;

  --t-xs:   0.8125rem;
  --t-sm:   0.9375rem;
  --t-base: 1.0625rem;
  --t-lg:   1.1875rem;
  --t-h2:   clamp(1.75rem, 2.9vw, 2.6rem);
  --t-display: clamp(2.5rem, 6.1vw, 5.25rem);

  --rail: 190px;
  --spine-in: clamp(500px, 64vh, 760px);   /* the ribbon emerges below the mark */

  /* the travelling reading highlight */
  --spine-mask: linear-gradient(to bottom, transparent var(--spine-in), #000 calc(var(--spine-in) + 120px), #000 calc(100% - 210px), transparent 100%);
  --read-span: 190px;
  --read: 50vh;
  --read-band: linear-gradient(to bottom,
    transparent calc(var(--read) - var(--read-span) * 2.1),
    #000 calc(var(--read) - var(--read-span) * 0.7),
    #000 calc(var(--read) + var(--read-span) * 0.7),
    transparent calc(var(--read) + var(--read-span) * 2.1));
  --read-band-local: linear-gradient(to bottom,
    transparent calc(var(--read-local, -9999px) - var(--read-span) * 2.1),
    #000 calc(var(--read-local, -9999px) - var(--read-span) * 0.7),
    #000 calc(var(--read-local, -9999px) + var(--read-span) * 0.7),
    transparent calc(var(--read-local, -9999px) + var(--read-span) * 2.1));
  --w: 1180px;              /* the document column */
  --gut: clamp(20px, 4.6vw, 56px);
  --measure: 50ch;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px; /* masthead min-height + 8 */
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--stock) url("../assets/world/stock.svg") repeat;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3 {
  font-family: var(--font-ledger);
  font-weight: 400;
  font-variation-settings: "opsz" 30;
  letter-spacing: -0.014em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1.05em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--ribbon); }

:focus-visible {
  outline: 2px solid var(--ribbon);
  outline-offset: 3px;
  border-radius: 2px;
}
.close :focus-visible, .foot :focus-visible { outline-color: var(--stock); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--stock);
  padding: 12px 18px;
  z-index: 50;
  text-decoration: none;
}
.skip:focus { left: 8px; top: 8px; }

/* ── masthead ─────────────────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--stock) 93%, transparent);
  border-bottom: 1px solid var(--rule);
}
.masthead__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 0 var(--gut);
  min-height: 64px;
}
.seal {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.seal img { display: block; width: 34px; height: 30px; }
.seal__name {
  font-family: var(--font-ledger);
  font-size: 1.0625rem;
  font-variation-settings: "opsz" 14;
  white-space: nowrap;
}
.seal__name em { font-style: normal; color: var(--ribbon); }

.masthead__nav { display: flex; gap: clamp(14px, 2.4vw, 30px); flex-wrap: wrap; }
.masthead__nav a {
  font-size: var(--t-sm);
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.masthead__nav a:hover { color: var(--ink); border-bottom-color: var(--ribbon); }

/* ── opening ──────────────────────────────────────────────────────────── */

.opening {
  padding: clamp(48px, 8vh, 96px) var(--gut) clamp(56px, 9vh, 108px);
  position: relative;
  z-index: 6;
}
.opening__in {
  max-width: var(--w);
  margin: 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
}
.opening__mark { position: relative; justify-self: end; }
.opening__mark img {
  display: block;
  width: clamp(260px, 33vw, 520px);
  height: auto;
}
/* the line is already descending before the first fold */


.opening__say { padding-top: clamp(8px, 2vh, 32px); }
.display {
  font-size: var(--t-display);
  line-height: 1.02;
  letter-spacing: -0.028em;
  max-width: 15ch;
  margin: 0 0 clamp(20px, 3vw, 32px);
}
.thesis {
  font-family: var(--font-ledger);
  font-variation-settings: "opsz" 18;
  font-size: clamp(1.1875rem, 1.9vw, 1.6rem);
  line-height: 1.42;
  max-width: 40ch;
  margin: 0 0 clamp(26px, 3.4vw, 38px);
}
.opening__cta { display: flex; gap: 14px; flex-wrap: wrap; max-width: none; }
.btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--t-sm);
  text-decoration: none;
  padding: 13px 24px;
  border-radius: 2px;
  background: var(--ink);
  color: var(--stock);
  border: 1px solid var(--ink);
  transition: background 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}
.btn:hover { background: var(--ribbon); border-color: var(--ribbon); transform: translateY(-1px); }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--quiet:hover { background: transparent; color: var(--ribbon); border-color: var(--ribbon); transform: translateY(-1px); }

/* ── the record ───────────────────────────────────────────────────────── */

.record { padding: 0 var(--gut) clamp(56px, 9vh, 104px); position: relative; }

.fold {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail);
  max-width: var(--w);
  margin: 0 auto;
}

/* spacing lives on the body so the rail spans the whole fold and the line
   never breaks between entries */
.fold__body { padding-top: 2px; padding-bottom: clamp(56px, 8vw, 112px); padding-right: clamp(20px, 3vw, 48px); }
.fold:last-child .fold__body { padding-bottom: 0; }

.fold__rail { position: relative; grid-column: 2; grid-row: 1; }
.fold__body { grid-column: 1; grid-row: 1; }
main { position: relative; }

/* ONE ribbon, in front of every section ground, so nothing can interrupt it.
   It emerges from under the mark: the mask hides it until it clears the logo.
   The reading highlight is a single feathered band travelling the whole page
   with the scroll — never a per-section switch, so two neighbouring stretches
   can never disagree at a boundary. */
.spine,
.spine-lit {
  position: absolute;
  top: 0;
  bottom: 0;
  right: max(var(--gut), calc(50vw - var(--w) / 2));
  width: var(--rail);
  background-repeat: repeat-y;
  background-position: right top;
  background-size: var(--rail) auto;
  pointer-events: none;
}
.spine {
  z-index: 3;
  background-image: url("../assets/world/ribbon.svg");
  /* emerges below the mark, and runs off the page rather than being cut */
  -webkit-mask-image: var(--spine-mask);
  mask-image: var(--spine-mask);
}
.spine-lit {
  z-index: 4;
  background-image: url("../assets/world/ribbon-lit.svg");
  /* the highlight is clipped by the same emergence + run-off mask as the base,
     so the lit layer can never appear above the mark */
  -webkit-mask-image: var(--read-band), var(--spine-mask);
  mask-image: var(--read-band), var(--spine-mask);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* Being built: the weave is a material fact, not a scroll state, so it sits
   over the ribbon and carries its own lit twin through the same band. */
.fold--weaving .fold__rail { z-index: 5; }
.fold--weaving .fold__rail::before,
.fold--weaving .fold__rail::after {
  content: "";
  position: absolute;
  inset: -1px 0;
  pointer-events: none;
  background-repeat: repeat-y;
  background-position: right var(--phase, 0px);
  background-size: var(--rail) auto;
}
.fold--weaving .fold__rail::before {
  /* the backing has to be the page's own stock, grain included, or the overlay
     reads as a pale rectangle sitting on the paper */
  background-image: url("../assets/world/ribbon-weave.svg"), url("../assets/world/stock.svg");
  background-repeat: repeat-y, repeat;
  background-position: right var(--phase, 0px), left top;
  background-size: var(--rail) auto, auto;
  background-color: var(--stock);
}
.fold--weaving .fold__rail::after {
  background-image: url("../assets/world/ribbon-weave-lit.svg");
  -webkit-mask-image: var(--read-band-local);
  mask-image: var(--read-band-local);
}


.fold__body > *:first-child { border-top: 1px solid var(--rule); padding-top: 18px; }
.fold__problem {
  font-family: var(--font-ledger);
  font-variation-settings: "opsz" 20;
  font-size: clamp(1.125rem, 1.6vw, 1.4rem);
  line-height: 1.36;
  color: var(--ink-2);
  max-width: 34ch;
  margin: 0 0 18px;
}
.fold__state {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--t-sm);
  color: var(--ribbon);
  margin: 0 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.fold__state::before {
  content: "";
  width: 9px; height: 9px;
  background: var(--ribbon);
  transform: rotate(45deg);
  flex: none;
}
.fold--weaving .fold__state { color: var(--ink-2); }
.fold--weaving .fold__state::before {
  background: linear-gradient(to bottom right, var(--ink-2) 0 50%, transparent 50% 100%);
  box-shadow: inset 0 0 0 1.5px var(--ink-2);
}

.fold__body h2 {
  font-size: var(--t-h2);
  line-height: 1.1;
  margin: 0 0 18px;
  max-width: 20ch;
}
.fold__body h2.with-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: none;
}
.pmark {
  display: block; width: auto; height: 52px; flex: none;
  transition: transform 260ms var(--ease);
}
.fold:hover .pmark { transform: translateY(-2px) rotate(-2deg); }
.pmark--raster { height: 56px; width: 56px; }

.fold__link { margin-top: 20px; }
.ext {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--ribbon) 40%, transparent);
  padding-bottom: 2px;
  transition: border-color 160ms var(--ease);
}
.ext:hover { border-bottom-color: var(--ribbon); }
.arrow {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms var(--ease);
}
.ext:hover .arrow { transform: translate(2px, -2px); }

/* evidence — the only place the page goes wide */
.evidence {
  display: flex;
  gap: clamp(16px, 2.4vw, 32px);
  margin-top: clamp(28px, 3.4vw, 44px);
  flex-wrap: wrap;
}
.shot { margin: 0; max-width: 430px; flex: 1 1 320px; }
.shot__open { display: block; text-decoration: none; }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--stock-2);
  transition: border-color 160ms var(--ease);
}
.shot__open:hover img { border-color: var(--ribbon); }
.shot figcaption a { color: var(--ribbon); white-space: nowrap; }
.shot figcaption {
  font-size: var(--t-xs);
  color: var(--ink-2);
  margin-top: 10px;
  line-height: 1.45;
}

/* ── the notes passage — quieter, no cards ────────────────────────────── */

.notes {
  position: relative;
  background: var(--stock-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: clamp(56px, 9vh, 104px) var(--gut);
}
.notes__in {
  max-width: var(--w);
  margin: 0 auto;
  padding-right: calc(var(--rail) + clamp(16px, 2vw, 40px));
  position: relative;
}
.notes__lede { font-size: var(--t-lg); color: var(--ink-2); max-width: 40ch; margin: -18px 0 clamp(28px, 3.4vw, 44px); }
.notes h2 {
  font-size: var(--t-h2);
  line-height: 1.1;
  margin: 0 0 18px;
  max-width: 24ch;
}
.creed { margin: 0; display: grid; gap: 0; }
.creed > div {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(16px, 3vw, 48px);
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
.creed > div:last-child { border-bottom: 1px solid var(--rule); }
.creed > div { transition: background 200ms var(--ease); }
.creed > div:hover { background: color-mix(in oklab, var(--stock) 55%, transparent); }
.creed dt {
  font-family: var(--font-ledger);
  font-variation-settings: "opsz" 18;
  font-size: var(--t-lg);
  line-height: 1.34;
}
.creed dd { margin: 0; color: var(--ink-2); font-size: var(--t-sm); }

/* ── close ────────────────────────────────────────────────────────────── */

.close {
  position: relative;
  background: var(--deep);
  color: var(--stock);
  padding: clamp(64px, 11vh, 128px) var(--gut);
}
.close__in { max-width: var(--w); margin: 0 auto; padding-right: var(--rail); position: relative; }
.close h2 {
  font-size: var(--t-h2);
  line-height: 1.1;
  margin: 0 0 20px;
  max-width: 18ch;
  color: var(--stock);
}
.close p { color: color-mix(in oklab, var(--stock) 82%, var(--lit)); max-width: 48ch; }
.close__mail { margin-top: clamp(28px, 3.4vw, 40px); }
.close__mail a {
  font-family: var(--font-ledger);
  font-variation-settings: "opsz" 24;
  font-size: clamp(1.375rem, 3.1vw, 2.35rem);
  color: var(--lit);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--lit) 45%, transparent);
  padding-bottom: 4px;
  transition: border-color 160ms var(--ease);
  word-break: break-word;
}
.close__mail a:hover { border-bottom-color: var(--lit); }


/* ── foot ─────────────────────────────────────────────────────────────── */

.foot {
  background: var(--deep);
  border-top: 1px solid color-mix(in oklab, var(--stock) 16%, transparent);
  padding: 24px var(--gut) 28px;
  color: color-mix(in oklab, var(--stock) 72%, var(--lit));
  font-size: var(--t-xs);
}
.foot__in {
  max-width: var(--w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.foot p { margin: 0; max-width: none; }
.foot p.foot__dom { margin-left: auto; }

/* ── the one authored moment: the line arrives ───────────────────────── */

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.display      { animation: settle 700ms var(--ease) 120ms both; }
.thesis       { animation: settle 700ms var(--ease) 260ms both; }
.opening__cta { animation: settle 700ms var(--ease) 380ms both; }
.opening__mark img { animation: settle 900ms var(--ease) 60ms both; }

.rise { opacity: 0; transform: translateY(14px); transition: opacity 620ms var(--ease), transform 620ms var(--ease); }
.rise.is-in { opacity: 1; transform: none; }

/* ── narrow ───────────────────────────────────────────────────────────── */

@media (max-width: 1040px) {
  .opening__in { grid-template-columns: minmax(0, 1fr); }
  .opening__mark { justify-self: stretch; order: -1; text-align: left; }
  .opening__mark img { width: clamp(200px, 42vw, 320px); }
}

@media (max-width: 900px) {
  :root { --rail: 78px; }
  .creed > div { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .shot { max-width: 100%; flex: 1 1 260px; }
  .fold__body h2.with-mark { gap: 12px; }
}

@media (max-width: 620px) {
  :root { --rail: 58px; }
  .masthead__in { min-height: 56px; flex-wrap: nowrap; gap: 12px; }
  .masthead__nav { gap: 10px; flex-wrap: nowrap; }
  .masthead__nav a { font-size: var(--t-xs); padding: 4px 0; white-space: nowrap; }
  .seal img { width: 28px; height: 25px; }
  .fold__body h2.with-mark { gap: 11px; }
  .pmark { height: 42px; }
  .pmark--raster { height: 44px; width: 44px; }
  .evidence { gap: 14px; }
  .shot { max-width: 100%; flex: 1 1 100%; }
}

/* below 430px three labels cannot sit beside the wordmark at an honest size.
   the two wayfinding links go; the primary action stays, because the page is
   one continuous read but the reason to write to us is not on the way. */
@media (max-width: 430px) {
  .masthead__nav a:not(:last-child) { display: none; }
  .masthead__nav a:last-child {
    color: var(--ink);
    border-bottom-color: var(--ribbon);
  }
}

@media (prefers-reduced-motion: reduce) {
  .display, .thesis, .opening__cta,
  .opening__mark img { animation: none !important; }
  .rise { opacity: 1; transform: none; transition: none !important; }
  .btn, .pmark, .creed > div, .arrow, .ext, .masthead__nav a { transition: none !important; }
}
