/* ==========================================================================
   RIVA Global: site stylesheet
   --------------------------------------------------------------------------
   1. Fonts            5. Header, menu, footer
   2. Design tokens    6. Page sections
   3. Base             7. Forms and legal pages
   4. Layout + parts   8. Motion (preloader, reveals, page transitions)
   ========================================================================== */

/* 1. Fonts (self-hosted, OFL licensed; see /assets/fonts/LICENSE-*.txt) */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-opsz.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* 2. Design tokens ======================================================== */
:root {
  /* Brand palette (fixed values) */
  --emerald: #0F5E4E;
  --emerald-700: #0A4A3D;
  --emerald-900: #0A3F35;
  --emerald-950: #06201B;
  --emerald-50: #EAF1EC;
  --gold: #C9A24A;
  --gold-soft: #D9B865;
  --gold-ink: #86671E;      /* gold for text on light grounds: 4.9:1 on ivory */
  --coral: #E07A5F;
  --coral-ink: #A8452C;     /* coral for text on light grounds: 5.5:1 on ivory */
  --ivory: #FAF7F0;
  --paper: #F5F1E7;
  --charcoal: #22313A;
  --slate: #4C5B63;         /* muted text: 6.6:1 on ivory */

  /* Semantic roles (these are what components use; dark theme swaps them) */
  --bg: var(--ivory);
  --bg-alt: var(--paper);
  --text: var(--charcoal);
  --muted: var(--slate);
  --rule: rgba(34, 49, 58, 0.16);
  --rule-strong: rgba(34, 49, 58, 0.42);
  --accent-ink: var(--gold-ink);
  --error-ink: var(--coral-ink);
  --brand-ink: var(--emerald);
  --focus: var(--coral-ink);
  --field-bg: #FFFDF8;
  --field-border: #7D8A84;  /* 3.5:1 against the field (non-text contrast) */
  --band-bg: var(--emerald);
  --band-text: var(--ivory);
  --band-muted: #CFDDD6;
  --footer-bg: var(--emerald-900);
  --btn-bg: var(--emerald);
  --btn-fg: var(--ivory);
  --btn-hover: var(--emerald-700);
  --mark-bg: #F6E3A6;
  --grain-opacity: 0.6;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  /* Fluid scale (roughly 1.25 at 360px, opening to about 1.4 at 1440px) */
  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.375rem);
  --step-2: clamp(1.4rem, 1.24rem + 0.75vw, 1.9rem);
  --step-3: clamp(1.75rem, 1.42rem + 1.5vw, 2.75rem);
  --step-4: clamp(2.2rem, 1.6rem + 2.8vw, 4.1rem);
  --step-5: clamp(2.6rem, 1.6rem + 4.6vw, 6rem);
  --step-6: clamp(2.75rem, 1.3rem + 6.6vw, 7.8rem);
  --measure: 66ch;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6rem;
  --section-y: clamp(4.5rem, 3rem + 6vw, 9rem);

  /* Layout */
  --max: 1440px;
  --pad: clamp(1.25rem, 5vw, 4.5rem);
  --gutter: clamp(1rem, 0.6rem + 1.6vw, 2rem);
  --header-h: 76px;
  --subnav-h: 56px;
  /* x position of the gold thread: half-way into the left page margin */
  --thread-x: calc((100% - min(100%, var(--max))) / 2 + var(--pad) / 2);

  /* Radius: buttons are round, fields are barely rounded, images are square */
  --radius-field: 4px;
  --radius-pill: 999px;

  /* Motion */
  --dur-1: 160ms;
  --dur-2: 320ms;
  --dur-3: 600ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: light;
}

/* Dark theme: follows the OS unless the visitor picked a theme with the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071A16;
    --bg-alt: #0E2A24;
    --text: var(--ivory);
    --muted: #B4C1BA;
    --rule: rgba(250, 247, 240, 0.14);
    --rule-strong: rgba(250, 247, 240, 0.4);
    --accent-ink: var(--gold);
    --error-ink: #E8907A;
    --brand-ink: var(--ivory);
    --focus: var(--gold);
    --field-bg: #0E2A24;
    --field-border: #6F807A;
    --band-bg: #0E3029;
    --band-muted: #C5D3CC;
    --footer-bg: #04130F;
    --btn-bg: var(--gold);
    --btn-fg: var(--emerald-950);
    --btn-hover: var(--gold-soft);
    --mark-bg: #5C4612;
    --grain-opacity: 0.35;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #071A16;
  --bg-alt: #0E2A24;
  --text: var(--ivory);
  --muted: #B4C1BA;
  --rule: rgba(250, 247, 240, 0.14);
  --rule-strong: rgba(250, 247, 240, 0.4);
  --accent-ink: var(--gold);
  --error-ink: #E8907A;
  --brand-ink: var(--ivory);
  --focus: var(--gold);
  --field-bg: #0E2A24;
  --field-border: #6F807A;
  --band-bg: #0E3029;
  --band-muted: #C5D3CC;
  --footer-bg: #04130F;
  --btn-bg: var(--gold);
  --btn-fg: var(--emerald-950);
  --btn-hover: var(--gold-soft);
  --mark-bg: #5C4612;
  --grain-opacity: 0.35;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-weight: 450;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Paper grain: a tiny tiled texture, fixed so it doesn't repaint on scroll */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  background-image: url("/assets/img/grain.webp");
  background-size: 140px 140px;
  opacity: var(--grain-opacity);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 380;
  font-optical-sizing: auto;
  line-height: 1.04;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
