@import url('/fonts/newsreader/newsreader.css');
@import url('/fonts/geist-mono/geist-mono.css');

/* ─────────────────────────────────────────────────────────────────────────────
   Alameda — la web como un libro de papel amarillo leído bajo un árbol.
   Hojas (`.leaf`) en el flujo normal (editor, «reducir movimiento», sin script) y, con `html.bk`, apiladas en un escenario fijo
   que el script hojea con el scroll (ver script.js). La sombra del árbol (`.sun`) es un video de luz entre hojas que el script mueve con ráfagas de viento.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  --desk: #a9ab8c;
  --desk-ink: #262517;
  --paper: #f3e5bd;
  --paper-age: #e9d29a;
  --paper-hi: #f8eed2;
  --ink: #2a2416;
  --ink-2: rgba(42, 36, 22, .78);
  --ink-3: rgba(42, 36, 22, .64);
  --hair: rgba(42, 36, 22, .2);
  --hair-2: rgba(42, 36, 22, .34);
  --accent: #34402a;
  --on-accent: #f6ebc9;
  --rust: #9a3f1e;
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --nav-h: 64px;
  --gut: 56px;
  --pad: 64px;
  --ease: cubic-bezier(.19, 1, .22, 1);
}
@media (max-width: 720px) {
  :root { --nav-h: 56px; --gut: 10px; --pad: 22px; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body, button, input, select, textarea { font-family: var(--serif); }
html { -webkit-text-size-adjust: 100%; background: var(--desk); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--desk);
  font-size: 18px;
  line-height: 1.6;
  font-optical-sizing: auto;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 6px; text-decoration: none; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

/* ─── Textos ─── */
.label {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.label-sm { font-size: 11px; }
.h-xl {
  font-weight: 400;
  font-size: clamp(38px, 5.2vw, 74px);
  line-height: 1.02;
  letter-spacing: -.018em;
  font-variation-settings: 'opsz' 72;
  margin-top: 14px;
  text-wrap: balance;
}
.lead { font-size: 21px; line-height: 1.55; color: var(--ink); max-width: 36em; }
.body { font-size: 18px; line-height: 1.7; color: var(--ink-2); max-width: 38em; }
.lead + .body, .body + .body { margin-top: 14px; }
.note { margin-top: 26px; font-size: 15px; line-height: 1.55; color: var(--ink-3); font-style: italic; max-width: 46em; padding-left: 14px; border-left: 1px solid var(--hair-2); }
@media (max-width: 720px) {
  body { font-size: 17px; }
  .lead { font-size: 19px; }
  .body { font-size: 17px; }
}

/* ─── Botones ─── */
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  border-radius: 999px; border: 1px solid var(--accent);
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
  cursor: pointer;
}
.btn .ar, .btn .wa-ic { flex: none; }
.btn-solid { background: var(--accent); color: var(--on-accent); }
.btn-solid:hover { background: #222b1b; border-color: #222b1b; }
.btn-line { background: transparent; color: var(--accent); }
.btn-line:hover { background: var(--accent); color: var(--on-accent); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 12px; }
.btn-big { min-height: 56px; padding: 0 30px; font-size: 14px; }
.btn .ar { transition: transform .3s var(--ease); }
.btn:hover .ar { transform: translateX(3px); }

/* ─── Cabecera ─── */
.nav {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  background: var(--desk);
  color: var(--desk-ink);
}
.nav-in { height: 100%; max-width: 1360px; margin: 0 auto; padding: 0 var(--gut); display: flex; align-items: center; gap: 18px; }
.logo { font-size: 22px; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; font-variation-settings: 'opsz' 36; }
.logo img { max-height: 40px; width: auto; }
.nav-role { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: rgba(38, 37, 23, .74); white-space: nowrap; }
.nav-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 6px 0 12px; border: 0; background: none; color: inherit; cursor: pointer;
  font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
}
.nt-i { position: relative; width: 22px; height: 12px; display: inline-block; }
.nt-i i { position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; transition: transform .35s var(--ease), top .35s var(--ease); }
.nt-i i:first-child { top: 2px; }
.nt-i i:last-child { top: 9px; }
.nav.is-open .nt-i i:first-child { top: 5.5px; transform: rotate(45deg); }
.nav.is-open .nt-i i:last-child { top: 5.5px; transform: rotate(-45deg); }
.nav-cta { flex: none; order: 3; }
.nav-toggle { order: 2; }
/* índice: panel que baja (escritorio) u hoja a pantalla completa (celular) */
.nav-links {
  position: absolute; top: calc(100% + 6px); right: var(--gut);
  width: min(380px, calc(100vw - 2 * var(--gut)));
  padding: 22px 24px 24px;
  background: var(--paper) url(images/grano.png);
  color: var(--ink);
  border: 1px solid var(--hair);
  box-shadow: 0 24px 48px -20px rgba(40, 30, 10, .5);
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .3s ease, transform .4s var(--ease), visibility 0s .4s;
}
.nav.is-open .nav-links { opacity: 1; visibility: visible; transform: none; transition: opacity .3s ease, transform .4s var(--ease); }
.nav-h { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.nl { display: flex; align-items: baseline; gap: 16px; min-height: 46px; padding: 8px 0; border-bottom: 1px solid var(--hair); text-decoration: none; font-size: 21px; line-height: 1.25; }
.nl:last-of-type { border-bottom: 0; }
/* número del enlace por contador: al quitar una sección el editor quita su enlace y los demás se renumeran solos
   (escrito a mano quedaban saltos, «I, IV, VII») */
.nav-links { counter-reset: nl; }
.nl { counter-increment: nl; }
.nl-n::before { content: counter(nl, upper-roman); }
.nl-n { flex: none; width: 34px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--ink-3); }
.nl:hover .nl-t, .nl.is-on .nl-t { color: var(--rust); }
.nl.is-on .nl-n { color: var(--rust); }
.nav-cta-m { display: none; margin-top: 18px; }
@media (max-width: 720px) {
  .nav-role { display: none; }
  .logo { font-size: 20px; }
  .nav-in { gap: 8px; }
  .nav-cta { padding: 0 13px; }
  .nav-cta .btn-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nt-t { display: none; }
  .nav-toggle { padding: 0 10px; }
  .nav-links { position: fixed; top: var(--nav-top, var(--nav-h)); left: 0; right: 0; bottom: 0; width: auto; border: 0; padding: 18px 22px 28px; overflow-y: auto; }
  .nav-cta-m { display: inline-flex; }
}
@media (max-width: 340px) { .logo { font-size: 18px; } }

