/* =====================================================================
   HABIB'S · BRAND SYSTEM COMPARTIDO (web + totem)
   ---------------------------------------------------------------------
   Este archivo es la única fuente de verdad visual. Web (index.html) y
   totem (totem.html) lo cargan primero y después su propia hoja.
   Si el cliente entrega HEX oficiales distintos, se cambian SOLO acá.
   ===================================================================== */

/* ---------- Tipografías propias (self-hosted, funcionan offline) ---------- */
@font-face {
  font-family: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/bebas-neue-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/outfit-latin-700-normal.woff2") format("woff2");
}

:root {
  /* ---------- Color: paleta de marca ---------- */
  --rojo: #a30d0d;            /* Rojo Habib's: fondos de marca, botones, precios */
  --rojo-profundo: #8b0000;   /* Degradados, estado presionado, sombras de color */
  --blanco: #ffffff;          /* Tarjetas, texto sobre rojo */
  --papel: #f9f6f0;           /* Fondo general cálido */
  --arena: #efe4d4;           /* Superficies secundarias, separadores suaves */
  --oro: #e6a100;             /* Acento: badges, kicker, detalles */
  --oro-viejo: #d4af37;       /* Acento secundario (bordes finos, brillos) */
  --tinta: #121212;           /* Texto principal, superficies oscuras */
  --tinta-suave: #1c1614;     /* Superficies oscuras secundarias */
  --tierra: #5c4a3d;          /* Texto secundario sobre claro */
  --niebla: #cbbba6;          /* Texto secundario sobre oscuro */
  --listo: #1f7a4d;           /* Estado "confirmado / listo" (uso mínimo) */

  /* Derivados (solo transparencias de la paleta, sin colores nuevos) */
  --rojo-08: rgba(163, 13, 13, 0.08);
  --rojo-14: rgba(163, 13, 13, 0.14);
  --oro-20: rgba(230, 161, 0, 0.2);
  --tinta-06: rgba(18, 18, 18, 0.06);
  --tinta-10: rgba(18, 18, 18, 0.1);
  --tinta-60: rgba(18, 18, 18, 0.6);
  --blanco-14: rgba(255, 255, 255, 0.14);
  --blanco-24: rgba(255, 255, 255, 0.24);
  --blanco-80: rgba(255, 255, 255, 0.8);

  --grad-rojo: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-profundo) 100%);
  --grad-oro: linear-gradient(135deg, var(--oro) 0%, var(--oro-viejo) 100%);
  --grad-foto: linear-gradient(180deg, rgba(18, 18, 18, 0) 35%, rgba(18, 18, 18, 0.78) 100%);

  /* ---------- Tipografía ---------- */
  /* Bebas Neue = voz de marca (titulares, precios, números de pedido).
     Outfit = lectura (cuerpo, botones, formularios).
     Los fallbacks están elegidos para Android 14 sin conexión:
     "Roboto Condensed"/sans-serif-condensed y Roboto vienen en el sistema. */
  --font-display: "Bebas Neue", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", Impact, sans-serif;
  --font-body: "Outfit", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ---------- Radios (PROHIBIDO 0) ---------- */
  --r-xs: 12px;     /* solo micro-elementos internos (check, thumb chico) */
  --r-sm: 16px;     /* mínimo para botones cuadrados, inputs, thumbs */
  --r-md: 20px;     /* tarjetas chicas */
  --r-lg: 24px;     /* tarjetas de producto */
  --r-xl: 32px;     /* contenedores principales, modales, secciones */
  --r-2xl: 40px;    /* hero, hojas del totem */
  --r-pill: 999px;  /* botones, chips, badges */

  /* ---------- Espaciado (escala de 4) ---------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* ---------- Sombras suaves ---------- */
  --sombra-1: 0 1px 2px rgba(18, 18, 18, 0.05), 0 4px 14px rgba(18, 18, 18, 0.06);
  --sombra-2: 0 2px 6px rgba(18, 18, 18, 0.06), 0 14px 34px rgba(18, 18, 18, 0.1);
  --sombra-3: 0 24px 60px rgba(18, 18, 18, 0.22);
  --sombra-roja: 0 10px 26px rgba(139, 0, 0, 0.3);

  /* ---------- Movimiento ---------- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-rapido: 160ms;
  --t-medio: 280ms;
  --t-lento: 520ms;

  /* ---------- Patrón geométrico árabe (estrella de 8 puntas) ---------- */
  --patron-blanco: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1.4' stroke-linejoin='round'%3E%3Crect x='23' y='23' width='26' height='26' rx='4'/%3E%3Crect x='23' y='23' width='26' height='26' rx='4' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='5'/%3E%3Cpath d='M0 36h9M63 36h9M36 0v9M36 63v9' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E");
  --patron-rojo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23a30d0d' stroke-width='1.4' stroke-linejoin='round'%3E%3Crect x='23' y='23' width='26' height='26' rx='4'/%3E%3Crect x='23' y='23' width='26' height='26' rx='4' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='5'/%3E%3Cpath d='M0 36h9M63 36h9M36 0v9M36 63v9' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E");
}

