/* ==========================================================================
   Fundación Espacio Nogal — sistema de diseño
   Paleta y tipografía elegidas por criterios de accesibilidad cognitiva
   y sensorial (bajo estímulo, alto contraste, tipografía legible),
   en línea con TIF cap. 16.9 (accesibilidad digital) y WCAG 2.2 + COGA.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&family=Nunito+Sans:wght@600;700;800&display=swap');

:root {
  /* Paleta tomada del logotipo institucional */
  --color-navy: #2b4356;
  --color-navy-dark: #1c2e3c;
  --color-sage: #7fa084;
  --color-sage-dark: #5f8065;
  --color-skin: #e3b98d;
  --color-bg: #faf8f5;
  --color-surface: #ffffff;
  --color-border: #e1ddd4;
  --color-text: #232b32;
  --color-text-muted: #4c5860;
  --color-focus: #1a5276;
  --color-link: #1c4a63;
  --color-link-visited: #3c3168;

  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;

  --radius: 14px;
  --max-width: 1120px;
  --font-scale: 1;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
}

/* Escalado de texto accesible (botón A- / A+) */
html.fs-1 { --font-scale: 1.12; }
html.fs-2 { --font-scale: 1.25; }

/* Modo alto contraste */
html.high-contrast {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-text: #000000;
  --color-text-muted: #1a1a1a;
  --color-border: #000000;
  --color-navy: #00263a;
  --color-sage: #245c30;
  --color-link: #00264d;
  --color-focus: #d1004b;
}
html.high-contrast img { filter: contrast(1.05); }

* { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--font-scale));
  scroll-behavior: smooth;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-navy-dark);
  line-height: 1.25;
  font-weight: 800;
}
h1 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); margin: 0 0 var(--space-2); }
h2 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); margin: 0 0 var(--space-2); }
h3 { font-size: 1.2rem; margin: 0 0 var(--space-1); }
p { margin: 0 0 var(--space-2); max-width: 68ch; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.4em; }

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
a:visited { color: var(--color-link-visited); }
a:hover { text-decoration-thickness: 2.5px; }

/* Foco visible en todos los elementos interactivos (WCAG 2.4.7 / 2.4.11) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* Enlace "saltar al contenido" (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  background: var(--color-navy-dark);
  color: #fff;
  padding: 0.9em 1.4em;
  border-radius: 0 0 8px 0;
  z-index: 1000;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus {
  left: 0;
  top: 0;
}

/* ---------- Barra de accesibilidad ---------- */
.a11y-bar {
  background: var(--color-navy-dark);
  color: #fff;
}
.a11y-bar .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.a11y-bar span.a11y-label {
  font-size: 0.85rem;
  margin-right: 0.4rem;
  color: #dbe3e8;
}
.a11y-bar button {
  background: transparent;
  border: 1.5px solid #ffffff88;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.3em 0.7em;
  border-radius: 8px;
  cursor: pointer;
}
.a11y-bar button:hover { background: #ffffff22; }
.a11y-bar button[aria-pressed="true"] { background: var(--color-sage); border-color: var(--color-sage); }

/* ---------- Encabezado / navegación ---------- */
header.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
header.site-header .container {
  max-width: 1600px;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--color-navy-dark);
  flex-shrink: 0;
}
.brand img { height: 68px; width: auto; }
.brand-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.15;
}
.brand-text small {
  display: block;
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
}

nav.main-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.nav-toggle {
  display: none;
  background: var(--color-navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5em 0.8em;
  font-size: 1rem;
  cursor: pointer;
}

nav.main-nav .nav-primary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
}
nav.main-nav .nav-primary a {
  display: block;
  padding: 0.55em 0.9em;
  border-radius: 8px;
  text-decoration: none;
  background: linear-gradient(135deg, var(--color-navy), var(--color-navy-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
nav.main-nav .nav-primary a:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(22, 41, 58, 0.25); }
nav.main-nav .nav-primary a[aria-current="page"] {
  background: linear-gradient(135deg, var(--color-sage), var(--color-sage-dark));
}

.nav-secondary { display: block; }
.nav-secondary a.nav-special {
  display: block;
  padding: 0.5em 1em;
  border-radius: 8px;
  text-decoration: none;
  background: var(--color-sage-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-secondary a.nav-special .nav-special-sub {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  opacity: 0.85;
  margin-top: 0.15em;
}
.nav-secondary a.nav-special:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(95, 128, 101, 0.35); }

@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  nav.main-nav {
    display: none;
    width: 100%;
    border-top: 1px solid var(--color-border);
  }
  nav.main-nav.open { display: flex; align-items: stretch; }
  nav.main-nav .nav-primary { flex-direction: column; justify-content: flex-start; align-items: stretch; padding: var(--space-2) 0; gap: 0.4rem; }
  nav.main-nav .nav-primary a,
  .nav-secondary a.nav-special { text-align: center; }
  .nav-bottom { flex-direction: column; width: 100%; }
  .nav-social { justify-content: center; width: 100%; padding: var(--space-2) 0; }
  .nav-secondary { width: 100%; padding-bottom: var(--space-2); }
  .header-inner { flex-wrap: wrap; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, #eef2ee 0%, var(--color-bg) 100%);
  padding: var(--space-5) 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.hero .eyebrow {
  display: inline-block;
  background: var(--color-sage);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3em 0.8em;
  border-radius: 999px;
  margin-bottom: var(--space-2);
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 62ch;
}

/* ---------- Secciones y bloques ---------- */
main { display: block; }
.section { padding: var(--space-4) 0; }
.section.alt { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }

.grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.card h3 { color: var(--color-navy-dark); }
.card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-sage-dark);
  margin-bottom: 0.4em;
}

.btn {
  display: inline-block;
  background: var(--color-navy);
  color: #fff !important;
  font-weight: 700;
  padding: 0.7em 1.3em;
  border-radius: 10px;
  text-decoration: none !important;
  border: 2px solid var(--color-navy);
}
.btn:hover { background: var(--color-navy-dark); border-color: var(--color-navy-dark); }
.btn.secondary {
  background: transparent;
  color: var(--color-navy) !important;
}
.btn.secondary:hover { background: var(--color-bg); }

.callout {
  background: #eef3ee;
  border-left: 5px solid var(--color-sage);
  border-radius: 8px;
  padding: var(--space-3);
}
.callout.important {
  background: #fbf1e8;
  border-left-color: var(--color-skin);
}
.callout.note {
  background: #eef2f6;
  border-left-color: var(--color-navy);
}

/* Migas de pan (orientación / previsibilidad, criterio COGA) */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.breadcrumb a { color: var(--color-text-muted); }

.audience-switch {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
}
.audience-switch a {
  text-decoration: none;
  font-weight: 700;
  padding: 0.5em 1em;
  border-radius: 999px;
  border: 2px solid var(--color-border);
  color: var(--color-navy-dark);
  font-size: 0.9rem;
}
.audience-switch a[aria-current="true"] {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: #fff !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-2) 0 var(--space-3);
}
th, td {
  text-align: left;
  padding: 0.7em 0.8em;
  border: 1px solid var(--color-border);
}
th { background: var(--color-bg); }

form .field { margin-bottom: var(--space-2); }
label { display: block; font-weight: 700; margin-bottom: 0.3em; }
input, textarea, select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7em 0.8em;
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text);
}

