/* PhotoEvent · Mis 24 años de Linda Valeria · estilo álbum vaquero */
:root {
  --crema: #F8EFE4;
  --papel: #FFF9F1;
  --rosa: #E8A5A8;
  --rosa-suave: #F6CFCB;
  --rosa-fuerte: #A84F5F;
  --cafe: #3B1F14;
  --cuero: #8A5436;
  --arena: #E9D3B6;
  --titulo: "Caveat Brush", "Segoe Print", cursive;
  --texto: "Patrick Hand", "Segoe Print", cursive;
  --sombra: 0 10px 24px -12px rgba(59, 31, 20, .45);
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--texto); font-size: 19px; line-height: 1.35; color: var(--cafe);
  background-color: var(--crema);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .28 0 0 0 0 .15 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--titulo); font-weight: 400; line-height: 1; text-wrap: balance; }
h2 { font-size: 38px; }
h3 { font-size: 27px; }
a { color: inherit; }
:focus-visible { outline: 3px dashed var(--rosa-fuerte); outline-offset: 3px; }

.contenedor { width: min(100% - 32px, 560px); margin-inline: auto; }
.contenedor.ancho { width: min(100% - 32px, 1180px); }
.centro { text-align: center; }
.suave { opacity: .78; font-size: 17px; }

/* Parches de mantel */
.gingham {
  background-color: #FBEDE6;
  background-image:
    repeating-linear-gradient(0deg, rgba(214, 120, 128, .24) 0 14px, transparent 14px 28px),
    repeating-linear-gradient(90deg, rgba(214, 120, 128, .24) 0 14px, transparent 14px 28px);
}
.parche { position: absolute; z-index: -1; pointer-events: none;
  clip-path: polygon(3% 8%, 22% 2%, 48% 6%, 71% 0, 97% 5%, 94% 31%, 100% 58%, 95% 94%, 68% 98%, 44% 93%, 19% 100%, 2% 94%, 6% 66%, 0 39%); }

/* Brochazo rosa detrás de un texto */
.brocha { display: inline-block; padding: 6px 22px 8px; background: var(--rosa-suave);
  clip-path: polygon(2% 14%, 18% 4%, 52% 10%, 99% 0, 96% 24%, 100% 40%, 97% 58%, 100% 84%, 70% 96%, 38% 90%, 1% 100%, 4% 74%, 0 58%, 4% 38%); }
.brocha.arena { background: var(--arena); }

/* Tarjeta de papel con cinta */
.tarjeta { position: relative; background: var(--papel); border: 2.5px solid var(--cafe);
  border-radius: 22px 26px 20px 28px / 26px 20px 28px 22px; padding: 24px 20px; box-shadow: 5px 6px 0 var(--rosa); }
.cinta::before { content: ""; position: absolute; top: -13px; left: 50%; width: 112px; height: 27px;
  transform: translateX(-50%) rotate(-3deg); background: rgba(233, 211, 182, .9);
  clip-path: polygon(0 0, 100% 6%, 96% 36%, 100% 62%, 97% 100%, 2% 94%, 5% 62%, 0 34%); }

/* Botones */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px;
  padding: 10px 26px; font: 25px/1.1 var(--titulo); letter-spacing: .4px; color: var(--crema); background: var(--cafe);
  border: 2.5px solid var(--cafe); border-radius: 40px 34px 42px 32px / 34px 40px 32px 42px;
  box-shadow: 0 5px 0 var(--rosa); cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .12s ease, box-shadow .12s ease; -webkit-tap-highlight-color: transparent; }
.boton:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rosa); }
.boton.rosa { background: var(--rosa-suave); color: var(--cafe); box-shadow: 0 5px 0 var(--cuero); }
.boton.rosa:active { box-shadow: 0 1px 0 var(--cuero); }
.boton.claro { background: var(--papel); color: var(--cafe); box-shadow: 0 4px 0 var(--arena); }
.boton.chico { min-height: 44px; font-size: 20px; padding: 6px 18px; }
.boton.bloque { width: 100%; }
.boton[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.enlace { background: none; border: 0; font: inherit; color: var(--rosa-fuerte); text-decoration: underline; cursor: pointer; padding: 8px; }

/* Formularios */
label { display: block; font-size: 20px; margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: 21px var(--texto); color: var(--cafe); background: #fff; border: 2.5px solid var(--cafe);
  border-radius: 14px 18px 13px 19px; padding: 12px 14px; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--rosa); outline-offset: 1px; }