h3 { line-height: 1.12; }
h4 { line-height: 1.2; letter-spacing: -0.005em; }

p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }

img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }

ul, ol { margin: 0; padding: 0; }

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

::selection { background: var(--gold); color: var(--emerald-950); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--pad);
  top: -200px;
  z-index: 300;
  padding: 0.75rem 1.25rem;
  background: var(--emerald-950);
  color: var(--ivory);
  border-radius: var(--radius-pill);
  font-weight: 650;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

/* 4. Layout and shared parts ============================================== */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* 12-column grid from 900px; one column below. Children span the full row by
   default, and each component sets its own columns at the md breakpoint. */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--gutter);
}
.grid > * { grid-column: 1 / -1; min-width: 0; }
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.section--alt { background-color: var(--bg-alt); }

/* Display numerals for sequences (practices, process steps) */
.num {
  font-family: var(--font-display);
  font-weight: 300;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--accent-ink);
  line-height: 1;
  letter-spacing: -0.02em;
}

.lead {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 370;
  line-height: 1.28;
  letter-spacing: -0.01em;
  max-width: 34ch;
}

.muted { color: var(--muted); }

/* Buttons: a fill wipes up from below on hover; the arrow slides right */
.btn {
  --btn-pad-x: 1.5rem;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  min-height: 52px;
  padding: 0.8rem var(--btn-pad-x);
  border: 1px solid var(--btn-bg);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 650;
  font-size: var(--step-0);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-hover);
  transform: translateY(101%);
  transition: transform var(--dur-2) var(--ease-out);
}
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }
.btn .arrow { width: 1.05em; height: 1.05em; flex: none; transition: transform var(--dur-2) var(--ease-out); }
.btn:hover .arrow, .btn:focus-visible .arrow { transform: translateX(5px); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-hover: var(--emerald-50);
  border-color: var(--rule-strong);
}
:root[data-theme="dark"] .btn--ghost { --btn-hover: rgba(250, 247, 240, 0.08); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--ghost { --btn-hover: rgba(250, 247, 240, 0.08); }
}
.btn--small { min-height: 44px; --btn-pad-x: 1.15rem; font-size: var(--step--1); }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* Inline link with a sliding arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  min-height: 44px;
  font-weight: 650;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
}
.link-arrow .arrow { width: 1em; height: 1em; transition: transform var(--dur-2) var(--ease-out); }
.link-arrow:hover .arrow, .link-arrow:focus-visible .arrow { transform: translateX(5px); }

/* Emerald band: any section that sits on the brand colour */
.band {
  background-color: var(--band-bg);
  color: var(--band-text);
  --text: var(--band-text);
  --muted: var(--band-muted);
  --rule: rgba(250, 247, 240, 0.2);
  --rule-strong: rgba(250, 247, 240, 0.5);
  --accent-ink: var(--gold);   /* large numerals only: 3.2:1 on emerald */
  --focus: var(--gold);
  --btn-bg: var(--gold);
  --btn-fg: var(--emerald-950);
  --btn-hover: var(--gold-soft);
}

/* List with short gold dashes (used for "Who it's for") */
.dash-list { list-style: none; display: grid; gap: var(--space-3); }
.dash-list li { position: relative; padding-left: 1.75rem; max-width: 52ch; }
.dash-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 1rem;
  height: 1px;
  background: var(--gold);
}

.subhead {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 400;
  margin-bottom: var(--space-5);
}

/* Photographs: square corners, cropped by their frame */
.frame { position: relative; overflow: hidden; background: var(--bg-alt); }
.frame picture, .frame img { width: 100%; height: 100%; }
.frame img { object-fit: cover; }
.frame--3x1 { aspect-ratio: 3 / 1; }
.frame--4x3 { aspect-ratio: 4 / 3; }
.frame--4x5 { aspect-ratio: 4 / 5; }
.frame--3x4 { aspect-ratio: 3 / 4; }
.frame--1x1 { aspect-ratio: 1 / 1; }
figcaption {
  margin-top: var(--space-3);
  font-size: var(--step--1);
  color: var(--muted);
}

/* Live clocks (Austin / India): one of the two signature motifs */
.clocks {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--step--1);
}
.clock { display: grid; gap: 0.1rem; margin: 0; }
.clock-place { color: var(--muted); }
.clock time {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 340;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.1;
}
.clocks-line {
  flex: 1 1 auto;
  min-width: 3rem;
  max-width: 10rem;
  height: 1px;
  background: var(--gold);
  position: relative;
}
.clocks-line::before, .clocks-line::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 7px; height: 7px;
  border-radius: 50%;
}
.clocks-line::before { left: -1px; background: var(--ivory); box-shadow: 0 0 0 1px var(--gold); }
.clocks-line::after { right: -1px; background: var(--coral); }
/* Without JavaScript there is no time to show, so the clocks stay hidden */
.clocks { display: none; }
.js .clocks { display: flex; }

