:root {
  color-scheme: light;
  --papel: #fff6f4;
  --tinta: #44121d;
  --vino: #86132a;
  --rojo: #df1939;
  --rosa: #ffdade;
  --marco: #efc9cd;
  --sans: 'Aptos', 'Segoe UI', Arial, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: var(--sans);
  color: var(--tinta);
  background: var(--papel);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
body:has(.portada:not([hidden])) { overflow: hidden; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--tinta); outline-offset: 4px; }
[hidden] { display: none !important; }

.calendario {
  --ancho: 48rem;
  max-width: calc(var(--ancho) + 3rem);
  margin-inline: auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 1.5rem) 1.5rem;
}

.cabecera { text-align: center; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.adorno { display: flex; align-items: center; justify-content: center; gap: .75rem; color: var(--rojo); }
.adorno::before, .adorno::after { content: ''; width: 2rem; height: 1px; background: var(--marco); }
.adorno span { font-size: 1.35rem; line-height: 1; }
.etiqueta { margin: .8rem 0 .5rem; font-size: .875rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: var(--vino); }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.055em; margin: 0; }
h1 { font-size: clamp(2.75rem, 7.3vw, 5.35rem); line-height: 1.08; }
h1:focus { outline: none; }
h1 em, h2 em { color: var(--rojo); font-weight: 400; }
.bajada { font-size: clamp(1rem, 2.5vw, 1.14rem); line-height: 1.55; color: #70414a; margin: .7rem auto 0; }
.tablero-info { display: flex; justify-content: space-between; gap: .65rem; border-top: 1px solid var(--marco); color: #764352; font-size: .875rem; font-weight: 650; }
.tablero-info p { margin: .75rem 0 .8rem; }

.mosaico {
  display: grid;
  grid-template: repeat(6, minmax(0, 1fr)) / repeat(6, minmax(0, 1fr));
  grid-auto-flow: dense;
  aspect-ratio: 1;
  container-type: inline-size;
  gap: clamp(.3rem, 1vw, .55rem);
}

.casilla {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-width: 0;
  isolation: isolate;
  overflow: hidden;
  background: var(--fondo);
  color: var(--texto);
  border: 1px solid var(--borde, transparent);
  border-radius: clamp(.38rem, 1vw, .65rem);
  padding: clamp(.28rem, 1.45cqi, .75rem);
  text-align: start;
  transition: translate .22s ease, filter .22s ease, box-shadow .22s ease;
}
.rojo { --fondo: var(--rojo); --texto: #fff7f7; }
.rosa { --fondo: var(--rosa); --texto: #9a142d; }
.vino { --fondo: var(--vino); --texto: #ffdce1; }
.blanco { --fondo: #fffdfc; --texto: #a3112e; --borde: #efc5c9; }
.numero { position: relative; z-index: 1; font-size: clamp(1rem, 7.1cqi, 3.75rem); font-weight: 900; line-height: .87; letter-spacing: -.09em; }
.marca { position: absolute; top: clamp(.22rem, 1.45cqi, .7rem); right: clamp(.28rem, 1.45cqi, .7rem); font-size: clamp(.7rem, 2.3cqi, 1.15rem); line-height: 1; z-index: 2; }
.hoy { box-shadow: inset 0 0 0 2px var(--texto); }
.navidad .numero { font-size: clamp(1rem, 13.8cqi, 7.5rem); padding: .09em .12em .11em .02em; border-radius: .1em; background: var(--rojo); }
.liston { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 44%, #ffd4dc 44% 56%, transparent 56%), linear-gradient(transparent 44%, #ffd4dc 44% 56%, transparent 56%); }
.liston::before, .liston::after { content: ''; position: absolute; top: 2%; width: 32%; height: 24%; border: clamp(3px, 1.35cqi, 10px) solid #ffd4dc; }
.liston::before { right: 49%; transform: rotate(27deg); border-radius: 52% 61% 37% 62%; }
.liston::after { left: 49%; transform: rotate(-27deg); border-radius: 61% 52% 62% 37%; }
@media (hover: hover) {
  .casilla:hover { translate: 0 -3px; filter: brightness(1.045); box-shadow: 0 5px 14px #7b173520; }
  .casilla.hoy:hover { box-shadow: inset 0 0 0 2px var(--texto), 0 5px 14px #7b173520; }
}
footer { margin-top: 1.8rem; text-align: center; font-size: .875rem; color: #70414a; }
footer span { color: var(--rojo); font-size: 1.15em; margin-right: .2rem; }

.portada {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  overflow: auto;
  padding: clamp(1rem, 4vw, 2rem);
  background: radial-gradient(ellipse at 50% 56%, #fff 6%, #fff5f5 54%, #ffe3e7);
}
.portada-interior { width: min(100%, 37rem); margin: auto; padding-block: .65rem; text-align: center; }
.portada h2 { margin-top: .8rem; font-size: clamp(2.6rem, 9.2vw, 5.7rem); line-height: 1.04; }
.portada .bajada { max-width: 28rem; }
.abrir { display: grid; justify-items: center; margin: .25rem auto 0; padding: 0; border: 0; border-radius: 2rem; color: inherit; background: transparent; }
.escena { position: relative; display: block; width: min(77vw, 19rem); aspect-ratio: 1.06; }
.halo { position: absolute; inset: 10% 8% 5%; border-radius: 50%; background: radial-gradient(circle, #ffbecd, #ffe9ef75 56%, transparent 72%); }
.sombra { position: absolute; left: 17%; right: 17%; bottom: 6%; height: 9%; background: #80122d40; border-radius: 50%; filter: blur(10px); }
.caja, .tapa {
  position: absolute;
  background: linear-gradient(90deg, transparent 42%, #ffd2dd 42%, #f4a8bf 57%, transparent 57%), linear-gradient(110deg, #f63855, #d71638 56%, #ae0d2c);
}
.caja { inset: 43% 19% 9%; border-radius: 0 0 9% 9%; box-shadow: inset 0 -8px 14px #810b252c, inset 0 9px 14px #810b254d; }
.tapa { inset: 38% 15% 46%; z-index: 1; border-radius: .55rem; box-shadow: 0 6px 10px #810b2540, inset 0 2px 0 #ffffff40; transition: transform .27s cubic-bezier(.2,.8,.3,1); }
.lazo { position: absolute; width: 14%; height: 72%; top: -40%; left: 43%; border-radius: 35%; background: linear-gradient(#ffdbe5, #ef99b4); }
.lazo::before, .lazo::after { content: ''; position: absolute; bottom: 44%; width: 228%; aspect-ratio: 1.3; border: clamp(5px, 2.5vw, 11px) solid #f79cb6; }
.lazo::before { right: 59%; transform: rotate(24deg); border-radius: 59% 54% 35% 61%; }
.lazo::after { left: 59%; transform: rotate(-24deg); border-radius: 54% 59% 61% 35%; }
.destello { position: absolute; font-size: clamp(1rem, 4vw, 1.7rem); color: #d22248; line-height: 1; }
.destello-1 { top: 23%; left: 12%; --x: -1.7rem; --y: -2rem; }
.destello-2 { top: 12%; right: 13%; --x: 1.7rem; --y: -2rem; }
.destello-3 { bottom: 23%; right: 4%; --x: 2rem; --y: 1rem; }
.destello-4 { bottom: 16%; left: 5%; --x: -2rem; --y: 1rem; }
.luz { position: absolute; left: 21%; right: 21%; top: 22%; height: 40%; opacity: 0; background: radial-gradient(ellipse, white, #ffe2ae 25%, transparent 69%); }
.boton { display: inline-flex; align-items: center; gap: .65rem; padding: .83rem 1.55rem; border-radius: 2rem; background: var(--vino); color: white; font-weight: 700; box-shadow: 0 .45rem 1.1rem #8b102d25; transition: background .22s ease, scale .22s ease; }
.boton span { font-size: 1.2rem; line-height: 1; }
@media (hover: hover) {
  .abrir:hover .tapa { transform: translateY(-5%) rotate(-2deg); }
  .abrir:hover .boton { background: #a51434; scale: 1.025; }
}
.abriendo { pointer-events: none; animation: salir .36s .62s both; }
.abriendo .tapa { animation: levantar .73s cubic-bezier(.22,.76,.26,1) both; }
.abriendo .caja { animation: caja .6s ease both; }
.abriendo .luz { animation: luz .76s .1s ease both; }
.abriendo .destello { animation: estallar .7s .12s ease-out both; }
@keyframes levantar { 20% { transform: translateY(2%) rotate(3deg); } 65% { opacity: 1; } to { transform: translate(12%, -260%) rotate(20deg); opacity: 0; } }
@keyframes caja { 25% { transform: scale(.95, 1.04); } 60% { transform: scale(1.04, .98); } }
@keyframes luz { 55% { opacity: 1; transform: translateY(-25%) scale(1.5); } 100% { opacity: 0; transform: translateY(-55%) scale(2.3); } }
@keyframes estallar { 30% { opacity: 1; scale: 1.3; } to { opacity: 0; transform: translate(var(--x), var(--y)) rotate(28deg); } }
@keyframes salir { to { opacity: 0; } }

dialog {
  position: fixed;
  width: min(30rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  border: 1px solid var(--marco);
  scroll-padding-top: 2.75rem;
  border-radius: 1.1rem;
  padding: clamp(1.5rem, 6vw, 2.6rem);
  background: #fffafa;
  color: var(--tinta);
  box-shadow: 0 1.25rem 4rem #4a081d35;
  text-align: center;
}
dialog[open] { animation: carta .24s ease-out both; }
dialog::backdrop { background: #3b0d21a6; backdrop-filter: blur(5px); }
dialog h2 { font-size: clamp(2rem, 6.4vw, 3.15rem); line-height: 1.05; }
#detalle-mensaje, #recuerdo-mensaje { line-height: 1.6; margin: 1rem 0; color: #70414a; white-space: pre-line; }
.revelar { border: 0; }
.recuerdo { margin-top: 1.15rem; outline: none; animation: aparecer .35s ease-out both; }
.recuerdo img { display: block; width: min(100%, 39vh, 17.25rem); aspect-ratio: 3 / 4; object-fit: contain; margin-inline: auto; border-radius: .75rem; background: var(--papel); }
@keyframes aparecer { from { opacity: 0; } }
.recuerdo-firma { margin: 1rem 0 .4rem; color: var(--vino); font-weight: 800; }
.detalle-adorno { display: block; margin-top: .5rem; color: var(--rojo); font-size: 1.5rem; }
.cerrar { display: grid; place-items: center; position: absolute; top: .5rem; right: .5rem; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; color: var(--vino); background: transparent; font-size: 1.5rem; }
.cerrar:hover { background: var(--rosa); }
@keyframes carta { from { opacity: 0; translate: 0 .65rem; scale: .96; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
