/* ============================================================================
   REDOUBT LABS — DESIGN TOKENS & COMPONENTS
   Extracted from redoubtlabs.io. Drop-in stylesheet for the Arena research blog
   and any other Redoubt Labs surface.

   Load order in your blog template:
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Fraunces:opsz,wght@9..144,400;9..144,500&display=swap" rel="stylesheet">
     <link rel="stylesheet" href="redoubt-tokens.css">

   Aesthetic: dark, technical, grid-based. Restrained blue accent.
   Mono = identity/labels/telemetry. Serif (Fraunces italic) = editorial emphasis.
   No gradients, no rounded-corner+left-border cards, no emoji.
   ============================================================================ */

:root {
  /* ---- Surfaces (dark, low-chroma blue-grey) ---- */
  --bg:        oklch(0.155 0.006 250);  /* page background            */
  --bg-deep:   oklch(0.125 0.006 250);  /* footer / recessed panels   */
  --surface:   oklch(0.195 0.007 250);  /* cards                      */
  --surface-2: oklch(0.225 0.008 250);  /* card hover / raised        */

  /* ---- Lines ---- */
  --line:      oklch(0.30 0.008 250);   /* visible dividers / borders */
  --line-soft: oklch(0.245 0.008 250);  /* hairlines, card edges      */

  /* ---- Text ---- */
  --text:      oklch(0.955 0.004 250);  /* primary                    */
  --text-2:    oklch(0.70 0.006 250);   /* secondary / body on dark   */
  --text-3:    oklch(0.52 0.008 250);   /* meta / labels / muted      */

  /* ---- Accent (restrained blue) ---- */
  --accent:      oklch(0.74 0.13 240);
  --accent-2:    oklch(0.86 0.10 240);  /* brighter, for small text   */
  --accent-soft: oklch(0.74 0.13 240 / 0.14);
  --warn:        oklch(0.78 0.14 70);   /* amber — disruption/impact  */

  /* ---- Type ---- */
  --font-sans:  "Söhne", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Fraunces", "Times New Roman", Georgia, serif;

  /* ---- Type scale (display → meta) ---- */
  --fs-display: clamp(40px, 5.4vw, 76px);
  --fs-h1:      clamp(34px, 4.2vw, 56px);
  --fs-h2:      clamp(28px, 3.4vw, 44px);
  --fs-h3:      22px;
  --fs-lead:    19px;
  --fs-body:    17px;
  --fs-small:   14px;
  --fs-meta:    11.5px;

  /* ---- Radius ---- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;

  /* ---- Layout ---- */
  --max:   1280px;   /* site width        */
  --prose: 720px;    /* article measure   */
  --gut:   32px;
}

/* ============================================================================
   BASE
   ============================================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--text); }

/* ============================================================================
   TYPE HELPERS
   ============================================================================ */
.mono  { font-family: var(--font-mono); font-feature-settings: "zero", "ss01"; }
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; }

/* Eyebrow — the mono kicker above headings everywhere on the site. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: 1px;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}

/* ============================================================================
   LAYOUT
   ============================================================================ */
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
.hairline  { border: 0; border-top: 1px solid var(--line-soft); margin: 0; }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 13px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s, color .14s;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--bg-deep); font-weight: 500; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: oklch(0.40 0.008 250); }
.btn .arr { transition: transform .14s; }
.btn:hover .arr { transform: translateX(3px); }

/* ============================================================================
   CARD
   ============================================================================ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: border-color .15s, background .15s;
}
.card:hover { border-color: oklch(0.36 0.01 250); background: var(--surface-2); }
.card .tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: 8px;
}
.card .tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Dashed "substrate"/aside note */
.note {
  padding: 20px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  display: flex;
  gap: 16px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
  background: color-mix(in oklab, var(--surface) 55%, transparent);
}
.note b { color: var(--text); font-weight: 500; }

