/* POSTIGOS · ver postigos.js. La marca viste:
   --postigo-madera (color de las hojas) · --postigo-dorso (cara de atrás) · --postigo-linea (marco y tablillas)
   --postigo-abre (ángulo abierto, por defecto 116deg; en celular 100deg) · --postigo-acerca (escala final, 1.12)
   --postigo-ancho / --postigo-alto (tamaño de la ventana) · --postigo-luz (sombra adentro con la ventana cerrada). */
@property --pq { syntax: '<number>'; inherits: true; initial-value: 0; }
.postigos { --pa: 0; --pz: 0; --pk: 0; --pq: 0; }
.postigos .fija__stage { display: grid; place-items: center; overflow: hidden; isolation: isolate; }
.postigos__ventana { position: relative; width: var(--postigo-ancho, min(78vw, 560px));
  height: var(--postigo-alto, min(64svh, 640px)); perspective: 1400px;
  transform: scale(calc(1 + (var(--postigo-acerca, 1.12) - 1) * var(--pz))); will-change: transform; }
.postigos__adentro { position: absolute; inset: 0; overflow: hidden; }
/* la luz de adentro: oscura con los postigos cerrados */
.postigos__adentro::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: var(--postigo-luz, #0b1630); opacity: calc((1 - var(--pa)) * .55); }

.postigos__hoja { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 6; pointer-events: none;
  transform-style: preserve-3d; will-change: transform; }
.postigos__hoja--izq { left: 0; transform-origin: 0 50%;
  transform: rotateY(calc(var(--postigo-abre, 116deg) * -1 * var(--pa) - 7deg * var(--pq) * (1 - var(--pa)))); }
.postigos__hoja--der { right: 0; transform-origin: 100% 50%;
  transform: rotateY(calc(var(--postigo-abre, 116deg) * var(--pa) + 9deg * var(--pq) * (1 - var(--pa)))); }
.postigos.postigos--lista { animation: postigos-asoma 1.2s .45s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes postigos-asoma { from { --pq: 0; } to { --pq: 1; } }

/* cada hoja: marco + tablillas (persiana) dibujadas con la línea de la marca */
.postigos__cara { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: var(--postigo-borde, 3px) solid var(--postigo-linea, #f6efe3);
  background:
    repeating-linear-gradient(180deg, transparent 0 calc(var(--postigo-tablilla, 22px) - 3px),
      color-mix(in srgb, var(--postigo-linea, #f6efe3) 70%, transparent) calc(var(--postigo-tablilla, 22px) - 3px) calc(var(--postigo-tablilla, 22px) - 1px),
      rgb(0 0 0 / .18) calc(var(--postigo-tablilla, 22px) - 1px) var(--postigo-tablilla, 22px))
      content-box,
    var(--postigo-madera, #3a64ad);
  padding: 9% 12%; box-shadow: inset 0 0 0 calc(var(--postigo-borde, 3px) * 2) var(--postigo-madera, #3a64ad); }
.postigos__cara::after { content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: var(--postigo-borde, 3px);
  background: var(--postigo-linea, #f6efe3); } /* el travesaño del medio */
.postigos__cara--dorso { transform: rotateY(180deg); background-color: var(--postigo-dorso, #2c4f8c);
  filter: brightness(.9); }
/* sombra que el postigo tira sobre la pared al abrirse */
.postigos__hoja--izq .postigos__cara:not(.postigos__cara--dorso) { box-shadow: inset 0 0 0 calc(var(--postigo-borde, 3px) * 2) var(--postigo-madera, #3a64ad), inset -10px 0 18px rgb(0 0 0 / .18); }
.postigos__hoja--der .postigos__cara:not(.postigos__cara--dorso) { box-shadow: inset 0 0 0 calc(var(--postigo-borde, 3px) * 2) var(--postigo-madera, #3a64ad), inset 10px 0 18px rgb(0 0 0 / .18); }

/* el cartel colgado del postigo derecho (lo escribe `horario`) */
.postigos__cartel { position: absolute; z-index: 2; left: 50%; top: 30%; translate: -60% 0; rotate: -4deg;
  transform: translateZ(1px); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transform-origin: 50% -1.4rem; animation: postigos-hamaca 4s ease-in-out infinite alternate; }
.postigos__cartel::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 2.2rem; height: 1.3rem;
  translate: -50% 0; border: 2px solid currentColor; border-bottom: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: transparent; }
.postigos__cartel:not(:has([data-estado]:not(:empty))) { display: none; } /* sin estado (horario pendiente), no hay cartel */
@keyframes postigos-hamaca { from { rotate: -5deg; } to { rotate: 3deg; } }

.postigos__despues { position: absolute; z-index: 8; opacity: var(--pk); pointer-events: none;
  transform: translateY(calc((1 - var(--pk)) * 3svh)); }
.postigos.is-despues .postigos__despues, .postigos__despues:focus-within { pointer-events: auto; }

@media (max-width: 760px) { .postigos { --postigo-abre: 100deg; } }

html:not(.mov) .postigos__hoja { display: none; }
html:not(.mov) .postigos .fija__stage { display: flex; flex-direction: column; align-items: center; gap: 2rem;
  padding-block: 6svh; }
html:not(.mov) .postigos__ventana { transform: none; }
html:not(.mov) .postigos__adentro::after { opacity: 0; }
html:not(.mov) .postigos__despues { position: relative; opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .postigos__cartel { animation: none; } }
