/* =========================================================
   MUNDOS: cada archivo redefine estas variables.
   El body transiciona entre ellos al hacer scroll.
   ========================================================= */
:root {
  --ease: cubic-bezier(.7, 0, .2, 1);
  --pad: clamp(18px, 5vw, 72px);
}

body[data-world="base"] {
  --bg: #0f0f0d; --ink: #ece7dc; --muted: #8f8a7e; --line: #2a2924;
  --accent: #ff5a1f; --chip-bg: transparent;
  --font-d: "Archivo", sans-serif; --font-b: "Archivo", sans-serif; --font-m: "IBM Plex Mono", monospace;
}
body[data-world="confidencial"] {
  --bg: #e8e2d2; --ink: #1d1b16; --muted: #5d574a; --line: #c9c0aa;
  --accent: #b3121f; --chip-bg: #ddd5c1;
  --font-d: "Special Elite", monospace; --font-b: "Archivo", sans-serif; --font-m: "Special Elite", monospace;
}
body[data-world="cyber"] {
  --bg: #07080a; --ink: #e9ecef; --muted: #7d8590; --line: #1f2329;
  --accent: #ff2e4d; --chip-bg: rgba(255,46,77,.08);
  --font-d: "IBM Plex Mono", monospace; --font-b: "IBM Plex Mono", monospace; --font-m: "IBM Plex Mono", monospace;
}
body[data-world="vision"] {
  --bg: #021208; --ink: #b9f7c4; --muted: #5f9a6a; --line: #0f3a1c;
  --accent: #39ff6a; --chip-bg: rgba(57,255,106,.06);
  --font-d: "VT323", monospace; --font-b: "IBM Plex Mono", monospace; --font-m: "VT323", monospace;
}
body[data-world="nexai"] {
  --bg: #020617; --ink: #e2e8f0; --muted: #94a3b8; --line: #1e293b;
  --accent: #22c55e; --chip-bg: rgba(34,197,94,.08);
  --font-d: "Fira Sans", sans-serif; --font-b: "Fira Sans", sans-serif; --font-m: "Fira Code", monospace;
}
body[data-world="biblio"] {
  --bg: #f2e8d3; --ink: #2b2118; --muted: #7a6650; --line: #d9c7a5;
  --accent: #9a3a12; --chip-bg: #e8dbbf;
  --font-d: "Libre Baskerville", serif; --font-b: "Libre Baskerville", serif; --font-m: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-b);
  line-height: 1.55;
  transition: background-color .9s var(--ease), color .9s var(--ease);
}
a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--bg); }

/* Grano de película: le quita el look "digital perfecto" */
.grain {
  position: fixed; inset: -50%; z-index: 50; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0%,100% { transform: translate(0,0); } 33% { transform: translate(-3%,2%); } 66% { transform: translate(2%,-3%); } }

/* Barrido al cambiar de mundo */
.sweep { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; pointer-events: none; background: var(--accent); box-shadow: 0 0 18px var(--accent); transform: translateY(-10px); opacity: 0; }
.sweep.go { animation: sweep .9s var(--ease); }
@keyframes sweep { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(100vh); opacity: 0; } }

/* ---------- TOPBAR ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px var(--pad);
  font-family: var(--font-m); font-size: .82rem;
  color: var(--ink); background: var(--bg); border-bottom: 1px solid var(--line);
  transition: background .6s, color .6s, border-color .6s;
}
.mark { font-family: "Archivo", sans-serif; font-weight: 900; font-stretch: 62%; font-size: 1.4rem; text-decoration: none; letter-spacing: .02em; }
.mark span { color: #ff5a1f; }
.topbar-meta { opacity: .8; }
.topbar-actions { display: flex; gap: 18px; align-items: center; }
.lang { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 4px 0; }
.lang span { opacity: .45; } .lang span.on { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

.link-u { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px; transition: background-size .35s var(--ease); }
.link-u:hover { background-size: 0 1px; background-position: 100% 100%; }
.link-u.strong { color: var(--accent); background-image: linear-gradient(var(--accent), var(--accent)); }

/* Riel lateral de archivos */
.rail { position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; gap: 10px; font-family: "IBM Plex Mono", monospace; font-size: .72rem; }
.rail a { text-decoration: none; color: var(--muted); padding: 2px 6px; border-left: 2px solid transparent; transition: all .3s; }
.rail a.on { color: var(--accent); border-left-color: var(--accent); }

