/* =============================================================
   Grupo Bande · Centro de sistemas
   Índice editorial. Papel cálido vs navy casi-negro (contraste
   por temperatura, no gris plano). Bricolage Grotesque (display)
   + Hanken Grotesk (texto) + un mono para las rutas.

   Los sistemas NO son tarjetones: son las FILAS de un índice
   numerado. Al enfocar, la fila se rellena de navy de izquierda
   a derecha y se invierte — ese barrido es el gesto de la casa.
   ============================================================= */

:root {
  --paper:       #f4f3ef;   /* fondo cálido */
  --card:        #ffffff;
  --ink:         #0d131f;   /* navy casi-negro: texto + bordes */
  --ink-soft:    #545c68;
  --ink-faint:   #8b929d;
  --line:        rgba(13,19,31,.13);
  --line-strong: rgba(13,19,31,.22);
  --glyph-bg:    rgba(13,19,31,.05);
  --invert-bg:   #0d131f;
  --invert-fg:   #f4f3ef;
  --invert-soft: #99a2b1;
  --shape-line:  rgba(13,19,31,.09);
  --dot:         rgba(13,19,31,.07);
  --focus:       #2f5fe0;
  --shadow-nav:  0 8px 28px rgba(13,19,31,.09);
  --shadow-row:  0 14px 34px rgba(13,19,31,.13);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-text:    "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:    ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  --maxw: 1180px;
  --nav-h: 78px;
}

html[data-theme="dark"] {
  --paper:       #0b0e14;
  --card:        #11161f;
  --ink:         #f1f0ea;
  --ink-soft:    #98a1af;
  --ink-faint:   #6c7481;
  --line:        rgba(241,240,234,.15);
  --line-strong: rgba(241,240,234,.28);
  --glyph-bg:    rgba(241,240,234,.06);
  --invert-bg:   #f1f0ea;
  --invert-fg:   #0b0e14;
  --invert-soft: #5c636f;
  --shape-line:  rgba(241,240,234,.09);
  --dot:         rgba(241,240,234,.06);
  --focus:       #7aa2f0;
  --shadow-nav:  0 8px 28px rgba(0,0,0,.45);
  --shadow-row:  0 14px 34px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background .3s ease, color .3s ease;
}

/* ── Fondo arquitectónico (hairline, con parallax) ────────── */
.bg-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-fx .grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.5px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 78% 58% at 22% 6%, #000 34%, transparent 80%);
          mask-image: radial-gradient(ellipse 78% 58% at 22% 6%, #000 34%, transparent 80%);
  opacity: .65;
}
.shape {
  position: absolute; aspect-ratio: 1;
  border: 1.5px solid var(--shape-line);
  border-radius: 24%;
  transform: translate3d(var(--px,0), var(--py,0), 0) rotate(var(--rot,0deg));
  will-change: transform;
}
.shape::before {
  content: ""; position: absolute; inset: 17%;
  border: 1.5px solid var(--shape-line); border-radius: 22%;
}
.s1 { width: min(46vw, 480px); top: -14vh; left: -10vw; --rot: 22deg; }
.s2 { width: min(30vw, 330px); top: 46%;  right: -9vw;  --rot: -15deg; }
.s3 { width: min(20vw, 230px); bottom: -10vh; left: 22%; --rot: 10deg; }

