/* JÁGR · jagrescritor.com — hoja de estilos compartida */

/* ——— Fuentes servidas desde la propia web (sin llamadas a Google Fonts) ——— */
@font-face { font-family: "Gloock"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/gloock-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/literata-normal-400_600.woff2") format("woff2"); }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/literata-italic-400.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/courierprime-normal-400.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/courierprime-normal-700.woff2") format("woff2"); }
@font-face { font-family: "Courier Prime"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/courierprime-italic-400.woff2") format("woff2"); }

/* ——— Tokens ——— */
:root {
  --paper: #EEF0F3;
  --sheet: #FBFBFA;
  --ink: #121826;
  --muted: #586173;
  --line: #C6CDD9;
  --line-soft: #DCE0E7;
  --cobalt: #1F3BD0;
  --cobalt-ink: #FFFFFF;
  --red: #C4342A;
  --shadow: 0 1px 0 rgba(18, 24, 38, .04), 0 22px 44px -26px rgba(18, 24, 38, .38);

  --monitor: #060913;
  --monitor-ink: #DCE3F4;
  --monitor-muted: #6E7A98;
  --monitor-glow: #9DB0FF;

  --f-display: "Gloock", "Bodoni 72", Didot, Georgia, serif;
  --f-body: "Literata", Georgia, "Times New Roman", serif;
  --f-mono: "Courier Prime", "Courier New", ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1180px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B1020;
    --sheet: #131B31;
    --ink: #E7EAF3;
    --muted: #9AA3B8;
    --line: #2C3654;
    --line-soft: #1E2742;
    --cobalt: #8FA3FF;
    --cobalt-ink: #0B1020;
    --red: #FF7C6D;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 22px 44px -26px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0B1020;
  --sheet: #131B31;
  --ink: #E7EAF3;
  --muted: #9AA3B8;
  --line: #2C3654;
  --line-soft: #1E2742;
  --cobalt: #8FA3FF;
  --cobalt-ink: #0B1020;
  --red: #FF7C6D;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 22px 44px -26px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ——— Base ——— */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--cobalt); color: var(--cobalt-ink); padding: .5rem .9rem; font-family: var(--f-mono); }
.skip:focus { left: 16px; }
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(80px, 11vw, 150px); scroll-margin-top: 64px; }

.label {
  font-family: var(--f-mono);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.h2 { font-size: clamp(2.5rem, 5.6vw, 4.5rem); line-height: 1.02; letter-spacing: -.005em; }
.lede { font-size: 1.1875rem; line-height: 1.6; max-width: 58ch; color: var(--muted); }
.head { display: grid; gap: 18px; }

.btn {
  display: inline-flex; align-items: center; gap: .6em;
  font-family: var(--f-mono); font-weight: 700; font-size: .82rem;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  padding: .95rem 1.25rem; border-radius: 2px; border: 1.5px solid transparent;
  transition: transform .2s ease, background-color .2s ease, color .2s ease;
  cursor: pointer;
}
.btn svg { width: 1em; height: 1em; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--cobalt); color: var(--cobalt-ink); }
.btn--ghost { border-color: currentColor; background: transparent; color: var(--ink); }
.link-quiet { font-family: var(--f-mono); font-size: .8rem; letter-spacing: .04em; color: var(--muted); text-underline-offset: 3px; }
.link-quiet:hover { color: var(--cobalt); }

/* ——— Nav ——— */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-inline: var(--gutter);
  color: var(--monitor-ink);
  transition: background-color .35s ease, color .35s ease, border-color .35s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-solid {
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--ink);
  border-bottom-color: var(--line-soft);
}
.nav-mark { font-family: var(--f-display); font-size: 1.45rem; text-decoration: none; letter-spacing: .02em; }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.2vw, 30px); list-style: none; margin: 0; padding: 0; }
.nav-links a { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; opacity: .85; }
.nav-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
[hidden] { display: none !important; }
.nav-links { margin-left: auto; }
.nav-links a[aria-current="true"] { opacity: 1; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--cobalt); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-btn { display: inline-flex; align-items: center; gap: .5em; font-family: var(--f-mono); font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: .5rem .8rem; border: 1.5px solid currentColor; background: transparent; color: inherit; cursor: pointer; border-radius: 2px; }
.nav-btn--solid { background: var(--cobalt); border-color: var(--cobalt); color: var(--cobalt-ink); }
.nav-btn svg { width: .8em; height: .8em; transition: transform .2s ease; }
.nav-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-menu-btn { display: none; }
@media (max-width: 959px) { .nav-links { display: none; } .nav-menu-btn { display: inline-flex; } .nav-actions { margin-left: auto; } }
.nav.is-menu { background: var(--paper); color: var(--ink); border-bottom-color: var(--line-soft); }
.buy-menu { position: relative; }
.buy-panel { position: absolute; right: 0; top: calc(100% + 10px); width: min(320px, calc(100vw - 32px)); display: grid; gap: 4px; padding: 14px; background: var(--sheet); color: var(--ink); border: 1px solid var(--line-soft); box-shadow: var(--shadow); }
@media (max-width: 859px) { .buy-panel { position: fixed; right: 16px; top: 64px; } }
.buy-panel .label { margin-bottom: 6px; }
.buy-opt { display: flex; align-items: center; gap: 12px; padding: 8px; text-decoration: none; border-radius: 2px; }
.buy-opt:hover, .buy-opt:focus-visible { background: var(--paper); }
.buy-opt img { width: 40px; height: 58px; object-fit: cover; flex: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.buy-opt span { display: grid; gap: 1px; }
.buy-opt b { font-weight: 600; font-size: .98rem; }
.buy-opt small { font-family: var(--f-mono); font-size: .74rem; color: var(--muted); }
.buy-opt--en { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 12px; border-radius: 0; }
.buy-opt--en span { padding-left: 52px; }
.menu { position: fixed; inset: 0; z-index: 45; background: var(--paper); color: var(--ink); overflow-y: auto; padding-block: 92px 40px; padding-inline: var(--gutter); }
.menu ol { list-style: none; margin: 18px 0 0; padding: 0; display: grid; }
.menu li a { display: grid; gap: 2px; padding-block: 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; }
.menu li a span { font-family: var(--f-display); font-size: clamp(1.9rem, 8vw, 2.6rem); line-height: 1.05; }
.menu li a em { font-style: normal; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .04em; color: var(--muted); }
.menu li a[aria-current="true"] span { color: var(--cobalt); }
body.menu-open { overflow: hidden; }

/* ——— El hilo (una sola línea) ——— */
.thread {
  position: fixed; top: 0; bottom: 0; z-index: 5; width: 2px;
  left: max(6px, calc((100vw - var(--max)) / 2 - 18px));
  pointer-events: none; opacity: 0; transition: opacity .5s ease;
}
.thread.is-on { opacity: 1; }
.thread::before { content: ""; position: absolute; inset: 0; background: var(--line-soft); }
.thread-fill { position: absolute; inset: 0; background: var(--cobalt); transform-origin: top; transform: scaleY(var(--p, 0)); }
.thread-nib {
  position: absolute; left: 50%; top: calc(var(--p, 0) * 100%);
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--cobalt); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cobalt) 22%, transparent);
}

