/* =========================================================
   Aquílex — sistema visual
   Se carga después de bootstrap.min.css (Bootswatch Flatly)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
  --aq-blue: #12809c;
  --aq-blue-dark: #0c6478;
  --aq-green: #a8ce39;
  --aq-green-dark: #8bb02b;
  --aq-navy: #1f3245;
  --aq-ink: #2b3a45;
  --aq-muted: #64798a;
  --aq-light: #f4f9fb;
  --aq-white: #ffffff;
  --aq-radius: 14px;
  --aq-shadow: 0 10px 30px rgba(31, 50, 69, 0.08);
  --aq-shadow-hover: 0 16px 36px rgba(31, 50, 69, 0.14);
}

html {
  scroll-behavior: smooth;
}

img {
  max-width: 100%;
  height: auto;
}

body {
  font-family: 'Nunito Sans', 'Lato', sans-serif;
  color: var(--aq-ink);
  background-color: var(--aq-white);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', 'Lato', sans-serif;
  font-weight: 600;
  color: var(--aq-navy);
}

a {
  color: var(--aq-blue-dark);
}

a:hover {
  color: var(--aq-green-dark);
}

/* ---------- Navbar ---------- */
#mainNav {
  background-color: var(--aq-light) !important;
  border-bottom: 1px solid rgba(31, 50, 69, 0.08);
  box-shadow: 0 4px 20px rgba(31, 50, 69, 0.10);
  padding-top: .6rem;
  padding-bottom: .6rem;
}

#mainNav .navbar-brand img {
  transition: transform .2s ease;
}

#mainNav .nav-link {
  color: var(--aq-navy) !important;
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: .02em;
  padding: .5rem 1rem !important;
  position: relative;
}

#mainNav .nav-link:hover,
#mainNav .nav-link:focus,
#mainNav .nav-link.active {
  color: var(--aq-blue-dark) !important;
}

#mainNav .dropdown-menu {
  border: none;
  border-radius: var(--aq-radius);
  box-shadow: var(--aq-shadow);
  padding: .5rem;
}

#mainNav .dropdown-item {
  border-radius: 8px;
  padding: .55rem .9rem;
  font-weight: 500;
}

#mainNav .dropdown-item:hover {
  background-color: var(--aq-light);
  color: var(--aq-blue-dark);
}

.navbar-toggler {
  border-color: var(--aq-navy) !important;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(31,50,69,1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E") !important;
}

/* Compensar la navbar fija */
body { padding-top: 84px; }

/* ---------- Botones ---------- */
.btn-primary,
.btn.btn-primary {
  background-color: var(--aq-blue);
  border-color: var(--aq-blue);
  border-radius: 50px;
  padding: .65rem 1.75rem;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(42, 182, 221, .28);
}

.btn-primary:hover,
.btn-primary:focus,
.btn.btn-primary:hover {
  background-color: var(--aq-blue-dark);
  border-color: var(--aq-blue-dark);
}

.btn-success,
.btn.btn-success {
  background-color: var(--aq-green);
  border-color: var(--aq-green);
  border-radius: 50px;
  font-weight: 600;
  /* Texto oscuro: el verde de marca es demasiado claro para blanco (WCAG AA) */
  color: var(--aq-navy);
}

.btn-success:hover {
  background-color: var(--aq-green-dark);
  border-color: var(--aq-green-dark);
  color: var(--aq-navy);
}

.btn:disabled,
.btn.disabled {
  opacity: .45;
  box-shadow: none;
}

/* El tema Flatly pinta el aspa de .btn-close en blanco y nuestros modales tienen
   la cabecera clara, así que la X quedaba invisible. Se repinta en azul oscuro. */
.btn-close {
  --bs-btn-close-color: var(--aq-navy);
  --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231f3245'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
  --bs-btn-close-opacity: .65;
  --bs-btn-close-hover-opacity: 1;
}

.btn-outline-light-aq {
  border: 2px solid var(--aq-white);
  color: var(--aq-white);
  border-radius: 50px;
  padding: .6rem 1.6rem;
  font-weight: 600;
  transition: all .2s ease;
}

.btn-outline-light-aq:hover {
  background-color: var(--aq-white);
  color: var(--aq-blue-dark);
}

/* ---------- Secciones ---------- */
.page-section {
  padding: 5.5rem 0;
}

.eyebrow {
  display: inline-block;
  color: var(--aq-green-dark);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .82rem;
  margin-bottom: .5rem;
}

.section-heading {
  font-size: 2.1rem;
  margin-bottom: .5rem;
}

.section-lead {
  color: var(--aq-muted);
  font-size: 1.05rem;
  max-width: 700px;
}

.section-lead.mx-auto {
  text-align: center;
}

.bg-aq-light {
  background-color: var(--aq-light);
}

.bg-aq-blue {
  background-color: var(--aq-blue) !important;
  color: var(--aq-white);
}

.bg-aq-navy {
  background-color: var(--aq-navy) !important;
  color: var(--aq-white);
}

.bg-aq-blue h1, .bg-aq-blue h2, .bg-aq-blue h3,
.bg-aq-navy h1, .bg-aq-navy h2, .bg-aq-navy h3 {
  color: var(--aq-white);
}

.bg-aq-blue p, .bg-aq-blue li,
.bg-aq-navy p, .bg-aq-navy li {
  color: rgba(255, 255, 255, .9);
}

.bg-aq-blue .eyebrow {
  color: var(--aq-white);
}

/* ---------- Hero / slider ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background-color: var(--aq-navy);
}

.hero .slider {
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.hero .slider ul {
  display: flex;
  padding: 0;
  margin: 0;
  width: 400%;
  animation: cambio 24s infinite alternate ease-in-out;
}

.hero .slider li {
  width: 100%;
  list-style: none;
  line-height: 0;
}

.hero .slider img {
  width: 100%;
  height: 62vh;
  min-height: 360px;
  object-fit: cover;
  object-position: 50% 50%;
  filter: brightness(.55);
}

/* La foto de equipo es de cuerpo entero: centrada verticalmente el recorte
   dejaba las caras fuera, así que este slide encuadra hacia arriba. */
.hero .slider img.encuadre-arriba {
  object-position: 50% 12%;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(19, 35, 48, .45), rgba(19, 35, 48, .65));
  pointer-events: none;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  box-sizing: border-box;
}

