/* IntuytIA – main.css
   Tema oscuro accesible + layout responsivo
   Fuente: Chakra Petch (cargada en <head>)
*/

/* --- Reset mínimo ------------------------------------------------------ */
* { box-sizing: border-box; }
html, body { height: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* --- Tokens de diseño -------------------------------------------------- */
:root {
  --bg: #0b0f17;            /* fondo principal */
  --surface: #0f1422;       /* superficies hero */
  --card: #121a2b;          /* tarjetas */
  --text: #e6e8ed;          /* texto principal */
  --muted: #9aa3b2;         /* texto secundario */
  --border: #1f2a3e;        /* bordes delicados */
  --accent: #6fd3ff;        /* primario */
  --accent-2: #a78bfa;      /* secundario */
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --maxw: 1120px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-2: #7c3aed;
  }
}

/* --- Base --------------------------------------------------------------- */
body {
  font-family: "Chakra Petch", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.muted { color: var(--muted); }
.note { color: var(--muted); font-size: .95rem; margin-top: .5rem; }

/* Accesibilidad: focus visible */
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }

/* Skip link */
.skip {
  position: absolute; left: -9999px; top: 0; padding: .6rem 1rem; background: var(--accent);
  color: #00131f; border-radius: 8px; box-shadow: var(--shadow);
}
.skip:focus { left: 1rem; top: 1rem; z-index: 1000; }

/* Contenedores */
.header-inner, main > .section, .hero, .site-footer { width: min(var(--maxw), 92vw); margin-inline: auto; }

/* --- Header / Nav (Layout estable en Flexbox) --------------------------- */
.site-header { 
  position: sticky; top: 0; z-index: 50; 
  backdrop-filter: saturate(140%) blur(6px); 
  background: color-mix(in oklab, var(--bg) 80%, transparent); 
  border-bottom: 1px solid var(--border); 
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap; /* Permite pasar a 2 filas sin superponerse */
  padding: .8rem 0;
}

/* Marca a la izquierda */
.brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; text-decoration: none; color: inherit; }
.logo { width: 40px; height: 40px; }
.wordmark { font-weight: 700; font-size: 1.25rem; letter-spacing: .5px; white-space: nowrap; }

/* CTA a la derecha de la primera fila */
.site-header .cta { order: 2; margin-left: auto; }

/* Selector de idioma junto al CTA */
.lang-switch { order: 3; display: flex; gap: .4rem; }
.lang-switch button { border: 1px solid var(--border); background: transparent; color: var(--text); padding: .35rem .6rem; border-radius: 10px; cursor: pointer; }
.lang-switch button:hover { border-color: var(--accent); }

/* Tagline abajo ocupa todo el ancho (2ª fila) */
.tagline { order: 4; flex: 1 1 100%; margin: 0; color: var(--muted); font-size: .95rem; }

/* Navegación principal después del tagline */
.primary-nav { order: 5; flex: 1 1 100%; }
.primary-nav ul { list-style: none; display: flex; justify-content: flex-start; flex-wrap: wrap; gap: .5rem 1rem; padding: 0; margin: 0; }
.primary-nav a { text-decoration: none; color: var(--text); padding: .4rem .6rem; border-radius: 8px; }
.primary-nav a:hover { background: color-mix(in oklab, var(--accent) 15%, transparent); color: var(--text); }

/* Botones y CTAs globales */
.cta, .button { border: none; background: var(--accent); color: #00131f; padding: .6rem 1rem; border-radius: 999px; cursor: pointer; font-weight: 700; box-shadow: var(--shadow); }
.button { text-decoration: none; display: inline-block; }
.button.primary { background: var(--accent); color: #00131f; }
.button.ghost, .ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); box-shadow: none; }
.button:hover, .cta:hover { transform: translateY(-1px); }
.button:active, .cta:active { transform: translateY(0); }

