/* ==========================================================================
   One0 — Kinetic Editorial Design System
   Rich Obsidian Cosmic Atmosphere • Dynamic Kinetic Constellation
   Zero JPEGs. Pure Vector FontAwesome & SVGs. Fluid Screen-Width Layout.
   WCAG AAA Compliant • Zero AI Template Tropes • Bespoke Human Craft
   ========================================================================== */

:root {
  --bg: #060811;
  --bg-gradient: radial-gradient(1200px circle at 50% -120px, rgba(30, 58, 138, 0.3) 0%, transparent 70%),
                 radial-gradient(900px circle at 10% 40%, rgba(13, 148, 136, 0.16) 0%, transparent 60%),
                 radial-gradient(900px circle at 90% 70%, rgba(124, 58, 237, 0.18) 0%, transparent 60%),
                 radial-gradient(800px circle at 50% 95%, rgba(2, 132, 199, 0.14) 0%, transparent 65%);
  --surface-card: rgba(13, 18, 30, 0.78);
  --surface-card-hover: rgba(18, 24, 40, 0.9);
  --surface-subtle: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border-hairline: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 255, 255, 0.35);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-subtle: rgba(255, 255, 255, 0.08);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 20px 48px rgba(0, 0, 0, 0.55);
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;
  --apple-blue: #38bdf8;
  --apple-blue-hover: #0284c7;
  --gold: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --cyan: #22d3ee;
  --purple: #c084fc;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient Cursor Torch */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: radial-gradient(750px circle at var(--mouse-x, 50vw) var(--mouse-y, 35vh), rgba(56, 189, 248, 0.075), transparent 75%);
  z-index: 1;
}

/* Scroll progress indicator */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--apple-blue), var(--green), var(--purple));
  width: 0%;
  z-index: 1000;
  transition: width 0.08s linear;
}

/* Frosted Navigation Bar */
.apple-bar {
  position: sticky;
  top: 0;
  z-index: 300;
  background: rgba(6, 9, 18, 0.88);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-bottom: 1px solid var(--border-hairline);
  padding: 0.85rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
}
.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--apple-blue);
  display: inline-block;
}
.brand-meta {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link-btn {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.nav-link-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}
.nav-link-btn.active {
  color: #060913;
  background: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Screen-Width Main Canvas */
main {
  position: relative;
  z-index: 10;
  width: 92%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 4rem 0 8rem;
  display: flex;
  flex-direction: column;
  gap: 5.5rem;
}

/* Common Typography & Hero Elements across pages */
.headline-xl {
  font-size: clamp(2.6rem, 5.5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: #ffffff;
}

.accent-text {
  color: var(--apple-blue);
  font-weight: 800;
}

.body-lead {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.7;
  margin-top: 0.8rem;
}

/* Pill Navigation Buttons & Topic Tabs */
.pill-nav-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.pill-nav-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: var(--border-hover);
}
.pill-nav-btn.active {
  background: #ffffff;
  color: #060913;
  border-color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Full-Width Visual Stages */
.stage-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.stage-title {
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: #ffffff;
}

.stage-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.7;
  margin-top: 0.8rem;
}

/* Stage Interactive Canvas & Frame */
.interactive-stage {
  background: var(--surface-card);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 3.5rem;
  box-shadow: var(--glass-highlight);
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.interactive-stage:hover {
  border-color: var(--border-hover);
}

/* Button System */
.btn-apple {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1.65rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease-smooth);
  user-select: none;
}
.btn-apple:active { transform: scale(0.98); }

.btn-primary {
  background: var(--apple-blue);
  color: #060913;
}
.btn-primary:hover {
  background: #7dd3fc;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-hairline);
  color: #ffffff;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--border-hover);
  color: #ffffff;
}

.btn-emerald {
  background: var(--green);
  color: #060913;
}
.btn-emerald:hover {
  background: #6ee7b7;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.btn-crimson {
  background: var(--red);
  color: #060913;
}
.btn-crimson:hover {
  background: #fca5a5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* Floating Citation Popover */
.apple-popover {
  position: fixed;
  z-index: 1000;
  background: rgba(10, 15, 28, 0.96);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid var(--border-hover);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.95);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  width: 390px;
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}
.pop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 0.6rem;
}
.pop-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pop-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}
.pop-close:hover { color: #fff; }
.pop-text {
  font-size: 0.94rem;
  color: #e2e8f0;
  line-height: 1.65;
}
.pop-receipt {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hairline);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* Interactive Info Dot */
.info-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: 0.45rem;
  transition: all 0.18s ease;
  vertical-align: middle;
}
.info-bubble:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: #060913;
}

/* Arcade & Laboratory Widgets */
.slider-styled {
  -webkit-appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, #2563eb 0%, #10b981 50%, #ef4444 100%);
  outline: none;
}
.slider-styled::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
  transition: transform 0.1s ease;
}
.slider-styled::-webkit-slider-thumb:hover { transform: scale(1.15); }

.wheel-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}
#wheelCanvas {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}
.wheel-arrow {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 20px solid var(--gold);
  z-index: 5;
}

.scratch-holder {
  position: relative;
  width: 260px;
  height: 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  margin: 0 auto;
}
.scratch-secret {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(30, 27, 75, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
}
#scratchCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 260px;
  height: 130px;
  cursor: crosshair;
  z-index: 2;
}

.captcha-cells {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 360px;
}
.captcha-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.captcha-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--apple-blue);
}
.captcha-item.done {
  background: rgba(48, 209, 88, 0.2);
  border-color: var(--green);
}

/* Toast overlay */
.toast-tray {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}
.toast-msg {
  background: rgba(13, 18, 32, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.95rem 1.45rem;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.94rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(28px);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  pointer-events: auto;
  max-width: 400px;
}

/* Confetti canvas */
#confettiCanvas {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9998;
}

/* Clean Understated Footer */
footer {
  border-top: 1px solid var(--border-hairline);
  padding: 5rem 2rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  width: 100%;
}
.footer-nav {
  display: flex;
  gap: 2.2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.18s ease;
}
.footer-nav a:hover { color: #ffffff; }

/* Responsive adjustments */
@media (max-width: 900px) {
  .apple-bar { padding: 0.85rem 1.4rem; }
  main { width: 95%; padding: 2.5rem 0 6rem; gap: 4rem; }
  .interactive-stage { padding: 2rem 1.5rem; }
}

/* Accessibility: Intentional Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn-apple, .nav-link-btn, .apple-popover, .toast-msg {
    transition: none !important;
    transform: none !important;
  }
}
