/* Identidad de i.teorema.org: blanco, negro y un acento naranja.
   Títulos en Bebas Neue; textos en monoespaciada liviana. */
:root {
  --fondo: #ffffff;
  --texto: #1a1a1a;
  --suave: #8a8a8a;
  --panel: #ebebeb;
  --naranja: #e8833a;
  --titulos: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --margen: clamp(1rem, 4vw, 4rem);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--fondo); }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--mono);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.85;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, .titulo {
  font-family: var(--titulos);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0 0 1rem;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: 1.9rem; margin-top: 2.5rem; }
h3 { font-size: 1.5rem; margin-top: 2rem; }

/* Cabecera */
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem var(--margen) 1rem;
}
.logo {
  font-family: var(--titulos);
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  line-height: 1;
  text-transform: uppercase;
}
.menu, .submenu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-family: var(--titulos);
  font-size: 1.35rem;
  text-transform: uppercase;
}
.submenu { justify-content: flex-end; padding: 0 var(--margen) 1rem; font-size: 1.15rem; }
.menu a, .submenu a { border-bottom: 2px solid transparent; }
.menu a:hover, .submenu a:hover, .activo { border-bottom-color: var(--naranja) !important; }

.contenido { padding: 2rem var(--margen) 4rem; }
.contenido.completo { padding-left: var(--margen); padding-right: var(--margen); }
.aviso { color: var(--suave); font-size: 0.85rem; }
.naranja { color: var(--naranja); }

/* Barra de título de galería: "EL RITO · ENSAYO >" */
.barra {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.barra .titulo { font-size: 2.2rem; margin: 0; }
.barra select {
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0.6rem 1rem;
  border: 0;
  background: var(--fondo);
  min-width: 14rem;
}

/* Muro: cuadrados sin separación, de borde a borde */
.muro {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.muro a { display: block; aspect-ratio: 1; overflow: hidden; background: var(--panel); }
.muro img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.muro a:hover img { opacity: 0.8; }
.muro a[hidden] { display: none; }

/* Mosaico: columnas que respetan la proporción de cada foto */
.mosaico { columns: 6 220px; column-gap: 16px; }
.mosaico a { display: block; break-inside: avoid; margin-bottom: 16px; background: var(--panel); }
.mosaico a:hover img { opacity: 0.85; }
.mosaico .pie { display: block; padding: 0.4rem 0.5rem; font-size: 0.75rem; color: var(--suave); background: var(--fondo); }

/* Ficha: imagen grande y panel lateral */
.ficha {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
  gap: clamp(1.5rem, 4vw, 5rem);
  align-items: start;
}
.ficha .imagen img { margin: 0 auto; max-height: 85vh; width: auto; }
.ficha .medios { margin-top: 1.5rem; display: grid; gap: 1rem; }
.panel { border: 1px solid var(--texto); position: sticky; top: 1.5rem; }
.panel .gris { background: var(--panel); padding: 2rem 2.25rem; }
.panel .blanco { padding: 2rem 2.25rem; }
.panel .codigo { font-family: var(--titulos); font-size: 1.9rem; color: #555; margin: 0 0 1.5rem; }
.panel dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.9rem; font-size: 0.9rem; }
.panel dt { color: var(--suave); }
.panel dd { margin: 0; color: var(--naranja); }
.panel details { margin-top: 1.25rem; }
.panel summary { cursor: pointer; list-style: none; font-family: var(--mono); font-weight: 400; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: ' +'; }
.panel details[open] summary::after { content: ' −'; }
.panel .testimonio { font-size: 0.9rem; margin-top: 0.75rem; }
.panel .ensayo { font-family: var(--mono); font-weight: 400; font-size: 1.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--naranja); }
.panel .navegar { display: flex; justify-content: space-between; margin-top: 2.5rem; font-size: 1.1rem; }

/* Texto de ensayo: texto a la izquierda, imágenes a la derecha */
.ensayo-texto {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 6rem);
  align-items: start;
}
.ensayo-texto .texto { max-width: 46rem; }
.ensayo-texto .texto p { margin: 0 0 1.5rem; }
.ensayo-texto .texto strong { font-weight: 500; }
.ensayo-texto .imagenes { display: grid; gap: 1.5rem; }
.ensayo-texto .imagenes img { width: 100%; height: auto; display: block; }
.con-video { display: block; text-decoration: none; }
.con-video span { display: block; margin-top: 0.4rem; color: var(--naranja); }
.ensayo-portada { margin: 0 0 clamp(2rem, 5vw, 4rem); }
.ensayo-portada img { width: 100%; max-height: 78vh; object-fit: cover; display: block; }

.listado { list-style: none; padding: 0; margin: 0; }
.listado li { padding: 0.35rem 0; }
.listado li::before { content: '+ '; color: var(--naranja); }

