/* ───────────────────────────────────────────────
   Headstone History — styles
   Antique paper · aged ink · hairline rules
   ─────────────────────────────────────────────── */

/* Fonts — self-hosted, placed in /fonts/ */
@font-face {
  font-family: 'Demo Love Struck';
  src: url('/fonts/DemoLoveStruck.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ───────────────────────────────── */
:root {
  --paper:       #F0E8D6;
  --ink:         #261C14;
  --ink-muted:   #6E5C46;
  --rule:        #A58C6E;
  --moss:        #4F6B3A;
  --cadmium:     #006B3C;
  --cadmium-dk:  #004D2A;

  --font-display: 'Demo Love Struck', Georgia, serif;
  --font-body:    Georgia, serif;

  --content-max: 640px;
  --gutter: 20px;

  --radius: 2px;
  --tap-min: 48px;
}

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  font-size: 1rem;
  min-height: 100vh;
  padding: 40px var(--gutter) 60px;
  display: flex;
  justify-content: center;
}

main {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (min-width: 700px) {
  html { font-size: 20px; }
  body { padding: 64px var(--gutter) 96px; }
}

/* ── Typography ───────────────────────────── */
h1, h2, h3, .display, .chapter, .prompt {
  font-family: var(--font-display);
  font-weight: normal;
  color: var(--ink);
  line-height: 1.15;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.6rem;
  letter-spacing: 0.01em;
  margin-bottom: 0.5rem;
}
@media (min-width: 700px) {
  .hero-title { font-size: 3.4rem; }
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-bottom: 2rem;
}

.chapter {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}

.name {
  font-family: var(--font-display);
  font-size: 2.1rem;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}
@media (min-width: 700px) {
  .name { font-size: 2.8rem; }
}

.years {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}

.prompt {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

p {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 1rem;
}

.intro {
  max-width: 540px;
  margin-bottom: 2rem;
}

.muted { color: var(--ink-muted); }

.small {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ── Rule with center ornament ────────────── */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 320px;
  margin: 1.5rem auto 2rem;
  color: var(--rule);
}
.rule::before,
.rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.rule-mark {
  width: 6px;
  height: 6px;
  background: var(--rule);
  border-radius: 50%;
  flex-shrink: 0;
}
.rule-mark.diamond {
  border-radius: 0;
  transform: rotate(45deg);
}

/* ── Buttons ──────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  max-width: 520px;
  padding: 22px 28px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  min-height: var(--tap-min);
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  background: #120c08;
  transform: scale(0.985);
}

.cta-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 1rem;
}
/* Homepage CTAs share size, pill shape, and the cadmium-green palette */
.cta-group .btn {
  background: var(--cadmium);
  color: var(--paper);
  margin: 0;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
}
.cta-group .btn:active {
  background: var(--cadmium-dk);
}

/* ── Form input ───────────────────────────── */
.year-input {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0 auto 1rem;
  padding: 14px 18px;
  background: transparent;
  border: 1px solid var(--ink-muted);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.15em;
  min-height: var(--tap-min);
  -webkit-appearance: none;
  appearance: none;
}
.year-input:focus {
  outline: none;
  border-color: var(--ink);
}
/* Hide number spinners */
.year-input::-webkit-outer-spin-button,
.year-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.year-input[type='number'] { -moz-appearance: textfield; }

.form-error {
  min-height: 1.5rem;
  margin: 0.25rem 0 0.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-muted);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.form-error.show { opacity: 1; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease; }

/* ── Map block ────────────────────────────── */
.map-block {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 2rem;
}
.map-block img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.map-caption {
  margin-top: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-muted);
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ── Form block ───────────────────────────── */
.form-block {
  width: 100%;
  margin-bottom: 2rem;
}

/* ── Video player ─────────────────────────── */
.video-block {
  width: 100%;
  margin: 2rem 0 1.5rem;
  display: none; /* shown after correct answer */
}
.video-block.visible { display: block; }

.video-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  max-height: 85vh;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.play-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: rgba(240, 232, 214, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.play-indicator::after {
  content: '';
  width: 0;
  height: 0;
  margin-left: 6px;
  border-left: 22px solid var(--ink);
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
}
.video-wrap.playing .play-indicator { opacity: 0; }
.video-wrap.ended    .play-indicator { opacity: 0; }

/* Post-video controls — shown after the video ends */
.post-video {
  display: none;
  width: 100%;
  margin-top: 1.25rem;
  flex-direction: column;
  align-items: center;
}
.post-video.visible { display: flex; }

.watch-again {
  display: inline-block;
  margin-top: 14px;
  background: none;
  border: none;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.watch-again:active { color: var(--ink); }

/* ── Chapter crumb ───────────────────────── */
.crumb {
  margin-top: 3rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  text-transform: lowercase;
}

/* ── Page footer ─────────────────────────── */
.page-footer {
  margin-top: 4rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-align: center;
}

/* ── Back-home link (journey pages) ──────── */
.back-home {
  align-self: flex-start;
  margin: -1rem 0 1rem;
}
.back-home a {
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 10px 6px;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
}
.back-home a:hover,
.back-home a:focus,
.back-home a:active { color: var(--ink); }

/* ── Timeline page ──────────────────────── */
.timeline-page {
  width: 100%;
  max-width: 720px;
}

.timeline-intro {
  width: 100%;
  text-align: center;
  margin-bottom: 2rem;
}
.timeline-intro .hero-title { margin-bottom: 0.25rem; }
.timeline-intro .hero-subtitle { margin-bottom: 0.75rem; }

.timeline-legend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 1rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  margin-top: 0.5rem;
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-swatch--history { background: var(--ink); }
.legend-swatch--person  { background: var(--moss); }

.timeline {
  position: relative;
  width: 100%;
  padding: 1rem 0 3rem;
}

/* Center vertical rule running through the column */
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--rule);
  opacity: 0.55;
  transform: translateX(-0.5px);
}

.timeline-entry {
  position: relative;
  margin: 0 0 2.4rem;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.timeline-entry.in-view {
  opacity: 1;
  transform: translateY(0);
}
.timeline-entry:last-child { margin-bottom: 0; }

/* Pill — centered on the rule, with a paper "halo" so the line breaks cleanly */
.timeline-pill {
  position: relative;
  display: block;
  margin: 0 auto 0.85rem;
  width: max-content;
  max-width: 80%;
  padding: 0.35rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 0 0 6px var(--paper);
}
.timeline-entry.person .timeline-pill {
  background: var(--moss);
}

/* Card */
.timeline-card {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 12px;
  background: #E7DFCB;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  text-align: left;
  transition: background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
a.timeline-card:hover,
a.timeline-card:focus,
a.timeline-card:active {
  background: #DBD2BC;
  outline: none;
}
a.timeline-card:active { transform: scale(0.995); }

.timeline-image {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 4px;
  background: rgba(38, 28, 20, 0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
}
.timeline-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.timeline-image--placeholder {
  background: rgba(165, 140, 110, 0.18);
}
.placeholder-mark {
  width: 10px;
  height: 10px;
  background: var(--rule);
  transform: rotate(45deg);
  display: inline-block;
}

.timeline-body {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
  align-self: center;
}

@media (min-width: 700px) {
  .timeline { padding: 1.5rem 0 4rem; }
  .timeline-entry { margin-bottom: 3rem; }
  .timeline-pill { font-size: 1.12rem; padding: 0.4rem 1.2rem; }
  .timeline-image {
    flex: 0 0 110px;
    width: 110px;
    height: 110px;
  }
  .timeline-body { font-size: 1rem; line-height: 1.55; }
  .timeline-card { padding: 16px; gap: 18px; }
}

/* ── Long-form prose (about, etc.) ──────── */
.prose {
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
}
.prose p {
  margin-bottom: 1.1rem;
}
.prose p:last-child { margin-bottom: 0; }
.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  -webkit-tap-highlight-color: transparent;
}
.prose a:hover,
.prose a:focus {
  text-decoration-color: var(--ink);
}

/* ── Contributors page ──────────────────── */
.contributors {
  margin-top: 2rem;
}
.contributor {
  margin-bottom: 2.5rem;
}
.contributor:last-child { margin-bottom: 0; }
.contributor-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: normal;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
.contributor-name a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
}
.contributor-name a:hover,
.contributor-name a:focus {
  text-decoration-color: var(--ink);
}

/* ── Homepage timeline disclosure ────────── */
.home-timeline {
  width: 100%;
  margin-top: 2.5rem;
}
.home-timeline[hidden] { display: none; }
.home-timeline .timeline { padding-top: 0.5rem; }

/* ── About page ─────────────────────────── */
.intro-line {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.4;
  color: var(--ink);
  text-align: center;
  max-width: 480px;
  margin: 0.5rem auto 1rem;
}
@media (min-width: 700px) {
  .intro-line { font-size: 1.5rem; }
}

.read-more {
  width: 100%;
  text-align: center;
  margin-bottom: 0.5rem;
}
.read-more summary {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
  -webkit-tap-highlight-color: transparent;
}
.read-more summary::-webkit-details-marker { display: none; }
.read-more summary::marker { content: ''; }
.read-more summary:hover,
.read-more summary:focus {
  color: var(--ink);
  outline: none;
}
.read-more-body {
  margin-top: 1.25rem;
}

.about-menu {
  width: 100%;
  max-width: 480px;
  margin: 2.5rem auto 0;
  display: flex;
  flex-direction: column;
}
.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 6px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, padding-left 0.15s ease;
}
.menu-item:first-child { border-top: 1px solid var(--rule); }
.menu-item::after {
  content: '\2192'; /* → */
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 1.05rem;
  transition: transform 0.15s ease, color 0.15s ease;
}
.menu-item:hover,
.menu-item:focus {
  color: var(--ink);
  padding-left: 10px;
  outline: none;
}
.menu-item:hover::after,
.menu-item:focus::after {
  color: var(--ink);
  transform: translateX(3px);
}

/* ── Utilities ───────────────────────────── */
.hidden { display: none !important; }
