/* theme.css — modo claro/oscuro de la portada (2026-11). Se carga DESPUÉS de /assets/nocturne/tokens.css.
   Los colores viven en tokens (--color-*, --th-*); aquí solo lo que no se puede expresar con un token:
   lockup del logo, conmutador de tema, botón de la banda violeta y los matices del claro. */

/* — Logo: el lockup «-dark» tiene texto blanco (para fondo oscuro); el «-light», texto navy (para fondo claro) — */
.th-logo-on-light { display: none !important; }
html[data-theme="light"] .th-logo-on-dark { display: none !important; }
html[data-theme="light"] .th-logo-on-light { display: block !important; }

/* — Conmutador de tema (misma especificación que las subpáginas) — */
.th-theme-toggle {
  flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-surface); box-shadow: var(--shadow-sm); color: var(--color-neutral-300);
}
.th-theme-toggle:hover { color: var(--color-text); }
.th-theme-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.th-theme-toggle svg { width: 16px; height: 16px; display: block; }
.th-theme-row {
  all: unset; box-sizing: border-box; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 16px 0;
  border-bottom: 1px solid var(--color-divider); font-size: 16px; font-weight: 500; color: var(--color-text);
}
.th-theme-row:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.th-theme-row svg { width: 18px; height: 18px; flex: none; color: var(--color-neutral-300); }

/* — Banda violeta «How»: botón secundario — */
.th-band-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px;
  border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
  background: var(--th-band-btn-bg); color: var(--th-band-btn-fg);
}
.th-band-btn:hover { background: var(--th-band-btn-bg-h); color: var(--th-band-btn-fg-h); }
.th-band-btn:focus-visible { outline: 2px solid var(--th-on-brand); outline-offset: 3px; }

/* — Cabecera en pantallas estrechas: conmutador + EN/ES + burger caben en 375 px — */
@media (max-width: 640px) {
  .th-hbar { gap: 10px !important; }
  .th-lang-ico { display: none !important; }
  .th-langwrap { gap: 6px !important; }
}

/* — Cambio de tema sin fundidos escalonados: durante el cambio se anulan las transiciones de color — */
html.th-theme-switching *, html.th-theme-switching *::before, html.th-theme-switching *::after { transition: none !important; }

