/* =========================================================================
   COFAINE — Carta QR
   Réplica de la carta de cofaine.pe (antes en Squarespace), con cabecera
   propia: logo centrado + selector de idioma siempre visible.
   ========================================================================= */

/* --- Tipografía ---------------------------------------------------------
   El sitio original usa Aktiv Grotesk (Adobe Fonts). Como Adobe no permite
   redistribuir el kit, aquí se sirve Archivo (SIL OFL, la neo-grotesca libre
   más cercana) auto-hospedada. Si se contrata un proyecto web de Adobe Fonts
   para cofaine.pe, basta con añadir su <link> en build.mjs: la familia
   'aktiv-grotesk' ya va primero en la pila y tomará el control sola.
   -------------------------------------------------------------------- */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --negro: #000000;      /* fondo base del documento */
  --carbon: #121212;     /* secciones oscuras */
  --crema-barra: #f5f4eb;/* barra de anuncio */
  --crema: #f9f1e1;      /* fondo de las cartas */
  --morado: #c28eff;     /* acento Cofaine */
  --blanco: #ffffff;

  --fuente: 'aktiv-grotesk', 'Archivo', system-ui, -apple-system,
    'Helvetica Neue', Arial, sans-serif;

  /* Ancho de columna: 88% en móvil (igual que el original) */
  --col: 88vw;

  /* Escala tipográfica fluida, calcada de los tamaños medidos en el sitio
     original (375px, 1200px y 1920px de ancho de ventana). */
  --fs-h3: clamp(25.6px, 23.6px + 0.56vw, 37.6px);
  --fs-h2: clamp(33.28px, 30.15px + 0.9vw, 55px);
  --fs-item: clamp(17.9px, 17.53px + 0.113vw, 20.4px);
  --fs-base: 16px;
}

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

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

body {
  margin: 0;
  /* Columna a pantalla completa: así la sección de contenido llena el alto
     aunque la carta sea corta, y no asoma el fondo negro del documento. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--negro);
  color: var(--blanco);
  font-family: var(--fuente);
  font-size: var(--fs-base);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------------------------------------------------- Barra de anuncio -- */
.announce {
  position: relative;
  z-index: 10000;
  background: var(--crema-barra);
  color: var(--negro);
}
.announce[hidden] { display: none; }
.announce__text {
  padding: 10.4px 39px;
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
}
.announce__text p { margin: 0; }
.announce__close {
  position: absolute;
  top: 0; right: 0;
  width: 36.4px; height: 36.1px;
  display: flex; align-items: center; justify-content: center;
  border: 0; padding: 0;
  background: none;
  color: var(--negro);
  font: inherit; font-size: 17px; line-height: 1;
  cursor: pointer;
}

/* ------------------------------------------------------------- Cabecera -- */
.header--dark { background: var(--carbon); color: var(--blanco); }
.header--cream { background: var(--crema); color: var(--negro); }

.header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}
.header__side { display: flex; align-items: center; min-width: 0; }

.header__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--morado);
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
}
.header__back:hover { text-decoration: underline; text-underline-offset: 3px; }
.header__back-text { display: none; }  /* en móvil sólo la flecha */

.header__logo { display: block; justify-self: center; text-decoration: none; }

/* El logo original es blanco sobre transparente: se usa como máscara para
   poder pintarlo del color del texto (blanco en oscuro, negro en crema). */
.logo {
  display: block;
  width: 129px; height: 16px;
  background-color: currentColor;
  -webkit-mask: url('/assets/img/logo.png') center / contain no-repeat;
  mask: url('/assets/img/logo.png') center / contain no-repeat;
}
@supports not (mask-image: url('/assets/img/logo.png')) {
  @supports not (-webkit-mask-image: url('/assets/img/logo.png')) {
    .logo {
      width: auto; height: auto;
      background: none;
      font-size: 15px; font-weight: 700; letter-spacing: .32em;
    }
    .logo::after { content: 'COFAINE'; }
  }
}

.header__lang {
  justify-content: flex-end;
  gap: 6px;
  font-size: 14px;
  line-height: 1;
}
.header__lang-item {
  text-decoration: none;
  opacity: .55;
  transition: opacity .2s ease, color .2s ease;
}
.header__lang-item:hover { opacity: 1; color: var(--morado); }
.header__lang-item[aria-current] {
  opacity: 1;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.header__lang-sep { opacity: .35; }

/* ------------------------------------------------------------ Secciones -- */
.section { position: relative; flex: 1; }
.section--dark { background: var(--carbon); color: var(--blanco); }

/* Mismo fondo que nps.cofaine.pe y el ERP: radial morado, sutil, arriba al
   centro. Valores literales (no color-mix) a propósito, igual que allá, para
   que se vea idéntico en cualquier navegador. Se pinta en el <body> para que
   el degradado cruce cabecera y contenido sin costura. */
.page--indice {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(109, 40, 217, .28) 0%, rgba(109, 40, 217, 0) 60%),
    var(--carbon);
}
.page--indice .header--dark,
.page--indice .section--dark { background: transparent; }
.section--cream { background: var(--crema); color: var(--negro); }

