/**
 * Oystro Design Tokens — "Harness UI" · GLOBAL THEME
 * ============================================================================
 * Canonical direction: OPTION 2 — Modern Infra Cyan (#38BDF8) & Deep Navy.
 * This is the single source of truth for colour, typography, spacing, and
 * shared components across oystro.com, staging.oystro.com, the blog, and docs.
 *
 * Usage (every page <head>):
 *   <link rel="stylesheet" href="/assets/css/tokens.css">
 *
 * Theme flip: set data-theme="light" on <html> (dark is the default).
 * The styleguide (design-system.html) may still preview Option 1 / Option 3 by
 * setting data-option="1" | "3"; production pages omit data-option entirely and
 * therefore inherit the canonical Option 2 palette below.
 */

/* ==========================================================================
   1. OPTION 2 · MODERN INFRA CYAN — CANONICAL DEFAULT (DARK)
   ========================================================================== */
:root {
  /* Core surfaces */
  --bg: #060d17;
  --bg-alt: #0a1524;
  --surface: #0f1f33;
  --surface-hover: #162b45;
  --line: #1c3554;
  --line-accent: #294d78;
  --text: #e2eeff;
  --text-muted: #8ca5c4;
  --text-faint: #4e6787;
  --code-bg: #030810;
  --shadow: rgba(3, 8, 16, 0.6);

  /* Accent / brand */
  --accent: #38bdf8;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-contrast: #030810;
  --gate-accent: #38bdf8;
  --link-accent: #38bdf8;

  /* Semantic status */
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.15);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.15);

  /* Typography — web-safe stacks (0ms latency, zero external downloads) */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Menlo, Consolas, monospace;

  /* Typography scale */
  --text-display: clamp(40px, 6vw, 68px);
  --text-h1: clamp(30px, 4.5vw, 42px);
  --text-h2: clamp(22px, 3.2vw, 30px);
  --text-h3: 20px;
  --text-lead: 19px;
  --text-body: 15.5px;
  --text-sm: 13.5px;
  --text-xs: 11.5px;

  /* Spacing, radius, motion */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;

  /* ------------------------------------------------------------------
     Back-compat aliases so legacy pages keep working unchanged.
     (teaser/blog use --ink/--muted/--gold/--success; portal uses
      --panel/--border/--blue.) Aliases resolve lazily, so they follow
      the active theme automatically.
     ------------------------------------------------------------------ */
  --ink: var(--bg);
  --ink-2: var(--bg-alt);
  --surface-2: var(--surface-hover);
  --muted: var(--text-muted);
  --gold: var(--amber);
  --success: var(--green);
  --panel: var(--surface);
  --panel-hover: var(--surface-hover);
  --border: var(--line);
  --border-accent: var(--line-accent);
  --blue: var(--accent);
  --accent-glow: var(--accent-soft);
}

/* ==========================================================================
   2. OPTION 2 · LIGHT MODE
   ========================================================================== */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f4f8fc;
  --surface: #e9f2fa;
  --surface-hover: #dbeaf7;
  --line: #cde0f2;
  --line-accent: #a5c7ea;
  --text: #0a1f38;
  --text-muted: #425b78;
  --text-faint: #7995b5;
  --code-bg: #f0f6fc;
  --shadow: rgba(10, 31, 56, 0.08);

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.14);
  --accent-contrast: #ffffff;
  --gate-accent: #0284c7;
  --link-accent: #0284c7;

  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.12);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
}

/* ==========================================================================
   3. STYLEGUIDE-ONLY PREVIEWS (design-system.html)
   ========================================================================== */

/* Option 1: Sovereign Executive — Warm Gold & Obsidian Bronze (dark) */
:root[data-option="1"] {
  --bg: #0c1314; --bg-alt: #101b1d; --surface: #142426; --surface-hover: #1b3033;
  --line: #243c3f; --line-accent: #375b60; --text: #f4f1e8; --text-muted: #9bb0ad;
  --text-faint: #576d6b; --code-bg: #070d0e; --shadow: rgba(0, 0, 0, 0.5);
  --accent: #d7b56d; --accent-hover: #e5c57e; --accent-soft: rgba(215, 181, 109, 0.14);
  --accent-contrast: #0c1314; --gate-accent: #d7b56d; --link-accent: #d7b56d;
  --green: #4ade80; --green-soft: rgba(74, 222, 128, 0.15);
  --red: #f87171; --red-soft: rgba(248, 113, 113, 0.15);
  --amber: #d7b56d; --amber-soft: rgba(215, 181, 109, 0.15);
}
:root[data-theme="light"][data-option="1"] {
  --bg: #fcfbf7; --bg-alt: #f6f3eb; --surface: #ede8dc; --surface-hover: #e4ddcf;
  --line: #dbd2c0; --line-accent: #c4b69d; --text: #1c1813; --text-muted: #5c5446;
  --text-faint: #918674; --code-bg: #f4efe2; --shadow: rgba(28, 24, 19, 0.08);
  --accent: #9a7322; --accent-hover: #805e19; --accent-soft: rgba(154, 115, 34, 0.14);
  --accent-contrast: #ffffff; --gate-accent: #9a7322; --link-accent: #9a7322;
  --green: #15803d; --green-soft: rgba(21, 128, 61, 0.12);
  --red: #b91c1c; --red-soft: rgba(185, 28, 28, 0.12);
  --amber: #9a7322; --amber-soft: rgba(154, 115, 34, 0.12);
}