/* 5. Header, mobile menu, footer ========================================== */
.header-sentinel { position: absolute; top: 24px; left: 0; width: 1px; height: 1px; pointer-events: none; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  view-transition-name: site-header;
}
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
.site-header.is-condensed::before { opacity: 1; }
.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--brand-ink);
  text-decoration: none;
}
.brand svg {
  height: 30px;
  width: auto;
  transform-origin: left center;
  transition: transform var(--dur-2) var(--ease-out);
}
@media (min-width: 600px) { .brand svg { height: 38px; } }
.site-header.is-condensed .brand svg { transform: scale(0.88); }

.site-nav { display: none; }
.site-nav ul { list-style: none; display: flex; align-items: center; gap: clamp(1.25rem, 2.4vw, 2.5rem); }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--step--1);
  font-weight: 620;
  text-decoration: none;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 9px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--dur-2) var(--ease-out);
}
.nav-link:hover::after, .nav-link:focus-visible::after { transform: scaleX(1); transform-origin: left center; }
.nav-link[aria-current="page"]::after { transform: scaleX(1); height: 2px; background: var(--gold); }
.site-nav .btn[aria-current="page"] { box-shadow: inset 0 0 0 2px var(--gold); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.js .icon-btn { display: inline-flex; }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  font-size: var(--step--1);
  cursor: pointer;
}
.js .menu-toggle { display: inline-flex; }
.menu-toggle .bars { display: grid; gap: 4px; width: 16px; }
.menu-toggle .bars span { display: block; height: 1.5px; background: currentColor; }
/* Without JavaScript the mobile menu can't open, so the nav wraps instead */
.no-js-nav { display: block; padding-bottom: var(--space-3); }
.no-js-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.js .no-js-nav { display: none; }

@media (min-width: 960px) {
  .site-nav { display: block; }
  .js .menu-toggle { display: none; }
  .no-js-nav { display: none; }
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  padding: 0 var(--pad) calc(var(--space-6) + env(safe-area-inset-bottom));
  background: var(--emerald-950);
  color: var(--ivory);
  --text: var(--ivory);
  --focus: var(--gold);
  --rule: rgba(250, 247, 240, 0.18);
  --rule-strong: rgba(250, 247, 240, 0.45);
  overflow-y: auto;
  visibility: hidden;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 520ms var(--ease-in-out), visibility 0s linear 520ms;
}
.mobile-menu.is-open {
  visibility: visible;
  clip-path: inset(0 0 0 0);
  transition: clip-path 520ms var(--ease-in-out), visibility 0s;
}
.mobile-menu .header-inner .brand { color: var(--ivory); }
.mobile-menu nav { margin-top: clamp(1.5rem, 6vh, 4rem); }
.mobile-menu ul { list-style: none; display: grid; }
.mobile-menu li { overflow: hidden; border-bottom: 1px solid var(--rule); }
.mobile-menu li a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 4vw, 3.2rem);
  font-weight: 340;
  line-height: 1.1;
  text-decoration: none;
  transform: translateY(105%);
  transition: transform 560ms var(--ease-out);
}
.mobile-menu li a[aria-current="page"] { color: var(--gold); }
.mobile-menu.is-open li a { transform: translateY(0); }
.mobile-menu.is-open li:nth-child(1) a { transition-delay: 140ms; }
.mobile-menu.is-open li:nth-child(2) a { transition-delay: 190ms; }
.mobile-menu.is-open li:nth-child(3) a { transition-delay: 240ms; }
.mobile-menu.is-open li:nth-child(4) a { transition-delay: 290ms; }
.mobile-menu.is-open li:nth-child(5) a { transition-delay: 340ms; }
.mobile-menu-foot { margin-top: auto; padding-top: var(--space-7); display: grid; gap: var(--space-2); color: #C5D3CC; }
.mobile-menu-foot a { color: var(--ivory); min-height: 44px; display: inline-flex; align-items: center; }

/* Footer */
.site-footer {
  background-color: var(--footer-bg);
  color: var(--ivory);
  --text: var(--ivory);
  --muted: #C5D3CC;
  --rule: rgba(250, 247, 240, 0.18);
  --focus: var(--gold);
  padding-top: clamp(3.5rem, 2.5rem + 4vw, 6.5rem);
}
.footer-top { row-gap: var(--space-7); align-items: end; }
.footer-brand .brand { color: var(--ivory); }
.footer-brand .brand svg { height: 40px; }
.footer-line {
  margin-top: var(--space-5);
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 340;
  line-height: 1.12;
  max-width: 18ch;
}
.footer-nav { row-gap: var(--space-6); margin-top: clamp(3rem, 2rem + 4vw, 5.5rem); }
.footer-col h2 {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-bottom: var(--space-3);
}
.footer-col ul { list-style: none; }
.footer-col a, .footer-col li span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.footer-col a:hover { text-decoration: underline; }
.footer-legal {
  margin-top: clamp(3rem, 2rem + 4vw, 5rem);
  padding-block: var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  font-size: var(--step--1);
  color: var(--muted);
}
.footer-legal p { margin: 0; max-width: none; }
.footer-legal ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.footer-legal a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ivory); }