@media (max-width: 800px) {
  .cabecera { flex-direction: column; align-items: flex-start; padding-top: 1.5rem; }
  .submenu { justify-content: flex-start; }
  .ficha, .ensayo-texto { grid-template-columns: 1fr; }
  .panel { position: static; }
  .barra { flex-direction: column; }
  .muro { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Textos de FISURA: formato editorial de lectura larga */
.contenido.editorial { padding: 0 0 4rem; }
.lectura { --columna: 40rem; }
.lectura .portada { margin: 0; }
.lectura .portada img { width: 100%; height: min(78vh, 52rem); object-fit: cover; }
.lectura .encabezado { max-width: calc(var(--columna) + 16rem); margin: 3rem auto 3.5rem; padding: 0 var(--margen); }
.lectura .antetitulo { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--naranja); margin: 0 0 1rem; }
.lectura h1 { font-size: clamp(2.8rem, 7vw, 6rem); line-height: 0.95; margin: 0 0 1.25rem; }
.lectura .autor { font-size: 1rem; margin: 0; }
.lectura .cuerpo {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-weight: 300;
  font-size: 1.18rem;
  line-height: 1.75;
}
.lectura .bloque { max-width: var(--columna); margin: 0 auto; padding: 0 var(--margen); box-sizing: content-box; }
.lectura .bloque p { margin: 0 0 1.4em; }
.lectura .bloque:first-of-type p:first-child { font-size: 1.32rem; line-height: 1.6; }
.lectura .bloque em { font-style: italic; }
.lectura .bloque strong { font-weight: 500; }
.lectura .bloque h2, .lectura .bloque h3 { font-family: var(--titulos); font-weight: 400; margin: 2.5rem 0 1rem; }
.lectura .bloque blockquote { margin: 2rem 0; padding-left: 1.25rem; border-left: 2px solid var(--naranja); font-style: italic; }
.lectura.poema .cuerpo { font-size: 1.25rem; line-height: 1.9; }
.lectura.poema .bloque p { margin-bottom: 2.2em; }
.lectura figure { margin: 3.5rem 0 4rem; }
.lectura figure.ancha img { width: 100%; max-height: 90vh; object-fit: cover; }
.lectura figure.media { max-width: 62rem; margin-left: auto; margin-right: auto; padding: 0 var(--margen); }
.lectura figure.media img { width: 100%; }
.lectura figcaption { max-width: var(--columna); margin: 0.75rem auto 0; padding: 0 var(--margen); font-size: 0.75rem; color: var(--suave); }
.lectura figure.media figcaption { padding: 0; margin-left: 0; }
.lectura figcaption a { color: var(--naranja); }

/* Índice de textos */
.indice-textos { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 3rem; }
.indice-textos a { display: grid; grid-template-columns: minmax(10rem, 22rem) 1fr; gap: 2rem; align-items: center; }
.indice-textos img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--panel); }
.indice-textos h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin: 0 0 0.5rem; }
.indice-textos a:hover h2 { color: var(--naranja); }
@media (max-width: 700px) { .indice-textos a { grid-template-columns: 1fr; gap: 1rem; } }

