/* ============================================================
   Culvii site-wide styles
   Built on the Culvii Design System v0.2
   Dark-first (per copy doc), orange accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ───────── Brand · Culvii Orange ───────── */
  --culvii-orange:         #FFA500;
  --on-orange:             #1C1410;

  --orange-50:  #FFF8EC;
  --orange-100: #FFF0D1;
  --orange-200: #FFDFA3;
  --orange-300: #FFC66A;
  --orange-400: #FFB035;
  --orange-500: #FFA500;
  --orange-600: #E88A00;
  --orange-700: #B86E00;
  --orange-800: #8C5300;
  --orange-900: #5C3600;

  --stone-50:   #FAFAF9;
  --stone-100:  #F5F5F4;
  --stone-200:  #E7E5E4;
  --stone-300:  #D6D3D1;
  --stone-400:  #A8A29E;
  --stone-500:  #78716C;
  --stone-600:  #57534E;
  --stone-700:  #44403C;
  --stone-800:  #292524;
  --stone-900:  #1C1917;
  --stone-950:  #0C0A09;

  --success-500: #10B981;
  --success-400: #34D399;
  --success-300: #6EE7B7;
  --warning-500: #EAB308;
  --danger-500:  #EF4444;
  --info-500:    #3B82F6;
  --info-400:    #60A5FA;

  --font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter Tight', var(--font-sans);
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Dark-first semantic roles */
  --bg:            #050505;
  --bg-subtle:     #0B0B0C;
  --bg-muted:      #131315;
  --bg-elevated:   #0E0E10;
  --bg-card:       #101012;

  --border:        #1F1F22;
  --border-strong: #2A2A2E;
  --border-accent: #3A2A12;

  --fg:            #F5F5F4;
  --fg-muted:      #A8A29E;
  --fg-subtle:     #78716C;
  --fg-dim:        #57534E;

  --accent:        var(--culvii-orange);
  --accent-hover:  #FF9500;
  --accent-active: #E88A00;
  --accent-fg:     var(--on-orange);
  --accent-muted:  rgba(255,165,0,0.10);
  --accent-ring:   rgba(255,165,0,0.28);

  --container-max: 1240px;
  --nav-h:         64px;
  --banner-h:      40px;

  --ease: cubic-bezier(.2,0,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

h1,h2,h3,h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }

::selection { background: var(--culvii-orange); color: var(--on-orange); }

/* ============ Utility ============ */
.page { max-width: var(--container-max); margin: 0 auto; padding: 0 32px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-weight: 500;
}
.mono { font-family: var(--font-mono); }
.num  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============ Announcement banner ============ */
.banner {
  height: var(--banner-h);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--fg-muted);
  gap: 10px;
}
.banner .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success-400);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}
.banner a {
  color: var(--success-400);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.banner a:hover { text-decoration: underline; text-underline-offset: 3px; }
.banner strong { color: var(--fg); font-weight: 500; }

/* ============ Nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(5,5,5,0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.nav .page { display: flex; align-items: center; gap: 32px; width: 100%; }
.nav-brand {
  display: inline-flex; align-items: center;
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--fg);
}
.nav-brand svg, .nav-brand img {
  width: 26px; height: 26px; margin-right: 8px;
  filter: brightness(0) invert(1);
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  font-size: 13.5px; padding: 6px 10px;
  color: var(--fg-muted); font-weight: 500;
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
  transition: color 120ms var(--ease), background 120ms var(--ease);
}
.nav-link:hover { color: var(--fg); background: var(--bg-muted); }
.nav-link.active { color: var(--fg); }
.nav-link .chev { width: 10px; height: 10px; opacity: 0.6; }
.nav-link[data-menu] { cursor: pointer; user-select: none; }

.nav-dropdown { position: relative; }
.nav-dropdown .nav-menu {
  position: absolute; top: calc(100% + 6px); left: -8px;
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 24px 48px -16px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02) inset;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease), visibility 0s linear 140ms;
  z-index: 50;
}
.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease), visibility 0s;
}
.nav-menu-item {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 120ms var(--ease);
}
.nav-menu-item:hover { background: var(--bg-subtle); }
.nav-menu-item .nm-title { display: block; color: var(--fg); font-size: 13.5px; font-weight: 500; letter-spacing: -0.005em; margin-bottom: 2px; }
.nav-menu-item .nm-desc { display: block; color: var(--fg-subtle); font-size: 12px; line-height: 1.4; }

/* On desktop: hide direct product links (dropdown handles them).
   On mobile: hide the dropdown and show direct links instead. */
@media (min-width: 960px) {
  .nav-links > a.nav-link[href="culvii-kit.html"],
  .nav-links > a.nav-link[href="culvii-agentops.html"] { display: none; }
}
@media (max-width: 959px) {
  .nav-dropdown { display: none; }
  .nav-links > a.nav-link[href="blog.html"],
  .nav-links > a.nav-link[href="docs.html"] { display: none; }
}

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 500;
  font-size: 13.5px;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 120ms var(--ease);
  letter-spacing: -0.005em;
  height: 34px; padding: 0 14px;
}
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; border-radius: 8px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent-active);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.4);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }

