@font-face { font-family: "Geist"; src: url("fuentes/geist.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --fondo: #1e2427;        /* gris carbón */
  --estante: #12171a;
  --tinta: #e9ece8;
  --tinta-suave: #a9b2b5;
  --papel: #e6e3da;        /* canto de las páginas */
  --farola: #e9ece8;        /* acento: el mismo blanco roto que la tinta */
  --margen: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font: 400 clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem)/1.5 "Geist", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--farola); color: var(--fondo); }
:focus-visible { outline: 3px solid var(--farola); outline-offset: 4px; }

.barra { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px var(--margen); }
.izquierda { display: flex; align-items: center; gap: 10px; margin-left: -10px; }
.inicio { width: 44px; height: 44px; display: inline-grid; place-items: center; color: var(--tinta); }
.inicio svg { width: 24px; height: 24px; fill: currentColor; }
.inicio svg rect + rect { opacity: 0.6; }
.redes { display: flex; align-items: center; gap: 2px; padding-left: 10px; border-left: 2px solid #2f383c; }
.redes > a, .desplegable summary { width: 44px; height: 44px; display: inline-grid; place-items: center; color: var(--tinta); }
.redes svg { width: 22px; height: 22px; fill: currentColor; }
/* Desplegable de Instagram: tres cuentas */
.desplegable { position: relative; }
.desplegable summary { list-style: none; cursor: pointer; width: 56px; grid-auto-flow: column; gap: 3px; }
.desplegable summary::-webkit-details-marker { display: none; }
.desplegable .flecha { width: 10px; height: 10px; fill: none; transition: transform 150ms ease; }
.desplegable[open] .flecha { transform: rotate(180deg); }
.menu-cuentas {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; list-style: none; margin: 0; padding: 6px;
  min-width: 230px; background: #2a3236; box-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
  transform-origin: top left; transition: opacity 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}
@starting-style { .desplegable[open] .menu-cuentas { opacity: 0; transform: scale(0.97) translateY(-4px); } }
.menu-cuentas a { display: block; padding: 12px 14px; text-decoration: none; font-weight: 600; }
.menu-cuentas a:focus-visible { outline-offset: -3px; }
@media (hover: hover) and (pointer: fine) { .redes > a, .inicio, .desplegable summary { transition: opacity 150ms ease; } .redes > a:hover, .inicio:hover, .desplegable summary:hover { opacity: 0.65; } .menu-cuentas a:hover { background: #343d42; } .boton { transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 150ms ease; } .boton:hover { background: #ffffff; } }

.boton { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; background: var(--tinta); color: var(--fondo); font-weight: 700; text-decoration: none; transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
.boton:active { transform: scale(0.97); }

.presentacion { padding: clamp(8px, 2.5vh, 32px) var(--margen) clamp(16px, 3vh, 36px); }
h1 { font-size: clamp(2.25rem, 1rem + 3.6vw, 4.25rem); font-weight: 700; letter-spacing: -0.035em; line-height: 0.92; }
h1 span { display: block; font-weight: 400; color: var(--tinta-suave); }
.presentacion p { margin-top: 18px; font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.75rem); line-height: 1.25; max-width: 26ch; color: var(--tinta-suave); }

/* ---------- Estantería: una balda por colección, un lomo por serie ---------- */
.coleccion { --balda: clamp(220px, 48svh, 520px); padding: 0 var(--margen) clamp(8px, 2vh, 40px); }
.coleccion h2:not(.oculto) { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.coleccion-cabeza { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.coleccion-cabeza .series { color: var(--tinta-suave); font-size: 0.9375rem; }
.pestanas { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.pestanas button { font: inherit; font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem); font-weight: 700; letter-spacing: -0.02em; color: var(--tinta-suave);
  background: none; border: 0; padding: 6px 0; min-height: 44px; cursor: pointer; text-decoration: none; }
.pestanas button[aria-pressed="true"] { color: var(--tinta); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.3em; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mueble { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 34%); gap: clamp(24px, 4vw, 64px); align-items: end; }
.balda { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #45525a transparent; padding-top: 26px; }
.lomos { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; gap: 4px; width: max-content; border-bottom: 16px solid var(--estante); }
.lomo {
  appearance: none; border: 0; padding: 0; cursor: pointer; font: inherit;
  width: var(--grosor); height: calc(var(--f) * var(--balda)); background: var(--tela); color: var(--tela-tinta);
  display: flex; flex-direction: column; align-items: center;
  transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.lomo .franja { width: 100%; height: 22%; flex: none; overflow: hidden; background: #000; }
.lomo .franja img { width: 100%; height: 100%; object-fit: cover; }
.lomo .titulo {
  flex: 1; min-height: 0; writing-mode: vertical-rl; transform: rotate(180deg);
  font-weight: 700; font-size: clamp(1.05rem, 0.8rem + 0.9vw, 1.6rem); letter-spacing: -0.01em;
  padding: 14px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lomo .cuantas { flex: none; font-size: 0.9375rem; font-weight: 600; padding-bottom: 10px; }
.lomo[aria-pressed="true"] { transform: translateY(-22px); }
@media (hover: hover) and (pointer: fine) { .lomo:not([aria-pressed="true"]):hover { transform: translateY(-6px); } }

/* La portada del libro sacado */
.portada { display: grid; gap: 8px; align-content: end; padding-bottom: 16px; }
.portada .lamina { height: calc(var(--balda) * 0.78); overflow: hidden; background: #000; }
.portada .lamina img { width: 100%; height: 100%; object-fit: cover; }
.portada h3 { margin: 0; font-size: clamp(1.5rem, 1rem + 1.6vw, 2.5rem); font-weight: 700; letter-spacing: -0.035em; line-height: 0.95; }
.portada p { margin: 0; color: var(--tinta-suave); }
.abrir { justify-self: start; }
.aviso { padding: 0 var(--margen); color: var(--tinta-suave); }

@media (max-width: 760px) {
  .mueble { grid-template-columns: 1fr; }
  .coleccion { --balda: clamp(180px, 30svh, 300px); }
  .portada { grid-template-columns: 40% 1fr; grid-template-rows: 1fr auto auto auto; align-items: end; padding-bottom: 0; gap: 4px 14px; }
  .portada .lamina { grid-row: 1 / 5; height: auto; aspect-ratio: 4 / 5; }
  .portada h3 { grid-row: 2; } .portada p { grid-row: 3; } .portada .abrir { grid-row: 4; margin-top: 8px; }
}
/* ---------- El libro abierto ---------- */
.lector { height: calc(100svh - 80px); display: grid; grid-template-rows: auto 1fr; padding: 0 var(--margen) clamp(16px, 4vh, 40px); }
.lector-cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
.lector-cabeza h1 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); letter-spacing: -0.025em; line-height: 1; }
.enlace { font: inherit; color: var(--tinta); background: none; border: 0; padding: 10px 0; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
@media (hover: hover) and (pointer: fine) { .enlace:hover { text-decoration-color: var(--farola); text-decoration-thickness: 2px; } }
.escena { position: relative; min-height: 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.pagina { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pagina img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.zona { position: absolute; top: 0; bottom: 0; width: 30%; z-index: 2; background: none; border: 0; padding: 0; cursor: pointer; color: var(--tinta); display: flex; align-items: center; }
.zona svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.6; opacity: 0; transition: opacity 150ms ease; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.6)); }
.zona.ant { left: 0; justify-content: flex-start; cursor: w-resize; }
.zona.sig { right: 0; justify-content: flex-end; cursor: e-resize; }
@media (hover: hover) and (pointer: fine) { .zona:hover svg { opacity: 0.85; } }
.zona:focus-visible svg { opacity: 1; }
/* En pantallas táctiles las flechas se ven siempre, discretas: indican que se puede pasar página */
@media (hover: none) { .zona svg { opacity: 0.55; width: 28px; height: 28px; } }
.zona[disabled] { display: none; }
.pie-libro { display: flex; justify-content: space-between; gap: 16px; padding-top: 12px; color: var(--tinta-suave); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.pie-libro strong { color: var(--tinta); font-weight: 600; }
/* Portadilla y colofón */
.hoja { max-width: 40rem; text-align: left; justify-self: start; align-self: center; }
.hoja h2 { font-size: clamp(3rem, 1.5rem + 6vw, 6rem); font-weight: 700; letter-spacing: -0.04em; line-height: 0.9; }
.hoja p { margin-top: 16px; font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem); color: var(--tinta-suave); max-width: 32ch; }
.hoja .acciones { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; margin-top: 28px; }
/* Índice de páginas */
.indice { width: min(1100px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 0; padding: 20px; background: var(--fondo); color: var(--tinta); }
.indice::backdrop { background: rgb(10 13 15 / 0.8); }
.indice-cabeza { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.indice-cabeza h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
.indice-lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.indice-lista button { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: pointer; aspect-ratio: 1; overflow: hidden; position: relative; }
.indice-lista img { width: 100%; height: 100%; object-fit: cover; }
.indice-lista span { position: absolute; left: 6px; bottom: 4px; font-size: 0.8125rem; color: #fff; text-shadow: 0 1px 2px #000; }
.indice-lista button[aria-current="true"] { outline: 3px solid var(--farola); outline-offset: -3px; }

@media (max-width: 760px) {
  .lector { height: calc(100svh - 72px); padding-bottom: 10px; }
  .volver { display: none; }
  .lector-cabeza h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pie-libro { font-size: 0.875rem; }
}

@media (max-width: 400px) { .izquierda { gap: 4px; } .redes { padding-left: 4px; } .barra .boton { padding: 0 14px; } }
/* ---------- Ventana de contacto ---------- */
.contacto { width: min(520px, calc(100vw - 32px)); border: 0; padding: 0; background: #2a3236; color: var(--tinta);
  transition: opacity 200ms ease, transform 200ms cubic-bezier(0.23, 1, 0.32, 1); }
@starting-style { .contacto[open] { opacity: 0; transform: scale(0.97); } }
.contacto::backdrop { background: rgb(10 13 15 / 0.75); }
.contacto form { display: grid; gap: 16px; padding: 22px; }
.contacto-cabeza { display: flex; justify-content: space-between; align-items: center; }
.contacto h2 { font-size: 1.75rem; letter-spacing: -0.025em; }
.contacto label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9375rem; }
.contacto input, .contacto textarea { font: inherit; font-weight: 400; color: var(--tinta); caret-color: var(--tinta); background: var(--fondo);
  border: 1px solid #45525a; padding: 12px; min-height: 48px; width: 100%; }
.contacto textarea { resize: vertical; line-height: 1.5; }
.contacto input:focus-visible, .contacto textarea:focus-visible { outline: 2px solid var(--tinta); outline-offset: 0; border-color: var(--tinta); }
.contacto .trampa { position: absolute; left: -9999px; }
.contacto .estado { min-height: 1.5em; color: var(--tinta-suave); }
.contacto .estado.mal { color: var(--tinta); font-weight: 700; }
.contacto button[type="submit"] { justify-self: start; border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.contacto button[disabled] { opacity: 0.6; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .contacto { transition: opacity 200ms ease; }
  .menu-cuentas { transition: opacity 150ms ease; } .lomo, .boton { transition: none; } .lomo[aria-pressed="true"] { transform: none; outline: 3px solid var(--farola); outline-offset: -3px; } }
