/* =========================================================
   Farmacia El Ángel · layout.css
   LAYOUT compartido por todas las páginas: contenedor, secciones,
   barra superior, header, menú, encabezado de página, footer,
   barra móvil, botones flotantes y pantalla de carga.
   ========================================================= */
/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container--narrow { --container: 48rem; }
.section { padding-block: var(--sp-section); }
.section--tight { padding-block: calc(var(--sp-section) * .6); }
.section--tint { background: var(--c-aqua-100); }
/* Textura de marca: ángeles del logo en blanco sobre aqua.
   (La url va aquí y no en una variable: url() en var() se resuelve
   relativo a la hoja que la usa y rompería en css/pages/.) */
.hero, .page-hero, .section--aqua {
  background-color: var(--c-aqua-200);
  background-image: url("../img/brand/patron-angeles.webp"), linear-gradient(170deg, var(--c-aqua-200), var(--c-aqua-100));
  background-size: 360px, auto;
}
.section--white { background: var(--c-white); }
.section--navy { background: var(--c-navy-900); color: var(--c-on-dark); }
.section--navy :where(h1, h2, h3, h4) { color: var(--c-white); }

.section-head { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-7); max-width: 44rem; }
.section-head--center { margin-inline: auto; text-align: center; justify-items: center; }
.section-head--center .eyebrow { justify-self: center; }
.section-head--split { max-width: none; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 768px) {
  .section-head--split { grid-template-columns: 1fr auto; gap: var(--sp-6); }
}

.grid { display: grid; gap: var(--sp-5); }
@media (min-width: 640px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } .grid--4 { grid-template-columns: repeat(4, 1fr); } }

.stack > * + * { margin-top: var(--sp-4); }

/* Encabezado de páginas interiores */
.page-hero {
  position: relative; overflow: hidden;
  padding-block: clamp(2.5rem, 2rem + 4vw, 5rem) clamp(2.5rem, 2rem + 3vw, 4.5rem);
}
.page-hero::after { /* aureola decorativa */
  content: ""; position: absolute; right: -7rem; top: -6.5rem; width: 18rem; aspect-ratio: 2.4 / 1;
  border: 3px solid var(--c-white); border-radius: 50%; opacity: .8; pointer-events: none;
  transform: rotate(-8deg);
}
@media (min-width: 768px) { .page-hero::after { right: -6rem; top: -5rem; width: 22rem; } }
.page-hero .container { position: relative; z-index: 1; display: grid; gap: var(--sp-4); }
.page-hero h1 { max-width: 18ch; }
.breadcrumb { font-size: var(--fs-sm); color: var(--c-ink); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: 0; list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; min-height: 44px; }
.breadcrumb li + li::before { content: "/"; margin-right: .4rem; color: var(--c-aqua-600); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- Header / nav ---------- */
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  padding: .75rem 1rem; background: var(--c-navy-900); color: var(--c-white); border-radius: var(--r-sm);
}
.skip-link:focus { top: 1rem; }

.topbar { background: var(--c-navy-900); color: var(--c-on-dark); font-size: var(--fs-sm); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: 40px; }
.topbar .status { color: var(--c-white); font-size: var(--fs-sm); }
.topbar .status[data-state="open"] .status__dot { background: #4ad07e; }
.topbar .status[data-state="closed"] .status__dot { background: #ff8a70; }
.topbar a { color: var(--c-white); text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; }
.topbar a:hover { text-decoration: underline; }
.topbar__extra { display: none; }
@media (min-width: 768px) { .topbar__extra { display: inline-flex; gap: var(--sp-5); } }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(255 255 255 / .94);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); height: var(--header-h); }
.brand { display: inline-flex; align-items: center; min-height: 48px; }
.brand img { width: 168px; height: auto; }

.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 48px; min-width: 48px; padding: 0 .9rem;
  border: 1px solid var(--c-line); border-radius: var(--r-pill); background: var(--c-white);
  font-weight: 700; color: var(--c-navy-700);
}
.nav-toggle__icon { position: relative; width: 18px; height: 12px; }
.nav-toggle__icon span { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: transform var(--t-med) var(--ease), opacity var(--t-fast); }
.nav-toggle__icon span:nth-child(1) { top: 0; }
.nav-toggle__icon span:nth-child(2) { top: 5px; }
.nav-toggle__icon span:nth-child(3) { top: 10px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* Menú móvil: panel desplegable bajo el header */
.nav {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--c-white); border-bottom: 1px solid var(--c-line); box-shadow: var(--sh-2);
  padding: var(--sp-3) var(--gutter) var(--sp-5);
  max-height: calc(100vh - var(--header-h) - 40px); max-height: calc(100dvh - var(--header-h) - 40px); /* dvh: barra del navegador móvil */
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; transform: translateY(-8px); visibility: hidden;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease), visibility 0s linear var(--t-med);
}
.nav.is-open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.nav__list { display: grid; padding: 0; list-style: none; }
.nav__list a {
  display: flex; align-items: center; justify-content: space-between; min-height: 52px;
  padding-inline: var(--sp-2); border-bottom: 1px solid var(--c-line);
  font-size: 1.125rem; font-weight: 700; color: var(--c-navy-700); text-decoration: none;
}
.nav__list a[aria-current="page"] { color: var(--c-aqua-600); }
.nav__list a[aria-current="page"]::after { content: ""; width: 1.4em; height: .55em; border: 2px solid currentColor; border-radius: 50%; }
.nav__cta { margin-top: var(--sp-4); }
.header-cta { display: none; }