/* ── Header píldora flotante ──────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: center;
  padding: 16px clamp(14px, 4vw, 28px) 10px;
  /* Difumina lo que pasa por debajo: nada de texto cortado a la mitad. */
  background: linear-gradient(var(--paper) 46%, transparent);
}
.nav-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  width: 100%; max-width: 780px;
  padding: 8px 8px 8px 15px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
          backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(13,19,31,.05);
  transition: box-shadow .3s ease, border-color .3s ease;
}
body.is-scrolled .nav-pill { box-shadow: var(--shadow-nav); border-color: var(--line-strong); }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo {
  flex: none; display: grid; place-items: center;
  height: 34px; padding: 4px 9px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px;
}
.brand-logo img { height: 21px; width: auto; object-fit: contain; display: block; }
.brand-sep { width: 1px; height: 20px; background: var(--line); flex: none; }
.brand-sub { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; flex: none;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-text); font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, opacity .2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); opacity: .88; }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .ic-moon { display: none; }
html[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
html[data-theme="dark"] .theme-toggle .ic-moon { display: inline; }

/* ── Contenido ────────────────────────────────────────────── */
.page {
  position: relative; z-index: 1;
  flex: 1; width: 100%; max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(20px, 5vw, 44px) clamp(36px, 5vw, 56px);
  display: grid; gap: clamp(30px, 4vw, 44px);
  align-content: start;
}
/* Sin esto las columnas del grid crecen hasta el min-content de las
   filas y la portada se sale de la pantalla en movil. */
.page > * { min-width: 0; }

/* ── Hero ─────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 18px;
}
.eyebrow .tick { width: 24px; height: 2px; background: var(--ink); display: inline-block; }

.intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 4.4vw, 3.5rem);
  line-height: .98;
  letter-spacing: -.032em;
  text-wrap: balance;
  max-width: 13ch;
}
.intro h1 .dot { color: var(--focus); }
.intro p {
  margin: 22px 0 0; max-width: 40ch;
  font-size: clamp(.98rem, 1.3vw, 1.08rem);
  color: var(--ink-soft); line-height: 1.6;
}

/* Notas del hero: las dos reglas reales de la plataforma, en fichas
   regladas. Nada de contadores grandes de adorno. */
.intro-notes { margin: 30px 0 0; max-width: 42ch; }
.intro-notes .note {
  display: grid; grid-template-columns: minmax(0, 11ch) minmax(0, 1fr); gap: 4px 18px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.intro-notes .note:last-child { border-bottom: 1px solid var(--line); }
.intro-notes dt {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); line-height: 1.5; padding-top: 2px;
}
.intro-notes dd { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }

/* ── Índice de sistemas ───────────────────────────────────── */
.systems-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1.5px solid var(--ink);
}
.systems-head h2 {
  margin: 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.02rem; letter-spacing: -.01em;
}
.systems-head span {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em;
  color: var(--ink-faint); white-space: nowrap;
}

.systems { display: grid; gap: 9px; min-width: 0; }

/* La fila: índice · glifo · nombre+ruta · descripción · flecha */
.sys {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid;
  grid-template-columns: 24px 44px minmax(0, 1fr) auto;
  align-items: center; gap: 16px;
  padding: 13px 17px;
  background: var(--card);
  border: 1.5px solid var(--line-strong);
  border-radius: 16px;
  text-decoration: none; color: var(--ink);
  transition: transform .32s cubic-bezier(.2,.7,.3,1),
              color .3s ease, border-color .3s ease, box-shadow .32s ease;
}
/* Barrido navy de izquierda a derecha: el gesto de la casa */
.sys::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--invert-bg);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .46s cubic-bezier(.19,1,.22,1);
}

.sys-idx {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint); text-align: right;
  transition: color .3s ease;
}

.sys-glyph {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--glyph-bg); color: var(--ink);
  border: 1px solid var(--line);
  transition: color .3s ease, background .3s ease, border-color .3s ease, transform .32s cubic-bezier(.2,.7,.3,1);
}
.sys-glyph svg { width: 24px; height: 24px; }

.sys-body { min-width: 0; }
.sys-name {
  margin: 0;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.08rem, 1.5vw, 1.3rem);
  letter-spacing: -.018em; line-height: 1.15;
}
.sys-name .sfx { color: var(--ink-soft); font-weight: 600; transition: color .3s ease; }
.sys-name .path {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: .03em; color: var(--ink-faint);
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px;
  transition: color .3s ease, border-color .3s ease;
}
.sys-desc {
  margin-top: 3px;
  font-size: 12.8px; line-height: 1.45; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: break-word;
  transition: color .3s ease;
}

.sys-go {
  flex: none; width: 38px; height: 38px; border-radius: 999px;
  display: grid; place-items: center;
  border: 1.5px solid var(--ink); color: var(--ink);
  transition: background .3s ease, color .3s ease, border-color .3s ease, transform .32s cubic-bezier(.2,.7,.3,1);
}
.sys-go svg { width: 17px; height: 17px; }

