/* ========================================
   INDEPAR - Estilos Globales
   Instituto de Estrategia Integral para el Retiro
   ======================================== */

/* --- Variables --- */
:root {
  /* Paleta completa del logo, guinda como acento (docs/identidad/sistema-visual.md v1.0, IND-0100) */
  --marca: #6E3A46;
  --marca-oscuro: #55303A;
  --marca-profundo: #432830;
  --superficie-oscura: #2B2627;
  --superficie-oscura-2: #3A3334;
  --acento: #C1A38D;
  --acento-texto: #965A4E;
  --acento-claro: #DFB090;
  --rosa: #C08375;
  --gris-1: #888787;
  --gris-2: #4B4A4A;
  --fondo-alt: #F7F1EC;
  --fondo-alt-2: #EEEAE7;
  --linea: #E5DCD6;
  --texto: #3D3436;
  --texto-2: #6B6164;
  --blanco: #FFFFFF;
  --foco: var(--marca);
  --marca-rgb: 110 58 70;
  --marca-oscuro-rgb: 85 48 58;
  --superficie-oscura-rgb: 43 38 39;
  --acento-rgb: 193 163 141;
  --acento-claro-rgb: 223 176 144;
  /* Alias de los nombres anteriores: mismo nombre, valor nuevo.
     Desde IND-0100 --navy es el carbón de titulares y superficies (no la marca) */
  --navy: var(--texto);
  --navy-dark: var(--superficie-oscura);
  --gold: var(--acento);
  --gold-light: var(--acento-claro);
  --bg-alt: var(--fondo-alt);
  --text-primary: var(--texto);
  --text-secondary: var(--texto-2);
  --white: var(--blanco);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --transition: 0.3s ease;
  --max-width: 1140px;
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  font-size: 17px; /* IND-0096: texto base 17 px (antes 16 px), lectura 50+ */
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Merriweather', serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

.section--alt {
  background: var(--bg-alt);
}

/* IND-0100: las secciones alternas se turnan arena (--fondo-alt) y piedra (--fondo-alt-2) */
.section--alt:nth-of-type(4n+2) {
  background: var(--fondo-alt-2);
}

.section__header {
  text-align: center;
  margin-bottom: 3rem;
}

.section__header p {
  max-width: 640px;
  margin: 0.5rem auto 0;
  font-size: 1.1rem;
}

/* --- Gold accent line --- */
.gold-line {
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin: 1rem auto;
  border-radius: 2px;
}

.gold-line--left {
  margin-left: 0;
}

/* IND-0096: foco visible discreto, solo con teclado (:focus-visible no se activa con ratón ni dedo).
   Las reglas de foco propias de cada componente siguen mandando por especificidad. */
:focus-visible {
  outline: 2px solid var(--foco);
  outline-offset: 2px;
}

/* IND-0100: sobre superficies oscuras (carbón) el foco usa durazno: vino sobre carbón no llega a 3:1 */
.hero :focus-visible,
.page-hero :focus-visible,
.home-cierre :focus-visible,
.footer :focus-visible {
  outline-color: var(--acento-claro);
}

/* ========================================
   NAVIGATION
   ======================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Merriweather', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}

.nav__brand img {
  height: 44px;
  width: auto;
}

.nav__links {
  display: flex;
  gap: 2rem;
}

.nav__link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 0.25rem 0;
  display: inline-flex; /* IND-0096: área de toque ≥44 px */
  align-items: center;
  min-height: 44px;
  transition: color var(--transition);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 3px; /* IND-0096: misma posición visual del subrayado con el alto de 44 px */
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold);
  transition: width var(--transition);
}

.nav__link:hover,
.nav__link--active {
  color: var(--marca);
}

.nav__link:hover::after,
.nav__link--active::after {
  width: 100%;
}

/* Enlace destacado del journey (IND-0022): sutil distinción dorada
   para que la pieza principal del lado humano destaque en la nav. */
.nav__link--featured {
  color: var(--marca);
  font-weight: 600;
}

.nav__link--featured::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.45rem;
  transform: translateY(-1px);
}

.nav__mobile a.nav__link--featured-mobile {
  color: var(--marca);
  font-weight: 600;
}

.nav__mobile a.nav__link--featured-mobile::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
  transform: translateY(-1px);
}

/* Hamburger */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
  min-width: 44px; /* IND-0096: área de toque ≥44 px; el ícono no se mueve */
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin-right: -10px;
}

.nav__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy);
  transition: var(--transition);
  border-radius: 1px;
}

/* Mobile menu */
.nav__mobile {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  z-index: 999;
  /* IND-0136: con submenús el panel ya no cabe en un teléfono; se desplaza él solo
     y no arrastra la página de atrás (iOS). */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity var(--transition), transform var(--transition);
}

.nav__mobile.is-open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.nav__mobile a {
  display: block;
  padding: 1rem 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  border-bottom: 1px solid var(--bg-alt);
}

.nav__mobile a:hover,
.nav__mobile a.nav__link--active {
  color: var(--acento-texto);
}

/* Hamburger active state */
.nav__hamburger.is-active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__hamburger.is-active span:nth-child(2) {
  opacity: 0;
}

.nav__hamburger.is-active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Submenús de escritorio (IND-0115) --- */
.nav__item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav__btn {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  gap: 0.35rem;
}

.nav__btn:focus-visible {
  outline: 2px solid var(--foco);
  outline-offset: 3px;
  border-radius: 4px;
}

.nav__caret {
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
  transition: transform var(--transition);
}

.nav__item.is-open .nav__caret {
  transform: translateY(0.1em) rotate(225deg);
}

