:root {
  --bg: #0d1117;
  --panel: #161b22;
  --text: #f0f2f8;
  --muted: #8b949e;
  --border: rgba(240, 246, 252, 0.1);
  --brand: #7c5cff;
  --brand-2: #00d4ff;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --max: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(124, 92, 255, 0.25), transparent 60%),
              radial-gradient(1200px 600px at 80% 10%, rgba(0, 212, 255, 0.18), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
}

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

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 18px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.skip-link:focus { left: 12px; z-index: 999; }

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(11, 16, 32, 0.7);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand-link {
  font-weight: 800;
  letter-spacing: 0.3px;
  text-decoration: none;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
}

.nav-list {
  display: flex;
  gap: 14px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--muted);
}

.nav-link.is-active {
  color: var(--text);
  background: rgba(124, 92, 255, 0.18);
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.hero {
  padding: 56px 0 22px;
}
.hero-inner {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(0, 212, 255, 0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}
.hero-kicker {
  color: var(--muted);
  margin: 0 0 6px;
}
.hero-title {
  margin: 0 0 8px;
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 62ch;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  color: #061018;
  font-weight: 700;
}
.button:hover { text-decoration: none; filter: brightness(1.05); }

.button-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}

.section { padding: 24px 0; }
.section-title { margin: 0 0 14px; font-size: 22px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius);
  padding: 16px;
}
.card-title { margin: 0 0 8px; font-size: 18px; }
.card-desc { margin: 0; color: var(--muted); }

.callout {
  border: 1px solid rgba(0, 212, 255, 0.24);
  background: rgba(0, 212, 255, 0.06);
  border-radius: var(--radius);
  padding: 18px;
}
.callout-text { margin: 8px 0 0; color: var(--muted); }
.callout-actions { margin: 14px 0 0; }

.list { display: grid; gap: 10px; }
.list-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.list-title { margin: 0 0 6px; font-size: 16px; }
.list-desc { margin: 0; color: var(--muted); }

.breadcrumb {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb-sep { margin: 0 8px; opacity: 0.6; }

.page-header { padding: 18px 0 10px; }
.page-title { margin: 0; font-size: 34px; line-height: 1.15; }
.page-desc { margin: 10px 0 0; color: var(--muted); max-width: 70ch; }
.page-meta { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.prose {
  max-width: 78ch;
  padding-bottom: 10px;
}
.prose p { margin: 14px 0; }
.prose h2, .prose h3 { margin-top: 28px; }
.prose code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 6px;
}
.prose pre {
  overflow: auto;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}
.prose pre code { border: none; background: transparent; padding: 0; }

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.prose blockquote {
  border-left: 4px solid var(--brand);
  background: rgba(124, 92, 255, 0.08);
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

.prose blockquote p { margin: 0; }

.prose blockquote p:first-child {
  font-size: 1.1rem;
  color: var(--text);
}

.prose blockquote p:last-child:not(:first-child) {
  font-size: 0.875rem;
  color: var(--muted);
  font-style: normal;
  margin-top: 0.75rem;
}

.cite-reference {
  font-size: 0.875rem;
  color: var(--muted);
}
.cite-reference a { color: var(--brand); }

.prose h2#references + ol,
.prose h2#references + ul {
  font-size: 0.875rem;
  color: var(--muted);
  padding-left: 1.5rem;
}

.prose h2#references + ol li,
.prose h2#references + ul li {
  margin-bottom: 0.5rem;
}

.prose h2#references + ol a,
.prose h2#references + ul a {
  color: var(--brand);
  word-break: break-all;
}

.prose h2#key-takeaways + ul {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.1), rgba(0, 212, 255, 0.05));
  border: 1px solid rgba(124, 92, 255, 0.2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0 2rem;
}

.prose h2#key-takeaways + ul li {
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.prose h2#key-takeaways + ul li:last-child { margin-bottom: 0; }
.prose h2#key-takeaways + ul li strong { color: var(--brand); }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.prose th {
  background: rgba(124, 92, 255, 0.15);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
}

.prose td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.prose tr:hover td { background: rgba(255, 255, 255, 0.02); }

.prose td:has(✅),
.prose td:has(❌),
.prose td:has(⚠️) {
  text-align: center;
}

.prose td:has(⭐) { white-space: nowrap; }

@media (max-width: 720px) {
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.faq-section { margin: 2rem 0; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.faq-item[open] summary::after { content: "−"; }

.faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--muted);
}

.faq-answer p { margin: 0; }

.heading-anchor {
  margin-left: 8px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.65;
}
.heading-anchor:hover { opacity: 1; }

.inline-related {
  margin: 10px 0 0;
  border: 1px dashed rgba(124, 92, 255, 0.35);
  background: rgba(124, 92, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}
.inline-related__label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.inline-related__list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.inline-related__item a { color: var(--text); opacity: 0.95; }

.footer {
  margin-top: 42px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}
.footer-inner { padding: 26px 0; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.footer-title { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-list a { color: var(--text); opacity: 0.9; }
.footer-copy { margin: 18px 0 0; color: var(--muted); font-size: 13px; }

@media (max-width: 920px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-title { font-size: 34px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; }
  .nav.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: flex-start; padding: 12px 0; }
  .hero-title { font-size: 30px; }
  .page-title { font-size: 28px; }
}

/* Site Search (Pagefind) */
.site-search {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.site-search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.site-search__dialog {
  position: relative;
  width: 90%;
  max-width: 600px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.site-search__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.site-search__icon {
  flex-shrink: 0;
  color: var(--muted);
}

.site-search__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
}

.site-search__input::placeholder {
  color: var(--muted);
}

.site-search__close {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.site-search__close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.site-search__results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}

.site-search__hint {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.site-search__result {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
}

.site-search__result:hover {
  background: rgba(124, 92, 255, 0.1);
  text-decoration: none;
}

.site-search__result-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.site-search__result-excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.site-search__result-excerpt mark {
  background: rgba(124, 92, 255, 0.3);
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
}

.site-search__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

html.is-search-open {
  overflow: hidden;
}

/* Search button in header */
.search-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.search-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.search-button kbd {
  font-size: 11px;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
