/* ==========================================================================
   LAYOUT — Header, Footer, structural wrappers
   ========================================================================== */

/* ==========================================================================
   HEADER — Sticky + dark background
   ========================================================================== */

/* Header: fixed on ALL pages for consistent positioning */
.wp-site-blocks > header.wp-block-template-part,
.wp-site-blocks > .wp-block-template-part:first-child {
  position: fixed !important;
  top: var(--wp-admin--admin-bar--height, 0);
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 !important;
  margin: 0 !important;
  height: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
  font-size: 0;
  line-height: 0;
}

/* WP admin bar below 782px is position:absolute (scrolls away).
   Keep header at top:0 once user scrolls past the admin bar. */
@media (max-width: 782px) {
  .admin-bar .wp-site-blocks > header.wp-block-template-part,
  .admin-bar .wp-site-blocks > .wp-block-template-part:first-child {
    top: 46px;
  }
}

.site-header {
  position: relative;
  z-index: 100;
  font-size: var(--text-m);
  line-height: 1.6;
  background-color: var(--color-secondary) !important;
  border-bottom: none !important;
  will-change: box-shadow;
  transition: background-color var(--transition-base), box-shadow var(--transition-base);
  padding: var(--space-xs) var(--space-s);
}

.site-header.is-scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* Home: transparent header over hero */
.site-header--transparent {
  background-color: transparent !important;
}

.site-header--transparent.is-scrolled {
  background-color: var(--color-secondary) !important;
}

/* Logo */
.site-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo {
  height: 40px;
  width: auto;
}
.site-logo-text {
  font-size: var(--text-l);
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.site-logo-text:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* Nav desktop */
.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-nav__link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: var(--text-s);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 0;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.header-nav__link:hover,
.header-nav__link:focus-visible {
  color: #fff;
}
.header-nav__link[aria-current="page"] {
  color: #fff;
  font-weight: 600;
  position: relative;
}
.header-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-primary);
  border-radius: 1px;
}

/* --- Nav dropdown (sedes) ----------------------------------------------- */
.header-nav__dropdown-wrap {
  position: relative;
}

.header-nav__chevron {
  margin-left: 2px;
  transition: transform 0.2s ease;
}

.header-nav__dropdown-wrap:hover .header-nav__chevron {
  transform: rotate(180deg);
}

.header-nav__dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  background: #fff;
  border-radius: var(--radius-l);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.header-nav__dropdown-wrap:hover .header-nav__dropdown {
  opacity: 1;
  visibility: visible;
}

/* Invisible bridge so hover doesn't break between link and dropdown */
.header-nav__dropdown::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 16px;
}

.header-nav__dropdown-header {
  padding: var(--space-s) var(--space-m);
  border-bottom: 1px solid var(--color-border);
}

.header-nav__dropdown-title {
  display: block;
  font-size: var(--text-s);
  font-weight: 700;
  color: var(--color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-nav__dropdown-subtitle {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-foreground-light);
  margin-top: 2px;
}

.header-nav__dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-m);
  text-decoration: none;
  color: var(--color-foreground);
  transition: background 0.15s ease;
}

.header-nav__dropdown-item:hover {
  background: var(--color-surface);
}

.header-nav__dropdown-item + .header-nav__dropdown-item {
  border-top: 1px solid var(--color-muted);
}

.header-nav__dropdown-icon {
  flex-shrink: 0;
  color: var(--color-primary);
}

.header-nav__dropdown-img {
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  border-radius: var(--radius-s);
  overflow: hidden;
}

.header-nav__dropdown-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-nav__dropdown-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.header-nav__dropdown-name {
  font-size: var(--text-s);
  font-weight: 600;
}

.header-nav__dropdown-phone {
  font-size: var(--text-xs);
  color: var(--color-foreground-light);
}

.header-nav__dropdown-arrow {
  flex-shrink: 0;
  color: var(--color-foreground-light);
  font-size: var(--text-s);
  transition: transform 0.15s ease;
}

.header-nav__dropdown-item:hover .header-nav__dropdown-arrow {
  transform: translateX(3px);
  color: var(--color-primary);
}

