/* Suplecon - estilos del sitio público. Mobile first. */

:root {
  --bg: #f7f9fa;
  --surface: #ffffff;
  --ink: #34495e;          /* azul pizarra: header, títulos, texto */
  --ink-soft: #5d6d7e;     /* texto secundario (5.3:1 sobre blanco) */
  --line: #e3e8ec;
  --accent: #4bb98c;       /* verde: bordes, íconos, detalles */
  --buy: #1f8460;          /* verde oscuro: botones de compra (4.6:1 con blanco) */
  --buy-hover: #186b4e;
  --danger: #b03a2e;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(52, 73, 94, .06), 0 4px 14px rgba(52, 73, 94, .06);
  --shadow-lg: 0 10px 40px rgba(52, 73, 94, .18);
  --header-h: 60px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
}
.skip:focus { top: 8px; }

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

/* ---------- Botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: 12px;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-buy { background: var(--buy); color: #fff; }
.btn-buy:hover { background: var(--buy-hover); }
.btn-buy[disabled], .btn-buy[aria-disabled="true"] {
  background: #dfe5e9; color: #5d6d7e; cursor: not-allowed; transform: none;
}
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 12px 22px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: #eef2f5; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--ink); color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
.header-in { display: flex; align-items: center; gap: 12px; height: var(--header-h); }

.logo {
  font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em;
  color: inherit; text-decoration: none; margin-right: auto;
}
.logo::after { content: "."; color: var(--accent); }

.main-nav { position: static; }
.nav-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 12px;
  background: rgba(255, 255, 255, .1); border: 0; border-radius: 10px;
  color: #fff; cursor: pointer; font-weight: 500;
}
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

.nav-list {
  list-style: none; margin: 0; padding: 8px;
  position: absolute; left: 0; right: 0; top: var(--header-h);
  background: var(--ink); border-top: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .15);
  display: none;
}
.nav-list.open { display: block; }
.nav-list a {
  display: flex; align-items: center; min-height: 48px; padding: 0 12px;
  color: #fff; text-decoration: none; border-radius: 8px;
}
.nav-list a:hover, .nav-list a:focus-visible { background: rgba(255, 255, 255, .1); }

.cart-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer;
}
.cart-count {
  position: absolute; top: 2px; right: 0;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #fff; color: var(--ink); border: 2px solid var(--accent);
  font-size: .75rem; font-weight: 700; line-height: 18px; text-align: center;
}

/* ---------- Hero ---------- */