/* ——— Hero: el monitor ——— */
.hero {
  position: relative; overflow: hidden;
  background: var(--monitor); color: var(--monitor-ink);
  padding-block: 112px 0;
  background-image:
    linear-gradient(rgba(157, 176, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 176, 255, .045) 1px, transparent 1px);
  background-size: 28px 28px;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 36px; align-items: end; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, .8fr); gap: 56px; } }
.readouts { display: flex; flex-wrap: wrap; gap: 10px 28px; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--monitor-muted); }
.readouts b { color: var(--monitor-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.beat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--monitor-glow); margin-right: 8px; vertical-align: 1px; opacity: .45; }
.beat-dot.is-beat { animation: beat .5s ease-out; }
@keyframes beat { 0% { opacity: 1; transform: scale(1.6); box-shadow: 0 0 12px var(--monitor-glow); } 100% { opacity: .45; transform: scale(1); } }
.hero h1 { font-size: clamp(3rem, 7.6vw, 6.6rem); line-height: .96; letter-spacing: -.012em; margin-top: 28px; max-width: 12ch; }
.hero h1 span { color: var(--monitor-glow); }
.hero-by { margin-top: 26px; font-family: var(--f-mono); font-size: .9rem; letter-spacing: .06em; color: var(--monitor-ink); }
.hero-by b { font-weight: 700; color: var(--monitor-glow); }
.hero-lede { margin-top: 14px; max-width: 44ch; font-size: 1.125rem; color: #B4BDD3; }
.hero-cta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn--primary { background: var(--monitor-glow); color: var(--monitor); }
.hero .btn--ghost { color: var(--monitor-ink); }
.sig-hero { width: 100%; max-width: 250px; height: auto; justify-self: end; display: block; }
@media (max-width: 859px) { .sig-hero { max-width: 132px; justify-self: start; margin-top: -8px; } }
.sig-pen { stroke-dasharray: 1; stroke-dashoffset: 0; }
.sig-fill { opacity: 1; }
.hero.is-armed .sig-pen { stroke-dashoffset: 1; }
.hero.is-armed .sig-fill { opacity: 0; }
.hero.is-awake .sig-pen { stroke-dashoffset: 0; transition: stroke-dashoffset 3.4s cubic-bezier(.5, .05, .35, 1); }
.hero.is-signed .sig-fill { opacity: 1; transition: opacity .9s ease; }
.ecg-band { position: relative; margin-top: clamp(28px, 5vw, 56px); border-top: 1px solid rgba(157, 176, 255, .12); }
.ecg { display: block; width: 100%; height: clamp(90px, 12vw, 130px); }
.ecg-scale { position: absolute; right: var(--gutter); top: 10px; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .12em; color: var(--monitor-muted); }

/* ——— Libros ——— */
.books-head { display: grid; gap: 22px; }
.book { display: grid; gap: clamp(28px, 4vw, 56px); margin-top: clamp(56px, 8vw, 96px);
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "cover" "info" "doc"; }
@media (min-width: 720px) {
  .book { grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "cover info" "doc doc"; }
}
@media (min-width: 1120px) {
  .book { grid-template-columns: 230px minmax(0, 1fr) minmax(0, 1.12fr); grid-template-areas: "cover info doc"; align-items: start; }
  .book--alt { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr) 230px; grid-template-areas: "doc info cover"; }
}
.book-cover { grid-area: cover; max-width: 230px; }
.book-info { grid-area: info; display: grid; gap: 18px; align-content: start; }
.book-doc { grid-area: doc; }

