/*
 * Pensión Koxka Ostatua — main.css
 * Estilos de soporte al SCSS compilado del tema.
 * Cubre: room cards, header scroll, breadcrumb,
 * formulario contacto, detalles habitación, utilidades.
 *
 * NOTA: El SCSS compilado (generado desde Figma) debe
 * enlazarse antes o reemplazarse por este archivo.
 */

/* ─────────────────────────────────────────────────────
   0. ACCESIBILIDAD WCAG 2.1 AA — Skip link & Focus
   (WCAG 2.4.1 Bypass Blocks, 2.4.7 Focus Visible,
    1.4.11 Non-text Contrast, 2.4.3 Focus Order)
───────────────────────────────────────────────────── */

/* Skip to main content — visible al recibir foco con teclado */
.koxka-skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 99999;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  color: #095281;
  font-weight: 700;
  font-size: 1rem;
  border: 3px solid #095281;
  text-decoration: none;
  outline: none;
  transition: top 0.2s ease;
}
.koxka-skip-link:focus {
  top: 1rem;
}

/* Focus visible global — cumple WCAG 2.4.7 */
:focus-visible {
  outline: 3px solid #095281;
  outline-offset: 3px;
  border-radius: 2px;
}

/* Quitar outline por defecto en clic (solo conservarlo en teclado) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Botones, links y elementos interactivos — foco con contraste alto */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
.wp-block-button__link:focus-visible,
.wp-element-button:focus-visible {
  outline: 3px solid #095281;
  outline-offset: 3px;
  border-radius: 2px;
}

/* El header fijo se define en la sección 1 HEADER más abajo */

/* Texto de solo lectura para screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Animaciones — respetar prefers-reduced-motion (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─────────────────────────────────────────────────────
   0b. RESET Y BASE
───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* ─────────────────────────────────────────────────────
   1. HEADER FIJO — TRANSPARENTE sobre hero
───────────────────────────────────────────────────── */

/* Variable para altura del header — ajusta si cambias el logo */
:root {
  --koxka-header-h: 90px;
}

/*
 * El header es SIEMPRE transparente por defecto.
 * !important es necesario porque style.css (SCSS de Figma)
 * puede compilar un background-color que lo sobreescribiría.
 */
.koxka-header,
.wp-block-group.koxka-header,
.wp-block-template-part .koxka-header,
header.wp-block-template-part .wp-block-group.koxka-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 9999 !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Estado con scroll — fondo azul Koxka */
.koxka-header.koxka-header--scrolled,
.wp-block-group.koxka-header.koxka-header--scrolled {
  background-color: rgba(9, 82, 129, 0.97) !important;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2) !important;
}

/*
 * Espacio bajo el header fijo.
 * En FSE themes usamos .wp-site-blocks (wrapper de todo el contenido)
 * en lugar de body, para evitar el hueco negro sobre la página.
 */
.wp-site-blocks {
  padding-top: var(--koxka-header-h);
}

/*
 * Páginas con hero full-screen (cover con useFeaturedImage):
 * el bloque de portada/cover debe empezar DESDE ARRIBA (bajo el header transparente),
 * compensando el padding-top del wrapper.
 */
.koxka-hero {
  margin-top: calc(-1 * var(--koxka-header-h));
}

/* Aseguramos que el <header> del template-part no añada altura */
header.wp-block-template-part {
  display: contents;  /* no ocupa flujo de documento */
}
/* Fallback si display:contents causa problemas de landmarks ARIA */
@supports not (display: contents) {
  header.wp-block-template-part {
    height: 0;
    overflow: visible;
  }
}

/* ─────────────────────────────────────────────────────
   1b. HERO HOME — botones CTA
───────────────────────────────────────────────────── */

/*
 * Botón secundario del hero: borde blanco semitransparente.
 * El !important anula el color de hover que WordPress pone por defecto
 * en .wp-element-button:hover (que cambia a background sólido).
 */
