/* ==========================================================================
   Clínica Paula Vega — Cromo común a todas las páginas
   Barra superior · cabecera y navegación · migas · pie · barra fija móvil ·
   aviso de cookies. El HTML se copia de web/index.html en cada build.
   ========================================================================== */

/* --- Barra superior (solo escritorio) ------------------------------------ */
.topbar { background: var(--navy-900); color: var(--on-navy-2); font-size: var(--fs-xs); }
.topbar__inner { display: flex; align-items: center; gap: 28px; min-height: 38px; }
.topbar__item { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: inherit; }
.topbar__item .icon { width: 15px; height: 15px; color: var(--teal); }
.topbar__item .icon--star { color: var(--star); }
.topbar__rating { margin-left: auto; color: var(--white); font-weight: 600; }
.topbar__muted { color: var(--on-navy-2); font-weight: 400; }
.topbar :focus-visible { outline-color: var(--teal-on-navy); }
@media (hover: hover) and (pointer: fine) {
  .topbar__rating:hover { text-decoration: underline; text-underline-offset: 3px; }
}
@media (max-width: 1023px) { .topbar { display: none; } }

/* --- Cabecera ------------------------------------------------------------ */
.header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  transition: box-shadow var(--t-hover) ease;
}
.header.is-stuck { box-shadow: var(--shadow-1); }
.header__inner { display: flex; align-items: center; gap: 24px; min-height: var(--header-h); }
.brand { flex: none; }
.brand img { width: auto; height: 52px; }
@media (min-width: 1024px) { .brand img { height: 60px; } }

.nav { margin-left: auto; }
.nav__list { display: flex; align-items: center; gap: 2px; }
.nav__item { position: relative; display: flex; align-items: center; }
.nav__link {
  display: block; padding: 10px 10px; font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; color: var(--ink); border-radius: var(--r-sm);
}
.nav__link[aria-current='page'] { color: var(--teal-ink); box-shadow: inset 0 -2px 0 var(--teal); border-radius: 0; }
.has-sub .nav__link { padding-right: 2px; }
.nav__toggle {
  display: grid; place-items: center; width: 28px; height: 36px;
  background: none; border: 0; border-radius: var(--r-sm); color: var(--ink-2);
}
.nav__toggle .icon { width: 14px; height: 14px; transition: transform var(--t-menu) var(--ease-out); }
.nav__toggle[aria-expanded='true'] .icon { transform: rotate(180deg); }

/* Submenú: aparece desde su disparador (arriba-izquierda), 200 ms ease-out;
   se va más rápido de lo que llega. */
.nav__sub {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 290px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
  padding: 8px 0;
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 120ms ease, transform 140ms var(--ease-out), visibility 0s linear 140ms;
}
.nav__sub a {
  display: block; padding: 9px 18px; font-size: var(--fs-sm); text-decoration: none; color: var(--ink);
}
.nav__sub li:first-child a { font-weight: 650; }
.nav__sub a[aria-current='page'] { color: var(--teal-ink); box-shadow: inset 3px 0 0 var(--teal); }
.has-sub.is-open .nav__sub {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 160ms ease, transform 200ms var(--ease-out), visibility 0s;
}
@media (hover: hover) and (pointer: fine) {
  .nav__link:hover { color: var(--teal-ink); }
  .nav__sub a:hover { background: var(--gray-50); color: var(--teal-ink); }
}

.nav__mobile-cta { display: none; }

.header__actions { display: flex; align-items: center; gap: 18px; }
.header__phone {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 700; font-size: var(--fs-base); color: var(--ink); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.header__phone .icon { width: 22px; height: 22px; color: var(--teal-ink); }
.header__phone span { display: flex; flex-direction: column; line-height: 1.15; }
.header__phone small { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) { .header__phone:hover { color: var(--teal-ink); } }

.menu-toggle {
  display: none; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 12px; background: none;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 650;
  transition: transform var(--t-press) var(--ease-out);
}
.menu-toggle:active { transform: scale(0.97); }
.menu-toggle__bars { display: grid; gap: 5px; width: 18px; }
.menu-toggle__bars span {
  display: block; height: 2px; background: currentColor; border-radius: 1px;
  transition: transform var(--t-menu) var(--ease-out);
}
.menu-toggle[aria-expanded='true'] .menu-toggle__bars span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] .menu-toggle__bars span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 1199px) {
  .header__phone small { display: none; }
  .nav__link { padding-inline: 8px; }
}

