/* ============ RESET & BASE ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a28;
  --border: #1e1e2e;
  --text: #c8c8d4;
  --text-bright: #e8e8f0;
  --text-dim: #6a6a80;
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.15);
  --accent-glow: rgba(0, 212, 170, 0.3);
  --wake: #4ecdc4;
  --focus: #f7dc6f;
  --rest: #8e99a4;
  --dream: #a78bfa;
  --crisis: #ff6b6b;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============ NAVIGATION ============ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.1em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ============ HERO ============ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 56px;
  background: radial-gradient(ellipse at 50% 30%, rgba(0, 212, 170, 0.05) 0%, transparent 60%);
}

.hero-content {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero-label {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.hero-sub {
  font-size: 1.25rem;
  color: var(--text-dim);
  margin-bottom: 3rem;
}

.hero-loop {
  margin: 2rem auto;
  max-width: 420px;
}

.loop-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--text);
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem 2rem;
  display: block;
}

.loop-code .kw { color: var(--accent); }
.loop-code .cm { color: var(--text-dim); }

.hero-cta {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 0.7rem 2rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn:not(.btn-ghost) {
  background: var(--accent);
  color: var(--bg);
}

.btn:not(.btn-ghost):hover {
  box-shadow: 0 0 20px var(--accent-glow);
}

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

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ SECTIONS ============ */
section {
  padding: 6rem 0;
}

section:nth-child(even) {
  background: rgba(18, 18, 26, 0.5);
}

h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

h4 {
  font-size: 1.1rem;
  color: var(--text-bright);
  font-weight: 600;
}

.section-intro {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 700px;
  margin-bottom: 2.5rem;
}

p {
  margin-bottom: 1rem;
}

ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.4rem;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-bright);
  font-style: italic;
  background: var(--accent-dim);
  border-radius: 0 6px 6px 0;
}

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--bg-card);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  color: var(--accent);
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

/* ============ HERO AVATAR ============ */
.hero-avatar {
  margin-bottom: 1.5rem;
}

.hero-avatar-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: 0 0 30px var(--accent-dim);
  transition: box-shadow 0.3s, border-color 0.3s;
}

.hero-avatar-img:hover {
  border-color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
}

.hero-avatar-caption {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  margin-bottom: 0;
  letter-spacing: 0.1em;
}

@media (max-width: 768px) {
  .hero-avatar-img {
    width: 110px;
    height: 110px;
  }
}

/* ============ TWO COLUMN ============ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 1.5rem;
}

/* ============ STACK DIAGRAM ============ */
.stack-diagram {
  max-width: 500px;
  margin: 2rem auto;
  text-align: center;
}

.stack-layer {
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.stack-layer h4 {
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.05em;
}

.stack-sage { border-color: var(--accent); }
.stack-sage h4 { color: var(--accent); }
.stack-irp { border-color: var(--focus); }
.stack-irp h4 { color: var(--focus); }
.stack-vae { border-color: var(--dream); }
.stack-vae h4 { color: var(--dream); }

.stack-layer p {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 0;
}

.stack-arrow {
  font-size: 1.5rem;
  color: var(--text-dim);
  padding: 0.3rem;
}

/* ============ STATE GRID ============ */
.state-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.state-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.state-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-dim);
}

.state-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 700;
  font-size: 1rem;
}

.state-icon.wake { background: rgba(78, 205, 196, 0.2); color: var(--wake); }
.state-icon.focus { background: rgba(247, 220, 111, 0.2); color: var(--focus); }
.state-icon.rest { background: rgba(142, 153, 164, 0.2); color: var(--rest); }
.state-icon.dream { background: rgba(167, 139, 250, 0.2); color: var(--dream); }
.state-icon.crisis { background: rgba(255, 107, 107, 0.2); color: var(--crisis); }

.state-card h4 {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.state-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0;
}

/* ============ SNARC ============ */
.snarc-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.snarc-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.85rem;
  text-align: center;
}

.snarc-item strong {
  color: var(--accent);
  font-size: 1.1rem;
}

/* ============ ACCORDION ============ */
.accordion {
  margin-top: 1.5rem;
}

.acc-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.acc-header {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: none;
  color: var(--text-bright);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
}

.acc-header::after {
  content: '+';
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  font-size: 1.2rem;
  transition: transform 0.2s;
}

