/* MALLEN 360° — SWISS FORENSIC PRECISION & TACTILE GLASS */
/* ==========================================================================
   FIRMA MALLEN® — DEEP SCROLL DIM, SMOOTH POINTER & PRECISION SANDBOX (v95)
   ========================================================================== */

:root {
  --bg-canvas: #07090e;
  --bg-elevated: rgba(14, 18, 26, 0.90);
  --bg-card: rgba(16, 20, 29, 0.88);
  --bg-card-hover: rgba(22, 28, 40, 0.95);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-hairline: rgba(148, 163, 184, 0.15);
  --shadow-architectural: 0 1px 0 0 inset rgba(255, 255, 255, 0.10),
                          0 16px 34px -12px rgba(0, 0, 0, 0.84);
  --grid-line-color: rgba(148, 163, 184, 0.036);
  --focus-ring-color: #e2e8f0;

  --kelvin-cool: 236, 244, 255;
  --kelvin-neutral: 255, 255, 255;
  --kelvin-warm: 255, 244, 224;
  --active-kelvin: var(--kelvin-cool);

  --scroll-dim-alpha: 0;
  --cursor-beam-boost: 1;

  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
}

html.light-mode,
body.light-mode {
  --bg-canvas: #e9eef5;
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --border-hairline: #cbd5e1;
  --shadow-architectural: 0 1px 0 0 inset #ffffff,
                          0 3px 8px 0 rgba(15, 23, 42, 0.05),
                          0 14px 26px -10px rgba(15, 23, 42, 0.09);
  --grid-line-color: rgba(15, 23, 42, 0.038);
  --focus-ring-color: #334155;
}

html {
  font-size: 18px !important;
  scroll-padding-top: 5.5rem;
  scroll-behavior: smooth;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

body {
  position: relative;
  background-color: var(--bg-canvas) !important;
  color: var(--text-primary) !important;
  background-image:
    linear-gradient(to right, var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-color) 1px, transparent 1px) !important;
  background-size: 56px 56px !important;
  overflow-x: hidden;
  font-size: 18px !important;
  line-height: 1.7 !important;
}

#mallen-architectural-wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}

#mallen-wall-geometry-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(0);
}

#mallen-wall-vignette {
  display: none !important;
  background: none !important;
  pointer-events: none;
}

html.light-mode #mallen-wall-vignette {
  display: none !important;
  background: none !important;
}

#mallen-wall-lamp {
  position: absolute;
  top: -420px;
  left: -420px;
  width: 840px;
  height: 840px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(50vw, 35vh, 0);
  background: radial-gradient(
    circle,
    rgba(var(--active-kelvin), calc(0.17 * var(--cursor-beam-boost))) 0%,
    rgba(var(--active-kelvin), calc(0.08 * var(--cursor-beam-boost))) 34%,
    rgba(var(--active-kelvin), calc(0.022 * var(--cursor-beam-boost))) 58%,
    transparent 74%
  );
}

html.light-mode #mallen-wall-lamp {
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, calc(0.96 * min(1.18, var(--cursor-beam-boost)))) 0%,
    rgba(255, 255, 255, 0.60) 38%,
    transparent 70%
  );
}

header, main, section, footer {
  position: relative;
  z-index: 1;
}

*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--focus-ring-color) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(226, 232, 240, 0.22) !important;
}

button, a.btn-forensic, input[type="checkbox"], input[type="radio"], summary, .interactive-chip, .lang-pill {
  min-width: 24px;
  min-height: 24px;
}

.mallen-glass-card,
.quantum-card,
.mallen-surface-card {
  --card-kelvin: var(--kelvin-cool);
  --spot-size: 380px;
  --spot-alpha: 0.18;
  --border-alpha: 0.54;
  --mouse-x: -999px;
  --mouse-y: -999px;
  position: relative;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-hairline) !important;
  border-radius: 14px !important;
  box-shadow: var(--shadow-architectural) !important;
  contain: layout style paint;
  overflow: hidden;
}

#express-check .mallen-glass-card,
#express-check .quantum-card,
#express-check .mallen-surface-card,
#osint-calibration-engine {
  --card-kelvin: var(--kelvin-cool);
  --spot-size: 460px;
  --spot-alpha: 0.20;
  --border-alpha: 0.62;
}

#risk-sandbox-section .mallen-glass-card,
#risk-sandbox-section label,
#eu-interactive-sandbox label {
  --card-kelvin: var(--kelvin-neutral);
  --spot-size: 290px;
  --spot-alpha: 0.24;
  --border-alpha: 0.72;
}

