/* Componentes reutilizables */

/* ---------- Botones ---------- */
.btn-t {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: 48px;
  padding: 14px 28px;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font: 600 var(--fs-btn)/var(--lh-btn) var(--font-sans);
  text-align: center;
  cursor: pointer;
  transition: background-color .2s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn-t svg { flex: none; }

.btn-t--primary { background: var(--brand); color: #ffffff; }
.btn-t--primary:hover { background: var(--brand-dark); color: #ffffff; }

.btn-t--outline { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.btn-t--outline:hover { background: var(--accent); color: var(--brand-dark); border-color: var(--brand-dark); }

.btn-t--outline-light { background: transparent; color: #ffffff; border-color: #ffffff; }
.btn-t--outline-light:hover { background: rgba(255, 255, 255, .12); color: #ffffff; }

.btn-t--wa { background: var(--wa); color: #ffffff; }
.btn-t--wa:hover { background: var(--wa-dark); color: #ffffff; }

@media (max-width: 575.98px) {
  .btn-t--block-m { width: 100%; }
}

/* ---------- Hero (compartido: Home con video, áreas con foto) ---------- */
/* Scrim del hero. El video de la Home tiene ventanales casi blancos detrás del texto: con .63 el texto chico mantiene 4.5:1 (AA) sobre blanco puro. */
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg,
    rgba(var(--brand-deep-rgb), .65) 0%,
    rgba(var(--brand-deep-rgb), .63) 45%,
    rgba(var(--brand-deep-rgb), .85) 100%);
}

/* Entrada del contenido del hero: fade-up de 600 ms (las demoras las define cada página). */
@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Header / navegación ---------- */
/* Fijo: transparente sobre el hero y sólido después de 80 px de scroll (main.js agrega .is-solid) */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  padding-top: 28px;
  padding-bottom: var(--space-2);
  background: transparent;
  transition: background-color .3s var(--ease-out), padding .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.site-header.is-solid {
  padding-top: var(--space-2);
  background: var(--brand-deep);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .18);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.site-header__logo { display: inline-flex; align-items: center; min-height: 44px; }
.site-header__logo img { height: 36px; width: auto; }

.site-nav { display: none; }
.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #ffffff;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  /* Subrayado en lugar de borde: la zona clickeable crece a 44 px sin alejar la línea del texto */
  text-decoration: underline 2px transparent;
  text-underline-offset: 6px;
  transition: text-decoration-color .2s var(--ease-out);
}
.site-nav__link:hover { color: #ffffff; text-decoration-color: rgba(255, 255, 255, .6); }

/* Submenú "Áreas de práctica": botón que despliega la lista (patrón disclosure; lo maneja main.js) */
.site-nav__item--sub { position: relative; }
.site-nav__toggle {
  gap: 6px;
  font-family: inherit;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.site-nav__toggle.is-current,
.site-nav__link[aria-current="page"] { text-decoration-color: #ffffff; }
.site-nav__chevron { transition: transform .2s var(--ease-out); }
.site-nav__toggle[aria-expanded="true"] .site-nav__chevron { transform: rotate(180deg); }
.site-nav__sub {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 10;
  min-width: 260px;
  margin: 8px 0 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
}
/* Puente invisible entre el botón y la lista: el hover no se corta al bajar el mouse */
.site-nav__sub::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.site-nav__sublink {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
}
.site-nav__sublink:hover { background: var(--accent); color: var(--brand-dark); }
.site-nav__sublink[aria-current="page"] { color: var(--brand-dark); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.site-nav__sub :focus-visible { outline-color: var(--brand); outline-offset: -3px; }

.site-header__actions { display: flex; align-items: center; gap: 12px; }

.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: var(--radius-pill);
  color: #ffffff;
  cursor: pointer;
  transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out);
}
.burger:hover { border-color: #ffffff; background: rgba(255, 255, 255, .08); }

@media (min-width: 768px) {
  .site-header__logo img { height: 48px; }
}

@media (min-width: 992px) {
  /* El menú queda al ras del borde derecho del container (igual que la fila de tarjetas del hero) */
  .site-nav { display: block; margin-left: auto; }
  .site-header__actions { display: none; }
}

/* Menú mobile (offcanvas de Bootstrap) */
.mobile-menu.offcanvas {
  --bs-offcanvas-width: min(360px, 88vw);
  background: var(--brand-deep);
  color: #ffffff;
}
.mobile-menu .offcanvas-header {
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
}
.mobile-menu__logo { height: 36px; width: auto; }
.mobile-menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: var(--radius-pill);
  color: #ffffff;
  cursor: pointer;
}
.mobile-menu .offcanvas-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-4);
}
.mobile-menu__list { margin: 0; padding: 0; list-style: none; }
.mobile-menu__link {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
  color: #ffffff;
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
}
.mobile-menu__link:hover { color: var(--on-dark); }
.mobile-menu__link[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
/* Áreas de práctica en el menú mobile: título del grupo y lista anidada */
.mobile-menu__group {
  display: block;
  padding: 14px 0 6px;
  color: #ffffff;
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
}
.mobile-menu__sub {
  margin: 0;
  padding: 0 0 10px 16px;
  list-style: none;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.mobile-menu__sublink {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--on-dark);
  font-size: 17px;
  line-height: 24px;
}
.mobile-menu__sublink:hover { color: #ffffff; }
.mobile-menu__sublink[aria-current="page"] { color: #ffffff; font-weight: 600; }

/* ---------- Tarjeta de área (sobre el video) ---------- */
.area-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  height: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(var(--brand-deep-rgb), .72);
  border: 1px solid rgba(255, 255, 255, .24);
  color: #ffffff;
  transition: background-color .25s var(--ease-out), border-color .25s var(--ease-out);
}
.area-card:hover {
  color: #ffffff;
  background: rgba(var(--brand-deep-rgb), .9);
  border-color: var(--accent);
}
.area-card__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 22px;
  line-height: 28px;
  color: #ffffff;
}
.area-card__text { font-size: 14px; line-height: 22px; color: var(--on-dark); }

/* Variante para fondo claro (página El estudio). Hover: solo borde y color del título */
.area-card--claro { background: var(--surface-alt); border-color: var(--line); color: var(--brand); }
.area-card--claro .area-card__title { color: var(--ink); transition: color .25s var(--ease-out); }
.area-card--claro .area-card__text { color: var(--muted); }
.area-card--claro:hover { background: var(--surface-alt); border-color: var(--brand); color: var(--brand); }
.area-card--claro:hover .area-card__title { color: var(--brand-dark); }

/* ---------- Métrica ---------- */
.metric {
  height: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--accent);
}
.metric__value {
  margin-bottom: var(--space-1);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--fs-num);
  line-height: var(--lh-num);
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.metric__label { font-size: 16px; line-height: 24px; color: var(--ink); }

@media (min-width: 768px) {
  .metric { padding: var(--space-4); }
}

/* ---------- Tarjeta de sucursal ---------- */
.branch-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.branch-card__media {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  object-position: 50% 100%; /* si se recorta, que no se pierdan los créditos de Google */
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
}
.branch-card__body { display: flex; flex-direction: column; flex: 1; padding: var(--space-3); }
.branch-card__title { margin-bottom: var(--space-1); }
.branch-card__line { color: var(--muted); }
/* Teléfono: zona táctil de 44 px sin cambiar el alto de la línea */
.branch-card__line a { display: inline-block; padding: 12px 0; margin: -12px 0; }
.branch-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: var(--space-3);
}

/* ---------- Formulario ---------- */
.form-card {
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) {
  .form-card { padding: 40px; }
}

.form-field { margin-bottom: 20px; }
.form-field__label {
  display: block;
  margin-bottom: var(--space-1);
  padding: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--ink);
}
.form-field__input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 400 16px/24px var(--font-sans);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.form-field__input:hover { border-color: #aab8c3; }
.form-field__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 117, 170, .25);
}
textarea.form-field__input { resize: vertical; min-height: 120px; }

.form-fieldset { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; }

.option-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  height: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 22px;
  cursor: pointer;
  transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out);
}
.option-chip:hover { border-color: var(--brand); }
.option-chip input { flex: none; margin: 0; accent-color: var(--brand-dark); }
.option-chip:has(input:checked) {
  border-color: var(--brand-dark);
  background: var(--accent);
  box-shadow: inset 0 0 0 1px var(--brand-dark);
}
.option-chip:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Errores por campo */
.form-field__error {
  margin-top: 6px;
  color: var(--error);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}
