/* Usual Club — tinta sobre papel.
   La idea: una tarjeta de sellos de cartón de toda la vida. Papel cálido,
   tinta azul noche y el rojo coral del tampón. Fraunces para titulares
   (serifa blanda, con carácter de imprenta) y Figtree para el texto.
   Móvil primero; los párrafos llenan su contenedor. */

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --paper: #f6efe3;
  --paper-2: #fffaf2;
  --card: #fffdf8;
  --ink: #1b1f3b;
  --ink-2: #3a3f5c;
  --ink-soft: #6b6f86;
  --line: rgba(27, 31, 59, .14);
  --line-strong: rgba(27, 31, 59, .28);
  --stamp: #ff6b4a;
  --stamp-deep: #c8391c;
  --ok: #17734a;
  --ok-bg: rgba(23, 115, 74, .1);
  --warn-bg: rgba(255, 168, 0, .16);
  --warn: #7a4d00;
  --err: #b0301a;
  --err-bg: rgba(176, 48, 26, .09);
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --display: "Fraunces", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* Grano de papel: ruido SVG muy suave, sin peticiones extra. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 0.2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--stamp-deep); }
img { max-width: 100%; }

:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.08;
  margin: 0;
  font-variation-settings: "opsz" 96;
}
h1 { font-size: clamp(32px, 6vw, 60px); }
h2 { font-size: clamp(24px, 3.6vw, 36px); }
h3 { font-size: 19px; }
p { margin: 0; }

.wrap { width: 100%; padding: 0 var(--gutter); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.muted { color: var(--ink-soft); }
.small { font-size: 13.5px; }
.tiny { font-size: 12.5px; }
.mono { font-family: var(--mono); letter-spacing: .12em; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--stamp-deep);
}

/* --- Cabecera y pie ------------------------------------------------------ */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 239, 227, .86);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: #fff;
  box-shadow: 0 0 0 3px var(--stamp);
  font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .02em;
  transform: rotate(-8deg);
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 420px) { .brand-name { font-size: 17px; } .brand-mark { width: 32px; height: 32px; font-size: 12px; } .topnav a { padding: 8px 8px; } }
.topnav { display: flex; gap: 4px; align-items: center; }
.topnav a { text-decoration: none; font-weight: 600; font-size: 14.5px; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
.topnav a:hover { background: var(--line); color: var(--ink); }

main { flex: 1; width: 100%; }

.footer {
  margin-top: 48px; padding: 28px var(--gutter) 36px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px 22px; justify-content: space-between;
  font-size: 13.5px; color: var(--ink-soft);
}
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer a { color: var(--ink-soft); }

/* --- Botones y formularios ---------------------------------------------- */

.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font: 600 16px/1 var(--body);
  background: var(--ink); color: #fff;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(27, 31, 59, .22); }
.btn:active { transform: translateY(1px) scale(.99); box-shadow: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-stamp { background: var(--stamp); color: var(--ink); }
.btn-stamp:hover { color: var(--ink); background: #ff7d60; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn-ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn-big { min-height: 64px; font-size: 19px; width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--err); font: 600 14px var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 14px; font-weight: 600; }
.field small { font-weight: 400; color: var(--ink-soft); }
.input, .field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"], .field input[type="search"] {
  width: 100%; min-height: 50px; padding: 0 15px;
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: var(--paper-2); color: var(--ink);
  font: 16px var(--body);
}
.input:focus, .field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 107, 74, .35); }
.check { display: flex; gap: 11px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--ink); }

.panel-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 1px 0 rgba(27, 31, 59, .04);
}

