/* Paleta del museo. El magenta se concentra en accesos y pequeños acentos. */
:root {
  color-scheme: dark;
  --azul-profundo: #19499a;
  --azul: #0b77bd;
  --amarillo: #fab216;
  --naranja: #ed6f1e;
  --magenta: #912986;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background-color: var(--azul-profundo);
  background-image: none;
  color: var(--amarillo);
  font: 16px/1.6 Arial, Helvetica, sans-serif;
}
/* Fondo liso: no se usan capas decorativas detrás de la página. */
body::before, body::after { content: none; background: none; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
  padding: 12px 18px;
  border: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: 700 12px/1.3 Arial, sans-serif;
  cursor: pointer;
  transition: background-color .18s, color .18s, border-color .18s;
}
button:hover { background: var(--amarillo); color: var(--azul-profundo); }
button:focus-visible, a:focus-visible, #viewer:focus-visible {
  outline: 3px solid var(--naranja);
  outline-offset: 5px;
}

/* La cabecera amarilla presenta la identidad sin competir con la ofrenda. */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 94px;
  padding: 17px max(5%, calc((100vw - 1320px) / 2));
  border-bottom: 7px solid var(--magenta);
  background: var(--amarillo);
  color: var(--azul-profundo);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 900; line-height: .95; letter-spacing: .5px; text-decoration: none; }
.brand em { font-size: 26px; font-style: normal; }
.brand-mark { width: 43px; height: 49px; }
.edition { font: 11px/1.6 monospace; letter-spacing: 2px; }
header button { border-color: var(--azul-profundo); }
header button:hover { background: var(--azul-profundo); color: var(--amarillo); }
main { max-width: 1480px; margin: auto; padding: 0 5%; }
.eyebrow { font: 700 10px/1.5 monospace; letter-spacing: 1.6px; }
.intro { display: grid; grid-template-columns: 1fr 330px; align-items: end; gap: 40px; padding: 52px 0 38px; }
.intro-copy .eyebrow { display: flex; align-items: center; gap: 8px; }
.intro-dot { width: 8px; height: 8px; background: var(--naranja); transform: rotate(45deg); }
h1 { margin: 22px 0 0; font: 700 clamp(55px, 7.8vw, 116px)/.94 Georgia, 'Times New Roman', serif; letter-spacing: -4px; }
h1 em { color: var(--naranja); font-style: italic; }
.intro-note { display: grid; grid-template-columns: 78px 1fr; gap: 16px; align-items: center; padding-bottom: 5px; }
.intro-note p { grid-column: 1 / -1; margin: 0; font-size: 15px; line-height: 1.6; }
.intro-note a {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 18px;
  border-left: 5px solid var(--naranja);
  background: var(--magenta);
  color: var(--amarillo);
  font: 700 11px/1.3 monospace;
  text-decoration: none;
}
.intro-note a span { font: 26px/1 Georgia, serif; }
.intro-note a:hover { background: var(--amarillo); color: var(--azul-profundo); }
.remembrance-seal { display: flex; align-items: center; gap: 13px; grid-column: 1 / -1; }
.remembrance-seal > span { color: var(--naranja); font-size: 69px; line-height: 1; }
.remembrance-seal small { padding-left: 14px; border-left: 1px solid var(--amarillo); font: 10px/1.5 monospace; letter-spacing: 2px; }

/* Rombos en una cenefa estrecha;*/
.paper { display: flex; align-items: center; justify-content: space-around; height: 34px; margin: 0 0 25px; border-top: 1px solid var(--amarillo); border-bottom: 1px solid var(--amarillo); }
.paper span { width: 11px; height: 11px; background: var(--naranja); transform: rotate(45deg); }
.paper span:nth-child(3n+2) { background: var(--amarillo); }
.paper span:nth-child(3n) { background: var(--magenta); border: 1px solid var(--naranja); }
.scene-caption { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 20px; background: var(--amarillo); color: var(--azul-profundo); font: 700 10px monospace; letter-spacing: 1px; }
.section-number { padding-right: 12px; margin-right: 12px; border-right: 1px solid var(--azul-profundo); color: var(--magenta); }

