/* ── Gabinete — aged paper & yellow pencil ─────────────────────────── */

:root {
  --paper: #f5edd8;
  --paper-deep: #efe3c4;
  --ink: #6b5416;
  --ink-soft: #8a6d1f;
  --ochre: #c9a227;
  --amber: #a67c00;
  --gold-pale: #d4b34a;
  --shadow: rgba(107, 84, 22, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  min-height: 100%;
  font-family: "Piazzolla", Georgia, "Palatino Linotype", serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(212, 179, 74, 0.10), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(166, 124, 0, 0.08), transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.33 0 0 0 0 0.09 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1.5rem 3rem;
  line-height: 1.65;
}

main {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

/* ── Primavera — paleta Holbein pastel, despierta al resolver "amarillo" ── */

body.primavera {
  --paper: #f3ede2;
  --paper-deep: #e9e1d3;
  --ink: #413b47;
  --ink-soft: #6f6675;
  --ochre: #8f4a52;
  --amber: #7a3c45;
  --gold-pale: #6f8a7c;
  --shadow: rgba(65, 59, 71, 0.16);
  --rosa: #b8848b;
  --verdigris: #6f8a7c;
  --indigo: #55688a;
  --ceniza: #85788f;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 18% 8%, rgba(184, 132, 139, 0.10), transparent 58%),
    radial-gradient(ellipse at 88% 88%, rgba(111, 138, 124, 0.10), transparent 52%),
    radial-gradient(ellipse at 55% 45%, rgba(85, 104, 138, 0.06), transparent 48%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.26 0 0 0 0 0.23 0 0 0 0 0.28 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* el florecer: transiciones suaves solo durante el cambio de estación */
body.florece,
body.florece * {
  transition: color 1.6s ease, background-color 1.6s ease,
    border-color 1.6s ease, box-shadow 1.6s ease;
}

/* ── El lápiz escribe: se levanta, cruza la página, traza y se queda quieto ── */

body.escribiendo .deco-pencil {
  z-index: 6;
  opacity: 1;
  animation: escribir 2.6s ease-in-out forwards;
}

@keyframes escribir {
  0%   { transform: rotate(-9deg)  translate(0, 0); }
  22%  { transform: rotate(28deg)  translate(34vw, 4vh); }
  34%  { transform: rotate(22deg)  translate(37vw, 7vh); }
  44%  { transform: rotate(30deg)  translate(40vw, 5vh); }
  54%  { transform: rotate(24deg)  translate(43vw, 8vh); }
  64%  { transform: rotate(31deg)  translate(46vw, 6vh); }
  72%  { transform: rotate(26deg)  translate(48vw, 7vh); }
  100% { transform: rotate(26deg)  translate(48vw, 7vh); }
}

body.escribiendo .gate button { opacity: 0.4; pointer-events: none; }

/* ── Typography ── */

h1 {
  font-family: "Piazzolla", Georgia, serif;
  font-weight: 400;
  font-variant-caps: small-caps;
  font-size: clamp(1.7rem, 5.2vw, 2.6rem);
  letter-spacing: 0.14em;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.epigraph {
  font-family: "Piazzolla", Georgia, serif;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 1.2rem auto 0;
  max-width: 46ch;
}

.attrib {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.emblem {
  display: block;
  width: min(340px, 78%);
  margin: 2.4rem auto;
  filter: drop-shadow(0 3px 10px var(--shadow));
}

/* ── Marginalia esparcida — la orilla del caleidoscopio ── */

.deco {
  position: fixed;
  z-index: -1;
  user-select: none;
  pointer-events: none;
}

.deco-gem      { top: 7%;    right: 7%;  width: clamp(56px, 8vw, 110px);  transform: rotate(12deg);  opacity: 0.9; }
.deco-pencil   { top: 26%;   left: 4.5%; width: clamp(34px, 5vw, 68px);   transform: rotate(-9deg);  opacity: 0.9; }
.deco-nietzsche{ bottom: 6%; left: 6%;   width: clamp(80px, 11vw, 150px); transform: rotate(-3deg);  opacity: 0.85; }

.deco-sunflower,
.deco-satellite {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  filter: sepia(0.45) saturate(0.8) drop-shadow(1px 2px 2px var(--shadow));
  opacity: 0.9;
}

.deco-sunflower { top: 11%;    left: 11%;  transform: rotate(-14deg); }
.deco-satellite { bottom: 13%; right: 8.5%; transform: rotate(18deg); }

@media (max-width: 720px) {
  .deco { opacity: 0.5; }
  .deco-nietzsche { width: 64px; }
  .deco-pencil { top: 12%; }
}

.ornament {
  display: block;
  width: min(320px, 70%);
  margin: 2.2rem auto;
  opacity: 0.85;
}

/* ── Riddle gate ── */

.riddle {
  font-family: "Piazzolla", Georgia, serif;
  font-style: italic;
  font-size: clamp(1.1rem, 3.4vw, 1.3rem);
  white-space: pre-line;
  color: var(--ink);
  margin: 1rem auto 2.4rem;
}

form.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.gate input {
  font-family: inherit;
  font-size: 1.15rem;
  font-style: italic;
  text-align: center;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--ochre);
  padding: 0.45rem 0.8rem;
  width: min(20rem, 80vw);
  outline: none;
  transition: border-color 0.3s ease;
}

.gate input::placeholder { color: var(--ink-soft); opacity: 0.55; }
.gate input:focus { border-bottom-color: var(--amber); }

.gate button {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  color: var(--paper);
  background: var(--ink-soft);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0.5rem 1.8rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.gate button:hover {
  background: var(--amber);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--shadow);
}

.gate button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }

.gate-reply {
  min-height: 1.6rem;
  font-style: italic;
  color: var(--amber);
  font-size: 1rem;
  transition: opacity 0.4s ease;
}

.gate-reply.shake { animation: quill 0.4s ease; }

@keyframes quill {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

body.unlocked { animation: sunwash 1.4s ease forwards; }

@keyframes sunwash {
  to { background-color: #f8efcf; }
}

/* ── Artifact (lámina) pages ── */

.plate-number {
  font-family: "Piazzolla", Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}

figure.plate {
  margin: 2.2rem auto;
  max-width: 560px;
}

figure.plate img,
figure.plate svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--gold-pale);
  box-shadow: 0 4px 24px var(--shadow), inset 0 0 40px rgba(212, 179, 74, 0.12);
  background: var(--paper-deep);
}

figcaption {
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin-top: 1.4rem;
  text-align: justify;
  text-align-last: center;
  hyphens: auto;
}

/* Hidden message — invisible until she selects the text or lingers on it */
.oculto {
  display: block;
  margin: 2.6rem auto 0;
  font-style: italic;
  font-size: 1.05rem;
  color: transparent;
  cursor: default;
  transition: color 2.5s ease;
  user-select: text;
}

.oculto::selection { color: var(--paper); background: var(--amber); }
.oculto:hover { color: var(--ochre); transition-delay: 1.2s; }

/* ── Las cartas ── */

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.cartas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 3.2rem 2.4rem;
  margin: 3rem 0 2rem;
}

button.carta {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.45s ease, opacity 0.45s ease;
}

button.carta svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(1px 2px 3px var(--shadow));
}

/* Las selladas duermen: descoloridas, apenas presentes. */
button.carta.sellada {
  opacity: 0.62;
  filter: saturate(0.6);
}

button.carta.sellada:hover { opacity: 0.78; }

/* La que espera respuesta conserva todo su color. */
button.carta.abierta:hover {
  transform: rotate(var(--tilt, 0deg)) translateY(-4px);
}

.rotulo {
  font-family: "Piazzolla", Georgia, serif;
  font-size: 0.74rem;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

button.carta.abierta .rotulo { color: var(--ochre); }

button.carta.shake { animation: quill 0.4s ease; }

.cartas-reply {
  min-height: 1.5rem;
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
}

.gate-panel { margin-top: 2rem; }
.gate-panel .pista {
  font-family: "Piazzolla", Georgia, serif;
  font-style: italic;
  margin-bottom: 1.2rem;
  color: var(--ink);
}
.gate-panel[hidden] { display: none; }

/* ── La carta: prosa ── */

.carta-texto {
  max-width: 34em;
  margin: 3rem auto 0;
  text-align: left;
  font-size: 1.09rem;
  line-height: 1.85;
  color: var(--ink);
}

.carta-texto p { margin-bottom: 1.35rem; }
.carta-texto p:first-child { font-style: italic; }
.carta-texto .ornament { margin: 2.6rem auto; width: min(260px, 60%); }

/* ── La canción ── */

.cancion {
  margin: 3.4rem auto 1rem;
  max-width: 660px;
  filter: saturate(0.85);
}

.cancion iframe { display: block; margin: 0 auto; border-radius: 3px; }

/* ── El álbum ── */

.album-titulo { margin-top: 3.6rem; }

.album {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 2.4rem 1.9rem;
  margin: 2rem 0 1rem;
}

figure.foto {
  position: relative;
  margin: 0;
  padding: 9px 9px 30px;
  background: #fbf7f0;
  border: 1px solid rgba(65, 59, 71, 0.10);
  box-shadow: 0 3px 10px var(--shadow);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  cursor: zoom-in;
}

figure.foto:hover {
  transform: rotate(var(--tilt, 0deg)) translateY(-4px) scale(1.015);
  box-shadow: 0 8px 20px var(--shadow);
}

figure.foto img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--paper-deep);
}

figure.foto figcaption {
  position: absolute;
  bottom: 7px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: "Piazzolla", Georgia, serif;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* una tira de cinta translúcida en algunas */
figure.foto.cinta::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 74px;
  height: 22px;
  transform: translateX(-50%) rotate(-2.5deg);
  background: rgba(214, 222, 214, 0.42);
  border-left: 1px solid rgba(255, 255, 255, 0.5);
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 2px rgba(65, 59, 71, 0.12);
}

/* ── El cierre y el vídeo ── */

.bienvenida {
  margin: 3.8rem auto 1.6rem;
  max-width: 30em;
  font-family: "Piazzolla", Georgia, serif;
  font-style: italic;
  font-size: 1.16rem;
  line-height: 1.7;
  color: var(--ink);
}

.video {
  margin: 0 auto 1rem;
  max-width: 660px;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(65, 59, 71, 0.14);
  box-shadow: 0 4px 16px var(--shadow);
  background: #14171d;
}

.video iframe { width: 100%; height: 100%; display: block; border: 0; }

/* ── Lente de aumento ── */

.lente {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 32, 40, 0.93);
  cursor: zoom-out;
  opacity: 0;
  animation: abrir 0.28s ease forwards;
}

@keyframes abrir { to { opacity: 1; } }

.lente img {
  max-width: 92vw;
  max-height: 86vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #1c2028;
}

.lente .paso {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.62);
  font-family: "Piazzolla", Georgia, serif;
  font-size: 2.6rem;
  padding: 0.4rem 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.lente .paso:hover { color: #fff; }
.lente .ant { left: 0.4rem; }
.lente .sig { right: 0.4rem; }

.lente .cuenta {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: "Piazzolla", Georgia, serif;
  font-size: 0.76rem;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.55);
}

/* ── Footer ── */

footer {
  margin-top: auto;
  padding-top: 3.5rem;
  font-family: "Piazzolla", Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
  opacity: 0.75;
  text-align: center;
}

a.volver {
  display: inline-block;
  margin-top: 2rem;
  color: var(--ink-soft);
  font-style: italic;
  text-decoration: none;
  border-bottom: 1px dotted var(--ochre);
}

a.volver:hover { color: var(--amber); }