/* Video incrustado (YouTube) a todo el ancho de la columna */
.video { position: relative; aspect-ratio: 16 / 9; margin: 0 0 2rem; background: var(--panel); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video.vertical { aspect-ratio: 9 / 16; max-width: 420px; }

/* Atlas de FISURA: paneles negros a la manera de Warburg */
.atlas-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-bottom: 3rem; }
.atlas-intro h1 { font-size: clamp(3rem, 8vw, 6rem); margin: 0 0 1rem; }
.atlas-intro div { max-width: 46rem; }
.atlas-indice { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 3rem 2.5rem; }
.atlas-indice a { display: flex; flex-direction: column; gap: 0.5rem; }
.atlas-num { font-family: var(--titulos); font-size: 1.9rem; line-height: 1; }
.atlas-indice a:hover .atlas-num { color: var(--naranja); }
.tablero { position: relative; aspect-ratio: 16 / 9; background: #111; overflow: hidden; }
.tablero.miniatura img { position: absolute; height: auto; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.tablero .pieza { position: absolute; padding: 0; border: 0; background: none; cursor: zoom-in; transition: opacity 0.2s; }
.tablero .pieza img { width: 100%; height: auto; display: block; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
.tablero .pieza.registro img { outline: 1px solid var(--naranja); outline-offset: 2px; }
.tablero .pieza:hover { opacity: 0.85; }
.tablero .etiqueta { position: absolute; left: 0; top: 100%; margin-top: 3px; font-size: 10px; color: #bdbdbd; white-space: nowrap; }
.lupa { position: absolute; inset: 0; background: rgba(8, 8, 8, 0.94); display: flex; align-items: center; justify-content: center; gap: 2rem; padding: 2rem; z-index: 10; }
.lupa[hidden] { display: none; }
.lupa img { max-width: 60%; max-height: 100%; object-fit: contain; }
.lupa-info { display: flex; flex-direction: column; gap: 0.6rem; color: #e8e8e4; font-size: 0.85rem; max-width: 18rem; }
.lupa-num { font-family: var(--titulos); font-size: 2.1rem; line-height: 1; }
.lupa-detalle { color: #bdbdbd; }
.lupa-info a { color: #f0a35e; }
.atlas-barra { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.75rem; margin-bottom: 1rem; font-size: 0.85rem; }
.boton { min-height: 44px; padding: 0 1.1rem; font: inherit; border: 1px solid var(--texto); background: var(--fondo); color: var(--texto); cursor: pointer; }
.boton.activo { background: var(--texto); color: var(--fondo); }
.boton.claro { align-self: flex-start; margin-top: 0.5rem; background: #fff; color: #1a1a1a; border-color: #fff; }
.boton.montaje { border-style: dashed; }
.atlas-pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; margin-top: 2.5rem; }
.atlas-texto { max-width: 46rem; }
.atlas-texto h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
.atlas-nav { display: flex; gap: 2rem; align-items: flex-end; font-family: var(--titulos); font-size: 1.4rem; }
.atlas-nav a:hover { color: var(--naranja); }
/* Modo montaje (solo local) */
.montando .tablero .pieza { cursor: move; outline: 1px dashed rgba(255, 255, 255, 0.35); }
.montando .tablero .pieza img { pointer-events: none; }
.tablero .asa { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: var(--naranja); cursor: nwse-resize; }
.tablero .quitar { position: absolute; right: -8px; top: -8px; width: 20px; height: 20px; line-height: 18px; text-align: center; background: #fff; color: #111; font-size: 14px; border-radius: 50%; cursor: pointer; }
.montaje-panel { margin-top: 1.5rem; padding: 1.25rem; border: 1px dashed var(--suave); }
.montaje-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.75rem 0 1rem; }
.montaje-acciones input { font: inherit; padding: 0.55rem 0.75rem; border: 1px solid var(--texto); margin-left: 0.4rem; width: 11rem; }
.montaje-bandeja { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; max-height: 22rem; overflow-y: auto; }
.montaje-bandeja button { padding: 0; border: 0; background: none; cursor: copy; font-size: 10px; color: var(--suave); text-align: left; }
.montaje-bandeja img { width: 100%; aspect-ratio: 1; object-fit: cover; }

/* Oráculo: el hexagrama dibujado con fotografías */
.oraculo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.tablero-hex { background: #111; aspect-ratio: 4 / 3; padding: 4% 7% 4% 9%; display: flex; flex-direction: column-reverse; gap: 2.4%; }
.tablero-hex .vacio-hex { margin: auto; color: #8a8a8a; font-size: 0.9rem; text-align: center; }
.tablero-hex .linea { flex: 1; display: flex; gap: 9%; position: relative; }
.tablero-hex .linea a { flex: 1; background-color: #2a2a2a; background-size: cover; background-position: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); transition: opacity 0.2s; }
.tablero-hex .linea a:hover { opacity: 0.85; }
.tablero-hex .linea.muta a { outline: 2px solid var(--naranja); outline-offset: 3px; }
.tablero-hex .num { position: absolute; left: -6%; top: 50%; transform: translateY(-50%); font-size: 11px; color: #8a8a8a; }
.tablero-hex .linea.muta .num { color: #f0a35e; }
.hex-num { font-family: var(--titulos); font-size: 4.5rem; line-height: 0.9; margin: 0; }
.hex-nombre { font-family: var(--titulos); font-size: 1.9rem; line-height: 1.05; margin: 0.4rem 0 0.9rem; }
@media (max-width: 800px) { .oraculo { grid-template-columns: 1fr; } }

/* Portada */
.portada { display: flex; flex-direction: column; align-items: center; gap: clamp(2.5rem, 6vw, 4.5rem); padding: clamp(1rem, 4vw, 3rem) 0 clamp(3rem, 8vw, 6rem); }
.portada-logo { width: min(520px, 82vw); height: auto; display: block; }
.portada-volumenes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(640px, 100%); border-top: 1px solid currentColor; }
.portada-volumenes a { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 1.5rem 1rem; text-decoration: none; color: inherit; }
.portada-volumenes a + a { border-left: 1px solid currentColor; }
.portada-volumenes .numeral { font-family: var(--titulos); font-size: clamp(2.5rem, 7vw, 4rem); line-height: 1; }
.portada-volumenes .nombre { font-family: var(--titulos); font-size: clamp(1.4rem, 3vw, 1.8rem); letter-spacing: 0.08em; }
.portada-volumenes a:hover .numeral, .portada-volumenes a:hover .nombre { color: var(--naranja); }
.cabecera.en-portada { justify-content: flex-end; }