/* Estado invertido (hover / foco por teclado) */
.sys:hover, .sys:focus-visible {
  transform: translateX(4px);
  border-color: var(--invert-bg);
  color: var(--invert-fg);
  box-shadow: var(--shadow-row);
  outline: none;
}
.sys:hover::before, .sys:focus-visible::before { transform: scaleX(1); }
.sys:hover .sys-idx, .sys:focus-visible .sys-idx { color: var(--invert-soft); }
.sys:hover .sys-name .sfx, .sys:focus-visible .sys-name .sfx,
.sys:hover .sys-desc, .sys:focus-visible .sys-desc { color: var(--invert-soft); }
.sys:hover .sys-name .path, .sys:focus-visible .sys-name .path {
  color: var(--invert-soft); border-color: rgba(255,255,255,.22);
}
.sys:hover .sys-glyph, .sys:focus-visible .sys-glyph {
  color: var(--invert-fg); background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.2); transform: scale(1.04);
}
.sys:hover .sys-go, .sys:focus-visible .sys-go {
  background: var(--invert-fg); color: var(--invert-bg);
  border-color: var(--invert-fg); transform: translateX(3px);
}
html[data-theme="dark"] .sys:hover .sys-glyph,
html[data-theme="dark"] .sys:focus-visible .sys-glyph { background: rgba(11,14,20,.12); border-color: rgba(11,14,20,.18); }
html[data-theme="dark"] .sys:hover .sys-name .path,
html[data-theme="dark"] .sys:focus-visible .sys-name .path { border-color: rgba(11,14,20,.2); }
.sys:focus-visible { box-shadow: 0 0 0 3px var(--focus), var(--shadow-row); }

/* Filas que no se pueden abrir: no invierten, se quedan tenues */
.sys--soon {
  border-style: dashed; border-color: var(--line);
  background: transparent; cursor: default;
}
.sys--soon::before { display: none; }
.sys--soon:hover { transform: none; color: var(--ink); border-color: var(--line); box-shadow: none; }
.sys--soon .sys-glyph { color: var(--ink-faint); }
.sys-chip {
  flex: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 11px; border: 1px dashed var(--line-strong); border-radius: 999px;
  white-space: nowrap;
}

/* ── Pie ──────────────────────────────────────────────────── */
.site-footer {
  position: relative; z-index: 1;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 20px clamp(20px, 5vw, 44px) 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-faint);
}

/* ── Animaciones de entrada ───────────────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); }
body.is-ready .reveal { animation: reveal .75s cubic-bezier(.19,1,.22,1) forwards; animation-delay: var(--d, 0s); }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ── Escritorio: hero pegado | índice que corre al lado ───── */
@media (min-width: 940px) {
  .page {
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    gap: clamp(40px, 5vw, 76px);
    padding-top: clamp(24px, 4vh, 44px);
  }
  /* El hero se queda quieto mientras el índice corre: así el
     listado nunca se esconde debajo de la píldora del header. */
  .intro { position: sticky; top: calc(var(--nav-h) + 12px); align-self: start; }
}

/* ── Responsivo ───────────────────────────────────────────── */
@media (max-width: 720px) {
  .sys { grid-template-columns: 42px minmax(0, 1fr); gap: 14px; padding: 13px 15px; }
  .sys-idx { display: none; }
  .sys-glyph { width: 42px; height: 42px; border-radius: 12px; }
  .sys-glyph svg { width: 23px; height: 23px; }
  .sys-go { display: none; }
  .sys-chip { grid-column: 2; justify-self: start; margin-top: 8px; }
  .sys:hover, .sys:focus-visible { transform: none; }
  .intro-notes .note { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
}

@media (max-width: 560px) {
  .brand-sep, .brand-sub { display: none; }
  .theme-toggle-label { display: none; }
  .theme-toggle { padding: 9px; }
  .nav-pill { max-width: 100%; }
  .sys-name .path { display: none; }
  .systems-head span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .shape { transform: rotate(var(--rot,0deg)) !important; }
}