/* --- Hero --------------------------------------------------------------- */
.hero { padding: 6rem 0 3rem; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 60%); border-bottom: 1px solid var(--border); }
.hero h1 { font-size: clamp(1.8rem, 2.4vw + 1.2rem, 3rem); line-height: 1.15; }
.hero .lead { font-size: clamp(1rem, .6vw + .9rem, 1.25rem); color: var(--muted); margin-top: .8rem; max-width: 60ch; }
.hero .mission { margin-top: .8rem; font-size: 1.05rem; }
.hero .hero-ctas { margin-top: 1.2rem; display: flex; gap: .8rem; flex-wrap: wrap; }

/* --- Secciones ---------------------------------------------------------- */
.section { padding: 3rem 0; }
.section h2 { font-size: clamp(1.4rem, .8vw + 1.2rem, 2rem); margin-bottom: 1rem; }
.section p { max-width: 75ch; }

/* Grids */
.feature-grid, .cards, .logo-grid { display: grid; gap: 1rem; }
.feature-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); list-style: none; padding: 0; }
.cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Logos Grid (No distorsionar, centrados) */
.logo-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); list-style: none; padding: 0; align-items: center; }
.logo-grid figure { margin: 0; padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; place-items: center; gap: .5rem; }
.logo-grid img { width: auto; height: 48px; max-width: 100%; object-fit: contain; filter: saturate(0.9) contrast(1.05); }
.logo-grid figcaption { font-size: .85rem; color: var(--muted); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(0,0,0,.45); }
.card h3 { font-size: 1.15rem; margin-bottom: .6rem; }
.card ul { margin: .2rem 0 0 1.1rem; padding-left: .5rem; }
.card li { margin-bottom: .4rem; }
.card-actions { margin-top: .9rem; display: flex; gap: .6rem; flex-wrap: wrap; }

/* Tarjeta Destacada (Becas SECIHTI / Posgrado) */
.card.highlight-card {
  border: 1px solid var(--accent);
  background: linear-gradient(160deg, var(--card) 40%, color-mix(in oklab, var(--card) 85%, var(--accent)));
  box-shadow: 0 10px 30px color-mix(in oklab, var(--accent) 15%, transparent);
  position: relative;
  overflow: hidden;
}
.card.highlight-card h3 { color: var(--accent); }
.card.highlight-card::before {
  content: ""; position: absolute; top: 0; right: 0;
  width: 150px; height: 150px;
  background: var(--accent); filter: blur(70px); opacity: 0.15; pointer-events: none;
}

/* Timeline / Roadmap */
.timeline { list-style: none; padding-left: 1rem; border-left: 2px solid var(--border); display: grid; gap: 1.5rem; }
.timeline > li { position: relative; padding-left: 1rem; }
.timeline > li::before { content: ""; position: absolute; left: -14px; top: .4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent-2) 15%, transparent); }
.timeline h3 { margin-bottom: .25rem; }

/* Recursos */
.resource-list { list-style: none; padding: 0; display: grid; gap: .8rem; }
.resource-list li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.resource-list a { font-weight: 600; white-space: nowrap; }

/* Contacto */
.contact-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .6rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--muted); font-size: .95rem; }
.site-footer p { margin: .2rem 0; }
.site-footer a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--border); }
.site-footer a:hover { color: var(--accent); border-color: var(--accent); }
.legal { margin-top: .4rem; }

/* Dialog (beta) */
#betaDialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 1.5rem; box-shadow: var(--shadow); max-width: 400px; }
#betaDialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
#betaDialog h2 { margin-top: 0; }
#betaDialog a { color: var(--accent); font-weight: 600; display: block; margin-bottom: 1rem; }

/* Utilidades */
.hidden { display: none !important; }
.center { text-align: center; }

/* --- Responsivo --------------------------------------------------------- */
@media (min-width: 860px) {
  .tagline { grid-column: auto; flex: 0 1 auto; justify-self: start; }
}

@media (max-width: 720px) {
  .hero { padding-top: 4rem; }
}

@media (max-width: 480px) {
  .logo-grid img { height: 40px; }
}