/* ─── Hojas: papel amarillo con grano, bordes más viejos y el lomo a la izquierda ─── */
.book { counter-reset: leaf; padding: 26px var(--gut) 56px; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.leaf {
  counter-increment: leaf;
  position: relative;
  width: 100%;
  max-width: 1180px;
  background-color: var(--paper);
  background-image:
    linear-gradient(to left, rgba(150, 105, 30, .1), transparent 9%),
    linear-gradient(to top, rgba(150, 105, 30, .08), transparent 7%),
    linear-gradient(to bottom, rgba(150, 105, 30, .06), transparent 6%),
    radial-gradient(120% 90% at 22% 12%, rgba(255, 249, 230, .55), transparent 60%),
    radial-gradient(90% 70% at 90% 88%, rgba(196, 150, 60, .12), transparent 60%),
    url(images/grano.png);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat;
  border: 1px solid rgba(110, 82, 30, .2);
  box-shadow: 0 1px 2px rgba(40, 30, 10, .14), 0 22px 44px -22px rgba(40, 30, 10, .55);
}
/* lomo: sombra donde la hoja entra en la encuadernación */
.leaf::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 64px; pointer-events: none;
  background: linear-gradient(90deg, rgba(42, 30, 10, .24), rgba(42, 30, 10, .1) 22%, rgba(42, 30, 10, .03) 55%, transparent);
  border-left: 1px solid rgba(42, 30, 10, .18);
}
.leaf-in { position: relative; padding: 34px var(--pad) 60px calc(var(--pad) + 18px); }
@media (max-width: 720px) {
  .leaf::after { width: 26px; }
  .leaf-in { padding: 20px var(--pad) 36px calc(var(--pad) + 6px); }
}