/* =====================================================================
   RESET MÍNIMO
   ===================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--tinta);
  background: var(--papel);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

img {
  -webkit-user-drag: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

/* Foco visible y redondeado para teclado (nunca esquinas rectas) */
:focus-visible {
  outline: 3px solid var(--oro);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.ico {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* =====================================================================
   TIPOGRAFÍA DE MARCA
   ===================================================================== */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 0.92;
  text-transform: uppercase;
}

.kicker {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--oro);
}

.precio {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  color: var(--rojo);
  line-height: 1;
  white-space: nowrap;
}

/* =====================================================================
   LOGO / LOCKUP DE MARCA
   ---------------------------------------------------------------------
   El logo oficial es el logotipo tipográfico "HABIB'S" (no se reemplaza).
   ===================================================================== */
.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-decoration: none;
  line-height: 1;
}

.brand__word {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.04em;
  color: var(--rojo);
}

.brand__tag {
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  color: var(--oro);
  padding-left: 1px;
}

.brand--claro .brand__word {
  color: var(--blanco);
}

.brand__logo {
  display: block;
  height: 48px;
  width: auto;
  border-radius: var(--r-xs);
}

/* Cuando solo hay logo a color y va sobre rojo: se apoya en una píldora blanca */
.brand__logo--pastilla {
  background: var(--blanco);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  box-sizing: content-box;
}

/* =====================================================================
   BOTONES
   ===================================================================== */
.btn {
  --btn-alto: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-alto);
  padding: 0 26px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-rapido) var(--ease-out), box-shadow var(--t-medio) var(--ease-out),
    background-color var(--t-medio) var(--ease-out), color var(--t-medio) var(--ease-out),
    opacity var(--t-medio);
  -webkit-user-select: none;
  user-select: none;
}

.btn svg {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.45;
}

.btn--rojo {
  background: var(--grad-rojo);
  color: var(--blanco);
  box-shadow: var(--sombra-roja);
}

.btn--blanco {
  background: var(--blanco);
  color: var(--rojo);
  box-shadow: var(--sombra-1);
}

.btn--oro {
  background: var(--oro);
  color: var(--tinta);
}

.btn--tinta {
  background: var(--tinta);
  color: var(--blanco);
}

.btn--contorno {
  background: transparent;
  color: currentColor;
  box-shadow: inset 0 0 0 2px currentColor;
}

.btn--vidrio {
  background: var(--blanco-14);
  color: var(--blanco);
  box-shadow: inset 0 0 0 1.5px var(--blanco-24);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.btn--grande {
  --btn-alto: 64px;
  font-size: 1.125rem;
  padding: 0 32px;
}

.btn--bloque {
  width: 100%;
}

/* Botón circular (+, −, cerrar) */
.btn-redondo {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: none;
  transition: transform var(--t-rapido) var(--ease-out), background-color var(--t-medio);
}

.btn-redondo svg {
  width: 55%;
  height: 55%;
}

.btn-redondo:active:not(:disabled) {
  transform: scale(0.9);
}

/* Hover solo en dispositivos que realmente tienen hover (web desktop).
   El totem nunca entra acá: se maneja con :active. */
@media (hover: hover) and (pointer: fine) {
  .btn--rojo:hover {
    box-shadow: 0 14px 32px rgba(139, 0, 0, 0.38);
    transform: translateY(-1px);
  }
  .btn--blanco:hover,
  .btn--oro:hover,
  .btn--tinta:hover {
    transform: translateY(-1px);
    box-shadow: var(--sombra-2);
  }
  .btn--vidrio:hover {
    background: var(--blanco-24);
  }
}

/* =====================================================================
   CHIPS / BADGES
   ===================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  background: var(--blanco);
  color: var(--tinta);
  font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--tinta-10);
  transition: background-color var(--t-medio) var(--ease-out), color var(--t-medio), box-shadow var(--t-medio),
    transform var(--t-rapido);
  white-space: nowrap;
}

.chip:active {
  transform: scale(0.96);
}

.chip.is-activo {
  background: var(--rojo);
  color: var(--blanco);
  box-shadow: var(--sombra-roja);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--oro);
  color: var(--tinta);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.badge svg {
  width: 14px;
  height: 14px;
}

.badge--rojo {
  background: var(--rojo);
  color: var(--blanco);
}

.badge--vidrio {
  background: var(--blanco-14);
  color: var(--blanco);
  box-shadow: inset 0 0 0 1px var(--blanco-24);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* =====================================================================
   TARJETA DE PRODUCTO (misma pieza en web y totem)
   ===================================================================== */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--blanco);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sombra-1);
  transition: transform var(--t-medio) var(--ease-out), box-shadow var(--t-medio) var(--ease-out);
  text-align: left;
  isolation: isolate;
}

