/* ==========================================================================
   Ventanas del calendario (compartido por calendario, panel y manual)
   Requiere brand.css · Desarrollado por analize
   ========================================================================== */

.face {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  isolation: isolate;
  container-type: size;
  border-radius: inherit;
  background-color: var(--bg);
  color: var(--fg);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.face__pattern { position: absolute; inset: 0; z-index: 0; pointer-events: none; }

/* Número: siempre arriba a la izquierda */
.face__num {
  position: absolute;
  z-index: 3;
  top: 7cqmin;
  left: 9cqmin;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 27cqmin;
  line-height: .9;
  letter-spacing: -.03em;
  font-variant-numeric: lining-nums;
  color: var(--num);
}

/* Ícono: al centro, levemente bajo */
.face__icon {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 57%;
  width: 56cqmin;
  aspect-ratio: 1;
  translate: -50% -50%;
}
.face__icon .ic { display: block; width: 100%; height: 100%; overflow: visible; }

/* Candado: arriba a la derecha */
.face__lock {
  position: absolute;
  z-index: 5;
  top: 7cqmin;
  right: 7cqmin;
  width: max(20px, 13cqmin);
  height: max(20px, 13cqmin);
  border-radius: 50%;
  display: none;
  place-items: center;
  background: var(--blanco);
  color: var(--frambuesa);
  box-shadow: 0 0 0 1px var(--palo), 0 .8cqmin 2cqmin rgba(142, 15, 67, .25);
}
.face__lock svg { width: 56%; height: 56%; }

/* Destellos: dorado, solo como luz */
.face__sparks { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.face__sparks i {
  position: absolute;
  width: calc(6cqmin * var(--s, 1));
  aspect-ratio: 1;
  translate: -50% -50%;
  background: var(--dorado);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: face-twinkle 2.8s ease-in-out var(--d, 0s) infinite;
}

.face__shine {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, 0) 36%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
}

/* Etiqueta de la ventana 24 */
.face__cap {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 6cqmin;
  translate: -50% 0;
  padding: 1.6cqmin 4cqmin;
  border-radius: 99cqmin;
  font-family: var(--font-text);
  font-weight: 800;
  font-size: 4.6cqmin;
  letter-spacing: .2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--frambuesa);
  background: var(--blanco);
}
.face--special .face__icon { top: 52%; width: 62cqmin; }
.face--special .face__shine {
  box-shadow: inset 0 0 0 1.6cqmin var(--blanco), inset 0 0 0 2.2cqmin var(--rosa), inset 0 0 0 2.6cqmin var(--blanco);
}

/* ---------------- Patrones de marca: lunares, rayas, cuadrillé, liso ---------------- */
.pat-lunares .face__pattern {
  background:
    radial-gradient(circle, var(--pa) 22%, transparent 25%) 0 0 / 12cqmin 12cqmin,
    radial-gradient(circle, var(--pa) 22%, transparent 25%) 6cqmin 6cqmin / 12cqmin 12cqmin;
}
.pat-rayas .face__pattern {
  background: repeating-linear-gradient(-45deg, var(--pa) 0 5cqmin, transparent 5cqmin 11cqmin);
}
.pat-cuadrille .face__pattern {
  background:
    linear-gradient(90deg, var(--pa) 50%, transparent 0) 0 0 / 14cqmin 14cqmin,
    linear-gradient(var(--pa) 50%, transparent 0) 0 0 / 14cqmin 14cqmin;
}
.pat-liso .face__pattern { background: none; }

