/* Shared styles for the scrolling sub-pages (/labs, /knowledge).
   Tokens mirror the :root block in index.html. */
:root {
  --ink: #0A1628;
  --navy: #122B4A;
  --navy-2: #1B3357;
  --steel: #2A4978;
  --gold: #C9A961;
  --gold-2: #E5C879;
  --gold-deep: #A88944;
  --paper: #F5F1E8;
  --paper-2: #EFE9DB;
  --bone: #E2DAC6;
  --slate: #4B5A6B;
  --mist: #8A97A6;
  --hairline: rgba(201, 169, 97, .28);
  --hairline-dark: rgba(10, 22, 40, .12);
  --pad-x: clamp(22px, 7vw, 120px);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0 }

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

body {
  font-family: var(--sans);
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}

a { color: inherit }
img { max-width: 100%; display: block }

/* ====== Header ====== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px var(--pad-x);
  background: rgba(10, 22, 40, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 169, 97, .16);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(245, 241, 232, .8);
  white-space: nowrap;
}

.wordmark .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold) }
.wordmark .slash { color: var(--gold); opacity: .7 }
.wordmark .labs { color: var(--gold) }

.site-nav { display: flex; align-items: center; gap: 6px }

.site-nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(245, 241, 232, .7);
  padding: 8px 12px;
  border-radius: 999px;
  transition: color .2s ease, background .2s ease;
}

.site-nav a:hover, .site-nav a:focus-visible { color: var(--gold-2) }
.site-nav a[aria-current="page"] { color: var(--gold); background: rgba(201, 169, 97, .1) }
.site-nav a:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px }

.site-nav .nav-book {
  background: var(--gold);
  color: #0a0e1a;
  margin-left: 6px;
  box-shadow: 0 6px 18px -10px rgba(201, 169, 97, .5);
}

.site-nav .nav-book:hover, .site-nav .nav-book:focus-visible { background: var(--gold-2); color: #0a0e1a }

/* ====== Sections ====== */
.section {
  position: relative;
  padding: clamp(64px, 11vh, 128px) var(--pad-x);
  overflow: hidden;
}

.section.dark {
  background: radial-gradient(1200px 800px at 80% 0%, var(--navy-2) 0%, var(--navy) 35%, var(--ink) 100%);
  color: var(--paper);
}

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

.section.light {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink);
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: .55;
  mix-blend-mode: overlay;
}

.section.light::before { mix-blend-mode: multiply; opacity: .35 }

.inner { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: clamp(18px, 3vh, 28px);
}

.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; opacity: .6 }
.light .eyebrow { color: var(--gold-deep) }

h1.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.02;
  letter-spacing: -.025em;
  text-wrap: balance;
  max-width: 16ch;
  margin-bottom: clamp(22px, 3.4vh, 36px);
}

h2.title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(30px, 3.8vw, 54px);
  line-height: 1.08;
  letter-spacing: -.015em;
  text-wrap: balance;
  max-width: 22ch;
  margin-bottom: clamp(16px, 2.6vh, 26px);
}

h1.display em, h2.title em { font-style: italic; color: var(--gold) }
.light h1.display em, .light h2.title em { color: var(--gold-deep) }

.lede {
  font-size: clamp(16px, 1.25vw, 20px);
  line-height: 1.6;
  max-width: 58ch;
  color: rgba(245, 241, 232, .72);
}

.light .lede { color: var(--slate) }
.lede + .lede { margin-top: 14px }
.lede strong { color: var(--paper); font-weight: 500 }
.light .lede strong { color: var(--ink) }

/* ====== Buttons ====== */
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: clamp(26px, 4vh, 40px) }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 15px 24px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.1;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid var(--gold);
  transition: background .25s ease, color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.btn .arrow { font-family: var(--mono); font-style: normal; font-size: .9em; transition: transform .25s ease }
.btn:hover .arrow, .btn:focus-visible .arrow { transform: translateX(5px) }
.btn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px }

.btn.primary { background: var(--gold); color: #0a0e1a; box-shadow: 0 8px 28px -18px rgba(201, 169, 97, .55) }
.btn.primary:hover, .btn.primary:focus-visible { background: var(--gold-2); border-color: var(--gold-2); transform: translateY(-2px) }

.btn.ghost { background: transparent; color: var(--gold) }
.btn.ghost:hover, .btn.ghost:focus-visible { background: rgba(201, 169, 97, .1); transform: translateY(-2px) }
.light .btn.ghost { color: var(--gold-deep); border-color: var(--gold-deep) }

/* ====== Cards / grids ====== */
.grid { display: grid; gap: clamp(16px, 2vw, 28px) }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)) }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)) }

.card {
  position: relative;
  padding: clamp(24px, 3vw, 40px);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: rgba(10, 22, 40, .35);
}

.light .card { border-color: var(--hairline-dark); background: rgba(255, 255, 255, .45) }

.card .kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

.light .card .kicker { color: var(--gold-deep) }

.card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.15;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}

.card p { font-size: 15px; line-height: 1.6; color: rgba(245, 241, 232, .7) }
.light .card p { color: var(--slate) }

.card ul { list-style: none; margin-top: 18px; display: grid; gap: 10px }

.card li {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(245, 241, 232, .78);
}

.light .card li { color: var(--slate) }

.card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 8px;
  height: 1px;
  background: var(--gold);
}

.section-head { margin-bottom: clamp(32px, 5vh, 56px) }

/* ====== Footer ====== */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  padding: 28px var(--pad-x);
  background: var(--ink);
  border-top: 1px solid rgba(201, 169, 97, .16);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(245, 241, 232, .5);
}

.site-footer a { text-decoration: none }
.site-footer a:hover { color: var(--gold-2) }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 18px }

/* ====== Responsive ====== */
@media (max-width: 980px) {
  .grid.three { grid-template-columns: 1fr 1fr }
}

@media (max-width: 720px) {
  .grid.two, .grid.three { grid-template-columns: 1fr }
  .site-header { padding: 12px 18px }
  .site-nav a:not(.nav-book) { padding: 8px 6px; letter-spacing: .12em }
  .wordmark .full { display: none }
}

@media (max-width: 480px) {
  .site-nav .nav-book { display: none }
  .site-header { gap: 10px }
  .wordmark { gap: 8px; letter-spacing: .16em }
  .site-nav { gap: 2px }
  .site-nav a:not(.nav-book) { padding: 8px 5px; font-size: 10px; letter-spacing: .08em }
}

@media (max-width: 359px) {
  .wordmark .slash, .wordmark .labs { display: none }
}
