/* Light theme tokens (default) */
:root {
  --bg: #fafaf9;
  --bg-alt: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-light: #f0eeec;
  --text: #1c1917;
  --text-secondary: #78716c;
  --text-tertiary: #a8a29e;
  --btn-bg: #1c1917;
  --btn-text: #ffffff;
  --btn-hover: #292524;
  --code-bg: #1c1917;
  --code-text: #e7e5e4;
  --green: #16a34a;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --nav-bg: rgba(250, 250, 249, 0.85);
  --focus-ring: rgba(22, 163, 74, 0.28);
}

/* Dark theme overrides - applied when data-theme="dark" is set on <html> */
[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --surface: #161b22;
  --border: #30363d;
  --border-light: #21262d;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --btn-bg: #16a34a;
  --btn-text: #0d1117;
  --btn-hover: #15803d;
  --code-bg: #161b22;
  --code-text: #e6edf3;
  --green: #4ade80;
  --nav-bg: rgba(13, 17, 23, 0.85);
  --focus-ring: rgba(74, 222, 128, 0.24);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-tertiary);
}

/* Shows light logo by default, dark logo when dark theme is active. */
.logo-dark { display: none; }
.logo-light { display: inline; }

[data-theme="dark"] .logo-dark { display: inline; }
[data-theme="dark"] .logo-light { display: none; }

/* Theme toggle icons - shows moon icon (switch-to-dark) by default, sun icon in dark mode */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

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

/* Smooth scroll for anchor links (e.g. docs sidebar navigation) */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

a { color: var(--text); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Nav Placeholder (prevents layout shift before components.js loads) */
#nav-placeholder { min-height: 60px; }

/* Navigation
   Sticky top bar with frosted-glass backdrop blur.
   Desktop: logo + links + theme toggle inline. */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 450;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.nav-links a[aria-current="page"],
.mobile-menu a[aria-current="page"],
.footer-right a[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

.nav-github {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mobile menu button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  transition: all 0.3s;
}

/* Animate lines into an X when menu is open */
.nav-toggle.active span:first-child { transform: rotate(45deg) translate(2.5px, 2.5px); }
.nav-toggle.active span:last-child { transform: rotate(-45deg) translate(2.5px, -2.5px); }

/* Full-width dropdown menu for mobile, toggled via .open class */
.mobile-menu {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  flex-direction: column;
  gap: 12px;
  z-index: 99;
}

.mobile-menu[hidden] { display: none !important; }
.mobile-menu.open { display: flex; }

.mobile-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 0;
}

.mobile-menu .theme-toggle {
  align-self: flex-start;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
}

/* Hero */

.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: 80px 24px 64px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.hero-badge:hover {
  color: var(--text);
  border-color: var(--green);
}

.hero-tagline {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 20px;
  color: var(--text);
}

.hero-logo {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.hero-logo img {
  max-width: 100%;
  height: auto;
}

.hero-accent {
  color: var(--text-secondary);
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 36px;
  line-height: 1.65;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
}

.btn-primary:hover {
  background: var(--btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-alt);
  border-color: var(--text-tertiary);
}

.hero-install {
  display: flex;
  align-items: center;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 18px;
  gap: 12px;
}

.hero-install code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--code-text);
  white-space: nowrap;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.2s;
  flex-shrink: 0;
}

.copy-btn:hover { color: var(--code-text); }

@media (max-width: 640px) {
  .hero {
    padding: 56px 20px 48px;
  }

  .hero-tagline {
    font-size: 2.15rem;
  }

  .hero-install {
    width: 100%;
    max-width: 360px;
  }

  .hero-install code {
    white-space: normal;
    word-break: break-word;
    text-align: left;
  }
}

/* Section Label */

.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 32px;
  text-align: center;
}

/* Features
   3-column grid of IP core cards on index.html.  */

.features {
  padding: 64px 0 80px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  padding: 28px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--surface);
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(16px);
}

.feature-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.feature-icon {
  font-size: 1.4rem;
  margin-bottom: 14px;
}

.feature-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.feature-card em {
  color: var(--text-tertiary);
  font-style: italic;
}

@media (max-width: 768px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
}

/* Code Section
   Terminal-style code block with macOS-like window dots.  */

.code-section {
  padding: 0 0 80px;
}

.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s ease;
}

