/* KindMX: estilos compartidos (tienda y panel). Sistema visual en DESIGN.md. */
:root {
  /* Superficies */
  --canvas: #f1f2f9;
  --paper: #ffffff;
  --wash: #e7e6f4;
  --night: #191034;

  /* Texto */
  --ink: #281950;
  --body: #5e537c;
  --muted: #676b89;
  --mist: #a39ac1;          /* solo decorativo: nunca texto sobre --paper o --canvas */

  /* Acción */
  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: #f3edfe;
  --on-accent: #ffffff;

  /* Semánticos */
  --ok: #15803d;      --ok-soft: #e8f6ee;
  --warn: #92400e;    --warn-soft: #fdf3e2;
  --bad: #be123c;     --bad-soft: #fdecef;

  /* Degradados */
  --dawn: linear-gradient(to right, #7dd3fc, #a5b4fc, #f9a8d4);
  --dawn-soft: linear-gradient(100deg, rgba(125,211,252,.10), rgba(165,180,252,.10), rgba(249,168,212,.10));

  /* Velos */
  --scrim: rgba(25,16,52,.45);            /* fondo detrás de los diálogos */
  --canvas-glass: rgba(241,242,249,.9);   /* barra pegajosa (--canvas al 90%) */
  --on-night: #ffffff;
  --on-night-soft: rgba(255,255,255,.7);
  --night-line: rgba(163,154,193,.25);    /* separador sobre --night */

  /* Tipografía */
  --font-display: "Fraunces", "Source Serif 4", Georgia, serif;
  --font-body: "Bricolage Grotesque", "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Radios */
  --r-pill: 9999px;
  --r-card: 16px;
  --r-input: 10px;
  --r-small: 4px;
  --r-dialog: 20px;
  --r-thumb: 12px;

  /* Sombras */
  --shadow-cta: 0 5px 5px -2px rgba(91,33,182,.10), 0 2px 4px -2px rgba(91,33,182,.10);
  --shadow-float: 0 0 0 1px rgba(32,34,55,.075), 0 10px 15px -3px rgba(32,34,55,.05), 0 4px 6px -4px rgba(32,34,55,.05);
  --shadow-dialog: 0 0 0 1px rgba(32,34,55,.06), 0 24px 48px -12px rgba(40,25,80,.25);
  --ring: 0 0 0 1px rgba(67,56,202,.25) inset;

  /* Espaciado (base 4 px) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  /* Layout */
  --max: 1200px;
  --gutter: 16px;
  --block: var(--s-16);
  --nav-top: 12px;
  --nav-h: 62px;
  --bar-top: calc(var(--nav-top) + var(--nav-h) + var(--s-2));
  --ease: 180ms ease-out;
}
@media (min-width: 720px) { :root { --gutter: 24px; --block: var(--s-24); } }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-top) + 72px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--body);
  font: 350 16px/1.6 var(--font-body); letter-spacing: .025em;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