@media (min-width: 900px) {
  .footer-brand { grid-column: 1 / 7; }
  .footer-clocks { grid-column: 8 / -1; justify-self: end; }
  .footer-col:nth-child(1) { grid-column: 1 / 4; }
  .footer-col:nth-child(2) { grid-column: 4 / 7; }
  .footer-col:nth-child(3) { grid-column: 8 / -1; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .footer-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-nav > * { grid-column: auto; }
}

/* 6. Page sections ======================================================== */

/* --- Home hero ---------------------------------------------------------- */
.hero { padding-top: clamp(2.5rem, 1.5rem + 5vw, 7rem); padding-bottom: var(--section-y); }
.hero-title {
  font-size: var(--step-6);
  font-weight: 340;
  line-height: 0.97;
  letter-spacing: -0.03em;
}
.hero-title .line { display: block; }
.hero-body { margin-top: clamp(2rem, 1rem + 4vw, 4.5rem); row-gap: var(--space-7); align-items: end; }
.hero-lede { font-size: var(--step-1); line-height: 1.55; max-width: 40ch; }
.hero-figure { margin: 0; }
@media (max-width: 899px) { .hero-figure .frame--3x1 { aspect-ratio: 2 / 1; } }
@media (min-width: 900px) {
  .hero-title { grid-column: 1 / -1; }
  /* The second line steps in by two columns: growth, moving across */
  .hero-title .line + .line { padding-left: calc((100% - 11 * var(--gutter)) / 12 * 2 + 2 * var(--gutter)); }
  .hero-text { grid-column: 1 / 6; grid-row: 1; }
  .hero-figure { grid-column: 6 / -1; grid-row: 1; margin-right: calc(var(--pad) * -1); }
  .hero-figure figcaption { padding-right: var(--pad); }
}
@media (min-width: 1440px) {
  /* Past the max width, bleed the photo to the window edge */
  .hero-figure { margin-right: calc((100vw - var(--max)) / -2 - var(--pad)); }
}

/* --- The gold thread (home): runs down the left margin as you scroll ----- */
.threaded { position: relative; }
.thread, .thread-node { display: none; }
@media (min-width: 1200px) {
  .thread {
    display: block;
    position: absolute;
    z-index: 5;
    top: 0;
    bottom: calc(var(--section-y) + 26px);
    left: var(--thread-x);
    width: 1px;
    background: var(--rule);
    pointer-events: none;
  }
  .thread span {
    display: block;
    height: 100%;
    background: var(--gold);
    transform-origin: top center;
    transform: scaleY(var(--progress, 1));
  }
  .thread-node {
    display: block;
    position: absolute;
    z-index: 6;
    left: calc(var(--thread-x) - 5px);
    top: calc(var(--section-y) + 0.6em);
    width: 11px; height: 11px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: var(--bg);
  }
  .band .thread-node { background: var(--band-bg); }
  .thread-node::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--gold);
    transform: scale(var(--lit, 1));
    transition: transform var(--dur-2) var(--ease-out);
  }
  .thread-node--end { top: auto; bottom: var(--section-y); }
  .thread-node--end::after { background: var(--coral); }
}

/* --- Section head pattern -------------------------------------------- */
.section-head { row-gap: var(--space-5); align-items: end; }
.section-title { font-size: var(--step-4); }
@media (min-width: 900px) {
  .section-head .section-title { grid-column: 1 / 7; }
  .section-head p { grid-column: 8 / 12; }
}

/* --- Home: the three practices as an index -------------------------- */
.practice-index { list-style: none; margin-top: clamp(2.5rem, 2rem + 3vw, 5rem); border-top: 1px solid var(--rule-strong); }
.practice-row {
  position: relative;
  border-bottom: 1px solid var(--rule);
  padding-block: clamp(1.5rem, 1rem + 2vw, 2.75rem);
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  column-gap: var(--gutter);
  row-gap: var(--space-3);
  align-items: start;
}
.practice-row::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--gutter) * -0.5);
  background: var(--bg-alt);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--dur-2) var(--ease-out);
}
.practice-row:hover::before, .practice-row:focus-within::before { opacity: 1; }
.practice-row .num { font-size: var(--step-3); padding-top: 0.1em; }
.practice-row h3 { font-size: var(--step-3); }
.practice-row h3 a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  text-decoration: none;
}
/* Stretch the heading link over the whole row */
.practice-row h3 a::after { content: ""; position: absolute; inset: 0; }
.practice-row h3 .arrow { width: 0.62em; height: 0.62em; flex: none; transition: transform var(--dur-2) var(--ease-out); }
.practice-row:hover h3 .arrow, .practice-row h3 a:focus-visible .arrow { transform: translateX(6px); }
.practice-row h3 a:focus-visible { outline: none; }
.practice-row:has(a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 4px; }
.practice-row p { grid-column: 2; color: var(--muted); max-width: 46ch; }
.practice-row .frame { display: none; }
.practice-row .frame img { transition: transform 900ms var(--ease-out); }
.practice-row:hover .frame img { transform: scale(1.06); }
@media (min-width: 900px) {
  .practice-row { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: center; }
  .practice-row .num { grid-column: 1 / 3; font-size: var(--step-4); }
  .practice-row h3 { grid-column: 3 / 7; }
  .practice-row p { grid-column: 7 / 11; }
  .practice-row .frame { display: block; grid-column: 11 / -1; }
}