/* El visor y las calaveritas comparten coordenadas sobre la imagen. */
#viewer { position: relative; height: clamp(350px, 53vw, 690px); overflow: hidden; border: 8px solid var(--amarillo); border-top: 0; border-bottom: 10px solid var(--amarillo); background: var(--azul-profundo); touch-action: none; cursor: grab; isolation: isolate; }
#viewer:active { cursor: grabbing; }
#scene { position: absolute; transform-origin: 0 0; will-change: transform; }
#altar { display: block; width: 100%; height: 100%; user-select: none; }
#hotspots { position: absolute; inset: 0; --escala-icono: 1; }
.hotspot {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  height: 64px;
  padding: 5px;
  transform: translate(-50%, -50%) scale(var(--escala-icono));
  border: 2px solid var(--amarillo);
  border-radius: 26px 26px 15px 15px;
  background: var(--magenta);
  color: var(--amarillo);
  transition: background-color .18s, border-color .18s;
}
.hotspot > img { width: 42px; height: 48px; pointer-events: none; user-select: none; }
.hotspot:hover, .hotspot:focus-visible { z-index: 3; background: var(--azul-profundo); border-color: var(--naranja); }
.hotspot-label { position: absolute; top: calc(100% + 8px); left: 50%; padding: 7px 11px; transform: translateX(-50%); background: var(--amarillo); color: var(--azul-profundo); font: 700 11px/1.2 Arial, sans-serif; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .18s; }
.hotspot:hover .hotspot-label, .hotspot:focus-visible .hotspot-label { opacity: 1; }
.hint { position: absolute; top: 15px; left: 15px; padding: 9px 12px; border-left: 3px solid var(--naranja); background: var(--azul-profundo); color: var(--amarillo); font: 11px monospace; pointer-events: none; }
.controls { position: absolute; bottom: 18px; left: 50%; display: flex; align-items: center; padding: 5px; transform: translateX(-50%); border: 2px solid var(--magenta); border-radius: 30px; background: var(--amarillo); color: var(--magenta); white-space: nowrap; }
.controls button { padding: 11px 13px; border: 0; border-radius: 22px; background: var(--amarillo); color: var(--magenta); font-size: 12px; }
.controls button:focus-visible { outline-color: var(--magenta); outline-offset: 2px; }
.controls button:hover { background: var(--magenta); color: var(--amarillo); }
.controls output { min-width: 48px; font: 11px monospace; text-align: center; }
#reset { margin: 0 4px; padding-inline: 18px; border: 1px solid var(--magenta); background: var(--amarillo); color: var(--magenta); font-weight: 900; }
#reset:hover { background: var(--magenta); color: var(--amarillo); }
#viewer:fullscreen { width: 100vw; height: 100dvh; border: 0; }

/* Tarjetas editoriales: retrato, nombre e icono, sin repetir información. */
.people-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-top: 38px; }
.people-heading h2 { margin: 9px 0 0; font: 700 34px/1.1 Georgia, 'Times New Roman', serif; }
.people-heading > span { padding-bottom: 5px; font: 10px monospace; }
.people { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0 42px; gap: 15px; counter-reset: person; }
.person { position: relative; display: flex; align-items: center; gap: 14px; padding: 20px 16px; border: 1px solid var(--amarillo); border-bottom: 5px solid var(--naranja); background: var(--azul-profundo); color: var(--amarillo); font-size: 16px; text-align: left; counter-increment: person; }
.person:nth-child(2) { border-bottom-color: var(--magenta); }
.person:nth-child(3) { border-bottom-color: var(--azul); }
.person:hover { background: var(--magenta); color: var(--amarillo); }
.person::before { content: '0' counter(person); align-self: flex-start; color: var(--naranja); font: 700 10px monospace; }
.person > img:not(.person-skull) { width: 51px; height: 63px; object-fit: cover; border: 2px solid var(--naranja); }
.person > span { flex: 1; }
.person small { display: block; margin-top: 9px; font: 9px monospace; letter-spacing: .4px; }
.person .person-skull { width: 27px; height: 31px; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; padding: 20px 0; border-top: 2px solid var(--naranja); font: 9px monospace; }
.footer-name { display: flex; align-items: center; gap: 12px; font-weight: bold; }
.footer-name > span { color: var(--naranja); font-size: 22px; }

/* Fichas: amarillo para leer, retrato sobre azul y detalles magenta. */
dialog { width: 90%; max-width: 920px; max-height: 90dvh; padding: 0; overflow: auto; border: 8px solid var(--amarillo); border-radius: 0; background: var(--amarillo); color: var(--azul-profundo); }
dialog::backdrop { background: var(--azul-profundo); opacity: .9; }
#detail[open] { display: grid; grid-template-columns: 38% 62%; }
.portrait { position: relative; display: flex; align-items: center; min-height: 480px; padding: 27px; border-bottom: 10px solid var(--magenta); background: var(--azul-profundo); }
.portrait img { width: 100%; max-height: 450px; border: 6px solid var(--naranja); object-fit: contain; }
.portrait span { position: absolute; bottom: 14px; left: 18px; color: var(--amarillo); font: 900 50px/1 Arial; }
.bio { padding: 42px 35px 30px; }
.bio .eyebrow { color: var(--azul-profundo); }
.bio h2 { margin: 18px 0; font: 700 42px/1 Georgia, 'Times New Roman', serif; letter-spacing: -1px; }
.dates { padding-bottom: 18px; border-bottom: 3px solid var(--magenta); font: 12px monospace; }
.bio p { font-size: 15px; line-height: 1.65; }
.bio h3 { margin-top: 26px; font: 700 21px Georgia, 'Times New Roman', serif; }
.bio a { font-size: 12px; text-underline-offset: 4px; }
.close { position: absolute; z-index: 2; top: 8px; right: 8px; width: 36px; height: 36px; padding: 0; background: var(--azul-profundo); color: var(--amarillo); font-size: 25px; }
.close:hover { background: var(--magenta); color: var(--amarillo); }
.navigation { display: flex; justify-content: space-between; gap: 8px; margin-top: 28px; }
.navigation button { font-size: 11px; }
.navigation button:hover { background: var(--azul-profundo); color: var(--amarillo); }
.back { width: 100%; margin-top: 10px; background: var(--magenta); color: var(--amarillo); border-color: var(--magenta); }
.back:hover { background: var(--azul-profundo); color: var(--amarillo); }
#instructions { max-width: 540px; padding: 30px; border-top: 10px solid var(--magenta); }
#instructions h2 { font: 700 32px/1 Georgia, 'Times New Roman', serif; }
#instructions p { font-size: 15px; }
#dismiss { background: var(--azul-profundo); color: var(--amarillo); }
#dismiss:hover { background: var(--magenta); color: var(--amarillo); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 1050px) {
  .intro { grid-template-columns: 1fr 270px; gap: 24px; }
  h1 { font-size: clamp(50px, 8.5vw, 85px); letter-spacing: -2px; }
  .people { gap: 9px; }
  .person { gap: 10px; padding: 17px 12px; font-size: 14px; }
  .person > img:not(.person-skull) { width: 38px; height: 48px; }
  .person .person-skull { width: 23px; height: 28px; }
}

