/* Página de revelado · dirección 1a «Sobre lacrado», ronda 2.
   Tokens: nuvola_ui_amigo_invisible.json v0.2 (los mismos que
   app/lib/tema/tokens.dart). Lacre: lacre/<tono>.svg, generado con
   herramientas/lacre.mjs. */

@font-face {
  font-family: "Young Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fuentes/young-serif-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fuentes/figtree-latin.woff2") format("woff2");
}

:root {
  --bg: #f4ede1;
  --surface: #fffbf4;
  --field: #ebe2d2;
  --ink: #1f2a44;
  --muted: #5c5a55;
  --accent: #a63d2a;
  --on-accent: #f4ede1;
  --highlight: #e3b23c;
  --line: #1f2a4424;
  --warn-bg: #f1dcd2;
  --env-back: #d6c5a8;
  --env-front: #e9ddc8;
  --env-flap: #e0d0b4;
  --env-card: #fffbf4;
  --env-liner: #fffbf4;
  --lacre: url("lacre/lacre.svg");
  --serif: "Young Serif", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181c;
    --surface: #232429;
    --field: #232429;
    --ink: #f4ede1;
    --muted: #b7b2a8;
    --accent: #e07a5f;
    --on-accent: #17181c;
    --line: #f4ede124;
    --warn-bg: #3a2622;
    --env-back: #2a2b31;
    --env-front: #34353c;
    --env-flap: #3d3e46;
    --env-card: #f4ede1;
    --env-liner: #2a2b31;
    --lacre: url("lacre/claro.svg");
  }
}

/* Tema de temporada «Noche de invierno». */
body[data-tema="invierno"] {
  --bg: #14213d;
  --surface: #1c2c4e;
  --field: #1c2c4e;
  --ink: #e8eef5;
  --muted: #b4c0d2;
  --accent: #d9b26f;
  --on-accent: #14213d;
  --highlight: #ff6b5b;
  --line: #e8eef529;
  --env-back: #1c2c4e;
  --env-front: #25385f;
  --env-flap: #2c4170;
  --env-card: #e8eef5;
  --env-liner: #1c2c4e;
  --lacre: url("lacre/coral.svg");
}

* { box-sizing: border-box; margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 500 1.0625rem/1.45 var(--sans);
}

main {
  flex: 1;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
}

.estado { display: flex; flex-direction: column; gap: 0.75rem; }
/* Gana a cualquier display de un estado concreto (la escena es block). */
.estado[hidden] { display: none !important; }

.marca {
  font: 600 0.84375rem/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.grupo, .titulo { font: 400 2rem/1.08 var(--serif); }
.contexto { color: var(--muted); }
.nota { font-size: 0.9375rem; font-weight: 400; color: var(--muted); }

.boton {
  min-height: 3.5rem;
  padding: 0.875rem 1.5rem;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1.0625rem/1 var(--sans);
  cursor: pointer;
}
.boton-secundario {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font: 600 1rem/1 var(--sans);
  cursor: pointer;
}
.boton:focus-visible,
.boton-secundario:focus-visible,
a:focus-visible,
.nombre:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 3px;
}
.boton:disabled { cursor: default; }

.fundiendo { animation: fundido 180ms ease-out forwards; }
@keyframes fundido { to { opacity: 0; } }

