/* ==========================================================================
   ARGDC — estilos
   Tokens (spec §5) · base · layout · componentes
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Paleta de la definición */
  --navy: #0C2544;
  --celeste: #0C7EC4;
  --sol: #FFB81C;
  --white: #FFFFFF;
  --gray-50: #F8FAFC;

  /* Derivados (decisión del builder, spec §5) */
  --text: #44546A;          /* cuerpo: ≥7:1 sobre blanco y gris-50 */
  --line: #E2E8F0;          /* bordes / hairlines */
  --navy-hover: #173A63;    /* botón sólido en hover */
  --shadow: 0 12px 32px rgba(12, 37, 68, .08);
  --on-navy: rgba(255, 255, 255, .78);      /* texto secundario sobre navy (≈9:1) */
  --on-navy-line: rgba(255, 255, 255, .16);
  --error: #B42318;         /* errores del formulario: ≈ 6.6:1 sobre blanco */

  /* Tipografía */
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --fs-h1: clamp(2.25rem, 1.75rem + 2.222vw, 3.75rem);     /* 36 → 60px (360 → 1440) */
  --fs-h2: clamp(1.75rem, 1.5rem + 1.111vw, 2.5rem);       /* 28 → 40px */
  --fs-h3: clamp(1.1875rem, 1.125rem + .278vw, 1.375rem);  /* 19 → 22px */
  --fs-body: 1.0625rem;                                    /* 17px */
  --fs-small: .9375rem;                                    /* 15px */

  /* Radios por jerarquía */
  --radius-form: 20px;
  --radius-card: 12px;
  --radius-control: 8px;

  /* Espaciado y layout */
  --container: 75rem;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --section-pad: clamp(4rem, 10vw, 8rem);
  --header-h: 4rem;         /* alto del header fijo (Task 3: scroll-padding-top) */

  --transition: 180ms ease;
}

@media (min-width: 60em) {   /* 960px con la fuente por defecto; crece si el usuario agranda la fuente */
  :root { --header-h: 4.75rem; }
}

/* ---------- Base ---------- */
html { scroll-padding-top: var(--header-h); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: -.015em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: 1.1; letter-spacing: -.025em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.3; letter-spacing: 0; }

p { margin: 0; }

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img { height: auto; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--celeste);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: .75rem;
  left: .75rem;
  z-index: 200;
  padding: .75rem 1.25rem;
  border-radius: var(--radius-control);
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: .625rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}

.btn--primary {
  background: var(--navy);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--navy-hover);
  border-color: var(--celeste);
}

.btn--outline {
  background: transparent;
  border-color: var(--navy);
  color: var(--navy);
}

.btn--outline:hover {
  border-color: var(--celeste);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 4px 16px rgba(12, 37, 68, .06);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 100%;
}

.site-header__brand {
  flex: none;
  padding-block: .1875rem;   /* área táctil ≥ 44px con el logo de 38px */
  border-radius: 4px;
}

.site-header__brand .logo {
  width: auto;
  height: 2.375rem;   /* 38px mobile */
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0 .6875rem;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--navy);
}

/* < 60em: panel desplegable bajo el header; se abre con .is-open (nav.js). */
.site-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem var(--gutter) 1.5rem;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(12, 37, 68, .08);
  /* Con poca altura (landscape, zoom 400%) el panel scrollea en vez de quedar cortado. */
  max-height: calc(100vh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
}

.site-nav.is-open {
  display: flex;
}

/* Sin JS (< 60em): header en el flujo y nav como lista visible bajo el logo; nada tapa el contenido. */
@media (scripting: none) and (max-width: 59.999em) {
  .site-header {
    position: relative;
    height: auto;
  }

  .site-header__inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: .5rem;
  }

  .nav-toggle { display: none; }

  .site-nav {
    display: flex;
    position: static;
    flex: 1 0 100%;
    padding: 0 0 .5rem;
    border: 0;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
}

.site-nav__list {
  display: flex;
  flex-direction: column;
}

.nav-link {
  display: inline-block;
  padding-block: .625rem;   /* mobile: área táctil ≥ 44px */
  border-radius: 4px;
  color: var(--navy);
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: .45em;
  transition: text-decoration-color var(--transition);
}

.nav-link:hover {
  text-decoration-color: var(--celeste);
}

/* Scrollspy: subrayado + punto --sol (decorativo) */
.nav-link[aria-current="true"] {
  position: relative;
  text-decoration-color: var(--navy);
}

.nav-link[aria-current="true"]::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--sol);
}

.site-nav__cta {
  font-size: var(--fs-small);
  white-space: nowrap;
}

