/* ====================================================================
   secciones.css
   Estilos compartidos para los paneles (nivel 2 y 3) que se abren
   encima de la home. Cada sección inyecta su fragmento HTML dentro
   de .ec-body. Las reglas específicas de cada plantilla (archivo de
   piezas, sub-cards, grid de Lab...) se irán añadiendo aquí cuando
   montemos cada sección.
   ==================================================================== */

/* ---------- Scrollbar global del documento ----------
   Mismo tono fino y discreto que el del panel. Aplica al html/body
   (Firefox: scrollbar-width/color; WebKit: ::-webkit-scrollbar).
   Mantenemos visible (no oculto) por accesibilidad y orientación. */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 10, 10, 0.15) transparent;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.15);
  border-radius: 4px;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 10, 10, 0.28);
}

/* ---------- Cabecera: banda de color ---------- */
.ec-header {
  background: var(--c);
  flex: 0 0 auto;
  min-height: 64px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  user-select: none;
}

.ec-titulo {
  font: inherit;
  color: inherit;
}

.ec-close,
.ec-home,
.ec-ruta-padre {
  background: none;
  border: none;
  padding: 6px 10px;
  margin: -6px -10px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  line-height: 1;
  transition: opacity .15s ease;
}

/* Botón casita con SVG inline. */
.ec-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ec-home-icono {
  width: 22px;
  height: 22px;
  display: block;
}

/* Ruta "SECCIÓN / SUB" en N3: el segmento padre es clickable
   (vuelve a N2), el actual es texto plano. */
.ec-ruta {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.ec-ruta-sep {
  opacity: 0.5;
}

.ec-ruta-actual {
  font: inherit;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ec-close:hover,
.ec-home:hover,
.ec-ruta-padre:hover {
  opacity: 0.6;
}

/* ---------- Cuerpo: blanco con scroll vertical propio.
   Aplica a todos los paneles (N2 y N2B): cualquier sección que
   tenga contenido más alto que el panel scrollea internamente. */
.ec-body {
  background: #fff;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 40px;
  font-family: "IBM Plex Sans Condensed", sans-serif;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  scrollbar-width: thin;
}

.ec-body::-webkit-scrollbar {
  width: 8px;
}
.ec-body::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.15);
  border-radius: 4px;
}

/* ---------- Estados: cargando / error ---------- */
.ec-loading,
.ec-error {
  padding: 80px 20px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.45;
}

.ec-error {
  color: #b2443a;
  opacity: 0.85;
}

/* ---------- Tipografía común del cuerpo del panel ----------
   Color NO se fija aquí a propósito: los headings heredan del
   .ec-body (que ya tiene color: var(--ink)) pero cada sección
   puede imponer el suyo sin pelear con especificidad. */
.ec-body h1,
.ec-body h2,
.ec-body h3 {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.ec-body h1 { font-size: 28px; margin-bottom: 16px; }
.ec-body h2 { font-size: 20px; margin: 28px 0 12px; }
.ec-body h3 {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 24px 0 8px;
}

.ec-body p {
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.ec-body a {
  color: inherit;
  text-decoration: underline;
}

.ec-body hr {
  border: none;
  border-top: 1px solid rgba(10, 10, 10, 0.1);
  margin: 32px 0;
}

.ec-body .btn,
.ec-body button {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 12px 18px;
  cursor: pointer;
}

/* ---------- Home UI cuando hay detalle abierto ---------- */
body.detalle-abierto {
  overflow: hidden;
}
/* Con un panel abierto, ocultamos completamente los hints del fondo
   (puntos + label HOME + DESLIZA con su flecha animada). Usamos
   display:none para detener también las animaciones CSS — opacity:0
   no basta porque las keyframes de la flecha y del idle re-asignan
   opacity y se ven parpadeando por debajo del panel. */
body.detalle-abierto .puntos,
body.detalle-abierto .desliza {
  display: none !important;
}

/* ====================================================================
   PLANTILLA · CONTENIDO
   Páginas con pieza destacada + texto + categorías + archivo de piezas.
   La usan: CUESTIONAR, MATRIZ, y los sub-destinos de EXPLORAR y LAB.
   ==================================================================== */

/* ---------- Placeholder para imágenes aún no cargadas ---------- */
.placeholder-img {
  background: linear-gradient(135deg, #e8e8e3, #f2f0e9);
  position: relative;
  overflow: hidden;
}
.placeholder-img::after {
  content: "img";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(10, 10, 10, 0.2);
  text-transform: uppercase;
}

/* ---------- Pieza destacada (hero) ---------- */
.pieza-destacada {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: stretch;
  margin-bottom: 40px;
}

/* En CUESTIONAR y MATRIZ el panel es portrait: apilamos pieza destacada
   en vertical (imagen arriba, texto debajo) y ajustamos grids a 2 cols. */
.block.cuestionar .pieza-destacada,
.block.matriz .pieza-destacada {
  grid-template-columns: 1fr;
  gap: 28px;
}
.block.cuestionar .categorias-grid,
.block.matriz .categorias-grid {
  grid-template-columns: 1fr;
  gap: 24px;
}
.block.cuestionar .archivo-grid,
.block.matriz .archivo-grid {
  grid-template-columns: repeat(2, 1fr);
}
.pieza-destacada-img {
  aspect-ratio: 1 / 1;
  min-height: 280px;
}
.pieza-destacada-texto {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 24px;
}
.pieza-destacada-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pieza-destacada-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}
.pieza-destacada-titulo {
  font-family: "IBM Plex Mono", monospace;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  color: var(--ink);
}
.pieza-destacada-desc {
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  margin: 0;
}
.pieza-destacada-cita {
  background: var(--c);
  color: #fff;
  padding: 18px 22px;
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.35;
}
.pieza-destacada-cta {
  align-self: flex-start;
  padding: 12px 20px;
  background: var(--ink);
  color: #fff;
  border: none;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ---------- Intro conceptual (texto centrado) ---------- */
.intro-concepto {
  max-width: 720px;
  margin: 32px auto 40px;
  text-align: center;
}
.intro-concepto p {
  font-size: 16px;
  line-height: 1.55;
  margin-bottom: 14px;
}

/* ---------- Grid de categorías (3 columnas) ---------- */
.categorias-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(10, 10, 10, 0.1);
  margin-bottom: 56px;
}
.categoria h3 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 12px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.categoria p {
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
}

/* ---------- Archivo de piezas ---------- */
.archivo {
  margin-top: 24px;
}
.archivo-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}
.archivo-header h2 {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}
.archivo-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(10, 10, 10, 0.5);
}
.archivo-filtros {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 8px;
}
.filtro {
  background: transparent;
  border: 1px solid rgba(10, 10, 10, 0.2);
  padding: 9px 16px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  color: var(--ink);
}
.filtro.activo {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.filtro:hover:not(.activo) {
  background: rgba(10, 10, 10, 0.04);
}
.archivo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.pieza-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
}
.pieza-card .pieza-img {
  aspect-ratio: 4 / 3;
}
.pieza-card .pieza-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c);
  text-transform: uppercase;
}