.hero-overlay-content {
  width: 100%;
  max-width: 720px;
}

.hero-overlay-content h1 {
  color: var(--aq-white);
  font-size: clamp(1.6rem, 4vw, 3.1rem);
  text-shadow: 0 2px 12px rgba(0,0,0,.35);
}

.hero-overlay-content p {
  color: rgba(255,255,255,.92);
  font-size: 1.15rem;
  max-width: 100%;
  margin: 0 auto 1.5rem;
  text-shadow: 0 1px 8px rgba(0,0,0,.3);
}

.hero-overlay-content .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
}

@keyframes cambio {
  0%   { margin-left: 0; }
  20%  { margin-left: 0; }
  25%  { margin-left: -100%; }
  45%  { margin-left: -100%; }
  50%  { margin-left: -200%; }
  70%  { margin-left: -200%; }
  75%  { margin-left: -300%; }
  100% { margin-left: -300%; }
}

/* ---------- Tarjetas de equipo ---------- */
.team-card {
  background: var(--aq-white);
  border-radius: var(--aq-radius);
  box-shadow: var(--aq-shadow);
  overflow: hidden;
  height: 100%;
  transition: transform .25s ease, box-shadow .25s ease;
}

.team-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--aq-shadow-hover);
}

.team-card .team-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.team-card .team-body {
  padding: 1.5rem;
}

.team-card h3 {
  font-size: 1.15rem;
  margin-bottom: .75rem;
  color: var(--aq-blue-dark);
}

.team-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: .92rem;
  color: var(--aq-muted);
}

.team-card ul li {
  padding: .3rem 0;
  border-top: 1px solid var(--aq-light);
}

.team-card ul li:first-child {
  border-top: none;
}

/* ---------- Rejilla compacta de equipo ---------- */
/* Cada fila es su propio contenedor (fisios arriba, resto del equipo abajo) y va
   centrada. El ancho de tarjeta es el mismo en todas para que queden alineadas
   tenga la fila 4 o 5 personas. */
.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
}

.team-grid + .team-grid {
  margin-top: 1rem;
}

.team-card-mini {
  flex: 1 1 170px;
  max-width: 205px;
  display: flex;
  flex-direction: column;
  background: var(--aq-white);
  border-radius: var(--aq-radius);
  box-shadow: var(--aq-shadow);
  overflow: hidden;
  transition: box-shadow .2s ease;
}

.team-card-mini:hover {
  box-shadow: var(--aq-shadow-hover);
}

.team-photo-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
}

.team-photo-item:focus-visible {
  outline: 3px solid var(--aq-blue);
  outline-offset: -3px;
}

.team-photo-item::after {
  content: '\f065';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(19, 35, 48, .55);
  color: var(--aq-white);
  font-size: .7rem;
  opacity: 0;
  transition: opacity .25s ease;
}