.koxka-hero--home .koxka-btn-secondary:hover,
.koxka-hero--home .koxka-btn-secondary:focus-visible {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: #ffffff !important;
  color: #ffffff !important;
}

/*
 * Botón principal del hero: blanco con texto azul.
 * Al hacer hover, ligero oscurecimiento del fondo.
 */
.koxka-hero--home .wp-block-buttons .wp-block-button:first-child .wp-block-button__link:hover,
.koxka-hero--home .wp-block-buttons .wp-block-button:first-child .wp-block-button__link:focus-visible {
  background-color: #e8f0f6 !important;
  color: #095281 !important;
}

/* ─────────────────────────────────────────────────────
   2. BREADCRUMB
───────────────────────────────────────────────────── */
.koxka-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 14px;
  margin-bottom: 12px;
}

.koxka-breadcrumb__item a {
  text-decoration: none;
  transition: opacity 0.2s;
}

.koxka-breadcrumb__item a:hover {
  opacity: 1 !important;
  text-decoration: underline;
}

/* ─────────────────────────────────────────────────────
   3. ROOM CARDS (shortcode [koxka_rooms_grid])
───────────────────────────────────────────────────── */
.koxka-rooms-grid {
  display: grid;
  gap: 30px;
}

.koxka-rooms-grid--cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.koxka-rooms-grid--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1024px) {
  .koxka-rooms-grid--cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .koxka-rooms-grid--cols-2,
  .koxka-rooms-grid--cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Card individual */
.koxka-room-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #eeeeee;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.koxka-room-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

/* Imagen */
.koxka-room-card__image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 552 / 376;
}

.koxka-room-card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.koxka-room-card:hover .koxka-room-card__image-wrap img {
  transform: scale(1.04);
}

/* Nombre de plaza (etiqueta superior) */
.koxka-room-card__plaza {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(9, 82, 129, 0.88);
  color: #ffffff;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
}

/* Cuerpo */
.koxka-room-card__body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.koxka-room-card__title {
  font-family: var(--wp--preset--font-family--dm-serif-display, 'DM Serif Display', serif);
  font-size: 24px;
  font-weight: 400;
  color: #000000;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.koxka-room-card__excerpt {
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 14px;
  line-height: 1.7;
  color: #666666;
  margin: 0 0 20px 0;
  flex: 1;
}

/* Precio */
.koxka-room-card__price {
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: #095281;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.koxka-room-card__price strong {
  font-size: 22px;
  font-weight: 700;
}

/* Botones */
.koxka-room-card__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.koxka-room-card__btn {
  display: inline-block;
  padding: 11px 22px;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.koxka-room-card__btn--leer {
  background: #000000;
  color: #ffffff;
}

.koxka-room-card__btn--leer:hover {
  background: #095281;
  color: #ffffff;
}

.koxka-room-card__btn--reservar {
  background: #095281;
  color: #ffffff;
}

.koxka-room-card__btn--reservar:hover {
  background: #3d82b3;
  color: #ffffff;
}

/* ─────────────────────────────────────────────────────
   4. SINGLE HABITACIÓN
───────────────────────────────────────────────────── */
.koxka-details-table {
  width: 100%;
  border-collapse: collapse;
}

.koxka-details-table__label,
.koxka-details-table__value {
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 15px;
  padding: 10px 0;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: top;
}

.koxka-details-table__label {
  font-weight: 600;
  color: #333333;
  width: 50%;
}

.koxka-details-table__value {
  color: #555555;
}

.koxka-amenities-list ul,
.koxka-bath-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.koxka-amenities-list li,
.koxka-bath-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 14px;
  color: #555555;
  line-height: 1.6;
}

/* Galería single */
.koxka-single-hab__gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.koxka-single-hab__gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.koxka-single-hab__gallery img:first-child {
  grid-column: 1 / -1;
  height: 340px;
}