.header-nav__dropdown-all {
  display: block;
  padding: var(--space-xs) var(--space-m);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.header-nav__dropdown-all:hover {
  background: var(--color-surface);
}

/* CTA button in header */
.header-cta-btn {
  margin-left: var(--space-2xs);
  font-size: var(--text-xs) !important;
  padding: 8px 20px !important;
  white-space: nowrap;
  background: var(--color-primary) !important;
  color: #fff !important;
  border: none;
}
.header-cta-btn:hover {
  background: var(--color-accent) !important;
}

/* ================================================================
   HAMBURGER TOGGLE (mobile only)
   ================================================================ */

.header-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.menu-toggle-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 18px;
  position: relative;
  flex-shrink: 0;
}

.menu-toggle-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: #fff;
  border-radius: 2px;
  position: absolute;
  left: 0;
  transition: transform 0.3s cubic-bezier(0.77, 0, 0.175, 1),
              opacity 0.2s ease;
}

.menu-toggle-icon span:nth-child(1) { top: 0; }
.menu-toggle-icon span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.menu-toggle-icon span:nth-child(3) { bottom: 0; }

/* Open state: lines -> X */
.header-mobile-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}
.header-mobile-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(2) {
  opacity: 0;
  transform: translateY(-50%) scaleX(0);
}
.header-mobile-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

.header-mobile-toggle:hover .menu-toggle-icon span,
.header-mobile-toggle:focus-visible .menu-toggle-icon span {
  background-color: var(--color-primary);
}

@media (prefers-reduced-motion: reduce) {
  .menu-toggle-icon span {
    transition: none;
  }
}

/* ================================================================
   MOBILE OVERLAY — Fullscreen
   ================================================================ */

.header-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(170deg, #1a1a1a 0%, #0d0d0d 100%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.header-mobile-overlay.is-open {
  display: block;
  animation: overlayFadeIn 0.25s ease-out;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Inner wrapper */
.mobile-menu {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: var(--space-m) var(--space-m) var(--space-l);
}

/* Top: logo + close */
.mobile-menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.mobile-menu__top .site-logo { height: 32px; }

.mobile-menu__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-s);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu__close:hover,
.mobile-menu__close:focus-visible {
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

/* Navigation links */
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.mobile-menu__link {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) var(--space-xs);
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--text-l);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-m);
  transition: all 0.2s ease;
  animation: menuSlideIn 0.35s ease-out both;
}

.mobile-menu__link:hover,
.mobile-menu__link:focus-visible {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.06);
}

.mobile-menu__link--active {
  color: var(--color-primary);
}

.mobile-menu__link--active:hover {
  color: var(--color-primary-light);
}

.mobile-menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-s);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
}

.mobile-menu__link:hover .mobile-menu__icon,
.mobile-menu__link--active .mobile-menu__icon {
  background: rgba(200, 2, 38, 0.15);
  color: var(--color-primary);
}

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

/* CTAs */
.mobile-menu__ctas {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-l);
  padding-top: var(--space-l);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-menu__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  width: 100%;
  padding: 16px;
  font-weight: 700;
  font-size: var(--text-m);
  border-radius: var(--radius-m);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-height: 52px;
  transition: all 0.2s ease;
  animation: menuSlideIn 0.35s ease-out both;
}

.mobile-menu__cta--primary {
  background: var(--color-primary);
  color: var(--color-white);
}
.mobile-menu__cta--primary:hover { background: var(--color-primary-dark); }
.mobile-menu__cta--primary:active { transform: scale(0.98); }

.mobile-menu__cta--wa {
  background: #25D366;
  color: var(--color-white);
}
.mobile-menu__cta--wa:hover { background: #1da851; }
.mobile-menu__cta--wa:active { transform: scale(0.98); }

/* Footer: status + address + phone + social */
.mobile-menu__footer {
  margin-top: auto;
  padding-top: var(--space-l);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  text-align: center;
  animation: menuSlideIn 0.35s ease-out both;
}

.mobile-menu__status {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.mobile-menu__address {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.4);
}

.mobile-menu__phone {
  font-size: var(--text-s);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}
.mobile-menu__phone:hover { color: var(--color-white); }

.mobile-menu__social {
  display: flex;
  gap: var(--space-s);
  margin-top: var(--space-2xs);
}

.mobile-menu__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-s);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: all 0.2s ease;
}

.mobile-menu__social a:hover {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.12);
}

/* ================================================================
   RESPONSIVE HEADER
   ================================================================ */