.nav__sub {
  display: none;
  position: absolute;
  top: calc(100% - 4px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  background: var(--white);
  border: 1px solid var(--linea);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
  z-index: 1001;
}

/* Con ratón abre al pasar; con teclado, Enter/Espacio en el botón (is-open) y Escape cierra.
   No se usa :focus-within para que Escape sí cierre mientras el botón conserva el foco. */
.nav__item:hover .nav__sub,
.nav__item.is-open .nav__sub {
  display: block;
}

.nav__sub-link {
  display: block;
  padding: 0.65rem 0.9rem;
  min-height: 44px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.nav__sub-link:hover,
.nav__sub-link:focus-visible {
  background: var(--fondo-alt);
  color: var(--marca);
}

.nav__sub-link--active {
  color: var(--marca);
  font-weight: 600;
}

/* Menú móvil: grupos con sus enlaces */
.nav__mobile-grupo {
  margin: 1.25rem 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acento-texto);
}

.nav__mobile-grupo:first-child {
  margin-top: 0;
}

.nav__mobile a.nav__mobile-sub {
  padding-left: 0.9rem;
  font-size: 1.05rem;
}

/* Body offset for fixed nav */
body {
  padding-top: 72px;
}

/* ========================================
   PAGE HERO (inner pages)
   ======================================== */
.page-hero {
  background: linear-gradient(135deg, var(--superficie-oscura-2) 0%, var(--superficie-oscura) 100%);
  padding: 4rem 0;
  text-align: center;
}

.page-hero h1 {
  color: var(--white);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.page-hero .gold-line {
  margin-top: 1rem;
}

/* ========================================
   FOOTER (IND-0385)
   ======================================== */
.footer {
  --pie-vel: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

/* Línea de acento que se dibuja de izquierda a derecha al entrar en pantalla */
.footer::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--acento-claro) 55%, var(--gold));
  transform-origin: left center;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 1.5rem;
}

.footer__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer__marca {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer__wordmark {
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  color: var(--acento-claro);
}

.footer__desc {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.footer__social {
  display: flex;
  gap: 0.6rem;
}

.footer__social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.7);
  transition: color var(--pie-vel), border-color var(--pie-vel), background var(--pie-vel), transform var(--pie-vel);
}

.footer__social a:hover {
  color: var(--navy-dark);
  background: var(--acento-claro);
  border-color: var(--acento-claro);
  transform: translateY(-2px);
}

.footer__cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  padding: 2rem 0;
}

.footer__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.footer__title {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--acento-claro);
  margin-bottom: 0.6rem;
}

.footer__col a,
.footer__legal a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.65);
  transition: color var(--pie-vel), transform var(--pie-vel);
}

/* Subrayado fino que crece al pasar el cursor */
.footer__col a::after,
.footer__legal a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 1px;
  background: var(--acento-claro);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--pie-vel);
}

.footer__col a:hover,
.footer__legal a:hover {
  color: var(--white);
}

.footer__col a:hover::after,
.footer__legal a:hover::after {
  transform: scaleX(1);
}

.footer__bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.25rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5); /* IND-0096: contraste 4.9:1 */
}

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.footer__dpm {
  display: inline-flex;
  margin-left: auto;
}

.footer__dpm img {
  height: 20px;
  width: auto;
  display: block;
}

/* Destello que recorre la línea de acento, de vez en cuando */
.footer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 140px;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  transform: translateX(-180px);
}

.footer__col a:hover { transform: translateX(3px); }

/* --- Entrada rápida: solo con movimiento permitido (clases que pone components.js) --- */
.footer--espera::before { transform: scaleX(0); }
.footer--espera .footer__marca,
.footer--espera .footer__social a,
.footer--espera .footer__title,
.footer--espera .footer__col a,
.footer--espera .footer__bottom { opacity: 0; }

@keyframes pie-linea { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pie-sube { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pie-brota { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes pie-aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes pie-destello { 0%, 78% { transform: translateX(-180px); } 100% { transform: translateX(100vw); } }

.footer--vivo::before { animation: pie-linea 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.footer--vivo::after { animation: pie-destello 6s cubic-bezier(0.65, 0, 0.35, 1) 0.9s infinite; }
.footer--vivo .footer__marca { animation: pie-sube 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s backwards; }
.footer--vivo .footer__social a { animation: pie-brota 0.38s cubic-bezier(0.34, 1.7, 0.64, 1) backwards; animation-delay: calc(0.12s + var(--i, 0) * 0.045s); }
.footer--vivo .footer__title { animation: pie-aparece 0.3s ease 0.15s backwards; }
.footer--vivo .footer__col a { animation: pie-sube 0.36s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: calc(0.18s + var(--i, 0) * 0.03s); }
.footer--vivo .footer__bottom { animation: pie-aparece 0.4s ease 0.45s backwards; }


/* ========================================
   UTILITIES
   ======================================== */
.text-center { text-align: center; }
.text-gold { color: var(--acento-texto); }
.text-navy { color: var(--navy); }
.mb-0 { margin-bottom: 0; }

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

/* Tablet */
@media (max-width: 1024px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  .section { padding: 4rem 0; }
  .footer__cols { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  .section { padding: 3rem 0; }
  .container { padding: 0 1rem; }

  .nav__links { display: none; }
  .nav__hamburger { display: flex; }

  .footer__top { flex-direction: column; align-items: flex-start; }
  .footer__cols { gap: 1.5rem 1rem; }
  .footer__col a, .footer__legal a { min-height: 44px; } /* IND-0096: área de toque */
  .footer__col a::after, .footer__legal a::after { bottom: 10px; }
  .footer__dpm { margin-left: 0; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
  .page-hero { padding: 3rem 0; }
  .page-hero h1 { font-size: 2rem; }
}