/* Botón reservar single — ocupa el ancho completo */
.koxka-btn-booking {
  width: 100%;
  display: block;
  text-align: center;
}

/* ─────────────────────────────────────────────────────
   5. GALERÍA GENERAL
───────────────────────────────────────────────────── */
.koxka-gallery.wp-block-gallery {
  gap: 10px !important;
}

.koxka-gallery .wp-block-image img {
  object-fit: cover;
  height: 280px;
  width: 100%;
}

/* ─────────────────────────────────────────────────────
   6. FORMULARIO DE CONTACTO
───────────────────────────────────────────────────── */
.koxka-form input[type="text"],
.koxka-form input[type="email"],
.koxka-form input[type="tel"],
.koxka-form textarea,
.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #dddddd;
  border-radius: 0;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 15px;
  color: #333333;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease;
}

.koxka-form input:focus,
.koxka-form textarea:focus,
.wpcf7-form input:focus,
.wpcf7-form textarea:focus {
  border-color: #095281;
}

.wpcf7-submit,
.koxka-form button[type="submit"] {
  background: #095281;
  color: #ffffff;
  padding: 16px 48px;
  border: none;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}

.wpcf7-submit:hover,
.koxka-form button[type="submit"]:hover {
  background: #3d82b3;
}

/* ─────────────────────────────────────────────────────
   7. MAPA
───────────────────────────────────────────────────── */
.koxka-map-wrapper {
  line-height: 0;
}

.koxka-map-wrapper iframe {
  display: block;
  width: 100%;
}

/* ─────────────────────────────────────────────────────
   8. PAGINACIÓN
───────────────────────────────────────────────────── */
.koxka-pagination .wp-block-query-pagination-numbers {
  display: flex;
  gap: 8px;
  align-items: center;
}

.koxka-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: #095281;
  text-decoration: none;
  border: 1px solid #095281;
  transition: background 0.2s, color 0.2s;
}

.koxka-pagination .page-numbers.current,
.koxka-pagination .page-numbers:hover {
  background: #095281;
  color: #ffffff;
}

/* ─────────────────────────────────────────────────────
   9. NAVEGACIÓN SINGLE ANTERIOR / SIGUIENTE
───────────────────────────────────────────────────── */
.koxka-single-hab__nav .wp-block-post-navigation-link {
  font-family: var(--wp--preset--font-family--poppins, 'Poppins', sans-serif);
}

.koxka-single-hab__nav .wp-block-post-navigation-link a {
  color: #095281;
  text-decoration: none;
}

.koxka-single-hab__nav .wp-block-post-navigation-link a:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────────────────────
   10. FOOTER SCROLL TO TOP
───────────────────────────────────────────────────── */
.koxka-footer__scroll-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s ease, opacity 0.3s ease;
  opacity: 0;
}

.koxka-footer__scroll-top:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ─────────────────────────────────────────────────────
   11. MENU MÓVIL OVERLAY
───────────────────────────────────────────────────── */
body.koxka-nav-open {
  overflow: hidden;
}

@media (max-width: 781px) {
  .wp-block-navigation__responsive-container.is-menu-open {
    background: #095281;
    padding: 80px 24px 40px;
  }

  .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item a {
    font-family: var(--wp--preset--font-family--open-sans, 'Open Sans', sans-serif);
    font-size: 22px;
    color: #ffffff;
    padding: 14px 0;
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }
}

/* ─────────────────────────────────────────────────────
   12. RESPONSIVE GENERAL
───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }

  .koxka-hero__title {
    font-size: 44px !important;
  }

  .koxka-single-hab__gallery {
    grid-template-columns: 1fr;
  }

  .koxka-single-hab__gallery img:first-child {
    height: 220px;
  }

  .koxka-room-card__actions {
    flex-direction: column;
  }

  .koxka-room-card__btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .koxka-hero__title {
    font-size: 34px !important;
  }
}
