/* Divergence site-wide design system.
   Loaded after shared.css (which holds tokens).
   Page-specific CSS lives inline per template. */

body { background: var(--bg); overflow-x: hidden; }

/* ── Top nav ──────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 18px 40px;
  background: rgba(15,15,19,0.82);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav .dv-logo { margin-right: auto; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav .link { font-size: 13px; color: var(--muted); transition: color .15s; }
.nav .link:hover, .nav .link.active { color: var(--text); }
.nav .link.active { font-weight: 600; }

.nav-hamburger { display: none; }
.nav-drawer    { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 8px; transition: all .15s; cursor: pointer;
  border: 1px solid transparent; text-decoration: none;
}
.btn-ghost   { color: var(--text); border-color: var(--border); background: var(--surface); }
.btn-ghost:hover { border-color: var(--border-2); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); }
.btn-primary:hover { filter: brightness(1.1); }

/* ── Page wrapper (non-full-bleed pages) ─────────────────────────── */
.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 60px 40px;
}
.page-head {
  max-width: 820px;
  margin-bottom: 44px;
}
.page-head h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: clamp(36px, 4vw, 56px);
  letter-spacing: -1.4px;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 14px;
  text-wrap: balance;
}
.page-head p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ── Section shell (from landing) ────────────────────────────────── */
.section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 100px 40px;
}
.section-intro {
  max-width: 680px;
  margin-bottom: 56px;
}
.section-intro .eye { display: block; margin-bottom: 18px; }
.section-intro h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: -1.4px;
  color: var(--text);
  margin-bottom: 18px;
  text-wrap: balance;
}
.section-intro p {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

/* ── Final CTA (reused on feed page) ─────────────────────────────── */
.final-cta {
  max-width: 1440px;
  margin: 0 auto;
  padding: 100px 40px;
  text-align: center;
}
.final-cta h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 62px;
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 22px;
  text-wrap: balance;
}
.final-cta h2 em { font-style: italic; color: var(--accent); }
.final-cta p {
  font-size: 17px;
  color: var(--text-2);
  margin-bottom: 30px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.final-cta .row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.final-cta .sub {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 18px;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px;
  display: flex;
  justify-content: space-between;
  gap: 40px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.footer-left { max-width: 320px; }
.footer-links { display: flex; gap: 28px; flex-wrap: wrap; }
.footer-links a:hover { color: var(--text); }
.footer-tagline {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

/* ── Code block (reused on landing API strip and docs) ───────────── */
.code-block {
  background: #0a0a0d;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}
.code-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.code-head .file { color: var(--text-2); }
.code-body {
  padding: 20px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
}
.tok-c { color: var(--muted-2); }
.tok-k { color: #c084fc; }
.tok-s { color: var(--green); }
.tok-n { color: var(--amber); }
.tok-p { color: var(--accent); }

/* ── Responsive collapses ────────────────────────────────────────── */
@media (max-width: 960px) {
  .nav { gap: 10px; padding: 14px 20px; }
  .nav .nav-links { gap: 6px; }
  .nav .link { font-size: 12px; }
  .section, .page { padding: 60px 24px; }
  .section-intro h2 { font-size: 34px; }
  .final-cta { padding: 60px 24px; }
  .final-cta h2 { font-size: 44px; }
  .footer { padding: 24px; gap: 24px; }
}
@media (max-width: 600px) {
  /* Nav: hamburger on mobile */
  .nav {
    padding: 12px 16px;
    gap: 12px;
    position: relative;
  }
  .nav .dv-logo { flex: 1; }
  .nav .dv-logo-wordmark { font-size: 16px; }
  .nav .dv-logo-mark { width: 30px; height: 30px; border-radius: 7px; }
  .nav .btn-primary { display: none; }
  .nav-links { display: none; }

  .nav-hamburger {
    display: flex;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 17px;
    color: var(--text);
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
  }

  .nav-drawer {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: rgba(15,15,19,0.97);
    backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border);
    padding: 6px 0 14px;
    z-index: 19;
  }
  .nav-drawer.open { display: block; }
  .nav-drawer a {
    display: block;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
  }
  .nav-drawer a.active { color: var(--text); font-weight: 600; }

  .section, .page { padding: 44px 18px; }
  .section-intro { margin-bottom: 28px; }
  .section-intro h2 { font-size: 26px; letter-spacing: -0.8px; }
  .section-intro p { font-size: 15px; }
  .final-cta { padding: 48px 18px; }
  .final-cta h2 { font-size: 32px; letter-spacing: -1px; line-height: 1.08; }
  .final-cta p { font-size: 14px; }
  .final-cta .row { flex-direction: column; gap: 8px; }
  .final-cta .row .btn { width: 100%; justify-content: center; }
  .final-cta .sub { font-size: 11px; }
  .page-head h1 { font-size: clamp(28px, 9vw, 40px); letter-spacing: -1px; line-height: 1.08; }
  .page-head p { font-size: 14.5px; }
  .code-block { border-radius: 8px; }
  .code-body { font-size: 11.5px; padding: 14px; }
  .footer { padding: 24px 18px; gap: 16px; }
  .footer-left { max-width: none; }
  .footer-links { gap: 14px 20px; }
}

/* ── Spectrum overflow: collapsed cluster chip + hover-expand ─────── */
/* Reused on both the landing demo (.demo-spectrum) and event detail (.spectrum-track).
   When pins overlap within a pixel threshold, JS hides all but the first in the
   cluster, inserts a .spec-more chip showing the count, and wires hover/focus
   to fan the hidden pins out briefly. */
.spec-more {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 99px;
  background: rgba(124,106,247,0.18);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer; user-select: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s;
  z-index: 3;
}
.spec-more:hover, .spec-more:focus {
  background: rgba(124,106,247,0.28);
  border-color: var(--accent);
  transform: translate(-50%, -50%) translateY(-1px);
  outline: none;
}
.spec-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  transform: translate(-50%, -50%) translateY(0);
}
.spec-cluster-expanded .spec-hidden {
  opacity: 1;
  pointer-events: auto;
  z-index: 4;
}
/* When a cluster is hover-expanded, fan pins out around the chip position.
   JS sets --fan-x in px relative to chip centre. */
.spec-cluster-expanded .spec-hidden[data-fan] {
  transform: translate(-50%, -50%) translateX(var(--fan-x, 0));
}
