/* base.css — shared design tokens and global chrome for all templates.
 *
 * Linked BEFORE each page's inline <style>, so any page-local rule still
 * wins the cascade. This file owns only what is identical across the
 * standard template family: reset, tokens, body defaults, nav (desktop +
 * mobile + hamburger), footer link colours, skip link, reduced-motion.
 *
 * The homepage (body.home-v2) intentionally keeps its own inline tokens
 * and coral nav-CTA override; its later-loaded home-v2.css continues to
 * win where the designs differ.
 *
 * Maintained by scripts/sync_shared.py, which links this file into every
 * page that lacks it.
 */

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

/* ── Global Modern Tech Scrollbar ───────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: #2e2e34 transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #2a2a32;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

*::-webkit-scrollbar-thumb:hover {
  background: #3e3e4a;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

:where(pre, .pipeline, .code-scroll, .table-wrap, [class*='code-scroll'], [class*='table-scroll'])::-webkit-scrollbar-thumb {
  background: #2e2e36;
  border-radius: 3px;
}

:where(pre, .pipeline, .code-scroll, .table-wrap, [class*='code-scroll'], [class*='table-scroll'])::-webkit-scrollbar-thumb:hover {
  background: #4a4a58;
}

:root {
  --bg: #0c0c0d;
  --surface: #141416;
  --surface2: #1a1a1d;
  --border: #222226;
  --border2: #2e2e34;
  --text: #e8e8ec;
  --muted: #a8a8b8;
  --accent: #c8f060;
  --accent-dim: #a8d040;
  --teal: #8be0c8;
  --action: #ea735e;
  --action-soft: #f2a08e;
  --action-dim: #c95a46;
}

/* ── CTA primitives ────────────────────────────────────────────────────
 * Colour contract (docs/site/cta-system.md):
 *   coral fill      = the cluster's ONE primary action (never lime)
 *   neutral outline = secondary action
 *   mint text link  = tertiary / editorial hop
 *   lime (--accent) = success + evidence states ONLY
 * Buttons: ~14px label, min-height 44px, DM Mono, visible focus ring.
 * One filled coral button per CLUSTER; the page intent may repeat at
 * hero, mid-page and ending.
 */

.cta-btn-primary,
:where(.article-body, .cta-band, .cta-snippet, .cta-block, .cta-block-end, .context-cta, aside, main) a.cta-btn-primary,
a.cta-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.5rem;
  background: var(--action) !important;
  color: #0c0c0d !important;
  border: 1px solid var(--action) !important;
  border-bottom: 1px solid var(--action) !important;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cta-btn-primary:hover,
:where(.article-body, .cta-band, .cta-snippet, .cta-block, .cta-block-end, .context-cta, aside, main) a.cta-btn-primary:hover,
a.cta-btn-primary:hover {
  background: var(--action-dim) !important;
  border-color: var(--action-dim) !important;
  border-bottom-color: var(--action-dim) !important;
  color: #0c0c0d !important;
}
.cta-btn-primary:focus-visible { outline: 2px solid var(--action); outline-offset: 3px; }

.cta-btn-outline,
:where(.article-body, .cta-band, .cta-snippet, .cta-block, .cta-block-end, .context-cta, aside, main) a.cta-btn-outline,
a.cta-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.4rem;
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid var(--border2) !important;
  border-bottom: 1px solid var(--border2) !important;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none !important;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cta-btn-outline:hover,
:where(.article-body, .cta-band, .cta-snippet, .cta-block, .cta-block-end, .context-cta, aside, main) a.cta-btn-outline:hover,
a.cta-btn-outline:hover {
  border-color: var(--muted) !important;
  border-bottom-color: var(--muted) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
}
.cta-btn-outline:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--teal) !important;
  font-size: 0.85rem;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px solid rgba(139, 224, 200, 0.4);
  transition: border-color 0.15s;
}
.cta-link:hover { border-bottom-color: var(--teal); }
.cta-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.cta-row .cta-link { margin-left: 0.25rem; }
.cta-snippet .cta-row { justify-content: center; margin-top: 1.25rem; }