/* En móvil el recorrido sigue completo y las calaveritas conservan tamaño táctil. */
@media (max-width: 700px) {
  header { min-height: 80px; padding: 13px 4%; gap: 12px; border-bottom-width: 5px; }
  .edition { display: none; }
  .brand { font-size: 13px; gap: 8px; }
  .brand em { font-size: 20px; }
  .brand-mark { width: 33px; height: 40px; }
  header button { padding: 10px; font-size: 10px; }
  main { padding: 0 4%; }
  .intro { grid-template-columns: 1fr; gap: 26px; padding: 30px 0 25px; }
  h1 { margin-top: 18px; font-size: clamp(48px, 12vw, 74px); letter-spacing: -2px; }
  .eyebrow { font-size: 9px; letter-spacing: 1px; }
  .intro-note { grid-template-columns: 58px 1fr; gap: 12px 16px; padding: 0; }
  .remembrance-seal { grid-column: 1; grid-row: span 2; }
  .remembrance-seal > span { font-size: 57px; }
  .remembrance-seal small { display: none; }
  .intro-note p { grid-column: 2; font-size: 13px; }
  .intro-note a { grid-column: 2; padding: 11px 12px; font-size: 9px; }
  .intro-note a span { font-size: 20px; }
  .paper { height: 30px; margin-bottom: 18px; }
  .paper span { width: 9px; height: 9px; }
  .scene-caption { gap: 8px; padding: 11px 9px; font-size: 8px; letter-spacing: 0; }
  .section-number { padding-right: 7px; margin-right: 7px; }
  #viewer { height: 52dvh; min-height: 310px; border-width: 5px; border-top: 0; border-bottom-width: 7px; }
  .hint { top: 9px; left: 9px; max-width: calc(100% - 18px); font-size: 9px; }
  .hotspot { width: 48px; height: 54px; padding: 4px; }
  .hotspot > img { width: 35px; height: 41px; }
  .hotspot-label { display: none; }
  .controls { bottom: 12px; padding: 3px; }
  .controls button { padding: 10px 8px; font-size: 10px; }
  .controls output { min-width: 35px; }
  .people-heading { display: block; margin-top: 27px; }
  .people-heading h2 { margin-bottom: 12px; font-size: 28px; }
  .people-heading > span { font-size: 9px; }
  .people { grid-template-columns: 1fr; gap: 10px; margin: 18px 0 30px; }
  .person { gap: 15px; padding: 15px; font-size: 16px; }
  .person > img:not(.person-skull) { width: 43px; height: 53px; }
  .person .person-skull { width: 28px; height: 34px; }
  .person::before { align-self: center; }
  .person small { margin-top: 6px; }
  footer { flex-wrap: wrap; gap: 12px; font-size: 9px; }
  footer span:last-child { width: 100%; }
  #detail[open] { display: block; max-width: 450px; }
  .portrait { justify-content: center; height: 240px; min-height: 0; padding: 16px; }
  .portrait img { width: auto; max-width: 100%; height: 100%; }
  .portrait span { font-size: 39px; }
  .bio { padding: 24px 18px; }
  .bio h2 { font-size: 32px; }
  .bio p { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Los nuevos enlaces usan el diseño de las tarjetas originales. */
.page-link { text-decoration: none; font: 700 16px/1.3 Arial, sans-serif; }
.page-link::before { content: counter(person, decimal-leading-zero); }
@media (max-width: 1050px) { .page-link { font-size: 14px; } }
@media (max-width: 700px) { .page-link { font-size: 16px; } }
