/* AfiliaSuite — sitio público
   Design system: UI UX Pro Max ("Minimalism & Swiss Style", Hero + Features + CTA)
   con la paleta de marca obligatoria. Ver design-system/afiliasuite/MASTER.md */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Marca (no negociable) */
  --brand-900: #0b3546;
  --brand-700: #124E66;
  --accent: #0EA5A4;

  /* Derivados accesibles del acento */
  --accent-hover: #2bbcbb;
  --on-accent: #04161e;      /* 6.09:1 sobre --accent */
  --accent-ink: #0a7574;     /* acento como texto sobre claro: 5.51:1 sobre blanco */
  --accent-soft: #5fd4d2;    /* acento como texto sobre --brand-900: 7.34:1 */
  --accent-tint: #e0f4f4;    /* fondo de íconos; --accent-ink encima: 4.83:1 */

  /* Neutros */
  --bg: #f6f9fa;
  --surface: #ffffff;
  --surface-tint: #eef4f6;
  --text: #1e293b;
  --muted: #475569;
  --border: #d6e1e6;
  --on-dark: #ffffff;
  --on-dark-muted: #cfe3ea;  /* 9.82:1 sobre --brand-900 */

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(11, 53, 70, .06), 0 4px 16px rgba(11, 53, 70, .06);
  --shadow-lg: 0 2px 4px rgba(11, 53, 70, .08), 0 16px 40px rgba(11, 53, 70, .12);

  --header-h: 68px;
  --gutter: 16px;
  --ease: cubic-bezier(.2, .6, .2, 1);
}

@media (min-width: 768px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: var(--accent-ink); }

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Foco ---------- */
:focus-visible {
  outline: 3px solid var(--brand-700);
  outline-offset: 3px;
  border-radius: 4px;
}
.hero :focus-visible,
.section-dark :focus-visible,
.site-footer :focus-visible { outline-color: var(--accent-soft); }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--brand-900);
  color: var(--on-dark);
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 12px; outline-color: var(--accent-soft); }

section[id] { scroll-margin-top: calc(var(--header-h) + 8px); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: .9375rem;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: 1rem; }

.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); }

.btn-ghost-dark { color: var(--on-dark); border-color: rgba(255, 255, 255, .45); }
.btn-ghost-dark:hover { border-color: var(--on-dark); background: rgba(255, 255, 255, .08); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(8px)) {
  .site-header { background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px); }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  max-width: 1280px;
}

.brand-group { display: flex; align-items: center; gap: 16px; min-width: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-900);
  text-decoration: none;
  flex-shrink: 0;
}
.brand-mark { width: 34px; height: 34px; color: var(--brand-700); }
.brand-mark .node { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }

/* El descriptor siempre va separado del logotipo */
.descriptor { font-size: .8125rem; font-weight: 500; color: var(--muted); line-height: 1.3; }
.header-descriptor {
  display: none;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}
@media (min-width: 1400px) { .header-descriptor { display: block; } }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--brand-900);
  cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.site-nav { display: flex; align-items: center; gap: 16px; }
.site-nav a { white-space: nowrap; }
.site-nav ul { display: flex; gap: 4px; list-style: none; }
.site-nav ul a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--text);
  font-weight: 500;
  font-size: .9375rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.site-nav ul a:hover { color: var(--brand-700); background: var(--surface-tint); }

/* Menú móvil: solo se colapsa si JS está disponible */
@media (max-width: 959px) {
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px var(--gutter) 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .js .site-nav.is-open { display: flex; }
  .js .site-nav ul { flex-direction: column; }
  .js .site-nav ul a { width: 100%; padding: 0 8px; }

  /* Sin JS: los enlaces se muestran debajo del logotipo */
  html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 8px; }
  html:not(.js) .site-nav { flex-wrap: wrap; gap: 8px; }
  html:not(.js) .site-nav ul { flex-wrap: wrap; }
}

/* ---------- Tipografía de sección ---------- */
.eyebrow {
  margin-bottom: 12px;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.eyebrow-dark { color: var(--accent-soft); }

h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.375rem); font-weight: 800; letter-spacing: -.015em; color: var(--brand-900); }
h3 { font-size: 1.125rem; font-weight: 700; color: var(--brand-900); }