/* Navegación de escritorio desde 1200px (7 enlaces + CTA no caben cómodos en 1024) */
.nav__short { display: none; }
@media (min-width: 1200px) {
  .nav-toggle { display: none; }
  .nav {
    position: static; padding: 0; background: none; border: 0; box-shadow: none;
    opacity: 1; transform: none; visibility: visible; max-height: none; overflow: visible;
  }
  .nav__list { display: flex; gap: .15rem; }
  .nav__short { display: inline; }
  .nav__long { display: none; }
  .nav__list a {
    position: relative; min-height: 44px; padding-inline: .75rem; border: 0; white-space: nowrap;
    font-size: 1rem; border-radius: var(--r-pill);
  }
  .nav__list a:hover { background: var(--c-aqua-50); }
  .nav__list a[aria-current="page"] { color: var(--c-navy-700); background: var(--c-aqua-100); }
  .nav__list a[aria-current="page"]::after { display: none; }
  .nav__cta { display: none; }
  .header-cta { display: inline-flex; }
  .brand img { width: 190px; }
}

/* ---------- Acciones fijas ---------- */
/* Móvil: barra inferior con las 3 acciones clave */
.mobile-bar {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: .4rem;
  padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  background: rgb(255 255 255 / .97); border-top: 1px solid var(--c-line);
  box-shadow: 0 -6px 20px rgb(22 54 71 / .08);
}
.mobile-bar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 48px; border-radius: var(--r-md);
  font-size: .8125rem; font-weight: 700; text-decoration: none; color: var(--c-navy-700);
}
.mobile-bar a .ico { font-size: 1.15rem; }
.mobile-bar .mobile-bar__wa { flex-direction: row; gap: .5rem; font-size: 1rem; color: var(--c-white); background: var(--c-wa); }
.mobile-bar .mobile-bar__wa .ico { font-size: 1.35rem; }
body { padding-bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom)); }

/* Botones flotantes: bot de ayuda (siempre) + WhatsApp (escritorio) */
.fabs {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); z-index: 60;
  bottom: calc(var(--mobile-bar-h) + .75rem + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: .75rem;
  pointer-events: none;
}
.fabs > * { pointer-events: auto; }
.wa-fab {
  display: none; align-items: center; gap: .6rem;
  min-height: 56px; padding: 0 1.4rem 0 1.1rem; border-radius: var(--r-pill);
  font-weight: 700; color: var(--c-white); background: var(--c-wa); text-decoration: none;
  box-shadow: var(--sh-3);
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast);
}
.wa-fab .ico { font-size: 1.6rem; }
.wa-fab:hover { transform: translateY(-2px); background: var(--c-wa-hover); }

/* Bot: móvil = avatar redondo; escritorio = píldora con nombre (ver media query abajo) */
.bot-launcher {
  position: relative; display: inline-flex; align-items: center; gap: .7rem; padding: 0;
  border: 0; border-radius: var(--r-pill); background: none;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.bot-launcher__avatar {
  position: relative; display: block; width: 64px; height: 64px; flex: none; border-radius: 50%;
  border: 3px solid var(--c-white); background: var(--c-aqua-200); box-shadow: var(--sh-3); overflow: hidden;
}
/* La cara está en la parte alta de la imagen: se amplía hacia ella para que quede centrada en el círculo */
.bot-launcher__avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); transform-origin: 50% 30%; }
.bot-launcher::before { /* punto verde "en línea" (fuera del avatar para que overflow no lo recorte) */
  content: ""; position: absolute; left: 47px; bottom: 2px; z-index: 1; width: 14px; height: 14px; border-radius: 50%;
  background: #34c46c; border: 2px solid var(--c-white);
}
.bot-launcher__text { display: none; }
.bot-launcher__badge {
  position: absolute; top: -4px; right: -4px; z-index: 2; display: grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); border: 2px solid var(--c-white);
  font-size: .75rem; font-weight: 700; line-height: 1; color: var(--c-white); background: var(--c-closed);
}
.bot-launcher.is-seen .bot-launcher__badge { display: none; }
.bot-launcher:hover { transform: translateY(-2px); }
.bot-launcher[aria-expanded="true"] { transform: scale(.9); opacity: 0; pointer-events: none; }

