/* Temas comunes de las webs (Bitácora, luz, estado, Agenda). EL MISMO ARCHIVO en todas: si se cambia, copiarlo.
   Cada app traduce estos tokens --t-* a sus propias variables; nunca usa colores sueltos.
   El tema lo pone tema.js en <html data-tema="…"> antes de pintar: claro y oscuro según el sistema (por defecto)
   o el que elija cada uno en Ajustes › Apariencia: cálido, cálido oscuro, contraste, matrix. */

@font-face { font-family: "Inter"; src: url("fuentes/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fuentes/jetbrains-mono.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fuentes/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fuentes/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Share Tech Mono"; src: url("fuentes/share-tech-mono.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fuentes/courier-prime-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* Matrix: glifos de la lluvia (Rezmason, MIT) y letra de los terminales de Reloaded (IBM VGA 8x16, int10h.org, CC BY-SA 4.0) */
@font-face { font-family: "Matrix Code"; src: url("fuentes/matrix-code.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "IBM VGA"; src: url("fuentes/ibm-vga-8x16.woff") format("woff"); font-display: swap; }

/* ---------- Claro (Niebla): blanco y el azul #BBCADF en superficies; #34548A para botones y enlaces ---------- */
:root, [data-tema="claro"] {
  color-scheme: light;
  --t-bg: #f6f8fc; --t-surface: #ffffff; --t-surface-2: #eef2f9; --t-line: #d9e1ee; --t-line-strong: #b9c5d6; --t-grid: #e6ebf2;
  --t-text: #1b2433; --t-muted: #556179; --t-faint: #7b8698;
  --t-accent: #34548a; --t-accent-hover: #2a4573; --t-on-accent: #ffffff; --t-soft: #bbcadf; --t-on-soft: #1b2433;
  --t-good: #1e7b4f; --t-warn: #9a5a00; --t-bad: #c23b3b; --t-on-bad: #ffffff; --t-ring: rgb(52 84 138 / .45);
  --t-s1: #34548a; --t-s2: #c8553d; --t-s3: #d08f1f; --t-s4: #1e7b4f; --t-s5: #7357d6;
  --t-shadow: 0 1px 2px rgb(16 24 40 / .06), 0 6px 18px rgb(16 24 40 / .06);
  --t-radius: 12px; --t-base: 16px; --t-glow: none; --t-glow-fuerte: none;
  --t-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-font-head: var(--t-font);
  --t-font-num: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --t-font-term: var(--t-font-num);
}
/* ---------- Oscuro (Noche) ---------- */
[data-tema="oscuro"] {
  color-scheme: dark;
  --t-bg: #0f141c; --t-surface: #161d28; --t-surface-2: #1d2633; --t-line: #2a3546; --t-line-strong: #3a475c; --t-grid: #222b39;
  --t-text: #e6ecf5; --t-muted: #9aa8bd; --t-faint: #6f7d93;
  --t-accent: #bbcadf; --t-accent-hover: #d3deec; --t-on-accent: #0f141c; --t-soft: #26364f; --t-on-soft: #e6ecf5;
  --t-good: #5fd39a; --t-warn: #f2b84b; --t-bad: #ff7a7a; --t-on-bad: #1a0b0b; --t-ring: rgb(187 202 223 / .5);
  --t-s1: #8fb3e8; --t-s2: #ff8a6b; --t-s3: #f2c14b; --t-s4: #5fd39a; --t-s5: #b39dfa;
  --t-shadow: 0 1px 0 rgb(255 255 255 / .02) inset, 0 8px 24px rgb(0 0 0 / .3);
}
/* ---------- Cálido: tono papel (misma letra que el frío; solo cambian los colores) ---------- */
[data-tema="calido"] {
  color-scheme: light;
  --t-bg: #faf7f2; --t-surface: #ffffff; --t-surface-2: #f3ede4; --t-line: #e4dacb; --t-line-strong: #cdbfa9; --t-grid: #eee6da;
  --t-text: #2a2420; --t-muted: #6b5f55; --t-faint: #93877b;
  --t-accent: #7c4f24; --t-accent-hover: #643e1b; --t-on-accent: #ffffff; --t-soft: #ead9c2; --t-on-soft: #2a2420;
  --t-good: #3f7a3a; --t-warn: #9a5a00; --t-bad: #b3362f; --t-on-bad: #ffffff; --t-ring: rgb(124 79 36 / .45);
  --t-s1: #7c4f24; --t-s2: #b3362f; --t-s3: #c98a1b; --t-s4: #3f7a3a; --t-s5: #6f8fa8;
  --t-shadow: 0 1px 2px rgb(60 40 20 / .07), 0 6px 18px rgb(60 40 20 / .06);
}
/* ---------- Cálido oscuro: el mismo papel, de noche y con luz de lámpara ---------- */
[data-tema="calido-oscuro"] {
  color-scheme: dark;
  --t-bg: #1c1814; --t-surface: #241f1a; --t-surface-2: #2c2620; --t-line: #3a3229; --t-line-strong: #4d4337; --t-grid: #2e2822;
  --t-text: #efe6d8; --t-muted: #b9ab98; --t-faint: #8a7d6c;
  --t-accent: #e0b07a; --t-accent-hover: #ecc79b; --t-on-accent: #1c1814; --t-soft: #3a2e22; --t-on-soft: #efe6d8;
  --t-good: #8fcf86; --t-warn: #f0b65a; --t-bad: #f08a7a; --t-on-bad: #1c0f0c; --t-ring: rgb(224 176 122 / .5);
  --t-s1: #e0b07a; --t-s2: #f08a7a; --t-s3: #f0c75e; --t-s4: #8fcf86; --t-s5: #9db8d6;
  --t-shadow: 0 1px 0 rgb(255 240 220 / .02) inset, 0 8px 24px rgb(0 0 0 / .35);
}
/* ---------- Alto contraste: negro sobre blanco y letra más grande ---------- */
[data-tema="contraste"] {
  color-scheme: light;
  --t-bg: #ffffff; --t-surface: #ffffff; --t-surface-2: #f0f0f0; --t-line: #1a1a1a; --t-line-strong: #000000; --t-grid: #bdbdbd;
  --t-text: #000000; --t-muted: #2e2e2e; --t-faint: #4a4a4a;
  --t-accent: #0040c1; --t-accent-hover: #00318f; --t-on-accent: #ffffff; --t-soft: #dce6ff; --t-on-soft: #000000;
  --t-good: #006b2e; --t-warn: #7a4200; --t-bad: #b00020; --t-on-bad: #ffffff; --t-ring: rgb(0 64 193 / .6);
  --t-s1: #0040c1; --t-s2: #b00020; --t-s3: #7a4200; --t-s4: #006b2e; --t-s5: #6a1b9a;
  --t-shadow: none; --t-radius: 6px; --t-base: 18px;
  --t-font: "Atkinson Hyperlegible", "Inter", system-ui, sans-serif;
  --t-font-head: var(--t-font);
}
/* ---------- Matrix: colores medidos en fotogramas de la trilogía (ver CLAUDE.md común) ---------- */
[data-tema="matrix"] {
  color-scheme: dark;
  --t-bg: #010604; --t-surface: #000000; --t-surface-2: #011a10; --t-line: #0b6b45; --t-line-strong: #52d4a9; --t-grid: #02562c;
  --t-text: #02ef6d; --t-muted: #19b874; --t-faint: #0f8a55;
  --t-accent: #1afbbf; --t-accent-hover: #9ff6d4; --t-on-accent: #012a23; --t-soft: #000000; --t-on-soft: #02ef6d;
  --t-good: #02ef6d; --t-warn: #c4e08f; --t-bad: #e3f5f6; --t-on-bad: #031b12; --t-ring: rgb(26 251 191 / .6);
  --t-s1: #02ef6d; --t-s2: #30fefb; --t-s3: #c4e08f; --t-s4: #0f9bbf; --t-s5: #9ff6d4;
  --t-shadow: none; --t-radius: 0px;
  --t-glow: 0 0 1px rgb(2 239 109 / .8), 0 0 5px rgb(2 239 109 / .35);
  --t-glow-fuerte: 0 0 1px rgb(26 251 191 / .9), 0 0 8px rgb(2 239 109 / .45);
  --t-font: "Share Tech Mono", ui-monospace, monospace;
  --t-font-head: "Share Tech Mono", ui-monospace, monospace;
  --t-font-num: "Share Tech Mono", ui-monospace, monospace;
  --t-font-term: "IBM VGA", ui-monospace, monospace;
  /* extras de Matrix para las apps */
  --t-mx-papel: #e3f5f6;    /* cajas invertidas: «ARE YOU SURE? (y/n)» */
  --t-mx-marco: #52d4a9;    /* marcos de ventana de terminal */
  --t-mx-terminal: #9ff6d4; /* texto de terminal */
  --t-mx-cian: #0f9bbf;     /* paneles del operador */
  --t-mx-mensaje: "Courier Prime", "Courier New", monospace;
}
/* Pantalla de monitor: líneas de barrido sobre toda la página (se ven en las pantallas de la película) */
[data-tema="matrix"] body { text-shadow: var(--t-glow); }
[data-tema="matrix"] body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 2147483000;
  background: repeating-linear-gradient(0deg, rgb(0 0 0 / .22) 0 1px, transparent 1px 3px); }
[data-tema="matrix"] ::selection { background: #02ef6d; color: #000; }
/* Zona con lluvia (lluvia.js la pinta detrás del contenido) */
/* :where() deja la especificidad a cero: si la app pone position: sticky/fixed a su cabecera, manda la app */
:where([data-tema="matrix"] [data-lluvia]) { position: relative; overflow: hidden; isolation: isolate; }
[data-tema="matrix"] [data-lluvia] > canvas.lluvia { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { [data-tema="matrix"] body::after { opacity: .6; } }

/* ---------- selector de Ajustes › Apariencia (lo pinta TEMA.selector) ---------- */
.tema-selector { display: grid; gap: 12px; font-family: var(--t-font); }
.tema-selector .tema-sistema { display: flex; gap: 10px; align-items: center; color: var(--t-text); cursor: pointer; }
.tema-selector .tema-sistema input { width: 18px; height: 18px; accent-color: var(--t-accent); }
.tema-selector .tema-grupo { display: grid; gap: 6px; }
.tema-selector .tema-grupo > span { font-size: .8125rem; color: var(--t-muted); }
.tema-selector .tema-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tema-selector button { display: grid; gap: 8px; text-align: left; padding: 10px; border-radius: var(--t-radius); border: 1px solid var(--t-line);
  background: var(--t-surface); color: var(--t-text); font: 500 .875rem var(--t-font); cursor: pointer; }
.tema-selector button[aria-checked="true"] { border-color: var(--t-accent); box-shadow: 0 0 0 2px var(--t-accent) inset; }
.tema-selector button:focus-visible { outline: 2px solid var(--t-accent); outline-offset: 2px; }
.tema-selector button small { display: block; color: var(--t-muted); font-weight: 400; }
.tema-selector .tema-luz { display: inline-flex; flex-wrap: wrap; width: fit-content; max-width: 100%; border: 1px solid var(--t-line); border-radius: var(--t-radius); overflow: hidden; background: var(--t-surface); }
.tema-selector .tema-luz button { display: block; padding: 8px 14px; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.tema-selector .tema-luz button + button { border-left: 1px solid var(--t-line); }
.tema-selector .tema-luz button[aria-checked="true"] { background: var(--t-accent); color: var(--t-on-accent); box-shadow: none; }
.tema-selector .tema-muestra i { display: block; }
.tema-muestra[data-m="claro"] i:nth-child(1) { background: #f6f8fc; } .tema-muestra[data-m="claro"] i:nth-child(2) { background: #bbcadf; } .tema-muestra[data-m="claro"] i:nth-child(3) { background: #34548a; }
.tema-muestra[data-m="oscuro"] i:nth-child(1) { background: #0f141c; } .tema-muestra[data-m="oscuro"] i:nth-child(2) { background: #26364f; } .tema-muestra[data-m="oscuro"] i:nth-child(3) { background: #bbcadf; }
.tema-muestra[data-m="calido"] i:nth-child(1) { background: #faf7f2; } .tema-muestra[data-m="calido"] i:nth-child(2) { background: #ead9c2; } .tema-muestra[data-m="calido"] i:nth-child(3) { background: #7c4f24; }
.tema-muestra[data-m="calido-oscuro"] i:nth-child(1) { background: #1c1814; } .tema-muestra[data-m="calido-oscuro"] i:nth-child(2) { background: #3a2e22; } .tema-muestra[data-m="calido-oscuro"] i:nth-child(3) { background: #e0b07a; }
.tema-muestra[data-m="contraste"] i:nth-child(1) { background: #ffffff; } .tema-muestra[data-m="contraste"] i:nth-child(2) { background: #dce6ff; } .tema-muestra[data-m="contraste"] i:nth-child(3) { background: #0040c1; }
.tema-muestra[data-m="matrix"] i:nth-child(1) { background: #010604; } .tema-muestra[data-m="matrix"] i:nth-child(2) { background: #02ef6d; } .tema-muestra[data-m="matrix"] i:nth-child(3) { background: #30fefb; }
.tema-selector .tema-muestra { height: 36px; border-radius: 6px; display: grid; grid-template-columns: 2fr 1fr 1fr; overflow: hidden; border: 1px solid rgb(127 127 127 / .25); }
