/* =============================
   Variables y base tipográfica
   ============================= */
:root {
  --color-primary: #0a2a43;
  --color-primary-contrast: #ffffff;
  --color-accent: #d4af37;
  --color-accent-hover: #b38e2e;
  --color-bg: #ffffff;
  --color-bg-alt: #f4f4f4;
  --color-text: #333333;
  --font-serif: 'Lora', Georgia, 'Times New Roman', Times, serif;
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
  --focus-ring: 2px solid var(--color-accent);
  --transition-fast: 0.18s;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  /* Sticky footer layout */
  min-height: 100vh; /* asegura altura completa de la ventana */
  display: flex;
  flex-direction: column;
}
main {
  flex: 1 0 auto; /* empuja el footer hacia abajo cuando hay poco contenido */
}

/* Clase para bloquear el scroll cuando el menú móvil está abierto */
body.nav-is-open {
  overflow: hidden;
}


/* =============================
   Utilidades de accesibilidad
   ============================= */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
  width: auto;
  height: auto;
  background: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
  border: 2px solid var(--color-primary);
}

/* =============================
   Layout
   ============================= */
.container {
  width: min(90%, 1100px);
  margin-inline: auto;
}

/* =============================
   Header / Navegación
   ============================= */
header {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  padding: 1rem 0;
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2.25rem;
}
.logo {
  height: 64px;
  width: auto;
  display: block;
  /* Tapete blanco detrás del logo (override) */
  background: #fff; /* fondo blanco */
  padding: 6px 10px; /* respiración */
  border-radius: 6px; /* esquinas suaves */
  box-shadow: var(--shadow-sm); /* opcional: sombra leve */
}

header nav {
  display: flex;
  align-items: center;
  gap: 1.25rem; /* << AQUI controlas la separación entre enlaces */
}

/* Área clicable más cómoda y separación interna */
nav a {
  display: inline-block;
  padding: 0.35rem 0.25rem; /* aumenta “hit area” vertical */
  text-decoration: none;
  color: var(
    --color-primary-contrast
  ); /* o var(--color-primary) si header blanco */
}
nav a:focus-visible,
nav a:hover {
  text-decoration: underline;
  color: var(--color-accent);
}

nav a + a {
  position: relative;
}
nav a + a::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 1em;
  background: rgba(255, 255, 255, 0.25); /* ajusta color si header claro */
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.site-header .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.btn--small {
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
}
.btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  margin: 5px 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  .nav {
    position: fixed;
    /* Cambiamos la posición para que entre desde la derecha */
    inset: 0 0 0 auto;
    background: var(--color-primary);
    flex-direction: column;
    gap: 1rem;
    padding: 4rem 2rem;
    width: min(75vw, 300px); /* Ancho del menú */
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 60; /* asegura que el panel quede encima */
  }
  .nav.is-open {
    transform: translateX(0);
  }

  /* Animación del icono de hamburguesa a "X" */
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-of-type(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-of-type(2) {
    opacity: 0;
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-of-type(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* Overlay para el fondo cuando el menú está abierto */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 59; /* Justo debajo del menú */
  }

/* Clase para mostrar el overlay (controlado por JS) */
  .nav-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* =============================
   Botón Volver Arriba
   ============================= */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 1001; /* por encima del menú móvil */
  /* Estado inicial oculto con transición */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility 0s linear 0.2s;
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--color-accent-hover);
}
.back-to-top svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* =============================
   Hero
   ============================= */
/* Asegúrate de tener la imagen en /assets/images/banners/bg-legal.jpg */
.hero {
  background: var(--color-primary) url("/assets/images/banners/bg-legal.jpg")
    center/cover no-repeat;
  color: #fff;
  padding: clamp(3rem, 6vw, 5rem) 0;
  text-align: center;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
  mix-blend-mode: multiply;
}
.hero > .container {
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}
.hero p {
  margin: 0 0 1.25rem;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
}

/* =============================
   Botones
   ============================= */
.btn,
button[type="submit"] {
  cursor: pointer;
  font: inherit;
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  line-height: 1.1;
  transition: background var(--transition-fast),
    transform var(--transition-fast);
  text-decoration: none;
}
.btn:hover,
.btn:focus-visible,
button[type="submit"]:hover,
button[type="submit"]:focus-visible {
  background: var(--color-accent-hover);
}
.btn:active,
button[type="submit"]:active {
  transform: translateY(1px);
}
.btn:focus-visible,
button[type="submit"]:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* =============================
   Secciones / Títulos
   ============================= */
.section {
  padding: clamp(2rem, 5vw, 3.5rem) 0;
}
.bg-light {
  background: var(--color-bg-alt);
}
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.2px;
}
h2 {
  text-align: center;
  margin: 0 0 1.75rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

/* =============================
   Grid / Cards
   ============================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}
.card {
  background: #fff;
  padding: 1.1rem 1.1rem 1.3rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card__image {
  width: 100%;
  aspect-ratio: 16 / 9; /* mantiene proporción responsiva */
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 1px);
}
.card h3 {
  margin: 0.25rem 0 0.25rem;
  font-size: 1.1rem;
}
.card p {
  margin: 0;
  font-size: 0.95rem;
}

/* =============================
   Formularios
   ============================= */
form {
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: auto;
}
.section form#contact-form,
#contact-form {
  gap: 1rem; /* ritmo vertical agradable entre elementos del formulario */
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
/* Solo afinar el contacto sin afectar otros posibles formularios */
#contact-form .form-group {
  gap: 0.5rem;
}
#contact-form .form-group small {
  color: #6b7280;
  font-size: 0.85rem;
}
#contact-form input[type="checkbox"] {
  margin-right: 0.5rem;
  margin-top: 0.2rem;
}

@media (min-width: 768px) {
  #contact-form {
    gap: 1.25rem;
  }
}
label {
  font-weight: 600;
  font-size: 0.9rem;
}

input,
textarea {
  font: inherit;
  background: #fff;
  border: 1px solid #c8ccd1;
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.85rem;
  line-height: 1.3;
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}
select {
  font: inherit;
  background: #fff;
  border: 1px solid #c8ccd1;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}
input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.35);
}
input:invalid[required]:not(:focus):not(:placeholder-shown),
textarea:invalid[required]:not(:focus):not(:placeholder-shown) {
  border-color: #c0392b;
}

#form-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}
#form-status.success {
  color: #1b6e34;
}
#form-status.error {
  color: #b00020;
}

.btn.is-loading,
button.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* =============================
   Breadcrumbs & CTA
   ============================= */
.breadcrumbs {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: #6b7280; /* gris medio */
}
.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.breadcrumbs li::after {
  content: "/";
  margin: 0 0.25rem;
  color: #a0a0a0;
}
.breadcrumbs li:last-child::after {
  content: "";
}
.breadcrumbs a {
  color: inherit;
  text-decoration: none;
}
.breadcrumbs a:hover {
  text-decoration: underline;
}

.cta-row {
  margin-top: 2rem;
}

/* =============================
   Footer
   ============================= */
footer {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 1.25rem 0;
  font-size: 0.85rem;
}
footer p {
  margin: 0;
}

/* =============================
   Foco accesible global
   ============================= */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* =============================
   Preferencias de usuario
   ============================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* =============================
   Clases de utilidad
   ============================= */
.text-center {
  text-align: center;
}

.container--narrow {
  max-width: 640px;
}

.contact-info-small {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn--ghost:hover,
.btn--ghost:focus {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

/* ===== Fin de styles.css ===== */
