/* Café Ocote · barro negro y brasa de ocote */
:root {
  --barro: #15100d;
  --barro-2: #1f1713;
  --barro-3: #2b211b;
  --barro-4: #3a2d25;
  --incision: rgba(244, 230, 208, 0.13);
  --incision-2: rgba(244, 230, 208, 0.22);
  --crema: #f4e6d0;
  --crema-2: #d3c1a8;
  --ceniza: #a29180;
  --brasa: #e8892b;
  --brasa-claro: #f7b85a;
  --brasa-hondo: #9c4a12;
  --oxido: #c5603a;
  --verde: #7fb08a;
  --tinta: #1a0f08;
  --radio: 22px;
  --serif: "Young Serif", Georgia, serif;
  --sans: "Bricolage Grotesque", system-ui, sans-serif;
  --suave: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--barro-4) var(--barro); }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--barro);
  background-image:
    radial-gradient(120% 70% at 15% -10%, rgba(255, 214, 170, 0.09), transparent 60%),
    radial-gradient(90% 60% at 110% 110%, rgba(232, 137, 43, 0.06), transparent 60%),
    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='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .8 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed;
  color: var(--crema);
  font: 400 1rem/1.5 var(--sans);
  font-optical-sizing: auto;
  overflow-x: hidden;
}
::selection { background: var(--brasa); color: var(--tinta); }
input, textarea, button, select { font: inherit; color: inherit; caret-color: var(--brasa); }
a { color: var(--brasa-claro); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--brasa-claro); outline-offset: 3px; border-radius: 6px; }
img, svg { display: block; }
.num { font-variant-numeric: tabular-nums; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Banda de demo */
.banda {
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--crema-2);
  padding: 8px 16px;
  border-bottom: 1px solid var(--incision);
  background: rgba(0, 0, 0, 0.25);
}
.banda a { color: inherit; }

/* Greca incisa (Mitla) como línea de horizonte */
.greca {
  height: 12px;
  border: 0;
  margin: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' fill='none' stroke='%23f4e6d0' stroke-opacity='.22' stroke-width='1.2'%3E%3Cpath d='M0 11.4h4V3.6h8v4.8H8V6H6v5.4h12V.6H24'/%3E%3C/svg%3E") repeat-x center / 24px 12px;
}

/* Contenedor */
.marco { width: min(100% - 32px, 1120px); margin-inline: auto; }
.columna { width: min(100% - 32px, 460px); margin-inline: auto; }

/* Marca */
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--crema); }
.marca svg { width: 30px; height: 30px; color: var(--brasa); }
.marca b { font: 400 1.25rem/1 var(--serif); letter-spacing: -0.01em; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.04; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }

