/* base.css — esqueleto estructural compartido por los 4 temas.
   Aquí vive el layout y el comportamiento (overlays, thumbnails, precios);
   cada tema aporta tipografía, color y decoración. */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  min-height: 100vh;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.nai-app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
}

/* ----- cabecera ----- */

.site-header { margin-bottom: 1rem; }
.header-inner { text-align: center; }
.site-eyebrow { margin: 0; }
.site-title { margin: 0.15em 0 0.5em; overflow-wrap: break-word; }

.site-title.has-logo {
  display: flex;
  justify-content: center;
  margin: 0.4rem 0 0.9rem;
}

.site-logo {
  display: block;
  width: min(78vw, 340px);
  height: auto;
}

.header-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lang-switch { display: inline-flex; }
.lang-btn { padding: 0.35rem 0.8rem; line-height: 1; }
.legend-btn { padding: 0.35rem 0.8rem; line-height: 1; }

.sample-notice {
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.65;
  margin: 0 0 1rem;
}

/* ----- índice de secciones y volver arriba ----- */

.section-nav {
  /* flex con wrap: los enlaces son elementos inline sin espacios entre sí,
     y sin esto la fila entera es una sola línea irrompible que se sale */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  row-gap: 0.15em;
  margin: 0 0 1.5rem;
  line-height: 1.9;
}
.section-nav-link { text-decoration: none; color: inherit; }
.section-nav-sep { opacity: 0.45; margin: 0 0.45em; }

.site-footer { margin-top: 2.5rem; }

.allergen-notice {
  margin: 0 auto;
  max-width: 34rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; }

/* ----- secciones y platos ----- */

.menu-section { margin-bottom: 2rem; scroll-margin-top: 0.75rem; }
.section-title { margin: 0 0 0.75rem; }

.dish-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dish {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.dish-media { flex: 0 0 auto; }

.dish-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}

.thumb-btn { display: block; line-height: 0; }
.thumb-placeholder { display: block; line-height: 0; cursor: default; }

.dish-info { flex: 1 1 auto; min-width: 0; }

.dish-topline {
  display: flex;
  align-items: baseline;
  column-gap: 0.75rem;
  row-gap: 0.2em;
  flex-wrap: wrap;
}

/* min-width:0 deja al nombre encoger envolviendo su texto en 2+ líneas,
   de modo que un precio único NUNCA se ve empujado a la línea siguiente.
   El max-width reserva sitio fijo a la derecha: el nombre envuelve antes
   de invadir la columna del precio, que queda siempre arriba a la derecha. */
.dish-name {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 7em);
}
.dish-desc { margin: 0.25rem 0 0; }

/* ----- precios ----- */

.dish-price {
  flex: 0 0 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  max-width: 100%;
}

/* Con media ración o tapa (clase has-half), el bloque de precios va SIEMPRE
   en su propia línea bajo el nombre, pegado a la derecha; con solo ración
   entera se queda fijo a la derecha en la primera línea. */
.dish-price.has-half { flex-basis: 100%; }

.price-part { display: inline-flex; align-items: baseline; gap: 0.3em; }
.price-label { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75; }
.price-sep { opacity: 0.5; }

/* ----- alérgenos ----- */

.dish-allergens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.allergen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
}

.allergen-icon { display: inline-flex; width: 1.1rem; height: 1.1rem; }
.allergen-icon svg { width: 100%; height: 100%; }

.allergen-tip {
  position: absolute;
  z-index: 60;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 6px;
  pointer-events: none;
  max-width: 14rem;
  text-align: center;
}

/* ----- overlays (lightbox y leyenda) ----- */

.nai-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.78);
  cursor: pointer;
}

.overlay-close {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  opacity: 0.85;
}

.lightbox-figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }

.lightbox-img {
  max-width: min(92vw, 900px);
  max-height: 78vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
}

.lightbox-caption { color: #f3f3f3; margin-top: 0.6rem; }

.legend-panel {
  cursor: auto;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.25rem 1.4rem;
  border-radius: 10px;
}

.legend-title { margin: 0 0 0.9rem; }

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
}

.legend-item { display: flex; align-items: center; gap: 0.5rem; }
.legend-icon { width: 1.35rem; height: 1.35rem; flex: 0 0 auto; }
.legend-name { font-size: 0.9rem; }

.legend-close-btn { margin-top: 1.1rem; padding: 0.45rem 1.1rem; }

@media (max-width: 360px) {
  .legend-list { grid-template-columns: 1fr; }
}
