/* =========================================================
   SUNOVA — estilos
   Tipografía: Unbounded (títulos y precios) + Onest (texto)
   ========================================================= */

@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded-latin-wght-normal.woff2") format("woff2-variations"),
       url("fonts/unbounded-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Onest";
  src: url("fonts/onest-latin-wght-normal.woff2") format("woff2-variations"),
       url("fonts/onest-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #160A22;
  --ink-2: #251238;
  --brand: #5B0E91;
  --brand-hover: #6E1BAD;
  --violet: #9D5CFF;
  --page: #F4F1F8;
  --surface: #FFFFFF;
  --line: #E3DBEE;
  --text: #1B1324;
  --muted: #645A71;
  --wa: #0F7F3A;
  --wa-hover: #0B6A30;

  --display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --gutter: 16px;
  --header-h: 64px;
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; --header-h: 72px; } }

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
ul { list-style: none; padding: 0; }
[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.15; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.85rem); letter-spacing: -0.01em; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-lg { width: 28px; height: 28px; stroke-width: 1.6; }
.icon-xl { width: 40px; height: 40px; stroke-width: 1.4; }

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

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--brand); padding: 10px 14px; border-radius: var(--r-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: var(--r-sm);
  font-weight: 600; font-size: 0.95rem; line-height: 1.1;
  text-decoration: none; text-align: center;
  transition: background-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hover); }
.btn-ghost { border: 1.5px solid var(--line); background: var(--surface); color: var(--brand); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-square { width: 44px; padding: 0; flex: none; }
.btn-block { width: 100%; }
.btn:disabled { background: #CFC8D8; color: #fff; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  transition: background-color .15s ease;
}

.link-btn { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; padding: 8px; }
.link-btn:hover { color: var(--text); }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
}
.brand { display: block; margin-right: auto; }
.brand img { height: 24px; width: auto; }
@media (min-width: 1024px) { .brand img { height: 30px; } }

.main-nav { display: none; gap: 4px; }
.main-nav a {
  text-decoration: none; font-weight: 500; font-size: .95rem;
  color: rgba(255,255,255,.82);
  padding: 10px 14px; border-radius: var(--r-sm);
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }

.header-actions { display: flex; align-items: center; gap: 6px; }
.header-wa { color: #fff; }
.header-wa:hover { background: rgba(255,255,255,.1); }

.cart-toggle {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff; font-weight: 600; font-size: .95rem;
  transition: background-color .15s ease;
}
.cart-toggle:hover { background: rgba(255,255,255,.18); }
.cart-toggle-label { display: none; }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  background: var(--violet); color: var(--ink);
  font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cart-toggle.bump .cart-count { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.3); } }

@media (min-width: 720px) {
  .main-nav { display: flex; }
  .header-wa { display: none; }
  .cart-toggle-label { display: inline; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  padding: 36px 0 44px;
}
.hero-waves {
  position: absolute; pointer-events: none;
  right: -120px; bottom: -150px; width: 420px; height: 420px;
  fill: none; stroke: var(--violet); stroke-width: 22; stroke-linecap: round;
  opacity: .22;
}
.hero-waves circle { fill: var(--violet); stroke: none; }
@media (min-width: 900px) {
  .hero { padding: 64px 0 72px; }
  .hero-waves { right: 4%; bottom: -120px; width: 560px; height: 560px; opacity: .32; }
}

.hero-inner { position: relative; }
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.05rem + 3.3vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 17ch;
}
.hero-sub {
  margin-top: 14px;
  max-width: 52ch;
  color: rgba(255,255,255,.76);
  font-size: clamp(1rem, .95rem + .3vw, 1.125rem);
}

