/* ============================================================
   La Cachapera · Carta 2026
   Colores de marca:  #f2cd27 (amarillo) · #333333 (oscuro) · #FFF
   Fuentes: Rockinsoda (titular), Bebas Neue (impacto), Cabin (texto)
   ============================================================ */

/* --- Fuente local: Rockinsoda --- */
@font-face {
  font-family: 'Rockinsoda';
  src: url('../fonts/Rockinsoda.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens --- */
:root {
  --c-yellow: #f2cd27;
  --c-yellow-soft: #fde87a;
  --c-dark: #333333;
  --c-dark-2: #1f1f1f;
  --c-white: #ffffff;
  --c-mist: #f7f6f1;
  --c-border: rgba(242, 205, 39, 0.55);
  --c-shadow: 0 4px 18px rgba(0,0,0,0.08);
  --c-shadow-strong: 0 10px 30px rgba(0,0,0,0.16);

  --f-display: 'Rockinsoda', 'Bebas Neue', sans-serif;
  --f-impact:  'Bebas Neue', 'Rockinsoda', sans-serif;
  --f-body:    'Cabin', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;

  --topbar-h: 64px;
  --catnav-h: 54px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  color: var(--c-dark);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}
/* Fondo global con Fondo_Nuevo + overlay blanco casi opaco
   para que la imagen aparezca suave detrás de los huecos entre cards. */
body {
  background-color: var(--c-mist);
  background-image:
    linear-gradient(rgba(255,255,255,0.88), rgba(255,255,255,0.94)),
    url('../../img/Fondo_Nuevo%20-%20La%20Cachapera%202026.png');
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   Loader
   ============================================================ */
.loader {
  position: fixed;
  inset: 0;
  background: var(--c-dark);
  display: grid;
  place-items: center;
  z-index: 9999;
  transition: opacity .5s ease, visibility .5s ease;
}
.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader__maiz {
  width: 110px;
  height: 110px;
  filter: drop-shadow(0 0 24px rgba(242,205,39,.45));
  animation: maizPulse 1.3s ease-in-out infinite;
}
@keyframes maizPulse {
  0%, 100% { transform: scale(1) rotate(-4deg); }
  50%      { transform: scale(1.08) rotate(4deg); }
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--c-dark);
  background-image: url('../../img/Fondo_Nuevo%20-%20La%20Cachapera%202026.png');
  background-size: cover;
  background-position: center;
  background-blend-mode: multiply;
  box-shadow: var(--c-shadow);
  border-bottom: 2px solid var(--c-yellow);
}
.topbar__logo img {
  height: 42px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
}

/* Idioma */
.topbar__lang { position: relative; }
.lang-current {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c-yellow);
  border: 2px solid var(--c-white);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform .15s ease;
}
.lang-current:hover { transform: scale(1.05); }
.lang-menu {
  list-style: none; margin: 0; padding: 6px;
  position: absolute; right: 0; top: calc(100% + 10px);
  background: var(--c-white);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  box-shadow: var(--c-shadow-strong);
  min-width: 170px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.topbar__lang.is-open .lang-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.lang-menu li button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--f-body);
  font-weight: 500;
  color: var(--c-dark);
}
.lang-menu li button:hover { background: var(--c-mist); }

/* Flags (SVG inyectados por JS en div.flag) */
.flag {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: #ddd;
  flex: 0 0 auto;
}
.flag svg { width: 100%; height: 100%; display: block; }