.hero { background: var(--surface); border-bottom: 1px solid var(--line); }
.hero-in { display: grid; gap: 20px; padding-top: 20px; padding-bottom: 28px; }
.hero-media {
  background: #fff; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 1 / 1; max-height: 36vh; width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.hero-media img { width: 100%; height: 100%; object-fit: contain; }
.hero-body { display: flex; flex-direction: column; gap: 12px; }
.hero-tag {
  align-self: flex-start; font-size: .85rem; font-weight: 600;
  color: var(--ink); background: #eaf6f0; border: 1px solid #bfe5d3;
  padding: 4px 10px; border-radius: 999px;
}
.hero-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
.hero-text { color: var(--ink-soft); font-size: 1.05rem; max-width: 46ch; }
.hero-price { font-size: 1.6rem; font-weight: 800; }
.hero-actions { display: grid; gap: 10px; }

.skeleton { background: linear-gradient(90deg, #eef2f5, #f6f8fa, #eef2f5); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Secciones ---------- */

.catalog, .combos { padding: 32px 0; }
.combos { background: var(--surface); border-top: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.section-sub, .result-count { color: var(--ink-soft); font-size: .95rem; }

/* ---------- Filtros ---------- */

.filters { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 0 12px; min-height: 48px; color: var(--ink-soft);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; min-height: 44px; color: var(--ink); }

.select-wrap select, .field-select {
  width: 100%; min-height: 48px; padding: 0 40px 0 12px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2334495e' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1.5px solid var(--line); border-radius: 12px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
.select-wrap select:focus, .field-select:focus { border-color: var(--accent); outline: 0; }
.field-select { min-height: 44px; font-size: .95rem; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; min-height: 40px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.clear-btn {
  justify-self: start; min-height: 40px; padding: 0 4px;
  background: none; border: 0; color: var(--ink); text-decoration: underline; cursor: pointer;
}

/* ---------- Grilla de productos ---------- */

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 6px 22px rgba(52, 73, 94, .12); }
.card-media {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  background: #fff; aspect-ratio: 1 / 1;
}
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.badge {
  position: absolute; top: 8px; left: 8px;
  font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.badge-out { background: #fff; color: var(--danger); border: 1px solid #e8c4c0; }
.badge-star { background: #eaf6f0; color: var(--ink); border: 1px solid #bfe5d3; }

.card-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; flex: 1; }
.card-brand { font-size: .78rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.card-name {
  font-size: .95rem; font-weight: 600; line-height: 1.3; text-align: left;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink);
}
.card-name:hover { text-decoration: underline; }
.card-price { font-size: 1.15rem; font-weight: 800; margin-top: auto; padding-top: 4px; }
.card-price.pending, .hero-price.pending, .price-pending { font-size: .95rem; color: var(--ink-soft); font-weight: 700; }
.card .btn { width: 100%; padding: 10px 8px; font-size: .95rem; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }

/* ---------- Combos ---------- */

.combo-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.combo-card {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start;
  background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 12px;
}
.combo-media { width: 96px; height: 96px; background: #fff; border-radius: var(--radius-sm); overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; }
.combo-media img { width: 100%; height: 100%; object-fit: contain; }
.combo-media.single { grid-template-columns: 1fr; }
.combo-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.combo-body h3 { font-size: 1.05rem; }
.combo-includes { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: .9rem; }
.combo-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.combo-foot .btn { flex: 1 1 160px; }

/* ---------- Footer ---------- */

.site-footer { background: var(--ink); color: #e9eef2; padding: 36px 0 90px; margin-top: 0; }
.footer-grid { display: grid; gap: 28px; }
.logo-footer { color: #fff; font-size: 1.5rem; margin-bottom: 8px; display: inline-block; }
.footer-h { font-size: 1rem; color: #fff; margin-bottom: 10px; }
.footer-text { color: #d5dde4; margin-bottom: 10px; max-width: 40ch; }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: #d5dde4; }
.footer-list a, .social a { color: #fff; }
.social { list-style: none; padding: 0; margin: 14px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.social a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; text-decoration: none;
}
.social a:hover { border-color: var(--accent); }
.legal { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 28px; padding-top: 18px; font-size: .9rem; color: #d5dde4; display: grid; gap: 6px; }
.copy { color: #b8c4ce; }

/* ---------- Carrito ---------- */

.overlay { position: fixed; inset: 0; background: rgba(30, 42, 54, .45); z-index: 60; }
.cart {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: 100%; max-width: 420px;
  background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .25s ease;
  visibility: hidden;
}
.cart.open { transform: none; visibility: visible; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font-size: 1.2rem; }
.cart-body { flex: 1; overflow-y: auto; padding: 8px 16px; }
.cart-empty { color: var(--ink-soft); text-align: center; padding: 40px 10px; display: grid; gap: 14px; justify-items: center; }
.cart-item { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.cart-item-name { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.cart-item-meta { color: var(--ink-soft); font-size: .85rem; }
.cart-item-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; }
.qty button { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; font-size: 1.2rem; color: var(--ink); border-radius: 10px; }
.qty button:hover { background: #eef2f5; }
.qty output { min-width: 28px; text-align: center; font-weight: 700; }
.remove-btn { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; font-size: .85rem; }
.line-total { font-weight: 700; }
.cart-foot { border-top: 1px solid var(--line); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); display: grid; gap: 10px; background: var(--surface); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; }
.cart-total strong { font-size: 1.4rem; }
.cart-note { font-size: .85rem; color: var(--ink-soft); text-align: center; }

.mobile-cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 54px; padding: 0 18px; border: 0; border-radius: 14px;
  background: var(--buy); color: #fff; font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer;
}
.mobile-cart-bar[hidden] { display: none; }

/* ---------- Modal ---------- */

.modal {
  width: min(760px, calc(100% - 24px)); max-height: calc(100% - 24px);
  padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg); overflow: auto;
}
.modal::backdrop { background: rgba(30, 42, 54, .5); }
.modal-close { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(255, 255, 255, .9); }
.detail { display: grid; gap: 16px; padding: 16px; }
.detail-media { background: #fff; border-radius: 12px; aspect-ratio: 1 / 1; max-height: 42vh; display: flex; align-items: center; justify-content: center; }
.detail-media img { width: 100%; height: 100%; object-fit: contain; }
.detail-body { display: flex; flex-direction: column; gap: 10px; }
.detail-body h2 { font-size: 1.35rem; padding-right: 40px; }
.detail-price { font-size: 1.5rem; font-weight: 800; }
.detail-desc { color: var(--ink-soft); white-space: pre-line; }
.detail-reg { font-size: .85rem; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 10px; }
.field-label { font-size: .85rem; font-weight: 600; display: block; margin-bottom: 4px; }
.combo-pick { display: grid; gap: 12px; }
.out-note { color: var(--danger); font-weight: 600; font-size: .9rem; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 84px; z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-weight: 500; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { padding: 20px; text-align: center; background: #fff3cd; }

/* ---------- Tablet y escritorio ---------- */

@media (min-width: 600px) {
  .filters { grid-template-columns: 1fr 240px; }
  .chips { grid-column: 1 / -1; flex-wrap: wrap; overflow: visible; }
  .combo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { gap: 16px; }
  .detail { grid-template-columns: 1fr 1fr; padding: 24px; }
  .detail-media { max-height: none; }
}

@media (min-width: 900px) {
  :root { --header-h: 68px; }
  .container { padding: 0 24px; }
  .nav-toggle { display: none; }
  .main-nav { margin-right: 8px; }
  .nav-list { display: flex; position: static; padding: 0; gap: 2px; background: none; border: 0; box-shadow: none; }
  .nav-list a { min-height: 44px; padding: 0 10px; font-size: .95rem; }
  .logo { margin-right: 24px; }
  .main-nav { margin-left: auto; }
  .hero-in { grid-template-columns: 1fr 1fr; align-items: center; gap: 48px; padding-top: 40px; padding-bottom: 48px; }
  .hero-media { max-height: 520px; }
  .hero-title { font-size: 2.5rem; }
  .hero-actions { grid-template-columns: minmax(0, 220px) minmax(0, 260px); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .card-body { padding: 12px 16px 16px; }
  .card-name { font-size: 1rem; }
  .catalog, .combos { padding: 48px 0; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .site-footer { padding-bottom: 36px; }
  .mobile-cart-bar { display: none !important; }
}

@media (min-width: 1140px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .combo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
