/* Tornaràs — estilos compartidos. Paleta «Explanada» (docs/marca.md). */
:root {
  --teja: #C8412B; --tinta: #1B1F3B; --arena: #F3EDE3; --mar: #2E6E8E;
  --bg: #F3EDE3; --papel: #FBF8F3; --fg: #1B1F3B; --muted: #625D6B; --line: #DDD5C9;
  --ok: #2F7D4F;
  --display: 'Outfit', ui-sans-serif, system-ui, sans-serif;
  --body: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --radio: 18px;
  --sombra: 0 1px 0 rgba(27,31,59,.06), 0 18px 40px -18px rgba(27,31,59,.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--fg);
  font: 16px/1.5 var(--body);
  /* grano de papel */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .1 0 0 0 0 .2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -.03em; line-height: 1.05; margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teja); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barra superior mínima */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: 1080px; margin: 0 auto; }
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.035em; }
.logo svg { width: 26px; height: 26px; color: var(--teja); }
.etiqueta { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--tinta); color: var(--arena); font-weight: 600; text-decoration: none;
  transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.97); }
.btn.teja { background: var(--teja); }
.btn.claro { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 20px; height: 20px; }

.aviso { font-size: 13.5px; color: var(--muted); text-wrap: pretty; }
.caja { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; }

/* ——— Tarjeta de sellos ——— */
.tarjeta {
  --neg: #C8412B; --neg-ink: #F3EDE3; --tinta-sello: #C8412B;
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--neg); color: var(--neg-ink);
  border-radius: 22px; padding: 20px 18px 18px;
  box-shadow: 0 2px 0 rgba(0,0,0,.08), 0 26px 50px -22px rgba(27,31,59,.55);
}
/* textura de cartulina */
.tarjeta::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5; mix-blend-mode: soft-light;
  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='.75' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
.tarjeta .cab { display: flex; align-items: center; gap: 10px; }
.tarjeta .tarjeta-logo { width: 34px; height: 34px; flex: none; border-radius: 50%; background: #fff; object-fit: cover; }
.tarjeta .emisor { font-size: 15px; font-weight: 600; }
.tarjeta .nombre { margin-top: 18px; font-family: var(--display); font-weight: 800; font-size: clamp(26px, 8vw, 34px); letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; }
.tarjeta .fila { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.tarjeta .fila .der { text-align: right; }
.tarjeta .fila small { display: block; font-size: 13px; opacity: .85; }
.tarjeta .fila b { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.tarjeta .qr-caja { display: grid; justify-items: center; gap: 8px; margin-top: 18px; }
.tarjeta .qr { width: 38%; aspect-ratio: 1; padding: 4.5%; background: #fff; border-radius: 12px; box-sizing: content-box; }
.tarjeta .qr svg { display: block; width: 100%; height: 100%; }
.tarjeta .codigo { font-size: 15px; letter-spacing: .04em; }

/* Imagen de los sellos: a sangre, al final de la tarjeta, como el heroImage del pase (misma cuadrícula: pase.js) */
.huecos { position: relative; container-type: inline-size; margin: 18px -18px -18px; background: #F3EDE3; }
.hueco { position: absolute; border-radius: 50%; border: 1.5px dashed #BDB3A5; display: grid; place-items: center; }
.hueco.premio::after { content: "★"; font-size: 6cqw; line-height: 1; color: #BDB3A5; }
.hueco.lleno { border-color: transparent; }
.hueco.lleno::after { display: none; }
.hueco .huella-logo { position: absolute; inset: 1%; width: 98%; height: 98%; border-radius: 50%; object-fit: cover; background: #fff; }
.hueco .huella { position: absolute; inset: -6%; width: 112%; height: 112%; color: var(--tinta-sello); mix-blend-mode: multiply; }
/* con la foto del negocio (mismos valores que scripts/wallet-imagenes.mjs) */
.tarjeta.con-foto .huecos { background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.55)), var(--foto) center / cover, #111; }
.tarjeta.con-foto .hueco { border-color: rgba(255,255,255,.85); background: rgba(255,255,255,.12); }
.tarjeta.con-foto .hueco.lleno { border-color: transparent; background: none; }
.tarjeta.con-foto .hueco.premio::after { color: rgba(255,255,255,.85); }

/* Sello de madera que baja */
.sello-madera { position: fixed; z-index: 50; width: 96px; pointer-events: none; transform-origin: 50% 100%; filter: drop-shadow(0 18px 14px rgba(27,31,59,.35)); }
@keyframes golpe { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.golpe { animation: golpe .35s ease-out; }

/* Hojas / diálogos */
dialog { border: 0; border-radius: 22px; padding: 22px; max-width: min(420px, calc(100vw - 32px)); background: var(--papel); color: var(--fg); box-shadow: 0 30px 80px rgba(27,31,59,.4); }
dialog::backdrop { background: rgba(27,31,59,.55); backdrop-filter: blur(3px); }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 60; background: var(--tinta); color: var(--arena); padding: 12px 18px; border-radius: 14px; font-size: 14.5px; max-width: calc(100vw - 32px); box-shadow: var(--sombra); animation: sube .25s ease-out; }
@keyframes sube { from { opacity: 0; translate: -50% 12px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