/* ── CTA snippet (ending #try section) ──────────────────────────────── */
.cta-snippet { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.75rem; margin-top: 3.5rem; text-align: center; }
.cta-snippet h3 { font-family: 'Instrument Serif', serif; font-size: 1.35rem; font-weight: 400; color: var(--text); margin-bottom: 0.5rem; }
.cta-snippet h2 { font-family: 'Instrument Serif', serif; font-size: 1.3rem; font-weight: 400; color: var(--text); margin-bottom: 0.5rem; }
.cta-snippet > p { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.25rem; }
.cta-actions { display: flex; gap: 0.75rem; justify-content: center; align-items: center; flex-wrap: wrap; }
.cta-tertiary { margin-top: 1.1rem; font-family: 'DM Mono', monospace; font-size: 0.72rem; color: var(--muted); }
.cta-snippet .cta-tertiary a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--border2); }
.cta-snippet .cta-tertiary a:hover { color: var(--accent); border-bottom-color: var(--accent); }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Skip link ── */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 1000; background: var(--accent, #c8f060); color: #0c0c0d; padding: 0.6rem 1.1rem; border-radius: 0 0 6px 0; font-family: 'DM Mono', monospace; font-size: 0.8rem; text-decoration: none; }
.skip-link:focus { left: 0; }

/* ── Nav ── */
nav:not(.breadcrumb-nav) { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 2.5rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(12,12,13,0.95); backdrop-filter: blur(12px); z-index: 100; }
.logo { display: flex; align-items: center; text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 0.82rem; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); }
/* Nav pilot CTA: coral-outline matching the homepage v2 design system */
.nav-links a.btn-nav-cta,
.btn-nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  color: #f2a08e !important;
  border: 1px solid var(--action, #ea735e) !important;
  border-bottom: 1px solid var(--action, #ea735e) !important;
  padding: 0.45rem 1.1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: 'DM Mono', monospace;
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-links a.btn-nav-cta:hover,
.btn-nav-cta:hover {
  background: var(--action, #ea735e) !important;
  border-color: var(--action, #ea735e) !important;
  border-bottom-color: var(--action, #ea735e) !important;
  color: #0c0c0d !important;
}

/* ── Breadcrumb reset ── */
.breadcrumb-nav,
nav.breadcrumb-nav {
  position: static !important;
  background: transparent !important;
  border: none !important;
  border-bottom: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: auto !important;
  display: block;
}

/* ── Hamburger ── */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border2);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.nav-hamburger:hover { border-color: var(--accent); }
.nav-hamburger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.18s ease;
  transform-origin: center;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Mobile nav ── */
@media (max-width: 900px) {
  html, body { overflow-x: clip; }
  body.menu-open { overflow: hidden; }
  nav:not(.breadcrumb-nav) { padding: 1rem 1.25rem; }
  .nav-hamburger { display: flex; }
  .nav-links {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    gap: 0;
    background: rgba(12,12,13,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1.25rem;
    z-index: 99;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease, visibility 0s linear 0.28s;
  }
  .nav-links.open {
    max-height: 80vh;
    opacity: 1;
    visibility: visible;
    padding: 0.5rem 1.25rem 1.25rem;
    transition: max-height 0.32s ease, opacity 0.25s ease, padding 0.32s ease, visibility 0s;
    overflow-y: auto;
  }
  .nav-links a:not(.btn-nav-cta) {
    display: block;
    color: var(--text);
    font-size: 0.92rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-links a:not(.btn-nav-cta):last-of-type { border-bottom: none; }
  .btn-nav-cta { margin-top: 1rem; text-align: center; display: block; }
}

/* Legacy narrow menu block retained until page-local copies are removed. */

/* ── Footer ── */
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* ── Canonical install module ────────────────────────────────────────── */
.install-module {
  max-width: 520px;
  margin: 0 auto 1.25rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.install-module-cmd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
}
.install-module-cmd code {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow-x: auto;
}
.install-module-copy {
  flex-shrink: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.install-module-copy:hover { color: var(--text); border-color: var(--muted); }
.install-module-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.install-module-copy[data-copied="true"] { color: var(--accent); border-color: var(--accent); }
.install-module-meta {
  margin-top: 0.7rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}
.install-module-meta a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.install-module-meta a:hover { color: var(--text); }

/* ── Mid-page CTA band ──────────────────────────────────────────────── */
.cta-band {
  margin: 3rem 0;
  background: rgba(234, 115, 94, 0.05);
  border: 1px solid rgba(234, 115, 94, 0.45);
  border-radius: 12px;
  padding: 1.75rem;
}
.cta-band-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--action);
  margin-bottom: 0.6rem;
}
.cta-band h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.cta-band p { font-size: 0.88rem; color: var(--muted); line-height: 1.65; margin: 0 0 1.25rem; }

/* ── End-of-page block ──────────────────────────────────────────────── */
.cta-block-end {
  margin-top: 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}
.cta-block-end h3 { font-family: 'Inter', sans-serif; font-size: 1.1rem; font-weight: 600; margin-bottom: 0.6rem; }
.cta-block-end p { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.25rem; }

/* ── Article Header Hero (matching demo hero style) ── */
.article-wrap {
  padding-top: 0 !important;
}

.article-header {
  position: relative;
  isolation: isolate;
  max-width: none !important;
  margin: 0 calc(50% - 50vw) 3.5rem !important;
  padding:
    clamp(2.5rem, 5vw, 3.8rem)
    max(1.25rem, calc((100vw - 720px) / 2 + 2rem))
    clamp(2.2rem, 4vw, 3.2rem) !important;
  overflow: hidden;
  border-top: 1px solid #292a2f;
  border-bottom: 1px solid #292a2f;
  background:
    radial-gradient(70% 150% at 78% 0%, rgba(200, 240, 96, 0.065), transparent 58%),
    linear-gradient(145deg, #161719 0%, #111214 68%, #131414 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018), 0 28px 80px rgba(0, 0, 0, 0.12);
}

.article-header::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-image:
    linear-gradient(rgba(200, 240, 96, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 240, 96, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  content: '';
  opacity: 0.32;
  -webkit-mask-image: radial-gradient(ellipse 82% 120% at 62% 6%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 82% 120% at 62% 6%, #000 0%, transparent 72%);
  pointer-events: none;
}

.article-header > * {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 900px) {
  .article-header {
    margin: 0 calc(50% - 50vw) 2.5rem !important;
    padding: clamp(2rem, 5vw, 3rem) 1.25rem clamp(1.75rem, 4vw, 2.5rem) !important;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