.team-photo-item:hover::after,
.team-photo-item:focus-visible::after {
  opacity: 1;
}

.team-card-mini .team-photo-mini {
  width: 100%;
  aspect-ratio: 1 / 1;
  /* Marco cuadrado: los retratos son verticales, así que un marco apaisado
     recortaba la cara. Cada foto ajusta su object-position en el HTML. */
  object-fit: cover;
  object-position: 50% 20%;
  display: block;
  transition: transform .35s ease;
}

.team-photo-item:hover .team-photo-mini {
  transform: scale(1.06);
}

.team-card-mini .team-avatar-mini {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--aq-white);
  font-family: 'Poppins', 'Lato', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--aq-blue), var(--aq-navy));
}

.team-card-mini .team-body-mini {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: .75rem .8rem .9rem;
}

.team-card-mini h3 {
  font-size: .82rem;
  font-weight: 600;
  color: var(--aq-blue-dark);
  margin: 0;
  line-height: 1.25;
  /* Se reservan dos líneas para el nombre: así el cargo y el botón de titulaciones
     caen a la misma altura tanto si el nombre ocupa una línea como si ocupa dos. */
  min-height: 2.5em;
}

.team-role-mini {
  margin: .2rem 0 0;
  font-size: .72rem;
  line-height: 1.35;
  color: var(--aq-muted);
  min-height: 1.35em;
}

.team-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .6rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--aq-blue-dark);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
}

.team-toggle:hover {
  color: var(--aq-green-dark);
}

.team-toggle i {
  font-size: .6rem;
  transition: transform .2s ease;
}

.team-toggle[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.team-titles {
  list-style: none;
  margin: .5rem 0 0;
  padding: 0;
  font-size: .72rem;
  color: var(--aq-muted);
  line-height: 1.35;
}

.team-titles li {
  padding: .28rem 0;
  border-top: 1px solid var(--aq-light);
}

.team-titles li:first-child {
  border-top: none;
}

/* ---------- Selector de sede (pedir cita) ---------- */
.selector-sede {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.btn-sede {
  flex: 1 1 12rem;
  padding: .85rem 1.25rem;
  border: 2px solid var(--aq-blue);
  border-radius: var(--aq-radius);
  background: var(--aq-white);
  color: var(--aq-blue-dark);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.btn-sede:hover {
  background: var(--aq-light);
}

.btn-sede.activa {
  background: var(--aq-blue);
  color: var(--aq-white);
  box-shadow: 0 8px 18px rgba(18, 128, 156, .28);
}

.btn-sede:focus-visible {
  outline: 3px solid var(--aq-navy);
  outline-offset: 2px;
}

/* ---------- Pasos de la reserva (centro -> calendario -> datos) ---------- */
.pasos-cita > [id] {
  transition: max-width .35s ease, flex-basis .35s ease;
}

.pasos-cita [hidden] {
  display: none !important;
}

/* Las tarjetas entran con un pequeño desplazamiento, para que se vea que el
   calendario se recoge y los datos aparecen a su lado. */
#columnaDatos:not([hidden]),
#columnaCalendario:not([hidden]) {
  animation: aparecerPaso .35s ease both;
}

@keyframes aparecerPaso {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .pasos-cita > [id],
  #columnaDatos:not([hidden]),
  #columnaCalendario:not([hidden]) {
    animation: none;
    transition: none;
  }
}

/* Día elegido en el calendario de reserva */
#calendarioReserva .fc-daygrid-day.dia-elegido {
  outline: 2px solid var(--aq-blue-dark);
  outline-offset: -2px;
  background: rgba(18, 128, 156, .08);
}

/* ---------- Tarjetas de servicio ---------- */
.service-card {
  background: var(--aq-white);
  border-radius: var(--aq-radius);
  box-shadow: var(--aq-shadow);
  padding: 2.25rem;
  height: 100%;
}

.service-card img {
  border-radius: var(--aq-radius);
  width: 100%;
  height: auto;
  box-shadow: var(--aq-shadow);
}

.service-list {
  columns: 1;
  padding-left: 1.1rem;
  color: var(--aq-ink);
}

@media (min-width: 768px) {
  .service-list.two-col {
    columns: 2;
    column-gap: 2.5rem;
  }
}

