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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-x: hidden;
}

::selection {
  background: rgba(200, 160, 100, 0.3);
  color: var(--text-primary);
}

html[data-theme="light"] ::selection {
  background: rgba(160, 120, 48, 0.25);
}

/* Light-mode scrollbar overrides */
html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(209, 201, 190, 0.7);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(160, 120, 48, 0.4);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb:active {
  background: rgba(160, 120, 48, 0.5);
}
html[data-theme="light"] * {
  scrollbar-color: rgba(209, 201, 190, 0.7) transparent;
}

/* ---- Custom scrollbar (Murmur theme) ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

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

strong {
  color: var(--text-primary);
  font-weight: 500;
}

em {
  font-style: italic;
  color: var(--text-primary);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  border: 1px solid var(--border-subtle);
}


/* ============================================
   HERO
   ============================================ */
.hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero__illustration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.hero__illustration canvas {
  width: 100%;
  height: 100%;
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__title {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.hero__title-line {
  display: block;
  opacity: 0;
  transform: translateY(30px);
}

.hero__title-line--1 {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.hero__title-line--2 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero__title-line--3 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.2;
}

.hero__subtitle {
  margin-top: var(--sp-2xl);
  font-size: 0.9375rem;
  color: var(--text-muted);
  opacity: 0;
  transform: translateY(20px);
}

.hero__subtitle strong {
  color: var(--text-secondary);
}

.hero__scroll-hint {
  position: absolute;
  bottom: var(--sp-2xl);
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  opacity: 0;
}

.hero__scroll-dot {
  animation: hero-scroll-bob 2s ease-in-out infinite;
}

@keyframes hero-scroll-bob {
  0%, 100% { cy: 8; }
  50% { cy: 16; }
}


/* ============================================
   PROLOGUE
   ============================================ */
.prologue {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-xl);
  position: relative;
  overflow: hidden;
}

.prologue::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(200,160,100,0.04) 0%, transparent 70%);
  pointer-events: none;
}

html[data-theme="light"] .prologue::before {
  background: radial-gradient(ellipse at center, rgba(160,120,48,0.04) 0%, transparent 70%);
}

.prologue__content {
  max-width: 700px;
}

.prologue__line {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  color: var(--text-secondary);
  line-height: 1.4;
  opacity: 0;
  transform: translateY(20px);
}

.prologue__line--2 {
  margin-top: var(--sp-lg);
  color: var(--text-primary);
}

.prologue__line--2 em {
  color: var(--accent);
  font-style: italic;
}


/* ============================================
   TYPOGRAPHY SCALE
   ============================================ */
.act__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.act__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.15;
  margin-top: var(--sp-sm);
}

.step__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: var(--sp-sm);
}

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

.step__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--sp-md);
}

.step__body {
  font-size: 1.0625rem;
  line-height: 1.75;
  max-width: 36ch;
}


/* ============================================
   LAYOUT — SECTIONS
   ============================================ */
.act {
  padding: var(--sp-4xl) var(--sp-xl);
  max-width: 1200px;
  margin: 0 auto;
}

.act__header {
  margin-bottom: var(--sp-3xl);
  opacity: 0;
  transform: translateY(30px);
}

.act__header.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}


/* ============================================
   EPILOGUE
   ============================================ */
.epilogue {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-4xl) var(--sp-xl);
  position: relative;
}

.epilogue::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(200,160,100,0.03) 0%, transparent 70%);
  pointer-events: none;
}

html[data-theme="light"] .epilogue::before {
  background: radial-gradient(ellipse at center, rgba(160,120,48,0.04) 0%, transparent 70%);
}

.epilogue__content {
  max-width: 700px;
}

.epilogue__line {
  opacity: 0;
  transform: translateY(20px);
}

.epilogue__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--text-primary);
  margin-bottom: var(--sp-xl);
}

.epilogue__text {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--sp-lg);
}


/* ============================================
   ESSAY NAV — Chapter navigation
   ============================================ */
.essay-nav {
  padding: var(--sp-3xl) var(--sp-xl);
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: var(--sp-lg);
  justify-content: center;
}

.essay-nav__link {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  flex: 1;
  max-width: 280px;
}

.essay-nav__link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.essay-nav__dir {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.essay-nav__title {
  font-size: 1rem;
  color: var(--text-primary);
}


/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: var(--sp-3xl) var(--sp-xl);
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.footer__text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

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

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


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .act {
    padding: var(--sp-3xl) var(--sp-md);
  }

  .essay-nav {
    flex-direction: column;
    align-items: center;
  }

  .essay-nav__link {
    max-width: 100%;
  }
}