.notice { padding: 12px 15px; border-radius: 12px; font-size: 14.5px; line-height: 1.5; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.notice-err { background: var(--err-bg); color: var(--err); font-weight: 600; }

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- La tarjeta de sellos (vista previa y tarjeta web) ------------------ */

.pass {
  --brand: var(--ink);
  --fg: #fff;
  position: relative; overflow: hidden;
  background: var(--brand); color: var(--fg);
  border-radius: 20px; padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 18px 40px -18px rgba(27, 31, 59, .55), 0 2px 0 rgba(255, 255, 255, .08) inset;
  max-width: 440px;
}
.pass::after { /* brillo de cartulina */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%);
}
.pass-head { display: flex; align-items: center; gap: 12px; }
.pass-logo { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #fff; flex: none; }
.pass-initials {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--fg); color: var(--brand); font-weight: 800; font-size: 16px;
}
.pass-name { font-family: var(--display); font-size: 21px; font-weight: 650; line-height: 1.1; }
.pass-reward { font-size: 14px; opacity: .92; }
.pass-points { font-family: var(--display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stamps { display: grid; grid-template-columns: repeat(var(--cols, 5), 1fr); gap: 10px; }
.stamp {
  aspect-ratio: 1; border-radius: 50%;
  border: 2px dashed color-mix(in srgb, var(--fg) 55%, transparent);
  display: grid; place-items: center;
}
.stamp img { width: 72%; height: 72%; opacity: .32; filter: grayscale(1); }
.stamp.on { border: 0; background: #fff; transform: rotate(var(--tilt, -6deg)); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.stamp.on img { opacity: 1; filter: none; }
.stamp.on.just { animation: thump .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes thump {
  0% { transform: scale(1.6) rotate(-18deg); opacity: 0; }
  60% { transform: scale(.92) rotate(var(--tilt, -6deg)); opacity: 1; }
  100% { transform: scale(1) rotate(var(--tilt, -6deg)); }
}
.stamp:nth-child(3n) { --tilt: 5deg; }
.stamp:nth-child(4n) { --tilt: -11deg; }
.progress { height: 12px; border-radius: 999px; background: color-mix(in srgb, var(--fg) 22%, transparent); overflow: hidden; }
.progress > div { height: 100%; background: var(--fg); border-radius: inherit; }
.pass-paused { font-size: 13.5px; font-weight: 600; background: rgba(0, 0, 0, .22); padding: 7px 11px; border-radius: 9px; align-self: flex-start; }

.qr-card {
  background: #fff; border-radius: 20px; padding: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 1px solid var(--line); max-width: 440px;
}
.qr-card img { width: min(260px, 100%); height: auto; image-rendering: pixelated; }
.qr-code { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: .16em; }

.wallet-btn { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 12px; background: #000; color: #fff; font-weight: 600; text-decoration: none; max-width: 440px; }
.wallet-btn:hover { color: #fff; opacity: .9; }

/* --- Landing -------------------------------------------------------------- */

.hero {
  display: grid; gap: clamp(28px, 5vw, 64px); align-items: center;
  padding: clamp(36px, 7vw, 96px) var(--gutter) clamp(32px, 5vw, 64px);
}
@media (min-width: 900px) { .hero { grid-template-columns: 1.15fr .85fr; } }
.hero h1 em { font-style: italic; color: var(--stamp-deep); font-weight: 500; }
.hero-lead { font-size: clamp(17px, 2vw, 20px); color: var(--ink-2); }
.hero-art { position: relative; display: grid; place-items: center; min-height: 340px; }
.hero-art .pass { width: 100%; transform: rotate(-3deg); animation: rise .7s ease-out both; }
.hero-art .pass + .pass { position: absolute; transform: rotate(6deg) translate(18px, 34px); z-index: -1; opacity: .9; animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) rotate(-6deg); } }
.ink-seal {
  position: absolute; left: 0; bottom: -2%; width: 118px; height: 118px; border-radius: 50%;
  border: 3px solid var(--stamp-deep); color: var(--stamp-deep);
  display: grid; place-items: center; text-align: center;
  font: 800 12px/1.15 var(--body); letter-spacing: .12em; text-transform: uppercase;
  transform: rotate(14deg); opacity: .85; mix-blend-mode: multiply;
  animation: seal .6s .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes seal { from { opacity: 0; transform: scale(1.8) rotate(-10deg); } }
.steps { display: grid; gap: 14px; padding: 0 var(--gutter); }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { padding: 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.step-n { font-family: var(--display); font-size: 42px; font-weight: 700; color: var(--stamp); line-height: 1; }
.section { padding: clamp(36px, 6vw, 72px) var(--gutter) 0; }
.features { display: grid; gap: 14px; margin-top: 18px; }
@media (min-width: 760px) { .features { grid-template-columns: repeat(2, 1fr); } }
.feature { padding: 18px 20px; border-left: 4px solid var(--stamp); background: var(--paper-2); border-radius: 0 12px 12px 0; }

/* --- Páginas de una columna (alta, entrar, tarjeta del cliente) -------- */

.page { padding: clamp(24px, 4vw, 48px) var(--gutter) 24px; }
.page-narrow { max-width: 560px; margin: 0 auto; }

/* --- Panel ---------------------------------------------------------------- */

.panel-head { padding: 22px var(--gutter) 0; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; justify-content: space-between; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { flex: none; text-decoration: none; font-weight: 600; font-size: 15px; padding: 10px 16px; border-radius: 999px; color: var(--ink-2); }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }
.panel-body { padding: 20px var(--gutter) 0; display: flex; flex-direction: column; gap: 18px; }
.panel-grid { display: grid; gap: 18px; }
@media (min-width: 980px) { .panel-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

.scan-video { width: 100%; max-height: 60vh; background: #000; object-fit: cover; border-radius: 12px; }

.card-result { display: flex; flex-direction: column; gap: 14px; }
.card-msg { padding: 16px; border-radius: 14px; background: var(--ok-bg); color: var(--ok); font-family: var(--display); font-size: clamp(22px, 5vw, 30px); font-weight: 700; text-align: center; }
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.result-list button {
  width: 100%; display: flex; justify-content: space-between; gap: 10px; align-items: center;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px;
  font: 15px var(--body); color: var(--ink); cursor: pointer; text-align: left;
}
.result-list button:hover { border-color: var(--ink); }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.stat-label { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.stat-value { display: block; margin: 6px 0 2px; font-family: var(--display); font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }

.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-picker label {
  display: flex; align-items: center; gap: 7px; padding: 5px 13px 5px 5px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper-2); font-size: 14px;
}
.icon-picker label:has(input:checked) { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 2px var(--stamp); }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker img { width: 28px; height: 28px; }

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.table-wrap { overflow-x: auto; }

.legal h2 { margin: 26px 0 8px; font-size: 22px; }
.legal p, .legal li { color: var(--ink-2); }
.legal p + p { margin-top: 10px; }
.draft-banner { padding: 10px 14px; border: 2px dashed var(--stamp-deep); color: var(--stamp-deep); border-radius: 10px; font-weight: 700; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, .footer, .tabs, .no-print { display: none !important; }
  body { background: #fff; }
}