.code-block.visible {
  opacity: 1;
  transform: translateY(0);
}

.code-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.code-filename {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-left: 8px;
}

.code-block pre {
  padding: 24px 20px;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--code-text);
}

/* Syntax highlighting color used by the hand-authored command examples. */
.cm { color: #78716c; }   /* comments */

/* Stack / Built With Section
   4-column grid listing the project's technology stack (index.html). */

.stack-section {
  padding: 0 0 80px;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
}

.stack-item {
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.2s;
}

.stack-item:hover {
  border-color: var(--border);
}

.stack-item strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.stack-item span {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

@media (max-width: 640px) {
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Funding acknowledgement
   NLnet / NGI0 Core acknowledgement on the landing page. */

.funding-section {
  padding: 0 0 80px;
}

.funding-panel {
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 32px 0;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s ease;
}

.funding-panel.visible {
  opacity: 1;
  transform: translateY(0);
}

.funding-logos {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 22px;
}

.funding-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Equal halves of the active width; never wrap, always shrink to fit. */
  flex: 1 1 0;
  min-width: 0;
  max-width: 380px;
  min-height: 90px;
  padding: 16px 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: #ffffff;
  transition: border-color 0.2s, transform 0.2s;
}

.funding-logo-link:hover {
  border-color: var(--border);
  transform: translateY(-1px);
}

.funding-logo-link img {
  display: block;
  /* Size by height so both banners match visually despite different
     aspect ratios; max-width lets them shrink on narrow viewports. */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
}

.funding-panel p {
  max-width: 760px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.75;
  text-align: center;
}

.funding-panel a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.funding-panel a:hover {
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .funding-logos {
    gap: 8px;
  }

  .funding-logo-link {
    max-width: none;
    min-height: 64px;
    padding: 8px;
  }

  .funding-logo-link img {
    max-height: 42px;
  }

  .funding-panel p {
    text-align: left;
  }
}

/* CTA
   Bottom call-to-action banner on index.html. Fades in on scroll. */

.cta {
  text-align: center;
  padding: 64px 24px;
  margin: 0 auto;
  max-width: 960px;
  border-top: 1px solid var(--border-light);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s ease;
}

.cta.visible {
  opacity: 1;
  transform: translateY(0);
}

.cta h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.cta p {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 1.02rem;
}

.cta-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */

.footer {
  border-top: 1px solid var(--border-light);
  padding: 24px 0;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text-tertiary);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-right {
  display: flex;
  gap: 20px;
}

.footer-right a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-right a:hover { color: var(--text); }

@media (max-width: 480px) {
  .footer-inner { flex-direction: column; gap: 12px; }
}

/*  Docs Page */

.docs-layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
}

.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.docs-sidebar-group {
  margin-bottom: 28px;
}

.docs-sidebar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.docs-sidebar a {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 0;
  transition: color 0.2s;
}

.docs-sidebar a:hover,
.docs-sidebar a.active {
  color: var(--text);
}

.docs-sidebar a.active {
  font-weight: 500;
}

.docs-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.docs-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.docs-content [id] {
  scroll-margin-top: 88px;
}

.docs-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.docs-content p {
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.docs-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-content a:hover {
  color: var(--text-secondary);
}

.docs-content code {
  font-family: var(--mono);
  font-size: 0.84rem;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.docs-content pre {
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--code-text);
  font-size: 0.84rem;
  line-height: 1.7;
}

.docs-content ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.docs-content li {
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.7;
  margin-bottom: 6px;
}

/* Info/status callout box - left-bordered highlight used for WIP notices etc. */
.docs-content .callout {
  background: var(--bg-alt);
  border-left: 3px solid var(--text-tertiary);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
}

.docs-content .callout p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .docs-sidebar {
    position: relative;
    top: 0;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 20px;
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
  }
  .docs-sidebar-group { margin-bottom: 12px; }
  .docs-sidebar a { display: inline; padding: 4px 0; }
}

/*  News Page  */

.news-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.news-page > h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.news-page > p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

.news-item {
  padding: 28px 0;
  border-top: 1px solid var(--border-light);
}

.news-date {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.news-item h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.news-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.news-item h2 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.news-item p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
}

.news-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  padding: 3px 10px;
  border-radius: 100px;
  margin-top: 12px;
}

.page-status {
  color: var(--text-tertiary);
  font-size: 0.94rem;
}
