/* Talavera: azulejo poblano en SVG. Los azulejos toman el color de la paleta; el ocre es fijo.
   Al abrir, la pared de la portada se voltea azulejo por azulejo y el encabezado se arma: franjas, marco y una flor que abre. */
:root {
  --letra-titulo: "Marcellus", Georgia, serif;
  --letra-firma: "Playfair Display", Georgia, serif;
  --suave: #4E5873;
  --linea: #D6DCE8;
  --sombra: rgba(28, 40, 72, .1);
  --apertura: 3000ms;
  --curva: cubic-bezier(.2, .7, .2, 1);
  --flor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%280 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%2845 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%2890 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%28135 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%28180 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%28225 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%28270 32 32%29'/%3E%3Cellipse cx='32' cy='17' rx='5.2' ry='10' transform='rotate%28315 32 32%29'/%3E%3Ccircle cx='32' cy='32' r='6'/%3E%3C/svg%3E");
}

.defs { position: absolute; color: var(--acento); }
.franja { display: block; width: 100%; height: 96px; color: var(--acento); }
.orla { display: block; width: 100%; height: 22px; color: var(--acento); }
.medallon { display: block; width: 76px; height: 76px; margin: 0 auto 1rem; color: var(--acento); overflow: visible; }

/* ---------- Portada: una pared de azulejo con la tarjeta al centro ---------- */
#portada { padding: 24px 16px; }
#muro { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols), var(--s)); grid-auto-rows: var(--s); justify-content: center; align-content: center; overflow: hidden; color: var(--acento); }
#muro i, .fila-az i { display: block; }
#muro svg, .fila-az svg { display: block; width: 100%; height: 100%; }
#portada .tarjeta { position: relative; z-index: 1; width: min(calc(100% - 24px), 22rem); padding: 2rem 1.4rem 2.2rem; border: 2px solid var(--acento); outline: 1px solid var(--acento); outline-offset: -8px; text-align: center; background: #FFFFFF; box-shadow: 0 0 0 10px #FFFFFF, 0 24px 60px rgba(28, 40, 72, .35); }
#portada .para { font-family: var(--letra-titulo); font-size: 1rem; letter-spacing: .12em; color: var(--suave); overflow-wrap: anywhere; }
#portada .para span { display: block; margin-top: .3rem; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.45rem; font-weight: 600; letter-spacing: 0; color: var(--tinta); }
#portada .nombre { margin-top: 1rem; font-family: var(--nombres-letra, var(--letra-firma)); font-style: var(--nombres-estilo, italic); font-size: calc(2.4rem / var(--nombres-ancho, 1)); line-height: 1.15; color: var(--acento); overflow-wrap: anywhere; font-weight: var(--nombres-peso, 400); text-transform: var(--nombres-mayus, none); letter-spacing: var(--nombres-espacio, normal); }
#portada .nombre b { font-weight: 400; font-size: .7em; color: var(--tinta); }
#portada .fecha { margin-top: .8rem; font-size: 1.15rem; color: var(--suave); }
#abrir { margin-top: 1.8rem; padding: 0 1.8rem; border: 0; background: var(--acento); color: #FFFFFF; font-family: var(--letra-titulo); font-size: .95rem; letter-spacing: .14em; }
#abrir:hover, #abrir:focus-visible { background: var(--tinta); outline: none; }

/* ---------- Encabezado ---------- */
#encabezado { justify-content: space-between; padding: 0; }
.banda { position: relative; width: 100%; overflow: hidden; color: var(--acento); }
.fila-az { display: flex; margin: 0 calc(var(--s) * -1); translate: calc(var(--sube) * -48px) 0; }
.banda.abajo .fila-az { translate: calc(var(--sube) * 48px) 0; }
.fila-az i { flex: none; width: var(--s); height: var(--s); }
.banda.abajo .orla { transform: scaleY(-1); }
.banda::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .5) 50%, transparent 62%) -100% 0 / 300% 100% no-repeat; }
.abierto .banda::after { animation: vidriado 8s ease-in-out 1s infinite; }
@keyframes vidriado { 0% { background-position: 150% 0; } 40%, 100% { background-position: -50% 0; } }
#encabezado .marco { width: min(calc(100% - 32px), 24rem); margin: 32px auto; padding: 2.4rem 1.4rem; border: 2px solid var(--acento); outline: 1px solid var(--acento); outline-offset: -8px; }
.marco .trazo rect:first-child { stroke-width: 2; }
.marco .trazo rect + rect { stroke-width: 1; }
#encabezado .medallon { rotate: calc(var(--sube) * 160deg); }
.medallon .petalos ellipse { transform-origin: 32px 32px; transform: rotate(var(--a)); }
.medallon .centro { transform-origin: 32px 32px; }
.abierto #encabezado .medallon { animation: rueda 60s linear infinite; }
@keyframes rueda { to { transform: rotate(360deg); } }
#encabezado .frase { font-family: var(--letra-titulo); font-size: 1rem; letter-spacing: .3em; text-transform: uppercase; color: var(--suave); }
#encabezado .nombres { margin: .8rem 0 1rem; font-family: var(--nombres-letra, var(--letra-firma)); font-style: var(--nombres-estilo, italic); font-weight: var(--nombres-peso, 400); font-size: calc(min(3.8rem, var(--ancho) * 1.25 / (var(--letras) * var(--nombres-ancho, 1)))); line-height: 1.1; color: var(--acento); text-transform: var(--nombres-mayus, none); letter-spacing: var(--nombres-espacio, normal); }
#encabezado .nombres b { display: block; font-weight: 400; font-size: .55em; color: var(--tinta); }
#encabezado .fecha { font-size: 1.2rem; color: var(--tinta); }