/* --- Home: why RIVA ------------------------------------------------- */
.why { row-gap: var(--space-7); }
.principles { display: grid; gap: var(--space-7) var(--gutter); }
.principle { border-top: 1px solid var(--gold); padding-top: var(--space-5); }
.principle h3 { font-size: var(--step-3); margin-bottom: var(--space-4); }
.principle p { color: var(--muted); max-width: 40ch; }
@media (min-width: 900px) {
  .why .section-title { grid-column: 1 / 5; align-self: start; position: sticky; top: calc(var(--header-h) + 2rem); }
  .principles { grid-column: 6 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .principle:nth-child(even) { margin-top: var(--space-8); }
}

/* --- Closing call to action band ------------------------------------ */
.cta-title { font-size: var(--step-5); font-weight: 330; line-height: 1; letter-spacing: -0.028em; max-width: 16ch; }
@media (min-width: 900px) {
  .cta-title { grid-column: 1 / 11; }
  .cta .actions { grid-column: 1 / -1; }
}

/* --- Inner page hero ---------------------------------------------- */
.page-hero { padding-top: clamp(2.5rem, 1.5rem + 5vw, 7rem); padding-bottom: clamp(2.5rem, 2rem + 3vw, 5rem); row-gap: var(--space-6); }
.page-title { font-size: var(--step-5); font-weight: 340; line-height: 1; letter-spacing: -0.028em; }
.page-intro { font-size: var(--step-1); line-height: 1.55; max-width: 52ch; }
@media (min-width: 900px) {
  .page-title { grid-column: 1 / 11; }
  .page-intro { grid-column: 3 / 10; }
}

/* --- Services: sticky practice sub-nav ------------------------------ */
.subnav {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: var(--bg);
  border-block: 1px solid var(--rule);
}
.subnav ul {
  list-style: none;
  display: flex;
  gap: clamp(1rem, 4vw, 3rem);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav ul::-webkit-scrollbar { display: none; }
.subnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--subnav-h);
  white-space: nowrap;
  font-weight: 620;
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--muted);
}
.subnav a .sub-num { font-family: var(--font-display); color: var(--accent-ink); font-size: var(--step-0); }
.subnav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-2) var(--ease-out);
}
.subnav a:hover { color: var(--text); }
.subnav a.is-active { color: var(--text); }
.subnav a.is-active::after { transform: scaleX(1); }

.practice-section { scroll-margin-top: calc(var(--header-h) + var(--subnav-h)); }
.ps-head { display: flex; align-items: baseline; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-6); }
.ps-head .num { font-size: var(--step-5); }
.ps-head h2 { font-size: var(--step-4); }
.ps-block + .ps-block { margin-top: clamp(2.5rem, 2rem + 2.5vw, 4.5rem); }
.ps-cta { margin-top: clamp(2.5rem, 2rem + 2.5vw, 4rem); }

/* Offerings ("What we do"): hairline-topped entries */
.offerings { display: grid; gap: var(--space-6) var(--gutter); }
.offering { border-top: 1px solid var(--rule-strong); padding-top: var(--space-4); }
.offering h4 { font-size: var(--step-1); margin-bottom: var(--space-2); }
.offering p { color: var(--muted); font-size: var(--step-0); }
@media (min-width: 600px) { .offerings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Steps as a vertical timeline joined by a gold line (Technology) */
.timeline { list-style: none; display: grid; gap: var(--space-6); }
.timeline li { position: relative; display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: var(--space-4); }
.timeline .num { font-size: var(--step-3); }
.timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 3.1rem;
  bottom: calc(var(--space-6) * -1 + 0.4rem);
  width: 1px;
  background: var(--gold);
}
.timeline h4 { font-size: var(--step-1); margin-bottom: var(--space-2); padding-top: 0.3em; }
.timeline p { color: var(--muted); }

/* Technology layout: sticky photo left, content right */
.ps--tech .ps-figure { margin: 0 0 var(--space-7); }
@media (min-width: 900px) {
  .ps--tech .ps-figure { grid-column: 1 / 6; margin: 0; position: sticky; top: calc(var(--header-h) + var(--subnav-h) + 2rem); align-self: start; }
  .ps--tech .ps-body { grid-column: 7 / -1; }
}