.folio { display: flex; align-items: center; gap: 14px; margin-bottom: 44px; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.folio-n::before { content: counter(leaf, upper-roman); color: var(--rust); }
.folio-rule { flex: 1; height: 1px; background: var(--hair); }
@media (max-width: 720px) { .folio { margin-bottom: 28px; } }

/* ─── I. Portada ─── */
.cover-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: end; }
.cover-name {
  margin-top: 18px;
  font-weight: 400;
  font-size: clamp(54px, 9.4vw, 140px);
  line-height: .94;
  letter-spacing: -.028em;
  font-variation-settings: 'opsz' 72;
}
.cover-lead { margin-top: 26px; font-size: clamp(20px, 1.9vw, 25px); line-height: 1.45; max-width: 26em; font-style: italic; color: var(--ink-2); }
.cover-book { width: 230px; transform: rotate(3deg); margin-bottom: 12px; }
/* la portada no se recorta: si el dueño sube otra foto (horizontal, cuadrada) se ve entera y el recuadro toma su forma.
   Con `aspect-ratio: 2/3; object-fit: cover` una foto horizontal quedaba cortada e inclinada. La inclinación es del CSS
   (.cover-book / .book-fig), no de la imagen; `outline` transparente + `backface-visibility` suavizan el borde inclinado. */
.book-img { display: block; width: 100%; height: auto; box-shadow: 1px 1px 0 rgba(0, 0, 0, .14), 14px 18px 30px -12px rgba(30, 22, 6, .6);
  outline: 1px solid transparent; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.cover-cap { width: max-content; max-width: 100%; margin-top: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); text-align: center; }
/* pie de la portada: dos citas con aire (la primera línea de la novela y una reseña), no un índice: los capítulos ya están
   en la cabecera y en el riel */
.cover-foot { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; margin-top: 76px; padding-top: 30px; border-top: 1px solid var(--hair-2); }
.cover-q { margin: 0; }
.cover-q-label { display: block; margin-bottom: 12px; }
.cover-q-t { font-size: clamp(19px, 1.6vw, 23px); line-height: 1.45; font-style: italic; color: var(--ink); max-width: 30em; }
.cover-q + .cover-q .cover-q-t { color: var(--ink-2); }
.cover-q-by { display: block; margin-top: 12px; font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 900px) {
  .cover-grid { grid-template-columns: 1fr; gap: 0; }
  .cover-book { width: 150px; margin: 34px 0 0 4px; }
  .cover-cap { text-align: left; }
}
@media (max-width: 720px) {
  .cover-foot { grid-template-columns: 1fr; gap: 30px; margin-top: 48px; padding-top: 24px; }
}

