/* ==========================================================================
   SCAS — base: tokens, reset, typography, layout primitives
   Design thesis: "Two disciplines, one council."
   Serif (arts) x Grotesk (sciences). Gold (human) x Navy (analytical).
   Concentric rings — many orbits, one center — as the unifying motif.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */

:root {
  /* Brand — sampled from the SCAS ring mark */
  --gold:        #d7b70c;
  --gold-bright: #f2d024;
  /* Gold is only legible as text once it is darkened. Two rungs down from the
     brand gold: --gold-deep clears 3:1 (large text) on both light surfaces,
     --gold-ink clears 4.5:1 for small text. Brand gold itself is graphic-only
     on light, and text-safe only on navy (9.9:1). */
  --gold-deep:   #8f7802;
  --gold-ink:    #6f5c00;

  --ink:    #06092b; /* navy near-black */
  --ink-2:  #0d1240; /* elevated navy */
  --ink-3:  #1b2258; /* hairline on navy */
  --blue:   #2a3aa0; /* royal accent on light */
  --blue-2: #e8eaf8; /* blue tint wash */

  --paper:   #fbfaf6; /* warm off-white */
  --paper-2: #f3f1e9;
  --line:    #ddd9cc;

  --text:  var(--ink);
  --muted: #545879;
  --muted-on-ink: #a8adcf;

  /* Type */
  --font-display: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;

  --fs-display: clamp(3rem, 0.6rem + 9.6vw, 9.5rem);
  --fs-h1:      clamp(2.25rem, 1.2rem + 4.3vw, 5.25rem);
  --fs-h2:      clamp(1.875rem, 1.25rem + 2.6vw, 3.5rem);
  --fs-h3:      clamp(1.1875rem, 1.05rem + 0.6vw, 1.625rem);
  --fs-lead:    clamp(1.0625rem, 0.97rem + 0.5vw, 1.4375rem);
  --fs-body:    clamp(1rem, 0.965rem + 0.16vw, 1.0625rem);
  --fs-sm:      0.875rem;
  --fs-xs:      0.75rem;

  --lh-tight: 0.94;
  --lh-snug: 1.12;
  --lh-body: 1.62;

  --track-eyebrow: 0.16em;

  /* Space & measure */
  --gutter:      clamp(1.25rem, 0.7rem + 2.2vw, 3rem);
  --sp-section:  clamp(4.5rem, 2.8rem + 6.4vw, 9.5rem);
  --sp-block:    clamp(2rem, 1.4rem + 2.4vw, 4rem);
  --maxw:        1320px;
  --maxw-text:   66ch;

  /* Motion */
  --dur-1: 180ms;
  --dur-2: 420ms;
  --dur-3: 950ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --radius: 2px;
  --ring-focus: 3px;
}

/* --- Reset --------------------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg,
video { display: block; max-width: 100%; }

img { height: auto; }

button,
input,
select,
textarea { font: inherit; color: inherit; }

ul[class],
ol[class] { list-style: none; padding: 0; }

a { color: inherit; }

:target { scroll-margin-top: 7rem; }

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

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

.on-ink :focus-visible,
.on-ink:focus-visible { outline-color: var(--gold-bright); }

/* --- Typography ---------------------------------------------------------- */

.display,
.h1,
.h2,
h1,
h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.display {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: -0.035em;
}

h1, .h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: -0.025em; }
h2, .h2 { font-size: var(--fs-h2); line-height: var(--lh-snug); letter-spacing: -0.02em; }

h3, .h3 {
  font-family: var(--font-sans);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.italic { font-style: italic; }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--muted);
  max-width: 54ch;
  text-wrap: pretty;
}

.on-ink .lead { color: var(--muted-on-ink); }

p { text-wrap: pretty; max-width: var(--maxw-text); }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--gold-ink);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--gold);
  flex: none;
}

.on-ink .eyebrow { color: var(--gold); }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Gold underline that draws on hover — used for inline prose links */
.link {
  text-decoration: none;
  background-image: linear-gradient(var(--gold), var(--gold));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 2px;
  padding-bottom: 1px;
  transition: background-size var(--dur-2) var(--ease);
}

.link:hover { background-size: 100% 100%; }

/* --- Layout -------------------------------------------------------------- */

.wrap {
  width: min(100% - (var(--gutter) * 2), var(--maxw));
  margin-inline: auto;
}

.wrap--narrow { max-width: 900px; }

.section { padding-block: var(--sp-section); }
.section--tight { padding-block: clamp(3rem, 2rem + 3.5vw, 5.5rem); }

/* Adjacent sections each contribute their own padding, so a junction is worth
   two gaps. That reads as breathing room when the background changes across it,
   and as a hole when it doesn't. Drop one side where both sides share a
   surface — the next section's padding alone is the intended rhythm. */
.section--flush-bottom { padding-bottom: 0; }

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

.on-ink .rule { border-color: var(--ink-3); }

/* Editorial 12-column grid */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}

.grid--gap-lg { gap: clamp(2rem, 1rem + 3vw, 4.5rem) var(--gutter); }

.col-full { grid-column: 1 / -1; }

@media (min-width: 62rem) {
  /* Set the END, not the shorthand. `grid-column: span N` writes the span into
     grid-column-START and leaves the end auto — so a later `.start-N` rule
     replaces the span outright and the item collapses to one column. Setting
     grid-column-end keeps the two axes independent: .col-full supplies the
     start (1), .col-N the width, .start-N moves the start without touching it. */
  .col-3  { grid-column-end: span 3; }
  .col-4  { grid-column-end: span 4; }
  .col-5  { grid-column-end: span 5; }
  .col-6  { grid-column-end: span 6; }
  .col-7  { grid-column-end: span 7; }
  .col-8  { grid-column-end: span 8; }
  .start-2 { grid-column-start: 2; }
  .start-6 { grid-column-start: 6; }
  .start-7 { grid-column-start: 7; }
  .start-8 { grid-column-start: 8; }
}

/* Auto-fit card rails */
.rail {
  display: grid;
  gap: var(--gutter);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.rail--wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.stack > * + * { margin-top: var(--flow, 1.25rem); }
.stack-sm > * + * { margin-top: 0.6rem; }
.stack-lg > * + * { margin-top: var(--sp-block); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

/* --- Surfaces ------------------------------------------------------------ */

.on-ink {
  background: var(--ink);
  color: var(--paper);
}

.on-ink h1,
.on-ink h2,
.on-ink h3 { color: var(--paper); }

.on-paper-2 { background: var(--paper-2); }

/* Paper grain — one repeating SVG turbulence, no image request */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* --- Utilities ----------------------------------------------------------- */

.visually-hidden {
  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;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--dur-1) var(--ease);
}

.skip-link:focus-visible { transform: translateY(0); }

.text-gold { color: var(--gold); }
.text-gold-ink { color: var(--gold-ink); }
.text-muted { color: var(--muted); }
.on-ink .text-muted { color: var(--muted-on-ink); }
.relative { position: relative; }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* --- Scroll reveal ------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 1.75rem, 0);
  transition:
    opacity var(--dur-3) var(--ease),
    transform var(--dur-3) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] { opacity: 1; transform: none; }
}
