:root {
  --night: #0f0b1a;
  --night-2: #1a1330;
  --stone: #2b2638;
  --stone-edge: #3d3650;
  --bone: #efe6d6;
  --dim: #a99fba;
  --marigold: #f6a21a;
  --rose: #e2457a;
  --teal: #3cc2b4;
  --serif: "IM Fell English", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--bone);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, #3a1d4a 0%, transparent 70%),
    radial-gradient(ellipse 60% 30% at 50% 100%, #2a1430 0%, transparent 70%),
    var(--night);
}

a { color: var(--marigold); }

/* Papel picado: a strip of cut-paper flags */
.papel {
  height: 40px;
  border-top: 2px solid #5a4a6a;
  background: linear-gradient(90deg, var(--rose) 0 25%, var(--marigold) 25% 50%, var(--teal) 50% 75%, #9b5de5 75%) 0 0 / 240px 100%;
  -webkit-mask:
    radial-gradient(circle 5px at 30px 14px, #0000 98%, #000) 0 0 / 60px 30px repeat-x,
    conic-gradient(from 135deg at 50% 0, #000 90deg, #0000 0) 0 30px / 20px 10px repeat-x;
  mask:
    radial-gradient(circle 5px at 30px 14px, #0000 98%, #000) 0 0 / 60px 30px repeat-x,
    conic-gradient(from 135deg at 50% 0, #000 90deg, #0000 0) 0 30px / 20px 10px repeat-x;
  opacity: .85;
}

.masthead { text-align: center; padding: 2.5rem 1rem 1rem; }
.title-link { text-decoration: none; color: inherit; }
h1 {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 5rem);
  font-weight: 400;
  letter-spacing: .02em;
  color: var(--marigold);
  text-shadow: 0 0 24px rgba(246, 162, 26, .45);
}
.tagline { margin: .25rem 0 0; color: var(--dim); font-style: italic; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.loading, .empty { text-align: center; color: var(--dim); font-style: italic; }

/* Graveyard */
.graveyard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2.5rem 1.75rem;
  padding-top: 1rem;
}

.tomb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  min-height: 270px;
  padding: 2.4rem 1rem 1.4rem;
  text-align: center;
  text-decoration: none;
  color: var(--bone);
  background: linear-gradient(180deg, var(--stone-edge), var(--stone) 30%, #221d2e);
  border-radius: 110px 110px 6px 6px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.04), 0 18px 0 -8px #120e1c, 0 22px 30px rgba(0,0,0,.5);
  transition: transform .25s ease, box-shadow .25s ease;
}
.tomb:hover, .tomb:focus-visible {
  transform: translateY(-6px);
  box-shadow: inset 0 0 0 2px rgba(246,162,26,.35), 0 18px 0 -8px #120e1c, 0 0 40px rgba(246,162,26,.25);
  outline: none;
}
.rip { font-size: .8rem; letter-spacing: .3em; color: var(--dim); }
.tomb-name { font-family: var(--mono); font-size: .95rem; font-weight: 600; word-break: break-word; }
.tomb-dates { font-family: var(--mono); font-size: .8rem; color: var(--marigold); }
.tomb-epitaph { margin-top: .4rem; font-style: italic; font-size: 1rem; color: var(--bone); opacity: .9; }
.tomb-epitaph:empty::before { content: "Not yet summoned"; color: var(--dim); }

.candle {
  position: absolute;
  bottom: -14px;
  right: 18px;
  width: 12px;
  height: 26px;
  background: linear-gradient(#f5ecd7, #d8cbb0);
  border-radius: 2px;
}
.flame {
  position: absolute;
  left: 50%;
  top: -14px;
  width: 9px;
  height: 14px;
  margin-left: -4.5px;
  background: radial-gradient(ellipse at 50% 70%, #fff6c8 0 20%, var(--marigold) 45%, transparent 70%);
  border-radius: 50% 50% 45% 45%;
  filter: drop-shadow(0 0 8px var(--marigold));
  animation: flicker 1.6s infinite alternate ease-in-out;
}
@keyframes flicker {
  0%   { transform: scale(1, 1) rotate(-2deg); opacity: .95; }
  50%  { transform: scale(.9, 1.1) rotate(2deg); opacity: .8; }
  100% { transform: scale(1.05, .95) rotate(-1deg); opacity: 1; }
}

/* Ofrenda (detail page) */
.back { display: inline-block; margin-bottom: 1rem; font-style: italic; }

.ofrenda-head { text-align: center; margin-bottom: 2rem; }
.ofrenda-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(1.3rem, 4vw, 2rem);
  word-break: break-word;
}
.ofrenda-head .dates { font-family: var(--mono); color: var(--marigold); }
.ofrenda-head .epitaph { font-size: 1.4rem; font-style: italic; margin: .5rem 0 0; }

.ofrenda { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.75rem; align-items: start; }
@media (max-width: 800px) { .ofrenda { grid-template-columns: 1fr; } }

.panel { border-radius: 10px; padding: 1.4rem 1.5rem; }
.panel h3 { margin: 0 0 .1rem; font-weight: 400; font-size: 1.35rem; }
.panel .label {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .15rem .5rem;
  border-radius: 4px;
}

.facts { background: #141b24; border: 1px solid #22303d; }
.facts .label { background: rgba(60,194,180,.15); color: var(--teal); }
.facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; font-size: .95rem; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; font-family: var(--mono); font-size: .85rem; word-break: break-word; }
.facts .source { margin: 1rem 0 0; font-size: .8rem; color: var(--dim); }

.ghost {
  background: linear-gradient(160deg, rgba(226,69,122,.10), rgba(246,162,26,.06)), #1c1426;
  border: 1px solid #3b2540;
}
.ghost .label { background: rgba(226,69,122,.16); color: var(--rose); }
.ghost .monologue p { margin: 0 0 1em; font-size: 1.12rem; }
.ghost .monologue p:first-child::first-letter {
  float: left;
  font-size: 3.2em;
  line-height: .9;
  padding: .05em .1em 0 0;
  color: var(--marigold);
}
.ghost audio { width: 100%; margin: .25rem 0 1rem; filter: sepia(.4) saturate(1.3) hue-rotate(-20deg); }
.ghost .credit { font-size: .8rem; color: var(--dim); margin: 0; }

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  text-align: center;
  color: var(--dim);
  font-size: .9rem;
  border-top: 1px solid #2a2338;
}

@media (prefers-reduced-motion: reduce) {
  .flame { animation: none; }
  .tomb { transition: none; }
}