@media (max-width: 1023px) {
  .header__actions .header__phone, .header__actions .header__cta { display: none; }
  .header__actions { margin-left: auto; }
  .menu-toggle { display: inline-flex; }
  .nav {
    position: fixed; inset: var(--header-h) 0 0 0; margin: 0;
    background: var(--white); overflow-y: auto; overscroll-behavior: contain;
    padding: 8px var(--gutter) 120px;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 160ms ease, transform 200ms var(--ease-out), visibility 0s linear 200ms;
  }
  .nav.is-open {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 180ms ease, transform 220ms var(--ease-out), visibility 0s;
  }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__item { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
  .nav__link { flex: 1; padding: 16px 0; font-size: var(--fs-lg); }
  .nav__link[aria-current='page'] { box-shadow: none; }
  .nav__toggle { width: 48px; height: 48px; }
  .nav__sub {
    position: static; flex-basis: 100%; min-width: 0; display: none;
    border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; box-shadow: none;
    margin: 0 0 12px; padding: 0;
    opacity: 1; visibility: visible; transform: none; transition: none;
  }
  .has-sub.is-open .nav__sub { display: block; }
  .nav__sub a { padding: 10px 16px; font-size: var(--fs-base); }
  .nav__mobile-cta { display: grid; gap: 12px; margin-top: 24px; }
  html.nav-open { overflow: hidden; }
}

/* --- Migas de pan -------------------------------------------------------- */
.crumbs ol {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px;
  font-size: var(--fs-sm); color: var(--ink-3);
}
.crumbs li { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.crumbs li + li::before {
  content: ''; width: 6px; height: 6px; flex: none;
  border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: 0.6;
}
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); text-decoration: none; }
.crumbs [aria-current='page'] {
  color: var(--ink); font-weight: 600;
  overflow: hidden; max-width: 34ch; white-space: nowrap; text-overflow: ellipsis;
}
@media (hover: hover) and (pointer: fine) { .crumbs a:hover { color: var(--teal-ink); text-decoration: underline; } }

/* Sobre navy (hero de landings y listados del blog) */
.lp-hero .crumbs ol,
.blog-hero .crumbs ol { color: var(--on-navy-2); }
.lp-hero .crumbs a,
.blog-hero .crumbs a { color: var(--on-navy-2); }
.lp-hero .crumbs [aria-current='page'],
.blog-hero .crumbs [aria-current='page'] { color: var(--white); }
@media (hover: hover) and (pointer: fine) {
  .lp-hero .crumbs a:hover,
  .blog-hero .crumbs a:hover { color: var(--white); }
}

/* --- Pie ----------------------------------------------------------------- */
.footer { background: var(--navy-900); color: var(--on-navy-2); font-size: var(--fs-sm); padding-top: clamp(56px, 6vw, 80px); }
.footer a { color: inherit; text-decoration: none; }
.footer :focus-visible { outline-color: var(--teal-on-navy); }
.footer__grid { display: grid; gap: 40px 32px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.footer__grid > * { grid-column: span 12; }
@media (min-width: 640px) { .footer__grid > * { grid-column: span 6; } }
@media (min-width: 1024px) {
  .footer__grid > :nth-child(1) { grid-column: span 4; }
  .footer__grid > :nth-child(2) { grid-column: span 3; }
  .footer__grid > :nth-child(3) { grid-column: span 3; }
  .footer__grid > :nth-child(4) { grid-column: span 2; }
}
.footer h2 {
  font-size: var(--fs-sm); font-weight: 700; color: var(--white); letter-spacing: 0;
  margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--on-navy-line);
}
.footer ul { display: grid; }
.footer li { display: flex; align-items: center; min-height: 36px; }
.footer__brand { display: inline-block; }
.footer__brand img { height: 76px; width: auto; }
.footer__nap { display: grid; gap: 2px; margin-top: 24px; }
.footer__nap a { display: inline-flex; align-items: center; min-height: 36px; color: var(--white); font-weight: 600; }
.footer__social { display: flex; gap: 8px; margin-top: 20px; }
.footer__social a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--on-navy-line); border-radius: var(--r-sm); color: var(--white);
  transition: border-color var(--t-hover) ease;
}
.footer__social .icon { width: 20px; height: 20px; }
.footer__legal {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  margin-top: 48px; padding-block: 24px; border-top: 1px solid var(--on-navy-line);
  font-size: var(--fs-xs);
}
.footer__legal ul { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer__legal li { min-height: 32px; }
@media (hover: hover) and (pointer: fine) {
  .footer a:hover { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
  .footer__social a:hover { border-color: var(--teal); text-decoration: none; }
}

/* --- Barra fija móvil -----------------------------------------------------
   Aparece cuando los CTA del hero salen de pantalla (main.js, .is-hidden).
   Entra desde abajo, 220 ms ease-out; con reduced-motion solo aparece.    */
.callbar { display: none; }
@media (max-width: 767px) {
  .callbar {
    position: fixed; inset: auto 0 0 0; z-index: var(--z-callbar);
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--white); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgb(18 42 58 / 0.08);
    transition: transform 220ms var(--ease-out), visibility 0s;
  }
  .callbar.is-hidden { transform: translateY(110%); visibility: hidden; transition: transform 180ms var(--ease-out), visibility 0s linear 180ms; }
  .callbar .btn { min-height: 50px; padding-inline: 12px; width: 100%; }
  body { padding-bottom: var(--bar-h); }
}
@media (prefers-reduced-motion: reduce) { .callbar, .callbar.is-hidden { transition: none; } }

/* --- Aviso de cookies ---------------------------------------------------- */
.consent {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--bar-h) + 12px + env(safe-area-inset-bottom));
  z-index: var(--z-consent);
  display: grid; gap: 12px;
  max-width: 30rem;
  padding: 16px 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: opacity 200ms ease, transform 240ms var(--ease-out);
}
.consent[hidden] { display: none; }
@starting-style { .consent { opacity: 0; transform: translateY(8px); } }
.consent .btn-row { gap: 8px; }
@media (min-width: 768px) {
  .consent { bottom: 16px; left: 16px; right: auto; }
}