/* Globo de bienvenida: simula una notificación de chat (el bot "te escribe") */
.bot-teaser {
  position: relative; width: min(310px, calc(100vw - 2rem)); overflow: hidden;
  border-radius: 20px 20px 6px 20px; background: var(--c-white); color: var(--c-ink);
  box-shadow: var(--sh-3), 0 0 0 1px var(--c-line); transform-origin: 100% 100%;
}
.bot-teaser[hidden], .bot-teaser [hidden] { display: none; }
.bot-teaser__head {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .5rem .6rem .75rem;
  color: var(--c-white); background: linear-gradient(120deg, var(--c-navy-700), var(--c-navy-900));
}
.bot-teaser__avatar { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 2px solid var(--c-aqua-400); background: var(--c-aqua-200); }
.bot-teaser__avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); transform-origin: 50% 30%; }
.bot-teaser__head p { flex: 1; display: grid; line-height: 1.2; }
.bot-teaser__head strong { font-family: var(--f-display); font-weight: 900; }
.bot-teaser__head p span { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--c-on-dark); }
.bot-teaser__head p span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #34c46c; }
.bot-teaser__close {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 50%; background: rgb(255 255 255 / .1); color: var(--c-white); font-size: .9rem;
}
.bot-teaser__close:hover { background: rgb(255 255 255 / .22); }
.bot-teaser__body {
  display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; width: 100%;
  padding: .75rem .75rem .25rem; border: 0; background: var(--c-aqua-50); text-align: left; cursor: pointer;
}
.bot-teaser__bubble {
  max-width: 92%; padding: .55rem .8rem; border-radius: 16px 16px 16px 4px;
  font-size: var(--fs-sm); line-height: 1.4; color: var(--c-ink); background: var(--c-white); border: 1px solid var(--c-line);
}
.bot-teaser__bubble strong { color: var(--c-navy-700); }
.bot-teaser__typing { display: inline-flex; gap: 4px; padding: .7rem .85rem; border-radius: 16px 16px 16px 4px; background: var(--c-white); border: 1px solid var(--c-line); }
.bot-teaser__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-aqua-600); }
.bot-teaser__chips { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem .75rem .8rem; background: var(--c-aqua-50); }
.bot-teaser__chips button {
  min-height: 36px; padding: .3rem .75rem; border-radius: var(--r-pill);
  border: 1px solid var(--c-aqua-300); background: var(--c-white); color: var(--c-navy-700);
  font-size: var(--fs-xs); font-weight: 700;
  transition: background-color var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease);
}
.bot-teaser__chips button:hover { background: var(--c-aqua-100); border-color: var(--c-aqua-600); transform: translateY(-1px); }
/* El badge "1" solo aparece cuando llega el mensaje */
.bot-launcher:not(.has-msg) .bot-launcher__badge { display: none; }

@media (min-width: 768px) {
  .mobile-bar { display: none; }
  .wa-fab { display: inline-flex; }
  .fabs { bottom: 1.5rem; right: 1.5rem; }
  body { padding-bottom: 0; }
  /* Escritorio: píldora con nombre, así se entiende qué es */
  .bot-launcher { padding: 5px 1.25rem 5px 5px; background: var(--c-white); box-shadow: var(--sh-3), 0 0 0 1px var(--c-aqua-300); }
  .bot-launcher__avatar { width: 52px; height: 52px; border-width: 2px; box-shadow: none; }
  .bot-launcher__text { display: grid; text-align: left; line-height: 1.2; }
  .bot-launcher__text strong { font-family: var(--f-display); font-size: 1.05rem; font-weight: 900; color: var(--c-navy-700); }
  .bot-launcher__text small { font-size: var(--fs-xs); font-weight: 700; color: var(--c-aqua-600); }
  .bot-launcher__badge { top: -2px; right: auto; left: 40px; }
  .bot-launcher::before { left: 43px; bottom: 5px; width: 12px; height: 12px; }
  .bot-launcher:hover { box-shadow: var(--sh-3), 0 0 0 2px var(--c-aqua-600); }
}

/* ---------- Header al hacer scroll ---------- */
.site-header { transition: box-shadow var(--t-med) var(--ease); }
.site-header.is-scrolled { box-shadow: 0 6px 24px rgb(22 54 71 / .1); }
.site-header .brand img { transition: transform var(--t-med) var(--ease); transform-origin: left center; }
.site-header.is-scrolled .brand img { transform: scale(.92); }