/* Consulting layout: text-led on the alternate ground, photo offset right */
.ps--consult .ps-lead-wrap { margin-bottom: clamp(2.5rem, 2rem + 3vw, 5rem); }
.ps--consult .lead { font-size: var(--step-3); max-width: 26ch; }
.def-rows { display: grid; }
.def-row { display: grid; gap: var(--space-2) var(--gutter); padding-block: var(--space-5); border-top: 1px solid var(--rule-strong); }
.def-row:last-child { border-bottom: 1px solid var(--rule-strong); }
.def-row h4 { font-size: var(--step-1); }
.def-row p { color: var(--muted); }
.columns-3 { list-style: none; display: grid; gap: var(--space-6) var(--gutter); }
.columns-3 li { display: grid; gap: var(--space-3); align-content: start; }
.columns-3 .num { font-size: var(--step-5); }
.columns-3 h4 { font-size: var(--step-2); }
.columns-3 p { color: var(--muted); }
.ps--consult .ps-figure { margin: 0 0 var(--space-6); }
@media (min-width: 600px) {
  .def-row { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
}
@media (min-width: 900px) {
  .ps--consult .ps-main { grid-column: 1 / 8; }
  .ps--consult .ps-side { grid-column: 9 / -1; }
  .ps--consult .ps-figure { margin-top: calc(clamp(2.5rem, 2rem + 3vw, 5rem) * -2.2); }
  .ps--consult .ps-steps { grid-column: 1 / -1; }
  .columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .columns-3 li + li { border-left: 1px solid var(--rule); padding-left: var(--gutter); }
}

/* Global trade layout: tall photo right, route-line steps across */
.ps--trade .ps-figure { margin: 0 0 var(--space-7); }
.ps--trade .ps-offer { margin-top: clamp(2.5rem, 2rem + 2.5vw, 4.5rem); }
.route { list-style: none; display: grid; gap: var(--space-6); position: relative; padding-left: 2rem; }
.route::before {
  content: "";
  position: absolute;
  left: 5px; top: 0.6rem; bottom: 0.6rem;
  width: 1px;
  background: var(--gold);
}
.route li { position: relative; }
.route li::before {
  content: "";
  position: absolute;
  left: calc(-2rem + 0px);
  top: 0.45rem;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: var(--bg);
}
.route li:last-child::before { background: var(--coral); border-color: var(--coral); }
.route .num { font-size: var(--step-3); display: block; margin-bottom: var(--space-3); }
.route h4 { font-size: var(--step-2); margin-bottom: var(--space-2); }
.route p { color: var(--muted); max-width: 36ch; }
@media (min-width: 900px) {
  .ps--trade .ps-intro { grid-column: 1 / 8; grid-row: 1; }
  .ps--trade .ps-figure { grid-column: 9 / -1; grid-row: 1 / span 2; margin: 0; }
  .ps--trade .ps-offer { grid-column: 1 / 8; grid-row: 2; }
  .ps--trade .ps-route { grid-column: 1 / -1; }
  .ps--trade .ps-for { grid-column: 1 / 8; }
  .route { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); padding-left: 0; padding-top: 2.5rem; }
  .route::before { left: 0; right: 0; top: 5px; bottom: auto; width: auto; height: 1px; }
  .route li::before { left: 0; top: -2.5rem; }
}
.services-close { row-gap: var(--space-5); align-items: end; }
.services-close h2 { font-size: var(--step-4); max-width: 18ch; }
@media (min-width: 900px) {
  .services-close h2 { grid-column: 1 / 9; }
  .services-close .actions { grid-column: 9 / -1; justify-self: end; margin: 0; }
}

/* --- About ------------------------------------------------------------ */
.mission { row-gap: var(--space-5); }
.mission h2 { font-size: var(--step-2); color: var(--muted); }
.mission-text {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 340;
  line-height: 1.22;
  letter-spacing: -0.012em;
  max-width: 30ch;
}
@media (min-width: 900px) {
  .mission h2 { grid-column: 1 / 4; padding-top: 0.5em; }
  .mission-text { grid-column: 4 / 12; }
}
.values { margin-top: clamp(2.5rem, 2rem + 3vw, 5rem); }
.value { padding-block: var(--space-6); border-top: 1px solid var(--rule-strong); row-gap: var(--space-3); }
.value:last-child { border-bottom: 1px solid var(--rule-strong); }
.value dt { font-family: var(--font-display); font-size: var(--step-3); font-weight: 360; line-height: 1.1; }
.value dd { margin: 0; color: var(--muted); font-size: var(--step-1); line-height: 1.55; max-width: 46ch; }
@media (min-width: 900px) {
  .value dt { grid-column: 1 / 5; }
  .value dd { grid-column: 6 / 12; padding-top: 0.35em; }
}