.lead { font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); color: var(--on-dark-muted); max-width: 38em; }
.section-lead { margin-top: 16px; font-size: 1.0625rem; color: var(--muted); max-width: 40em; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: var(--on-dark);
  background-color: var(--brand-900);
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  overflow: hidden;
}
.hero h1 { color: var(--on-dark); margin-bottom: 20px; }
.hero-inner {
  display: grid;
  gap: 40px;
  padding-block: 56px 64px;
  align-items: center;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-figure { position: relative; margin: 0; justify-self: center; width: 100%; max-width: 560px; }
.hero-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.hex-card {
  width: 220px;
  margin: -56px auto 0;
  position: relative;
  padding: 14px;
  background: var(--brand-900);
  border: 1px solid rgba(95, 212, 210, .4);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
@media (min-width: 600px) {
  .hero-figure { margin-bottom: 28px; }
  .hex-card { position: absolute; left: -24px; bottom: -28px; margin: 0; width: clamp(190px, 38%, 230px); }
}

@media (min-width: 960px) {
  .hero-inner { grid-template-columns: 1.05fr .95fr; padding-block: 88px 112px; gap: 64px; }
  .hero-figure { margin-bottom: 0; }
}
@media (max-width: 479px) {
  .hero-actions .btn { width: 100%; }
}

.hex-diagram { width: 100%; height: auto; overflow: visible; }
.hex-ring { fill: rgba(18, 78, 102, .55); stroke: var(--accent-soft); stroke-width: 3; stroke-linejoin: round; }
.hex-inner { fill: none; stroke: rgba(95, 212, 210, .3); stroke-width: 1.5; stroke-dasharray: 4 6; }
.hex-spoke { stroke: var(--accent-soft); stroke-width: 3; stroke-linecap: round; fill: none; }
.hex-core { fill: var(--on-dark); }
.hex-node { fill: var(--accent); stroke: var(--brand-900); stroke-width: 4; }
.hex-label rect { fill: var(--on-dark); }
.hex-label text {
  fill: var(--brand-900);
  font-family: var(--font);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .04em;
  text-anchor: middle;
}

/* ---------- Secciones ---------- */
.section { padding-block: 72px; }
@media (min-width: 960px) { .section { padding-block: 104px; } }
.section-tint { background: var(--surface-tint); }
.section-head { margin-bottom: 40px; }

.split { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) {
  .split { grid-template-columns: 1fr 1fr; gap: 64px; }
}

/* Problema */
.pain-list { list-style: none; margin-top: 28px; display: grid; gap: 16px; }
.pain-list li { display: flex; gap: 14px; align-items: flex-start; color: var(--text); }
.pain-icon {
  flex-shrink: 0;
  display: inline-flex;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-tint);
  color: var(--brand-700);
}
.pain-icon svg, .card-icon svg, .contact-mail svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scatter-figure {
  margin: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.scatter-figure svg { width: 100%; height: auto; }
@media (max-width: 479px) { .scatter-figure { padding: 12px; } }
.scatter-lines path { fill: none; stroke: #9fb3bd; stroke-width: 1.5; stroke-dasharray: 5 6; }
.scatter-box rect { fill: var(--surface); stroke: var(--brand-700); stroke-width: 1.5; }
.scatter-box text { fill: var(--brand-900); font-family: var(--font); font-size: 19px; font-weight: 700; text-anchor: middle; }
.scatter-box-alt rect { fill: var(--surface-tint); stroke: #9fb3bd; }
.scatter-box-alt text { fill: var(--muted); font-weight: 600; }

/* Módulos */
.module-grid { list-style: none; display: grid; gap: 16px; }
@media (min-width: 640px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .module-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

/* Tarjeta final a lo ancho para cerrar la cuadrícula (7 módulos) */
@media (min-width: 640px) {
  .card-wide { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; column-gap: 20px; row-gap: 6px; align-items: start; }
  .card-wide .card-icon { grid-row: span 2; }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card p { color: var(--muted); }
.card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-icon {
  display: inline-flex;
  width: 56px; height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--accent-tint);
  color: var(--accent-ink);
}
.card-icon svg { width: 28px; height: 28px; }
.card-soon { background: transparent; border-style: dashed; box-shadow: none; }
.card-soon .card-icon { background: var(--surface); color: var(--brand-700); border: 1px solid var(--border); }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-700);
  color: var(--on-dark);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* Cómo funciona */
.steps { list-style: none; counter-reset: step; margin-top: 32px; display: grid; gap: 24px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 60px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -4px;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-900);
  color: var(--on-dark);
  font-weight: 800;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 19px; top: 44px; bottom: -20px;
  width: 2px;
  background: var(--border);
}
.steps p { margin-top: 6px; color: var(--muted); }

.mockup { margin: 0; }
.mockup-window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.mockup-bar { display: flex; gap: 6px; padding: 12px 16px; background: var(--brand-900); }
.mockup-bar span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.mockup-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface-tint);
  border-bottom: 1px solid var(--border);
}
.mockup-label { width: 100%; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mockup-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1.5px solid var(--brand-700);
  border-radius: var(--radius-sm);
  font-size: .8125rem;
}
.mockup-chip b { color: var(--brand-900); font-weight: 700; }
.mockup-rows { padding: 8px 16px 16px; }
.mockup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.mockup-row:last-child { border-bottom: 0; }
.mockup-row .sk { flex: 1; min-width: 0; }
.sk { display: inline-block; height: 8px; border-radius: 4px; background: #dde6ea; }
.sk-sm { max-width: 56px; min-width: 40px; }
.sk-md { max-width: 96px; min-width: 56px; }
.sk-lg { max-width: 160px; min-width: 64px; }
.mockup-chip .sk { width: 56px; }
.tag {
  flex-shrink: 0;
  min-width: 96px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-tint);
  color: var(--brand-700);
  font-size: .75rem;
  font-weight: 700;
}
.status {
  flex-shrink: 0;
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  /* Pendiente de envío (ámbar): texto 6.84:1 */
  border: 1px solid #D97706;
  background: #FFFBEB;
  color: #92400E;
}
/* Enviado (azul): texto 8.01:1 */
.status-sent { border-color: #2563EB; background: #EFF6FF; color: #1E40AF; }
/* Acuse recibido (verde): texto 9.23:1 */
.status-ok { border-color: #059669; background: #ECFDF5; color: #064E3B; }
.mockup figcaption { margin-top: 12px; font-size: .8125rem; color: var(--muted); text-align: center; }

/* Piloto */
.section-dark { background: var(--brand-900); color: var(--on-dark); }
.section-dark h2 { color: var(--on-dark); }
.section-dark .section-lead { color: var(--on-dark-muted); }
.section-dark .eyebrow { color: var(--accent-soft); }
.section-brand { background: var(--brand-700); }
.pilot { display: grid; gap: 40px; align-items: center; }
.pilot-photo { margin: 0; }
.pilot-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.pilot-body { display: grid; gap: 28px; }
@media (max-width: 959px) { .pilot-photo { max-width: 560px; } }
.pilot-cta { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.pilot-note { font-size: .875rem; color: var(--on-dark-muted); max-width: 30em; }
@media (min-width: 960px) {
  .pilot { grid-template-columns: 1fr 1.1fr; gap: 64px; }
}
@media (max-width: 479px) {
  .pilot-cta .btn { width: 100%; }
}

/* Contacto */
.contact { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact .section-lead { margin-inline: auto; }
.contact-mail {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  min-height: 52px;
  padding: 12px 22px;
  border: 1.5px solid var(--brand-700);
  border-radius: var(--radius-sm);
  color: var(--brand-900);
  font-weight: 700;
  font-size: clamp(.9375rem, .85rem + .5vw, 1.125rem);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color .2s var(--ease);
}
.contact-mail:hover { background: var(--surface-tint); }
.privacy-note { margin-top: 20px; font-size: .875rem; color: var(--muted); }
.section-dark .contact-mail { color: var(--on-dark); border-color: var(--accent-soft); }
.section-dark .contact-mail:hover { background: rgba(255, 255, 255, .08); }
.section-dark .privacy-note { color: var(--on-dark-muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-900); color: var(--on-dark-muted); border-top: 1px solid rgba(255, 255, 255, .08); }
.footer-inner { display: grid; gap: 16px; padding-block: 40px; }
.footer-brand { display: flex; flex-direction: column; gap: 4px; }
.footer-brand .brand-name { color: var(--on-dark); }
.site-footer .descriptor { color: var(--on-dark-muted); }
.footer-legal, .footer-copy { font-size: .875rem; }
@media (min-width: 960px) {
  .footer-inner { grid-template-columns: auto 1fr auto; align-items: center; gap: 40px; }
  .footer-legal { text-align: center; }
}

/* ---------- 404 ---------- */
.error-page { min-height: 100vh; display: flex; flex-direction: column; }
.error-main { flex: 1; display: grid; place-items: center; padding-block: 72px; }
.error-box { text-align: center; max-width: 34rem; }
.error-code { font-size: .875rem; font-weight: 700; letter-spacing: .08em; color: var(--accent-soft); text-transform: uppercase; margin-bottom: 12px; }
.error-box h1 { margin-bottom: 16px; }
.error-box .lead { margin-inline: auto; margin-bottom: 32px; }

/* ---------- Aparición al hacer scroll ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .4s var(--ease), transform .4s var(--ease); }
  .js .reveal.is-visible { opacity: 1; transform: none; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .card:hover { transform: none; }
}

/* ---------- Modo alto contraste (Windows) ---------- */
@media (forced-colors: active) {
  .btn, .card, .contact-mail { border: 1px solid CanvasText; }
}
