@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Fraunces:opsz,wght@9..144,300;9..144,450;9..144,600;9..144,700&display=swap');

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

/* ── Theme tokens ────────────────────────────────── */
/* Dark — the editorial identity in a dark mood: warm cream ink and rust
   accent (carried from [data-theme="light"]), but grounded on dreamcatcher's
   neutral "ink" background instead of a warm brown, which read muddy. Warm
   content on a near-neutral dark. This :root is also the data-theme="dark"
   fallback. */
:root {
  --bg:        oklch(0.18 0.012 270);
  --surface:   oklch(0.22 0.015 270);
  --border:    rgba(237, 228, 214, 0.12);
  --blue:      oklch(68% 0.14 48);
  --blue-dim:  oklch(68% 0.14 48 / 0.14);
  --blue-glow: oklch(68% 0.14 48 / 0.30);
  --sun:       var(--blue);   /* accent-touch colour (labels, stat numbers, bullet markers); defaults to the theme accent, overridden only by Ocean */
  --text:      #ece3d5;
  --muted:     #a2968a;
  --faint:     oklch(0.24 0.016 270);
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Space Grotesk', sans-serif;
  --serif:     'Fraunces', 'Space Grotesk', serif;
  --display:   var(--serif);
  --dot-color: rgba(230,220,205,0.045);
}

/* Editorial — the site's primary identity: warm paper, ink type, a
   single rust accent, restraint over glow. Matches the language already
   shared by the grant-tracker demo and the portfolio-hub front door. */
[data-theme="light"] {
  --bg:        #faf7f2;
  --surface:   #ffffff;
  --border:    rgba(26, 20, 16, 0.11);
  --blue:      oklch(52% 0.15 45);
  --blue-dim:  oklch(52% 0.15 45 / 0.09);
  --blue-glow: oklch(52% 0.15 45 / 0.16);
  --text:      #1a1410;
  --muted:     #7a6f63;
  --faint:     #f1ece3;
  --display:   var(--serif);
  --dot-color: transparent;
}

/* Ocean — the dreamcatcher demo's ocean/sun combination: deep ocean-navy
   ground, pale-blue ink. The ocean sky-blue is the primary accent so the
   theme reads calm and cohesive; the warm gold "sun" is dialled back to
   glow/highlight duty (--blue-glow) so it enhances rather than takes over. */
[data-theme="ocean"] {
  --bg:        #050d1c;
  --surface:   #091628;
  --border:    rgba(74, 174, 232, 0.14);
  --blue:      #4aaee8;
  --blue-dim:  rgba(74, 174, 232, 0.15);
  --blue-glow: oklch(0.86 0.16 90 / 0.42);
  --sun:       #ffd24d;   /* the dreamcatcher/Walmart "sun" — gold accent used judiciously on touches */
  --text:      #deeaf8;
  --muted:     #7a9ab8;
  --faint:     #0c1e34;
  --dot-color: rgba(74,174,232,0.06);
  --display:   var(--sans);   /* Ocean keeps the original technical (Space Grotesk) headline, not the editorial serif */
}

/* ── Base ────────────────────────────────────────── */
/* scrollbar-gutter reserves the scrollbar's space on EVERY page, so navigating
   between a scrolling page and a non-scrolling one no longer shifts the centered
   layout sideways. scrollbar-* recolours the bar to the theme (Firefox). */
html { scroll-behavior: smooth; overflow-y: scroll; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }

/* Themed scrollbars (WebKit/Blink) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 8px; border: 3px solid var(--bg); transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.35s, color 0.35s;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.35s;
}

/* ── Page transition overlay ─────────────────────── */
#page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

#page-transition.fade-out { opacity: 1; }

/* ── Nav ─────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(22,23,31,0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s, border-color 0.35s;
}

[data-theme="light"] nav  { background: rgba(250,247,242,0.88); }
[data-theme="ocean"] nav { background: rgba(5,13,28,0.85); }

.nav-logo {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--blue);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.nav-logo span { color: var(--muted); transition: opacity 0.38s ease; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--blue); }

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.35s;
}
.theme-toggle:hover { border-color: var(--blue); }

.theme-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.theme-btn.active, .theme-btn:hover {
  background: var(--blue-dim);
  color: var(--blue);
}

/* ── Main wrapper ────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  padding-top: 64px;
  flex: 1 0 auto;   /* grow so the footer sits at the bottom on short pages (e.g. contact) */
}

/* ── Section layout ──────────────────────────────── */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 96px 48px;
}
/* Large and ultrawide screens: let content breathe instead of pinching
   into a centered sliver. */
@media (min-width: 1800px) {
  .section { max-width: 1440px; }
}

/* ── Typography ──────────────────────────────────── */
h1 { font-family: var(--display); font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; font-weight: 600; }

.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sun);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.label::before {
  content: '';
  display: block;
  width: 24px; height: 1px;
  background: var(--sun);
}

/* ── Button ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--blue);
  color: #000;
  border: 1px solid transparent;
  font-weight: 500;
}
.btn-primary:hover {
  background: transparent;
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 20px var(--blue-glow);
}
.btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--blue);
  box-shadow: 0 0 16px var(--blue-glow);
}

/* ── Card ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.35s;
}
.card:hover {
  border-color: rgba(79,158,255,0.35);
  box-shadow: 0 0 32px rgba(79,158,255,0.08);
}

/* ── Tag ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  background: var(--blue-dim);
  color: var(--blue);
  letter-spacing: 0.04em;
  transition: background 0.35s, color 0.35s;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
  transition: border-color 0.35s;
}

/* ── Scroll reveal ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.3s; }
.reveal-d4 { transition-delay: 0.4s; }

/* Keep fade-up for above-the-fold (hero) elements that don't need IntersectionObserver */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up              { animation: fadeUp 0.6s ease both; }
.fade-up-d1           { animation-delay: 0.10s; }
.fade-up-d2           { animation-delay: 0.22s; }
.fade-up-d3           { animation-delay: 0.34s; }
.fade-up-d4           { animation-delay: 0.46s; }

/* ── Footer ──────────────────────────────────────── */
footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 28px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.35s;
}
footer p {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ── Hamburger (hidden on desktop) ───────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  margin-left: auto;
}
.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
nav.menu-open .hamburger .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
nav.menu-open .hamburger .hamburger-line:nth-child(2) { opacity: 0; }
nav.menu-open .hamburger .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  nav {
    padding: 0 20px;
    justify-content: flex-start;
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 10;
    gap: 0;
    padding-bottom: 12px;
    border-top: 1px solid var(--border);
  }
  .nav-links li { display: block; }
  .nav-links a { display: block; padding: 11px 0; font-size: 13px; }
  nav.menu-open .nav-links { display: flex; }
  .hamburger { display: flex; }
  .section { padding: 64px 20px; }
}
