/* =====================================================================
   MEKANIKEPAL — Estilos modernizados
   Inspiración visual: Gorilla App Landing (index-14.html)
   ===================================================================== */

/* ---- Variables ---- */
:root {
  /* Paleta base — modo claro */
  --fondo:        #FEFAF2;
  --superficie:   #FFFFFF;
  --texto:        #1A0F08;
  --suave:        #5A4033;
  --borde:        #E8D5B5;
  --foco:         #0B3D91;

  /* Terracota */
  --tierra:       #D4512A;
  --tierra-osc:   #B03E1C;

  /* Verde */
  --verde:        #2D6A47;
  --verde-osc:    #1E4F34;

  /* Acento dorado */
  --dorado:       #F5A623;

  /* Hero oscuro */
  --hero:         #1C1008;
  --hero-txt:     #F5EDE0;
  --hero-dim:     rgba(245, 237, 224, 0.68);

  /* Sombras */
  --s1: 0 2px 8px rgba(28, 16, 8, .08);
  --s2: 0 6px 20px rgba(28, 16, 8, .13);
  --s3: 0 14px 36px rgba(28, 16, 8, .20);
}

/* ---- Reset base ---- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: 20px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 1rem/1.65 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
}
h1, h2, h3 {
  font-family: 'Outfit', system-ui, sans-serif;
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 .6rem;
  color: var(--texto);
}
h1 { font-size: clamp(1.75rem, 5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--tierra-osc); }
img { max-width: 100%; }

:focus-visible {
  outline: 4px solid var(--foco);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px #fff;
}
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }

/* ---- Utilidades ---- */
.contenedor { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar {
  position: absolute; left: -9999px; top: .5rem;
  background: #fff; padding: .75rem 1rem;
  z-index: 200; border: 3px solid var(--foco);
  font-weight: 700;
}
.saltar:focus { left: .5rem; max-width: calc(100% - 1rem); }

/* ====================================================================
   PRELOADER (inspirado en Gorilla dots)
   ==================================================================== */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--hero);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease, visibility .5s ease;
}
#preloader.fade-out { opacity: 0; visibility: hidden; }
.loader-dots { display: flex; gap: .55rem; align-items: center; }
.loader-dots span {
  display: block;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--tierra);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: .15s; background: var(--tierra-osc); }
.loader-dots span:nth-child(3) { animation-delay: .30s; }
.loader-dots span:nth-child(4) { animation-delay: .45s; background: var(--tierra-osc); }
.loader-dots span:nth-child(5) { animation-delay: .60s; }
@keyframes dot-pulse {
  0%, 100% { transform: scale(.55); opacity: .35; }
  50%       { transform: scale(1);   opacity: 1;   }
}

/* ====================================================================
   HEADER / NAV — Sticky glassmorphism oscuro
   ==================================================================== */