/* ---------------- Colores de los íconos (solo paleta) ---------------- */
.ic { fill: currentColor; }
.ic .s { fill: var(--ac); }
.ic .g { fill: var(--dorado); }
.ic .w { fill: var(--blanco); }
.ic .k { fill: var(--frambuesa); }
.ic .r { fill: var(--rosa); }
.ic .d { fill: rgba(142, 15, 67, .15); }
.ic .mz { fill: rgba(255, 255, 255, .3); }
.ic .bite { fill: var(--bg); }
.ic .wb { fill: var(--blanco); stroke: var(--ac); stroke-width: 1.2; }
.ic .gl { fill: rgba(255, 255, 255, .35); stroke: var(--blanco); stroke-width: 2; }
.ic .glow { fill: rgba(255, 255, 255, .22); }
.ic .st { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ic .sw { fill: none; stroke: var(--blanco); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic .sa { fill: none; stroke: var(--ac); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ic .sk { fill: none; stroke: var(--frambuesa); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic .lv { fill: none; stroke: rgba(255, 255, 255, .65); stroke-width: 1.4; stroke-linecap: round; }
.ic .wire { fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .8; }
.ic .steam { fill: none; stroke: var(--ac); stroke-width: 2.2; stroke-linecap: round; }
.ic .ring { fill: none; stroke: currentColor; stroke-width: 11; }
.ic .ring2 { fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: 11; stroke-dasharray: 2.5 4.5; }
.ic .ring3 { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-dasharray: 2 5; stroke-linecap: round; opacity: .5; }
.ic .cc { fill: none; stroke: currentColor; stroke-width: 9; stroke-linecap: round; }
.ic .cc2 { fill: none; stroke: var(--blanco); stroke-width: 9; stroke-dasharray: 4 6; }
.ic .bulb.b1 { fill: currentColor; }
.ic .bulb.b2 { fill: var(--ac); }
.ic .bulb.b3 { fill: var(--dorado); }
.ic .bulb.b4 { fill: var(--blanco); }

/* Animaciones siempre vivas (suaves) */
.ic .tw { transform-box: fill-box; transform-origin: center; animation: face-twinkle 2.6s ease-in-out infinite; }
.ic .bulb { animation: face-bulb 2.2s ease-in-out infinite; }
.ic .flicker { transform-box: fill-box; transform-origin: 50% 100%; animation: face-flicker 1.4s ease-in-out infinite; }
.ic .steam { animation: face-steam 3s ease-in-out infinite; }

@keyframes face-twinkle {
  0%, 100% { scale: .45; opacity: .25; }
  50% { scale: 1; opacity: 1; }
}
@keyframes face-bulb {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes face-flicker {
  0%, 100% { scale: 1 1; rotate: -2deg; }
  30% { scale: .94 1.06; rotate: 2deg; }
  60% { scale: 1.04 .96; rotate: -1deg; }
}
@keyframes face-steam {
  0%, 100% { opacity: .25; translate: 0 2px; }
  50% { opacity: .95; translate: 0 -2px; }
}

/* ---------------- Ventana abierta ----------------
   La puerta queda como marco (su color y su diseño) con una costura alrededor de la abertura;
   adentro se ve lo que había: la foto, o el ícono del día con el título del regalo.        */
.opened {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  container-type: size;
}
.opened > .face .face__icon, .opened > .face .face__num, .opened > .face .face__lock,
.opened > .face .face__cap, .opened > .face .face__sparks { display: none; }
.opened > .face::after {
  content: '';
  position: absolute;
  z-index: 5;
  inset: 3.4cqmin;
  border: max(1px, .9cqmin) dashed currentColor;
  border-radius: max(8px, 10cqmin);
  opacity: .5;
  pointer-events: none;
}
.opened__win {
  --fg: var(--rosa);
  --ac: var(--frambuesa);
  --bg: var(--blanco);
  position: absolute;
  z-index: 1;
  inset: 8cqmin;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3cqmin;
  padding: 9cqmin 6cqmin 6cqmin;
  overflow: hidden;
  border-radius: max(6px, 7cqmin);
  text-align: center;
  color: var(--rosa);
  background: radial-gradient(circle at 50% 38%, var(--blanco) 42%, var(--palo) 135%);
  box-shadow:
    inset 0 3cqmin 5cqmin -1cqmin rgba(142, 15, 67, .38),
    inset 0 0 0 max(1px, .6cqmin) rgba(142, 15, 67, .14);
}
.opened__icon {
  display: block;
  flex: none;
  width: 42cqmin;
  aspect-ratio: 1;
  transition: scale .5s var(--ease-spring);
}
.opened__win:has(.opened__title) .opened__icon { width: 30cqmin; }
.opened__icon .ic { display: block; width: 100%; height: 100%; overflow: visible; }
.opened__day {
  position: absolute;
  z-index: 2;
  top: 4.5cqmin;
  left: 5.5cqmin;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: max(10px, 12cqmin);
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: lining-nums;
  color: var(--frambuesa);
}
.opened__title {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: max(9.5px, 10cqmin);
  line-height: 1.08;
  letter-spacing: -.01em;
  color: var(--frambuesa);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.opened--photo .opened__win { padding: 0; background: var(--palo); }
.opened__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: scale .7s var(--ease-out);
}
.opened--photo .opened__day {
  top: 4cqmin;
  left: 4cqmin;
  display: grid;
  place-items: center;
  min-width: max(20px, 17cqmin);
  height: max(20px, 17cqmin);
  padding: 0 3cqmin;
  border-radius: 99cqmin;
  font-size: max(10px, 9.5cqmin);
  color: var(--rosa);
  background: var(--blanco);
  box-shadow: 0 1cqmin 3cqmin rgba(142, 15, 67, .35);
}
.opened--photo .opened__title { display: none; }
@container (min-width: 220px) and (min-height: 220px) {
  .opened--photo .opened__title {
    display: -webkit-box;
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16cqmin 7cqmin 6cqmin;
    font-size: 7.5cqmin;
    color: var(--blanco);
    background: linear-gradient(rgba(142, 15, 67, 0), rgba(142, 15, 67, .78));
  }
}

@media (prefers-reduced-motion: reduce) {
  .face__sparks i, .ic .tw, .ic .bulb, .ic .flicker, .ic .steam { animation: none; }
}