details.faq {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.9em 1.1em;
  margin-bottom: 0.8em;
  background: var(--color-surface);
}
details.faq summary {
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-heading);
  color: var(--color-navy-dark);
}
details.faq p:last-child { margin-bottom: 0; }

.disclaimer {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  border-top: 1px dashed var(--color-border);
  padding-top: var(--space-2);
  margin-top: var(--space-3);
}

/* ---------- Pie de página ---------- */
footer.site-footer {
  background: var(--color-navy-dark);
  color: #dfe6ea;
  padding: var(--space-4) 0 var(--space-3);
  margin-top: var(--space-5);
}
footer.site-footer a { color: #fff; }
footer.site-footer h3 { color: #fff; font-size: 1rem; }
.footer-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.footer-grid > div:nth-child(2),
.footer-grid > div:nth-child(3) {
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 0.8rem 1rem;
}
.footer-bottom {
  border-top: 1px solid #ffffff22;
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  font-size: 0.82rem;
  color: #b7c2c9;
}

/* ========================================================================
   Redes sociales flotantes (arriba del botón de WhatsApp)
   ======================================================================== */

.social-float-stack {
  position: fixed;
  bottom: 5.8rem;
  right: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 8999;
}

.social-float-stack a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-navy);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background 0.2s ease;
}

.social-float-stack a:hover {
  transform: scale(1.1);
  background: var(--color-sage-dark);
}

.social-float-stack svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* ========================================================================
   Botón flotante de WhatsApp
   ======================================================================== */

.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  z-index: 9000;
  text-decoration: none;
}

.whatsapp-tooltip {
  background: #fff;
  color: var(--color-navy-dark);
  padding: 0.6em 1em;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-heading);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.whatsapp-icon {
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.whatsapp-icon svg {
  width: 1.9rem;
  height: 1.9rem;
  fill: #fff;
}

.whatsapp-float:hover .whatsapp-icon,
.whatsapp-float:focus-visible .whatsapp-icon {
  transform: scale(1.08);
}

@media (max-width: 480px) {
  .whatsapp-tooltip {
    display: none;
  }
}

/* ========================================================================
   Splash Screen (Video Intro)
   ======================================================================== */

#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.8s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding-top: 3rem;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

#splash-video {
  max-width: 85vw;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-top: -12vh;
}

.sound-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(43, 67, 86, 0.85);
  color: #fff;
  border: none;
  padding: 0.6em 1.2em;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-heading);
  border-radius: 50px;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.3s ease, opacity 0.4s ease;
}

.sound-btn:hover {
  background: #2b4356;
}

.sound-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  padding: 1.5em 3em;
  font-size: 1.5rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
}

.play-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%) scale(1.05);
}

.play-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.invisible-btn {
  background: linear-gradient(135deg, #7fa084, #5f8065);
  color: #fff;
  border: 2px solid #7fa084;
  padding: 0.8em 2em;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  border-radius: 50px;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 8px 25px rgba(95, 128, 101, 0.3);
  transition: background 0.5s ease-in-out, color 0.5s ease-in-out, border-color 0.5s ease-in-out, transform 0.3s ease, box-shadow 0.4s ease;
  opacity: 0;
  animation: fadeInBtn 1s ease 7s forwards;
}

.invisible-btn:hover {
  background: #fff;
  color: #2b4356;
  border-color: #2b4356;
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(43, 67, 86, 0.3);
}

.unmute-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(43, 67, 86, 0.8);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0.8em 1em;
  font-size: 1.5rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unmute-btn:hover {
  background: rgba(127, 160, 132, 0.9);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.6);
}

#splash-screen.hidden .unmute-btn {
  display: none;
}

@keyframes fadeInBtn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
