@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=IM+Fell+English:ital@0;1&display=swap');

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

/* ── Base ────────────────────────────────────────────────────── */
:root {
  --bg:      #090806;
  --text:    #e4ddd0;
  --muted:   #6a6258;
  --accent:  #c5b48e;
  --display: 'Cormorant Garamond', Georgia, serif;
  --body:    'IM Fell English', Georgia, serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.075'/%3E%3C/svg%3E");
  background-size: 220px;
  background-repeat: repeat;
}

/* Vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── View switching ──────────────────────────────────────────── */
#view-person {
  display: none;
}

/* ── Home page ───────────────────────────────────────────────── */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 4rem 2rem;
}

.home__eyebrow {
  font-family: var(--display);
  font-size: 0.6rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
}

/* Vertical rule lines bracketing the name list */
.home__rule {
  width: 1px;
  height: 52px;
  background: var(--muted);
  opacity: 0;
}

.home__rule--top {
  animation: ruleIn 0.9s ease 0.3s forwards;
  transform-origin: top center;
}

.home__rule--bottom {
  animation: ruleIn 0.9s ease 0.85s forwards;
  transform-origin: top center;
}

@keyframes ruleIn {
  from { opacity: 0; transform: scaleY(0); }
  to   { opacity: 0.28; transform: scaleY(1); }
}

.home__names {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.2rem 0;
  gap: 0;
}

.home__names li {
  opacity: 0;
  animation: fadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.home__names li:nth-child(1) { animation-delay: 0.28s; }
.home__names li:nth-child(2) { animation-delay: 0.42s; }
.home__names li:nth-child(3) { animation-delay: 0.56s; }
.home__names li:nth-child(4) { animation-delay: 0.70s; }

.home__name {
  display: block;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(3.2rem, 9.5vw, 6.5rem);
  line-height: 1.1;
  letter-spacing: 0.07em;
  color: var(--text);
  padding: 0.05em 0;
  position: relative;
  transition: color 0.4s ease;
}

/* Underline that draws in on hover */
.home__name::after {
  content: '';
  position: absolute;
  bottom: 0.06em;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.home__name:hover::after {
  width: 100%;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Person page ─────────────────────────────────────────────── */
.person {
  max-width: 820px;
  margin: 0 auto;
  padding: 4rem 2rem 10rem;
}

.person__back {
  display: inline-block;
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5.5rem;
  transition: color 0.25s ease;
}

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

.person__name {
  font-family: var(--display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-bottom: 1.2rem;
}

.person__ornament {
  display: block;
  color: var(--muted);
  font-size: 0.55rem;
  letter-spacing: 0.7em;
  margin-bottom: 5.5rem;
  opacity: 0.45;
  user-select: none;
}

/* ── Memory card ─────────────────────────────────────────────── */
.memory {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-bottom: 6.5rem;
}

.memory__illustration {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.memory__illustration.visible {
  opacity: 1;
  transform: translateY(0);
}

.memory__illustration svg {
  width: 100%;
  height: auto;
  display: block;
}

.memory__text {
  font-family: var(--body);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.95;
  color: var(--text);
}

.memory__text p {
  margin-bottom: 1.1em;
}

.memory__text p:last-child {
  margin-bottom: 0;
}

/* ── Placeholder ─────────────────────────────────────────────── */
.placeholder {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  color: var(--muted);
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin-top: 2rem;
}

/* ── Divider between memories ────────────────────────────────── */
.memory-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  margin: 0 auto 6.5rem;
  color: var(--muted);
  opacity: 0.3;
}

.memory-divider::before,
.memory-divider::after {
  content: '';
  display: block;
  width: 56px;
  height: 1px;
  background: currentColor;
}

.memory-divider__glyph {
  font-size: 0.45rem;
}

/* ── SVG hand-draw animation ─────────────────────────────────── */
@keyframes draw {
  to { stroke-dashoffset: 0; }
}

.draw-path {
  stroke-dashoffset: var(--path-length, 1000);
  stroke-dasharray: var(--path-length, 1000);
  animation: draw 1.8s ease forwards;
  animation-play-state: paused;
}

.illustration-ready .draw-path {
  animation-play-state: running;
}

/* ── Responsive: side-by-side on wider screens ───────────────── */
@media (min-width: 640px) {
  .memory {
    grid-template-columns: 260px 1fr;
    align-items: start;
    gap: 4.5rem;
  }

  .memory__illustration {
    max-width: 260px;
    margin: 0;
    position: sticky;
    top: 4rem;
  }
}
