/* ============================================================
   base.css — reset, typography, layout, bento grid, utilities
   Retro-Future Casino Moderne: dark, deco hairlines, grain.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  position: relative;
  min-height: 100vh;
}
/* Subtle film grain + warm vignette over the espresso ground */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(217,164,65,0.06), transparent 60%),
    radial-gradient(100% 60% at 50% 120%, rgba(232,93,117,0.05), transparent 60%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><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.90  0 0 0 0 0.78  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}
body > * { position: relative; z-index: 1; }

img, svg, video { display: block; max-width: 100%; height: auto; }
img { font-style: italic; background: var(--surface-sunk); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); border-radius: 2px; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: 12px; top: 12px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600;
  transform: translateY(-150%); transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
  line-height: var(--lh-tight);
  letter-spacing: var(--track-tight);
  font-weight: 500;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-h3); line-height: 1.3; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
.lead { font-size: 1.2rem; color: var(--text-muted); line-height: 1.55; }
.prose p { margin-bottom: 1.1em; }
.prose { max-width: 65ch; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-cap);
  text-transform: uppercase;
  letter-spacing: var(--track-cap);
  color: var(--accent-ink);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
/* Deco eyebrow rule — a short gold ray before the label */
.eyebrow::before {
  content: ""; display: inline-block; width: 22px; height: 1px;
  background: linear-gradient(to right, transparent, var(--accent));
}
.eyebrow.bare::before { display: none; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.ink { color: var(--ink); }

a.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: color var(--dur) var(--ease);
}
a.link:hover { color: var(--accent-bright); }

/* ---------- Layout ---------- */
.container { width: var(--maxw); margin-inline: auto; padding-inline: 16px; }
.container.narrow { width: var(--maxw-narrow); }
.section { padding-block: var(--s-8); }
.section.tight { padding-block: var(--s-7); }
.section + .section { padding-top: 0; }
.section-head { max-width: 60ch; margin-bottom: var(--s-6); }
.section-head .eyebrow { display: inline-flex; margin-bottom: 12px; }
.section-head h2 { margin-bottom: 12px; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; }

/* Deco double rule under section heads */
.section-head.deco h2 { padding-bottom: 14px; border-bottom: 1px solid var(--border); position: relative; }
.section-head.deco h2::after {
  content: ""; position: absolute; left: 0; bottom: -3px; height: 1px; width: 38%;
  background: linear-gradient(to right, var(--accent), transparent);
}

/* ---------- Bento grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--gap);
}
.bento.tight { gap: var(--gap-tight); }
.bento > * { grid-column: span 12; }

@media (min-width: 720px) {
  .bento > .b-span-6 { grid-column: span 6; }
  .bento > .b-span-4 { grid-column: span 4; }
  .bento > .b-span-8 { grid-column: span 8; }
  .bento > .b-span-3 { grid-column: span 3; }
  .bento > .b-span-9 { grid-column: span 9; }
  .bento > .b-row-2 { grid-row: span 2; }
}
@media (min-width: 1024px) {
  .bento > .b-lg-4 { grid-column: span 4; }
  .bento > .b-lg-6 { grid-column: span 6; }
  .bento > .b-lg-8 { grid-column: span 8; }
  .bento > .b-lg-3 { grid-column: span 3; }
  .bento > .b-lg-9 { grid-column: span 9; }
  .bento > .b-lg-5 { grid-column: span 5; }
  .bento > .b-lg-7 { grid-column: span 7; }
}

/* ---------- Card base ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card.sunk { background: var(--surface-sunk); }
.card.raise { background: var(--surface-raise); }
.card.flat { box-shadow: none; }
.card.raised:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--accent-line); }
.card.pad-6 { padding: var(--s-6); }
.card.pad-4 { padding: var(--s-4); }

/* Deco corner marks — subtle gold brackets on feature cards */
.card.deco { position: relative; }
.card.deco::before, .card.deco::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 1px solid var(--accent-line); opacity: 0.7;
}
.card.deco::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.card.deco::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
}
.pill.gold { border-color: var(--accent-line); background: var(--accent-tint); color: var(--accent-bright); }
.pill.good { border-color: color-mix(in oklab, var(--good) 45%, transparent); background: var(--good-tint); color: var(--good); }
.pill.warn { border-color: color-mix(in oklab, var(--warn) 45%, transparent); background: var(--warn-tint); color: var(--warn); }
.pill.neon { border-color: color-mix(in oklab, var(--neon) 45%, transparent); background: var(--neon-tint); color: var(--neon-soft); }
.pill.ghost { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1;
  border: 1px solid transparent;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #FFF1D0; }
.btn-gold { background: linear-gradient(180deg, var(--accent-bright), var(--accent)); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 18px rgba(217,164,65,0.22); }
.btn-gold:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.22) inset, 0 8px 24px rgba(217,164,65,0.34); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-bright); }
.btn-neon { background: transparent; color: var(--neon-soft); border-color: color-mix(in oklab, var(--neon) 50%, transparent); }
.btn-neon:hover { background: var(--neon-tint); border-color: var(--neon); }
.btn-block { display: flex; width: 100%; }

/* ---------- Helpers ---------- */
.stack > * + * { margin-top: var(--s-4); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-6 > * + * { margin-top: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--rule); border: 0; margin-block: var(--s-6); }
/* Deco divider — gold ray with diamond */
.deco-rule { display: flex; align-items: center; gap: 14px; margin-block: var(--s-6); color: var(--accent-line); }
.deco-rule::before, .deco-rule::after { content: ""; height: 1px; flex: 1; background: linear-gradient(to right, transparent, var(--accent-line), transparent); }
.deco-rule .diamond { width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }

/* ---------- Dossier layout primitives (single-property editorial) ---------- */
.page-grid {
  width: min(100% - clamp(32px, 5vw, 96px), var(--maxw));
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
}
.page-grid > * { grid-column: 1 / -1; }
.article-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(240px, 320px) minmax(0, 1fr);
  gap: 32px;
}
.article-body { grid-column: 2; }
.article-rail { grid-column: 3; position: sticky; top: 104px; align-self: start; }
.section-pad { padding-block: var(--s-8); }
.section-pad.tight { padding-block: var(--s-7); }
.eyebrow-num {
  font-family: var(--font-sans); font-size: var(--fs-cap); font-weight: 700;
  letter-spacing: var(--track-cap); color: var(--accent-ink);
  display: inline-flex; align-items: baseline; gap: 10px;
}
.eyebrow-num .n { font-family: var(--font-display); font-size: 1.1rem; color: var(--accent-bright); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