/* Option 3: Zapier High-Contrast Signal — Graphite & Safety Orange (dark) */
:root[data-option="3"] {
  --bg: #09090b; --bg-alt: #121215; --surface: #18181b; --surface-hover: #222226;
  --line: #27272a; --line-accent: #3f3f46; --text: #fafafa; --text-muted: #a1a1aa;
  --text-faint: #52525b; --code-bg: #040405; --shadow: rgba(0, 0, 0, 0.55);
  --accent: #ff5722; --accent-hover: #ff7043; --accent-soft: rgba(255, 87, 34, 0.16);
  --accent-contrast: #ffffff; --gate-accent: #ff9800; --link-accent: #ff5722;
  --green: #10b981; --green-soft: rgba(16, 185, 129, 0.16);
  --red: #ef4444; --red-soft: rgba(239, 68, 68, 0.16);
  --amber: #ff9800; --amber-soft: rgba(255, 152, 0, 0.16);
}
:root[data-theme="light"][data-option="3"] {
  --bg: #ffffff; --bg-alt: #fafafa; --surface: #f4f4f5; --surface-hover: #e4e4e7;
  --line: #e4e4e7; --line-accent: #d4d4d8; --text: #09090b; --text-muted: #52525b;
  --text-faint: #a1a1aa; --code-bg: #f4f4f5; --shadow: rgba(9, 9, 11, 0.08);
  --accent: #ea580c; --accent-hover: #c2410c; --accent-soft: rgba(234, 88, 12, 0.12);
  --accent-contrast: #ffffff; --gate-accent: #d97706; --link-accent: #ea580c;
  --green: #059669; --green-soft: rgba(5, 150, 105, 0.12);
  --red: #dc2626; --red-soft: rgba(220, 38, 38, 0.12);
  --amber: #d97706; --amber-soft: rgba(217, 119, 6, 0.12);
}

/* ==========================================================================
   4. GLOBAL BASE STYLES
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a { color: var(--link-accent); text-decoration: none; transition: opacity var(--transition-fast); }
a:hover { opacity: 0.85; }

code, pre, kbd { font-family: var(--font-mono); }

::selection { background: var(--accent); color: var(--accent-contrast); }

/* Layout helpers */
.container, .wrap { max-width: 1120px; margin: 0 auto; }
.eyebrow {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ==========================================================================
   5. BRAND LOGO (extracted from the teaser — the canonical Oystro mark)
   ========================================================================== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { opacity: 1; }
.brand-logo { width: 34px; height: 34px; flex: 0 0 auto; display: block; }
.brand-logo svg { width: 100%; height: 100%; display: block; }

/* Brand mark fills (usable anywhere the canonical SVG is inlined) */
.mark-bg { fill: var(--accent); }
.mark-ink { fill: var(--accent-contrast); }

/* ==========================================================================
   6. MASTHEAD & SITE FOOTER (shared page shell)
   ========================================================================== */
.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: padding var(--transition-normal);
}
.masthead.scrolled { padding: 12px 40px; }
.masthead .nav-links { display: flex; align-items: center; gap: 30px; }
.masthead .nav-links a { color: var(--text-muted); font-size: 14.5px; font-weight: 600; letter-spacing: 0.02em; }
.masthead .nav-links a:hover { color: var(--accent); opacity: 1; }

.site-footer {
  padding: 46px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.site-footer .brand { justify-content: center; margin-bottom: 12px; }
.site-footer .row { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.site-footer .row a { color: var(--text-muted); font-size: 13px; }
.site-footer .row a:hover { color: var(--accent); }

/* ==========================================================================
   7. COMPONENTS: BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-contrast);
  transition: transform var(--transition-fast), box-shadow var(--transition-normal), background var(--transition-fast);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px var(--accent-soft); background: var(--accent-hover); opacity: 1; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); box-shadow: none; }
.btn.small { padding: 9px 16px; font-size: 13.5px; border-radius: 8px; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--line-accent); box-shadow: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--line); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }

/* ==========================================================================
   8. COMPONENTS: STATUS BADGES
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-gate { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.badge-pass { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.badge-fail { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.badge-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ==========================================================================
   9. COMPONENTS: CARDS
   ========================================================================== */
.card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover { border-color: var(--line-accent); transform: translateY(-2px); box-shadow: 0 8px 24px var(--shadow); }

/* ==========================================================================
   10. COMPONENTS: ARTICLE / PROSE (blog & docs)
   ========================================================================== */
.prose { max-width: 720px; margin: 0 auto; }
.prose h1 { font-size: var(--text-h1); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 16px; color: var(--text); }
.prose h2 { font-size: var(--text-h2); line-height: 1.2; margin: 40px 0 14px; color: var(--text); }
.prose h3 { font-size: var(--text-h3); margin: 30px 0 10px; color: var(--text); }
.prose p { font-size: var(--text-lead); line-height: 1.7; color: var(--text-muted); margin: 0 0 20px; }
.prose p strong { color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { margin: 0 0 20px 1.25rem; color: var(--text-muted); }
.prose li { margin-bottom: 8px; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 18px; margin: 24px 0; color: var(--text); font-style: italic; }
.prose code { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px 6px; font-size: 0.9em; color: var(--text); }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px; overflow: auto; margin: 0 0 24px; }
.prose pre code { background: transparent; border: 0; padding: 0; color: var(--text); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.prose img { max-width: 100%; border-radius: var(--radius-md); }

/* ==========================================================================
   11. RESPONSIVE SHELL
   ========================================================================== */
@media (max-width: 640px) {
  .masthead { padding: 14px 18px; }
  .masthead.scrolled { padding: 10px 18px; }
  .masthead .nav-links { display: none; }
}
