/*
 * Efecto "chocolate derretido" para el Hero (components/banner.html).
 * Solo CSS + un filtro SVG (gooey) — nada de JS ni dependencias externas,
 * así no agrega peso a un sitio estático que hoy no tiene build step.
 *
 * Se degrada solo:
 *  - prefers-reduced-motion: reduce  -> sin animación, drip en su estado final.
 *  - sin soporte de filtros SVG      -> se ven círculos simples, sin fusionarse
 *    (no rompe el layout, solo pierde el efecto "goo").
 */

.choco-drip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  pointer-events: none;
  filter: url(#choco-goo) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
  z-index: 2;
}

.choco-drip::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 30px;
  background: linear-gradient(165deg, #8a5a33 0%, #4b2e2e 55%, #2e1b12 100%);
}

.choco-drip__blob {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  margin-left: calc(var(--size) / -2);
  background: radial-gradient(circle at 35% 30%, #9c6c42 0%, #4b2e2e 60%, #2e1b12 100%);
  border-radius: 50%;
  transform-origin: top center;
  transform: translateY(55%) scaleY(1);
}

@media (prefers-reduced-motion: no-preference) {
  .choco-drip__blob {
    animation: choco-drip-fall 2.4s var(--delay, 0s) cubic-bezier(.65, 0, .35, 1) both;
  }
}

@keyframes choco-drip-fall {
  0% {
    transform: translateY(-40%) scaleY(0.4);
  }
  55% {
    transform: translateY(45%) scaleY(1.35);
  }
  100% {
    transform: translateY(55%) scaleY(1);
  }
}

@media (max-width: 480px) {
  .choco-drip {
    height: 64px;
  }
  .choco-drip::before {
    height: 20px;
  }
}

/*
 * Layout del Hero. Antes vivía en estilos inline en components/banner.html,
 * que pisaban las reglas mobile de styles.css (por eso el título seguía en
 * 3rem en el celular y los botones se salían de la tarjeta). Va con #banner
 * para ganarle a las reglas duplicadas de .banner-* que quedan en styles.css.
 */
#banner .banner-background {
  padding: 60px 20px;
  color: #fff;
  text-align: center;
  justify-content: center;
}

#banner .banner-content {
  position: relative;
  z-index: 3;
  max-width: 800px;
  margin: 0 auto;
  padding: 32px;
  border-radius: 16px;
  background-color: rgba(75, 46, 46, 0.82);
}

#banner .banner-title {
  font-size: 3rem;
  margin-bottom: 18px;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.55), 0 0 24px rgba(255, 255, 255, 0.35), 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#banner .banner-text {
  font-size: 1.2rem;
  line-height: 1.5;
  margin-bottom: 26px;
}

#banner .banner-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

#banner .banner-buttons .hero-cta {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  width: auto;
}

#banner .banner-buttons .hero-cta--primary {
  background-color: #d6336c;
  color: #fff;
  padding: 16px 34px;
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* .banner-content (styles.css) le pone sombra oscura a todo su texto; en los
   botones eso hacía que las etiquetas se vieran borrosas. */
#banner .banner-buttons .hero-cta {
  text-shadow: none;
}

#banner .banner-buttons .btn-melt:hover,
#banner .banner-buttons .btn-melt:focus-visible {
  border-radius: 46% 54% 63% 37% / 45% 48% 52% 55%;
}

#banner .hero-cta--green { background-color: #157a37; color: #fff; }
#banner .hero-cta--yellow { background-color: #ffc107; color: #4b2e2e; }
#banner .hero-cta--game { background-color: #cfd767; color: #4b2e2e; }

@media (max-width: 600px) {
  /* index.html envuelve el componente en <section id="banner"> y el componente
     trae otra <section>: el padding global de section se sumaba dos veces. */
  #banner,
  #banner .banner-section {
    padding: 0;
    margin: 0;
    max-width: none;
  }

  #banner .banner-background {
    min-height: 0;
    padding: 24px 12px 72px;
  }

  #banner .banner-content {
    padding: 22px 16px;
  }

  #banner .banner-title {
    font-size: 2.1rem;
    margin-bottom: 12px;
  }

  #banner .banner-text {
    font-size: 1.02rem;
    margin-bottom: 18px;
  }

  #banner .banner-text-extra {
    display: none;
  }

  #banner .banner-buttons {
    gap: 8px;
  }

  /* Principal a lo ancho; las tres secundarias en una fila compacta. */
  #banner .banner-buttons .hero-cta--primary {
    flex: 1 1 100%;
    padding: 14px 16px;
  }

  #banner .banner-buttons .hero-cta:not(.hero-cta--primary) {
    flex: 1 1 0;
    padding: 10px 6px;
    font-size: 0.82rem;
    white-space: nowrap;
  }
}