#mallen-vanta-trust-center .mallen-glass-card,
#mallen-vanta-trust-center .grid > div,
#eu-trust-center-section .grid > div,
#validez-legal .mallen-glass-card,
#probative-validity-section .mallen-surface-card {
  --card-kelvin: var(--kelvin-warm);
  --spot-size: 410px;
  --spot-alpha: 0.19;
  --border-alpha: 0.58;
}

.mallen-glass-card::before,
.quantum-card::before,
.mallen-surface-card::before {
  content: "" !important;
  display: block !important;
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    var(--spot-size, 380px) circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(var(--card-kelvin, 236, 244, 255), calc(var(--spot-alpha, 0.18) * var(--cursor-beam-boost))),
    transparent 68%
  ) !important;
  z-index: 0;
}

.mallen-glass-card::after,
.quantum-card::after,
.mallen-surface-card::after {
  content: "" !important;
  display: block !important;
  position: absolute;
  bottom: 0;
  left: 14%;
  right: 14%;
  height: 1.5px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--card-kelvin, 255, 255, 255), 0.85),
    transparent
  ) !important;
  opacity: 0.25;
  z-index: 2;
}

.mallen-glass-card:hover,
.quantum-card:hover,
.mallen-surface-card:hover {
  border-color: rgba(var(--card-kelvin, 255, 255, 255), var(--border-alpha, 0.52)) !important;
}

.mallen-glass-card:hover::after,
.quantum-card:hover::after,
.mallen-surface-card:hover::after {
  opacity: 0.95 !important;
  left: 4% !important;
  right: 4% !important;
}

.mallen-glass-card > *,
.quantum-card > *,
.mallen-surface-card > * {
  position: relative;
  z-index: 1;
}

.tabular-telemetry {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

@keyframes guilloche-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.mallen-guilloche-ring {
  transform-origin: center;
  animation: guilloche-spin 48s linear infinite;
}

input.mallen-input-subtle-red {
  border-color: rgba(239, 68, 68, 0.78) !important;
  background-color: rgba(127, 29, 29, 0.14) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16) !important;
}
.mallen-subtle-red-hint {
  color: #f87171 !important;
  font-size: 0.86rem !important;
  font-weight: 500;
  margin-top: 6px;
}
.mallen-sandbox-card-active {
  border-color: rgba(255, 255, 255, 0.62) !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28) !important;
}
.mallen-sandbox-card-inactive {
  opacity: 0.55;
  border-color: rgba(148, 163, 184, 0.20) !important;
}

html body p, html body li, html body dd, html body td, html body th, html body label, html body summary {
  font-size: 1.02rem !important;
  line-height: 1.68 !important;
}
html body .text-xs, html body .text-\[8px\], html body .text-\[9px\], html body .text-\[10px\], html body .text-\[11px\], html body .text-\[12px\], html body small, html body .mallen-baymard-microcopy {
  font-size: 0.88rem !important;
  line-height: 1.55 !important;
}
html body .text-sm { font-size: 1.0rem !important; line-height: 1.62 !important; }
html body .text-base, html body .text-lg { font-size: 1.14rem !important; line-height: 1.6 !important; }
html body h1 { font-size: clamp(2.1rem, 3.6vw, 3.0rem) !important; line-height: 1.18 !important; }
html body h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem) !important; line-height: 1.25 !important; }
html body h3 { font-size: clamp(1.25rem, 2.0vw, 1.5rem) !important; line-height: 1.32 !important; }
html body input:not([type="checkbox"]):not([type="radio"]), html body select, html body textarea, html body button, html body a.mallen-btn-primary, html body a.mallen-btn-secondary {
  font-size: 1.0rem !important;
  min-height: 46px !important;
}

html.light-mode header, html.light-mode footer, html.light-mode .top-bar-surface {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}
html.light-mode .mallen-glass-card, html.light-mode .quantum-card, html.light-mode .mallen-surface-card, html.light-mode [class*="bg-slate-9"], html.light-mode [class*="bg-slate-8"] {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
}
html.light-mode h1, html.light-mode h2, html.light-mode h3, html.light-mode h4, html.light-mode .text-white, html.light-mode .text-slate-100, html.light-mode .text-slate-200 {
  color: #0f172a !important;
}
html.light-mode p, html.light-mode li, html.light-mode label, html.light-mode summary, html.light-mode .text-slate-300, html.light-mode .text-slate-400 {
  color: #334155 !important;
}
html.light-mode input:not([type="checkbox"]):not([type="radio"]), html.light-mode select, html.light-mode textarea {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #94a3b8 !important;
}