/* ---------- Movimiento: solo con `.animar` ---------- */
@keyframes entra { from { opacity: 0; transform: translateY(14px); } }
@keyframes llega { from { opacity: 0; transform: perspective(320px) rotateY(-90deg); } }
@keyframes se-va { to { opacity: 0; transform: perspective(320px) rotateY(90deg) scale(.92); } }
@keyframes tarjeta-sale { to { opacity: 0; transform: scale(.9); } }
@keyframes orla { from { clip-path: inset(0 50% 0 50%); } }
@keyframes trazo { from { stroke-dashoffset: var(--p); } }
@keyframes petalo { from { transform: rotate(var(--a)) scale(0); } }
@keyframes aparece { from { opacity: 0; } }
@keyframes centro { from { transform: scale(0); } }
@keyframes aro { from { stroke-dashoffset: 1; } }
@keyframes pincel { from { opacity: 0; clip-path: inset(-20% 100% -20% -10%); } to { opacity: 1; clip-path: inset(-20% -10% -20% -10%); } }
@keyframes espacia { from { opacity: 0; letter-spacing: .7em; } }

.animar #muro i { animation: llega .6s var(--curva) both; animation-delay: calc(var(--d) * .9s); }
.animar #portada .tarjeta { animation: aparece .7s ease .15s backwards; }
.animar #portada.saliendo { opacity: 1; background: transparent; transition: background .2s; }
.animar #portada.saliendo .tarjeta { animation: tarjeta-sale .45s ease-in both; }
.animar #portada.saliendo #muro i { animation: se-va .5s cubic-bezier(.5, 0, .75, 0) both; animation-delay: calc(.2s + var(--d) * .8s); }

.animar .abriendo .fila-az i { animation: llega .7s cubic-bezier(.2, .8, .3, 1.15) both; animation-delay: calc(.9s + var(--k) * .07s); }
.animar .abriendo .orla { animation: orla 1s var(--curva) 1.25s both; }
.animar .abriendo .marco .trazo rect { stroke-dasharray: var(--p) var(--p); animation: trazo 1.5s cubic-bezier(.6, 0, .2, 1) 1s both; }
.animar .abriendo .marco .trazo rect + rect { animation-delay: 1.2s; }
.animar .abriendo .medallon .petalos ellipse { animation: petalo .6s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(1.35s + var(--k) * .07s); }
.animar .abriendo .medallon .vetas { animation: aparece .4s ease 2s both; }
.animar .abriendo .medallon .centro { animation: centro .5s cubic-bezier(.3, 1.8, .5, 1) 1.25s both; }
.animar .abriendo .medallon .aro { stroke-dasharray: 1; animation: aro 1s ease 1.5s both; }
.animar .abriendo #encabezado .frase { animation: espacia 1s var(--curva) 1.6s both; }
.animar .abriendo #encabezado .nombres { animation: pincel 1.2s var(--curva) 1.75s both; }
.animar .abriendo #encabezado .fecha { animation: entra .7s var(--curva) 2.2s both; }

/* ---------- Contenido: entre secciones, un azulejo que gira al aparecer ---------- */
h2 { letter-spacing: .16em; text-transform: uppercase; font-size: 1.05rem; }
.seccion + .seccion { border-top: 0; }
.seccion + .seccion::after { content: ""; position: absolute; left: 12%; right: 12%; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--linea) 25%, var(--linea) 43%, transparent 43% 57%, var(--linea) 57%, var(--linea) 75%, transparent); }
.seccion + .seccion::before { content: ""; position: absolute; z-index: 1; left: 50%; top: -17px; width: 34px; height: 34px; margin-left: -17px; background: var(--acento); -webkit-mask: var(--flor) center / contain no-repeat; mask: var(--flor) center / contain no-repeat; }
.animar .seccion + .seccion::before { transform: rotate(-180deg) scale(0); transition: transform 1.1s cubic-bezier(.3, 1.4, .5, 1); }
.animar .seccion:has(.visto)::before { transform: none; }
.firma { font-style: italic; font-size: 2.1rem; color: var(--acento); }
.pase { border: 2px solid var(--acento); outline: 1px solid var(--acento); outline-offset: -7px; }
.pase .num { font-family: var(--letra-firma); font-style: italic; }
.cuenta div { border-color: var(--acento); }
.franja.pie { height: 64px; }

@media (prefers-reduced-motion: reduce) {
  #encabezado .medallon, .fila-az { rotate: none; translate: none; }
  .abierto #encabezado .medallon, .abierto .banda::after { animation: none; }
}