.form-fieldset .form-field__error { margin: 0 0 var(--space-1); }
.form-field__input[aria-invalid="true"] { border-color: var(--error); }
.form-field__input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .2); }
.form-fieldset[aria-invalid="true"] .option-chip { border-color: var(--error); }

/* Honeypot: fuera de la pantalla (no display:none, que algunos bots detectan) */
.form-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-card { position: relative; }
/* Dentro de una sección oscura, el foco del formulario (fondo blanco) sigue siendo azul */
.on-dark .form-card :focus-visible { outline-color: var(--brand); }
/* Área de la consulta en el formulario corto de las páginas de área */
.form-card__tag {
  display: inline-block;
  margin-bottom: var(--space-3);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--brand-dark);
  font-size: var(--fs-label);
  line-height: var(--lh-label);
  font-weight: 600;
}
.form-card__privacy {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

/* Resultado del envío (zona aria-live: siempre presente, se ve solo con mensaje) */
.form-status { margin-top: var(--space-2); }
.form-status:empty { margin: 0; }
.form-status--ok,
.form-status--error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
}
.form-status--ok { background: var(--accent); color: var(--brand-dark); }
.form-status--error { background: #fdeceb; color: var(--error); }
.form-status:focus { outline: none; }

/* Botón mientras se envía */
.btn-t[aria-disabled="true"] { opacity: .7; cursor: progress; transform: none; }

/* ---------- Footer ---------- */
.site-footer {
  padding-top: 72px;
  padding-bottom: 104px; /* deja libre el botón flotante de WhatsApp */
  background: var(--brand-deep);
  color: var(--on-dark);
  font-size: 15px;
  line-height: 22px;
  text-align: center;
}
.site-footer__logo { display: block; height: 36px; width: auto; margin: 0 auto 20px; }
.site-footer__claim { max-width: 320px; margin: 0 auto; line-height: 24px; }
.site-footer__bottom {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255, 255, 255, .2);
  font-size: 13px;
  line-height: 18px;
}