.btn-secondary {
  background: var(--bg-muted);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--btn-secondary-hover-bg, #1a1a1c); border-color: var(--btn-secondary-hover-border, #353539); }

.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--bg-muted); }

.btn-link {
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  padding: 0;
  height: auto;
}
.btn-link:hover { color: var(--accent-hover); }

.btn svg, .btn i[data-lucide] { width: 14px; height: 14px; flex-shrink: 0; }
.btn-lg svg, .btn-lg i[data-lucide] { width: 15px; height: 15px; }

.kbd {
  font-family: var(--font-mono); font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--fg-muted);
}

/* ============ Badge / tag ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}
.badge.accent {
  color: var(--orange-300);
  border-color: var(--border-accent);
  background: var(--accent-muted);
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,165,0,0.18);
}
.badge .dot.green {
  background: var(--success-400);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
}

.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--bg-muted);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.tag.feature  { color: #A5D6FA; background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.2); }
.tag.dx       { color: var(--orange-300); background: var(--accent-muted); border-color: var(--border-accent); }
.tag.milestone{ color: var(--success-300); background: rgba(52,211,153,0.08); border-color: rgba(52,211,153,0.2); }
.tag.research { color: #C4B5FD; background: rgba(168,85,247,0.08); border-color: rgba(168,85,247,0.2); }

/* ============ Sections ============ */
.section {
  padding: 112px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.section.tight { padding: 72px 0; }
.section-head { max-width: 68ch; margin-bottom: 56px; }
.section-head .eyebrow { margin-bottom: 14px; display: inline-block; }
.section-head h2 {
  font-size: clamp(32px, 3.5vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  color: var(--fg);
}
.section-head p {
  font-size: 17px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin: 0;
  max-width: 62ch;
}
.section-label {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 14px;
}
.section-label::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent 60%);
  max-width: 140px;
}

/* ============ Cards ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}
.card:hover { border-color: var(--border-strong); }

/* ============ Code blocks ============ */
.code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  background: #07070A;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  color: #E7E5E4;
  overflow-x: auto;
  position: relative;
}
.code .comment { color: var(--fg-dim); }
.code .k       { color: #C4B5FD; }   /* keyword */
.code .s       { color: var(--success-300); }  /* string */
.code .fn      { color: var(--info-400); }
.code .p       { color: var(--orange-300); }   /* prop / brand */
.code .n       { color: #FFC66A; } /* number */
.code-tabs {
  display: flex; align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 0 8px;
  height: 36px;
  gap: 2px;
}
.code-tabs + .code { border-radius: 0 0 10px 10px; border-top: none; }
.code-tab {
  font-family: var(--font-mono); font-size: 12px;
  padding: 6px 10px;
  color: var(--fg-muted);
  border-radius: 4px;
  cursor: pointer;
}
.code-tab.active { color: var(--fg); background: var(--bg-muted); }
.code-tabs .spacer { flex: 1; }
.code-tabs .copy {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-subtle); padding: 4px 8px; cursor: pointer;
  display: inline-flex; gap: 4px; align-items: center;
}
.code-tabs .copy:hover { color: var(--fg); }

/* ============ Footer ============ */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 72px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr);
  gap: 48px;
  margin-bottom: 56px;
}
.footer-brand .logo-line {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.footer-brand .logo-line img { width: 26px; filter: brightness(0) invert(1); }
.footer-brand .tagline {
  color: var(--fg-muted); font-size: 13.5px; max-width: 28ch; line-height: 1.55;
  margin-bottom: 24px;
}
.footer-brand .social {
  display: flex; gap: 8px;
}
.footer-brand .social a {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px; color: var(--fg-muted);
}
.footer-brand .social a:hover { color: var(--fg); border-color: var(--border-strong); }

.footer-col h5 {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-subtle);
  margin: 0 0 16px; font-weight: 500;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
  font-size: 13.5px; color: var(--fg-muted);
  transition: color 120ms var(--ease);
}
.footer-col a:hover { color: var(--fg); }

.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 24px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px;
  color: var(--fg-subtle);
}
.footer-bottom .status {
  display: inline-flex; align-items: center; gap: 6px;
}
.footer-bottom .status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success-400);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.15);
}
.footer-bottom .right { display: flex; gap: 20px; }

/* ============ Grid helpers ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============ Arrow / link ============ */
.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
  font-weight: 500; font-size: 13.5px;
  transition: gap 160ms var(--ease);
}
.link-arrow:hover { gap: 10px; color: var(--accent-hover); }
.link-arrow svg { width: 14px; height: 14px; }

/* ============ Grid wash background ============ */
.grid-wash {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 75%);
}
.section > .page { position: relative; z-index: 1; }