.search {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  margin-top: 24px; max-width: 560px;
  background: var(--surface); color: var(--text);
  border-radius: var(--r-md);
  padding: 6px;
}
.search:focus-within { box-shadow: 0 0 0 3px var(--violet); }
.search-icon { position: absolute; left: 16px; color: var(--muted); }
.search input {
  flex: 1; min-width: 0;
  height: 44px; padding: 0 8px 0 40px;
  border: 0; background: transparent; outline: none;
  font-size: 1rem; /* 16px evita el zoom automático en iPhone */
}
.search input::placeholder { color: #8C8298; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search .btn { padding: 0 16px; }
@media (max-width: 419px) {
  .search .btn { display: none; }
}

.hero-location {
  display: flex; align-items: center; gap: 6px;
  margin-top: 18px; font-size: .9rem; color: rgba(255,255,255,.66);
}
.hero-location .icon { width: 18px; height: 18px; }

/* ---------- catálogo ---------- */

.catalog { padding-top: 32px; padding-bottom: 56px; outline: none; }
@media (min-width: 900px) { .catalog { padding-top: 48px; padding-bottom: 80px; } }

.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.result-count { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

.chips {
  display: flex; gap: 8px;
  margin: 16px calc(var(--gutter) * -1) 20px;
  padding: 2px var(--gutter) 6px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; } }

.chip {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 16px 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text); font-weight: 500; font-size: .92rem;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.chip .icon { width: 18px; height: 18px; color: var(--brand); }
.chip:hover { border-color: #C9B7E0; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip[aria-pressed="true"] .icon { color: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.card-media { display: block; width: 100%; aspect-ratio: 4 / 5; background: #5E2A9C; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
@media (hover: hover) { .card:hover .card-media img { transform: scale(1.03); } }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 12px; }
@media (min-width: 640px) { .card-body { padding: 16px; } }

.card-cat { font-size: .8rem; color: var(--muted); }
.card-title { font-family: var(--body); font-weight: 600; font-size: .98rem; line-height: 1.3; margin-top: 2px; }
.card-title button { text-align: left; }
.card-title button:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.card-desc {
  margin-top: 6px; font-size: .88rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 479px) { .card-desc { display: none; } }

.card-price {
  margin-top: auto; padding-top: 10px;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(.98rem, .9rem + .35vw, 1.15rem);
  color: var(--brand); letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-actions .btn-primary { flex: 1; min-width: 0; padding: 0 10px; }
@media (max-width: 479px) {
  .card-actions { gap: 6px; }
  .card-actions .btn-primary { padding: 0 6px; font-size: .9rem; }
  .card-actions .btn-primary .icon { display: none; }
}

.empty {
  text-align: center; padding: 40px 16px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md);
  color: var(--muted);
}
.empty p:first-child { color: var(--text); font-weight: 600; }
.empty .btn { margin-top: 16px; }

/* ---------- cómo comprar ---------- */

.how { background: var(--surface); border-top: 1px solid var(--line); padding: 44px 0; }
@media (min-width: 900px) { .how { padding: 64px 0; } }
.how-list { display: grid; gap: 24px; margin-top: 24px; }
@media (min-width: 720px) { .how-list { grid-template-columns: repeat(3, 1fr); gap: 32px; } }
.how-list li { display: flex; gap: 14px; align-items: flex-start; }
.how-list .icon { color: var(--brand); margin-top: 2px; }
.how-list h3 { font-size: 1.02rem; font-weight: 600; }
.how-list p { margin-top: 4px; color: var(--muted); font-size: .95rem; max-width: 36ch; }

/* ---------- footer ---------- */

.site-footer { background: var(--ink); color: rgba(255,255,255,.75); padding: 40px 0 calc(32px + env(safe-area-inset-bottom)); }
.footer-inner { display: grid; gap: 24px; }
@media (min-width: 720px) {
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
  .copyright { grid-column: 1 / -1; }
}
.footer-brand img { height: 26px; width: auto; }
.footer-brand p { margin-top: 10px; font-size: .95rem; }
.social { display: flex; flex-wrap: wrap; gap: 8px; }
.social a {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18);
  color: #fff; text-decoration: none; font-weight: 500; font-size: .92rem;
}
.social a:hover { background: rgba(255,255,255,.08); }
.copyright { font-size: .85rem; color: rgba(255,255,255,.55); padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }

/* ---------- modal de producto ---------- */

