/*
 * Estilos compartidos de Menulia.
 *
 * Los colores NO se escriben aquí: salen de la paleta del restaurante, que el
 * servidor calcula y valida (ver src/core/tema.js) y cada pantalla inyecta
 * como variables CSS. Aquí sólo se usan las variables. Si algún día hace falta
 * un color nuevo, se añade al tema, no a este archivo.
 */

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

:root {
  /* Valores de arranque, para el parpadeo entre que carga el HTML y llega la
     paleta del restaurante. Neutros a propósito. */
  --marca: #c2410c;
  --marca-legible: #c2410c;
  --tinta-en-marca: #ffffff;
  --fondo: #fffbf5;
  --superficie: #ffffff;
  --texto: #171717;
  --texto-suave: #6b6b6b;
  --borde: #e7e2da;

  --radio: 14px;
  --radio-chico: 10px;
  --sombra: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -12px rgba(0,0,0,.18);
  --ancho: 720px;
}

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

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* El menú se lee de pie, con una mano y con hambre. Nada por debajo de 16px. */
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

a { color: var(--marca-legible); }

.envoltorio { max-width: var(--ancho); margin: 0 auto; padding: 0 16px; }

/* ─── botones ──────────────────────────────────────────────────────────── */

.boton {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radio-chico);
  padding: 12px 16px;
  cursor: pointer;
  /* 44px de alto mínimo: es lo que mide un dedo. Un botón de 32px en un menú
     de restaurante es un botón que se falla a la primera. */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--superficie);
  color: var(--texto);
  border-color: var(--borde);
  transition: transform .08s ease, opacity .15s ease;
}
.boton:active { transform: scale(.97); }
.boton:disabled { opacity: .45; cursor: not-allowed; }
.boton:focus-visible { outline: 3px solid var(--marca-legible); outline-offset: 2px; }

.boton.primario { background: var(--marca); color: var(--tinta-en-marca); border-color: transparent; }
.boton.ancho { width: 100%; }
.boton.chico { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 8px; }

/* ─── piezas ───────────────────────────────────────────────────────────── */

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 16px;
}

.etiqueta {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--marca) 12%, transparent);
  color: var(--marca-legible);
}

.suave { color: var(--texto-suave); }
.chico { font-size: 13px; }
.oculto { display: none !important; }

/* ─── campos ───────────────────────────────────────────────────────────── */

.campo { display: block; margin-bottom: 14px; }
.campo > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--texto);
}
.campo > .ayuda { font-weight: 400; color: var(--texto-suave); font-size: 12px; margin: 4px 0 0; }

input[type=text], input[type=tel], input[type=number], input[type=date],
input[type=time], input[type=url], input[type=email], textarea, select {
  font: inherit;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: var(--radio-chico);
  background: var(--superficie);
  color: var(--texto);
  min-height: 44px;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--marca-legible);
  outline-offset: -1px;
  border-color: var(--marca-legible);
}
textarea { min-height: 76px; resize: vertical; }

/* ─── avisos ───────────────────────────────────────────────────────────── */

.aviso {
  border-radius: var(--radio-chico);
  padding: 11px 13px;
  font-size: 14px;
  border: 1px solid var(--borde);
  background: var(--superficie);
}
.aviso.malo { border-color: #dc2626; background: #fef2f2; color: #7f1d1d; }
.aviso.bueno { border-color: #16a34a; background: #f0fdf4; color: #14532d; }

/* ─── visor 3D ─────────────────────────────────────────────────────────── */

model-viewer {
  width: 100%;
  height: 320px;
  background: color-mix(in srgb, var(--texto) 5%, var(--superficie));
  border-radius: var(--radio);
  --poster-color: transparent;
}

/* ─── hoja que sube desde abajo ────────────────────────────────────────── */

.hoja-fondo {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
}
.hoja {
  background: var(--fondo);
  width: 100%;
  max-width: var(--ancho);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: subir .22s ease-out;
}
@keyframes subir { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }

.hoja-cabeza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cerrar {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--texto-suave);
  padding: 4px 8px;
  min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