/* ---------- Footer (compacto: solo información de apoyo) ----------
   Móvil/tablet: centrado. Escritorio (1024px): 4 columnas + barra inferior. */
.site-footer { position: relative; overflow-x: clip; margin-top: 48px; background: var(--c-navy-900); color: var(--c-on-dark); font-size: var(--fs-sm); }
.site-footer::before { /* borde superior en arco: une el footer con la página */
  content: ""; position: absolute; left: 50%; top: 0; width: 140%; height: 48px; translate: -50% -60%;
  background: var(--c-navy-900); border-radius: 50% 50% 0 0 / 100% 100% 0 0; pointer-events: none;
}
.site-footer a { color: var(--c-white); text-decoration: none; }
.footer { position: relative; padding-block: var(--sp-5) calc(var(--sp-3) + 80px); } /* 80px: deja libre el bot sobre la barra móvil */
.footer__grid { display: grid; gap: var(--sp-5); }
.footer__col { display: grid; align-content: start; gap: var(--sp-2); min-width: 0; }
.footer__title {
  position: relative; margin-bottom: var(--sp-1); padding-bottom: .45rem;
  font-size: .9375rem; font-weight: 800; letter-spacing: .02em; color: var(--c-white);
}
.footer__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 1.5rem; height: 2px; border-radius: 2px; background: var(--c-aqua-400); }

.footer__brand { justify-self: start; }
.footer__brand img { width: 150px; }
.footer__about p { color: var(--c-on-dark); }

.footer__list { display: grid; margin: 0; }
.footer__list :where(a, li > span) { display: inline-flex; align-items: center; gap: .5rem; min-height: 36px; color: var(--c-on-dark); overflow-wrap: anywhere; }
.footer__list strong { color: var(--c-white); font-weight: 700; }
.footer__list .ico { flex: none; color: var(--c-aqua-400); }
.footer__list a, .footer__bottom nav a { transition: color var(--t-fast); }
.footer__list a:hover, .footer__bottom nav a:hover { color: var(--c-aqua-400); }

.social { display: flex; gap: var(--sp-2); padding: 0; margin: var(--sp-1) 0 0; list-style: none; }
.social a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .18); font-size: 1rem;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-med) var(--ease);
}
.social a:hover { background: var(--c-aqua-400); color: var(--c-navy-900); transform: translateY(-3px) rotate(-6deg); }

.footer__bottom {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
  margin-top: var(--sp-5); padding-top: var(--sp-3); border-top: 1px solid rgb(255 255 255 / .12); font-size: var(--fs-xs);
}
.footer__bottom nav { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); }
.footer__bottom nav a { display: inline-flex; align-items: center; min-height: 36px; color: var(--c-on-dark); }

/* Celular y tablet: todo centrado */
@media (max-width: 1023px) {
  .footer { text-align: center; }
  .footer__col { justify-items: center; }
  .footer__brand { justify-self: center; }
  .footer__title::after { left: 50%; translate: -50% 0; }
  .social { justify-content: center; }
  .footer__list { justify-items: center; }
  .footer__bottom { align-items: center; }
  .footer__bottom nav { justify-content: center; }
}
@media (min-width: 640px) {
  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6) var(--sp-5); }
}
@media (min-width: 768px) {
  .footer { padding-block: var(--sp-6) var(--sp-3); }
  .footer__bottom { flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (min-width: 1024px) {
  .footer__grid { grid-template-columns: 1.1fr .8fr 1.3fr 1.1fr; gap: var(--sp-6); }
  .footer__list :where(a, li > span) { min-height: 32px; }
}

/* ---------- Pantalla de carga ---------- */
.splash { display: none; }
html.splash-on { overflow: hidden; }
html.splash-on .splash {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-content: center; justify-items: center; gap: var(--sp-4);
  background: radial-gradient(40rem 40rem at 50% 45%, var(--c-aqua-100), var(--c-aqua-200));
}
html.splash-out .splash { opacity: 0; transform: scale(1.04); transition: opacity 450ms var(--ease), transform 450ms var(--ease); }
.splash__mark { position: relative; width: 140px; height: 140px; display: grid; place-items: center; border-radius: 50%; background: var(--c-white); box-shadow: var(--sh-3); }
.splash__mark img { width: 104px; height: 104px; }
.splash__halo { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--c-white); }
.splash__name { font-family: var(--f-display); font-size: 1.5rem; font-weight: 800; color: var(--c-navy-700); }
.splash__name strong { font-weight: 900; }
.splash__bar { width: 140px; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .7); overflow: hidden; }
.splash__bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--c-navy-700); }