.acc-item.open .acc-header::after {
  content: '\2212';
}

.acc-header:hover {
  background: var(--bg-card-hover);
}

.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1.5rem;
}

.acc-item.open .acc-body {
  max-height: 2000px;
  padding: 1rem 1.5rem 1.5rem;
}

.code-block {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  overflow-x: auto;
  color: var(--text);
  display: block;
}

.code-block .kw { color: var(--accent); }

/* ============ LIVE NOW ============ */
.live-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.live-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-dim);
}

.live-number {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.live-card p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.live-detail {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.live-dashboard {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.live-dashboard p {
  color: var(--text-dim);
  margin-bottom: 0;
}

/* ============ ROADMAP ============ */
.roadmap-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 1.5rem;
}

.roadmap-tier {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
}

.roadmap-tier h3 {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.roadmap-tier ul {
  list-style: none;
  margin-left: 0;
}

.roadmap-tier li {
  padding: 0.4rem 0;
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.9rem;
}

.roadmap-tier li::before {
  content: '\2192';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ============ TIMELINE ============ */
.timeline {
  position: relative;
  margin-top: 2rem;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-event {
  position: relative;
  margin-bottom: 2.5rem;
}

.timeline-marker {
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline-event:last-child .timeline-marker {
  background: var(--accent);
}

.timeline-content {
  padding-left: 0.5rem;
}

.timeline-content h4 {
  margin-bottom: 0.5rem;
}

/* ============ WEB4 EQUATION ============ */
.equation {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 1rem;
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.eq-legend {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ============ HERO LOOP CAPTION ============ */
.loop-caption {
  font-size: 0.9rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 0.75rem;
}

/* ============ STATE ANALOG ============ */
.state-analog {
  font-size: 0.7rem;
  color: var(--accent);
  opacity: 0.7;
  margin-top: 0.3rem;
  margin-bottom: 0;
  font-style: italic;
}

/* ============ NOTE ============ */
.note {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 212, 170, 0.05);
  border-left: 2px solid var(--accent-dim);
  border-radius: 0 4px 4px 0;
}

.note a { color: var(--accent); }

/* ============ ARCHITECTURE OVERVIEW ============ */
.arch-overview {
  margin-bottom: 2rem;
}

.arch-overview h3 {
  margin-top: 0;
}

.arch-phases {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1.5rem 0;
}

.arch-phase {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.arch-phase-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 700;
  font-size: 0.9rem;
}

.arch-phase h4 {
  margin-bottom: 0.5rem;
}

.arch-phase p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0;
}

.arch-phase-arrow {
  color: var(--accent);
  font-size: 1.5rem;
  padding: 0 0.75rem;
  flex-shrink: 0;
}

/* ============ HARDWARE TABLE ============ */
.hw-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.hw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.hw-table th,
.hw-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.hw-table th {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.hw-table td {
  color: var(--text);
}

.hw-table td strong {
  color: var(--accent);
}

.hw-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ============ TOOL TIER LIST ============ */
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.tier-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.tier-item strong {
  color: var(--accent);
  font-size: 0.95rem;
}

.tier-item p {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ============ WEB4 DETAILS ============ */
.web4-details {
  margin: 1rem 0;
}

.web4-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.web4-details summary:hover {
  text-decoration: underline;
}

/* ============ GET STARTED ============ */
.get-started {
  border-top: 1px solid var(--accent-dim);
}

.start-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.start-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.start-step h4 {
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.start-step .code-block {
  font-size: 0.8rem;
  margin: 0;
  padding: 0.75rem 1rem;
}

/* ============ FOOTER ============ */
footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.5rem 0;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .state-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .snarc-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .live-grid {
    grid-template-columns: 1fr 1fr;
  }

  .roadmap-track {
    grid-template-columns: 1fr;
  }

  .arch-phases {
    flex-direction: column;
  }

  .arch-phase-arrow {
    transform: rotate(90deg);
    padding: 0.25rem 0;
  }

  .start-steps {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 1.8rem;
  }

  .hero h1 {
    font-size: 3.5rem;
  }
}

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

  .snarc-grid {
    grid-template-columns: 1fr 1fr;
  }

  .live-grid {
    grid-template-columns: 1fr;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }
}
