/* Portal de The Agentic D. Scientist.
   Todos los colores, tipografías y radios salen de design/tokens/tokens.css (se carga antes).
   El guardia de `python -m harness validate` rechaza colores literales en este archivo. */

:root {
  /* Alias de nombres usados por páginas anteriores. */
  --ink: var(--text);
  --soft: var(--surface-soft);
  --glass: color-mix(in srgb, var(--hero-text) 8%, transparent);
  --glass-line: color-mix(in srgb, var(--hero-text) 20%, transparent);
  --hero-soft: color-mix(in srgb, var(--hero-text) 82%, transparent);
  --shadow-card: 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent);
  --shadow-lift: 0 18px 44px color-mix(in srgb, var(--accent) 14%, transparent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; color-scheme: light; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--surface); font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Encabezado ---------- */
.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 max(20px, calc((100vw - var(--max)) / 2));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .icon { width: 28px; height: 28px; color: var(--accent); }
.brand strong { font-size: 17px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.site-header nav { display: flex; align-items: center; gap: 26px; }
.site-header nav a { color: var(--muted); font-size: 14px; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--text); }
.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--surface);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.header-cta .icon { width: 14px; height: 14px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 26px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }
.btn .icon { width: 16px; height: 16px; }
.btn-accent { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-lift); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-dark { background: var(--text); color: var(--surface); }
.btn-dark:hover { background: var(--primary); }
.btn-ghost { background: var(--glass); color: var(--hero-text); border-color: var(--glass-line); }
.btn-ghost:hover { background: color-mix(in srgb, var(--hero-text) 14%, transparent); }

