/* ==========================================================================
   Node.js with Koda — Privacy Policy website
   Design tokens mirror lib/core/theme/app_colors.dart and app_theme.dart
   1:1 so this page reads as part of the same product as the Flutter app.
   ========================================================================== */

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

:root {
  /* ---- Brand (theme-independent, from AppColors) ---- */
  --node-green: #3c873a;
  --node-green-light: #6cc24a;
  --node-green-deep: #2b5f2a;

  --mint: #34d8b0;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --amber: #f5b942;
  --purple: #8b5cf6;
  --streak-orange: #fb923c;
  --success: #34d399;
  --error: #f87171;

  --koda-body-light: #7fe3d4;
  --koda-body-base: #4fcdc0;
  --koda-body-shadow: #2e9e93;
  --koda-hoodie: #15203d;
  --koda-hoodie-light: #223055;
  --koda-hoodie-zip: #6cc24a;
  --koda-node-badge: #3c873a;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-code: 'JetBrains Mono', 'Courier New', monospace;

  --radius-card: 24px;
  --radius-chip: 20px;
  --blur-glass: 18px;

  --max-width: 780px;
}

/* ---- Dark theme (default — matches AppPalette.dark) ---- */
:root,
[data-theme='dark'] {
  --bg-0: #0d1117;
  --bg-1: #10151d;
  --bg-2: #0b0f14;
  --surface: #161b22;
  --surface-raised: #1f2630;
  --glass-fill: rgba(255, 255, 255, 0.102);
  --glass-fill-strong: rgba(255, 255, 255, 0.149);
  --glass-border: rgba(255, 255, 255, 0.18);
  --text-primary: #f2f5f7;
  --text-secondary: #a6b0be;
  --text-muted: #6e7887;
  --shadow-color: rgba(0, 0, 0, 0.25);
  --code-bg: #0d1117;
  --code-header-bg: #161b22;
}

/* ---- Light theme (matches AppPalette.light) ---- */
[data-theme='light'] {
  --bg-0: #fdfefe;
  --bg-1: #f5f7f8;
  --bg-2: #f3f5f7;
  --surface: #ffffff;
  --surface-raised: #f0f2f4;
  --glass-fill: rgba(255, 255, 255, 0.7);
  --glass-fill-strong: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(13, 17, 23, 0.12);
  --text-primary: #0d1117;
  --text-secondary: #4b5563;
  --text-muted: #8a94a3;
  --shadow-color: rgba(13, 17, 23, 0.1);
  --code-bg: #0d1117;
  --code-header-bg: #161b22;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--bg-0), var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
}

::selection {
  background: var(--mint);
  color: #04201b;
}

/* ---- Ambient glow blobs (matches splash_screen.dart's soft glows) ---- */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}
.glow--purple {
  top: -120px;
  right: -100px;
  width: 340px;
  height: 340px;
  background: color-mix(in srgb, var(--purple) 18%, transparent);
}
.glow--mint {
  bottom: -140px;
  left: -110px;
  width: 360px;
  height: 360px;
  background: color-mix(in srgb, var(--mint) 16%, transparent);
}

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  background: var(--glass-fill);
  border-bottom: 1px solid var(--glass-border);
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.brand svg {
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 10px;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text-primary);
  background: var(--glass-fill-strong);
  outline: none;
}
.nav-link.active {
  color: var(--node-green-light);
  background: color-mix(in srgb, var(--node-green) 16%, transparent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover {
  background: var(--glass-fill-strong);
}
.theme-toggle:active {
  transform: scale(0.94);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
[data-theme='light'] .icon-moon {
  display: block;
}
[data-theme='light'] .icon-sun {
  display: none;
}
[data-theme='dark'] .icon-moon {
  display: none;
}
[data-theme='dark'] .icon-sun {
  display: block;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ---- Hero ---- */
.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hero-koda {
  flex-shrink: 0;
  filter: drop-shadow(0 8px 20px var(--shadow-color));
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin: 0 0 6px;
  line-height: 1.1;
}

.hero-text p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15.5px;
}

.updated-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 18px 0;
}
.updated-row svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---- Glass card (mirrors GlassCard in app_theme.dart) ---- */
.card {
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  background: var(--glass-fill);
  border: 1.2px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 24px var(--shadow-color);
  padding: 22px 22px 24px;
  margin-bottom: 16px;
  scroll-margin-top: 84px;
}

.card--intro {
  border-color: color-mix(in srgb, var(--mint) 40%, transparent);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 .num {
  font-family: var(--font-code);
  font-size: 12px;
  font-weight: 500;
  color: var(--node-green-light);
  background: color-mix(in srgb, var(--node-green) 16%, transparent);
  border-radius: 8px;
  padding: 3px 7px;
}

.card p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  margin: 0 0 10px;
}
.card p:last-child {
  margin-bottom: 0;
}

.card ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.card li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 9px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
}
.card li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}
.card li:last-child {
  margin-bottom: 0;
}

.card a.inline-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--node-green-light);
  text-decoration: underline;
  font-size: 16px;
}
.card a.inline-link:hover {
  color: var(--node-green);
}

.placeholder {
  color: var(--amber);
}

/* ---- Footer ---- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--glass-border);
  padding: 28px 20px 40px;
  text-align: center;
}
.site-footer p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.site-footer a {
  color: var(--text-secondary);
  text-decoration: underline;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

/* ---- Back to top ---- */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-strong);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--shadow-color);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--glass-fill);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    top: 63px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-1);
    border-bottom: 1px solid var(--glass-border);
    padding: 8px 16px 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open {
    max-height: 480px;
    overflow-y: auto;
  }
  .nav-link {
    padding: 12px 10px;
    border-radius: 10px;
  }
  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 560px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-text h1 {
    font-size: 27px;
  }
  .card {
    padding: 18px 16px 20px;
    border-radius: 18px;
  }
  .page {
    padding: 28px 14px 70px;
  }
}

@media (min-width: 861px) and (max-width: 1024px) {
  .page {
    max-width: 700px;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}