/* ============================================================
   Hero / Carrusel
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--c-dark);
  /* Ocupa >50% del viewport manteniendo un mínimo en móvil y un tope en pantallas grandes */
  min-height: clamp(420px, 58vh, 700px);
}
.hero__track {
  display: flex;
  transition: transform .5s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
  height: 100%;
}
.hero__slide {
  flex: 0 0 100%;
  min-height: clamp(420px, 58vh, 700px);
  padding: 36px 22px 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  color: var(--c-white);
  background-color: var(--c-dark);
  background-size: cover;
  background-position: center;
  position: relative;
}
.hero__slide::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.65) 100%);
  pointer-events: none;
}
.hero__slide > * { position: relative; z-index: 1; }
.hero__title {
  font-family: var(--f-display);
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: .95;
  letter-spacing: .02em;
  color: var(--c-yellow);
  margin: 0 0 10px;
  text-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.hero__subtitle {
  font-family: var(--f-body);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  max-width: 560px;
  margin: 0 0 22px;
  line-height: 1.45;
}
.hero__ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  font-family: var(--f-impact);
  font-size: 1.1rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.hero__cta--primary {
  background: var(--c-yellow);
  color: var(--c-dark);
  box-shadow: 0 6px 18px rgba(242,205,39,.35);
}
.hero__cta--secondary {
  background: transparent;
  color: var(--c-white);
  border: 2px solid var(--c-yellow);
}
.hero__cta:hover { transform: translateY(-2px); }

.hero__dots {
  position: absolute;
  bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
  z-index: 2;
}
.hero__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  transition: width .2s ease, background .2s ease;
}
.hero__dot.is-active {
  background: var(--c-yellow);
  width: 26px;
  border-radius: 6px;
}

/* ============================================================
   Category nav (chips horizontales, sticky)
   ============================================================ */
.catnav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 45;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.catnav__track {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  height: var(--catnav-h);
  align-items: center;
}
.catnav__track::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--c-mist);
  color: var(--c-dark);
  font-family: var(--f-impact);
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: background .18s, color .18s, border-color .18s;
  white-space: nowrap;
}
.chip:hover { background: var(--c-yellow-soft); }
.chip.is-active {
  background: var(--c-yellow);
  color: var(--c-dark);
  border-color: var(--c-dark);
}

/* ============================================================
   Menu
   ============================================================ */
.menu {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 16px 60px;
}
.section {
  margin-bottom: 44px;
  scroll-margin-top: calc(var(--topbar-h) + var(--catnav-h) + 10px);
}
.section__title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  letter-spacing: .03em;
  color: var(--c-dark);
  margin: 0 0 18px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--c-yellow);
  display: inline-block;
}

/* En móvil: 2 columnas fijas, huecos ajustados.
   A partir de 640px: auto-fill con mínimo de 230px. */
.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
}