/* ---------- Galería ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.gallery-item {
  border-radius: var(--aq-radius);
  overflow: hidden;
  box-shadow: var(--aq-shadow);
  aspect-ratio: 4 / 3;
  cursor: pointer;
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.gallery-item:focus-visible {
  outline: 3px solid var(--aq-blue);
  outline-offset: 2px;
}

.gallery-item::after {
  content: '\f065';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: .6rem;
  right: .6rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(19, 35, 48, .55);
  color: var(--aq-white);
  font-size: .8rem;
  opacity: 0;
  transition: opacity .25s ease;
}

.gallery-item:hover::after,
.gallery-item:focus-visible::after {
  opacity: 1;
}

/* ---------- Lightbox ---------- */
.lightbox-dialog {
  max-width: 90vw;
}

.lightbox-content {
  background: transparent;
  border: none;
}

.lightbox-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}

.lightbox-image {
  max-width: 100%;
  max-height: 82vh;
  border-radius: var(--aq-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

.lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background-color: var(--aq-white);
  opacity: 1;
  border-radius: 50%;
  padding: .6rem;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .9);
  color: var(--aq-navy);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--aq-shadow);
  transition: background .2s ease;
}

.lightbox-nav:hover {
  background: var(--aq-white);
  color: var(--aq-blue-dark);
}

.lightbox-prev {
  left: -1.2rem;
}

.lightbox-next {
  right: -1.2rem;
}

.lightbox-counter {
  position: absolute;
  bottom: -2.2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--aq-white);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .04em;
}

@media (max-width: 767px) {
  .lightbox-prev { left: .5rem; }
  .lightbox-next { right: .5rem; }
  .lightbox-close { top: .5rem; right: .5rem; }
}

/* ---------- Ubicación ---------- */
.map-frame {
  border-radius: var(--aq-radius);
  overflow: hidden;
  box-shadow: var(--aq-shadow);
}

/* Ficha de cada sede en la sección de Ubicación */
.sede-card {
  background: var(--aq-white);
  border-radius: var(--aq-radius);
  box-shadow: var(--aq-shadow);
  padding: 1.5rem;
  height: 100%;
}

.sede-card h3 {
  color: var(--aq-blue-dark);
}

/* ---------- Formularios ---------- */
.card-form {
  background: var(--aq-white);
  border-radius: var(--aq-radius);
  box-shadow: var(--aq-shadow);
  padding: 2.25rem;
}

.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid #dfe7ec;
  padding: .6rem .9rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--aq-blue);
  box-shadow: 0 0 0 .2rem rgba(42, 182, 221, .18);
}

label {
  font-weight: 600;
  color: var(--aq-navy);
  font-size: .9rem;
}

/* Sugerencias de pacientes bajo un buscador del panel (js/buscador_pacientes.js):
   flotan sobre lo que haya debajo para no empujar el formulario al escribir. */
.sugerencias-pacientes {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 2px;
  box-shadow: var(--aq-shadow-hover);
}

.sugerencias-pacientes .list-group-item {
  padding: .45rem .75rem;
}

.sugerencias-pacientes .list-group-item.active small {
  color: inherit !important;
}

/* ---------- Footer ---------- */
.site-footer {
  background-color: var(--aq-navy);
  color: rgba(255,255,255,.85);
  padding: 4rem 0 2rem;
  border-top: 1px solid rgba(255,255,255,.15);
}

.site-footer h4 {
  color: var(--aq-white);
  font-size: 1.05rem;
  letter-spacing: .04em;
  margin-bottom: 1.1rem;
}

.site-footer a {
  color: rgba(255,255,255,.85);
}

.site-footer a:hover {
  color: var(--aq-green);
}

.site-footer .footer-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  margin-right: .6rem;
  font-size: 1.1rem;
  transition: background .2s ease;
}

.site-footer .footer-icon-link:hover {
  background: var(--aq-blue);
  color: var(--aq-white);
}

.site-footer .footer-icon-link:last-child {
  margin-right: 0;
}

.site-footer .footer-links {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: .88rem;
}

.site-footer .footer-links-sep {
  margin: 0 .6rem;
  color: rgba(255,255,255,.35);
}

.site-footer .footer-bottom {
  margin-top: 1rem;
  font-size: .85rem;
  color: rgba(255,255,255,.55);
  text-align: center;
}

/* ---------- WhatsApp flotante ---------- */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background-color: #1c9a4d;
  color: var(--aq-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 1030;
  transition: transform .2s ease;
}

.whatsapp-float:hover {
  color: var(--aq-white);
  transform: scale(1.08);
}

/* Botón de "avisar por WhatsApp" del panel, con el verde de la marca WhatsApp
   ya oscurecido para que el texto blanco tenga contraste suficiente. */