/* ---------- Sellos (discos de barro) ---------- */
.sellos { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 3.4vw, 18px); justify-items: center; }
.sellos.fila { grid-template-columns: repeat(8, 1fr); gap: clamp(5px, 1.6vw, 10px); }
.sello {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #120d0a, #1d1511 70%);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.75), inset 0 -1px 0 rgba(244, 230, 208, 0.08), 0 1px 0 rgba(244, 230, 208, 0.05);
  display: grid;
  place-items: center;
  color: var(--crema);
}
.sello svg.m { position: relative; z-index: 1; width: 66%; height: 66%; opacity: 0.1; }
.sello .n { position: absolute; bottom: -1.4em; font-size: 0.7rem; color: var(--ceniza); }
/* La brasa vive debajo de la incisión: núcleo caliente bajo la marca, borde carbonizado */
.sello::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 56%, #ffd99c 0%, var(--brasa-claro) 16%, var(--brasa) 38%, #b85a16 62%, #4a1a06 92%);
  clip-path: circle(0% at 50% 56%);
}
.sello.lleno { color: var(--tinta); box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.75), 0 7px 16px -7px rgba(232, 137, 43, 0.6); }
.sello.lleno::before { clip-path: circle(72% at 50% 56%); }
.sello.lleno svg.m { opacity: 0.85; }
.sello.premio-ranura svg.m { opacity: 0.22; color: var(--brasa); }
.sello.frio::before { background: radial-gradient(circle at 50% 56%, #9a8b7e, #5c5048 80%); }
.sello.frio { box-shadow: inset 0 3px 7px rgba(0,0,0,.75); }
.sello.frio svg.m { opacity: 0.6; }

/* Interacción firma: el sello baja, presiona el barro y la brasa prende desde adentro */
.sello.prende { animation: presiona 900ms var(--suave) var(--d, 0ms) both; }
.sello.prende::before { animation: prende 1000ms var(--suave) calc(var(--d, 0ms) + 220ms) both; }
.sello.prende svg.m { animation: marca 900ms var(--suave) var(--d, 0ms) both; }
.sello.prende::after {
  content: "";
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--brasa-claro);
  animation: onda 1100ms var(--suave) calc(var(--d, 0ms) + 300ms) both;
  pointer-events: none;
}
@keyframes presiona {
  0% { transform: scale(1); }
  26% { transform: scale(0.88); }
  58% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes prende {
  0% { clip-path: circle(0% at 50% 56%); filter: brightness(1.7); }
  45% { filter: brightness(1.3); }
  100% { clip-path: circle(72% at 50% 56%); filter: none; }
}
@keyframes marca {
  0% { transform: translateY(-60%) scale(1.5); opacity: 0; }
  30% { transform: translateY(0) scale(0.92); opacity: 0.9; }
  100% { transform: none; opacity: 0.82; }
}
@keyframes onda { from { opacity: 0.9; transform: scale(0.85); } to { opacity: 0; transform: scale(1.45); } }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: 7px; }
.campo label, .etiqueta { font-size: 0.9rem; font-weight: 600; color: var(--crema); }
.entrada {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--incision-2);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.entrada::placeholder { color: #8d7d6f; }
.entrada:focus { border-color: var(--brasa); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(232, 137, 43, 0.22); }
.entrada[aria-invalid="true"] { border-color: var(--oxido); }
.prefijo { display: flex; align-items: stretch; }
.prefijo span {
  display: grid; place-items: center; padding: 0 14px; border-radius: 14px 0 0 14px;
  border: 1px solid var(--incision-2); border-right: 0; background: rgba(244, 230, 208, 0.06); color: var(--crema-2);
}
.prefijo .entrada { border-radius: 0 14px 14px 0; }

.casilla { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; cursor: pointer; font-size: 0.95rem; line-height: 1.4; color: var(--crema-2); }
.casilla input { appearance: none; margin: 0; width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--incision-2); background: rgba(0, 0, 0, 0.3); display: grid; place-items: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.casilla input::after { content: ""; width: 12px; height: 7px; border: 2.5px solid var(--tinta); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform 0.2s var(--suave); }
.casilla input:checked { background: var(--brasa); border-color: var(--brasa); }
.casilla input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.casilla b { color: var(--crema); font-weight: 600; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 24px; border-radius: 999px; border: 0;
  font-weight: 650; font-size: 1.05rem; letter-spacing: 0.005em; text-decoration: none; cursor: pointer;
  transition: transform 0.15s var(--suave), filter 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn:active { transform: scale(0.97); }
.btn-brasa {
  background: linear-gradient(180deg, var(--brasa-claro), var(--brasa) 60%, #d27420);
  color: var(--tinta);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.6), 0 8px 20px -8px rgba(232, 137, 43, 0.7);
}
.btn-brasa:hover { filter: brightness(1.06); }
.btn-borde { background: transparent; color: var(--crema); box-shadow: inset 0 0 0 1.5px var(--incision-2); }
.btn-borde:hover { box-shadow: inset 0 0 0 1.5px var(--crema-2); }
.btn-wa { background: #1f6b4a; color: #f1fff6; box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 8px 18px -10px rgba(0,0,0,.8); }
.btn-wa:hover { background: #237a55; }
.btn-texto { background: none; color: var(--crema-2); min-height: 44px; padding: 0 8px; text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }
.btn-ancho { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.cargando { pointer-events: none; opacity: 0.75; }

/* Avisos */
.aviso {
  display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start;
  padding: 12px 14px; border-radius: 14px;
  background: rgba(232, 137, 43, 0.1); border: 1px solid rgba(232, 137, 43, 0.35);
  color: var(--crema); font-size: 0.92rem; line-height: 1.4;
}
.aviso svg { width: 22px; height: 22px; color: var(--brasa-claro); }
.aviso.rojo { background: rgba(197, 96, 58, 0.14); border-color: rgba(197, 96, 58, 0.5); }
.aviso.rojo svg { color: #e98a64; }
.error { color: #f0a080; font-size: 0.9rem; min-height: 1.2em; }

/* Placa crema (QR) */
.placa {
  background: var(--crema);
  color: var(--tinta);
  border-radius: 20px;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.9), inset 0 -2px 0 rgba(120, 80, 40, 0.18);
}

/* Celdas del código */
.celdas { display: flex; gap: 8px; justify-content: center; }
.celdas span {
  width: 46px; height: 58px; border-radius: 12px; display: grid; place-items: center;
  font: 400 1.9rem/1 var(--serif); background: rgba(0,0,0,.3); box-shadow: inset 0 2px 6px rgba(0,0,0,.6); border: 1px solid var(--incision);
}

/* Pie */
.pie { margin-top: 56px; padding: 28px 0 40px; border-top: 1px solid var(--incision); text-align: center; display: grid; gap: 16px; justify-items: center; color: var(--crema-2); font-size: 0.9rem; }
.pie .btn { width: min(100%, 360px); }
.pie a.hecho { color: var(--crema-2); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--crema); color: var(--tinta); padding: 12px 18px; border-radius: 999px; font-weight: 600;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.9); transition: transform .4s var(--suave), opacity .3s; width: max-content; max-width: calc(100% - 32px); text-align: center;
}
.toast.ver { opacity: 1; transform: translate(-50%, 0); }

/* Barra de navegación del café */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; }
.pestanas { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.3); border: 1px solid var(--incision); }
.pestanas a, .pestanas button { min-height: 38px; padding: 0 14px; border-radius: 999px; display: grid; place-items: center; text-decoration: none; color: var(--crema-2); font-size: .9rem; font-weight: 600; background: none; border: 0; cursor: pointer; }
.pestanas [aria-current="page"], .pestanas [aria-selected="true"] { background: var(--barro-4); color: var(--crema); box-shadow: inset 0 1px 0 rgba(244,230,208,.1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