.cover-frame {
  position: relative; aspect-ratio: 2 / 3; background: var(--sheet); border: 1px solid var(--line-soft);
  display: grid; place-items: center; text-align: center; padding: 16px;
  box-shadow: var(--shadow), 10px 14px 0 -2px color-mix(in srgb, var(--cobalt) 14%, transparent);
  transform: perspective(900px) rotateY(-9deg);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.cover-frame:hover { transform: perspective(900px) rotateY(0deg) translateY(-4px); }
.cover-frame .fallback { font-family: var(--f-display); font-size: 1.35rem; line-height: 1.1; color: var(--muted); }
.cover-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-frame::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.12) 60%, transparent); pointer-events: none; }
.rating { margin-top: 22px; font-family: var(--f-mono); font-size: .8rem; letter-spacing: .04em; color: var(--muted); display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.rating strong { font-size: 1.05rem; color: var(--ink); letter-spacing: .02em; }
.rating .stars { color: var(--cobalt); letter-spacing: .12em; }

.book-title { font-size: clamp(2.2rem, 4vw, 3.1rem); line-height: 1.02; }
.book-sub { font-style: italic; color: var(--muted); margin-top: -8px; }
.book-info p.syn { max-width: 60ch; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 18px; margin: 4px 0 0; font-size: .95rem; }
.facts dt { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: .2rem; }
.facts dd { margin: 0; }
.buy { display: grid; gap: 10px; justify-items: start; margin-top: 6px; }
.buy-formats { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
.buy-formats b { color: var(--ink); }

.doc {
  container-type: inline-size;
  position: relative; background: var(--sheet); border: 1px solid var(--line-soft);
  box-shadow: var(--shadow); padding: clamp(22px, 3.4vw, 38px); border-radius: 2px;
}
/* Informe de alta */
.chart-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-family: var(--f-mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.chart-top b { font-weight: 700; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding-block: .72rem; border-bottom: 1px dashed var(--line); }
.field:last-of-type { border-bottom: 0; }
.field dt { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.field dd { margin: 0; font-size: .98rem; line-height: 1.5; }
@container (min-width: 420px) { .field { grid-template-columns: 8.4rem minmax(0, 1fr); gap: 16px; } .field dt { padding-top: .22rem; } }
.dd-stamp { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; }
.stamp {
  display: inline-block; flex: none;
  font-family: var(--f-mono); font-weight: 700; font-size: 1.05rem; letter-spacing: .24em; line-height: 1.4;
  color: var(--cobalt); border: 3px double var(--cobalt); padding: .25rem .7rem .2rem .9rem;
  --rot: -9deg; transform: rotate(var(--rot)); opacity: .88; pointer-events: none;
}
/* Manuscrito */
.ms { font-family: var(--f-mono); font-size: .98rem; line-height: 2; }
.ms-head { display: flex; justify-content: flex-end; font-size: .78rem; letter-spacing: .06em; color: var(--muted); margin-bottom: 18px; }
.ms-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 20px; margin-bottom: 10px; }
.ms-row p { text-indent: 2.2em; }
@container (min-width: 460px) { .ms-row { grid-template-columns: minmax(0, 1fr) 9.5rem; } }
.fix del { text-decoration: none; color: var(--muted); background: linear-gradient(var(--red), var(--red)) 0 58% / 100% 2px no-repeat; }
.fix ins { text-decoration: none; color: var(--red); font-family: var(--f-body); font-style: italic; font-size: .95em; margin-left: .25em; }
.fix ins::before { content: "‸"; margin-right: .1em; font-style: normal; }
.note { font-family: var(--f-body); font-style: italic; font-size: .88rem; line-height: 1.4; color: var(--red); align-self: start; padding-left: 10px; border-left: 1.5px solid var(--red); transform: rotate(-1.5deg); margin-top: .5rem; }
.ms-sign { margin-top: 16px; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.interlude { margin-top: clamp(56px, 8vw, 96px); font-family: var(--f-mono); font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 14px; }
.interlude::before { content: ""; width: 44px; height: 1.5px; background: var(--cobalt); }

/* ——— Autor ——— */
.author { display: grid; gap: clamp(36px, 5vw, 72px); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .author { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); } }
.portrait { position: relative; margin: 0; max-width: 520px; align-self: start; }
@media (min-width: 900px) { .portrait { position: sticky; top: 96px; } }
.portrait-photo { position: relative; }
.portrait-photo::before { content: ""; position: absolute; inset: 14px -14px -14px 14px; border: 1.5px solid var(--cobalt); pointer-events: none; }
.portrait-photo img { position: relative; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; box-shadow: var(--shadow); }
.portrait-sig { position: absolute; right: 5%; bottom: 4%; width: 17%; aspect-ratio: 544 / 861; background: #fff; opacity: .92;
  -webkit-mask: url("firma.png?v=2") center / contain no-repeat; mask: url("firma.png?v=2") center / contain no-repeat; }
.portrait figcaption { margin-top: 30px; }
.author-text { display: grid; gap: 20px; }
.author-text .h2 small { display: block; margin-top: 10px; font-family: var(--f-mono); font-size: .9rem; letter-spacing: .1em; color: var(--cobalt); }
.author-text p { max-width: 60ch; }
/* Ficha de autor: ficha de catálogo de biblioteca */
.card { margin-top: 14px; padding-bottom: 50px; }
.card .chart-top { border-bottom-color: var(--red); }
.card-name { font-family: var(--f-mono); font-weight: 700; font-size: 1.05rem; padding-block: .8rem .3rem; }
.card-name span { font-weight: 400; color: var(--muted); }
.card .field { border-bottom: 1px solid color-mix(in srgb, var(--cobalt) 24%, transparent); }
.card .field dd a { color: var(--cobalt); text-underline-offset: 3px; overflow-wrap: anywhere; }
.card::after { content: ""; position: absolute; left: 50%; bottom: 16px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .28); }

/* ——— Lectores (pulso) ——— */
.readers { display: grid; gap: clamp(28px, 4vw, 56px); grid-template-columns: minmax(0, 1fr); border-block: 1px solid var(--line); padding-block: clamp(36px, 5vw, 56px); margin-top: 8px; }
@media (min-width: 960px) { .readers { grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); } }
.readers-side { display: grid; gap: 18px; align-content: start; }
.stats { display: grid; gap: 10px; font-family: var(--f-mono); font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats div { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.stats b { font-size: 1rem; color: var(--ink); }
.stats .stars { color: var(--cobalt); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .06em; padding: .45rem .75rem; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; border-radius: 2px; }
.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--sheet); }
.pulse { position: relative; }
.pulse-strip { position: relative; height: 64px; }
.pulse-strip svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pulse-strip path { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pulse-base { stroke: var(--line); stroke-width: 1.5; }
.pulse-done { stroke: var(--cobalt); stroke-width: 2; }
.pulse-timer { stroke: var(--cobalt); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.pulse-timer.run { animation: pulse-draw var(--dwell, 7s) linear forwards; }
.pulse.is-paused .pulse-timer { animation-play-state: paused; }
@keyframes pulse-draw { to { stroke-dashoffset: 0; } }
.pulse-dot { position: absolute; top: 10%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; }
.pulse-dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line); transition: transform .2s ease, background-color .2s ease; }
.pulse-dot.is-past::after { border-color: var(--cobalt); }
.pulse-dot[aria-current="true"]::after { background: var(--cobalt); border-color: var(--cobalt); transform: scale(1.35); box-shadow: 0 0 0 5px color-mix(in srgb, var(--cobalt) 20%, transparent); }
.quote { margin: 22px 0 0; min-height: 10.5rem; display: grid; gap: 14px; align-content: start; transition: opacity .22s ease, transform .22s ease; }
.quote.is-out { opacity: 0; transform: translateY(6px); }
.quote-text { font-size: clamp(1.3rem, 2.4vw, 1.7rem); line-height: 1.35; font-style: italic; max-width: 40ch; text-wrap: pretty; }
.quote-text::before { content: "«"; color: var(--cobalt); font-style: normal; margin-right: .08em; }
.quote-text::after { content: "»"; color: var(--cobalt); font-style: normal; margin-left: .08em; }
.quote-meta { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.quote-meta b { color: var(--ink); }
.quote-meta .stars { color: var(--cobalt); letter-spacing: .1em; }
.pulse-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-family: var(--f-mono); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctrl { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; border-radius: 2px; }
.ctrl:hover { border-color: var(--ink); }
.ctrl svg { width: 14px; height: 14px; }
.pulse-count { margin-left: 6px; }

/* ——— Vídeos ——— */
.videos { display: grid; gap: clamp(24px, 3vw, 36px); grid-template-columns: minmax(0, 1fr); margin-top: clamp(36px, 5vw, 56px); }
@media (min-width: 900px) { .videos { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }
.video-main { display: grid; gap: 18px; align-content: start; }
.video-list { display: grid; gap: 22px; align-content: start; }
.video-item { display: grid; gap: 10px; }
@media (min-width: 560px) and (max-width: 899px) { .video-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.vid, .vid-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: #05070d; overflow: hidden; border: 0; }
.vid img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease, opacity .3s ease; opacity: .9; }
.vid:hover img { transform: scale(1.03); opacity: 1; }
.vid .play { position: absolute; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: #fff; }
.vid .play i { width: 44px; height: 44px; border-radius: 50%; background: var(--cobalt); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.vid .play svg { width: 14px; height: 14px; margin-left: 3px; fill: var(--cobalt-ink); }
.vid .dur { position: absolute; right: 12px; top: 12px; font-family: var(--f-mono); font-size: .72rem; color: #fff; background: rgba(6, 9, 19, .72); padding: .15rem .45rem; font-variant-numeric: tabular-nums; }
.video-title { font-weight: 600; font-size: 1rem; line-height: 1.35; }
.video-meta { font-family: var(--f-mono); font-size: .76rem; color: var(--muted); }
.pull { font-family: var(--f-display); font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.12; max-width: 24ch; }
.pull span { color: var(--cobalt); }

/* ——— Tercer libro ——— */
.next { display: grid; gap: clamp(28px, 4vw, 56px); grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 900px) { .next { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.next-text { display: grid; gap: 20px; }
.next-note { font-family: var(--f-mono); font-size: .85rem; color: var(--muted); }
.stamp--red { color: var(--red); border-color: var(--red); --rot: 7deg; }
.case .fix ins { font-size: 1.05em; }
.redacted { color: var(--ink); letter-spacing: -.05em; opacity: .85; user-select: none; }
.typed { font-family: var(--f-mono); }
.caret { display: inline-block; width: .6em; height: 1.15em; background: var(--cobalt); vertical-align: -.2em; margin-left: 2px; animation: caret 1.05s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.blank-quote { margin-top: 34px; font-family: var(--f-body); font-style: italic; color: var(--muted); font-size: .95rem; }
.follow { display: flex; flex-wrap: wrap; gap: 10px; }

/* ——— Final ——— */
.end { padding-block: clamp(80px, 10vw, 130px) 40px; border-top: 1px solid var(--line); }
.end-grid { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 820px) { .end-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.end h2 { font-size: clamp(3rem, 8vw, 6.5rem); line-height: .95; }
.contact { margin-top: 26px; color: var(--muted); max-width: 46ch; }
.mail { display: inline-block; margin-top: 6px; font-family: var(--f-display); font-size: clamp(1.4rem, 3.4vw, 2.1rem); color: var(--cobalt); text-decoration: none; overflow-wrap: anywhere; background: linear-gradient(var(--cobalt), var(--cobalt)) 0 100% / 0 2px no-repeat; transition: background-size .35s ease; }
.mail:hover, .mail:focus-visible { background-size: 100% 2px; }
.socials { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 30px; list-style: none; padding: 0; }
.socials a { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-mono); font-size: .88rem; }
.socials a:hover { color: var(--cobalt); }
.socials svg { width: 22px; height: 22px; flex: none; }
.sig-end { display: block; width: min(200px, 44vw); height: auto; aspect-ratio: 544 / 861; justify-self: end; }
@media (max-width: 819px) { .sig-end { justify-self: start; width: 120px; } }
.foot { margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; font-family: var(--f-mono); font-size: .74rem; color: var(--muted); line-height: 1.6; }
.foot p { max-width: 70ch; }

/* ——— Portada: los libros a la vista ——— */
.hero-books { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 860px) {
  .hero-books { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .hero-books .hb { padding-right: 12px; }
  .hero-books .hb b { font-size: .98rem; line-height: 1.25; }
}
.hb { display: flex; align-items: center; gap: 14px; padding: 8px 18px 8px 8px; border: 1px solid rgba(157, 176, 255, .28); background: rgba(157, 176, 255, .06); text-decoration: none; border-radius: 2px; transition: border-color .2s ease, background-color .2s ease, transform .2s ease; }
.hb:hover { border-color: var(--monitor-glow); background: rgba(157, 176, 255, .12); transform: translateY(-2px); }
.hb img { width: 44px; height: 64px; object-fit: cover; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.hb span { display: grid; gap: 2px; }
.hb small { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--monitor-muted); }
.hb b { font-weight: 600; font-size: 1.05rem; color: var(--monitor-ink); }
.hero-link { display: inline-block; margin-top: 18px; font-family: var(--f-mono); font-size: .82rem; color: var(--monitor-muted); text-underline-offset: 4px; }
.hero-link:hover { color: var(--monitor-ink); }
.book { scroll-margin-top: 84px; }

/* ——— Portadas que se pueden pulsar ——— */
.cover-link { display: block; text-decoration: none; }
.cover-hint { position: absolute; left: 0; right: 0; bottom: 0; padding: .55rem; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; text-align: center; color: #fff; background: rgba(6, 9, 19, .8); opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
.cover-link:hover .cover-hint, .cover-link:focus-visible .cover-hint { opacity: 1; transform: none; }

/* ——— El hilo como índice ——— */
.thread-node { position: absolute; left: 50%; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line); pointer-events: auto; transition: background-color .25s ease, border-color .25s ease, transform .25s ease; }
.thread:not(.is-on) .thread-node { pointer-events: none; }
.thread-node.is-past { border-color: var(--cobalt); }
.thread-node[aria-current="true"] { background: var(--cobalt); border-color: var(--cobalt); transform: scale(1.2); }
.thread-node span { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: .3rem .55rem; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.thread-node:hover span { opacity: 1; }
@media (max-width: 719px) { .thread-node { display: none; } }

/* ——— Documentos que cobran vida al llegar ——— */
.doc.armed .field { opacity: .25; transform: translateY(8px); }
.doc.armed .stamp { opacity: .1; transform: rotate(var(--rot)) scale(2); }
.doc.armed .fix del { background-size: 0 2px; }
.doc.armed .fix ins { opacity: .2; }
.doc.armed .note { opacity: .2; }
.doc.live .field { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; transition-delay: calc(var(--i, 0) * 110ms); }
.doc.live .stamp { opacity: .88; transform: rotate(var(--rot)) scale(1); transition: transform .38s cubic-bezier(.3, 1.5, .5, 1), opacity .2s ease; transition-delay: var(--stamp-delay, .9s); }
.doc.live .fix del { background-size: 100% 2px; transition: background-size .5s ease; transition-delay: var(--d, 0s); }
.doc.live .fix ins { opacity: 1; transition: opacity .5s ease; transition-delay: calc(var(--d, 0s) + .5s); }
.doc.live .note { opacity: 1; transition: opacity .6s ease; transition-delay: calc(var(--d, 0s) + .8s); }

/* ——— La ruta y la firma final se dibujan ——— */
.sig-end.armed .sig-pen { stroke-dashoffset: 1; }
.sig-end.armed .sig-fill { opacity: 0; }
.sig-end.live .sig-pen { stroke-dashoffset: 0; transition: stroke-dashoffset 2.8s cubic-bezier(.5, .05, .35, 1); }
.sig-end.live .sig-fill { opacity: 1; transition: opacity .8s ease 2.9s; }

/* ——— La obra en orden: nº 1, nº 2 y nº 3 ——— */
.shelf { list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shelf li { position: relative; padding: 30px 24px 0 0; }
.shelf li::before { content: ""; position: absolute; left: 0; top: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--cobalt); }
.shelf li::after { content: ""; position: absolute; left: 14px; right: 0; top: 6px; height: 2px; background: var(--cobalt); }
.shelf li:nth-child(2)::after { background: repeating-linear-gradient(90deg, var(--red) 0 6px, transparent 6px 12px); }
.shelf li:last-child::after { display: none; }
.shelf li.is-wip::before { background: var(--paper); border: 2px solid var(--red); animation: wip 1.8s ease-in-out infinite; }
@keyframes wip { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--red) 22%, transparent); } }
.shelf a { display: grid; gap: 4px; text-decoration: none; }
.shelf-n { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.shelf b { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.1; transition: color .2s ease; }
.shelf a:hover b { color: var(--cobalt); }
.shelf-state { font-family: var(--f-mono); font-size: .78rem; color: var(--cobalt); }
.shelf .is-wip b { color: var(--muted); }
.shelf .is-wip .shelf-state { color: var(--red); }
@media (max-width: 639px) {
  .shelf { grid-template-columns: minmax(0, 1fr); }
  .shelf li { padding: 0 0 22px 32px; }
  .shelf li::before { top: 4px; }
  .shelf li::after { left: 6px; right: auto; top: 22px; width: 2px; height: calc(100% - 20px); }
  .shelf li:nth-child(2)::after { background: repeating-linear-gradient(180deg, var(--red) 0 6px, transparent 6px 12px); }
}
.hb--wip { border-style: dashed; background: transparent; }
.hb-q { width: 44px; height: 64px; display: grid; place-items: center; border: 1.5px dashed rgba(157, 176, 255, .45); font-family: var(--f-display); font-size: 1.8rem; color: var(--monitor-glow); }
.hb--wip small { color: #FF9A8E; }
.cover-wip { border: 2px dashed var(--line); background: var(--sheet); box-shadow: none; align-content: center; gap: 10px; transform: none; }
.cover-wip:hover { transform: none; }
.cover-wip::after { display: none; }
.wip-n { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wip-q { font-family: var(--f-display); font-size: clamp(4.5rem, 9vw, 6.5rem); line-height: 1; color: var(--cobalt); }
.wip-state { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.wip-state .caret { width: .5em; height: 1em; background: var(--red); }
.wip-tag { font-family: var(--f-body); font-style: italic; font-size: .5em; color: var(--muted); }
.label--wip { color: var(--red); }

/* ——— El escritorio: lo publicado vive en papel; lo que aún se escribe, en la mesa del autor de noche ——— */
.desk {
  --paper: #0B1020; --sheet: #131B31; --ink: #E7EAF3; --muted: #9AA3B8; --line: #2C3654; --line-soft: #1E2742;
  --cobalt: #8FA3FF; --cobalt-ink: #0B1020; --red: #FF7C6D;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 22px 44px -26px rgba(0, 0, 0, .85);
  color-scheme: dark;
  background-color: var(--monitor); color: var(--ink);
  background-image:
    radial-gradient(ellipse 55% 65% at 80% 28%, rgba(157, 176, 255, .11), transparent 70%),
    linear-gradient(rgba(157, 176, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 176, 255, .035) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  border-block: 1px solid rgba(157, 176, 255, .12);
}

/* ——— Lectores: pista ——— */
.pulse-hint { margin-bottom: 6px; font-family: var(--f-mono); font-size: .76rem; letter-spacing: .03em; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .cover-frame, .cover-frame:hover { transform: none; }
  .caret { animation: none; }
}

/* ——— SEO: el nombre va dentro del H1 con el mismo aspecto de antes ——— */
.hero h1 .hero-by { display: block; margin-top: 26px; font-family: var(--f-mono); font-size: .9rem; line-height: 1.5; letter-spacing: .06em; color: var(--monitor-ink); }
.hero h1 .hero-by b { font-weight: 700; color: var(--monitor-glow); }

/* ——— Opiniones: la lista completa vive en el HTML; con JavaScript se muestra el pulso ——— */
.review-list { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; display: grid; gap: 0 28px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.review-list li { display: grid; gap: 6px; align-content: start; padding-block: 14px; border-top: 1px solid var(--line-soft); }
.review-list blockquote { margin: 0; font-style: italic; }
.rv-by { font-family: var(--f-mono); font-size: .76rem; color: var(--muted); }
.rv-by cite { font-style: normal; }
.js .review-list { display: none; }
html:not(.js) .pulse, html:not(.js) .chips { display: none; }

/* ——— Páginas secundarias: legales, 404 e inglés ——— */
.nav-btn { text-decoration: none; }
.ecg-static { display: block; width: 100%; height: 90px; }
.legal { max-width: 72ch; }
.legal h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); line-height: 1.02; margin-top: 12px; }
.legal h2 { font-size: 1.45rem; margin-top: 36px; margin-bottom: 8px; }
.legal p, .legal li { margin-bottom: 10px; }
.legal ul { padding-left: 1.2em; margin: 0; }
.legal a { color: var(--cobalt); text-underline-offset: 3px; }
.legal .updated { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); margin-top: 10px; }
.todo { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--ink); padding: 0 .3em; font-family: var(--f-mono); font-size: .9em; }
.foot a { color: inherit; text-underline-offset: 3px; }
.foot a:hover { color: var(--cobalt); }

/* ——— Ficha de autor: nota con la definición del autor (bloque citable) ——— */
.card-note { padding-bottom: .7rem; font-size: .98rem; line-height: 1.55; }

/* ——— Fecha de las valoraciones ——— */
.stats-date { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .04em; color: var(--muted); }

/* ——— Preguntas frecuentes: plegables y discretas ——— */
.faq { display: grid; gap: clamp(24px, 4vw, 56px); grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); padding-top: clamp(36px, 5vw, 56px); }
@media (min-width: 960px) { .faq { grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); } }
.faq-side { display: grid; gap: 18px; align-content: start; }
.faq-list { display: grid; }
.faq-item { border-bottom: 1px solid var(--line-soft); }
.faq-item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-block: 16px; font-family: var(--f-display); font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.25; transition: color .2s ease; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex: none; font-family: var(--f-mono); font-size: 1.25rem; line-height: 1; color: var(--cobalt); transition: transform .25s ease; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--cobalt); }
.faq-item p { margin: 0 0 18px; max-width: 62ch; color: var(--muted); }
.faq-item p a { color: var(--cobalt); text-underline-offset: 3px; }