main { overflow-x: clip; }

/* ---------- PORTADA ---------- */
.cover { min-height: 100vh; padding: 110px var(--pad) 40px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.kicker { font-family: var(--font-m); font-size: .82rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin: 0 0 14px; }
.name { margin: 0; font-family: "Archivo", sans-serif; font-weight: 900; font-stretch: 62%; line-height: .84; font-size: clamp(4rem, 15vw, 13rem); letter-spacing: -.01em; }
.name span { display: block; }
.name .outline { color: transparent; -webkit-text-stroke: 2px var(--ink); }
.cover-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 36px; align-items: end; }
.role { font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 600; font-stretch: 85%; margin: 0 0 10px; max-width: 30ch; }
.cover-lead { color: var(--muted); max-width: 46ch; margin: 0 0 22px; }
.cover-links { display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--font-m); font-size: .9rem; }

.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); font-family: var(--font-m); }
.index a { display: grid; grid-template-columns: 42px 1fr auto; align-items: baseline; gap: 10px; padding: 13px 4px; border-bottom: 1px solid var(--line); text-decoration: none; transition: padding .35s var(--ease), color .3s; }
.index b { color: var(--accent); font-weight: 600; }
.index span { font-family: "Archivo", sans-serif; font-size: 1.15rem; font-weight: 600; }
.index em { font-style: normal; font-size: .75rem; color: var(--muted); }
.index em span { font: inherit; }
.index a:hover { padding-left: 16px; color: var(--accent); }
.scroll-cue { margin-top: 44px; width: fit-content; font-family: var(--font-m); font-size: .8rem; color: var(--muted); text-decoration: none; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* ---------- ARCHIVOS ---------- */
.file { min-height: 100vh; padding: 110px var(--pad) 80px; display: flex; flex-direction: column; justify-content: center; }
.file-head { display: flex; justify-content: space-between; gap: 16px; font-family: var(--font-m); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 40px; }
.file-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.file h2 { font-family: var(--font-d); font-size: clamp(2.2rem, 4.6vw, 4rem); line-height: 1.02; margin: 0 0 8px; font-weight: 700; }
.sub { font-family: var(--font-m); color: var(--accent); margin: 0 0 14px; font-size: 1.05rem; }
.lead { font-size: 1.12rem; margin: 10px 0 24px; max-width: 54ch; }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 10px 18px; margin: 0 0 24px; }
.facts dt { font-family: var(--font-m); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); padding-top: 4px; }
.facts dd { margin: 0; color: var(--muted); font-size: .97rem; }
.chips { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-family: var(--font-m); font-size: .78rem; padding: 4px 10px; border: 1px solid var(--line); background: var(--chip-bg); }