/* ============================================================
   Card de producto
   ============================================================ */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  position: relative;
}
.card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--c-shadow-strong);
  border-color: var(--c-yellow);
}
.card__imgwrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--c-mist);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.card:hover .card__img { transform: scale(1.04); }
.card__fallback {
  width: 70px; height: 70px;
  opacity: .5;
}
.card__tags {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; gap: 6px;
  flex-wrap: wrap;
  max-width: 85%;
  z-index: 1;
}
.tag {
  font-family: var(--f-impact);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--c-yellow);
  color: var(--c-dark);
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.tag--nuevo          { background: #ff7a59; color: #fff; }
.tag--sin-gluten     { background: #5fc27a; color: #fff; }
.tag--recomendacion-casa { background: var(--c-dark); color: var(--c-yellow); }

.card__body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.card__title {
  font-family: var(--f-impact);
  font-size: 1.25rem;
  letter-spacing: .02em;
  line-height: 1.05;
  margin: 0;
  color: var(--c-dark);
  flex: 1;
}
.card__price {
  font-family: var(--f-impact);
  font-size: 1.3rem;
  color: var(--c-dark);
  background: var(--c-yellow);
  padding: 4px 10px;
  border-radius: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.card__desc {
  font-size: .92rem;
  color: #555;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__allergens {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}
.allergen-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-dark);
  padding: 4px;
  color: var(--c-yellow);
}
.allergen-icon svg { width: 100%; height: 100%; display: block; fill: currentColor; }

/* ============================================================
   Modal
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal__card {
  position: relative;
  max-width: 640px;
  width: calc(100% - 24px);
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  overflow: hidden;
  background: var(--c-white);
  border: 1px solid var(--c-yellow);
  border-radius: var(--r-xl);
  box-shadow: var(--c-shadow-strong);
  transform: translateY(20px) scale(.98);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}
.modal.is-open .modal__card { transform: translateY(0) scale(1); }
.modal__close {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  font-size: 1.6rem;
  line-height: 1;
  border-radius: 50%;
  background: var(--c-yellow);
  color: var(--c-dark);
  z-index: 2;
}
.modal__body {
  overflow-y: auto;
  padding: 0;
}

/* Contenido dentro del modal */
.pd__hero {
  position: relative;
  aspect-ratio: 16/10;
  background: var(--c-mist);
  display: grid;
  place-items: center;
}
.pd__hero img { width: 100%; height: 100%; object-fit: cover; }
.pd__hero .card__fallback { width: 100px; height: 100px; opacity: .55; }
.pd__content { padding: 18px 20px 22px; }
.pd__title {
  font-family: var(--f-display);
  font-size: 2rem;
  margin: 0 0 6px;
  color: var(--c-dark);
  line-height: 1;
}
.pd__price {
  display: inline-block;
  font-family: var(--f-impact);
  font-size: 1.4rem;
  background: var(--c-yellow);
  padding: 4px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.pd__desc { font-size: 1rem; line-height: 1.5; color: #444; margin: 0 0 18px; }

.pd__section {
  border-top: 1px solid var(--c-border);
  padding-top: 14px;
  margin-top: 14px;
}
.pd__section h4 {
  font-family: var(--f-impact);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--c-dark);
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.pd__allergens { display: flex; gap: 10px; flex-wrap: wrap; }
.pd__allergen {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--c-mist);
  border: 1px solid var(--c-border);
}
.pd__allergen .allergen-icon { width: 22px; height: 22px; padding: 3px; }
.pd__allergen span {
  font-size: .9rem;
  text-transform: capitalize;
}

.pd__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pd__list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(0,0,0,.08);
  font-size: .95rem;
}
.pd__list li:last-child { border-bottom: none; }
.pd__list .pd__list-name { flex: 1; padding-right: 10px; }
.pd__list .pd__list-price {
  font-family: var(--f-impact);
  color: var(--c-dark);
  background: var(--c-yellow);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .9rem;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  text-align: center;
  padding: 28px 16px 36px;
  background: var(--c-dark);
  color: var(--c-white);
  border-top: 3px solid var(--c-yellow);
}
.footer__maiz { width: 60px; margin: 0 auto 8px; opacity: .85; }
.footer__brand {
  font-family: var(--f-display);
  color: var(--c-yellow);
  font-size: 2rem;
  margin: 0 0 4px;
  letter-spacing: .04em;
}
.footer__small { margin: 0; font-size: .85rem; opacity: .8; }

/* ============================================================
   Utilidades
   ============================================================ */
.is-hidden { display: none !important; }

/* ============================================================
   Botón "back to top"
   ============================================================ */
.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--c-yellow);
  color: var(--c-dark);
  border: 2px solid var(--c-dark);
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
  font-size: 1.4rem;
  line-height: 1;
  z-index: 70;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.to-top:hover { transform: translateY(-2px); }
.to-top svg { width: 20px; height: 20px; }

/* ============================================================
   Ajustes para móviles
   ============================================================ */
@media (max-width: 639px) {
  :root { --topbar-h: 56px; --catnav-h: 48px; }
  .topbar__logo img { height: 34px; }
  .menu { padding: 14px 10px 60px; }

  /* Cards compactas en móvil */
  .card { border-radius: 16px; }
  .card__body { padding: 10px 10px 12px; gap: 6px; }
  .card__head { gap: 6px; }
  .card__title { font-size: .98rem; line-height: 1.05; letter-spacing: 0; }
  .card__price { font-size: .92rem; padding: 3px 7px; border-radius: 8px; }
  .card__desc {
    font-size: .78rem;
    line-height: 1.3;
    -webkit-line-clamp: 2;
  }
  .card__tags { top: 6px; left: 6px; gap: 4px; max-width: 90%; }
  .tag { font-size: .58rem; padding: 3px 6px; letter-spacing: .04em; }
  .card__allergens { gap: 4px; padding-top: 6px; }
  .allergen-icon { width: 20px; height: 20px; padding: 3px; }

  .section { margin-bottom: 28px; }
  .section__title { font-size: 1.8rem; margin-bottom: 12px; }

  /* Hero — recalculamos paddings para no tener texto pegado */
  .hero__slide { padding: 28px 18px 46px; }
  .hero__title  { font-size: clamp(2.2rem, 10vw, 3.6rem); }
  .hero__subtitle { font-size: .95rem; margin-bottom: 18px; }
  .hero__cta { font-size: 1rem; padding: 10px 16px; }
}