h1, h2, h3 {
  margin: 0; color: var(--ink); font-family: var(--font-display); font-weight: 500;
  font-variation-settings: "SOFT" 0, "WONK" 0; letter-spacing: -.025em;
}
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.heading { font-size: 28px; line-height: 1.33; }
@media (min-width: 720px) { .heading { font-size: 36px; } }
.subheading { font-size: 22px; line-height: 1.15; }
.caption { font-size: 13px; line-height: 1.4; font-weight: 450; letter-spacing: .03em; color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- iconos (sprite Lucide) ---------- */
.icon {
  width: 20px; height: 20px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon-16 { width: 16px; height: 16px; }
.icon-24 { width: 24px; height: 24px; }
.icon-40 { width: 40px; height: 40px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 12px 22px; border-radius: var(--r-pill); border: 1.5px solid transparent;
  font-size: 16px; font-weight: 500; line-height: 1; letter-spacing: .025em; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-cta); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-outline { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-ghost { background: none; color: var(--ink); padding-inline: 12px; }
.btn-ghost:hover { text-decoration: underline; }
.btn-danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { min-height: 40px; padding: 9px 16px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { min-width: 40px; padding: 8px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------- campos ---------- */
.field { display: grid; gap: 6px; color: var(--ink); font-size: 15px; font-weight: 500; }
.field-label { display: inline-flex; align-items: center; gap: var(--s-2); }
.field-label .icon { color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select {
  width: 100%; background: var(--paper); border: 1px solid var(--wash); border-radius: var(--r-input);
  padding: 11px 14px; color: var(--ink); font-size: 16px; font-weight: 400; line-height: 1.4;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input:focus-visible, .field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field textarea { resize: vertical; }
.help { font-size: 13px; line-height: 1.4; font-weight: 450; letter-spacing: .03em; color: var(--muted); }
.field-error, .form-error {
  display: flex; align-items: flex-start; gap: 6px; color: var(--bad);
  font-size: 13px; line-height: 1.4; font-weight: 450; letter-spacing: .03em;
}
.form-error:empty { display: none; }
.form-error .icon { margin-top: 1px; }
.input[aria-invalid="true"], .field input[aria-invalid="true"] { border-color: var(--bad); }

.check { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; font-weight: 450; cursor: pointer; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* input de búsqueda con icono */
.search { position: relative; display: block; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 40px; padding: 9px 16px 9px 42px; border-radius: var(--r-pill);
  background: var(--paper); border: 1px solid var(--wash); color: var(--ink); font-size: 15px;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- chips y badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--r-pill); border: 1px solid var(--wash); background: var(--paper);
  color: var(--body); font-size: 15px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
  text-decoration: none; transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 575; line-height: 1.2; letter-spacing: .02em; white-space: nowrap;
}
.badge .icon { width: 16px; height: 16px; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 575; line-height: 1; }

/* ---------- navegación flotante ---------- */
.nav-shell { position: sticky; top: var(--nav-top); z-index: 20; margin-top: var(--nav-top); }
.nav {
  position: relative; display: flex; align-items: center; gap: var(--s-4); min-height: var(--nav-h);
  padding: 10px 12px 10px 20px; background: var(--paper); border: 1px solid var(--wash);
  border-radius: var(--r-pill); box-shadow: var(--shadow-float);
}
.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink); text-decoration: none; min-height: 40px; }
.brand-name { font: 500 22px/1 var(--font-display); letter-spacing: -.025em; font-variation-settings: "SOFT" 0, "WONK" 0; }
.brand img { height: 28px; width: auto; object-fit: contain; }
.brand-tag { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .03em; }
.nav-links { display: flex; gap: var(--s-1); margin: 0 auto; padding: 0; list-style: none; }
.nav-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; color: var(--ink); font-size: 15px; font-weight: 450; text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }
.nav-actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.nav-menu-btn { display: none; }
@media (max-width: 719px) {
  .nav { padding-left: 16px; gap: var(--s-2); }
  .nav-links { display: none; }
  .nav-menu-btn { display: inline-flex; }
  .nav.is-open .nav-links {
    display: grid; position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: var(--s-2);
    background: var(--paper); border: 1px solid var(--wash); border-radius: var(--r-card); box-shadow: var(--shadow-float);
  }
  .nav.is-open .nav-links a { min-height: 44px; padding: 0 var(--s-4); }
}

/* ---------- hero ---------- */
.hero { background: var(--dawn-soft); margin-top: calc(-1 * (var(--nav-h) + var(--nav-top))); padding: calc(var(--nav-h) + var(--nav-top) + var(--s-12)) 0 var(--s-12); }
.hero h1 { font-size: clamp(40px, 7vw, 64px); line-height: 1.15; letter-spacing: -.045em; }
.hero h1.is-in { animation: fade-in 300ms ease-out both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-6); margin-top: var(--s-5); }
.countdown {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 40px; padding: 8px 16px 8px 14px;
  background: var(--paper); border: 1px solid var(--wash); border-radius: var(--r-pill); font-size: 15px;
}
.countdown .icon { color: var(--accent); }
.countdown-label { color: var(--muted); font-weight: 450; }
.countdown-time { color: var(--ink); font-weight: 575; font-variant-numeric: tabular-nums; }
.notice { font-size: 18px; line-height: 1.66; color: var(--body); max-width: 65ch; }
.hero-help { margin-top: var(--s-3); }

/* ---------- barra de secciones ---------- */
.shop-area { margin-top: var(--s-6); }   /* contenedor de la barra: deja de estar pegada al terminar la vitrina */
.section-bar {
  position: sticky; top: var(--bar-top); z-index: 10;
  background: var(--canvas-glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--wash);
}
.section-bar-inner { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-3) 0; }
.chips { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: thin; flex: 1; min-width: 0; padding: 2px; margin: -2px; }
.section-bar .search { width: 260px; flex: none; }
/* Móvil: una sola fila. El buscador es un círculo con lupa y se abre a todo el ancho
   al enfocarlo o mientras tiene texto; abierto, oculta los chips. */
@media (max-width: 719px) {
  .section-bar-inner { gap: var(--s-2); padding: 10px 0; }
  .section-bar .search { width: 40px; transition: width var(--ease); }
  .section-bar .search .icon { left: 10px; }
  .section-bar .search input { padding-left: 38px; padding-right: 8px; }
  .section-bar .search input::placeholder { color: transparent; }
  .section-bar .search:focus-within,
  .section-bar .search:has(input:not(:placeholder-shown)) { width: 100%; }
  .section-bar .search:focus-within input::placeholder { color: var(--muted); }
  .section-bar-inner:has(.search:focus-within) .chips,
  .section-bar-inner:has(.search input:not(:placeholder-shown)) .chips { display: none; }
}

/* ---------- vitrina ---------- */
.shop { padding: var(--s-8) 0 var(--block); min-height: 60vh; }
.sec + .sec { margin-top: var(--s-12); }
.sec h2 { margin-bottom: var(--s-5); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s-4); }
@media (max-width: 719px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); } }

