/* ============ Tokens ============ */
:root {
  --cream: #F7F2E9;
  --paper: #FFFDF9;
  --ink: #2A2419;
  --olive: #3F4A2F;
  --olive-deep: #2F3823;
  --copper: #B4642F;
  --gold: #C79432;
  --line: #E3DCCB;
  --muted: #837D6C;
  --white: #FFFFFF;
  --danger: #A6412E;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(42,36,25,.07);
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "Instrument Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: 96px; /* room for the sticky bar */
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ============ Header ============ */
.site-header {
  background:
    radial-gradient(1200px 300px at 50% -80px, rgba(199,148,50,.14), transparent),
    var(--cream);
  border-top: 6px solid var(--olive);
  padding: 18px 0 22px;
  text-align: center;
}

/* Desplegable de idioma (mismo componente que en el admin) */
.lang-dd { position: relative; width: max-content; margin-left: auto; margin-bottom: 14px; font-size: 12px; }
.lang-dd summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; font-weight: 600; letter-spacing: .06em; color: var(--muted);
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper);
}
.lang-dd summary::-webkit-details-marker { display: none; }
.lang-dd .caret { font-size: 9px; }
.lang-dd .flag { width: 17px; height: 11px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(42,36,25,.15); flex: 0 0 auto; }
.lang-menu {
  position: absolute; right: 0; margin-top: 6px; min-width: 90px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.1); padding: 6px; z-index: 30;
  display: flex; flex-direction: column; gap: 2px;
}
.lang-menu a {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--ink);
}
.lang-menu a:hover { background: var(--cream); }
.lang-menu a.on { background: var(--olive); color: #fff; }
.langs a.on .flag { box-shadow: 0 0 0 1px rgba(255,255,255,.45); }

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(32px, 7vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.tagline { margin-top: 6px; color: var(--olive-deep); font-weight: 500; }

.pickup-note {
  margin-top: 12px; display: inline-block;
  font-size: 13px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 999px; padding: 6px 14px;
  background: var(--paper);
}

/* ============ Tabs de categorías (sticky) ============ */
.cat-tabs {
  position: sticky; top: 0; z-index: 15;
  background: rgba(247,242,233,.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.tabs-wrap { position: relative; }
.tabs-inner {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  padding: 10px 0;
  scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }

/* Affordance de scroll: fundido en los bordes + flechas, solo cuando hay más tabs en esa dirección */
.tabs-wrap::before, .tabs-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 46px;
  pointer-events: none; opacity: 0; transition: opacity .15s ease; z-index: 1;
}
.tabs-wrap::before { left: 0; background: linear-gradient(90deg, var(--cream) 30%, rgba(247,242,233,0)); }
.tabs-wrap::after { right: 0; background: linear-gradient(270deg, var(--cream) 30%, rgba(247,242,233,0)); }
.tabs-wrap.can-left::before, .tabs-wrap.can-right::after { opacity: 1; }

.tabs-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 28px; height: 28px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); color: var(--olive-deep);
  font-size: 18px; line-height: 26px; text-align: center; cursor: pointer;
  box-shadow: var(--shadow);
  display: none;
}
.tabs-arrow.prev { left: 4px; }
.tabs-arrow.next { right: 4px; }
.tabs-wrap.can-left .tabs-arrow.prev { display: block; }
.tabs-wrap.can-right .tabs-arrow.next { display: block; }
.tab {
  flex: 0 0 auto;
  font-family: var(--body); font-size: 14px; font-weight: 600;
  color: var(--olive-deep);
  background: var(--paper);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; white-space: nowrap;
}
.tab.on { background: var(--olive); border-color: var(--olive); color: var(--white); }
.tab.bestsellers { border-color: var(--copper); color: var(--copper); font-weight: 600; }
.tab.bestsellers.on { background: var(--copper); border-color: var(--copper); color: #fff; }

/* ============ Secciones y cards ============ */
.menu-section { margin-top: 26px; }
.menu-section[hidden] { display: none; }

.cat {
  font-family: var(--display);
  font-weight: 700; font-size: 15px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 14px;
}

.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }

.dish-card {
  display: flex; gap: 0; overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.dish-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(42,36,25,.12); }
.dish-card.selected { outline: 2px solid var(--gold); outline-offset: -2px; }

.card-media {
  flex: 0 0 108px; min-height: 116px; position: relative;
  background: linear-gradient(135deg, var(--olive), var(--olive-deep));
}
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 800; font-size: 34px; color: rgba(255,255,255,.85);
}

.card-body { flex: 1; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; }

.card-name { font-family: var(--display); font-weight: 700; font-size: 16.5px; line-height: 1.25; }

.card-desc {
  font-size: 13.5px; color: var(--muted); margin-top: 4px;
  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: 10px; }

.price { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--copper); }

.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper[hidden] { display: none; }
.step {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--olive); background: var(--paper); color: var(--olive);
  font-size: 19px; line-height: 1; cursor: pointer;
}
.step:active { background: var(--olive); color: var(--white); }
.qty { min-width: 18px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper.big .step { width: 40px; height: 40px; font-size: 22px; }
.stepper.big .qty { font-size: 18px; min-width: 24px; }

/* ============ Sticky order bar ============ */
.order-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--olive-deep); color: var(--white);
  padding: 12px 0; box-shadow: 0 -6px 24px rgba(42,36,25,.18);
}
.bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bar-info strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.bar-info small { display: block; opacity: .75; font-size: 12px; }

