/* Qué Alegría! — estilos del menú digital (identidad según manual de marca) */
:root {
  --coral: #ff7f50;
  --coral-dark: #ff5a36;
  --coral-light: #ff9f7c;
  --melon: #ffc3ad;
  --electric: #ff370a;
  --cream: #fbf8f0;
  --cream-2: #f4ece2;
  --cream-3: #ece2d4;
  --brown: #6b3a16;
  --brown-soft: #9a6a45;
  --ink: #454545;
  --yellow: #fed965;
  --durazno: #fee7b1;
  --mint: #8de6cf;
  --mint-light: #c5e6dd;
  --lavender: #efddff;
  --rose: #fbcce2;
  --water: #cbeef0;
  --wa: #25d366;
  --wa-dark: #1ebe5b;
  --shadow: 0 6px 24px rgba(107, 58, 22, 0.10);
  --shadow-sm: 0 2px 10px rgba(107, 58, 22, 0.08);
  --radius: 18px;
  --font-title: 'Titan One', 'Cooper Black', 'Arial Rounded MT Bold', sans-serif;
  --font-sub: 'Andika', 'Trebuchet MS', sans-serif;
  --font-body: 'Syne', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  overflow-x: hidden;
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.45;
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
.title { font-family: var(--font-title); letter-spacing: 0.01em; line-height: 1.05; }
.sub { font-family: var(--font-sub); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap { width: min(100%, 1080px); margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--coral);
  color: var(--cream);
  box-shadow: 0 2px 12px rgba(255, 90, 54, 0.25);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: none; }
.topbar .brand img { height: 44px; width: auto; flex: none; }
.topbar .brand small { font-family: var(--font-sub); font-size: 12px; letter-spacing: 0.22em; text-transform: lowercase; opacity: 0.9; display: none; }
.cart-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  background: var(--cream); color: var(--coral-dark);
  padding: 9px 14px 9px 12px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow-sm); transition: transform 0.15s;
}
.cart-btn:active { transform: scale(0.96); }
.cart-btn svg { width: 20px; height: 20px; }
.cart-btn .badge {
  position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--brown); color: var(--cream); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--coral);
}
.cart-btn .badge[data-n="0"] { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--coral);
  color: var(--cream);
  padding: 28px 0 0;
}
.hero::after {
  content: ''; position: absolute; left: -10%; right: -10%; bottom: -1px; height: 48px;
  background: var(--cream); border-radius: 100% 100% 0 0 / 100% 100% 0 0;
}
.hero .wrap { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; padding-bottom: 64px; }
.hero .logo { width: min(64vw, 320px); height: auto; }
.hero .slogan { font-family: var(--font-sub); font-size: clamp(16px, 4vw, 22px); margin-top: 14px; max-width: 30ch; line-height: 1.3; }
.hero .meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; opacity: 0.95; }
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero .meta svg { width: 16px; height: 16px; }
.hero .mascot { width: clamp(96px, 26vw, 190px); align-self: end; filter: drop-shadow(0 8px 14px rgba(0,0,0,0.12)); }
@media (max-width: 380px) { .hero .mascot { width: 84px; } }