@media (min-width: 60em) {   /* = breakpoint de nav.js */
  .site-header__brand .logo { height: 2.875rem; }   /* 46px desktop */

  .nav-toggle { display: none; }

  .site-nav {
    position: static;
    display: flex;
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
    max-height: none;
    overflow: visible;
  }

  .site-nav__list {
    flex-direction: row;
    gap: clamp(1rem, 2.2vw, 2.25rem);
    margin-inline: auto;
  }

  .nav-link { padding-block: .5rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--header-h) + clamp(4rem, 10vw, 8rem));
  padding-bottom: clamp(8rem, 16vw, 13rem);
  background: var(--white);
  text-align: center;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__title {
  max-width: 21ch;
}

.hero__accent {
  color: var(--navy);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero__accent {
    background-image: linear-gradient(100deg, var(--navy) 10%, var(--celeste) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.hero__lead {
  max-width: 60ch;
  margin-top: clamp(1.25rem, 2.5vw, 1.75rem);
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem 1rem;
  margin-top: clamp(2rem, 4vw, 2.75rem);
}

@media (max-width: 29.99rem) {
  .hero__actions {
    flex-direction: column;
    align-self: stretch;
  }
}

.hero__waves {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(4.5rem, 10vw, 9rem);
  fill: none;
  stroke: var(--celeste);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.hero__wave { vector-effect: non-scaling-stroke; }
.hero__wave--1 { opacity: .38; }
.hero__wave--2 { opacity: .22; }
.hero__wave--3 { opacity: .38; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: var(--on-navy);
  font-size: var(--fs-small);
}

.site-footer :focus-visible {
  outline-color: var(--white);
}

.site-footer__inner {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(3.5rem, 7vw, 5rem);
}

.site-footer__brand .logo {
  width: auto;
  height: 2.5rem;
  margin-bottom: 1.25rem;
}

/* Placeholder: logo a color filtrado a blanco hasta tener el archivo oficial. */
.logo--white-placeholder {
  filter: brightness(0) invert(1);
}

.site-footer__brand p {
  max-width: 34ch;
}

.site-footer__list {
  display: grid;
  align-content: start;
  margin-block: -.625rem;    /* compensa el padding de los links: el bloque no se mueve */
}

.site-footer__link {
  display: inline-block;
  padding-block: .625rem;    /* área táctil ≥ 44px */
  color: var(--white);
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: .35em;
  transition: text-decoration-color var(--transition);
}

.site-footer__link:hover {
  text-decoration-color: var(--celeste);
}

.site-footer__base {
  padding-bottom: 1.5rem;
  font-size: .875rem;
}

.site-footer__base p {
  padding-top: 1.5rem;
  border-top: 1px solid var(--on-navy-line);
}

@media (min-width: 48rem) {
  .site-footer__inner {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

/* ---------- Secciones de contenido ---------- */
.section {
  padding-block: var(--section-pad);
  background: var(--white);
}

.section--gray { background: var(--gray-50); }

.section__head {
  max-width: 48rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.section__head--center {
  margin-inline: auto;
  text-align: center;
}

.section__head p {
  max-width: 62ch;           /* spec §5: líneas ≤ 70ch */
  margin-top: 1.25rem;
}

.section__action {
  display: flex;
  justify-content: center;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

@media (max-width: 29.99rem) {
  .section__action .btn { width: 100%; }
}

/* Íconos lineales (spec §7) */
.icon {
  flex: none;
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: var(--celeste);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 1 · La Asociación */
.about {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
}

.about__intro p {
  max-width: 62ch;
  margin-top: 1.5rem;
}

.about__pillars {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.pillar,
.commissions .card {
  padding: clamp(1.5rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--white);
}

.pillar .icon { margin-bottom: 1rem; }

.pillar p,
.card p {
  margin-top: .5rem;
  font-size: var(--fs-small);
}

@media (min-width: 60rem) {
  .about { grid-template-columns: 1fr 1fr; align-items: start; }
  .about__intro { position: sticky; top: calc(var(--header-h) + 2rem); }
}

/* 2 · Intereses */
.commissions {
  display: grid;
  gap: 1rem;
}

.commissions .card { background: var(--gray-50); }

@media (min-width: 48rem) {
  .commissions { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}

/* 3 · Beneficios */
.benefits {
  max-width: 51.25rem;   /* ≈ 820px */
  margin-inline: auto;
}

.benefit {
  display: flex;
  gap: 1.25rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
}

.benefit:last-child { border-bottom: 1px solid var(--line); }

.benefit .icon { margin-top: .125rem; }

.benefit p { max-width: 62ch; margin-top: .375rem; }

@media (min-width: 48rem) {
  .benefit { gap: 1.75rem; }
  .benefit .icon { width: 2.25rem; height: 2.25rem; }
}

/* 4 · Autoridades */
.authorities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
}

.authority {
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--line);
  border-top: 2px solid var(--celeste);
  border-radius: var(--radius-card);
  text-align: center;
}

.authority__role {
  margin-top: .5rem;
  font-weight: 600;
  color: var(--navy);
}

.authority__org {
  margin-top: .125rem;
  font-size: var(--fs-small);
}

.section__head--list {
  max-width: 51.25rem;
  margin-inline: auto;
}

/* ---------- 5 · Formulario ---------- */
.form-card {
  max-width: 52rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  border-radius: var(--radius-form);
  background: var(--white);
  box-shadow: var(--shadow);
}

.form-card__head {
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
  text-align: center;
}

.form-card__head p {
  max-width: 60ch;
  margin: 1.25rem auto 0;
}

.form-note {
  margin-bottom: 1.5rem;
  font-size: var(--fs-small);
}

.form-group {
  min-width: 0;
  margin: 0 0 2.5rem;
  padding: 2rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.form-group legend {
  float: left;               /* el legend deja de montarse sobre el borde */
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 0;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy);
}

.form-group legend + * { clear: both; }

.form-group__desc {
  max-width: 62ch;
  margin-bottom: 1.5rem;
  font-size: var(--fs-small);
}

.form-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 40rem) {
  .form-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem 1.5rem; }
}

.field {
  min-width: 0;
  margin-bottom: 1.5rem;
}

.form-grid .field { margin-bottom: 0; }

.field > label:not(.choice),
.field--group > legend {
  display: block;
  margin-bottom: .5rem;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy);
}

.field--group {
  margin-inline: 0;
  padding: 0;
  border: 0;
}

.field--group > legend {
  float: none;
  padding: 0;
  margin-bottom: .75rem;
  font-family: var(--font-body);   /* es un label de campo, no el título del grupo */
}

.form input[type="text"],
.form input[type="email"],
.form input[type="tel"] {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: .5rem .875rem;
  border: 1px solid #64748B;     /* ≥3:1 sobre blanco (borde de control) */
  border-radius: var(--radius-control);
  background: var(--white);
  font: inherit;
  font-size: 1rem;
  color: var(--navy);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form input[type="text"]:hover,
.form input[type="email"]:hover,
.form input[type="tel"]:hover {
  border-color: var(--navy);
}

.form input[type="text"]:disabled {   /* misma especificidad que :hover, gana por orden */
  background: var(--gray-50);
  border-color: var(--line);
  cursor: not-allowed;
}

/* Radios: cada opción es un área táctil completa (≥ 44px) */
.choice {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  min-height: 2.75rem;
  margin-bottom: .5rem;
  padding: .625rem .875rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  line-height: 1.5;
  font-size: var(--fs-small);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}

.choice:hover { border-color: var(--celeste); }

.choice:has(input:checked) {
  border-color: var(--navy);
  background: var(--gray-50);
  color: var(--navy);
}

.choice input[type="radio"] {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: .125rem 0 0;
  accent-color: var(--navy);
  cursor: pointer;
}

.choice--other {
  position: relative;
  flex-wrap: wrap;
  align-items: center;
}

/* El label envuelve solo al radio (un control por label); su ::before cubre
   toda la fila para conservar el área táctil completa. */
.choice__label {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
}

.choice__label::before {
  content: "";
  position: absolute;
  inset: 0;
}

.choice__label > * { position: relative; }   /* radio y texto por encima del área táctil */

.choice--other > input[type="text"] {
  position: relative;        /* por encima del área táctil del label */
  flex: 1 1 14rem;
  width: auto;
  margin: 0;
  cursor: text;
}

.choice--other > input[type="text"]:disabled {
  cursor: not-allowed;
  pointer-events: none;   /* el click cae en el ::before del label y marca "Otro" */
}

.choice--other input[type="radio"] { margin-top: 0; }

/* Errores */
.field-error {
  margin-top: .5rem;
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.4;
  color: var(--error);
}

.field-error::before {
  content: "! ";
  content: "! " / "";   /* sin texto alternativo: el lector de pantalla no lee el "!" */
  font-weight: 700;
}

/* Le gana a .form input[type="text"] (y a su :hover) por orden. */
.form input[aria-invalid="true"],
.form input[aria-invalid="true"]:hover {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

.choice:has(input[aria-invalid="true"]) { border-color: var(--error); }

.form-error,
.form-success {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--error);
  border-radius: var(--radius-card);
  background: #FEF3F2;
  font-size: var(--fs-small);
  color: #7A271A;
}

.form-error a { font-weight: 600; }

.form-success {
  margin: 0;
  padding: clamp(2rem, 6vw, 3.5rem) clamp(1.25rem, 4vw, 2.5rem);
  border-color: var(--line);
  border-top: 2px solid var(--celeste);
  background: var(--gray-50);
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.4;
  color: var(--navy);
}

.form-success:focus { outline: none; }
.form-success:focus-visible { outline: 2px solid var(--celeste); outline-offset: 3px; }

.form-submit {
  width: 100%;
  min-height: 3.25rem;
}

.form-submit:disabled {
  opacity: .7;
  cursor: progress;
}

@media (min-width: 40rem) {
  .form-submit { width: auto; min-width: 18rem; }
}