/* ---------- Secciones ---------- */
main, footer { max-width: var(--max); margin: 0 auto; padding-inline: 24px; }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: 20px; }
.band { padding: 96px 0; }
.band-white { background: var(--surface); }
.band-alt { background: var(--surface-alt); border-block: 1px solid var(--line); }
.kicker { margin: 0 0 12px; color: var(--accent-text); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.section-title { margin: 0; font-size: clamp(30px, 4vw, 40px); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
.section-lead { margin: 14px 0 0; max-width: 640px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.section-head { margin-bottom: 44px; max-width: 680px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .section-lead { margin-inline: auto; }

/* Indicadores */
.summary-rail { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.summary-rail div { padding: 0 24px; border-left: 1px solid var(--line); min-width: 0; }
.summary-rail div:first-child { padding-left: 0; border-left: 0; }
.summary-rail dt { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.summary-rail dd { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 700; }

/* Catálogo por niveles */
.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
#levelFilters { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
#levelFilters button {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#levelFilters button:hover { border-color: var(--accent); color: var(--text); }
#levelFilters button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#search {
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#catalog { display: grid; gap: 12px; }
.level-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.level-group.free { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.level-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px; cursor: pointer; list-style: none; }
.level-head::-webkit-details-marker { display: none; }
.level-head:hover .level-title h3 { color: var(--primary); }
.level-toggle { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.level-toggle::before { content: "+"; font-size: 20px; line-height: 1; }
.level-group[open] .level-toggle::before { content: "−"; }
.level-number {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.level-group.free .level-number { background: var(--accent); color: var(--on-accent); }
.level-title { flex: 1; min-width: 0; }
.level-title h3 { margin: 0; font-size: 16px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.level-title span { color: var(--muted); font-size: 13px; }
.plan-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-pill); padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--surface-soft); color: var(--muted); }
.plan-badge .icon { width: 10px; height: 10px; }
.level-group.free .plan-badge { background: var(--accent-soft); color: var(--accent-text); }
.catalog-row {
  min-height: 56px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px 90px;
  align-items: center;
  gap: 20px;
  padding: 0 20px 0 80px;
}
.catalog-row strong { font-size: 14px; font-weight: 600; }
.catalog-row span { color: var(--muted); font-size: 13px; }
.catalog-row a { color: var(--accent-text); font-size: 13px; font-weight: 700; justify-self: end; }
.catalog-row a:hover { text-decoration: underline; }
.catalog-row[hidden], .level-group[hidden] { display: none; }
.publication-note { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 28px 0; }

/* Datasets y validación */
.data-table { border-top: 1px solid var(--line); }
.data-row { min-height: 60px; display: grid; grid-template-columns: 1.25fr .6fr .6fr 1fr; gap: 20px; align-items: center; border-bottom: 1px solid var(--line); font-size: 13px; }
.data-row.header { min-height: 42px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.data-row a { color: var(--accent-text); font-weight: 700; }
.data-row span { color: var(--muted); }
.validation-list { border-top: 1px solid var(--line); margin: 0; }
.validation-list div { min-height: 58px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 180px 1fr; align-items: center; }
.validation-list dt { font-size: 13px; font-weight: 700; }
.validation-list dd { margin: 0; color: var(--muted); font-size: 13px; }
.validation-links { display: flex; gap: 24px; margin-top: 24px; }
.validation-links a { color: var(--accent-text); border-bottom: 1px solid currentColor; padding-bottom: 2px; font-size: 13px; font-weight: 700; }

/* Pie */
footer {
  min-height: 110px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 30px;
  font-size: 13px;
}
footer .brand .icon { width: 20px; height: 20px; }
footer .brand strong { font-size: 14px; }
footer nav { display: flex; flex-wrap: wrap; gap: 20px; color: var(--muted); }
footer nav a:hover { color: var(--text); }
footer p { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- Metodología ---------- */
.methodology-page main { max-width: 860px; padding-block: 72px 110px; }
.methodology-page .methodology-intro { padding-bottom: 56px; }
.methodology-page .methodology-intro h1 { margin: 0; font-size: clamp(40px, 6vw, 60px); line-height: 1.05; letter-spacing: -.03em; }
.methodology-page .methodology-intro p { max-width: 700px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.methodology-page article { border-top: 1px solid var(--line); padding: 40px 0; }
.methodology-page article h2 { margin: 0 0 16px; font-size: 28px; letter-spacing: -.02em; }
.methodology-page article p, .methodology-page article li { color: var(--muted); line-height: 1.65; }
.methodology-page article a { color: var(--accent-text); font-weight: 700; border-bottom: 1px solid currentColor; }
.methodology-page .score-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.methodology-page .score-grid div { padding: 20px 14px; border-bottom: 1px solid var(--line); }
.methodology-page .score-grid strong, .methodology-page .score-grid span { display: block; }
.methodology-page .score-grid span { margin-top: 5px; color: var(--muted); font-size: 12px; }

/* ---------- Diagnóstico (base; el resto vive en placement.html) ---------- */
.placement-page main { max-width: 1040px; padding-block: 72px 98px; }
.result-panel h2 { margin: 0 0 20px; font-size: 30px; letter-spacing: -.02em; }
.recommendations { margin-top: 26px; }
.recommendations h3 { margin: 0 0 10px; }
.recommendations li, .recommendations p { color: var(--muted); line-height: 1.55; }

/* ---------- Navegación móvil ---------- */
.mobile-nav { display: none; }

@media (max-width: 800px) {
  .site-header { padding-inline: 16px; min-height: 62px; }
  .site-header nav { display: none; }
  .brand strong { font-size: 15px; }
  main, footer { padding-inline: 16px; }
  .wrap { padding-inline: 16px; }
  .band { padding: 64px 0; }
  .summary-rail { grid-template-columns: 1fr 1fr; gap: 20px 0; }
  .summary-rail div:nth-child(3) { padding-left: 0; border-left: 0; }
  .filters { align-items: stretch; flex-direction: column; padding: 12px; }
  #levelFilters { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  #levelFilters button { flex: 0 0 auto; }
  #search { width: 100%; }
  .level-head { padding: 14px 16px; gap: 12px; }
  .level-number { width: 38px; height: 38px; }
  .catalog-row { grid-template-columns: 1fr auto; padding: 12px 16px; min-height: 64px; gap: 4px 16px; }
  .catalog-row span { grid-column: 1; }
  .catalog-row a { grid-row: 1 / 3; grid-column: 2; }
  .data-row { grid-template-columns: 1fr 1fr; gap: 8px 20px; padding: 14px 0; }
  .data-row.header { display: none; }
  .data-row > *:nth-child(3), .data-row > *:nth-child(4) { font-size: 11px; }
  .validation-list div { grid-template-columns: 115px 1fr; }
  .validation-links { flex-wrap: wrap; }
  footer { flex-direction: column; align-items: flex-start; padding-block: 32px; }
  .methodology-page main { padding-block: 48px 80px; }
  .methodology-page .score-grid { grid-template-columns: 1fr 1fr; }
  .placement-page main { padding-block: 40px 72px; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 68px;
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
    z-index: 40;
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 56px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .mobile-nav a[aria-current="page"] { color: var(--accent-text); }
  .mobile-nav .icon { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
footer > strong { font-size: 14px; }
.footer-link { color: var(--accent-text); font-weight: 700; }