@media (max-width: 768px) {
  .site-header__nav {
    display: none !important;
  }
  .header-mobile-toggle {
    display: flex;
  }
  .site-logo {
    height: 34px;
  }
  .site-header {
    padding-left: var(--space-xs) !important;
    padding-right: var(--space-xs) !important;
  }
}

@media (max-width: 479px) {
  .site-logo {
    height: 30px;
  }
}

/* ==========================================================================
   SITE FOOTER
   ========================================================================== */

.is-layout-flow > .site-footer,
.wp-site-blocks > footer .site-footer {
  margin-block-start: 0 !important;
  margin-block-end: 0 !important;
}

.site-footer {
  position: relative;
  background: var(--color-secondary);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-2xl) var(--space-s) var(--space-l);
}

.site-footer__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

/* Brand column */
.site-footer__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-bottom: var(--space-s);
}
.site-footer__logo-img {
  height: 28px;
  width: auto;
  display: block;
}
.site-footer__logo-text {
  color: #fff;
  font-size: var(--text-xl);
  font-weight: 700;
}

.site-footer__tagline {
  font-size: var(--text-s);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 var(--space-m) 0;
  max-width: 300px;
}

/* Social */
.site-footer__social {
  display: flex;
  gap: 12px;
}
.site-footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.2s ease, color 0.2s ease;
}
.site-footer__social-link:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Link columns */
.site-footer__heading {
  font-size: var(--text-s);
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-s) 0;
}

.site-footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.site-footer__list a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: var(--text-s);
  transition: color 0.2s ease;
}
.site-footer__list a:hover {
  color: var(--color-primary);
}

/* Bottom bar */
.site-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-s);
  padding-top: var(--space-m);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer__copy,
.site-footer__legal,
.site-footer__credit {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
}
.site-footer__legal a,
.site-footer__credit a {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.2s ease;
}
.site-footer__legal a:hover {
  color: rgba(255, 255, 255, 0.7);
}
.site-footer__credit a:hover {
  color: var(--color-primary);
}

/* Contact list with icons */
.site-footer__contact-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.site-footer__contact-row svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* Horario realtime */
.footer-horario__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.footer-horario__dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}
.footer-horario--abierto .footer-horario__dot {
  background: #4ade80;
}
.footer-horario--abierto .footer-horario__dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.5);
  z-index: -1;
  animation: horarioPulse 2.5s ease-in-out infinite;
}
.footer-horario--cerrado .footer-horario__dot {
  background: #f87171;
}

@keyframes horarioPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.footer-horario__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-horario__day {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  padding: 2px 0;
  border-radius: 4px;
}
.footer-horario__day--hoy {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  margin: 0 -6px;
}
.footer-horario__day--cerrado .footer-horario__day-hours {
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
}
.footer-horario__day-name {
  flex-shrink: 0;
}
.footer-horario__day-hours {
  text-align: right;
  white-space: nowrap;
}
.footer-horario__next {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* Responsive footer */
@media (max-width: 959px) {
  .site-footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: var(--space-l);
  }
  .site-footer__col--horario {
    grid-column: 1 / -1;
  }
  .footer-horario__list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 24px;
  }
}

@media (max-width: 767px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-l);
  }
  .site-footer__col--horario {
    grid-column: auto;
  }
  .footer-horario__list {
    grid-template-columns: 1fr;
  }
  .site-footer__bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ------------------------------------------------------------------------- *
 * Header microtag de colegiada — único de este fork (Enfermera en casa).    *
 * Aparece junto al wordmark/logo, sutil pero leíble.                        *
 * ------------------------------------------------------------------------- */
.site-header__logo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}
.site-header__microtag {
  display: block;
  margin-top: 2px;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

/* ------------------------------------------------------------------------- *
 * Footer — microtag colegiada y bloque de zonas de cobertura.               *
 * ------------------------------------------------------------------------- */
.site-footer__colegiada {
  margin: var(--space-2xs) 0 0;
  font-size: var(--text-xs);
  color: var(--color-foreground-light);
  line-height: 1.5;
}

.site-footer__zonas {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2xs) var(--space-s);
  font-size: var(--text-s);
}
.site-footer__zonas li {
  color: var(--color-foreground-light);
}

@media (max-width: 767px) {
  .site-footer__zonas {
    grid-template-columns: 1fr 1fr;
  }
}