.btn-whatsapp {
  background-color: #1c9a4d;
  border-color: #1c9a4d;
  color: var(--aq-white);
  font-weight: 600;
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
  background-color: #157a3c;
  border-color: #157a3c;
  color: var(--aq-white);
}

/* ---------- Aviso de cookies ---------- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  background: var(--aq-navy);
  color: rgba(255,255,255,.9);
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  box-shadow: 0 -4px 20px rgba(0,0,0,.2);
}

.cookie-banner-text {
  font-size: .9rem;
  max-width: 700px;
}

.cookie-banner-text a {
  color: var(--aq-green);
  text-decoration: underline;
}

@media (max-width: 575px) {
  .whatsapp-float {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
    bottom: 1rem;
    right: 1rem;
  }
}

@media (max-width: 767px) {
  body { padding-top: 72px; }
  .page-section { padding: 3.5rem 0; }
}

/* ---------- Impresion / Generar PDF ---------- */
@media print {
  #mainNav, .site-footer, .no-print {
    display: none !important;
  }

  body {
    padding-top: 0 !important;
    background: var(--aq-white) !important;
  }

  .card-form {
    box-shadow: none !important;
    border: 1px solid #dfe7ec;
  }
}

/* ---------- Hoja imprimible de la historia clínica ----------
   Los campos del formulario son textarea, y los navegadores no los estiran al
   imprimir: el texto largo salía cortado. Por eso al pulsar "Generar PDF" se
   monta esta hoja aparte con el texto plano y es lo único que se imprime. */
#hojaImpresion {
  display: none;
}

@media print {
  body.imprimiendo-ficha > *:not(#hojaImpresion) {
    display: none !important;
  }

  body.imprimiendo-ficha #hojaImpresion {
    display: block;
  }

  @page {
    margin: 1.5cm 1.4cm;
  }

  #hojaImpresion {
    font-family: 'Nunito Sans', 'Lato', sans-serif;
    /* Cuerpo e interlineado ajustados para que una ficha completa quepa en un
       folio sin quedar al límite: con 10,5pt se iba a una segunda página. */
    font-size: 10pt;
    line-height: 1.35;
    color: #000;
  }

  .hoja-cabecera {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 2px solid var(--aq-blue-dark);
    padding-bottom: .4rem;
    margin-bottom: .7rem;
  }

  .hoja-marca {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
  }

  .hoja-logo {
    height: 34pt;
    width: auto;
  }

  .hoja-cabecera h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 15pt;
    margin: 0;
    color: var(--aq-blue-dark);
  }

  .hoja-cabecera .hoja-centro {
    font-size: 9pt;
    color: #444;
    text-align: center;
    margin-top: .25rem;
  }

  .hoja-identidad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .25rem 1.5rem;
    border: 1px solid #bbb;
    padding: .5rem .7rem;
    margin-bottom: .75rem;
  }

  .hoja-dato .hoja-etiqueta {
    display: block;
    font-size: 7.5pt;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #555;
  }

  .hoja-dato .hoja-valor {
    font-weight: 600;
  }

  .hoja-seccion {
    /* Que un apartado no se parta entre dos páginas si cabe entero. */
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: .45rem;
  }

  .hoja-seccion > h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 10.5pt;
    margin: 0 0 .2rem;
    padding-bottom: .12rem;
    border-bottom: 1px solid #ccc;
    color: var(--aq-blue-dark);
  }

  .hoja-seccion p {
    margin: 0;
    /* El texto se imprime entero, sin recortes ni barras de desplazamiento. */
    white-space: pre-wrap;
    overflow-wrap: break-word;
  }

  .hoja-rejilla {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem 1.5rem;
  }

  .hoja-rejilla .hoja-campo {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .hoja-rejilla .hoja-etiqueta {
    font-weight: 700;
    font-size: 9pt;
  }

  .hoja-firma {
    margin-top: 1.2rem;
    text-align: right;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .hoja-firma-img {
    height: 42pt;
    width: auto;
  }

  .hoja-firma p {
    margin: 0;
    font-size: 8.5pt;
    line-height: 1.3;
  }

  .hoja-firma .hoja-firma-nombre {
    font-weight: 700;
  }

  .hoja-pie {
    margin-top: .8rem;
    padding-top: .35rem;
    border-top: 1px solid #ccc;
    font-size: 8pt;
    color: #555;
    display: flex;
    justify-content: space-between;
  }
}

/* ---------- Accesibilidad ---------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 2000;
  background: var(--aq-navy);
  color: var(--aq-white) !important;
  padding: .75rem 1.25rem;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  transition: top .15s ease;
}

.skip-link:focus {
  top: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--aq-blue);
  outline-offset: 2px;
}
