/* ================================================================
   BrainTax — editorial documentary, dark-moody, premium
   Brand palette honored: 70% navy · 20% white · 10% gold + signal
   ================================================================ */

:root {
  --navy: #0A1628;
  --navy-deep: #060F1C;
  --slate: #1A202C;
  --slate-soft: #141B28;
  --white: #FFFFFF;
  --ink-1: #E8ECF2;
  --ink-2: #B6BDCB;
  --gray: #718096;
  --gray-soft: #4A5568;
  --gold: #F5A623;
  --gold-deep: #D69E2E;
  --red: #E53E3E;
  --green: #38A169;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --gold-line: rgba(245, 166, 35, 0.55);
  --gold-faint: rgba(245, 166, 35, 0.18);

  --font-display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1160px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--navy);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main { flex: 1 0 auto; }

/* ---- Ambient layers: gold glow + grain ---- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.ambient::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(1100px 700px at 8% -10%, rgba(245, 166, 35, 0.10), transparent 55%),
    radial-gradient(1400px 900px at 110% 110%, rgba(26, 32, 44, 0.9), transparent 60%);
}
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.96  0 0 0 0 0.96  0 0 0 0 0.96  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.5;
  mix-blend-mode: overlay;
}

body > * { position: relative; z-index: 1; }

/* ---- Layout ---- */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 32px;
}
@media (max-width: 640px) {
  .wrap { padding: 0 22px; }
}

/* ---- Header ---- */
.site-header {
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--navy-deep);
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  border: 1px solid var(--gold-line);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.08);
}
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  font-size: 17px;
}
.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.site-nav a {
  color: inherit;
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color 180ms var(--ease);
}
.site-nav a:hover { color: var(--white); }
.site-nav a[aria-current="page"] { color: var(--gold); }
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--gold);
}
.nav-sep { color: var(--gray-soft); }

/* ---- Eyebrow (bulletin tag) ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 40px;
}
.eyebrow .dot {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.12);
  animation: pulse 2.8s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.12); }
  50%      { box-shadow: 0 0 0 9px rgba(245, 166, 35, 0.02); }
}

/* ---- Hero ---- */
.hero {
  padding: 120px 0 80px;
}
.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(44px, 9vw, 108px);
  line-height: 0.98;
  letter-spacing: -0.028em;
  color: var(--white);
  margin: 0 0 40px;
  max-width: 14ch;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 900ms var(--ease) 80ms forwards;
}
.display .accent {
  color: var(--gold);
  font-style: italic;
  font-weight: 700;
  position: relative;
}
.rule {
  width: 64px;
  height: 1px;
  background: var(--gold-line);
  margin: 28px 0 28px;
  transform-origin: left;
  transform: scaleX(0);
  animation: sweep 900ms var(--ease) 260ms forwards;
}
.lede {
  font-family: var(--font-body);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
  margin: 0 0 72px;
  letter-spacing: -0.005em;
  opacity: 0;
  animation: rise 900ms var(--ease) 380ms forwards;
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sweep {
  to { transform: scaleX(1); }
}

/* ---- Meta row (numerals showcase) ---- */
.meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 36px 0;
  margin-top: 8px;
  opacity: 0;
  animation: rise 900ms var(--ease) 500ms forwards;
}
.meta-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 8px;
  border-right: 1px solid var(--line);
}
.meta-cell:last-child { border-right: 0; }
.meta-num {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.meta-num .meta-unit {
  font-family: var(--font-body);
  font-size: 0.45em;
  font-weight: 600;
  color: var(--ink-2);
  margin-left: 4px;
  letter-spacing: 0;
}
.meta-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
}
@media (max-width: 720px) {
  .meta-row { grid-template-columns: 1fr; }
  .meta-cell { border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 0; }
  .meta-cell:last-child { border-bottom: 0; }
}

/* ---- Section kicker ---- */
.section-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray);
  margin: 0 0 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold-line);
}

/* ---- Platforms list ---- */
.platforms {
  padding: 96px 0 72px;
  border-top: 1px solid var(--line);
}
.platform-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.platform-row {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  align-items: baseline;
  column-gap: 20px;
  padding: 22px 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--font-display);
  transition: background 200ms var(--ease);
}
.platform-row:first-child { border-top: 1px dashed var(--line); }
.platform-row:hover { background: linear-gradient(90deg, rgba(245, 166, 35, 0.04), transparent 60%); }
.platform-idx {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--gray);
}
.platform-name {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--white);
}
.platform-hairline {
  height: 1px;
  background: var(--line);
  align-self: center;
  min-width: 20px;
}
.platform-handle {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--gold);
  text-decoration: none;
  transition: color 180ms var(--ease);
}
.platform-handle:hover { color: var(--white); }
.platform-handle.muted { color: var(--gray); }