.campo { margin-bottom: 16px; }
.error { color: #9B2D2D; background: #FBE0DC; border-radius: 12px; padding: 8px 12px; margin-bottom: 14px; }
.error:empty { display: none; }

/* Aviso flotante */
#aviso { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 90; width: max-content;
  max-width: calc(100% - 32px); transform: translate(-50%, 160%); opacity: 0; background: var(--cafe); color: var(--crema);
  padding: 12px 20px; border-radius: 18px; box-shadow: var(--sombra); transition: .25s ease; pointer-events: none; text-align: center; }
#aviso.ver { transform: translate(-50%, 0); opacity: 1; }

/* Doodles */
.doodle { position: absolute; pointer-events: none; user-select: none; }

@keyframes entra { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes mece { 0%, 100% { rotate: -5deg; } 50% { rotate: 6deg; } }
@keyframes pop { from { opacity: 0; transform: scale(.5) rotate(-12deg); } 70% { transform: scale(1.06) rotate(1deg); } }
.entra { animation: entra .6s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: var(--d, 0s); }
.mece { animation: mece 4.5s ease-in-out infinite; }

/* ---------- Portada ---------- */
.portada { position: relative; isolation: isolate; text-align: center; padding-top: 22px; }
.portada .invitacion { font-size: 18px; letter-spacing: 1.5px; text-transform: uppercase; transform: rotate(-1.5deg); }
.titulazo { position: relative; font-size: clamp(76px, 25vw, 138px); line-height: .78; margin: 20px auto 6px; transform: rotate(-3deg); }
.titulazo small { display: block; font-size: .56em; }
.titulazo .corona { position: absolute; width: .46em; right: 4%; top: -.04em; rotate: 14deg; }
.nombre { font-size: 40px; margin-top: 14px; }
.retrato { position: relative; isolation: isolate; width: min(100%, 440px); margin: 4px auto 0; }
.retrato > img.foto { width: 100%; filter: drop-shadow(0 14px 14px rgba(59, 31, 20, .28)); animation: pop .8s cubic-bezier(.2, .8, .2, 1) .25s backwards; }
.retrato .parche { inset: 13% 2% 5%; rotate: -3deg; }
.lema { position: relative; margin-top: -14px; font: 31px/1.1 var(--titulo); }
.datos { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 18px 0 4px; padding: 0; list-style: none; }
.datos li:nth-child(odd) { rotate: -1.4deg; }
.datos li:nth-child(even) { rotate: 1.2deg; }
.pasos { list-style: none; padding: 0; counter-reset: paso; display: grid; gap: 14px; }
.pasos li { counter-increment: paso; display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 12px; }
.pasos li::before { content: counter(paso); display: grid; place-items: center; width: 52px; height: 52px; font: 32px var(--titulo);
  background: var(--rosa-suave); border: 2.5px solid var(--cafe); border-radius: 50% 44% 52% 46%; }
.seccion { position: relative; margin-top: 44px; }
.pie { text-align: center; padding: 40px 0 46px; }
.pie img { width: 110px; margin: 0 auto 6px; }

@media (min-width: 900px) {
  .landing { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; width: min(100% - 64px, 1100px); margin-inline: auto; align-items: start; }
  .landing > * { width: 100%; }
  .landing .lado { padding-top: 70px; }
}

/* ---------- Invitado ---------- */
.barra { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; }
.barra img { width: 66px; }
.barra h1 { font-size: 34px; overflow-wrap: anywhere; }
.barra .salir { margin-left: auto; font-size: 17px; white-space: nowrap; }
.contador { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.contador strong { font: 42px/1 var(--titulo); }
.medidor { height: 20px; margin: 10px 0 18px; border: 2.5px solid var(--cafe); border-radius: 20px; background: #fff; overflow: hidden; }
.medidor i { display: block; height: 100%; width: 0; transition: width .5s ease;
  background: repeating-linear-gradient(-45deg, var(--rosa) 0 9px, var(--rosa-suave) 9px 18px); }
.acciones { display: grid; gap: 15px; }
.acciones .boton { min-height: 66px; font-size: 29px; }
.acciones svg { width: 32px; height: 32px; flex: none; }

.rejilla { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 14px; padding: 0; list-style: none; }
.polaroid { position: relative; width: 100%; aspect-ratio: 1; padding: 6px; background: #fff; border: 0; border-radius: 4px;
  box-shadow: var(--sombra); cursor: pointer; font: inherit; color: inherit; }
.polaroid img { width: 100%; height: 100%; object-fit: contain; background: var(--crema); }
.rejilla li:nth-child(3n) .polaroid { rotate: 1.8deg; }
.rejilla li:nth-child(3n+1) .polaroid { rotate: -1.6deg; }
.vacio { text-align: center; padding: 26px 10px; }
.vacio img { width: 130px; margin: 0 auto 10px; }

/* Ventanas (vista previa y visor) */
dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border: 0; padding: 0; color: var(--cafe); background: var(--crema); }
dialog::backdrop { background: rgba(59, 31, 20, .8); }
dialog[open] { display: flex; flex-direction: column; animation: entra .3s ease; }
.ventana-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 2.5px dashed var(--rosa); }
.ventana-cuerpo { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.ventana-pie { display: grid; gap: 12px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); border-top: 2.5px dashed var(--rosa); }
.ventana-pie > * { width: min(100%, 520px); margin-inline: auto; }
.cerrar { width: 46px; height: 46px; flex: none; font: 30px/1 var(--titulo); background: var(--papel); color: var(--cafe); border: 2.5px solid var(--cafe); border-radius: 50%; cursor: pointer; }
.previas { display: grid; gap: 22px; justify-items: center; list-style: none; padding: 0; }
.previa { position: relative; max-width: 520px; width: 100%; display: grid; justify-items: center; }
.previa canvas { max-width: 100%; max-height: 62vh; width: auto; height: auto; box-shadow: var(--sombra); }
.previa .quitar { position: absolute; top: -10px; left: -4px; width: 40px; height: 40px; font-size: 24px; }
.previa .estado { margin-top: 8px; }
.previa.lista canvas { opacity: .6; }
.previa.fallo .estado { color: #9B2D2D; }
.visor .ventana-cuerpo { display: grid; place-items: center; }
.visor .ventana-cuerpo img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: var(--sombra); -webkit-touch-callout: default; }
.visor .ventana-cuerpo { min-height: 0; grid-template-rows: minmax(0, 1fr); }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Panel ---------- */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 14px 0; }
.cifra { background: var(--papel); border: 2px solid var(--cafe); border-radius: 16px 20px 14px 18px; padding: 10px 14px; }
.cifra b { display: block; font: 38px/1 var(--titulo); }
.pestanas { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.pestanas button { font: 24px var(--titulo); color: var(--cafe); background: none; border: 0; border-bottom: 5px solid transparent; padding: 6px 12px; cursor: pointer; }
.pestanas button[aria-selected=true] { border-color: var(--rosa); background: var(--papel); border-radius: 12px 12px 0 0; }
.filtros { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.filtros select { width: auto; max-width: 100%; flex: 1 1 220px; }
.casilla { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; min-height: 44px; }
.casilla input { width: 22px; height: 22px; accent-color: var(--cafe); }
.descargas { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.partes { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.partes:empty { display: none; }
.rejilla.panel { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.rejilla.panel li { position: relative; }
.rejilla.panel .quien { display: block; font-size: 16px; text-align: center; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav { position: absolute; top: -6px; right: -6px; width: 44px; height: 44px; font-size: 26px; line-height: 1; color: var(--cafe);
  background: var(--papel); border: 2px solid var(--cafe); border-radius: 50%; cursor: pointer; }
.fav[aria-pressed=true] { background: #F6D58E; }
.dedicatorias { columns: 280px; column-gap: 20px; padding-top: 14px; }
.dedicatorias article { break-inside: avoid; margin-bottom: 26px; }
.dedicatorias p { white-space: pre-wrap; overflow-wrap: anywhere; }
.dedicatorias footer { margin-top: 10px; font: 24px var(--titulo); text-align: right; }
.tabla { width: 100%; border-collapse: collapse; font-size: 17px; }
.tabla td, .tabla th { text-align: left; padding: 7px 6px; border-bottom: 1.5px dashed var(--rosa); overflow-wrap: anywhere; }

@media (min-width: 600px) { .rejilla { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 599px) {
  .cifras { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cifra { padding: 8px; font-size: 16px; }
  .cifra b { font-size: 28px; }
  .pestanas { gap: 2px; }
  .pestanas button { font-size: 19px; padding: 6px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .no-imprimir { display: none !important; }
}