/* — Matices del claro — */
html[data-theme="light"] body { background: var(--color-bg); }
html[data-theme="light"] a:hover { color: var(--color-accent-200); }
html[data-theme="light"] .tag-outline { border-color: color-mix(in srgb, var(--color-accent) 70%, transparent); }
/* El navegador pinta los campos y la barra de scroll con el esquema del tema (color-scheme viene de tokens.css). */
html[data-theme="light"] .input { background: #fff; }
html[data-theme="light"] .input:hover { border-color: color-mix(in srgb, var(--color-text) 40%, transparent); }

/* ═══════════════ LOTE 3 (1-nov-2026): accesibilidad, visual, responsive, coherencia con el sistema del sitio ═══════════════ */

/* — Contraste (R2-06/R2-07): rellenos del diagrama y chip «Tracehold» en oscuro. Solo la portada carga este fichero;
     el claro (tokens.css, html[data-theme="light"]) tiene mayor especificidad y no se toca. — */
/* (los 3 valores oscuros ya viven en /assets/nocturne/tokens.css desde el 1-nov; override local retirado) */

/* — Utilidades — */
.th-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.th-caret { display: inline-block; width: 1.5px; height: 16px; margin-left: 1px; vertical-align: -3px; background: var(--color-accent); animation: blink 1s step-end infinite; }
.input::placeholder { color: var(--color-neutral-400); opacity: 1; }          /* R2-08 */
.tag { font-size: 12px; }                                                  /* R2-22 */
#console button:focus-visible { outline: 2px solid var(--color-accent) !important; outline-offset: 2px !important; }   /* R2-11 (el inline all:unset lo anulaba) */

/* — Botones: UN solo sistema (D1 primario RELLENO, P6 tamaño, P9 estados) con las mismas métricas que .h-btn de las subpáginas — */
.btn { min-height: 36px; padding: 0 17px; border-radius: 8px; font-weight: 500; line-height: 1.2;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 160ms cubic-bezier(.23, 1, .32, 1); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-lg { min-height: 44px; padding: 0 22px; font-size: 15px; }
.btn-primary { background: var(--th-brand); border-color: var(--th-brand); }
.btn-primary, .btn-primary:hover, .btn-primary:active { color: var(--th-on-brand) !important; }
.btn-primary:hover, .btn-primary:active { background: var(--th-brand); border-color: var(--th-brand); }          /* táctil: el hover del DS no cambia el relleno */
.btn-secondary, .btn-secondary:hover { color: var(--color-text) !important; }
.btn-ghost, .btn-ghost:hover { color: var(--color-accent) !important; }
html:not([data-theme="light"]) .btn-ghost, html:not([data-theme="light"]) .btn-ghost:hover { color: var(--color-accent-400) !important; }   /* R2-05 */
@media not all and (hover: hover) and (pointer: fine) { .btn-secondary:hover, .btn-ghost:hover { background: transparent; } }
@media (hover: hover) and (pointer: fine) {
  /* V-02: el hover OSCURECE (criterio de las subpáginas: 5,45 → 7,1:1 sobre blanco); --th-brand-2 aclaraba a 4,14:1 */
  .btn-primary:hover { background: color-mix(in srgb, var(--th-brand) 85%, #000); border-color: color-mix(in srgb, var(--th-brand) 85%, #000); }
  .btn-primary:active { background: color-mix(in srgb, var(--th-brand) 75%, #000); border-color: color-mix(in srgb, var(--th-brand) 75%, #000); }
  .th-band-btn:hover { background: var(--th-band-btn-bg-h); }
}
.th-band-btn { border-radius: 8px; transition: background-color 150ms ease, color 150ms ease, transform 160ms cubic-bezier(.23, 1, .32, 1); }
.th-band-btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { .btn:active:not(:disabled), .th-band-btn:active { transform: none; } }

/* — Titulares de sección (P5): la escala de las subpáginas (polish.css) — */
.th-h2 { font-family: var(--font-heading); font-weight: 600; font-size: clamp(32px, 1.5vw + 18px, 44px); line-height: 1.08; letter-spacing: -.03em; margin: 0; max-width: 18ch; text-wrap: balance; overflow-wrap: break-word; }
@media (max-width: 640px) { .th-h2 { font-size: clamp(28px, 6vw + 8px, 34px); letter-spacing: -.028em; } }
.th-h2--band { font-size: clamp(32px, 4.4vw, 60px); line-height: 1.04; letter-spacing: -.025em; }       /* la banda violeta conserva su tamaño (P2 es decisión de Ander) pero a 600 */

/* — Pausa de las animaciones del héroe (WCAG 2.2.2) — */
.th-pause { all: unset; box-sizing: border-box; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; color: var(--color-neutral-300); background: var(--color-surface); box-shadow: var(--shadow-sm); transition: color 150ms, transform 160ms cubic-bezier(.23, 1, .32, 1); }
.th-pause i { font-size: 14px; }
.th-pause:hover { color: var(--color-text); }
.th-pause:active { transform: scale(.94); }
.th-pause:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .th-pause { display: none; } }
html.th-paused *, html.th-paused *::before, html.th-paused *::after { animation-play-state: paused !important; }

/* — Zonas con scroll horizontal (R2-04): enfocables, con nombre, con pista visible — */
.th-scroll { overflow-x: auto; }
.th-scroll:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 6px; }
.th-hint { display: none; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--color-neutral-400); }
@media (max-width: 900px) {
  .th-hint { display: flex; }
  /* diagrama: el contenido que sigue a la derecha se difumina (la tabla no, por su columna fija) */
  .th-scroll--fade { padding-right: 36px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
  /* tabla: la columna Tracehold queda fija a la derecha */
  .th-cmp-best { position: sticky !important; right: 0; z-index: 2; }
  .th-cmp-best::before { content: ""; position: absolute; top: 0; bottom: 0; left: -12px; width: 12px; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .38)); }
  html[data-theme="light"] .th-cmp-best::before { background: linear-gradient(90deg, transparent, rgba(20, 16, 48, .14)); }
}
@media (max-width: 640px) {
  .th-cmp { min-width: 560px !important; grid-template-columns: 112px repeat(3, minmax(148px, 1fr)) !important; }
  .th-cmp [role="rowheader"] { font-size: 13px !important; padding-right: 10px !important; }
}

/* — Área táctil (R2-23): solo con puntero grueso — */
@media (pointer: coarse) {
  .btn, .th-langwrap a, #top button, #policy button, #console button, summary, .nav-signin, .nav-burger { min-height: 44px; }
  .th-theme-toggle, .nav-burger { min-width: 44px; min-height: 44px; }
  .th-langwrap a { min-width: 40px; justify-content: center; }
  .nav-signin { display: inline-flex; align-items: center; }
  .th-pause { width: 44px; height: 44px; }
  .th-flinks { gap: 0 !important; }
  .th-flinks a { display: flex; align-items: center; min-height: 44px; }
}
/* selector de acción del diagrama: cabe en 375 px también en español */
.th-ybtn { white-space: nowrap; }
@media (max-width: 480px) { .th-ybtn { padding: 0 10px !important; } }
