:root {
  --bg-deep: #0a0a0f;
  --bg-surface: #12121a;
  --bg-elevated: #1a1a26;
  --fg-primary: #e8e4dc;
  --fg-secondary: #9a9590;
  --fg-muted: #5a5650;
  --accent-gold: #c49a4a;
  --accent-warm: #d4a853;
  --accent-glow: rgba(196, 154, 74, 0.15);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  background: var(--bg-deep);
  color: var(--fg-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

.accent {
  color: var(--accent-gold);
}

/* --- NAV --- */
.nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 2rem 3rem;
  z-index: 10;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  text-transform: lowercase;
}

/* --- HERO --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 3rem 4rem;
  overflow: hidden;
}

.hero-bg-pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(196, 154, 74, 0.06) 0%, transparent 70%),
    radial-gradient(circle at 20% 80%, rgba(196, 154, 74, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  max-width: 820px;
  position: relative;
  z-index: 2;
}

.hero-kicker {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 2rem;
  color: var(--fg-primary);
}

.hero-sub {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--fg-secondary);
  max-width: 600px;
  font-weight: 300;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--accent-gold), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* --- ETYMOLOGY DEMO --- */
.etym-demo {
  padding: 8rem 3rem;
  background: var(--bg-surface);
  border-top: 1px solid rgba(196, 154, 74, 0.1);
  border-bottom: 1px solid rgba(196, 154, 74, 0.1);
}

.etym-demo-inner {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent-gold);
  margin-bottom: 1rem;
  font-weight: 500;
}

.etym-demo h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  margin-bottom: 4rem;
}

.word-journey {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.word-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.5rem 2rem;
  border-radius: 12px;
}

.root-node {
  background: var(--accent-glow);
  border: 1px solid rgba(196, 154, 74, 0.3);
  margin-bottom: 0;
}

.word-era {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--fg-muted);
  font-weight: 500;
}

.word-form {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent-gold);
  font-style: italic;
}

.word-meaning {
  font-size: 0.85rem;
  color: var(--fg-secondary);
}

.branch-lines {
  display: flex;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 700px;
  height: 50px;
  position: relative;
}

.branch-line {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(196, 154, 74, 0.25);
}

.branch-line.left { left: 16%; }
.branch-line.center { left: 50%; }
.branch-line.right { left: 84%; }

.word-branches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
  max-width: 800px;
}

.branch-node {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.modern-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.8rem;
}

.modern-word {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  background: rgba(196, 154, 74, 0.08);
  border: 1px solid rgba(196, 154, 74, 0.15);
  border-radius: 20px;
  color: var(--fg-secondary);
  font-weight: 400;
}

.etym-caption {
  margin-top: 3rem;
  font-size: 1rem;
  color: var(--fg-secondary);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

/* --- FEATURES --- */
.features {
  padding: 8rem 3rem;
}

.features-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.feature-block {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 2rem;
  align-items: start;
}

.feature-number {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 300;
  color: rgba(196, 154, 74, 0.25);
  line-height: 1;
  padding-top: 0.2rem;
}

.feature-content h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--fg-primary);
}

.feature-content p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--fg-secondary);
  font-weight: 300;
}

/* --- CLOSING --- */
.closing {
  padding: 8rem 3rem;
  background: var(--bg-surface);
  border-top: 1px solid rgba(196, 154, 74, 0.1);
  text-align: center;
}

.closing-inner {
  max-width: 750px;
  margin: 0 auto;
}

.closing h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 2rem;
}

.closing p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--fg-secondary);
  font-weight: 300;
}

/* --- FOOTER --- */
.site-footer {
  padding: 4rem 3rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  text-transform: lowercase;
  margin-bottom: 0.5rem;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* --- LANDING CTA BUTTONS --- */
.nav-cta {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  text-decoration: none;
  border: 1px solid rgba(196, 154, 74, 0.35);
  padding: 0.45rem 1rem;
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s;
}
.nav-cta:hover {
  background: var(--accent-glow);
  border-color: rgba(196, 154, 74, 0.6);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-cta {
  display: inline-block;
  margin-top: 2.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--bg-deep);
  background: var(--accent-gold);
  text-decoration: none;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  transition: background 0.2s, opacity 0.2s;
}
.hero-cta:hover {
  background: var(--accent-warm);
  opacity: 0.9;
}

/* --- EXPLORE PAGE --- */
.explore-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.explore-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 1.25rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(196, 154, 74, 0.08);
}