/*
 * Partículas flotantes del Hero ("ingredientes vivos" liviano): un puñado
 * de emoji con drift vertical lento, decorativo, sin canvas ni dependencias.
 * pointer-events: none para que nunca interfieran con los botones de abajo.
 */
.choco-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.choco-particle {
  position: absolute;
  top: 100%;
  left: var(--x);
  font-size: 1.6rem;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@media (prefers-reduced-motion: no-preference) {
  .choco-particle {
    animation: choco-float var(--dur, 9s) linear var(--delay, 0s) infinite;
  }
}

@keyframes choco-float {
  0% {
    top: 100%;
    opacity: 0;
    transform: translateX(0) rotate(0deg);
  }
  10% {
    opacity: 0.85;
  }
  90% {
    opacity: 0.85;
  }
  100% {
    top: -10%;
    opacity: 0;
    transform: translateX(18px) rotate(25deg);
  }
}

@media (max-width: 480px) {
  .choco-particle {
    font-size: 1.2rem;
  }
}

/* Entrada suave del contenido del Hero una vez que el componente llega al DOM. */
.choco-fade-in {
  opacity: 0;
  transform: translateY(14px);
}

@media (prefers-reduced-motion: no-preference) {
  .choco-fade-in {
    animation: choco-fade-in 0.7s ease-out 0.05s both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .choco-fade-in {
    opacity: 1;
    transform: none;
  }
}

@keyframes choco-fade-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/*
 * Microinteracción "melt" para los botones del Hero: el botón se deforma
 * hacia una silueta orgánica al pasar el mouse/foco. Solo border-radius +
 * sombra (barato de pintar, sin filtros ni JS), reutilizable en cualquier
 * botón del sitio con la clase .btn-melt.
 */
.btn-melt {
  transition: border-radius 0.4s cubic-bezier(.65, 0, .35, 1), box-shadow 0.3s ease;
}

.btn-melt:hover,
.btn-melt:focus-visible {
  border-radius: 46% 54% 63% 37% / 45% 48% 52% 55%;
  box-shadow: 0 10px 22px rgba(75, 46, 46, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .btn-melt {
    transition: none;
  }
}

/*
 * Racha de visitas / contador de pedidos (js/racha.js).
 * Sistema de honor, 100% client-side — ver comentario en ese archivo.
 */
/* Todo escopado bajo #racha-widget (no solo .racha-card) a propósito:
   el widget vive dentro de #bienvenida, y la regla #bienvenida p
   (color claro, pensada para texto sobre el fondo oscuro de esa sección)
   tiene más especificidad que una clase sola y ganaba por sobre el color
   oscuro que esta tarjeta necesita sobre SU fondo claro — el texto
   quedaba casi invisible. Iguala la especificidad con el mismo ID. */
#racha-widget .racha-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fff8f0, #fff);
  border: 2px solid var(--color-yellow, #ffc800);
  border-radius: 18px;
  padding: 18px 22px;
  max-width: 560px;
  margin: 24px auto 0;
  box-shadow: 0 6px 18px rgba(75, 46, 46, 0.12);
  text-align: left;
}

#racha-widget .racha-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 2px solid var(--color-pink, #d4216c);
  flex-shrink: 0;
}

#racha-widget .racha-texto strong {
  display: block;
  color: var(--color-pink, #d4216c);
  font-size: 1.15rem;
}

#racha-widget .racha-texto p {
  margin: 6px 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #4b2e2e;
  font-weight: 500;
}

#racha-widget .racha-btn {
  display: inline-block;
  margin-top: 10px;
  background-color: #1da851;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
}

#racha-widget .racha-card--completa {
  border-color: var(--color-pink, #d4216c);
  background: linear-gradient(135deg, #fff0f6, #fff);
  position: relative;
  overflow: hidden;
}

#racha-widget .racha-card--completa::after {
  content: "🎉";
  position: absolute;
  top: -6px;
  right: 10px;
  font-size: 1.6rem;
}

@media (prefers-reduced-motion: no-preference) {
  #racha-widget .racha-card--completa {
    animation: racha-pop 0.5s ease-out both;
  }
}

@keyframes racha-pop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
  #racha-widget .racha-card {
    flex-direction: column;
    text-align: center;
  }
}

.pedidos-widget {
  display: block;
  text-align: center;
  font-size: 0.9em;
  color: #6b4a3a;
  margin: 10px auto 15px;
  max-width: 500px;
}