.cabecera {
  position: sticky; top: 0; z-index: 100;
  background: rgba(28, 16, 8, .90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(212, 81, 42, .25);
  transition: background .3s ease, box-shadow .3s ease;
}
.cabecera.scrolled {
  background: rgba(28, 16, 8, .97);
  box-shadow: 0 4px 28px rgba(0, 0, 0, .35);
}
.cabecera-in {
  display: flex; flex-wrap: wrap; gap: .75rem;
  align-items: center; justify-content: space-between;
  padding-top: .75rem; padding-bottom: .5rem;
}
.marca {
  text-decoration: none; color: var(--hero-txt);
  display: flex; flex-direction: column;
  min-height: 48px; justify-content: center;
}
.marca-nombre {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.65rem; font-weight: 800;
  color: var(--tierra); line-height: 1.15;
  letter-spacing: -.01em;
}
.marca-lema { font-size: .85rem; color: var(--hero-dim); }
.letra { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Nav items */
.menu {
  list-style: none; margin: 0;
  padding: 0 0 .75rem;
  display: flex; flex-wrap: wrap; gap: .45rem;
}
.menu a {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: .3rem .9rem;
  border: 1.5px solid rgba(212, 81, 42, .35);
  border-radius: 2rem;
  color: var(--hero-dim);
  font-size: .9rem; font-weight: 600;
  text-decoration: none; background: transparent;
  transition: all .2s ease;
}
.menu a:hover {
  background: var(--tierra);
  color: #fff;
  border-color: var(--tierra);
}

/* ====================================================================
   BOTONES — Pill style
   ==================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; min-width: 48px;
  padding: .5rem 1.35rem;
  font: inherit; font-weight: 700;
  border-radius: 2rem;           /* pill */
  border: 2px solid transparent;
  cursor: pointer; text-decoration: none;
  line-height: 1.3; text-align: center;
  transition: all .22s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-verde  { background: var(--verde); color: #fff; }
.btn-verde:hover {
  background: var(--verde-osc);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(45, 106, 71, .35);
}
.btn-terracota { background: var(--tierra); color: #fff; }
.btn-terracota:hover {
  background: var(--tierra-osc);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(212, 81, 42, .35);
}

/* Claro — contexto OSCURO (header, hero) */
.btn-claro {
  background: rgba(255, 255, 255, .08);
  color: var(--hero-txt);
  border-color: rgba(255, 255, 255, .22);
}
.btn-claro:hover {
  background: rgba(255, 255, 255, .16);
}

/* Claro — contexto CLARO (catálogo, ficha) */
.catalogo .btn-claro,
.filtros  .btn-claro,
.ficha    .btn-claro {
  background: #fff;
  color: var(--texto);
  border-color: var(--borde);
}
.catalogo .btn-claro:hover,
.filtros  .btn-claro:hover,
.ficha    .btn-claro:hover {
  background: #F4E9D5;
  border-color: var(--tierra);
}

.btn-grande { min-height: 56px; font-size: 1.1rem; padding: .7rem 2rem; }

/* Dame una idea — efecto glow pulsante */
#idea {
  background: linear-gradient(135deg, var(--tierra) 0%, var(--tierra-osc) 100%);
  color: #fff; border: 0;
  box-shadow: 0 4px 18px rgba(212, 81, 42, .38);
  animation: idea-glow 3s ease-in-out infinite;
}
#idea:hover {
  box-shadow: 0 6px 26px rgba(212, 81, 42, .55);
  transform: translateY(-2px) scale(1.02);
}
@keyframes idea-glow {
  0%, 100% { box-shadow: 0 4px 18px rgba(212, 81, 42, .38); }
  50%       { box-shadow: 0 4px 30px rgba(212, 81, 42, .58); }
}

/* ====================================================================
   HERO / PORTADA — Oscuro con fondo animado
   ==================================================================== */
.portada {
  background: var(--hero);
  padding: 3.5rem 0 3rem;
  position: relative; overflow: hidden;
}

/* Radial glow background */
.portada::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 80% at 15% 50%, rgba(212, 81, 42, .09) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 85% 25%, rgba(245, 166, 35, .07) 0%, transparent 55%),
    radial-gradient(ellipse 40% 50% at 60% 90%, rgba(45, 106, 71, .06) 0%, transparent 50%);
  animation: hero-breathe 9s ease-in-out infinite alternate;
}
@keyframes hero-breathe {
  0%   { opacity: .6; }
  100% { opacity: 1; }
}

/* Dot grid overlay */
.portada::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(245, 237, 224, .045) 1px, transparent 1px);
  background-size: 26px 26px;
}

.portada .contenedor { position: relative; z-index: 1; }

/* Hero heading */
.portada h1 {
  color: var(--hero-txt);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}

/* Stat badge — tipo fun-facts del template */
.hero-stat {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(212, 81, 42, .14);
  border: 1px solid rgba(212, 81, 42, .35);
  border-radius: 2rem;
  padding: .28rem .9rem;
  font-size: .85rem; font-weight: 700;
  color: var(--dorado);
  margin-bottom: 1.1rem;
}

/* Lead text en hero */
.lead { font-size: 1.1rem; max-width: 44rem; }
.portada .lead { color: var(--hero-dim); }

/* ---- Buscador — pill integrado ---- */
.buscador label {
  display: block; font-weight: 700;
  margin-bottom: .5rem; color: var(--hero-txt);
}
.buscador-fila { display: flex; max-width: 38rem; }

