/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:            #faf9f7;
  --bg-canvas:     #f3f2ee;
  --text:          #1c1c1e;
  --text-secondary:#5c5c61;
  --text-faint:    #aeaeb2;
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --border:        #e2e0da;

  --font-serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --width-text: 700px;
  --width-wide: 920px;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Nav ────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 2rem;
  max-width: var(--width-wide);
  margin: 0 auto;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.nav-brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.nav-brand:hover { color: var(--accent); }

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

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.18rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-sans);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  max-width: var(--width-text);
  margin: 4rem auto 0;
  padding: 0 2rem;
  text-align: center;
  animation: fade-up 0.7s ease both;
}

.hero-kicker {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.4rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.72;
}

.hero-byline {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-style: italic;
  color: var(--text-faint);
  margin-top: 1.6rem;
}

.hero-byline a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.hero-byline a:hover { color: var(--text); }

.hero-burrito-figure {
  margin: 2.4rem auto 0;
  max-width: 520px;
  width: 100%;
}

.hero-burrito {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.10));
}

/* ── Walk Section ───────────────────────────────────────────────────────── */
.walk-section {
  max-width: var(--width-wide);
  margin: 4rem auto;
  padding: 0 2rem;
  animation: fade-up 0.7s 0.12s ease both;
}

.walk-figure {
  background: var(--bg-canvas);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.walk-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  cursor: crosshair;
}

.walk-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.walk-reset-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

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

.walk-caption {
  padding: 0.9rem 1.4rem 1.1rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.walk-caption em {
  font-style: italic;
  color: var(--text);
}

/* ── Intro ──────────────────────────────────────────────────────────────── */
.intro-section {
  max-width: var(--width-text);
  margin: 0 auto 5rem;
  padding: 0 2rem;
  text-align: center;
  animation: fade-up 0.7s 0.24s ease both;
}

.intro-text {
  font-size: 1.15rem;
  line-height: 1.78;
  margin-bottom: 2.4rem;
  color: var(--text);
}

.btn-primary {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  padding: 0.72rem 1.65rem;
  border-radius: 6px;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ── Essays ──────────────────────────────────────────────────────────────── */
.essays-section {
  max-width: var(--width-text);
  margin: 0 auto 6rem;
  padding: 0 2rem;
  animation: fade-up 0.7s 0.36s ease both;
}

.section-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.8rem;
}

/* Section groupings (A View of the Cell, Building Blocks, …) */
.essay-group {
  margin-bottom: 0.5rem;
}

.essay-group-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  padding: 2.2rem 0 0.5rem;
  border-top: none;
}

.essay-group:first-of-type .essay-group-title {
  padding-top: 0;
}

.essay-group--epilogue .essay-group-title {
  display: none;
}

/* Essay rows */
.essay-list {
  list-style: none;
}

.essay {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem 0;
}

.essay-body {
  flex: 1;
}

.essay-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

a.essay-title:hover {
  color: var(--accent);
}

.essay-desc {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.5;
  margin-top: 0.2rem;
}

/* Upcoming / coming-soon */
.essay--upcoming {
  opacity: 0.42;
}

.coming-soon {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.3rem;
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.18rem 0.45rem;
}


/* ── Newsletter signup ──────────────────────────────────────────────────── */
.signup-section {
  max-width: var(--width-text);
  margin: 0 auto 0;
  padding: 2rem 2rem;
  border-top: 1px solid var(--border);
}

.signup-heading {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.signup-desc {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.signup-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.signup-form label {
  display: none;
}

.signup-form input[type="email"] {
  flex: 1;
  min-width: 200px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.15s;
}

.signup-form input[type="email"]:focus {
  border-color: var(--accent);
}

.signup-form input[type="submit"] {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 5px;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s;
}

.signup-form input[type="submit"]:hover {
  background: var(--accent-hover);
}


/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  max-width: var(--width-text);
  margin: 0 auto 3rem;
  padding: 1.6rem 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-faint);
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 16px; }

  .nav { padding: 1.2rem 1.2rem; }
  .nav-links { gap: 1.2rem; }

  .hero,
  .essays-section { padding: 0 1.2rem; }

  .walk-section { padding: 0 1.2rem; }

  .hero-title { font-size: 2.6rem; }

  .essay { gap: 0.8rem; }
}

/* ── Dark mode ──────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #141413;
    --bg-canvas:     #1c1b19;
    --text:          #f0ede8;
    --text-secondary:#9a9996;
    --text-faint:    #5a5a5e;
    --accent:        #4d7fff;
    --accent-hover:  #6b94ff;
    --border:        #2a2926;
  }
}

/* JS-toggled theme overrides (take precedence over media query) */
:root[data-theme="light"] {
  --bg:            #faf9f7;
  --bg-canvas:     #f3f2ee;
  --text:          #1c1c1e;
  --text-secondary:#5c5c61;
  --text-faint:    #aeaeb2;
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --border:        #e2e0da;
}

:root[data-theme="dark"] {
  --bg:            #141413;
  --bg-canvas:     #1c1b19;
  --text:          #f0ede8;
  --text-secondary:#9a9996;
  --text-faint:    #5a5a5e;
  --accent:        #4d7fff;
  --accent-hover:  #6b94ff;
  --border:        #2a2926;
}