/* ─── II. El libro ─── */
.book-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
.book-fig { position: relative; max-width: 360px; justify-self: center; transform: rotate(-2deg); margin-top: 10px; }
.stamp {
  position: absolute; right: -26px; bottom: 34px; width: 108px; height: 108px; border-radius: 50%;
  border: 2px solid var(--rust); color: var(--rust); background: rgba(243, 229, 189, .25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  transform: rotate(-14deg); font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; line-height: 1.3;
  box-shadow: inset 0 0 0 4px rgba(243, 229, 189, .6), inset 0 0 0 5px rgba(154, 63, 30, .7);
  opacity: .88; mix-blend-mode: multiply;
}
.stamp b { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 19px; letter-spacing: 0; text-transform: none; }
.book-title { font-style: italic; }
.book-sub { margin-top: 12px; font-size: 22px; line-height: 1.4; color: var(--ink-2); }
.book-sub + .body { margin-top: 22px; }
.facts { margin-top: 30px; border-top: 1px solid var(--hair-2); max-width: 40em; }
.fact { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px dashed var(--hair-2); align-items: baseline; }
.fact-k { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.fact-v { font-size: 18px; }
@media (max-width: 900px) {
  .book-grid { grid-template-columns: 1fr; gap: 34px; }
  .book-fig { max-width: 220px; justify-self: start; margin-left: 6px; }
  .stamp { width: 92px; height: 92px; right: -40px; font-size: 10px; }
  .stamp b { font-size: 16px; }
}
@media (max-width: 720px) {
  .fact { grid-template-columns: 1fr; gap: 2px; }
  .book-sub { font-size: 19px; }
}

/* ─── III. Un fragmento ─── */
.read { max-width: 1000px; }
.read-cols { margin-top: 34px; columns: 2; column-gap: 56px; column-rule: 1px solid var(--hair); }
.read-p { color: var(--ink); max-width: none; font-size: 19px; line-height: 1.75; text-align: justify; hyphens: auto; -webkit-hyphens: auto; text-indent: 1.6em; }
.read-p.dropcap { text-indent: 0; }
.read-p + .read-p { margin-top: 0; }
.dropcap::first-letter { float: left; font-size: 4.6em; line-height: .82; padding: .06em .1em 0 0; color: var(--rust); font-variation-settings: 'opsz' 72; }
.read-sign { margin-top: 34px; text-align: right; font-style: italic; color: var(--ink-3); font-size: 17px; }
@media (max-width: 820px) {
  .read-cols { columns: 1; }
  .read-p { font-size: 18px; text-align: left; }
}

/* ─── Fotos «pegadas» en la hoja ─── */
.photo { position: relative; background: var(--paper-hi); padding: 10px 10px 12px; box-shadow: 0 1px 1px rgba(0, 0, 0, .1), 0 14px 28px -16px rgba(40, 30, 10, .55); }
.photo-img { width: 100%; object-fit: cover; filter: sepia(.22) saturate(.86) contrast(.98); }
.photo-tall { transform: rotate(-1.4deg); }
.photo-tall .photo-img { aspect-ratio: 4 / 5; }
.photo-wide .photo-img { aspect-ratio: 4 / 3; }
.photo-cap { margin-top: 10px; font-style: italic; font-size: 16px; color: var(--ink-3); text-align: center; }

/* ─── IV. Sobre mí ─── */
.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
.about-grid .photo { max-width: 420px; }
.about-body .lead { margin-top: 22px; }
.label-sm { margin-top: 30px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips li { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 7px 12px; border: 1px solid var(--hair-2); border-radius: 999px; color: var(--ink-2); }
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 34px; }
  .about-grid .photo { max-width: 330px; }
}

/* ─── V. Charlas ─── */
.talks-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 56px; align-items: end; }
.talks-head .lead { margin-top: 20px; }
.talks-head .photo { transform: rotate(1.2deg); }
.talks { counter-reset: talk; margin-top: 48px; border-top: 1px solid var(--hair-2); }
.talk { counter-increment: talk; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--hair); }
.talk-n::before { content: counter(talk, decimal-leading-zero); font-family: var(--mono); font-size: 13px; letter-spacing: .1em; color: var(--rust); }
.talk-n { align-self: start; padding-top: 8px; }
.talk-t { font-weight: 400; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.15; letter-spacing: -.01em; }
.talk-d { margin-top: 8px; color: var(--ink-2); max-width: 40em; }
.talk-m { margin-top: 10px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 900px) {
  .talks-head { grid-template-columns: 1fr; gap: 30px; }
  .talks-head .photo { max-width: 520px; }
}
@media (max-width: 720px) {
  .talk { grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; }
  .talk > .btn { grid-column: 2; justify-self: start; margin-top: 12px; }
}

