/* ==========================================================
   Morelli Mayorista — estilos del sitio (HTML estático)
   Orden: tokens · base · componentes · secciones · movimiento
   ========================================================== */

/* ---------- Tipografía (alojada localmente: sin pedidos a Google) ---------- */
@font-face {
  font-family: "Roboto"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/roboto-latin.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  --celeste: #00AFF0;
  --celeste-claro: #E1F5FD;
  --celeste-circulo: #CCEEFB;
  --azul: #131951;
  --texto: #212121;
  --gris: #F5F5F5;
  --verde: #0C9E16;
  --blanco: #FFFFFF;
  --max: 1240px;
  --radio: 16px;
  --radio-grande: 24px;
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sombra-1: 0 2px 10px rgba(19, 25, 81, .06);
  --sombra-2: 0 10px 30px rgba(19, 25, 81, .10);
  --sombra-3: 0 18px 44px rgba(19, 25, 81, .16);
  --seccion: clamp(56px, 8vw, 100px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--texto);
  background: var(--blanco);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { color: var(--azul); line-height: 1.15; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); }
p { margin: 0 0 1em; text-wrap: pretty; }
::selection { background: var(--celeste); color: #fff; }
:focus-visible { outline: 3px solid var(--celeste); outline-offset: 3px; border-radius: 6px; }
[id] { scroll-margin-top: 80px; }

.contenedor { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.centrado { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 8px; background: var(--azul); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.saltar:focus { left: 8px; }

/* ---------- Botones ---------- */
.btn {
  --sombra-btn: rgba(0, 175, 240, .45);
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 32px; border-radius: 50px; border: 0;
  font: 500 1.125rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  color: #fff; background: var(--celeste);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), filter .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -8px var(--sombra-btn); filter: brightness(.95); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; }
.btn svg { width: 20px; height: 20px; flex: none; fill: currentColor; transition: transform .3s var(--ease); }
.btn:hover > svg:first-child { transform: scale(1.15) rotate(-6deg); }
.btn:hover > svg:last-child:not(:first-child) { transform: translateX(5px); }
.btn--verde { background: var(--verde); --sombra-btn: rgba(12, 158, 22, .5); }
.btn--azul { background: var(--azul); --sombra-btn: rgba(19, 25, 81, .5); }
.btn--bloque { width: 100%; }

/* ---------- Header (vidrio esmerilado al hacer scroll) ---------- */
.header { --header-alto: 88px; position: sticky; top: 0; z-index: 50; }
.header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, 0);
  transition: background-color .35s, box-shadow .35s;
}
.header .contenedor { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-alto); transition: min-height .35s var(--ease); }
.header__logo img { width: 170px; transition: width .35s var(--ease); }
.header--scroll { --header-alto: 64px; }
.header--scroll::before { background: rgba(255, 255, 255, .95); box-shadow: 0 1px 0 rgba(0, 0, 0, .08); }
.header--scroll .header__logo img { width: 138px; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .header::before { -webkit-backdrop-filter: saturate(100%) blur(0); backdrop-filter: saturate(100%) blur(0); }
  .header--scroll::before { background: rgba(255, 255, 255, .72); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
}
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.nav a {
  position: relative; display: block; padding: 9px 16px; border-radius: 50px;
  font-weight: 600; text-decoration: none; color: var(--texto);
  transition: background .25s, color .25s;
}
.nav a::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 5px; height: 2px; border-radius: 2px;
  background: var(--celeste); transform: scaleX(0); transition: transform .3s var(--ease);
}
.nav a:hover { color: var(--celeste); }
.nav a:hover::after { transform: scaleX(1); }
.nav a[aria-current="page"] { background: var(--celeste); color: #fff; }
.nav a[aria-current="page"]::after { display: none; }
.nav__toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav__toggle span { display: block; width: 26px; height: 3px; margin: 5px 0; background: var(--azul); border-radius: 2px; transition: transform .25s, opacity .25s; }

@media (max-width: 860px) {
  .nav__toggle { display: block; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(255, 255, 255, .97); box-shadow: 0 16px 32px rgba(19, 25, 81, .14);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s, transform .3s var(--ease), visibility .25s;
  }
  @supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .nav { background: rgba(255, 255, 255, .8); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  }
  .nav.abierto { opacity: 1; visibility: visible; transform: none; }
  .nav ul { flex-direction: column; padding: 12px 20px 20px; gap: 4px; }
  .nav a { padding: 12px 16px; }
  .nav a::after { display: none; }
  .header__toggle-abierto span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .header__toggle-abierto span:nth-child(2) { opacity: 0; }
  .header__toggle-abierto span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* ---------- Carrusel de diapositivas (hero) ---------- */
.carrusel { position: relative; }
.carrusel__pista {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-behavior: smooth; scrollbar-width: none; gap: var(--gap, 0px);
}
.carrusel__pista::-webkit-scrollbar { display: none; }
.carrusel__item { flex: 0 0 calc((100% - (var(--por-vista, 1) - 1) * var(--gap, 0px)) / var(--por-vista, 1)); scroll-snap-align: start; }
.carrusel__flecha {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: #c7c7c7; display: grid; place-items: center;
  transition: color .2s, background .25s, transform .25s var(--ease);
}
.carrusel__flecha:hover { color: var(--azul); transform: translateY(-50%) scale(1.1); }
.carrusel__flecha svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.carrusel__flecha--prev { left: 8px; }
.carrusel__flecha--next { right: 8px; }
.carrusel__puntos { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.carrusel__puntos button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 8px;
  background: currentColor; opacity: .25; cursor: pointer; color: var(--texto);
  transition: width .35s var(--ease), opacity .3s;
}
.carrusel__puntos button:hover { opacity: .55; }
.carrusel__puntos button[aria-current="true"] { opacity: 1; width: 26px; }

/* ---------- Marquesina (carrusel continuo de marcas y rubros) ---------- */
.carrusel[data-marquesina] {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.carrusel[data-marquesina] .carrusel__item { flex: 0 0 var(--ancho-item, 200px); scroll-snap-align: start; }
.marquesina--activa .carrusel__pista {
  width: max-content; overflow: visible; scroll-snap-type: none;
  animation: marquesina var(--duracion, 40s) linear infinite; will-change: transform;
}
.marquesina--activa:hover .carrusel__pista,
.marquesina--activa:focus-within .carrusel__pista { animation-play-state: paused; }
@keyframes marquesina { to { transform: translateX(calc(-1 * var(--desplazamiento, 50%))); } }

/* ---------- Hero ---------- */
.hero { padding: 8px 0 0; }
.hero .carrusel { --por-vista: 1; border-radius: var(--radio-grande); overflow: hidden; background: var(--celeste-claro); box-shadow: var(--sombra-2); }
.hero .carrusel__item img { width: 100%; aspect-ratio: 1740 / 727; object-fit: cover; }
.hero .carrusel__flecha { color: #fff; background: rgba(19, 25, 81, .22); }
.hero .carrusel__flecha:hover { color: #fff; background: rgba(19, 25, 81, .45); }
.hero .carrusel__puntos button { color: var(--celeste); }
.hero__ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 28px 0 0; }

/* ---------- Categorías (rubros) ---------- */
.categorias { padding: var(--seccion) 0 calc(var(--seccion) * .9); }
.categorias .carrusel { --ancho-item: 150px; margin-top: 40px; padding: 8px 0; }
.categoria { position: relative; text-align: center; padding: 12px 8px 0; cursor: default; }
.categoria::before {
  content: ""; position: absolute; left: 50%; top: 0; width: 112px; height: 112px; margin-left: -56px;
  border-radius: 50%; background: var(--celeste-claro); opacity: 0; transform: scale(.6);
  transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.categoria img { position: relative; width: 84px; height: 84px; object-fit: contain; margin: 14px auto 18px; transition: transform .45s var(--ease); }
.categoria span { position: relative; display: block; font-size: .875rem; font-weight: 700; color: var(--texto); transition: color .25s; }
.categoria:hover::before { opacity: 1; transform: scale(1); }
.categoria:hover img { transform: translateY(-4px) scale(1.08); }
.categoria:hover span { color: var(--celeste); }
@media (max-width: 600px) { .categorias .carrusel { --ancho-item: 120px; } }

/* ---------- Cómo hacer un pedido ---------- */
.pedido { background: var(--gris); padding: calc(var(--seccion) * .75) 0; }
.pedido__grilla { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 64px; align-items: stretch; }
.tarjeta {
  display: flex; flex-direction: column;
  position: relative; background: #fff; border-radius: var(--radio);
  padding: 96px 32px 32px; text-align: center; box-shadow: var(--sombra-1);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.tarjeta:hover { transform: translateY(-6px); box-shadow: var(--sombra-3); }
.tarjeta__icono {
  position: absolute; top: -42px; left: 50%; transform: translateX(-50%);
  width: 133px; height: 133px; border-radius: 50%; display: grid; place-items: center;
  background: var(--celeste); transition: transform .4s var(--ease);
}
.tarjeta:hover .tarjeta__icono { transform: translateX(-50%) translateY(-5px) scale(1.04); }
.tarjeta__icono--azul { background: var(--azul); }
.tarjeta__icono img { width: 100%; height: 100%; border-radius: 50%; }
.tarjeta h3 { font-size: 1.75rem; }
.tarjeta p { max-width: 46ch; margin: 0 auto 1.6em; }
.tarjeta__acciones { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tarjeta__acciones--una { grid-template-columns: 1fr; }
@media (max-width: 860px) {
  .pedido__grilla { grid-template-columns: 1fr; row-gap: 80px; }
  .tarjeta__acciones { grid-template-columns: 1fr; }
}

/* ---------- Entrega ----------
   El mapa (1920×803) es el fondo de .entrega__mapa. Concepción está en el punto
   (58,8 %; 56,3 %) de la imagen: con background-size: cover ese mismo porcentaje del
   contenedor coincide con ese punto, así el logo queda siempre sobre la ciudad. */
.entrega { --foco-x: 58.8%; --foco-y: 56.3%; position: relative; overflow: hidden; padding: calc(var(--seccion) * .8) 0; min-height: 440px; display: flex; align-items: center; background: #d4f0dc; }
.entrega__mapa {
  position: absolute; inset: 0;
  background: url("../img/entrega-fondo.webp") var(--foco-x) var(--foco-y) / cover no-repeat;
}
/* Radio de entrega alrededor de Concepción */
.entrega__mapa::after {
  content: ""; position: absolute; left: var(--foco-x); top: var(--foco-y);
  width: 380px; height: 380px; transform: translate(-50%, -50%); border-radius: 50%;
  background: rgba(204, 238, 251, .3);
}
.entrega .contenedor { position: relative; z-index: 1; width: 100%; }
.entrega__tarjeta { background: #fff; border-radius: var(--radio); padding: 36px 40px; max-width: 480px; box-shadow: var(--sombra-2); }
.entrega__tarjeta img { width: 80px; margin-bottom: 18px; }
.entrega__tarjeta h2 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); margin-bottom: .5em; }
.entrega__tarjeta p { margin: 0; color: var(--azul); }

/* Logo con pulso azul que se expande */
.entrega__sello {
  position: absolute; z-index: 1; left: var(--foco-x); top: var(--foco-y); transform: translate(-50%, -50%);
  width: 110px; height: 110px; border-radius: 50%; background: #fff; display: grid; place-items: center;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .7), 0 6px 18px rgba(19, 25, 81, .25);
  animation: sello-latido 2.6s ease-in-out infinite;
}
.entrega__sello img { position: relative; width: 90px; }
.entrega__sello::before, .entrega__sello::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(0, 175, 240, .65); animation: sello-onda 2.6s ease-out infinite;
}
.entrega__sello::after { animation-delay: 1.3s; }
@keyframes sello-onda {
  0%   { box-shadow: 0 0 0 0 rgba(0, 175, 240, .65); }
  100% { box-shadow: 0 0 0 64px rgba(0, 175, 240, 0); }
}
@keyframes sello-latido {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 255, 255, .7), 0 6px 18px rgba(19, 25, 81, .25), 0 0 0 0 rgba(0, 175, 240, .55); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 255, 255, .7), 0 6px 18px rgba(19, 25, 81, .25), 0 0 26px 10px rgba(0, 175, 240, .35); }
}
@media (max-width: 860px) {
  .entrega { flex-direction: column; align-items: stretch; padding: 40px 0 0; min-height: 0; }
  .entrega__tarjeta { max-width: none; }
  /* En celular el mapa pasa debajo de la tarjeta, con su propia altura */
  .entrega__mapa { order: 2; position: relative; inset: auto; height: 340px; margin-top: 28px; }
  .entrega__mapa::after { width: 260px; height: 260px; }
  .entrega .contenedor { z-index: 2; }
}

/* ---------- Marcas ---------- */
.marcas { padding: calc(var(--seccion) * .7) 0; scroll-margin-top: 96px; }
.marcas .carrusel { --ancho-item: 220px; margin-top: 32px; padding: 14px 0; }
.marcas .carrusel__item { display: grid; place-items: center; padding: 0 14px; }
.marcas .carrusel__item img {
  max-height: 90px; width: auto; object-fit: contain; border-radius: 12px;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.marcas .carrusel__item:hover img { transform: translateY(-4px) scale(1.07); box-shadow: var(--sombra-2); }
@media (max-width: 600px) { .marcas .carrusel { --ancho-item: 160px; } }

/* ---------- Quiénes somos (home) ---------- */
.quienes { padding: var(--seccion) 0; }
.quienes .contenedor { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.quienes h2 { font-size: clamp(2rem, 3.4vw, 2.8rem); }
.quienes p { color: var(--azul); max-width: 58ch; }
.quienes img { border-radius: var(--radio-grande); width: 100%; box-shadow: var(--sombra-2); transition: transform .6s var(--ease), box-shadow .6s var(--ease); }
.quienes img:hover { transform: scale(1.02); box-shadow: var(--sombra-3); }
@media (max-width: 860px) { .quienes .contenedor { grid-template-columns: 1fr; } }

/* ---------- Nosotros ---------- */
.nosotros-intro { padding: calc(var(--seccion) * .7) 0; }
.nosotros-intro .contenedor { display: grid; grid-template-columns: 1fr 1.1fr; gap: 64px; align-items: center; }
.nosotros-intro img { border-radius: var(--radio-grande); width: 100%; box-shadow: var(--sombra-2); transition: transform .6s var(--ease), box-shadow .6s var(--ease); }
.nosotros-intro img:hover { transform: scale(1.02); box-shadow: var(--sombra-3); }
.nosotros-intro h1 { font-size: clamp(2rem, 3.4vw, 2.6rem); }
.nosotros-intro p { color: var(--azul); }
@media (max-width: 860px) { .nosotros-intro .contenedor { grid-template-columns: 1fr; gap: 32px; } }

/* ---------- Contacto ---------- */
.contacto { padding: calc(var(--seccion) * .8) 0 var(--seccion); }
.contacto .contenedor { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; }
.contacto h1 { color: var(--celeste); font-size: clamp(2rem, 3.4vw, 2.8rem); }
.contacto__datos { margin-top: 28px; color: var(--azul); }
.contacto__datos a { color: var(--azul); }
.form label { display: block; margin: 0 0 6px; }
.form .campo { margin-bottom: 14px; }
.form input, .form textarea {
  width: 100%; padding: 11px 16px; font: 400 1rem var(--font); color: var(--texto);
  border: 1px solid #69727d; border-radius: 10px; background: #fff;
  transition: border-color .2s, box-shadow .25s;
}
.form textarea { min-height: 96px; resize: vertical; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--celeste); box-shadow: 0 0 0 4px rgba(0, 175, 240, .2); }
.form .btn { border-radius: 10px; font-size: 1rem; padding: 12px 20px; }
.form__estado { margin-top: 12px; font-size: .95rem; color: var(--azul); }
.campo--trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 860px) { .contacto .contenedor { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Footer ---------- */
.footer { background: var(--gris); padding: 56px 0 40px; }
.footer .contenedor { display: grid; grid-template-columns: 1.1fr 1fr 1.1fr 1fr; gap: 32px; }
.footer__logo img { width: 290px; }
.footer__titulo { font-size: 1.125rem; font-weight: 700; color: var(--texto); text-transform: uppercase; margin: 0 0 1em; line-height: 1.15; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li + li { margin-top: 10px; }
.footer a { text-decoration: none; }
.footer li a {
  padding-bottom: 2px;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: color .25s, background-size .35s var(--ease);
}
.footer li a:hover { color: var(--celeste); background-size: 100% 1px; }
.redes { display: flex; gap: 6px; }
.redes a { width: 50px; height: 50px; border-radius: 8px; background: var(--celeste); display: grid; place-items: center; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.redes a:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 10px 20px -6px rgba(0, 175, 240, .6); }
.redes svg { width: 26px; height: 26px; fill: #fff; }
.footer__legal { grid-column: 1 / -1; border-top: 1px solid #e3e3e3; padding-top: 20px; margin-top: 12px; font-size: .85rem; color: #6b6b6b; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer__legal p { margin: 0; }
.footer__credito a { color: var(--azul); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; transition: color .25s; }
.footer__credito a:hover { color: var(--celeste); }
@media (max-width: 1024px) { .footer .contenedor { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px)  { .footer .contenedor { grid-template-columns: 1fr; } .footer__logo img { width: 220px; } }

/* ---------- Botón flotante WhatsApp ---------- */
.wa-flotante {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%; background: var(--verde);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.wa-flotante::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(12, 158, 22, .55); animation: wa-onda 2.8s ease-out infinite;
}
.wa-flotante:hover { transform: scale(1.1); box-shadow: 0 12px 26px rgba(12, 158, 22, .4); }
.wa-flotante svg { position: relative; width: 30px; height: 30px; fill: #fff; }
@keyframes wa-onda {
  0%   { box-shadow: 0 0 0 0 rgba(12, 158, 22, .55); }
  70%, 100% { box-shadow: 0 0 0 22px rgba(12, 158, 22, 0); }
}

/* ---------- Página 404 ---------- */
.error404 { padding: 96px 0; text-align: center; }
.error404 .error404__codigo { margin: 0 0 .2em; font-size: clamp(5rem, 18vw, 9rem); font-weight: 700; line-height: 1; color: var(--celeste); }
.error404 p { max-width: 46ch; margin: 0 auto 1.6em; }
.error404__acciones { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }

/* ---------- Aparición al hacer scroll (la activa main.js, solo bajo el pliegue) ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal--visto { opacity: 1; transform: none; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html, .carrusel__pista { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
  .entrega__sello::before { box-shadow: 0 0 0 14px rgba(0, 175, 240, .2); }
  .entrega__sello::after { display: none; }
}