/* ---------- Category nav ---------- */
.catnav {
  position: sticky; top: 64px; z-index: 30;
  background: var(--cream); border-bottom: 1px solid var(--cream-3);
}
.catnav .scroller {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none;
  scroll-padding: 16px; -webkit-overflow-scrolling: touch;
}
.catnav .scroller::-webkit-scrollbar { display: none; }
.chip {
  flex: none; white-space: nowrap; padding: 9px 16px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--cream-3); color: var(--brown);
  font-family: var(--font-sub); font-size: 14px; font-weight: 700; transition: background 0.15s, color 0.15s, transform 0.1s;
}
.chip:active { transform: scale(0.96); }
.chip.active { background: var(--coral); border-color: var(--coral); color: #fff; }

/* ---------- Sections ---------- */
main { padding-bottom: 120px; }
.group-title {
  font-family: var(--font-title); color: var(--coral-dark);
  font-size: clamp(30px, 8vw, 46px); margin: 34px 0 6px; line-height: 1;
}
.group-title:first-child { margin-top: 24px; }
.section { scroll-margin-top: 128px; margin-top: 22px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h3 { font-family: var(--font-title); color: var(--brown); font-size: clamp(22px, 6vw, 30px); }
.section-head .subtitle { font-family: var(--font-sub); color: var(--brown-soft); font-size: 14px; letter-spacing: 0.18em; margin-left: 6px; }
.section-head img { height: 54px; width: auto; opacity: 0.85; }
.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: 16px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; position: relative; transition: transform 0.15s, box-shadow 0.15s;
}
.card:active { transform: scale(0.985); }
.card .media { position: relative; aspect-ratio: 4 / 3; background: var(--cream-2); overflow: hidden; }
.card .media img.photo { width: 100%; height: 100%; object-fit: cover; }
.card .media .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.card .media .placeholder img { width: 62%; height: 62%; object-fit: contain; opacity: 0.9; }
.card .media .ctl { position: absolute; right: 8px; bottom: 8px; }
.card .media .stepper { background: rgba(255,255,255,0.95); box-shadow: var(--shadow-sm); }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h4 { font-family: var(--font-sub); font-weight: 700; color: var(--brown); font-size: 15px; line-height: 1.2; }
.card p { margin: 0; font-size: 12px; color: #6e6e6e; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 6px; gap: 6px; }
.price { font-family: var(--font-title); color: var(--coral-dark); font-size: 17px; letter-spacing: 0.01em; }
.price.ask { font-family: var(--font-sub); font-size: 12px; color: var(--brown-soft); }
.add {
  width: 36px; height: 36px; border-radius: 12px; background: var(--coral); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(255, 90, 54, 0.35);
  transition: transform 0.1s, background 0.15s; flex: none;
}
.add:active { transform: scale(0.9); }
.add svg { width: 20px; height: 20px; }
.stepper {
  display: inline-flex; align-items: center; background: var(--cream-2); border-radius: 12px; height: 36px; overflow: hidden;
}
.stepper button { width: 34px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: var(--coral-dark); font-weight: 700; }
.stepper button svg { width: 16px; height: 16px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; color: var(--brown); font-size: 14px; }
.stepper.lg { height: 44px; border-radius: 14px; }
.stepper.lg button { width: 44px; height: 44px; }
.stepper.lg span { min-width: 32px; font-size: 16px; }

.empty { padding: 60px 20px; text-align: center; color: var(--brown-soft); font-family: var(--font-sub); }
.empty img { width: 120px; margin: 0 auto 12px; }

/* ---------- Footer ---------- */
footer { background: var(--cream-2); margin-top: 40px; padding: 30px 0 40px; color: var(--brown-soft); font-size: 13px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
footer .logo { height: 60px; width: auto; }
footer .slogan { font-family: var(--font-sub); color: var(--brown); font-size: 15px; max-width: 34ch; }
footer a { color: var(--coral-dark); text-decoration: none; font-weight: 700; }
footer .admin-link { opacity: 0.55; font-size: 12px; font-weight: 400; }

/* ---------- Cart bar ---------- */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none; transform: translateY(110%); transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
}
.cartbar.show { transform: none; }
.cartbar button {
  pointer-events: auto; width: min(100%, 560px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  background: var(--brown); color: var(--cream); border-radius: 18px; padding: 14px 18px; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 30px rgba(107, 58, 22, 0.35);
}
.cartbar .count { background: var(--coral); color: #fff; border-radius: 8px; padding: 2px 9px; margin-right: 10px; font-size: 13px; }
.cartbar .total { font-family: var(--font-title); font-size: 18px; }

/* ---------- Sheets / modals ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(69, 40, 20, 0.45); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(100%, 640px);
  background: var(--cream); border-radius: 26px 26px 0 0; max-height: 92dvh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}
.overlay.open .sheet { transform: none; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; transform: translate(0, -46%); border-radius: 26px; max-height: 88vh; }
  .overlay.open .sheet { transform: translate(0, -50%); }
}
.sheet .grab { width: 44px; height: 5px; border-radius: 999px; background: var(--cream-3); margin: 10px auto 0; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 6px; }
.sheet .sheet-head h2 { font-family: var(--font-title); color: var(--brown); font-size: 24px; }
.sheet .close { width: 38px; height: 38px; border-radius: 50%; background: var(--cream-2); display: inline-flex; align-items: center; justify-content: center; color: var(--brown); }
.sheet .close svg { width: 18px; height: 18px; }
.sheet .sheet-body { overflow-y: auto; padding: 4px 20px 20px; }
.sheet .sheet-foot { padding: 12px 20px 16px; border-top: 1px solid var(--cream-3); background: var(--cream); }

/* Product detail */
.detail .media { border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--cream-2); }
.detail .media img.photo { width: 100%; height: 100%; object-fit: cover; }
.detail .media .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.detail .media .placeholder img { width: 50%; height: 50%; object-fit: contain; }
.detail h2 { font-family: var(--font-title); color: var(--brown); font-size: 26px; margin-top: 14px; }
.detail .cat { font-family: var(--font-sub); color: var(--brown-soft); font-size: 13px; letter-spacing: 0.08em; }
.detail p { color: #5a5a5a; font-size: 15px; margin: 10px 0 0; }
.detail .price { font-size: 26px; margin-top: 12px; display: block; }
.detail .price.ask { font-size: 14px; }
.detail .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 15px 18px; border-radius: 16px; font-weight: 700; font-size: 16px; transition: transform 0.1s, filter 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--coral); color: #fff; box-shadow: 0 8px 20px rgba(255, 90, 54, 0.3); }
.btn.wa { background: var(--wa); color: #fff; box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3); }
.btn.ghost { background: var(--cream-2); color: var(--brown); }
.btn svg { width: 22px; height: 22px; }
.btn.sm { width: auto; padding: 10px 14px; font-size: 14px; border-radius: 12px; }

/* Cart */
.cart-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--cream-3); }
.cart-item .thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--cream-2); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cart-item .thumb img.photo { width: 100%; height: 100%; object-fit: cover; }
.cart-item .thumb img.ph { width: 60%; height: 60%; object-fit: contain; }
.cart-item h4 { font-family: var(--font-sub); color: var(--brown); font-size: 15px; font-weight: 700; }
.cart-item .line { font-size: 13px; color: var(--brown-soft); }
.cart-item .line b { color: var(--coral-dark); }
.summary { margin: 14px 0 6px; display: grid; gap: 6px; font-size: 14px; color: var(--brown-soft); }
.summary .row { display: flex; justify-content: space-between; }
.summary .total { font-family: var(--font-title); color: var(--brown); font-size: 20px; border-top: 2px dashed var(--cream-3); padding-top: 10px; margin-top: 4px; }
.summary .total b { color: var(--coral-dark); }
.note { font-size: 12.5px; color: var(--brown-soft); background: var(--durazno); border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.note.warn { background: var(--rose); color: #8a2c4c; }

.form { display: grid; gap: 10px; margin-top: 16px; }
.form h3 { font-family: var(--font-title); color: var(--brown); font-size: 20px; margin-top: 8px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-family: var(--font-sub); font-size: 13px; font-weight: 700; color: var(--brown); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--cream-3); background: #fff; color: var(--ink);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255, 127, 80, 0.2); }
.field input.invalid { border-color: var(--electric); }
.field textarea { resize: vertical; min-height: 64px; }
.err { color: var(--electric); font-size: 13px; font-weight: 700; min-height: 1em; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); z-index: 70;
  background: var(--brown); color: var(--cream); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { background: linear-gradient(90deg, var(--cream-2) 25%, #fff 50%, var(--cream-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