/* ============ Page-hero shared ============ */
.page-hero {
  padding: 110px 0 96px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.page-hero h1 {
  font-size: clamp(42px, 5.8vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 20px 0 24px;
  max-width: 18ch;
  font-weight: 600;
}
.page-hero h1 em { font-style: normal; color: var(--accent); }
.page-hero .lead {
  font-size: 18px; color: var(--fg-muted);
  max-width: 62ch; line-height: 1.6;
  margin: 0 0 40px;
}
.page-hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.page-hero .below-cta {
  margin-top: 24px; font-size: 13px; color: var(--fg-subtle);
}

/* ============ Final CTA block ============ */
.final-cta {
  padding: 128px 0;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.final-cta::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 60% 80% at 50% 50%, rgba(255,165,0,0.08), transparent 65%);
}
.final-cta .page { position: relative; z-index: 1; }
.final-cta h2 {
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1.05; letter-spacing: -0.03em;
  margin: 0 auto 20px;
  max-width: 22ch;
}
.final-cta .lead {
  font-size: 17px; color: var(--fg-muted);
  max-width: 56ch; margin: 0 auto 32px;
  line-height: 1.6;
}
.final-cta .ctas { justify-content: center; display: flex; gap: 12px; flex-wrap: wrap; }
.final-cta .below { margin-top: 24px; font-size: 13px; color: var(--fg-subtle); }

/* ============================================================
   Light theme
   Applied via data-theme="light" on <html>
   Dark remains the default (no data-theme or data-theme="dark")
   ============================================================ */
[data-theme="light"] {
  /* Surfaces */
  --bg:            #FFFFFF;
  --bg-subtle:     #FAFAF9;
  --bg-muted:      #F5F5F4;
  --bg-elevated:   #FFFFFF;
  --bg-card:       #FAFAF9;

  /* Borders */
  --border:        #E7E5E4;
  --border-strong: #D6D3D1;
  --border-accent: rgba(255,165,0,0.35);

  /* Foreground */
  --fg:            #1C1917;
  --fg-muted:      #78716C;
  --fg-subtle:     #A8A29E;
  --fg-dim:        #A8A29E;

  /* Accent — orange is unchanged in light */
  --accent-muted:  #FFF8EC;
  --accent-ring:   rgba(255,165,0,0.28);

  /* Button secondary hover */
  --btn-secondary-hover-bg:     #E7E5E4;
  --btn-secondary-hover-border: #D6D3D1;
}

/* Nav backdrop */
[data-theme="light"] .nav {
  background: rgba(255,255,255,0.82);
}

/* Nav dropdown shadow */
[data-theme="light"] .nav-dropdown .nav-menu {
  box-shadow: 0 8px 24px -8px rgba(28,25,23,0.12), 0 0 0 1px rgba(28,25,23,0.05);
}

/* Logo: white inversion is wrong in light; show it as black */
[data-theme="light"] .nav-brand svg,
[data-theme="light"] .nav-brand img {
  filter: brightness(0);
}
[data-theme="light"] .footer-brand .logo-line img {
  filter: brightness(0);
}

/* Code blocks — light syntax theme */
[data-theme="light"] .code {
  background: #F5F5F4;
  border-color: #E7E5E4;
  color: #292524;
}
[data-theme="light"] .code .comment { color: #A8A29E; }
[data-theme="light"] .code .k       { color: #7C3AED; }
[data-theme="light"] .code .s       { color: #059669; }
[data-theme="light"] .code .fn      { color: #1D4ED8; }
[data-theme="light"] .code .p       { color: #C2610C; }
[data-theme="light"] .code .n       { color: #B45309; }
[data-theme="light"] .code-tabs {
  background: #FAFAF9;
  border-color: #E7E5E4;
}

/* Grid wash — use dark lines in light mode */
[data-theme="light"] .grid-wash {
  background-image:
    linear-gradient(rgba(28,25,23,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28,25,23,0.05) 1px, transparent 1px);
}

/* Badge accent — orange-300 text is too light on white; use a warm dark */
[data-theme="light"] .badge.accent {
  color: #C2610C;
}
[data-theme="light"] .merkle .node.root {
  color: #C2610C;
}

/* Semantic tags — darken text for legibility on light backgrounds */
[data-theme="light"] .tag.feature  { color: #1D4ED8; background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.25); }
[data-theme="light"] .tag.dx       { color: #C2610C; background: rgba(255,165,0,0.08); border-color: rgba(255,165,0,0.25); }
[data-theme="light"] .tag.milestone{ color: #047857; background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.25); }
[data-theme="light"] .tag.research { color: #6D28D9; background: rgba(168,85,247,0.08); border-color: rgba(168,85,247,0.25); }

/* Theme toggle icon swap */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: inline-flex; }
[data-theme="light"] .theme-toggle .icon-sun  { display: inline-flex; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