/* ---------- Resultado (ronda 3, captura 5) ---------- */
.entrando { animation: entra 240ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes entra { from { opacity: 0; transform: translateY(0.5rem); } }

.antetitulo { margin-top: 1.5rem; font-size: 1.0625rem; color: var(--muted); }
.nombre {
  align-self: start;
  font: 400 4.75rem/1.02 var(--serif);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.nombre.medio { font-size: 3.625rem; }
.nombre.largo { font-size: 2.875rem; }
/* La mostaza se queda solo para esta raya. */
.raya {
  width: 56px;
  height: 4px;
  margin: 0.75rem 0 0.25rem;
  border-radius: 2px;
  background: var(--highlight);
}
.grupo-resultado { font-weight: 600; }
.estado .grupo-resultado + .contexto { margin-top: -0.5rem; font-weight: 400; }

.mensaje {
  margin: 0.75rem 0 0;
  padding: 1rem 1.125rem;
  border-radius: 14px;
  background: var(--field);
}
.mensaje blockquote { margin: 0; font: 400 1.125rem/1.35 var(--serif); }
.mensaje figcaption { margin-top: 0.5rem; font-size: 0.875rem; font-weight: 400; color: var(--muted); }

.deseos { margin-top: 1rem; }
.deseos h2 {
  margin: 0 0 0.25rem;
  font: 600 0.8125rem/1.4 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.deseos ol { list-style: none; counter-reset: deseo; padding: 0; margin: 0; }
.deseos li {
  counter-increment: deseo;
  display: flex;
  gap: 0.875rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.deseos li:last-child { border-bottom: 0; }
.deseos li::before {
  content: counter(deseo);
  min-width: 1.25rem;
  font-family: var(--serif);
  color: var(--accent);
}

.acciones { display: grid; gap: 0.75rem; margin-top: 1rem; }
.enlace-boton {
  min-height: 2.75rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 0.875rem/1 var(--sans);
  text-decoration: underline;
  cursor: pointer;
}
.enlace-boton:focus-visible { outline: 3px solid var(--highlight); outline-offset: 3px; }

.lacre-vacio {
  width: 4.5rem;
  height: 4.5rem;
  margin: 1.5rem 0 0.5rem;
  border: 3px dashed var(--accent);
  border-radius: 50%;
}

/* ---------- Pie: al final y en voz baja ---------- */
.pie {
  padding: 2rem 1.25rem 2.5rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  display: grid;
  gap: 0.375rem;
}
.pie a { color: inherit; }

a.boton { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.solo-lector {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
  .fundiendo { animation: fundido 180ms ease-out forwards !important; }
}

/* ---------- Escena del revelado (ronda 4) ----------
   Mismas capas, medidas y coreografía que la app (EscenaRevelado). Las
   posiciones y transformaciones las pone revelado.js en cada fotograma. */
.estado.escena {
  position: relative;
  display: block;
  height: max(600px, 100svh);
  margin: -2rem -1.5rem 0;
  overflow: hidden;
  background: var(--e-bg);
  color: var(--e-ink);
}
.escena-grano {
  position: absolute;
  inset: 0;
  background: url("sobre/papel-grano.webp") 0 0 / 192px 192px repeat;
  opacity: var(--e-grano);
  pointer-events: none;
}
.escena-halo { position: absolute; inset: 0; pointer-events: none; }
body[data-tema="noche"] .escena-halo {
  background: radial-gradient(60% 40% at 50% 46%, rgba(217, 178, 111, 0.16), rgba(217, 178, 111, 0));
}
.escena-nieve { position: absolute; inset: 0; pointer-events: none; }
.escena-nieve span {
  position: absolute;
  border-radius: 50%;
  background: #e8eef5;
  animation: nieve-cae linear infinite;
}
@keyframes nieve-cae { from { transform: translateY(-110svh); } to { transform: translateY(10svh); } }

.escena-cabecera {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  padding: 0 24px;
}
.escena-marca {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}
.escena-cabecera .marca { margin-top: 10px; color: var(--e-muted); }
.escena-cabecera .grupo { margin-top: 4px; font-size: 34px; }
.escena-cabecera .contexto { margin-top: 6px; font-size: 16px; color: var(--e-muted); }

.sobre4 { position: absolute; inset: 0; cursor: pointer; }
.sobre4 .capa { position: absolute; display: block; }
.sobre4 img.capa, .solapa4 img, .lacre4 img, .trozo4 img { width: 100%; height: 100%; display: block; }
.sobre4 [data-capa="sombra"], .sobre4 [data-capa="fondo"] { z-index: 0; }
.sobre4 [data-capa="bolsillo"] { z-index: 4; }
.sobre4 [data-capa="sombraSolapa"] { z-index: 5; }
.sobre4 [data-capa="lacre"] { z-index: 7; }
.sobre4 .trozo4 { z-index: 8; pointer-events: none; }
.solapa4-giro { position: absolute; inset: 0; transform-origin: 50% 0; }
.solapa4-giro img { position: absolute; inset: 0; }
.lacre4-presion { position: absolute; inset: 0; }
.lacre4-presion img { position: absolute; inset: 0; }
.trozo4 img { position: absolute; inset: 0; opacity: 0; }
.grietas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
}

.tarjeta4 {
  position: absolute;
  border-radius: 8px;
  background: var(--e-card);
  color: var(--e-card-ink);
  overflow: hidden;
}
.tarjeta4.terminada { overflow-y: auto; scrollbar-width: none; }
.tarjeta4-grano {
  position: absolute;
  inset: 0;
  background: url("sobre/papel-grano.webp") 0 0 / 192px 192px repeat;
  opacity: 0.35;
  pointer-events: none;
}
.tarjeta4-cuerpo { position: relative; }
.tarjeta4-cabeza { padding-right: 58px; }
.tarjeta4-etiqueta { color: var(--e-card-muted); font-weight: 500; }
.tarjeta4-nombre { display: inline-flex; flex-direction: column; max-width: 100%; margin-top: 6px; }
.tarjeta4 .nombre {
  font: 400 32px/1.04 var(--serif);
  color: var(--e-card-ink);
  overflow-wrap: anywhere;
  outline: none;
  white-space: pre-wrap;
}
.tarjeta4 .raya {
  width: 0;
  height: 4px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--e-hl);
}
.tarjeta4-contenido { margin-top: 18px; opacity: 0; }
.tarjeta4 .grupo-resultado { font-size: 16px; font-weight: 600; }
.tarjeta4 .meta-resultado { font-size: 15px; color: var(--e-card-muted); margin-top: 3px; }
.tarjeta4 .mensaje {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--e-msg);
}
.tarjeta4 .mensaje blockquote { margin: 0; font: 400 17px/1.35 var(--serif); }
.tarjeta4 .mensaje figcaption { margin-top: 6px; font-size: 13.5px; color: var(--e-card-muted); }
.tarjeta4 .deseos { margin-top: 20px; }
.tarjeta4 .deseos h3 {
  margin: 0 0 4px;
  font: 700 12.5px/1.4 var(--sans);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--e-card-muted);
}
.tarjeta4 .deseos li { border-bottom-color: var(--e-card-line); font-size: 16.5px; }
.tarjeta4 .deseos li::before { color: var(--e-card-accent); }
.tarjeta4 .nota { color: var(--e-card-muted); }
.estampa4 { position: absolute; width: 56px; height: 56px; opacity: 0; }
.estampa4 img { width: 56px; height: 56px; display: block; }
.rayos {
  position: absolute;
  left: -32px;
  top: -32px;
  width: 120px;
  height: 120px;
  overflow: visible;
  stroke: var(--e-hl);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.escena-cerrado {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  display: grid;
  gap: 12px;
}
.escena-cerrado .saludo { font-size: 18px; line-height: 1.4; }
.escena .boton {
  height: 56px;
  border-radius: 14px;
  background: var(--e-accent);
  color: var(--e-accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.escena .nota { text-align: center; font-size: 14px; color: var(--e-muted); }
.escena-saltar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  z-index: 10;
  text-align: center;
  font-size: 14px;
  color: var(--e-muted);
  opacity: 0;
  pointer-events: none;
}
.escena-final {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 10;
  display: grid;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
}
.escena .boton-secundario {
  height: 48px;
  border: 1.5px solid var(--e-line2);
  color: var(--e-ink);
}
.escena.fundiendo { animation: fundido 180ms ease-out forwards; }

body:has(.estado.escena:not([hidden])) { background: var(--e-bg); color: var(--e-ink); }
body:has(.estado.escena:not([hidden])) .pie { color: var(--e-muted); }

@media (prefers-reduced-motion: reduce) {
  .escena-nieve span { animation: none; }
}
