@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap");

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ─── Theme tokens ─── */
[data-theme="dark"] {
  --bg:         #0f1224;
  --bg-2:       #14182f;
  --text:       #eef1fb;
  --muted:      #a6aec6;
  --accent:     #6472c0;
  --accent-2:   #ef4323;
  --logo-ink:   #eef1fb;
  --line:       rgba(46, 53, 83, 0.65);
  --glass:      rgba(22, 26, 49, 0.85);
  --card:       rgba(12, 18, 26, 0.72);
  --header-bg:  rgba(7, 11, 16, 0.50);
  --body-grad:  radial-gradient(circle at top, #2b315a 0%, #1a1e40 45%, #0f1224 100%);
  --shadow:     0 20px 56px rgba(0, 0, 0, 0.42);
  --noise-op:   0.38;
}
[data-theme="light"] {
  --bg:         #f4f5fa;
  --bg-2:       #e8eaf4;
  --text:       #0f1224;
  --muted:      #5a6280;
  --accent:     #213166;
  --accent-2:   #ef4323;
  --logo-ink:   #213166;
  --line:       rgba(100, 110, 160, 0.22);
  --glass:      rgba(255, 255, 255, 0.90);
  --card:       rgba(255, 255, 255, 0.78);
  --header-bg:  rgba(244, 245, 250, 0.62);
  --body-grad:  radial-gradient(circle at top, #d8dcf0 0%, #e5e8f6 45%, #f4f5fa 100%);
  --shadow:     0 20px 56px rgba(0, 0, 0, 0.08);
  --noise-op:   0.10;
}

/* ─── Base ─── */
body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: var(--body-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' seed='12'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.12'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: var(--noise-op);
  z-index: 0;
}

main { position: relative; z-index: 1; }

/* ─── Frosted scrim ───
   Blurs page content as it scrolls up beneath the header. Sits above the
   content but below the sticky header (z 100), so the header stays crisp. */
.scrim {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(60px, 9vh, 84px);   /* limited to the logo / button band */
  z-index: 50;
  pointer-events: none;
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  /* Fade the blur out toward the bottom so there is no hard edge. */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 100%);
}

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 68px;
  padding: 0 6vw;
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.logo {
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;
  color: var(--logo-ink);
  display: flex;
  align-items: center;
}

.logo-svg {
  height: 76px;
  width: auto;
  transform: translateY(10px);
  overflow: visible;
}

#site-nav {
  align-self: stretch;
  display: flex;
}

.nav-links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  align-items: stretch;
  align-self: stretch;
}

.nav-links li {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-links li::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #e879a0;
  opacity: 0;
  transition: opacity 0.15s;
}

.nav-links li:hover::after {
  opacity: 1;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
  white-space: nowrap;
}
.nav-link:hover,
.nav-link.active { color: var(--text); }
.nav-link.active { font-weight: 600; }

.nav-link.external::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.6;
}

.nav-link-beta {
  color: var(--accent) !important;
  font-weight: 600;
}
.nav-link-beta::after {
  background: var(--accent) !important;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* ─── Theme toggle ─── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none;  }
[data-theme="light"] .icon-sun  { display: none;  }
[data-theme="light"] .icon-moon { display: block; }

/* ─── Mobile nav toggle ─── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.52rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.87rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(33, 49, 102, 0.32);
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.52rem 1.1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.87rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Footer ─── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 48px 6vw 28px;
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-top {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}

.footer-logo {
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  color: var(--logo-ink);
}

.footer-logo-svg {
  height: 48px;
  width: auto;
  overflow: visible;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.footer-cols h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.footer-cols a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  margin-bottom: 8px;
  transition: color 0.15s;
}
.footer-cols a:hover { color: var(--text); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ─── Section utilities ─── */
.section { padding: 80px 6vw; }
.section-sm { padding: 56px 6vw; }

.eyebrow {
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}

h1 {
  font-size: clamp(2rem, 3.5vw + 1rem, 3.8rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.5rem, 2vw + 0.8rem, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h3 { font-size: 1rem; font-weight: 600; }

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 580px;
}

/* ─── Cards ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.card-hover {
  transition: transform 0.2s, border-color 0.2s;
}
.card-hover:hover {
  transform: translateY(-3px);
  border-color: rgba(100, 114, 192, 0.55);
}

/* ─── Accent line divider ─── */
.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* ─── Hero (subpage, particle canvas) ─── */
.hero-page {
  position: relative;
  padding: 72px 6vw 80px;
}
.hero-page #hero-canvas {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: -24px;
  z-index: 0;
  pointer-events: none;
}
.hero-page .hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}
.hero-page .hero-content h1 { margin: 10px 0 14px; }
.hero-page .hero-content p  { color: var(--muted); font-size: 1.05rem; line-height: 1.7; }

/* ─── Chevron section connector ─── */
.section-alt {
  position: relative;
  background: #fafafa;
  clip-path: polygon(0 0, 50% 24px, 100% 0, 100% 100%, 0 100%);
  margin-top: -24px;
}
[data-theme="dark"] .section-alt {
  background: #08091d;
}

/* ─── Page header band (legacy) ─── */
.page-header {
  padding: 56px 6vw 48px;
  border-bottom: 1px solid var(--line);
  max-width: 720px;
}
.page-header h1 { margin: 10px 0 14px; }
.page-header p { color: var(--muted); font-size: 1.05rem; line-height: 1.7; }

/* ─── Strip (colored band) ─── */
.strip {
  padding: 56px 6vw;
  background: linear-gradient(120deg, rgba(22, 26, 49, 0.5), rgba(15, 18, 36, 0.5));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .strip {
  background: linear-gradient(120deg, rgba(200, 205, 235, 0.38), rgba(220, 224, 245, 0.38));
}

/* ─── Responsive ─── */
@media (max-width: 860px) {
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 5vw;
    gap: 0.75rem;
  }

  .logo { order: 1; }
  .nav-toggle { order: 2; display: flex; margin-left: auto; }
  .nav-actions { order: 3; }

  #site-nav {
    order: 4;
    width: 100%;
    display: none;
  }
  body.nav-open #site-nav { display: block; }

  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 0 4px;
  }
  .nav-links li { width: 100%; }
  .nav-links li::after { display: none; }
  .nav-link {
    display: block;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
  }
  .nav-links li:last-child .nav-link { border-bottom: none; }

  .footer-top { grid-template-columns: 1fr; gap: 24px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .section { padding: 56px 5vw; }
  .section-sm { padding: 40px 5vw; }
  .footer-cols { grid-template-columns: 1fr; }
}