.modal {
  margin: auto;
  width: min(920px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--text);
  overflow: auto; overscroll-behavior: contain;
}
.modal::backdrop { background: rgba(14, 6, 22, .7); }
.modal[open] { animation: pop .2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal-inner { position: relative; display: grid; }
@media (min-width: 760px) { .modal-inner { grid-template-columns: 1fr 1.1fr; } }

.modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(255,255,255,.92); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.modal-close:hover { background: #fff; }

.modal-media { background: #5E2A9C; }
.modal-media img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 5; }
@media (max-width: 759px) {
  .modal-media img { aspect-ratio: 1 / 1; max-height: 44dvh; }
}

.modal-info { padding: 20px var(--gutter) 24px; display: flex; flex-direction: column; }
@media (min-width: 760px) { .modal-info { padding: 40px 36px 32px; } }
.modal-info h2 { font-size: clamp(1.25rem, 1.05rem + .9vw, 1.6rem); margin-top: 4px; padding-right: 36px; }
.modal-price { font-family: var(--display); font-weight: 600; font-size: 1.35rem; color: var(--brand); margin-top: 10px; font-variant-numeric: tabular-nums; }
.modal-desc { margin-top: 12px; color: var(--muted); }

.feature-list { margin-top: 16px; display: grid; gap: 8px; font-size: .95rem; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; }
.feature-list .icon { width: 18px; height: 18px; color: var(--brand); margin-top: 3px; stroke-width: 2.2; }

.modal-actions {
  display: grid; gap: 10px; margin-top: 24px;
  position: sticky; bottom: 0; padding-top: 12px; padding-bottom: 4px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--surface) 12px);
}
.modal-actions .btn { white-space: nowrap; padding: 0 14px; }
@media (min-width: 480px) { .modal-actions { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .modal-actions { position: static; margin-top: auto; padding-top: 24px; } }

/* ---------- carrito ---------- */

.cart-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(14, 6, 22, .55);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s;
}
.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(420px, 100%);
  display: flex; flex-direction: column;
  background: var(--surface);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .25s ease, visibility .25s;
  box-shadow: -8px 0 32px rgba(0,0,0,.18);
}
.cart-drawer.open { transform: none; visibility: visible; }

.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 10px var(--gutter);
  border-bottom: 1px solid var(--line);
  padding-top: calc(10px + env(safe-area-inset-top));
}
.cart-head h2 { font-size: 1.2rem; }
.cart-head .icon-btn:hover { background: var(--page); }

.cart-items { flex: 1; overflow-y: auto; padding: 8px var(--gutter); overscroll-behavior: contain; }
.cart-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 64px; height: 80px; object-fit: cover; border-radius: var(--r-sm); flex: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.cart-item-price { font-family: var(--display); font-weight: 600; font-size: .92rem; color: var(--brand); margin-top: 4px; font-variant-numeric: tabular-nums; }
.remove { color: var(--muted); align-self: flex-start; margin-top: -6px; }
.remove:hover { color: #B3261E; background: #FBEDEC; }

.qty {
  display: inline-flex; align-items: center; margin-top: 8px;
  border: 1.5px solid var(--line); border-radius: 999px;
}
.qty button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.qty button:hover { background: var(--page); }
.qty .icon { width: 16px; height: 16px; }
.qty span { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.cart-empty { display: grid; justify-items: center; gap: 10px; padding: 56px 0; color: var(--muted); text-align: center; }
.cart-empty .icon { color: #B9A9CF; }

.cart-foot {
  border-top: 1px solid var(--line);
  padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 10px; justify-items: center;
  background: var(--page);
}
.cart-total { width: 100%; display: flex; justify-content: space-between; align-items: baseline; }
.cart-total strong { font-family: var(--display); font-weight: 600; font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* ---------- aviso ---------- */

.toast {
  position: fixed; z-index: 50;
  left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-md);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font-size: .92rem;
  transition: transform .25s ease;
}
.toast.show { transform: translate(-50%, 0); }
.toast .icon { color: var(--violet); width: 18px; height: 18px; stroke-width: 2.4; }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.toast button {
  flex: none; height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.12); font-weight: 600; font-size: .88rem;
}
.toast button:hover { background: rgba(255,255,255,.2); }

/* ---------- movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}