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

:root {
  --bg: #0a0a0b;
  --bg-alt: #0f0f12;
  --bg-card: #141418;
  --border: #1e1e24;
  --primary: #6998a5;
  --primary-d: #487886;
  --text: #f5f2eb;
  --text-muted: #8a8a9a;
  --gold: #d4a853;
  --emerald: #4a9d7c;
  --coral: #e05555;
  /* Theme-invariant — always dark bg / ivory text (e.g. modal overlays, gate cards) */
  --ivory: #f5f2eb;
  --ivory-dim: #e8e4d8;
  --text-dark: #1a2e36;
  /* Depth badge palette — mapped to brand colors */
  --depth-intermediate: var(--primary);
  --depth-advanced: var(--primary-d);
  /* Tag tint backgrounds — derived from brand colors via rgba */
  --tag-project-bg: rgba(105, 152, 165, 0.12);
  --tag-available-bg: rgba(74, 157, 124, 0.08);
  --tag-available-border: rgba(74, 157, 124, 0.3);
  --card-hover-bg: rgba(105, 152, 165, 0.06);
  /* Code editor colors (dark/light editor theme, not site theme) */
  --editor-bg: #1a1d23;
  --editor-text: #d4d4d4;
  --editor-bg-light: #f5f5f5;
  --editor-text-light: #2d2d2d;
  --editor-output-bg-light: #f0f4f5;
  --editor-output-text-light: #2d6e50;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f9f9f9;
    --bg-alt: #ffffff;
    --bg-card: #ffffff;
    --border: #c8d0d4;
    --primary: #6998a5;
    --primary-d: #487886;
    --text: #3f5a65;
    --text-muted: #6b8591;
    --gold: #b8922e;
    --emerald: #3d8a6a;
    --coral: #d04444;
  }
}

[data-theme="light"] {
  --bg: #f9f9f9;
  --bg-alt: #ffffff;
  --bg-card: #ffffff;
  --border: #c8d0d4;
  --primary: #6998a5;
  --primary-d: #487886;
  --text: #3f5a65;
  --text-muted: #6b8591;
  --gold: #b8922e;
  --emerald: #3d8a6a;
  --coral: #d04444;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}

.inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 4rem;
}

/* ── Nav ── */
nav {
  width: 100%;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}
.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 3rem;
  width: 100%;
  padding: 0 2.5rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}
.nav-logo {
  height: 1.5rem;
  width: auto;
  max-width: 100%;
  display: block;
}
.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}
.nav-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}
.nav-link:hover {
  color: var(--primary);
}
.nav-link.active {
  color: var(--text);
}
.nav-cta {
  font-size: 0.85rem;
  color: var(--text);
  background: var(--primary);
  text-decoration: none;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  transition: background 0.2s;
}
.nav-cta:hover {
  background: var(--primary-d);
}

.nav-theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s;
}
.nav-theme-toggle:hover {
  color: var(--text);
}
.nav-theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}

.hidden {
  display: none !important;
}

/* ── Section label ── */
.section-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 1.5rem;
}

/* ── Footer ── */
footer {
  width: 100%;
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}
footer .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 2rem;
}
.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--primary);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.4rem;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s;
}
.nav-hamburger:hover {
  color: var(--text);
}
.nav-hamburger svg {
  width: 1.25rem;
  height: 1.25rem;
}

.nav-mobile-menu {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  gap: 0.25rem;
}
.nav-mobile-menu.open {
  display: flex;
}
.nav-mobile-link {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.nav-mobile-link:last-of-type {
  border-bottom: none;
}
.nav-mobile-link:hover,
.nav-mobile-link.active {
  color: var(--text);
}
.nav-mobile-cta {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: var(--text);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
}
.nav-mobile-cta:hover {
  background: var(--primary-d);
}

@media (max-width: 900px) {
  .inner {
    padding: 0 1.5rem;
  }
  .nav-inner {
    display: flex;
    justify-content: space-between;
    padding: 0 1.5rem;
  }
  .nav-links,
  .nav-cta {
    display: none;
  }
  .nav-hamburger {
    display: flex;
  }
  footer .inner {
    justify-content: center;
    text-align: center;
  }
  .footer-links {
    justify-content: center;
  }
}

/* ── Pagefind search modal ── */
.pf-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}
.pf-modal[hidden] {
  display: none;
}
.pf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.pf-modal-box {
  position: relative;
  width: min(640px, 90vw);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
/* Hide tier filter — internal metadata, not for users */
.pf-modal-box .pagefind-ui__filter-panel {
  display: none !important;
}
/* Override Pagefind UI defaults to match site theme */
.pf-modal-box .pagefind-ui__search-input {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--border);
  border-radius: 6px;
}
.pf-modal-box .pagefind-ui__result-title {
  color: var(--primary);
}
.pf-modal-box .pagefind-ui__result-excerpt {
  color: var(--text-muted);
}