/* Status pulse (e.g. "research preview") */
.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--text-3); }
.pulse {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
  animation: rl-pulse 1.8s ease-in-out infinite;
}
.pulse.ok { background: oklch(0.74 0.16 145); box-shadow: 0 0 0 3px oklch(0.74 0.16 145 / 0.18); }
@keyframes rl-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* Index/list row (research index, link lists) */
.index-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 120px 24px;
  gap: 32px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s, padding-left .14s;
}
.index-row:first-child { border-top: 1px solid var(--line-soft); }
.index-row:hover { background: color-mix(in oklab, var(--surface) 50%, transparent); padding-left: 12px; }
.index-row .meta  { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--text-3); letter-spacing: 0.08em; }
.index-row .title { font-size: 19px; line-height: 1.35; letter-spacing: -0.012em; color: var(--text); margin: 0; text-wrap: pretty; }
.index-row .kind  { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--text-3); }
.index-row .arr   { color: var(--text-3); transition: color .14s, transform .14s; text-align: right; }
.index-row:hover .arr { color: var(--accent-2); transform: translateX(4px); }
@media (max-width: 720px) {
  .index-row { grid-template-columns: 1fr; gap: 4px; padding: 18px 0; }
  .index-row .arr { display: none; }
}

/* ============================================================================
   LONG-FORM ARTICLE / PROSE  →  the core of the Arena blog
   Wrap article body in <article class="prose"> … </article>
   ============================================================================ */
.article-head {
  max-width: var(--prose);
  margin: 0 auto;
  padding: 72px var(--gut) 0;
}
.article-head .meta {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 22px;
}
.article-head h1 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-h1);
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.article-head h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--accent-2); }
.article-head .standfirst {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  color: var(--text-2);
  margin: 0;
  text-wrap: pretty;
}
.article-head .byline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--fs-small);
  color: var(--text-2);
}
.article-head .byline .mono { color: var(--text-3); }

.prose {
  max-width: var(--prose);
  margin: 0 auto;
  padding: 40px var(--gut) 96px;
  font-size: var(--fs-body);
  line-height: 1.72;
  color: var(--text-2);
}
.prose > * + * { margin-top: 1.4em; }
.prose h2 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.018em;
  color: var(--text);
  margin: 2.2em 0 0;
  text-wrap: balance;
}
.prose h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.012em;
  color: var(--text);
  margin: 1.8em 0 0;
}
.prose h2 + p, .prose h3 + p { margin-top: 0.8em; }
.prose p { margin-top: 1.2em; text-wrap: pretty; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { font-style: italic; }
.prose a {
  color: var(--accent-2);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color .14s;
}
.prose a:hover { text-decoration-color: var(--accent-2); }

.prose ul, .prose ol { margin-top: 1.2em; padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 26px; margin-top: 0.6em; }
.prose ul li::before {
  content: "";
  position: absolute; left: 6px; top: 0.62em;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.prose ol { counter-reset: rl; }
.prose ol li { counter-increment: rl; }
.prose ol li::before {
  content: counter(rl, decimal-leading-zero);
  position: absolute; left: 0; top: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-2);
  line-height: 1.9;
}

/* Pull quote / blockquote */
.prose blockquote {
  margin: 2em 0;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--accent);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.38;
  color: var(--text);
  text-wrap: pretty;
}
.prose blockquote cite {
  display: block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--fs-meta);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Inline + block code */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent-2);
}
.prose pre {
  margin: 1.6em 0;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 20px 22px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

/* Figure + caption (diagrams / schematics) */
.prose figure { margin: 2em 0; }
.prose figure .frame {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 24px;
}
.prose figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.04em;
  color: var(--text-3);
  text-align: center;
}

.prose hr { border: 0; border-top: 1px solid var(--line-soft); margin: 2.4em 0; }

/* Section divider with mono label (e.g. "—— 02 · System implication") */
.prose .marker {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 2.6em 0 -0.6em;
  display: flex; align-items: center; gap: 12px;
}
.prose .marker::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }

/* ============================================================================
   GRID BACKGROUND (optional decorative — for headers/hero)
   Apply to a positioned container; layer a topology SVG above it.
   ============================================================================ */
.grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, color-mix(in oklab, var(--line) 60%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklab, var(--line) 60%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.4;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .pulse, * { animation: none !important; }
}