.explore-nav .logo {
  text-decoration: none;
}

.explore-nav-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* --- SEARCH --- */
.explore-search-wrap {
  padding: 2.5rem 2.5rem 1.5rem;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.explore-search-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.explore-search-input {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  font-style: italic;
  color: var(--fg-primary);
  background: var(--bg-surface);
  border: 1px solid rgba(196, 154, 74, 0.2);
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.explore-search-input::placeholder {
  color: var(--fg-muted);
  font-style: italic;
}
.explore-search-input:focus {
  border-color: rgba(196, 154, 74, 0.5);
  box-shadow: 0 0 0 3px rgba(196, 154, 74, 0.08);
}

.explore-search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--bg-deep);
  background: var(--accent-gold);
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.explore-search-btn:hover {
  background: var(--accent-warm);
}

.explore-suggestions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.suggestions-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-muted);
  font-weight: 500;
}

.suggestion-chip {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--fg-secondary);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.suggestion-chip:hover {
  color: var(--accent-gold);
  border-color: rgba(196, 154, 74, 0.3);
  background: var(--accent-glow);
}

/* --- STATES --- */
.explore-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2.5rem;
}
.explore-empty-text {
  font-size: 1rem;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-style: italic;
}

.explore-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 4rem 2.5rem;
}
.explore-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(196, 154, 74, 0.2);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.explore-loading-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--fg-secondary);
}

.explore-error {
  padding: 2rem 2.5rem;
  max-width: 760px;
  margin: 0 auto;
  color: #c46a4a;
  font-size: 0.9rem;
}

/* --- RESULT --- */
.explore-result {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2.5rem 4rem;
  width: 100%;
}

.result-header {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(196, 154, 74, 0.1);
}

.result-word {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  color: var(--fg-primary);
}

.result-root-badge {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  background: var(--accent-glow);
  border: 1px solid rgba(196, 154, 74, 0.2);
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  white-space: nowrap;
}

.chain-section, .tree-section, .notes-section {
  margin-bottom: 3rem;
}

.chain-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--fg-muted);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.chain-track {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(196,154,74,0.2) transparent;
}

.chain-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.05);
  min-width: 110px;
  flex-shrink: 0;
}

.chain-step--root {
  border-color: rgba(196, 154, 74, 0.3);
  background: var(--accent-glow);
}

.chain-step--modern {
  border-color: rgba(196, 154, 74, 0.5);
  background: rgba(196, 154, 74, 0.1);
}

.chain-period {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  font-weight: 500;
}

.chain-form {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  font-style: italic;
  color: var(--accent-gold);
  text-align: center;
}

.chain-lang {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
}

.chain-meaning {
  font-size: 0.72rem;
  color: var(--fg-secondary);
  text-align: center;
  max-width: 120px;
}

.chain-arrow {
  font-size: 1.2rem;
  color: rgba(196, 154, 74, 0.3);
  padding: 0 0.4rem;
  flex-shrink: 0;
}

.tree-container {
  background: var(--bg-surface);
  border: 1px solid rgba(196, 154, 74, 0.08);
  border-radius: 12px;
  overflow: hidden;
  padding: 1.5rem 0;
}

#treeSvg {
  display: block;
  width: 100%;
}

.notes-section {
  background: var(--bg-elevated);
  border: 1px solid rgba(196, 154, 74, 0.12);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 8px 8px 0;
  padding: 1.5rem 1.75rem;
}

.notes-kicker {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent-gold);
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.notes-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--fg-secondary);
  line-height: 1.65;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .hero {
    padding: 5rem 1.5rem 3rem;
  }

  .nav {
    padding: 1.5rem;
  }

  .etym-demo {
    padding: 5rem 1.5rem;
  }

  .word-branches {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .branch-lines {
    display: none;
  }

  .features {
    padding: 5rem 1.5rem;
  }

  .feature-block {
    grid-template-columns: 50px 1fr;
    gap: 1rem;
  }

  .feature-number {
    font-size: 2rem;
  }

  .closing {
    padding: 5rem 1.5rem;
  }

  .site-footer {
    padding: 3rem 1.5rem;
  }
}