input[type=search] {
  font: inherit;
  height: 52px;
  padding: .45rem 1.25rem;
  border: 1.5px solid rgba(245, 237, 224, .15);
  border-right: 0;
  border-radius: 2rem 0 0 2rem;
  background: rgba(255, 255, 255, .07);
  color: var(--hero-txt);
  flex: 1 1 16rem; min-width: 0;
  transition: border-color .2s, background .2s;
  backdrop-filter: blur(6px);
}
input[type=search]::placeholder { color: rgba(245, 237, 224, .38); }
input[type=search]:focus {
  outline: none;
  border-color: var(--tierra);
  background: rgba(255, 255, 255, .11);
}
.buscador-fila .btn {
  border-radius: 0 2rem 2rem 0;
  min-height: 52px;
  padding: .45rem 1.4rem;
}

/* ---- Accesos: Desayuno / Comida / Cena ---- */
.accesos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr));
  gap: 1rem;
  margin: 1.75rem 0 1.5rem;
}
.acceso {
  font: inherit;
  min-height: 108px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, .04);
  color: var(--hero-txt);
  border: 1.5px solid rgba(212, 81, 42, .28);
  border-radius: 1rem;
  cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: .15rem;
  transition: all .25s ease;
  backdrop-filter: blur(4px);
}
.acceso:hover {
  background: rgba(212, 81, 42, .12);
  border-color: var(--tierra);
  transform: translateY(-5px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.acceso-emoji { font-size: 1.7rem; line-height: 1; margin-bottom: .2rem; }
.acceso span  { font-family: 'Outfit', system-ui, sans-serif; font-size: 1.15rem; font-weight: 800; color: var(--tierra); }
.acceso small { font-size: .82rem; color: var(--hero-dim); }
.acceso[aria-pressed=true] { background: var(--tierra); border-color: var(--tierra); }
.acceso[aria-pressed=true] span  { color: #fff; }
.acceso[aria-pressed=true] small { color: rgba(255, 255, 255, .82); }
.acceso[aria-pressed=true] small::before { content: "✓ Elegido · "; }

/* ---- Caja "Dame una idea" ---- */
.idea {
  background: rgba(255, 255, 255, .05);
  border: 1.5px solid rgba(45, 106, 71, .38);
  border-radius: 1rem; padding: 1.25rem; margin-top: 1.25rem;
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
  backdrop-filter: blur(8px);
}
.idea img, .idea .fallback {
  width: 8rem; height: 8rem;
  border-radius: .75rem; object-fit: cover; flex: none;
}
.idea-txt { flex: 1 1 14rem; color: var(--hero-txt); }
.idea-txt h3 { color: var(--hero-txt); margin-bottom: .35rem; }
.idea-btns { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ====================================================================
   CATÁLOGO
   ==================================================================== */
.catalogo { padding: 2.5rem 0; background: var(--fondo); }

/* ---- Filtros ---- */
.filtros {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
  background: var(--superficie);
  border: 1.5px solid var(--borde);
  border-radius: 1rem; padding: 1.1rem;
  box-shadow: var(--s1);
  margin-bottom: 1.5rem;
}
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .campo label {
  font-weight: 700; padding: 0;
  margin-bottom: .4rem; display: block;
  color: var(--texto);
}

/* Chips filtro */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  font: inherit; font-size: .88rem; font-weight: 600;
  min-height: 40px; padding: .3rem .95rem;
  border: 1.5px solid var(--verde);
  border-radius: 2rem;
  background: #fff; color: var(--verde-osc);
  cursor: pointer;
  transition: all .2s ease;
}
.chip:hover { background: rgba(45, 106, 71, .08); }
.chip[aria-pressed=true] { background: var(--verde); color: #fff; }
.chip[aria-pressed=true]::before { content: "✓ "; }

/* Select */
select {
  font: inherit; height: 40px;
  padding: .3rem .8rem;
  border: 1.5px solid var(--borde);
  border-radius: .6rem;
  background: #fff; color: var(--texto);
  max-width: 100%; cursor: pointer;
  transition: border-color .2s;
}
select:focus { outline: none; border-color: var(--verde); }
.campo { min-width: 0; max-width: 100%; }

.conteo { font-weight: 700; margin: 0 0 1rem; font-size: .95rem; color: var(--suave); }

/* ---- Grid de recetas ---- */
.rejilla {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1.25rem;
}

/* ---- Cards — hover-box estilo Gorilla ---- */
.card {
  background: var(--superficie);
  border: 1.5px solid var(--borde);
  border-radius: 1rem; overflow: hidden;
  display: flex; flex-direction: column;
  height: 100%;
  box-shadow: var(--s1);
  /* Estado inicial para animación de entrada */
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .4s ease, transform .4s ease;
}
.card.visible {
  opacity: 1;
  transform: translateY(0);
}
.card:hover {
  transform: translateY(-6px) !important;
  box-shadow: var(--s3);
  border-color: rgba(212, 81, 42, .22);
}
.card:hover.visible { transform: translateY(-6px); }

/* Card imagen con zoom */
.card-img {
  display: block; aspect-ratio: 4/3;
  background: #EAD9B6;
  overflow: hidden; position: relative;
}
.card-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .45s ease;
}
.card:hover .card-img img { transform: scale(1.07); }

/* Badge de momento (Desayuno / Comida / Cena) */
.card-badge {
  position: absolute; top: .6rem; right: .6rem;
  background: rgba(28, 16, 8, .72);
  color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: .22rem .6rem;
  border-radius: 2rem;
  backdrop-filter: blur(4px);
  letter-spacing: .02em;
  line-height: 1.4;
  pointer-events: none;
}

.card-cuerpo {
  padding: 1rem 1.1rem 1.2rem;
  display: flex; flex-direction: column; flex: 1;
}
.card h3 a { color: var(--texto); text-decoration: none; transition: color .2s; }
.card h3 a:hover { color: var(--tierra); text-decoration: underline; }
.datos { margin: .3rem 0 1rem; font-size: .9rem; color: var(--suave); }
.datos div { margin: .15rem 0; }
.datos b   { color: var(--texto); }
.card .btn { margin-top: auto; align-self: flex-start; }

/* Fallback sin imagen */
.fallback {
  width: 100%; height: 100%;
  background: #EAD9B6; border: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 1rem;
  font-weight: 700; color: var(--tierra-osc);
  aspect-ratio: 1/1;
}

/* Estado vacío */
.vacio {
  background: var(--superficie);
  border: 2px dashed var(--tierra);
  border-radius: 1rem; padding: 2rem; text-align: center;
  box-shadow: var(--s1);
}

/* ====================================================================
   SECCIÓN "SOBRE ESTE PROYECTO" — Oscuro con patrón de puntos
   ==================================================================== */
.proyecto {
  background: var(--hero);
  padding: 3rem 0;
  position: relative; overflow: hidden;
}
.proyecto::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(245, 237, 224, .04) 1px, transparent 1px);
  background-size: 24px 24px;
}
.proyecto::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 70% at 80% 50%, rgba(212, 81, 42, .06) 0%, transparent 60%);
}
.proyecto .contenedor { position: relative; z-index: 1; }
.proyecto h2 { color: var(--tierra); font-family: 'Outfit', system-ui, sans-serif; }
.proyecto p  { color: rgba(245, 237, 224, .78); max-width: 46rem; }