.btn-primary {
  background: var(--copper); color: var(--white);
  border: none; border-radius: 999px;
  font-family: var(--body); font-weight: 600; font-size: 16px;
  padding: 13px 26px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-primary:active { filter: brightness(.94); }
.btn-primary.wide { width: 100%; margin-top: 18px; text-align: center; }
.btn-ghost {
  background: none; border: none; width: 100%;
  color: var(--muted); font-size: 14px; margin-top: 10px; padding: 8px; cursor: pointer;
}

/* ============ Overlays (detalle + checkout) ============ */
.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(42,36,25,.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--paper); width: 100%; max-width: 560px;
  border-radius: 18px 18px 0 0; padding: 26px 22px 30px;
  max-height: 92vh; overflow-y: auto;
}
@media (min-width: 600px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; }
}
.sheet h2 { font-family: var(--display); font-weight: 700; font-size: 24px; margin-bottom: 6px; }

/* ---- Panel de detalle ---- */
.sheet-detail { padding: 0; position: relative; }
.close-x {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: rgba(42,36,25,.55); color: var(--white);
  font-size: 22px; line-height: 1; cursor: pointer;
}

.carousel { position: relative; overflow: hidden; border-radius: 18px 18px 0 0; background: var(--olive-deep); }
.carousel[hidden] { display: none; }
.carousel-track { display: flex; transition: transform .25s ease; }
.carousel-track img {
  flex: 0 0 100%; width: 100%; height: 260px; object-fit: cover; display: block;
}
.car-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,253,249,.85); color: var(--ink);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.car-nav.prev { left: 10px; }
.car-nav.next { right: 10px; }
.carousel.single .car-nav, .carousel.single .car-dots { display: none; }
.car-dots {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; gap: 6px; justify-content: center;
}
.car-dots button {
  width: 8px; height: 8px; border-radius: 50%; border: none;
  background: rgba(255,253,249,.5); cursor: pointer; padding: 0;
}
.car-dots button.on { background: var(--white); }

.detail-body { padding: 20px 22px 26px; }
.detail-price { color: var(--copper); font-weight: 600; font-size: 18px; margin-top: 4px; }
.detail-desc { color: var(--muted); font-size: 14.5px; margin-top: 12px; white-space: pre-line; }

/* ---- Composición del menú (apartados con radios) ---- */
.course { margin-top: 20px; }
.course h3 {
  font-family: var(--display); font-weight: 700; font-size: 13px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--copper);
  margin-bottom: 8px;
}
.course.missing h3 { color: var(--danger); }
.course.missing .opt { border-color: #E4BDB2; }
.course .opt {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 6px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--ink);
  font-size: 14.5px; font-weight: 400; cursor: pointer;
}
.course .opt:has(input:checked) { border-color: var(--olive); background: #F0F2E8; }
.course .opt input[type="radio"] {
  width: 16px; height: 16px; margin: 0; flex: 0 0 auto;
  accent-color: var(--olive);
}
.opt-photo {
  width: 52px; height: 44px; border-radius: 8px; object-fit: cover;
  flex: 0 0 auto; background: var(--olive-deep);
}
.opt-text { display: flex; flex-direction: column; min-width: 0; }
.opt-name { font-weight: 500; line-height: 1.3; }
.opt-desc {
  color: var(--muted); font-size: 12.5px; margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.dd-error { color: var(--danger); font-size: 13.5px; margin-top: 12px; }
.detail-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 22px;
}
.detail-actions .btn-primary { flex: 1; }

/* ---- Formulario del checkout ---- */
.sheet label { display: block; font-size: 13px; font-weight: 600; color: var(--olive-deep); margin: 16px 0 6px; }
.sheet select, .sheet input {
  width: 100%; padding: 12px 14px; font-size: 16px; font-family: var(--body);
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink);
}
.sheet select:focus, .sheet input:focus { outline: 2px solid var(--olive); outline-offset: 1px; }
.sheet textarea {
  width: 100%; padding: 12px 14px; font-size: 16px; font-family: var(--body);
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--white);
  color: var(--ink); resize: vertical;
}
.sheet textarea:focus { outline: 2px solid var(--olive); outline-offset: 1px; }

.hint { font-size: 13px; color: var(--muted); margin-top: 14px; }

.error {
  background: #F7E5E0; color: var(--danger);
  border: 1px solid #E4BDB2; border-radius: 10px;
  padding: 10px 14px; font-size: 14px; margin-top: 12px;
}

/* ============ Confirmation pages ============ */
.page-center { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.card-msg { text-align: center; max-width: 440px; }
.card-msg .mark {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; color: var(--white);
}
.mark.ok { background: var(--olive); }
.mark.ko { background: var(--danger); }
.card-msg h1 { font-family: var(--display); font-weight: 700; font-size: 30px; margin-bottom: 10px; }
.card-msg p { color: var(--muted); margin-bottom: 24px; }
.powered { font-size: 12px; margin-top: 28px; }

.site-footer { text-align: center; padding: 44px 0 20px; font-size: 12px; color: var(--muted); }
.site-footer a, .powered a { color: inherit; text-decoration: none; }
.site-footer a:hover, .powered a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: rise .22s ease-out; }
  @keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