.card {
  display: flex; flex-direction: column; text-align: left; padding: 0; min-width: 0;
  background: var(--paper); border: 1px solid var(--wash); border-radius: var(--r-card);
  cursor: pointer; color: inherit;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out, transform 150ms ease-out;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-cta); transform: translateY(-2px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.wide { grid-column: span 2; }
.card-art {
  position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: calc(var(--r-card) - 1px) calc(var(--r-card) - 1px) 0 0;
  background: radial-gradient(circle at 50% 38%, var(--ca, var(--wash)), var(--cb, var(--mist)));
}
.card.wide .card-art { aspect-ratio: 8 / 5; }
.card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.card.wide .card-art img { object-fit: cover; object-position: center top; }
.card-badge { position: absolute; top: 10px; left: 10px; right: 10px; justify-content: flex-start; width: fit-content; max-width: calc(100% - 20px); background: var(--paper); color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.card-badge span { overflow: hidden; text-overflow: ellipsis; }
.card-info { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; flex: 1; min-width: 0; }
.card-name {
  color: var(--ink); font-size: 16px; font-weight: 500; line-height: 1.35; letter-spacing: .01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-type { display: inline-flex; align-items: center; gap: 4px; }
.card-price { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; margin-top: auto; padding-top: var(--s-2); }
.price { color: var(--ink); font: 500 22px/1 var(--font-display); letter-spacing: -.02em; font-variation-settings: "SOFT" 0, "WONK" 0; font-variant-numeric: tabular-nums; }
.vb { display: inline-flex; align-items: center; gap: 4px; }
.vb s { color: var(--muted); }

/* ---------- estado vacío ---------- */
.empty-state { display: grid; justify-items: center; gap: var(--s-3); text-align: center; padding: var(--s-16) var(--s-4); }
.empty-state .icon { color: var(--mist); }
.empty-state p { max-width: 46ch; }
.empty-state .btn { margin-top: var(--s-2); }

/* ---------- banda "Cómo comprar" ---------- */
.how { background: var(--dawn); padding: var(--block) 0; }
.how h2 { margin-bottom: var(--s-8); }
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); margin: 0; padding: 0; list-style: none; }
@media (max-width: 719px) { .steps-row { grid-template-columns: 1fr; } }
.step { background: var(--paper); border-radius: var(--r-card); padding: var(--s-6); }
.step-n { display: block; color: var(--accent); font: 500 36px/1 var(--font-display); letter-spacing: -.025em; font-variation-settings: "SOFT" 0, "WONK" 0; margin-bottom: var(--s-4); }
.step h3 { font: 575 18px/1.4 var(--font-body); letter-spacing: 0; color: var(--ink); margin-bottom: var(--s-2); }

/* ---------- footer ---------- */
.foot { background: var(--night); color: var(--mist); font-size: 15px; padding: var(--s-12) 0 var(--s-10); }
.foot-cols { display: flex; flex-wrap: wrap; gap: var(--s-8) var(--s-16); }
.foot-brand { color: var(--on-night); font: 500 22px/1 var(--font-display); letter-spacing: -.025em; font-variation-settings: "SOFT" 0, "WONK" 0; margin-bottom: var(--s-3); }
.foot h2 { font: 500 12px/1.4 var(--font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--on-night-soft); margin-bottom: var(--s-3); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.foot a { color: var(--on-night); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot-legal { margin-top: var(--s-10); padding-top: var(--s-6); border-top: 1px solid var(--night-line); }

/* ---------- diálogo ---------- */
.dialog {
  width: min(560px, 100% - 2 * var(--s-4)); max-height: calc(100dvh - 2 * var(--s-4)); padding: 0;
  border: 0; border-radius: var(--r-dialog); background: var(--paper); color: var(--body); box-shadow: var(--shadow-dialog);
}
.dialog::backdrop { background: var(--scrim); }
.dialog[open] { animation: dialog-in 180ms ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dialog-close { position: absolute; top: var(--s-3); right: var(--s-3); margin: 0; }
.dialog-body { padding: var(--s-6); display: grid; gap: var(--s-5); }
@media (max-width: 479px) { .dialog-body { padding: var(--s-5) var(--s-4); } }
.buy-head { display: flex; gap: var(--s-4); align-items: center; padding-right: var(--s-10); }
.buy-thumb {
  position: relative; width: 72px; height: 72px; flex: none; overflow: hidden; border-radius: var(--r-thumb);
  background: radial-gradient(circle at 50% 38%, var(--ca, var(--wash)), var(--cb, var(--mist)));
}
.buy-thumb img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.buy-head h2 { font-size: 22px; line-height: 1.15; }
.buy-meta { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.buy-contents { font-size: 15px; font-weight: 450; padding: var(--s-3) var(--s-4); background: var(--canvas); border-radius: var(--r-input); }
.buy-form { display: grid; gap: var(--s-4); }
.buy-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.buy-form legend { padding: 0; margin-bottom: 6px; color: var(--ink); font-size: 15px; font-weight: 500; }
.pay-options { display: grid; gap: var(--s-2); }
.pay {
  position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--wash); border-radius: var(--r-input); background: var(--paper);
  color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease);
}
.pay:hover { border-color: var(--accent); }
.pay .icon { color: var(--muted); }
.pay input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pay:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay:has(input:checked) .icon { color: var(--accent); }
.pay:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pay-tick { margin-left: auto; color: var(--accent); visibility: hidden; }
.pay:has(input:checked) .pay-tick { visibility: visible; }

.done { text-align: left; }
.done > .icon { color: var(--accent); }
.done-lead { color: var(--body); }
.done-lead b { color: var(--ink); font-weight: 575; }
.pay-details {
  margin: 0; padding: var(--s-4); background: var(--canvas); border: 1px dashed var(--accent); border-radius: var(--r-input);
  color: var(--ink); font: 450 15px/1.6 var(--font-body); letter-spacing: .02em; white-space: pre-wrap; word-break: break-word;
}
.done-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.done-actions .btn { flex: 1 1 200px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: var(--s-6); z-index: 100; display: inline-flex; align-items: center; gap: var(--s-2);
  max-width: calc(100% - 2 * var(--s-4)); padding: 12px 20px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-accent); font-size: 15px; font-weight: 450; box-shadow: var(--shadow-float);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity var(--ease), transform var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
.toast:not(.bad) .icon { display: none; }

/* ---------- movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card:hover { transform: none; }
}