.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--arena);
  /* Radio interno: la foto también queda redondeada (y separada del borde) */
  margin: 8px 8px 0;
  border-radius: calc(var(--r-lg) - 8px);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-lento) var(--ease-out);
}

.card__media .badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px 18px;
  flex: 1;
}

.card__titulo {
  font-family: var(--font-display);
  font-size: 1.625rem;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.card__desc {
  color: var(--tierra);
  font-size: 0.9375rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 10px;
}

.card__pie .precio {
  font-size: 1.75rem;
}

.card:active {
  transform: scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sombra-2);
  }
  .card:hover .card__media img {
    transform: scale(1.06);
  }
}

/* =====================================================================
   CONTROLES DE FORMULARIO (siempre redondeados)
   ===================================================================== */
.campo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campo label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tierra);
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--papel);
  box-shadow: inset 0 0 0 1.5px var(--tinta-10);
  transition: box-shadow var(--t-medio), background-color var(--t-medio);
  -webkit-user-select: text;
  user-select: text;
}

.input:focus {
  outline: none;
  background: var(--blanco);
  box-shadow: inset 0 0 0 2px var(--rojo), 0 0 0 4px var(--rojo-14);
}

textarea.input {
  resize: vertical;
  min-height: 88px;
}

/* Selector segmentado (Delivery / Retiro / Auto, Comer aquí / Llevar…) */
.segmento {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 6px;
  border-radius: var(--r-lg);
  background: var(--papel);
  box-shadow: inset 0 0 0 1.5px var(--tinta-06);
}

.segmento button {
  min-height: 48px;
  padding: 6px 10px;
  border-radius: calc(var(--r-lg) - 6px);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.2;
  color: var(--tierra);
  transition: background-color var(--t-medio) var(--ease-out), color var(--t-medio), box-shadow var(--t-medio);
}

.segmento button.is-activo {
  background: var(--blanco);
  color: var(--rojo);
  box-shadow: var(--sombra-1), inset 0 0 0 2px var(--rojo);
}

/* Contador − 1 + */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--papel);
  box-shadow: inset 0 0 0 1.5px var(--tinta-06);
}

.stepper .btn-redondo {
  background: var(--blanco);
  color: var(--rojo);
  box-shadow: var(--sombra-1);
}

.stepper__n {
  min-width: 2ch;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
}

/* =====================================================================
   PATRÓN ÁRABE DECORATIVO
   ===================================================================== */
.patron {
  position: relative;
  isolation: isolate;
}

.patron::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--patron-blanco);
  background-size: 72px 72px;
  opacity: 0.07;
  border-radius: inherit;
  pointer-events: none;
}

.patron--rojo::before {
  background-image: var(--patron-rojo);
  opacity: 0.07;
}

/* =====================================================================
   TOAST (aviso flotante)
   ===================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--r-pill);
  background: var(--tinta);
  color: var(--blanco);
  font-weight: 600;
  box-shadow: var(--sombra-3);
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t-medio) var(--ease-spring), opacity var(--t-medio);
}

.toast svg {
  width: 22px;
  height: 22px;
  color: var(--oro);
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* =====================================================================
   ANIMACIONES COMPARTIDAS
   ===================================================================== */
@keyframes subir {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rebote {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.14);
  }
  70% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes latido {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55), var(--sombra-3);
  }
  60% {
    box-shadow: 0 0 0 22px rgba(255, 255, 255, 0), var(--sombra-3);
  }
}

@keyframes kenburns {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.12) translate3d(-2%, -2%, 0);
  }
}

.anim-rebote {
  animation: rebote 480ms var(--ease-out);
}

/* Accesibilidad: sin animaciones si el sistema lo pide */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