@media (min-width: 768px) {
  .site-footer__logo { height: 48px; }
}

/* ---------- WhatsApp flotante ---------- */
/* El ícono (img/whatsapp.webp) ya es el globo verde: el botón no lleva fondo propio. */
.wa-float {
  position: fixed;
  right: max(var(--space-2), env(safe-area-inset-right));
  bottom: max(var(--space-2), env(safe-area-inset-bottom));
  z-index: 1030; /* sobre el contenido, debajo del offcanvas de Bootstrap (1045) */
  display: block;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-pill);
  filter: drop-shadow(0 6px 14px rgba(15, 26, 43, .28));
  transition: filter .2s var(--ease-out);
}
.wa-float__icon { display: block; width: 100%; height: 100%; }
.wa-float:hover { filter: drop-shadow(0 10px 20px rgba(15, 26, 43, .36)); }
/* Doble anillo: se ve sobre fondos claros y oscuros */
.wa-float:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--brand-deep);
}

@media (min-width: 768px) {
  .wa-float {
    right: max(var(--space-4), env(safe-area-inset-right));
    bottom: max(var(--space-4), env(safe-area-inset-bottom));
    width: 64px;
    height: 64px;
  }
}

/* ---------- Tarjeta de reseña ---------- */
.review-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  margin: 0;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.review-card__stars { display: flex; gap: 4px; color: var(--accent); }
.review-card__stars svg { stroke: var(--accent-dark); }
.review-card__text { margin: 0; color: var(--ink); }
.review-card__author { margin-top: auto; font-size: 15px; line-height: 22px; }
.review-card__author strong { display: block; color: var(--ink); }
.review-card__author span { color: var(--muted); }

/* ---------- Slider (scroll con snap, sin dependencias) ---------- */
/* 1 tarjeta y un asomo de la siguiente en mobile, 2 en tablet, 3 en desktop. */
.slider { --slider-gap: var(--space-3); }
.slider__track {
  display: flex;
  gap: var(--slider-gap);
  margin: 0;
  padding: 4px 0 var(--space-2);
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.slider__track::-webkit-scrollbar { display: none; }
.slider__track:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; border-radius: var(--radius-md); }
.slider__item {
  flex: 0 0 85%;
  scroll-snap-align: start;
}
.slider__controls { display: flex; gap: var(--space-1); }
.slider__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color .2s ease-out, color .2s ease-out;
}
.slider__btn:hover:not(:disabled) { color: #fff; background: var(--brand); border-color: var(--brand); }
.slider__btn:disabled { color: var(--muted); opacity: .45; cursor: default; }

@media (min-width: 768px) {
  .slider__item { flex-basis: calc((100% - var(--slider-gap)) / 2); }
}
@media (min-width: 992px) {
  .slider__item { flex-basis: calc((100% - 2 * var(--slider-gap)) / 3); }
}
@media (prefers-reduced-motion: no-preference) {
  .slider__track { scroll-behavior: smooth; }
}