/* ============================================================
   REJILLA DE PIEZAS — compartida (LAB, archivo de CUESTIONAR…)
   Cards cuadradas con imagen al fondo y overlay (chip arriba al
   hover, título siempre abajo). Auto-fit responsive: cuanto más
   ancho el panel, más columnas; en móvil pasa a una sola columna
   apaisada para no comer toda la pantalla.

   Uso:
     <div class="piezas-rejilla">
       <article class="pieza" ...>
         <div class="pieza-img"><img …></div>
         <div class="pieza-overlay">
           <span class="pieza-tipo">…</span>     ← opcional
           <span class="pieza-titulo">…</span>
         </div>
       </article>
       …
     </div>

   La clase .pieza--atenuada se usa para filtros (gris + opacidad).
   ============================================================ */
.piezas-rejilla {
  display: grid;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 8px;
  margin: 0 auto;
}

.pieza {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #e8e4dc;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
  isolation: isolate;
  transition:
    opacity .35s ease,
    filter .35s ease,
    transform .4s cubic-bezier(.4, 0, .2, 1),
    box-shadow .35s ease;
}
.pieza:not(.pieza--atenuada):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(10, 10, 10, 0.28);
}

.pieza--atenuada {
  opacity: 0.22;
  filter: grayscale(100%);
  cursor: default;
}
.pieza--atenuada:hover .pieza-overlay { opacity: 0; }
.pieza--atenuada:hover .pieza-img img { transform: none; }

.piezas-rejilla .pieza-img {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
}
.piezas-rejilla .pieza-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .7s cubic-bezier(.4, 0, .2, 1);
}

.pieza-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  color: #fff;
  pointer-events: none;
  z-index: 1;
}

.pieza-tipo {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.92);
  color: #0a0a0a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s ease, transform .25s ease;
}

.pieza-titulo {
  font-family: "IBM Plex Sans Condensed", sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55);
}

/* Gradiente para legibilidad del título sobre cualquier imagen */
.pieza::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 35%,
    rgba(0, 0, 0, 0) 65%
  );
  opacity: 0.85;
  transition: opacity .3s ease;
  pointer-events: none;
  z-index: 0;
}
.pieza:not(.pieza--atenuada):hover::after        { opacity: 1; }
.pieza:not(.pieza--atenuada):hover .pieza-tipo   { opacity: 1; transform: translateY(0); }
.pieza:not(.pieza--atenuada):hover .pieza-img img{ transform: scale(1.05); }

/* MÓVIL: una sola columna en formato apaisado, sin radius para
   que las piezas peguen entre sí como un listado pleno. */
@media (max-width: 640px) {
  .piezas-rejilla {
    grid-template-columns: 1fr;
    gap: 4px;
    max-width: none;
  }
  .pieza {
    aspect-ratio: 16 / 9;
    border-radius: 0;
  }
  .pieza-titulo { font-size: 16px; }
}

/* ============================================================
   FILTROS · TABS — compartido (LAB y archivo de CUESTIONAR)
   Estilo editorial: texto plano, subrayado fino solo en el activo
   y al hover. Ningún botón con relleno.

   Uso:
     <nav class="filtros-tabs">
       <button class="filtro-tab filtro-tab--activo">Todas</button>
       <button class="filtro-tab">Otra</button>
       …
     </nav>

   Especificidad doble (.filtros-tabs .filtro-tab) para ganarle al
   selector global .ec-body button definido más arriba.
   ============================================================ */
.filtros-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.filtros-tabs .filtro-tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(10, 10, 10, 0.55);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 4px 12px;
  cursor: pointer;
  position: relative;
  transition: color .2s ease;
}
.filtros-tabs .filtro-tab:hover {
  color: var(--ink);
}

/* Subrayado fino debajo del botón. Reservado en transparente para
   que no haya saltos verticales al activar. */
.filtros-tabs .filtro-tab::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 2px;
  height: 1px;
  background: transparent;
  transition: background .2s ease, left .25s ease, right .25s ease;
}
.filtros-tabs .filtro-tab:hover::after {
  background: rgba(10, 10, 10, 0.25);
}
.filtros-tabs .filtro-tab--activo {
  color: var(--ink);
}
.filtros-tabs .filtro-tab--activo::after {
  background: var(--ink);
  left: 0;
  right: 0;
}

/* Foco accesible (teclado) */
.filtros-tabs .filtro-tab:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 2px;
}
