/* ======================================================
   Comercio El Soconuzco — styles.css
====================================================== */

:root {
  --navy: #1b3a63;
  --navy-deep: #122844;
  --ink: #24262b;
  --paper: #fbf7ec;
  --paper-card: #ffffff;
  --line: #e6dcc2;
  --pencil: #f4b400;
  --pencil-deep: #d99700;
  --crayon-red: #e05d44;
  --chalk-green: #3f8a5c;
  --muted: #6b6a63;
  --header-h: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: linear-gradient(var(--paper), var(--paper)),
    repeating-linear-gradient(0deg, rgba(27,58,99,.05) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(27,58,99,.035) 0 1px, transparent 1px 28px);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

h1, h2, h3, .disp { font-family: 'Baloo 2', 'Space Grotesk', system-ui, sans-serif; }
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--navy-deep); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; text-decoration: none; font-weight: 700; }
.skip-link:focus { left: 0; }

.ruler-strip { height: 10px; width: 100%; background: repeating-linear-gradient(90deg, var(--pencil) 0 26px, var(--crayon-red) 26px 52px, var(--navy) 52px 78px, var(--chalk-green) 78px 104px); }

/* ---------- Header ---------- */
header.site { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--navy-deep); border-bottom: 4px solid var(--pencil); }
.site-inner { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo-badge { background: #fff; border-radius: 8px; padding: 6px 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--pencil-deep); }

/* Ajustes para que tu logo se vea bien sin deformarse */
.brand .logo-badge img {
  height: 45px;
  width: auto;
  object-fit: contain;
}

.cart-btn { display: flex; align-items: center; gap: 8px; background: var(--pencil); color: #2a1a08; border: none; padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: .92rem; cursor: pointer; transition: transform .15s ease, background .15s ease; font-family: 'Inter'; }
.cart-btn:hover { background: var(--pencil-deep); color: #fff; }
.cart-count { background: var(--navy-deep); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; padding: 0 6px; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%); color: #fff; padding: 52px 0 60px; position: relative; overflow: hidden; }
.hero::after { content: "✏️"; position: absolute; right: 30px; top: 20px; font-size: 7rem; opacity: .14; transform: rotate(18deg); pointer-events: none; }
.hero-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.eyebrow-free { display: inline-block; color: var(--navy-deep); font-weight: 700; font-size: .8rem; margin-bottom: 12px; background: var(--pencil); padding: 5px 12px; border-radius: 999px; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.1; margin: 0 0 16px; max-width: 720px; font-weight: 700; }
.hero p { max-width: 560px; color: #dbe3ef; font-size: 1.05rem; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn-primary { background: var(--pencil); color: #2a1a08; border: none; padding: 13px 24px; border-radius: 10px; font-weight: 700; font-size: .98rem; cursor: pointer; text-decoration: none; display: inline-block; transition: background .15s ease; box-shadow: 0 3px 0 var(--pencil-deep); }
.btn-primary:hover { background: #ffce42; transform: translateY(1px); box-shadow: 0 2px 0 var(--pencil-deep); }
.hero-stats { display: flex; gap: 34px; margin-top: 38px; flex-wrap: wrap; }
.hero-stats div { min-width: 110px; }
.hero-stats b { display: block; font-family: 'Baloo 2', 'Space Grotesk'; font-size: 1.5rem; color: var(--pencil); }
.hero-stats span { font-size: .82rem; color: #c7d1e0; }

/* ---------- Filtros ---------- */
.filter-bar { position: sticky; top: var(--header-h); z-index: 20; background: var(--paper); border-bottom: 2px dashed var(--line); padding: 14px 0; }
.filter-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-inner input[type=search] { flex: 1; min-width: 200px; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line); font-family: 'Inter'; font-size: .92rem; background: #fff; }
.chip { border: 1.5px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 999px; font-size: .84rem; cursor: pointer; white-space: nowrap; font-family: 'Inter'; font-weight: 600; }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Catálogo ---------- */
.catalog-section { padding: 36px 0 70px; }
.cat-heading { display: flex; align-items: baseline; justify-content: space-between; margin: 34px 0 16px; gap: 10px; }
.cat-heading h2 { font-size: 1.35rem; margin: 0; color: var(--navy-deep); }
.cat-heading span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.empty-msg { text-align: center; color: var(--muted); padding: 60px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card { background: var(--paper-card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 2px 0 rgba(27,58,99,.05); transition: box-shadow .15s ease, transform .15s ease; position: relative; }
.card:hover { box-shadow: 0 5px 14px rgba(27,58,99,.12); transform: translateY(-2px); }
.card-img { aspect-ratio: 4/3; overflow: hidden; background: #eee; position: relative; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-qty { position: absolute; top: 8px; right: 8px; background: var(--chalk-green); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 3px 9px; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.card-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-body h3 { font-size: .98rem; margin: 0; line-height: 1.3; font-family: 'Inter'; font-weight: 700; color: var(--navy-deep); }

/* CORRECCIÓN DEL ERROR DE LA LÍNEA 92 (agregado el 'line-clamp' estándar) */
.card-body p { 
  font-size: .82rem; 
  color: var(--muted); 
  margin: 0; 
  flex: 1; 
  display: -webkit-box; 
  -webkit-line-clamp: 3; 
  line-clamp: 3; 
  -webkit-box-orient: vertical; 
  overflow: hidden; 
}

.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.unit-tag { font-size: .74rem; color: var(--navy); background: #e8edf5; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.add-btn { border: none; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: .82rem; font-weight: 700; cursor: pointer; transition: background .15s ease; font-family: 'Inter'; }
.add-btn:hover { background: var(--navy-deep); }
.add-btn.added { background: var(--chalk-green); }

/* ---------- Carrito Drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18,30,48,.45); z-index: 45; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 92vw); background: #fff; z-index: 50; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top,0px); padding-bottom: env(safe-area-inset-bottom,0px); border-left: 4px solid var(--pencil); }
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 18px 20px; border-bottom: 2px dashed var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-size: 1.1rem; color: var(--navy-deep); }
.close-btn { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.drawer-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.drawer-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.di-info { flex: 1; min-width: 0; }
.di-info b { font-size: .86rem; display: block; line-height: 1.25; }
.di-info span { font-size: .75rem; color: var(--muted); }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: .9rem; line-height: 1; }
.qty-ctrl span { min-width: 20px; text-align: center; font-size: .85rem; font-weight: 700; }
.remove-x { background: none; border: none; color: var(--crayon-red); font-size: .78rem; cursor: pointer; margin-left: 6px; text-decoration: underline; }
.drawer-empty { padding: 40px 10px; text-align: center; color: var(--muted); font-size: .9rem; }
.drawer-foot { padding: 16px 20px; border-top: 2px dashed var(--line); }
.drawer-foot .count-line { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.btn-checkout { width: 100%; background: var(--pencil); color: #2a1a08; border: none; padding: 14px; border-radius: 10px; font-weight: 700; font-size: .98rem; cursor: pointer; font-family: 'Inter'; box-shadow: 0 3px 0 var(--pencil-deep); }
.btn-checkout:hover { background: #ffce42; }
.btn-clear { width: 100%; background: none; border: none; color: var(--muted); font-size: .8rem; margin-top: 10px; cursor: pointer; text-decoration: underline; }

/* ---------- Modal & Botones de acción ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(18,30,48,.55); z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; padding: 26px 26px 30px; margin-top: 10px; border-top: 5px solid var(--pencil); }
.modal h2 { margin: 0 0 6px; font-size: 1.25rem; color: var(--navy-deep); }
.modal p.sub { color: var(--muted); font-size: .86rem; margin: 0 0 20px; }
.modal label { font-size: .82rem; font-weight: 700; display: block; margin: 12px 0 5px; color: var(--navy-deep); }
.modal input, .modal textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-family: 'Inter'; font-size: .9rem; background: var(--paper); }
.modal input:focus, .modal textarea:focus { outline: none; border-color: var(--navy); }
.modal textarea { resize: vertical; min-height: 70px; }
.summary-list { background: var(--paper); border-radius: 12px; padding: 12px 14px; margin: 16px 0; max-height: 180px; overflow-y: auto; font-size: .82rem; border: 1.5px dashed var(--line); }
.summary-list div { display: flex; justify-content: space-between; padding: 4px 0; gap: 10px; }
.summary-list div span:first-child { flex: 1; }

/* Acciones del Modal (Solo el botón de correo ahora) */
.action-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
.btn-action { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border: none; border-radius: 10px; font-weight: 700; font-size: .95rem; cursor: pointer; transition: opacity .15s; font-family: 'Inter'; }
.btn-action:hover { opacity: 0.9; }
.btn-action span { font-size: 1.2rem; }
.btn-email { background: var(--navy); color: #fff; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-cancel { width: 100%; background: none; border: 1.5px solid var(--line); padding: 13px 18px; border-radius: 10px; cursor: pointer; font-weight: 700; color: var(--muted); }

/* ---------- Footer ---------- */
footer { background: var(--navy-deep); color: #cdd6e4; padding: 40px 0 30px; margin-top: 40px; position: relative; }
.foot-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-inner h3 { color: #fff; font-size: 1rem; margin: 0 0 10px; }
.foot-inner p, .foot-inner a { font-size: .85rem; color: #b7c2d4; text-decoration: none; }
.foot-inner a:hover { text-decoration: underline; }
.foot-bottom { text-align: center; font-size: .76rem; color: #8595ad; margin-top: 30px; }

/* ---------- FAB Móvil ---------- */
.fab-cart { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom,0px)); right: 18px; z-index: 35; background: var(--pencil); color: #2a1a08; border: none; width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; font-size: 1.3rem; display: none; align-items: center; justify-content: center; }
.fab-count { position: absolute; top: -4px; right: -4px; background: var(--crayon-red); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid #fff; }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom,0px)); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; max-width: 90vw; }
.toast { background: var(--navy-deep); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .88rem; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.3); display: flex; align-items: center; gap: 10px; animation: toastIn .25s ease forwards; pointer-events: auto; }
.toast.success { background: var(--chalk-green); }
.toast.error { background: var(--crayon-red); }
.toast.info { background: var(--navy); }
.toast.hide { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px); } }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .fab-cart { display: flex; }
  .site-inner .cart-btn { display: none; }
  .brand .logo-badge img { height: 35px; }
  .hero-stats { gap: 22px; }
  .hero { padding: 40px 0 46px; }
  .filter-inner { padding: 0 16px; }
  .wrap, .hero-inner { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}