.wrap {
  width: var(--col);
  margin-inline: auto;
}

/* ------------------------------------------------ Botones tipo Cofaine -- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 59px;
  padding: 0 37.4px;
  border-radius: 300px;
  border: 2px solid transparent;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  transition: opacity .2s ease;
}
.btn:hover { opacity: .85; }
.btn--primary { background: var(--morado); color: var(--carbon); border-color: var(--morado); }
.btn--secondary { background: transparent; color: var(--morado); border-color: var(--morado); }

/* ======================================== Índices de carta (ES / EN) ==== */
/* Rediseñado: las tres categorías y el enlace al NPS entran en una sola
   pantalla de móvil, sin scroll. La tarjeta completa es el enlace. */

.section--center { display: flex; align-items: center; }

.indice {
  padding: 28px 0 36px;
  width: min(var(--col), 1100px);
}

.indice__title {
  margin: 0 0 24px;
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.344;
  letter-spacing: 0.01em;
  text-align: center;
  color: var(--blanco);
}

.cats { display: grid; gap: 12px; }

.cat {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 20px 24px;
  border-radius: 16px;
  background: var(--blanco);
  color: var(--negro);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cat:hover { box-shadow: 0 0 0 2px var(--morado); }
.cat:active { transform: scale(.985); }
.cat:focus-visible { outline: 3px solid var(--morado); outline-offset: 3px; }

.cat__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cat__title {
  font-size: clamp(24px, 19.5px + 1.2vw, 34px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.cat__meta { font-size: 13px; line-height: 1.45; color: #5a5a5a; }

.cat__go {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--morado);
  color: var(--carbon);
}
.cat__go svg { width: 22px; height: 22px; display: block; }

.indice__nps {
  display: block;
  margin: 20px auto 0;
  width: fit-content;
  padding: 12px 26px;
  border: 1.5px solid rgba(194, 142, 255, .5);
  border-radius: 300px;
  color: var(--morado);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease;
}
.indice__nps:hover { border-color: var(--morado); background: rgba(194, 142, 255, .12); }

/* ================================================= Cartas (menu block) == */
.carta { padding: 26.8px 0 40px; }

.carta__heading {
  min-height: 59px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 11px;
}
.carta__heading h1 {
  margin: 0;
  /* El original conserva los espacios dobles de títulos como "T É  Y  M Á S" */
  white-space: pre-wrap;
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.2993;
  letter-spacing: 0.01em;
  text-align: center;
}

/* --- Selector de pestañas -----------------------------------------------
   Las pestañas van agrupadas de 3 en 3. En móvil cada grupo es una página
   que se pasa deslizando (scroll-snap) o tocando los puntos; en escritorio
   los grupos se aplanan en una sola fila y los puntos desaparecen.
   ---------------------------------------------------------------------- */
.tabs { margin: 0 0 40px; }

.tabs__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs__track::-webkit-scrollbar { display: none; }

.tabs__page {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
}

.tabs__tab {
  padding: 8px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  /* Se achica lo justo para que las tres del grupo entren en una línea
     incluso en pantallas de 320 px */
  font-size: clamp(12px, 3.8vw, 15px);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.tabs__tab[aria-selected='true'] {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.tabs__dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
}
.tabs__dot {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 0; padding: 0;
  background: none;
  cursor: pointer;
}
.tabs__dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .28;
  transition: opacity .2s ease, background-color .2s ease, transform .2s ease;
}
.tabs__dot[aria-current='true']::before {
  opacity: 1;
  background: var(--morado);
  transform: scale(1.15);
}

.panel[hidden] { display: none; }

.menu-section { margin-top: 56px; }
.menu-section:first-child { margin-top: 16px; }
.menu-section__header { margin-bottom: 24px; padding-bottom: 16px; }
.menu-section__title {
  margin: 0;
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-align: center;
}
.menu-section__desc { margin: 0; font-size: 16px; line-height: 1.8; text-align: center; }

/* Los productos fluyen en columnas: se llena la primera de arriba abajo y
   sigue en la siguiente. Una columna en móvil, dos en tablet, tres a partir
   de 1024px. */
.menu-items { column-gap: 48px; }

.menu-item {
  padding-bottom: 20px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}
.menu-item::after { content: ''; display: table; clear: both; }
.menu-item__price {
  float: right;
  padding-left: 20px;
  font-size: 16px;
  line-height: 1.5;
}
.menu-item__name {
  margin: 0;
  font-size: var(--fs-item);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
}
.menu-item__desc {
  margin: 4px 24px 0 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- Pie --- */
/* Mismo remate que nps.cofaine.pe. El fondo se pinta en el <body> (no en la
   sección) para que el pie quede sobre el color de la página y no sobre el
   negro del documento. */
.page--carta { background: var(--crema); }

.foot {
  margin-top: auto;
  padding: 18px 0 calc(18px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11.5px;
  line-height: 1.6;
}
.page--indice .foot { color: rgba(255, 255, 255, .42); }
.page--carta .foot { color: rgba(0, 0, 0, .40); }

/* ------------------------------------------------------------- Pop-up --- */
.popup[hidden] { display: none; }
.popup {
  position: fixed;
  inset: 0;
  z-index: 11000;
  pointer-events: none;
}
/* En móvil es una hoja inferior: esquinas redondeadas, sombra que la despega
   del contenido, asa para arrastrarla hacia abajo y respeto por el área segura
   del iPhone (la barra de gestos se comía el botón). */
.popup__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: var(--blanco);
  color: var(--negro);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .28);
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  pointer-events: auto;
  touch-action: none;
  animation: popup-up .45s cubic-bezier(.22, .61, .36, 1) both;
}
@keyframes popup-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .popup__panel { animation: none; }
}

/* Asa: señala que la hoja se arrastra hacia abajo para cerrarla */
.popup__grip {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .18);
}

.popup__media { display: none; }

.popup__title {
  margin: 12px 44px 8px 0;   /* deja libre la esquina del aspa */
  font-size: 23px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--negro);
}
.popup__body {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: .2px;
  color: #4a4a4a;
}
.popup__cta {
  display: block;
  margin-top: 18px;
  padding: 15px;
  border-radius: 999px;
  background: #222222;
  color: var(--blanco);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .6px;
  text-align: center;
  text-decoration: none;
}
.popup__cta:active { opacity: .85; }