/* ─── VI. Consultas y talleres ─── */
.offers { margin-top: 38px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 18px; justify-content: center; }
.offer { display: flex; flex-direction: column; padding: 26px 24px 24px; background: rgba(255, 250, 232, .5); border: 1px solid var(--hair-2); }
.offer-t { font-weight: 400; font-size: 26px; line-height: 1.2; }
.offer-d { margin-top: 10px; color: var(--ink-2); font-size: 17px; line-height: 1.6; }
.offer-meta { margin: 18px 0 20px; padding-top: 14px; border-top: 1px dashed var(--hair-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: baseline; }
.offer-m { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.offer > .btn { margin-top: auto; align-self: flex-start; }

/* ─── VII. Lectores ─── */
.readers-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: end; }
.readers-head .photo { transform: rotate(-1.6deg); }
.quotes { margin-top: 46px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 34px 40px; justify-content: center; }
.quote { position: relative; padding-top: 34px; border-top: 1px solid var(--hair-2); }
.quote-mark { position: absolute; top: -6px; left: -2px; font-size: 64px; line-height: 1; color: var(--rust); font-variation-settings: 'opsz' 72; }
.quote-t { font-size: 21px; line-height: 1.5; font-style: italic; }
.quote figcaption { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.quote-n { font-size: 17px; }
.quote-r { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 900px) {
  .readers-head { grid-template-columns: 1fr; gap: 30px; }
  .readers-head .photo { max-width: 520px; }
}

/* ─── VIII. Contacto (colofón) ─── */
.end-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 64px; align-items: end; }
/* aire entre la línea de arriba y «Escríbeme»: con 14 px la tilde de la í tocaba la etiqueta en el celular */
.end-title { margin-top: 30px; font-weight: 400; font-style: italic; font-size: clamp(56px, 7.6vw, 126px); line-height: .92; letter-spacing: -.03em; font-variation-settings: 'opsz' 72; }
.end-main .lead { margin-top: 26px; }
.end-mail { margin-top: 26px; font-size: 18px; color: var(--ink-2); }
.mail-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-underline-offset: 4px; overflow-wrap: anywhere; }
.socials { margin-top: 10px; border-top: 1px solid var(--hair-2); }
.socials li { border-bottom: 1px solid var(--hair); }
.socials a { display: flex; align-items: center; justify-content: space-between; min-height: 50px; text-decoration: none; font-size: 20px; }
.socials a:hover { color: var(--rust); }
.colophon { margin-top: 30px; }
.colophon .label-sm { margin-top: 0; }
.colo-t { margin-top: 8px; font-size: 16px; line-height: 1.55; font-style: italic; color: var(--ink-3); }
.end-foot { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--hair-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.to-top { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; }
.to-top:hover { color: var(--rust); }
@media (max-width: 900px) {
  .end-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* ─── Sombra del árbol: video real de luz entre hojas (komorebi.sh), en gris, multiplicado sobre el papel ───
   El sol del video es blanco puro: con multiply no tiñe nada y solo oscurece donde hay sombra; la fuerza va en la opacidad.
   Mientras carga (y en el editor, miniaturas o «reducir movimiento») se ve un cuadro fijo del mismo video.
   --sun-video: el script toma de aquí la ruta del video (y el ZIP lo incluye porque está en un url() de la hoja). */
.sun {
  --sun-video: url(images/komorebi.webm); --sun-video-mp4: url(images/komorebi.mp4);
  position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden;
  mix-blend-mode: multiply; opacity: .16;
  background: url(images/komorebi.webp) center / cover no-repeat;
}
/* el video, un poco más grande que la pantalla: el viento lo empuja unos píxeles (script.js) sin mostrar los bordes */
.sun video {
  position: absolute; inset: -3%; width: 106%; height: 106%; max-width: none; max-height: none; object-fit: cover;
  opacity: 0; transition: opacity 1.2s ease, transform .5s linear; will-change: transform;
  scale: -1 1; /* espejo: en el video el tronco (la sombra más oscura) queda a la izquierda; el árbol va a la derecha */
}
.sun video.is-on { opacity: 1; }
/* en el celular la letra es más chica respecto a las manchas de sol: sombra más suave */
@media (max-width: 720px) { .sun { opacity: .13; } }
/* (max-width: none: la vista previa del catálogo limita `video { max-width: 100% }` y el video girado quedaba cortado a media pantalla)
   pantalla vertical: el video (horizontal) va girado 90°; si no, para cubrir el alto se agrandaba 2,3× y las manchas de sol
   se volvían un borrón. rotate/translate sueltos: el script usa `transform` para el empuje del viento y se suman */
@media (orientation: portrait) {
  .sun video { inset: auto; left: 50%; top: 50%; width: 106lvh; height: 106vw; translate: -50% -50%; rotate: 90deg; scale: 1; } /* girado, el tronco ya cae a la derecha */
}
/* sin libro (reducir movimiento, miniaturas): la sombra queda sobre la portada y se desvanece al bajar (fija a la ventana se cortaba) */
html:not(.bk) body { position: relative; }
html:not(.bk) .sun { position: absolute; bottom: auto; height: 1500px; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
html.menu-open .sun { opacity: .07; transition: opacity .3s ease; }
html.is-ed .sun, html.is-ed .book-ui { display: none; }

/* ─── Interfaz del libro (la arma el script): índice lateral, número de hoja y «pasar la hoja» ─── */
.book-ui { display: none; }

/* ─── Pantalla grande (1100 px o más): que cada hoja entre entera en un Full HD (1920×1080: ~850 px de hoja en el
   navegador, ~800 en la Vista previa del editor) sin tramo de lectura. Medido: portada 1071, libro 886, sobre mí 833,
   presentaciones 1030 → todas por debajo de 800. Celular y tablet no cambian. ─── */
@media (min-width: 1100px) {
  .leaf-in { padding: 26px var(--pad) 40px calc(var(--pad) + 18px); }
  .folio { margin-bottom: 24px; }
  .cover-name { margin-top: 12px; font-size: clamp(54px, 6.6vw, 108px); }
  .cover-lead { margin-top: 18px; }
  .cover-foot { margin-top: 64px; }
  .book-fig { max-width: 290px; margin-top: 4px; }
  .book-sub + .body { margin-top: 16px; }
  .facts { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }  /* dato arriba, valor abajo, de a dos: la hoja II entra sin scroll en Full HD con barras del navegador (~880 px) */
  .fact { padding: 8px 0; grid-template-columns: 1fr; gap: 2px; }
  .book-body .btns { margin-top: 22px; }
  .about-grid .photo { max-width: 360px; }
  /* presentaciones: los encuentros lado a lado */
  .talks-head .photo { max-width: 420px; justify-self: end; }
  .talks { margin-top: 30px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 36px; border-top: 0; }
  .talk { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 18px 0 0; border-top: 1px solid var(--hair-2); border-bottom: 0; }
  .talk-n { padding-top: 0; margin-bottom: 10px; }
  .talk-t { font-size: 26px; }
  .talk > .btn { margin-top: auto; }
  .talk-main { margin-bottom: 18px; }
}

/* ═══════════ Modo libro (html.bk): hojas apiladas en un escenario fijo ═══════════ */
html.bk .nav { position: fixed; left: 0; right: 0; top: 0; }
html.bk .book {
  position: fixed; left: 0; right: 0; top: var(--stage-top, 72px); z-index: 10;
  height: calc(100svh - var(--stage-top, 72px) - var(--stage-gap, 22px));
  padding: 0; display: block; gap: 0;
  perspective: 2600px; perspective-origin: 30% 50%;
  /* recorta lo que sube por debajo de la cabecera; deja ver la pila de hojas abajo y la hoja que gira a los lados */
  clip-path: inset(0 -60vw -40px -60vw);
}
html.bk .leaf {
  position: absolute; top: 0; left: 50%;
  width: var(--leaf-w); margin-left: calc(var(--leaf-w) / -2); max-width: none;
  min-height: 100%;
  transform-origin: 0 50%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  visibility: hidden; pointer-events: none;
}
html.bk { --leaf-w: min(1180px, calc(100vw - 2 * var(--gut) - 72px)); }
@media (max-width: 720px) { html.bk { --leaf-w: calc(100vw - 2 * var(--gut)); --stage-gap: 14px; } html.bk .book { perspective: 1500px; } }
html.bk .leaf.is-focus { visibility: visible; z-index: 50; }
html.bk .leaf.is-focus.is-still { pointer-events: auto; }
/* la hoja de arriba y la de abajo ya tienen su capa antes de girar: si la capa nace al empezar el giro, el navegador vuelve a
   dibujar la hoja y las sombras grandes (el libro, las fotos) cambian de golpe («se prende una sombra») */
html.bk .leaf.is-focus, html.bk .leaf.is-under { will-change: transform; }
html.bk .leaf.is-under { visibility: visible; z-index: 40; }
/* la sombra grande la llevan solo las hojas de la pila. Si la lleva la hoja de arriba, al subir de «debajo» a «arriba» su sombra
   pasa a dibujarse sobre la pila y las hojas de atrás se oscurecen de golpe («antes está claro, luego se ponen más oscuras») */
html.bk .leaf.is-focus, html.bk .leaf.is-under { box-shadow: 0 1px 2px rgba(40, 30, 10, .14); }
html.bk .leaf.is-below { visibility: visible; z-index: calc(30 - var(--d, 1)); transform: translate3d(calc(var(--d, 1) * 4px), calc(var(--d, 1) * 5px), 0); box-shadow: 0 1px 2px rgba(40, 30, 10, .14), 0 22px 44px -22px rgba(40, 30, 10, .55); }
html.bk .leaf.is-below > .leaf-in { visibility: hidden; }
/* debajo solo se ve una pantalla de hoja: lo que sobra no asoma por el borde de abajo */
html.bk .leaf.is-under, html.bk .leaf.is-below { height: 100%; overflow: clip; }
/* la cara que gira se oscurece y brilla como el papel al doblarse; la hoja de abajo recibe su sombra */
html.bk .leaf::before {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(30, 22, 6, .2), rgba(30, 22, 6, .04) 16%, rgba(255, 250, 230, .4) 46%, rgba(255, 250, 230, .1) 64%, rgba(30, 22, 6, .1) 85%, rgba(30, 22, 6, .26));
}
html.bk .leaf.is-turning::before { opacity: min(.8, calc(var(--t, 0) * 1.3)); }
/* la sombra sobre la hoja de abajo crece con el giro y se va al final: antes saltaba de 0 a .9 al empezar a girar («se prende una sombra, se ve brusco») */
html.bk .leaf.is-under::before { opacity: calc(min(1, var(--t, 0) * 4) * (1 - var(--t, 0)) * .9); background: linear-gradient(90deg, rgba(30, 22, 6, .3), rgba(30, 22, 6, .12) 40%, rgba(30, 22, 6, .02)); }
html.bk .leaf.is-under:not(.is-shaded)::before { opacity: 0; }


html.bk .book-ui { display: block; }
.bu-rail { position: fixed; left: 18px; top: 50%; transform: translateY(-50%); z-index: 35; display: flex; flex-direction: column; gap: 2px; }
.bu-rail button {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: rgba(38, 37, 23, .62);
  border-left: 1px solid rgba(38, 37, 23, .3); transition: color .25s ease, border-color .25s ease;
}
.bu-rail button:hover { color: var(--desk-ink); }
.bu-rail button.is-on { color: var(--desk-ink); border-left: 2px solid var(--rust); font-weight: 500; }
.bu-no { margin-top: 14px; width: 36px; text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: rgba(38, 37, 23, .74); }
.bu-rail .bu-next { margin-top: 6px; border: 1px solid rgba(38, 37, 23, .4); border-radius: 50%; width: 36px; height: 36px; font-size: 15px; color: var(--desk-ink); }
.bu-rail .bu-next:hover { border-color: var(--rust); color: var(--rust); }
.bu-next[hidden] { display: none; }
.bu-bar { position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: 45; transform-origin: 0 0; transform: scaleX(0); background: var(--rust); pointer-events: none; }
/* ─── Celular (html.bk-touch): la página no hace scroll; la hoja se pasa deslizando de lado y se lee con su propio scroll ───
   Sin scroll de la ventana la barra de direcciones no se esconde ni cambia el alto; solo se mueve una hoja (transform). */
html.bk-touch, html.bk-touch body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.bk-touch .book { height: auto; bottom: 64px; touch-action: pan-y; }
html.bk-touch .leaf { height: 100%; min-height: 0; overflow: hidden; }
html.bk-touch .leaf > .leaf-in { height: 100%; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; }
html.bk-touch .leaf > .leaf-in::-webkit-scrollbar { display: none; }
.bu-pager { display: none; }
html.bk-touch .bu-pager {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 35;
  display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px;
  background: rgba(244, 233, 200, .92); border: 1px solid rgba(110, 82, 30, .25); box-shadow: 0 6px 18px -8px rgba(40, 30, 10, .5);
}
.bu-pg { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font-size: 24px; line-height: 1; color: var(--ink); cursor: pointer; }
.bu-pg:disabled { opacity: .3; cursor: default; }
/* llegaste al final de la hoja: la flecha avisa que la siguiente está a un tirón (o a un toque) */
.bu-pg.is-ready { background: var(--rust); color: #fff8e8; transition: background-color .3s ease, color .3s ease; }
.bu-pg-no { min-width: 44px; text-align: center; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--ink-2); }
@media (max-width: 1080px) { .bu-rail { display: none; } html.bk { --leaf-w: min(1180px, calc(100vw - 2 * var(--gut))); } }
@media (max-width: 720px) {
  html.bk { --leaf-w: calc(100vw - 2 * var(--gut)); }
}

/* ─── Correo: Gmail · Outlook · App de correo · Copiar ─── */
.mail-pick { position: fixed; z-index: 90; min-width: 230px; padding: 8px; background: var(--paper-hi); border: 1px solid var(--hair-2); box-shadow: 0 18px 40px -16px rgba(30, 22, 6, .5); display: flex; flex-direction: column; }
.mail-pick p { padding: 8px 10px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.mail-pick a, .mail-pick button { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border: 0; background: none; text-align: left; font-size: 17px; color: var(--ink); text-decoration: none; cursor: pointer; }
.mail-pick a:hover, .mail-pick button:hover { background: rgba(42, 36, 22, .07); }

/* ─── Editor: todo plano, visible y editable ─── */
html.is-ed .nav { position: sticky; }
html.is-ed .nav-links { position: static; opacity: 1; visibility: visible; transform: none; display: none; }
html.is-ed .nav.is-open .nav-links { display: flex; position: absolute; }
html.is-ed .chips { display: flex; flex-direction: row; }
html.is-ed .socials, html.is-ed .facts, html.is-ed .talks { display: flex; flex-direction: column; }