/* The bridge section: the signature moment of the site */
.bridge { background-color: var(--emerald-950); color: var(--ivory); --text: var(--ivory); --muted: #B4C1BA; --rule: rgba(250,247,240,0.18); --accent-ink: var(--gold); --focus: var(--gold); overflow: hidden; }
.bridge h2 { font-size: var(--step-5); font-weight: 320; letter-spacing: -0.028em; max-width: 14ch; }
.bridge .lead { margin-top: var(--space-6); font-size: var(--step-2); max-width: 36ch; }
.bridge-visual { margin-top: clamp(3rem, 2rem + 5vw, 7rem); row-gap: var(--space-6); }
.bridge-arc { display: none; }
.bridge-end { margin: 0; }
.bridge-end figcaption { color: var(--muted); }
.bridge-end .clock { margin-top: var(--space-4); }
.bridge-end .clock time { font-size: var(--step-3); }
.bridge-end .clock-place::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 0.55em;
  vertical-align: 0.05em;
}
.bridge-end--us .clock-place::before { background: var(--ivory); }
.bridge-end--in .clock-place::before { background: var(--coral); }
.bridge-text { margin-top: clamp(3rem, 2rem + 4vw, 6rem); row-gap: var(--space-5); }
.bridge-text p { color: #D9E2DD; font-size: var(--step-1); line-height: 1.6; max-width: 44ch; }
@media (min-width: 900px) {
  .bridge h2 { grid-column: 1 / 9; }
  .bridge .lead { grid-column: 1 / 8; }
  .bridge-arc {
    display: block;
    grid-column: 3 / 11;
    grid-row: 1;
    height: clamp(90px, 11vw, 170px);
    margin-inline: calc(var(--gutter) * 1.2);
    position: relative;
  }
  .bridge-arc svg { width: 100%; height: 100%; overflow: visible; }
  .bridge-arc path { fill: none; stroke: var(--gold); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
  .bridge-arc::before, .bridge-arc::after {
    content: "";
    position: absolute;
    bottom: -6px;
    width: 12px; height: 12px;
    border-radius: 50%;
  }
  .bridge-arc::before { left: -6px; background: var(--ivory); }
  .bridge-arc::after { right: -6px; background: var(--coral); }
  .bridge-end--us { grid-column: 1 / 6; grid-row: 2; }
  .bridge-end--in { grid-column: 8 / -1; grid-row: 2; }
  .bridge-text p:first-child { grid-column: 2 / 7; }
  .bridge-text p:last-child { grid-column: 8 / -1; }
}

/* --- Markets ---------------------------------------------------------- */
.industries { list-style: none; row-gap: var(--space-7); margin-top: clamp(2.5rem, 2rem + 3vw, 4.5rem); }
.industry { border-top: 1px solid var(--rule-strong); padding-top: var(--space-5); }
.industry h3 { font-size: var(--step-2); margin-bottom: var(--space-3); }
.industry p { color: var(--muted); max-width: 40ch; }
.industry--lead h3 { font-size: var(--step-4); max-width: 12ch; }
.industry--lead p { font-size: var(--step-1); }
@media (min-width: 900px) {
  .industry--lead { grid-column: 1 / 8; grid-row: 1 / span 2; }
  .industry:nth-child(2) { grid-column: 9 / -1; }
  .industry:nth-child(3) { grid-column: 9 / -1; }
  .industry:nth-child(4) { grid-column: 1 / 6; }
  .industry:nth-child(5) { grid-column: 7 / 12; }
}
.places { row-gap: var(--space-7); margin-top: clamp(2.5rem, 2rem + 3vw, 4.5rem); align-items: start; }
.place h3 { font-size: var(--step-5); font-weight: 320; letter-spacing: -0.03em; margin-bottom: var(--space-4); }
.place p { font-size: var(--step-1); max-width: 30ch; }
.place .clock { margin-top: var(--space-5); }
.place-link { display: none; }
@media (min-width: 900px) {
  .place--us { grid-column: 1 / 6; }
  .place-link {
    display: block;
    grid-column: 6 / 8;
    align-self: start;
    margin-top: calc(var(--step-5) * 0.55);
    height: 1px;
    background: var(--gold);
    position: relative;
  }
  .place-link::before, .place-link::after { content: ""; position: absolute; top: -5px; width: 11px; height: 11px; border-radius: 50%; }
  .place-link::before { left: -14px; background: var(--emerald); }
  .place-link::after { right: -14px; background: var(--coral); }
  .place--in { grid-column: 8 / -1; }
  .places-note { grid-column: 1 / 9; }
}
.places-note { font-family: var(--font-display); font-size: var(--step-2); font-weight: 360; line-height: 1.3; max-width: 34ch; margin-top: var(--space-6); }

/* 7. Forms and legal pages ================================================ */
.contact-grid { row-gap: var(--space-8); }
@media (min-width: 900px) {
  .contact-form-wrap { grid-column: 1 / 8; }
  .contact-aside { grid-column: 9 / -1; align-self: start; position: sticky; top: calc(var(--header-h) + 2rem); }
}
.form { display: grid; gap: var(--space-5); }
.form-row { display: grid; gap: var(--space-5); }
@media (min-width: 600px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: grid; gap: 0.45rem; align-content: start; }
.field label, .field legend { font-weight: 650; font-size: var(--step--1); padding: 0; }
.field .optional { font-weight: 500; color: var(--muted); }
.field input, .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-field);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: max(16px, var(--step-0)); /* 16px+ stops iOS zooming in */
}
.field textarea { min-height: 170px; resize: vertical; line-height: 1.55; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--text); }
.field [aria-invalid="true"] { border-color: var(--error-ink); border-width: 2px; }
.field-error { color: var(--error-ink); font-size: var(--step--1); font-weight: 600; margin: 0; }
.field-error:empty { display: none; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: 0.2rem; }
.choice { position: relative; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 1.1rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
  font-weight: 600;
  pointer-events: none;
}
.choice input:checked + span { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
.choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-note { font-size: var(--step--1); color: var(--muted); }
.form-status { font-weight: 600; }
.form-status:empty { display: none; }
.form-status.is-error { color: var(--error-ink); }
.form-success { border-top: 2px solid var(--gold); padding-top: var(--space-6); }
.form-success h2 { font-size: var(--step-4); margin-bottom: var(--space-4); }
.contact-aside dl { display: grid; gap: var(--space-6); margin: 0; }
.contact-aside dt { color: var(--muted); font-size: var(--step--1); margin-bottom: 0.2rem; }
.contact-aside dd { margin: 0; font-family: var(--font-display); font-size: var(--step-2); line-height: 1.25; }
.contact-aside dd a { text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.contact-aside .clocks { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--rule); }

/* Legal pages */
.legal-wrap { row-gap: var(--space-7); }
.legal-toc { font-size: var(--step--1); }
.legal-toc h2 { font-family: var(--font-sans); font-size: var(--step--1); font-weight: 700; color: var(--muted); margin-bottom: var(--space-2); }
.legal-toc ol { list-style: none; display: grid; }
.legal-toc a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; }
.legal-toc a:hover { text-decoration: underline; }
.legal { max-width: 68ch; }
.legal h2 { font-size: var(--step-2); margin: 2.4em 0 0.7em; scroll-margin-top: calc(var(--header-h) + 1rem); }
.legal h2:first-child { margin-top: 0; }
.legal ul { padding-left: 1.2rem; margin-bottom: 1em; }
.legal li { margin-bottom: 0.4em; }
.legal .effective { font-size: var(--step--1); color: var(--muted); }
mark.placeholder {
  background: var(--mark-bg);
  color: var(--text);
  outline: 1.5px dashed var(--error-ink);
  outline-offset: 1px;
  padding: 0.05em 0.35em;
  border-radius: 2px;
  font-weight: 700;
}
.legal .placeholder-block { display: block; padding: 0.9em 1em; margin: 0.4em 0 1em; }
@media (min-width: 900px) {
  .legal-toc { grid-column: 1 / 4; position: sticky; top: calc(var(--header-h) + 2rem); align-self: start; }
  .legal { grid-column: 5 / 12; }
}