/* Entrada de cada archivo */
.file .file-text > *, .file .file-visual { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.file.in .file-text > *, .file.in .file-visual { opacity: 1; transform: none; }
.file.in .file-text > *:nth-child(2) { transition-delay: .08s; }
.file.in .file-text > *:nth-child(3) { transition-delay: .16s; }
.file.in .file-text > *:nth-child(4) { transition-delay: .24s; }
.file.in .file-text > *:nth-child(5) { transition-delay: .32s; }
.file.in .file-visual { transition-delay: .2s; }

/* ---------- 01 · DOCUMENTO CONFIDENCIAL ---------- */
.paper { position: relative; background: #f7f3e8; color: #1d1b16; padding: 38px 34px 28px; font-family: "Special Elite", monospace; font-size: 1.02rem; box-shadow: 0 1px 0 #c9c0aa, 8px 10px 0 rgba(29,27,22,.12); transform: rotate(-1.2deg); border: 1px solid #d8cfb8; }
.paper::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(transparent 0 31px, rgba(29,27,22,.07) 31px 32px); pointer-events: none; }
.paper p { margin: 0 0 8px; position: relative; }
.paper-title { font-size: 1.3rem; letter-spacing: .12em; margin-bottom: 18px !important; border-bottom: 2px solid #1d1b16; padding-bottom: 6px; }
.paper-hint { font-size: .78rem; color: #8a826f; margin-top: 18px !important; }
.redact { background: #111; color: #111; padding: 0 3px; cursor: help; position: relative; transition: background .25s, color .25s; }
.redact:hover { background: transparent; color: var(--accent); }
.redact:hover::after { content: attr(data-reveal); position: absolute; left: 3px; top: 0; color: var(--accent); background: #f7f3e8; white-space: nowrap; }
.stamp { position: absolute; right: 22px; bottom: 54px; z-index: 2; font-family: "Special Elite", monospace; font-size: 1.35rem; letter-spacing: .14em; color: #b3121f; border: 3px solid #b3121f; padding: 4px 12px; transform: rotate(9deg) scale(2.4); opacity: 0; mix-blend-mode: multiply; }
.file.in .stamp { animation: stamp .45s .6s var(--ease) forwards; }
@keyframes stamp { to { transform: rotate(9deg) scale(1); opacity: .85; } }

/* ---------- 02 · SOC ---------- */
.soc { background: #0b0d10; border: 1px solid #1f2329; font-family: "IBM Plex Mono", monospace; font-size: .8rem; box-shadow: 0 0 0 1px rgba(255,46,77,.08), 0 30px 60px rgba(0,0,0,.6); }
.soc-top { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #1f2329; color: #7d8590; }
.rec { color: #ff2e4d; animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.soc-body { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 16px; align-items: center; }
.radar { width: 130px; height: 130px; border-radius: 50%; position: relative; overflow: hidden; border: 1px solid #2b3038; background: radial-gradient(circle, transparent 30%, #11151a 31%, transparent 32%, transparent 62%, #11151a 63%, transparent 64%); }
.radar i { position: absolute; inset: 0; background: conic-gradient(from 0deg, rgba(255,46,77,.45), transparent 22%); animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.blip { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ff2e4d; box-shadow: 0 0 10px #ff2e4d; animation: blink 1.5s infinite; }
.b1 { top: 28%; left: 60%; } .b2 { top: 64%; left: 30%; animation-delay: .5s; } .b3 { top: 45%; left: 78%; animation-delay: 1s; background: #ffb020; box-shadow: 0 0 10px #ffb020; }
.soc-counts { display: grid; gap: 8px; }
.soc-counts div { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 10px; border: 1px solid #1f2329; }
.soc-counts b { font-size: 1.6rem; }
.soc-counts span { font-size: .68rem; color: #7d8590; letter-spacing: .1em; }
.crit b { color: #ff2e4d; text-shadow: 0 0 12px rgba(255,46,77,.6); }
.susp b { color: #ffb020; text-shadow: 0 0 12px rgba(255,176,32,.5); }
.norm b { color: #2ee6a6; text-shadow: 0 0 12px rgba(46,230,166,.5); }
.feed { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; gap: 4px; height: 196px; overflow: hidden; }
.feed li { display: grid; grid-template-columns: 62px 74px 1fr; gap: 8px; padding: 4px 8px; border-left: 2px solid #2ee6a6; background: rgba(255,255,255,.02); animation: feedin .3s ease; font-size: .74rem; }
.feed li.crit { border-left-color: #ff2e4d; } .feed li.susp { border-left-color: #ffb020; }
.feed time { color: #6b7380; }
.feed .sev { font-weight: 600; } .feed li.crit .sev { color: #ff2e4d; } .feed li.susp .sev { color: #ffb020; } .feed li.norm .sev { color: #2ee6a6; }
@keyframes feedin { from { opacity: 0; transform: translateX(-8px); } }
.glitch { position: relative; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; opacity: 0; }
.file.in .glitch::before { color: #ff2e4d; animation: glitch 3.5s infinite steps(1); }
.file.in .glitch::after { color: #2ee6a6; animation: glitch 3.5s .1s infinite steps(1) reverse; }
@keyframes glitch { 0%,92%,100% { opacity: 0; transform: none; } 93% { opacity: .8; transform: translate(-3px, 1px); clip-path: inset(10% 0 55% 0); } 96% { opacity: .8; transform: translate(3px,-1px); clip-path: inset(60% 0 8% 0); } }

/* ---------- 03 · CCTV ---------- */
.cctv { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: radial-gradient(ellipse at center, #0b3a1a 0%, #03150a 70%, #010a04 100%); border: 1px solid #0f3a1c; font-family: "VT323", monospace; color: #b9f7c4; }
.cctv::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px); pointer-events: none; }
.cctv::before { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 90px rgba(0,0,0,.85); z-index: 3; pointer-events: none; }
.osd { position: absolute; z-index: 4; font-size: 1.25rem; letter-spacing: .04em; text-shadow: 0 0 6px rgba(57,255,106,.7); }
.osd.tl { top: 10px; left: 14px; } .osd.tr { top: 10px; right: 14px; } .osd.bl { bottom: 10px; left: 14px; } .osd.br { bottom: 10px; right: 14px; color: #5f9a6a; }
.osd b { color: #39ff6a; }
.lane { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; background: linear-gradient(180deg, rgba(57,255,106,.06), rgba(57,255,106,.02)); border-top: 1px dashed rgba(57,255,106,.25); }
.gate { position: absolute; left: 58%; top: 20%; bottom: 0; width: 2px; background: #39ff6a; box-shadow: 0 0 10px #39ff6a; opacity: .7; }
.obj { position: absolute; }
.car { bottom: 12%; width: 128px; height: 52px; border-radius: 16px 22px 6px 6px; background: linear-gradient(180deg, #2f6b3c, #12341d); animation: drive 5.5s linear infinite; }
.walker { bottom: 44%; width: 26px; height: 64px; border-radius: 13px 13px 4px 4px; background: linear-gradient(180deg, #3c8a4f, #174a26); animation: walk 9s linear infinite; }
.walker::before { content: ""; position: absolute; top: -20px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #3c8a4f; }
.box { position: absolute; inset: -10px; border: 2px solid #39ff6a; box-shadow: 0 0 10px rgba(57,255,106,.5); }
.walker .box { inset: -26px -10px -8px; }
.box span { position: absolute; top: -22px; left: -2px; background: #39ff6a; color: #021208; font-size: 1rem; padding: 0 5px; white-space: nowrap; }
@keyframes drive { from { left: -160px; } to { left: 110%; } }
@keyframes walk { from { left: 110%; } to { left: -60px; } }
.scan { position: absolute; left: 0; right: 0; height: 60px; background: linear-gradient(transparent, rgba(57,255,106,.08), transparent); animation: scan 4s linear infinite; z-index: 2; }
@keyframes scan { from { top: -60px; } to { top: 100%; } }

/* ---------- 04 · NEXAI ---------- */
.device { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid #1e293b; background: #0b1224; box-shadow: 0 40px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(34,197,94,.08); transform: perspective(900px) rotateY(var(--ry, -8deg)) rotateX(var(--rx, 4deg)); transition: transform .4s ease-out; }
.device-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid #1e293b; font-family: "Fira Code", monospace; font-size: .72rem; color: #64748b; }
.device-bar i { width: 9px; height: 9px; border-radius: 50%; background: #1e293b; }
.device-bar span { margin-left: 8px; }
.device-glow { position: absolute; inset: auto -20% -40% -20%; height: 60%; background: radial-gradient(ellipse, rgba(34,197,94,.25), transparent 70%); pointer-events: none; }

/* Mini dashboard en vivo, réplica del sistema de diseño de NexAI Pro */
.nx { --nx-cyan: #22d4fd; --nx-violet: #7c5cfc; --nx-green: #22c55e; --nx-warn: #f59e0b; --nx-border: #1e293b; --nx-muted: #8a93a6;
  display: grid; grid-template-columns: 132px 1fr; min-height: 380px; font-family: "Fira Sans", sans-serif; color: #f0f2ff; font-size: 12px;
  background: radial-gradient(ellipse 70% 55% at 75% -10%, rgba(124,92,252,.22), transparent 65%), radial-gradient(ellipse 50% 40% at 10% 110%, rgba(34,212,253,.12), transparent 70%), #020617; }
.nx-side { border-right: 1px solid var(--nx-border); padding: 14px 8px; background: rgba(13,17,28,.7); }
.nx-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin: 0 4px 16px; }
.nx-logo b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, var(--nx-cyan), var(--nx-violet)); box-shadow: 0 0 16px rgba(34,212,253,.35); }
.nx-logo svg { width: 15px; fill: none; stroke: #fff; stroke-width: 2.2; }
.nx-group { font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: #5b6478; margin: 12px 6px 6px; font-weight: 700; }
.nx-item { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 8px; color: var(--nx-muted); font-size: 11px; white-space: nowrap; }
.nx-item.on { color: var(--nx-cyan); background: rgba(34,212,253,.08); box-shadow: inset -2px 0 0 var(--nx-cyan); }
.nx-item i { width: 13px; height: 13px; flex: none; background: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.ic-grid { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
.ic-chat { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Crect x='3' y='4' width='18' height='14' rx='4'/%3E%3Cpath d='M8 21l3-3'/%3E%3C/svg%3E"); }
.ic-img { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='3.5'/%3E%3C/svg%3E"); }
.ic-db { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Cellipse cx='12' cy='5.5' rx='8' ry='3'/%3E%3Cpath d='M4 5.5v13c0 1.7 3.6 3 8 3s8-1.3 8-3v-13M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E"); }
.ic-node { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Crect x='3' y='4' width='18' height='7' rx='2'/%3E%3Crect x='3' y='13' width='18' height='7' rx='2'/%3E%3C/svg%3E"); }
.nx-badge { margin-left: auto; font-style: normal; font-size: 8.5px; font-weight: 700; color: #fff; padding: 1px 5px; border-radius: 6px; background: linear-gradient(135deg, var(--nx-cyan), var(--nx-violet)); }
.nx-badge.v { background: var(--nx-violet); }
.nx-main { padding: 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.nx-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.nx-title { font-size: 21px; font-weight: 700; line-height: 1; }
.nx-title b { background: linear-gradient(135deg, var(--nx-cyan), var(--nx-violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nx-ok { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 10px; color: var(--nx-green); font-weight: 600; }
.nx-ok i { width: 6px; height: 6px; border-radius: 50%; background: var(--nx-green); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: nxPulse 1.8s infinite; }
@keyframes nxPulse { 70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.nx-btn { font-size: 10px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; background: linear-gradient(135deg, var(--nx-cyan), var(--nx-violet)); box-shadow: 0 6px 18px rgba(124,92,252,.35); }
.nx-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nx-card, .nx-kpi { border: 1px solid var(--nx-border); border-radius: 12px; background: rgba(13,17,28,.82); }
.nx-kpi { padding: 10px; display: grid; gap: 4px; min-width: 0; }
.nx-kpi p, .nx-h { font-size: 9.5px; color: var(--nx-muted); font-weight: 600; }
.nx-kpi b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.nx-kpi em { justify-self: start; font-style: normal; font-size: 8.5px; font-weight: 600; padding: 2px 6px; border-radius: 20px; white-space: nowrap; }
.nx-kpi em.up { color: var(--nx-green); background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25); }
.nx-kpi em.warn { color: var(--nx-warn); background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); }
.nx-bar { display: block; height: 4px; border-radius: 4px; background: #111827; overflow: hidden; }
.nx-bar i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--nx-cyan), var(--nx-violet)); transform-origin: left; transform: scaleX(0); transition: transform 1.4s cubic-bezier(.2,.8,.2,1); }
.nx-bar.warn i { background: linear-gradient(90deg, var(--nx-warn), #ef4444); }
.nx.live .nx-bar i { transform: scaleX(1); }
.nx-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 8px; }
.nx-card { padding: 10px; min-width: 0; }
.nx-chart svg { width: 100%; height: 92px; margin-top: 6px; display: block; }
.nx-gridlines line { stroke: #1e293b; stroke-dasharray: 3 4; }
#nx-dot { filter: drop-shadow(0 0 5px #22d4fd); }
.nx-health { display: grid; gap: 7px; align-content: start; }
.nx-meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 6px; font-size: 9.5px; color: var(--nx-muted); }
.nx-meter b { color: #f0f2ff; font-family: "Fira Code", monospace; font-size: 9.5px; }
.nx-meter b.w { color: var(--nx-warn); }
.nx-meter .nx-bar { grid-column: 1 / -1; }
.nx-chatbox { display: grid; gap: 6px; }
.nx-msg { font-size: 10.5px; line-height: 1.45; padding: 7px 10px; border-radius: 10px; max-width: 92%; }
.nx-msg.me { justify-self: end; background: linear-gradient(135deg, rgba(34,212,253,.18), rgba(124,92,252,.22)); border: 1px solid rgba(124,92,252,.35); }
.nx-msg.ai { background: #0b1224; border: 1px solid var(--nx-border); color: #cbd5e1; min-height: 34px; }
.nx-msg.ai b { font-family: "Fira Code", monospace; font-size: 8.5px; color: var(--nx-green); margin-right: 6px; }
.nx-caret { display: inline-block; width: 6px; height: 11px; margin-left: 2px; vertical-align: -1px; background: var(--nx-cyan); animation: nxBlink 1s steps(1) infinite; }
@keyframes nxBlink { 50% { opacity: 0; } }
@media (max-width: 560px) {
  .nx { grid-template-columns: 1fr; min-height: 0; }
  .nx-side { display: none; }
  .nx-main { padding: 12px; }
  .nx-kpi b { font-size: 16px; }
  .nx-row { grid-template-columns: 1fr; }
  .nx-health { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 05 · CATÁLOGO ---------- */
.catalog { display: grid; gap: 18px; }
.search { font-family: "IBM Plex Mono", monospace; font-size: .9rem; padding: 12px 14px; background: #fbf6ea; border: 1px solid #d9c7a5; color: #2b2118; min-height: 46px; }
.caret { display: inline-block; width: 8px; height: 1em; background: #9a3a12; vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(1) infinite; }
.card-ficha { position: relative; background: #fffaf0; border: 1px solid #d9c7a5; padding: 26px 28px 70px; box-shadow: 6px 8px 0 #e3d3b2; transform: rotate(.8deg); }
.card-ficha::before { content: ""; position: absolute; left: 50%; bottom: 14px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; border: 2px solid #d9c7a5; background: #f2e8d3; }
.ficha-num { font-family: "IBM Plex Mono", monospace; font-size: .8rem; color: #9a3a12; margin: 0 0 8px; }
.ficha-title { font-size: 1.35rem; font-weight: 700; margin: 0 0 6px; transition: opacity .3s; }
.ficha-meta { font-style: italic; color: #7a6650; margin: 0 0 14px; }
.ficha-lines { height: 60px; background: repeating-linear-gradient(transparent 0 19px, #e6d6b6 19px 20px); }
.stamp-loan { position: absolute; right: 22px; bottom: 26px; font-family: "IBM Plex Mono", monospace; font-weight: 600; letter-spacing: .2em; color: #9a3a12; border: 2px solid #9a3a12; padding: 4px 10px; transform: rotate(-8deg) scale(2); opacity: 0; mix-blend-mode: multiply; }
.stamp-loan.hit { animation: stamp2 .4s var(--ease) forwards; }
@keyframes stamp2 { to { transform: rotate(-8deg) scale(1); opacity: .85; } }

/* ---------- BITÁCORA / INVENTARIO ---------- */
.ledger { padding: 110px var(--pad) 60px; }
.ledger-title { font-family: "Archivo", sans-serif; font-weight: 900; font-stretch: 62%; font-size: clamp(2.6rem, 7vw, 5.5rem); line-height: .9; margin: 0 0 30px; text-transform: uppercase; }
.ledger-title:not(:first-child) { margin-top: 90px; }
.ledger-rows .row { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); }
.ledger-rows .row:last-child { border-bottom: 1px solid var(--line); }
.date { font-family: var(--font-m); font-size: .85rem; color: var(--accent); padding-top: 4px; }
.row h3 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 700; font-stretch: 90%; }
.row p { margin: 0; color: var(--muted); }
.inventory { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.inventory div { padding: 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .3s; }
.inventory div:hover { background: rgba(255,90,31,.06); }
.inventory span { font-family: var(--font-m); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.inventory p { margin: 8px 0 0; }

/* Anexos: etiquetas de expediente con perforación y sello */
.annex-note { color: var(--muted); margin: -14px 0 28px; max-width: 52ch; }
.annex { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 44px 18px; padding-top: 20px; }
.tag { position: relative; padding: 46px 18px 20px; min-height: 230px; display: flex; flex-direction: column; gap: 8px;
  background: #ece7dc; color: #1a1814; border-radius: 4px 4px 4px 22px; transform: rotate(var(--r, -1.2deg));
  box-shadow: 0 18px 30px rgba(0,0,0,.35); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.tag:nth-child(2) { --r: 1.4deg; } .tag:nth-child(3) { --r: -.6deg; } .tag:nth-child(4) { --r: 1deg; }
.tag:hover { transform: rotate(0) translateY(-6px); }
.tag::before { content: ""; position: absolute; top: 16px; left: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 3px #c9c1b0; }
.tag::after { content: ""; position: absolute; top: -26px; left: 22px; width: 2px; height: 46px; background: #9a8f7a; transform: rotate(-14deg); transform-origin: bottom; }
.tag-id { position: absolute; top: 14px; right: 16px; font-family: "IBM Plex Mono", monospace; font-size: .72rem; letter-spacing: .1em; color: #8b8272; }
.tag h3 { font-family: "Archivo", sans-serif; font-weight: 800; font-stretch: 75%; font-size: 1.35rem; line-height: 1.05; margin: 0; text-transform: uppercase; }
.tag p { margin: 0; font-size: .86rem; color: #4a4439; }
.tag-date { margin-top: auto; font-family: "IBM Plex Mono", monospace; font-size: .75rem; color: #6b6356; }
.tag-stamp { align-self: flex-start; font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: #ff5a1f; border: 2px solid currentColor; padding: 3px 8px; border-radius: 3px; transform: rotate(-4deg); }
.tag-stamp.pending { color: #6b6356; border-style: dashed; }

/* ---------- CONTACTO ---------- */
.contact { min-height: 80vh; padding: 110px var(--pad); display: flex; flex-direction: column; justify-content: center; }
.big { font-family: "Archivo", sans-serif; font-weight: 900; font-stretch: 62%; font-size: clamp(4rem, 16vw, 14rem); line-height: .85; margin: 0 0 24px; }
.mail { font-family: "Archivo", sans-serif; font-weight: 600; font-size: clamp(1.4rem, 4vw, 3rem); text-decoration: none; color: var(--accent); width: fit-content; }
.mail:hover { text-decoration: underline; text-underline-offset: 6px; }
.copy { margin-top: 18px; width: fit-content; font-family: var(--font-m); font-size: .85rem; background: none; color: var(--ink); border: 1px solid var(--line); padding: 10px 16px; cursor: pointer; transition: border-color .3s, color .3s; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px var(--pad); border-top: 1px solid var(--line); font-family: var(--font-m); font-size: .78rem; color: var(--muted); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .cover-grid, .file-grid { grid-template-columns: 1fr; }
  .rail { display: none; }
  .inventory { grid-template-columns: 1fr 1fr; }
  .annex { grid-template-columns: 1fr 1fr; }
  .ledger-rows .row { grid-template-columns: 1fr; gap: 6px; }
  .topbar-meta { display: none; }
}
@media (max-width: 560px) {
  .inventory { grid-template-columns: 1fr; }
  .annex { grid-template-columns: 1fr; gap: 26px; }
  .tag { min-height: 0; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 10px; }
  .soc-body { grid-template-columns: 1fr; justify-items: center; }
  .feed li { grid-template-columns: 56px 1fr; } .feed time { display: none; }
  .paper { padding: 30px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .file .file-text > *, .file .file-visual { opacity: 1; transform: none; }
  .stamp { opacity: .85; transform: rotate(9deg); }
}