/*
 * Banner de las páginas internas (components/page-banner.html): mismo goteo de
 * chocolate y mismos brillitos que el Hero del inicio, en formato compacto.
 * Va con .page-banner para ganarle a la regla global `section` de styles.css.
 */
.page-banner {
  position: relative;
  overflow: hidden;
  max-width: none;
  margin: 0;
  padding: 34px 20px 38px;
  text-align: center;
  color: #fff8f0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 200, 0, 0.12), transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(212, 33, 108, 0.18), transparent 50%),
    linear-gradient(165deg, #64321b 0%, #4b2e2e 55%, #2e1b12 100%);
}
.page-banner .page-banner__contenido {
  position: relative;
  z-index: 3;
  max-width: 720px;
  margin: 0 auto;
}

.page-banner .page-banner__titulo {
  margin: 6px 0 6px;
  font-size: 2.6rem;
  line-height: 1.1;
  color: #ffc800;
  text-shadow: 0 0 14px rgba(255, 200, 0, 0.35), 2px 2px 4px rgba(0, 0, 0, 0.55);
}
.page-banner .page-banner__sub {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.4;
  color: #fff8f0;
}
@media (max-width: 480px) {
  .page-banner { padding: 24px 16px 28px; }
  .page-banner .page-banner__titulo { font-size: 2rem; }
  .page-banner .page-banner__sub { font-size: 1rem; }
}

/*
 * Brillitos de fondo en los recuadros (js/brillos.js): los mismos chocolates y
 * destellos que suben en el Hero, pero detrás del contenido de cada tarjeta.
 * Solo transform + opacity (baratos); se animan únicamente mientras el recuadro
 * está en pantalla (.is-activo) y no se crean con prefers-reduced-motion.
 */
.choco-fondo {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.brillos {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.brillos i {
  position: absolute;
  inset: 0;
  display: block;
  padding-left: var(--x);
  font-style: normal;
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(100%);
}
.choco-fondo.is-activo .brillos i {
  animation: brillo-sube var(--dur, 9s) linear var(--delay, 0s) infinite;
}
@keyframes brillo-sube {
  0%   { transform: translateY(100%) translateX(0) rotate(0deg); opacity: 0; }
  12%  { opacity: 0.6; }
  88%  { opacity: 0.6; }
  100% { transform: translateY(-100%) translateX(14px) rotate(25deg); opacity: 0; }
}

/*
 * Logo oficial vertical siempre a la vista: en el Hero, en el banner de cada página,
 * en el pie y en la racha. Va sobre una placa blanca (el logo tiene letras rosadas y
 * cafés que no se leen sobre el fondo oscuro) y solo se fija el alto: el ancho es
 * automático para no deformar el logo.
 */
.logo-placa {
  display: inline-block;
  background: #fff;
  border-radius: 16px;
  padding: 8px 14px;
  line-height: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.logo-placa img { display: block; height: 112px; width: auto; max-width: 100%; }
@media (max-width: 480px) {
}
#racha-widget .racha-avatar {
  width: auto;
  height: 72px;
  border-radius: 12px;
  object-fit: contain;
  padding: 4px 8px;
}

/* El emoji vuelve al banner de las páginas (el logo ahora va fijo en el encabezado). */
.page-banner .page-banner__emoji { margin: 0; font-size: 2rem; line-height: 1; }

/*
 * Encabezado fijo con el logo oficial vertical arriba a la izquierda: se ve siempre al
 * navegar. --header-h lo mantiene js/base.js (alto real, también con el menú abierto) y lo
 * usan las barras que se pegan debajo (Historia y Tienda) para no quedar tapadas.
 * Solo se fija el alto del logo; el ancho es automático para no deformarlo.
 */
:root { --header-h: 84px; }
html { scroll-padding-top: calc(var(--header-h) + 8px); }
/* padding 0: el <header id="header"> contenedor también recibía el relleno global de `header` (styles.css) y duplicaba el alto. */
#header { position: sticky; top: 0; z-index: 1000; padding: 0; }
.site-logo {
  display: inline-block;
  background: #fff;
  border-radius: 12px;
  padding: 4px 9px;
  line-height: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.site-logo img { display: block; height: 60px; width: auto; }
@media (max-width: 480px) {
  .site-logo img { height: 52px; }
}
.site-logo-link { text-align: left; margin: 0; }

/* Invitación a hacerse Matilover bajo la racha (solo con cuentas encendidas). */
#racha-widget .racha-cta { margin: 12px auto 0; max-width: 560px; font-size: 0.95rem; line-height: 1.5; color: #fff8f0; text-align: center; }
#racha-widget .racha-cta a { color: #ffc800; font-weight: 800; text-decoration: underline; }
#racha-widget .racha-btn { display: inline-block; margin-top: 8px; }