/* Credits */
.credits { list-style: none; display: grid; gap: 0; max-width: 72ch; }
.credits li { padding-block: var(--space-5); border-top: 1px solid var(--rule); display: grid; gap: var(--space-4); grid-template-columns: 96px minmax(0, 1fr); align-items: start; }
.credits li:last-child { border-bottom: 1px solid var(--rule); }
.credits .frame { width: 96px; }
.credits h2 { font-size: var(--step-1); margin-bottom: 0.3rem; }
.credits p { font-size: var(--step--1); color: var(--muted); margin: 0; }

/* 404 */
.lost { min-height: 60vh; align-content: center; row-gap: var(--space-6); }
.lost svg { width: min(100%, 520px); height: 24px; }
.lost-line path { stroke: var(--gold); stroke-width: 1.5; fill: none; }

/* 8. Motion =============================================================== */

/* Preloader: first visit per session only. The inline head script adds
   .intro to <html>; everything else is CSS, so it ends by itself (1.2s)
   even if main.js never runs. Skipped under prefers-reduced-motion. */
.intro { display: none; }
html.is-intro .intro {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--emerald-950);
  color: var(--ivory);
  pointer-events: none;
  animation: intro-out 380ms var(--ease-in-out) 820ms forwards;
}
.intro-mark { width: min(62vw, 420px); height: auto; }
.intro-mark .stroke { stroke-dasharray: 1; stroke-dashoffset: 1; }
html.is-intro .intro-mark .stroke { animation: draw 520ms var(--ease-out) forwards; }
html.is-intro .intro-mark .stroke:nth-of-type(2) { animation-delay: 70ms; }
html.is-intro .intro-mark .stroke:nth-of-type(3) { animation-delay: 140ms; }
html.is-intro .intro-mark .stroke:nth-of-type(4) { animation-delay: 210ms; }
html.is-intro .intro-mark .stroke:nth-of-type(5) { animation-delay: 300ms; animation-duration: 260ms; }
.intro-mark .word { opacity: 0; }
html.is-intro .intro-mark .word { animation: fade 300ms ease-out 380ms forwards; }
.intro-inner { position: relative; }
/* The gold line starts at the A's crossbar (35.5 / 56 of the mark's height)
   and sweeps out across the full width of the screen */
.intro-line {
  position: absolute;
  left: calc(50% - 50vw);
  width: 100vw;
  top: calc(35.5 / 56 * 100%);
  height: 2px;
  margin-top: -1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left center;
}
html.is-intro .intro-line { animation: sweep 420ms var(--ease-in-out) 400ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes sweep { to { transform: scaleX(1); } }
@keyframes intro-out {
  from { clip-path: inset(0 0 0 0); }
  to { clip-path: inset(0 0 100% 0); visibility: hidden; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Headline lines rise through a mask, one line at a time */
  .rise .line { overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }
  .rise .line > span { display: block; animation: rise 900ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 110ms + 100ms); }
  html.is-intro .rise .line > span { animation-delay: calc(var(--i, 0) * 110ms + 980ms); }
  .rise-after { animation: fade-up 800ms var(--ease-out) both; animation-delay: 420ms; }
  html.is-intro .rise-after { animation-delay: 1300ms; }

  /* Scroll reveals: main.js marks below-the-fold blocks as pending */
  [data-reveal] { transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }
  [data-reveal].is-pending { opacity: 0; transform: translateY(22px); }

  /* The bridge arc draws itself when it scrolls into view */
  .js .bridge-arc path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1600ms var(--ease-in-out); }
  .js .bridge-arc.is-drawn path { stroke-dashoffset: 0; }
  .js .bridge-arc::after { transform: scale(0); transition: transform 400ms var(--ease-out) 1400ms; }
  .js .bridge-arc.is-drawn::after { transform: scale(1); }

  /* Page transitions (View Transitions API, cross-document) */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vt-out 200ms var(--ease-in) both; }
  ::view-transition-new(root) { animation: vt-in 420ms var(--ease-out) both; }
}
@keyframes rise { from { transform: translateY(108%); } to { transform: translateY(0); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; clip-path: inset(0 0 4% 0); transform: translateY(10px); } }

/* Fallback page transition where the API isn't supported: a short fade-in */
@supports not (view-transition-name: none) {
  @media (prefers-reduced-motion: no-preference) {
    main { animation: fade-up 420ms var(--ease-out) both; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  .intro { display: none !important; }
}

@media print {
  .site-header, .site-footer, .intro, .subnav, .thread, .mobile-menu, body::before { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Single clocks (About, Markets) also need JavaScript to show a time */
.clocks-solo { display: none; }
.js .clocks-solo { display: block; }