/* ====================================================================
   FOOTER
   ==================================================================== */
.pie {
  background: #0D0804;
  padding: 1.6rem 0; text-align: center;
}
.pie p {
  margin: 0;
  font-size: .9rem;
  color: rgba(245, 237, 224, .5);
}

/* ====================================================================
   FICHA DE RECETA
   ==================================================================== */
.ficha { padding: 1.5rem 0 2.5rem; }
.ficha-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem; margin: 1rem 0 1.5rem;
}
@media (min-width: 56rem) {
  .ficha-top { grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); align-items: start; }
}
.ficha-img {
  width: 100%; height: auto; aspect-ratio: 1/1;
  border-radius: 1rem; border: 1.5px solid var(--borde);
  display: block; background: #EAD9B6; object-fit: cover;
  box-shadow: var(--s2);
}
.pie-img { font-size: .9rem; color: var(--suave); margin: .4rem 0 0; }
.acciones { display: flex; flex-wrap: wrap; gap: .6rem; margin: .5rem 0; }
.bloque {
  background: var(--superficie);
  border: 1.5px solid var(--borde);
  border-radius: 1rem; padding: 1.2rem; margin-bottom: 1.25rem;
  box-shadow: var(--s1);
}
.lista-marcas { list-style: none; margin: 0; padding: 0; }
.lista-marcas li { margin: 0; }
.marca-fila {
  display: flex; gap: .9rem; align-items: flex-start;
  min-height: 56px; padding: .55rem .4rem;
  border-bottom: 1px solid var(--borde);
  cursor: pointer;
  transition: background .15s;
}
.marca-fila input {
  width: 34px; height: 34px; min-width: 34px;
  margin: .1rem 0 0; accent-color: var(--verde);
  cursor: pointer; flex: none;
}
.marca-fila:has(input:checked) { background: #EAF2E4; }
.marca-fila:has(input:checked) .tx::after {
  content: " ✓ Listo";
  font-weight: 700; color: var(--verde-osc); font-size: .9em;
}
.pasos { list-style: none; counter-reset: p; margin: 0; padding: 0; }
.pasos .tx { font-size: 1.05rem; line-height: 1.7; }
.num  { font-weight: 800; color: var(--tierra-osc); }
.ayuda { font-size: .95rem; color: var(--suave); }
.solo-imp { display: none; }

/* ====================================================================
   ANIMACIONES
   ==================================================================== */
@keyframes fadeInUp   { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }

/* Animaciones del hero al cargar la página */
.hero-stat              { animation: fadeInDown .55s ease .0s both; }
.portada h1             { animation: fadeInUp   .6s  ease .15s both; }
.portada .lead          { animation: fadeInUp   .6s  ease .32s both; }
.portada .buscador      { animation: fadeInUp   .6s  ease .48s both; }
.portada .accesos       { animation: fadeInUp   .6s  ease .62s both; }
.portada > .contenedor > p { animation: fadeInUp .6s ease .76s both; }
.portada #idea-caja     { animation: fadeIn     .4s  ease both; }

/* Reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  /* Cards visibles inmediatamente sin animación */
  .card { opacity: 1; transform: none; }
}