.popup__close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .06);
  color: #3a3a3a;
  font: inherit; font-size: 20px; line-height: 1;
  cursor: pointer;
}
.popup__close:active { background: rgba(0, 0, 0, .12); }

/* =========================================== Tablet: 2 columnas (≥640) === */
@media (min-width: 640px) {
  .menu-items { columns: 2; }

  /* Fuera del móvil se recupera el aire del original */
  .menu-item { padding-bottom: 32px; }
  .menu-item__price { line-height: 1.8; }
  .menu-item__desc { margin-top: 5px; line-height: 1.8; }
  .menu-section { margin-top: 80px; }
  .menu-section__header { margin-bottom: 32px; }
}

/* ================================================== Escritorio (≥768) === */
@media (min-width: 768px) {
  /* Caben todas las pestañas: se aplanan los grupos y sobran los puntos */
  .tabs { margin-bottom: 48px; }
  .tabs__track { overflow: visible; justify-content: center; gap: 4px; }
  .tabs__page { flex: 0 0 auto; gap: 4px; }
  .tabs__tab { font-size: 16px; padding: 8px; }
  .tabs__dots { display: none; }

  :root { --col: clamp(330px, 30vw, 560px); }

  /* Las cartas usan una columna ancha, como en el original */
  /* La cabecera va ancha en las dos plantillas, aunque el cuerpo del
     índice use una columna angosta */
  .wrap.carta, .header__inner { width: 76.5vw; }

  .announce__text { padding: 12.8px 39px; }

  .header__inner { padding: 20px 0; }
  .header__back-text { display: inline; }
  .header__back { font-size: 16px; }
  .logo { width: 161px; height: 20px; }
  .header__lang { font-size: 15px; gap: 8px; }

  /* Las tres categorías, una al lado de la otra */
  .cats { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .cat {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 28px;
    min-height: 200px;
  }
  .cat__text { flex: 1; gap: 8px; }
  .cat__meta { font-size: 14px; }

  .indice { padding: 44px 0 56px; width: min(76.5vw, 1100px); }
  .indice__title { margin-bottom: 32px; }
  .indice__nps { margin-top: 32px; font-size: 14px; padding: 14px 30px; }

  /* En escritorio no es una hoja inferior sino un modal centrado partido en
     dos: foto a la izquierda, texto a la derecha, con el fondo oscurecido. */
  .popup--scrim { pointer-events: auto; background: rgba(0, 0, 0, .36); }
  .popup__panel {
    top: 50%; left: 50%; right: auto; bottom: auto;
    transform: translate(-50%, -50%);
    width: min(750px, 92vw);
    display: flex;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    touch-action: auto;
    animation: popup-fade .35s ease both;
  }
  @keyframes popup-fade { from { opacity: 0; } to { opacity: 1; } }
  .popup__grip { display: none; }
  .popup__media { display: block; width: 50%; flex: none; }
  .popup__media img { width: 100%; height: 100%; object-fit: cover; }
  .popup__content { width: 50%; padding: 100px 50px; }
  .popup__title { margin: 0 0 25px; font-size: 40px; line-height: 1; color: #1a1a1a; }
  .popup__body { font-size: 16px; line-height: 1.6; letter-spacing: .24px; color: #333333; }
  .popup__cta { margin-top: 30px; padding: 22.4px 40px; background: var(--negro); letter-spacing: .8px; }
  .popup__close { top: 3px; right: 3px; background: none; color: #0a0a0a; font-size: 24px; }
}

/* ============================================ Escritorio: 3 columnas ==== */
@media (min-width: 1024px) {
  .menu-items { columns: 3; }
}