@media (max-width: 640px) {
  .platform-row { grid-template-columns: 40px 1fr auto; }
  .platform-hairline { display: none; }
}

/* ---- Dossier (about + legal) ---- */
.dossier {
  padding: 96px 0 120px;
  border-top: 1px solid var(--line);
}
.dossier-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 72px;
  align-items: start;
}
.dossier-col p {
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--ink-2);
  margin: 0 0 18px;
  max-width: 48ch;
}
.dossier-col p.quiet {
  color: var(--gray);
  font-size: 15px;
}
.dossier-col a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-faint);
  transition: border-color 180ms var(--ease);
}
.dossier-col a:hover { border-bottom-color: var(--gold); }

.legal-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.legal-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0) 70%);
  color: var(--ink-1);
  text-decoration: none;
  border-radius: 2px;
  transition: border-color 220ms var(--ease), transform 220ms var(--ease), background 220ms var(--ease);
}
.legal-card:hover {
  border-color: var(--gold-line);
  transform: translateX(2px);
  background: linear-gradient(180deg, rgba(245,166,35,0.04), rgba(245,166,35,0) 70%);
}
.legal-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--gray);
}
.legal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--white);
}
.legal-arrow {
  color: var(--gold);
  font-size: 18px;
  transition: transform 220ms var(--ease);
}
.legal-card:hover .legal-arrow { transform: translateX(4px); }

@media (max-width: 820px) {
  .dossier-grid { grid-template-columns: 1fr; gap: 48px; }
}

/* ================================================================
   DOCUMENT (policy pages)
   ================================================================ */
.doc {
  padding: 72px 0 120px;
}
.doc-head {
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 56px;
}
.doc-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--white);
  margin: 0;
}
.doc-body-wrap { }

.doc-content {
  max-width: 68ch;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink-1);
}
.doc-content p {
  margin: 0 0 20px;
  color: var(--ink-2);
}
.doc-content p strong { color: var(--white); font-weight: 600; }
.doc-content h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--white);
  margin: 56px 0 18px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 16px;
}
.doc-content h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
/* Auto-number the leading "1. / 2." section markers rendered by Markdown — they already carry their own numbers,
   so we lean into that with accent color on the number text itself. */
.doc-content h2::first-letter { color: var(--gold); }

.doc-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--white);
  margin: 36px 0 12px;
  letter-spacing: -0.008em;
}
.doc-content ul, .doc-content ol {
  padding-left: 20px;
  margin: 0 0 24px;
}
.doc-content li {
  margin: 8px 0;
  color: var(--ink-2);
}
.doc-content li::marker { color: var(--gold); }
.doc-content code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--gold);
  background: rgba(245, 166, 35, 0.07);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(245, 166, 35, 0.14);
}
.doc-content a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-faint);
  transition: border-color 180ms var(--ease);
}
.doc-content a:hover { border-bottom-color: var(--gold); }
.doc-content hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 48px 0;
}

/* Policy date stamps (first two <p> elements in policies are date stamps rendered as paragraphs
   with leading <strong>). Give them a distinct editorial treatment. */
.doc-content > p:first-of-type,
.doc-content > p:nth-of-type(2) {
  display: inline-block;
  margin-right: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
}
.doc-content > p:first-of-type strong,
.doc-content > p:nth-of-type(2) strong {
  color: var(--ink-2);
}

/* Callback page — keep its dynamic elements readable */
#status {
  font-family: var(--font-mono);
  color: var(--ink-2);
  margin-bottom: 14px;
}
#code-box {
  background: var(--slate-soft) !important;
  border: 1px solid var(--line);
  padding: 18px !important;
  border-radius: 4px !important;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  word-break: break-all;
  white-space: pre-wrap;
}
#error-box {
  font-family: var(--font-mono);
  color: var(--red) !important;
}

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 72px;
  margin-top: auto;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.25));
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px;
  align-items: start;
}
.foot-col { display: flex; flex-direction: column; gap: 6px; }
.foot-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray);
}
.foot-link {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-1);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
  align-self: start;
}
a.foot-link:hover { color: var(--gold); border-bottom-color: var(--gold-faint); }

.foot-meta { align-items: flex-end; text-align: right; }
.foot-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--white);
  letter-spacing: -0.015em;
}
.foot-fine {
  font-size: 12px;
  color: var(--gray);
  font-style: italic;
}
@media (max-width: 820px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .foot-meta { align-items: flex-start; text-align: left; grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 20px; }
}

/* ---- Selection & focus ---- */
::selection { background: var(--gold); color: var(--navy); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Respect motion prefs ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .display, .lede, .rule, .meta-row { opacity: 1 !important; transform: none !important; }
}