/* ====================================================================
   RESPONSIVO
   ==================================================================== */
@media (max-width: 30rem) {
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }
  .btn-grande  { width: 100%; }
  .letra .btn  { flex: 1; padding: .4rem .5rem; }
  .bloque      { padding: .85rem; }
  .contenedor  { padding: 0 .85rem; }

  /* Buscador apilado en móvil */
  .buscador-fila          { flex-direction: column; gap: .5rem; }
  input[type=search]      { border-right: 1.5px solid rgba(245, 237, 224, .15); border-radius: 2rem; }
  .buscador-fila .btn     { border-radius: 2rem; }
}

/* ====================================================================
   IMPRESIÓN
   ==================================================================== */
@media print {
  html { font-size: 14pt; }
  body { background: #fff; color: #000; }
  #preloader,
  .cabecera, .pie, .acciones, .ayuda,
  .ficha-img, .pie-img, .skip, .saltar,
  #vista-catalogo { display: none !important; }
  .solo-imp    { display: block; }
  .bloque      { border: 0; padding: 0; box-shadow: none; }
  .marca-fila  { border-bottom: 0; min-height: 0; padding: .15rem 0; }
  .marca-fila input { width: 16px; height: 16px; min-width: 16px; }
  .marca-fila:has(input:checked)         { background: none; }
  .marca-fila:has(input:checked) .tx::after { content: ""; }
  .ficha-top   { display: block; }
  li, .bloque  { break-inside: avoid; }
}

/* ====================================================================
   MISCELÁNEA
   ==================================================================== */
h1, h2, h3, p, li, .tx { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