#mallen-mobile-drawer-backdrop, #mallen-pwa-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.78);
  z-index: 9990;
  display: none;
}
#mallen-mobile-drawer-backdrop.open, #mallen-pwa-modal-backdrop.open { display: block; }

#mallen-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(84vw, 320px);
  background: var(--bg-canvas);
  border-left: 1px solid var(--border-hairline);
  z-index: 9995;
  transform: translate3d(100%, 0, 0);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}
#mallen-mobile-drawer.open { transform: translate3d(0, 0, 0); }

#mallen-pwa-install-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  width: min(92vw, 470px);
  background: #0d111a;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 1.5rem;
  z-index: 9999;
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.88);
  display: none;
}
#mallen-pwa-install-modal.open { display: block; }
html.light-mode #mallen-pwa-install-modal {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}


/* Vista editorial ligera para Arquitectura de Blindaje Patrimonial 360° (cero lag ni apariencia de botones) */
#mallen-vanta-trust-center .mallen-glass-card,
#mallen-vanta-trust-center .quantum-card,
#mallen-vanta-trust-center .mallen-surface-card,
#mallen-vanta-trust-center .grid > div {
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--border-hairline) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  contain: none !important;
  overflow: visible !important;
}

#mallen-vanta-trust-center .mallen-glass-card::before,
#mallen-vanta-trust-center .mallen-glass-card::after,
#mallen-vanta-trust-center .grid > div::before,
#mallen-vanta-trust-center .grid > div::after {
  display: none !important;
  content: none !important;
}


/* ==========================================================================
   LENTE DE ILUMINACIÓN DE TEXTO (GPU 120 FPS — mix-blend-mode: color-dodge)
   No proyecta neblina sobre el fondo negro; enciende las letras dentro del radio
   ========================================================================== */
#mallen-wall-lamp {
  position: fixed !important;
  top: -360px !important;
  left: -360px !important;
  width: 720px !important;
  height: 720px !important;
  z-index: 45 !important;
  pointer-events: none !important;
  mix-blend-mode: color-dodge !important;
  will-change: transform !important;
  backface-visibility: hidden !important;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.36) 0%,
    rgba(236, 244, 255, 0.16) 32%,
    rgba(236, 244, 255, 0.04) 56%,
    transparent 70%
  ) !important;
}

html.light-mode #mallen-wall-lamp {
  mix-blend-mode: normal !important;
  opacity: 0 !important;
}

/* v117: Eliminación global de sombras proyectadas y degradados hacia abajo */
*, *::before, *::after {
  box-shadow: none !important;
  text-shadow: none !important;
}
body, html {
  background-image: none !important;
}
section, header, footer, main, article,
.mallen-surface-card, .mallen-glass-card, .mallen-btn-primary, .mallen-btn-secondary {
  box-shadow: none !important;
  background-image: none !important;
}

/* v119: Fondo uniforme y plano en todas las páginas (cero oscurecimiento progresivo / viñetas) */
html, body {
  background-color: #020617 !important;
  background-image: none !important;
  background: #020617 !important;
}
html.light-mode, body.light-mode {
  background-color: #f8fafc !important;
  background-image: none !important;
  background: #f8fafc !important;
}
body::before, body::after, main::before, main::after,
#quantum-light-overlay, #quantum-ambient-layer, .quantum-vignette, .mallen-scroll-fade {
  display: none !important;
  opacity: 0 !important;
  background: none !important;
}


/* v128: Contraste nítido en Modo Claro para pasarela, directorios, ARCO y verify */
html.light-mode body { background-color: #f8fafc !important; color: #0f172a !important; }
html.light-mode .text-emerald-400, html.light-mode .text-emerald-300 { color: #047857 !important; }
html.light-mode .text-blue-400, html.light-mode .text-blue-300, html.light-mode .text-cyan-400, html.light-mode .text-cyan-300 { color: #0369a1 !important; }
html.light-mode .bg-slate-950, html.light-mode .bg-slate-900, html.light-mode [class*="bg-slate-950/"], html.light-mode [class*="bg-slate-900/"] {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}


/* v130: Pestaña activa nítida en Modo Claro para /normas/:cat y /normas/:cat/:idx */
html.light-mode a[aria-current="page"].mallen-nav-pill-active {
  background-color: #e0f2fe !important;
  color: #0f172a !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.35), 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}
