/* ==========================================================
   El Cuaderno del Inspector
   ========================================================== */

:root {
    --ink: #16130f;
    --ink-2: #1c1916;
    --ink-3: #2a2622;
    --paper: #f0e7d4;
    --paper-2: #e3daca;
    --text-dark: #16130f;
    --text-muted: #7a6e5e;
    --text-light: #efe9df;
    --text-light-muted: #a79d91;
    --red: #a32118;
    --gold: #d0a24c;

    --f-title: "Zilla Slab", Georgia, serif;
    --f-body: "Spectral", Georgia, serif;
    --f-mono: "IBM Plex Mono", ui-monospace, monospace;
    --f-logo: "Big Shoulders Display", Impact, sans-serif;

    --gutter: clamp(16px, 5vw, 64px);
    --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--ink);
    color: var(--text-light);
    font-family: var(--f-body);
    font-size: 18px;
    line-height: 1.6;
    overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-title); font-weight: 700; line-height: 1.08; margin: 0; }
h2 { font-size: clamp(2rem, 4.5vw, 3.4rem); margin-bottom: .6em; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

.label {
    display: block;
    font-family: var(--f-mono);
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-light-muted);
    margin-bottom: .8em;
}
.label--gold { color: var(--gold); }
.label--red { color: var(--red); }

.lead { font-size: 1.2rem; max-width: 42em; color: var(--text-light-muted); }

/* Botones */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    padding: .9em 1.6em;
    background: var(--red); color: #fff;
    font-family: var(--f-mono); font-size: .8rem; font-weight: 600;
    letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
    border: 1px solid var(--red); border-radius: 2px; cursor: pointer;
    transition: transform .25s var(--ease), background .25s, box-shadow .25s, color .25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -8px rgba(163, 33, 24, .6); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn--small { padding: .65em 1.1em; font-size: .72rem; }
.btn--ghost { background: transparent; border-color: rgba(239, 233, 223, .35); }
.btn--ghost:hover { border-color: var(--text-light); box-shadow: none; }
.btn--light { background: var(--paper); color: var(--c, var(--ink)); border-color: var(--paper); }
.btn--light:hover { box-shadow: 0 12px 26px -10px rgba(0, 0, 0, .6); }
.btn--ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.btn--ghost-light:hover { background: rgba(255, 255, 255, .1); box-shadow: none; }

/* Logo */
.logo { display: inline-flex; flex-direction: column; align-items: center; text-decoration: none; line-height: 1; }
.logo__pre { font-family: var(--f-mono); font-size: .55rem; letter-spacing: .3em; text-transform: uppercase; margin-bottom: .25em; }
.logo__main { font-family: var(--f-logo); font-size: 1.7rem; letter-spacing: .02em; display: inline-flex; align-items: center; }
.logo__o {
    display: inline-block; width: .62em; height: .62em; margin: 0 .04em;
    background: var(--red);
    border-radius: 48% 52% 45% 55% / 55% 45% 55% 45%;
    box-shadow: .08em -.06em 0 -.03em var(--red), -.07em .07em 0 -.04em var(--red);
    animation: blot 6s ease-in-out infinite;
}
@keyframes blot {
    50% { border-radius: 55% 45% 52% 48% / 45% 55% 45% 55%; transform: rotate(20deg) scale(1.05); }
}

/* Navegación */
.nav {
    position: fixed; inset: 0 0 auto; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 14px var(--gutter);
    transition: background .35s, padding .35s, box-shadow .35s;
}
.nav.is-scrolled { background: rgba(20, 18, 16, .88); backdrop-filter: blur(10px); padding-top: 10px; padding-bottom: 10px; box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
.nav__links { display: flex; gap: 2rem; }
.nav__links a { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; color: var(--text-light-muted); position: relative; }
.nav__links a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 1px; background: var(--red); transition: right .3s var(--ease); }
.nav__links a:hover { color: var(--text-light); }
.nav__links a:hover::after { right: 0; }
@media (max-width: 760px) { .nav__links { display: none; } }

/* ============ HERO ============ */
.hero {
    position: relative;
    min-height: 100vh; min-height: 100svh;
    display: flex; align-items: center;
    padding: 120px var(--gutter) 90px;
    background:
        radial-gradient(ellipse 60% 50% at 75% 45%, rgba(163, 33, 24, .12), transparent 70%),
        radial-gradient(ellipse 50% 60% at 10% 90%, rgba(208, 162, 76, .06), transparent 70%),
        var(--ink);
    overflow: hidden;
}
@media (min-height: 1400px) { .hero { min-height: 1000px; } }
.hero::before {           /* rejilla de cuaderno */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.hero__grid {
    position: relative;
    width: 100%; max-width: 1180px; margin: 0 auto;
    display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center;
}
.hero__clue { font-style: italic; font-size: 1.2rem; color: #d8d0c4; max-width: 30em; min-height: 3.2em; }
.hero__clue.is-typing::after { content: "▌"; color: var(--red); font-style: normal; animation: caret .8s steps(1) infinite; margin-left: 2px; }
@keyframes caret { 50% { opacity: 0; } }
.hero__title { font-size: clamp(3rem, 8vw, 6rem); letter-spacing: -.01em; margin-bottom: .35em; }
.rule { display: block; width: 90px; height: 3px; background: var(--red); margin-bottom: 1.4rem; transform-origin: left; }
.hero__sub { font-size: 1.15rem; color: var(--text-light-muted); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }

/* Sospechosos */
.suspects { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem 1rem; max-width: 440px; justify-self: end; width: 100%; }
.suspects__hint { grid-column: 1 / -1; text-align: right; margin: 0; color: var(--gold); }
.suspect {
    all: unset; cursor: pointer; display: block; text-align: left;
    opacity: 0; transform: translateY(30px) rotate(calc((var(--i) - 1.5) * 2deg));
    animation: deal .9s var(--ease) forwards;
    animation-delay: calc(.9s + var(--i) * .15s);
}
.suspect:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
@keyframes deal { to { opacity: 1; transform: translateY(0) rotate(0); } }
.suspect__photo {
    position: relative; display: block; overflow: hidden;
    background: #fff; padding: 6px;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .9);
    transition: transform .35s var(--ease), box-shadow .35s;
}
.suspect img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; filter: grayscale(.25) contrast(1.05); transition: filter .35s, transform .6s var(--ease); }
.suspect:hover .suspect__photo { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 26px 50px -18px rgba(0, 0, 0, .95); }
.suspect:hover img { filter: none; transform: scale(1.04); }
.suspect .label { font-size: .62rem; margin: .7em 0 .1em; }
.suspect strong { font-family: var(--f-title); font-size: 1.05rem; }
.suspect__stamp {
    position: absolute; left: 50%; top: 50%;
    padding: .2em .5em;
    font-family: var(--f-mono); font-weight: 600; font-size: .95rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--red); border: 3px solid var(--red); background: rgba(255, 255, 255, .8);
    transform: translate(-50%, -50%) rotate(-14deg) scale(2.2); opacity: 0;
    transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
}
.suspect.is-accused .suspect__stamp { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
.suspect.is-accused img { filter: grayscale(0) sepia(.3); }
.suspects.has-accused .suspect:not(.is-accused) { opacity: .45; }

.verdict {
    grid-column: 1 / -1;
    border-left: 3px solid var(--red); padding: .2em 0 .2em 1em;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height .5s var(--ease), opacity .4s;
}
.verdict.is-open { max-height: 200px; opacity: 1; }
.verdict__text { margin: 0 0 .4em; font-style: italic; }
.verdict__link { font-family: var(--f-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); text-decoration: none; }
.verdict__link:hover { text-decoration: underline; }

.scroll-cue { position: absolute; left: 50%; bottom: 26px; width: 24px; height: 40px; margin-left: -12px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 12px; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 2px; height: 8px; margin-left: -1px; background: var(--red); animation: cue 1.8s infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

@media (max-width: 900px) {
    .hero__grid { grid-template-columns: 1fr; }
    .suspects { justify-self: stretch; max-width: 520px; }
    .suspects__hint { text-align: left; }
    .scroll-cue { display: none; }
}

/* ============ MARQUEE ============ */
.marquee { overflow: hidden; padding: 40px 0 60px; background: var(--ink-2); border-block: 1px solid rgba(255, 255, 255, .05); }
.marquee__track { display: flex; gap: 32px; width: max-content; animation: marquee 50s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 16px)); } }
.marquee__item { width: 170px; text-decoration: none; flex: none; }
.marquee__item img { aspect-ratio: 7 / 10; object-fit: cover; box-shadow: 0 16px 30px -14px #000; transition: transform .4s var(--ease); }
.marquee__item:hover img { transform: translateY(-8px) rotate(-2deg); }
.marquee__item .label { margin-top: 1em; padding-top: .6em; border-top: 2px solid var(--c); font-size: .62rem; }

/* ============ CIFRAS ============ */
.stats { padding: clamp(70px, 10vw, 120px) var(--gutter); max-width: 1180px; margin: 0 auto; }
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.stat { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 1.2rem; }
.stat__num { display: block; font-family: var(--f-title); font-size: clamp(3rem, 7vw, 5rem); line-height: 1; color: var(--text-light); font-variant-numeric: tabular-nums; }
.stat:last-child .stat__num { color: var(--red); }
.stat__txt { display: block; margin-top: .5rem; color: var(--text-light-muted); font-size: 1rem; }
.stats__seal { margin-top: 3rem; max-width: 40em; color: var(--text-light-muted); }
.stats__seal .label { display: inline; margin-right: .8em; }
@media (max-width: 760px) { .stats__grid { grid-template-columns: 1fr 1fr; } }

/* ============ SECCIONES DE PAPEL ============ */
.paper {
    background: var(--paper); color: var(--text-dark);
    background-image: linear-gradient(rgba(38, 33, 28, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(38, 33, 28, .045) 1px, transparent 1px);
    background-size: 24px 24px;
    padding: clamp(80px, 11vw, 140px) 0;
}
.paper .label:not(.label--red) { color: var(--text-muted); }

/* Anatomía */
.anatomy__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; margin-top: 2rem; }
.anatomy__pages { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding-bottom: 2rem; }
.page { margin: 0; position: relative; background: #fff; box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 24px 40px -22px rgba(38, 33, 28, .55); cursor: zoom-in; }
.page--left { transform: rotate(-1.5deg); }
.page--right { transform: rotate(1.2deg) translateY(24px); }
.page.is-visible.page--left { transform: rotate(-1.5deg); }
.anatomy__tip { position: absolute; bottom: -1.6rem; left: 0; font-size: .62rem; }
.loupe {
    position: absolute; z-index: 5; pointer-events: none;
    width: 190px; height: 190px; border-radius: 50%;
    border: 6px solid #2a2622;
    box-shadow: 0 0 0 2px #8a7a64, 0 20px 40px rgba(0, 0, 0, .45), inset 0 0 20px rgba(0, 0, 0, .25);
    background-repeat: no-repeat; background-color: #fff;
    transform: translate(-50%, -50%) scale(.3); opacity: 0;
    transition: opacity .2s, transform .25s var(--ease);
}
.loupe::after { content: ""; position: absolute; right: -44px; bottom: -44px; width: 60px; height: 14px; background: #2a2622; border-radius: 6px; transform: rotate(45deg); transform-origin: left center; }
.loupe.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; }
.steps__n { font-family: var(--f-title); font-weight: 700; font-size: 2.4rem; line-height: .9; color: var(--red); }
.steps h3 { font-size: 1.35rem; margin-bottom: .3em; }
.steps p { margin: 0; color: var(--text-muted); }

.levels { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid rgba(38, 33, 28, .15); }
.levels .label { margin: 0 1rem 0 0; }
.level { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; padding: .45em 1em; border: 1px solid rgba(22, 19, 15, .3); border-radius: 99px; }
.level i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--red); }
.level i.on { background: var(--red); }
.level i:last-of-type { margin-right: .5em; }

@media (max-width: 860px) { .anatomy__grid { grid-template-columns: 1fr; } }

/* ============ COLECCIÓN ============ */
.collection { padding: clamp(80px, 11vw, 140px) 0 0; }
.collection > .container { margin-bottom: 4rem; }

.volume { position: relative; padding: 0 var(--gutter); margin-bottom: clamp(3rem, 6vw, 5rem); }
.volume__panel {
    position: relative; z-index: 1;
    max-width: 1180px; margin: 0 auto;
    display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center;
    padding: clamp(2rem, 5vw, 4rem);
    background: var(--c); color: #fff;
    background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(0, 0, 0, .25));
    background-size: 24px 24px, 24px 24px, 100% 100%;
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8);
    overflow: hidden; isolation: isolate;
}
.volume--flip .volume__panel { grid-template-columns: 1fr minmax(220px, 380px); }
.volume--flip .volume__cover { order: 2; }
.volume .label { color: rgba(255, 255, 255, .75); }
.volume h3 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); margin-bottom: .4em; }
.volume__summary { font-size: 1.15rem; max-width: 32em; color: rgba(255, 255, 255, .92); }
.volume__types { margin: 1.8rem 0 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, .25); }
.volume__types ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.volume__types li { font-size: .95rem; padding: .25em .8em; background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .15); border-radius: 2px; }
.volume__actions { display: flex; flex-wrap: wrap; gap: 1rem; }
.volume__num {
    position: absolute; z-index: -1; right: 1.5rem; bottom: -.18em;
    font-family: var(--f-logo); font-size: clamp(6rem, 14vw, 12rem); line-height: 1;
    color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, .16);
    pointer-events: none;
}
.volume--flip .volume__num { right: auto; left: 1.5rem; }

.volume__cover { perspective: 1200px; }
.book {
    position: relative; transform-style: preserve-3d;
    transform: rotateY(var(--ry, -12deg)) rotateX(var(--rx, 4deg));
    transition: transform .6s var(--ease);
    box-shadow: 18px 26px 40px -12px rgba(0, 0, 0, .6);
}
.book::before {        /* lomo */
    content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 14px;
    background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .15) 60%, transparent);
    z-index: 1;
}
.book img { aspect-ratio: 7 / 10; object-fit: cover; width: 100%; }
.book__shine { position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .28) 45%, transparent 60%); background-size: 250% 100%; background-position: var(--shine, 100%) 0; mix-blend-mode: soft-light; pointer-events: none; }
.volume--flip .book { --ry: 12deg; }

@media (max-width: 800px) {
    .volume__panel, .volume--flip .volume__panel { grid-template-columns: 1fr; }
    .volume--flip .volume__cover { order: 0; }
    .volume__cover { max-width: 240px; }
    .volume__num, .volume--flip .volume__num { right: 1rem; left: auto; bottom: auto; top: -.1em; }
}

/* ============ REGALO ============ */
.gift h2 { max-width: 20em; }
.gift__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; margin-top: 3rem; }
.gift__item h3 { font-size: 1.35rem; margin: 1rem 0 .4rem; }
.gift__item p { color: var(--text-muted); margin: 0; }
.gift__icon svg { width: 48px; height: 48px; fill: none; stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gift__icon path, .gift__icon circle, .gift__icon rect { stroke-dasharray: 200; stroke-dashoffset: 200; transition: stroke-dashoffset 1.6s var(--ease) .3s; }
.gift__item.is-visible .gift__icon * { stroke-dashoffset: 0; }
html:not(.js) .gift__icon * { stroke-dashoffset: 0; }
@media (max-width: 800px) { .gift__grid { grid-template-columns: 1fr; } }

/* ============ TIENDA ============ */
.shop { padding: clamp(80px, 11vw, 140px) 0; background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(163, 33, 24, .12), transparent 70%), var(--ink); }
.shop h2 { margin-bottom: 1.2em; }
.shop__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3rem 1.6rem; }
.shop__item { display: block; text-decoration: none; transition-delay: var(--d); }
.shop__cover { display: block; position: relative; margin-bottom: 1rem; }
.shop__cover::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 3px; background: var(--c); transform: scaleX(.25); transform-origin: left; transition: transform .45s var(--ease); }
.shop__cover img { aspect-ratio: 7 / 10; object-fit: cover; width: 100%; box-shadow: 0 20px 36px -18px #000; transition: transform .45s var(--ease), box-shadow .45s; }
.shop__item:hover .shop__cover img { transform: translateY(-10px) rotate(-1.5deg); box-shadow: 0 34px 44px -20px #000; }
.shop__item:hover .shop__cover::after { transform: scaleX(1); }
.shop__item .label { margin: 1.2em 0 .2em; font-size: .62rem; }
.shop__item strong { display: block; font-family: var(--f-title); font-size: 1.25rem; line-height: 1.15; }
.shop__buy { display: inline-block; margin-top: .6rem; font-family: var(--f-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.shop__buy span { display: inline-block; transition: transform .3s var(--ease); }
.shop__item:hover .shop__buy span { transform: translateX(6px); }
@media (max-width: 900px) { .shop__grid { grid-template-columns: repeat(2, 1fr); } }

/* ============ FOOTER ============ */
.footer { padding: 60px 0 40px; border-top: 1px solid rgba(255, 255, 255, .07); color: var(--text-light-muted); }
.footer__inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; }
.footer .logo { color: var(--text-light); margin-bottom: .8rem; }
.footer__small { font-size: .78rem; opacity: .7; }

/* ============ VISOR DE PÁGINA ============ */
.preview {
    border: 0; padding: 1.2rem; background: var(--paper); color: var(--text-dark);
    max-width: min(92vw, 640px); max-height: 92vh; overflow: auto;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .7);
}
.preview[open] { animation: pop .4s var(--ease); }
.preview::backdrop { background: rgba(10, 9, 8, .8); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.preview__title { color: var(--text-muted); margin-right: 3rem; }
.preview__close { position: absolute; top: .6rem; right: .8rem; width: 40px; height: 40px; border: 0; background: none; font-size: 2rem; line-height: 1; cursor: pointer; color: var(--text-dark); }

/* ============ ANIMACIONES AL HACER SCROLL ============ */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .page--left.reveal:not(.is-visible) { transform: translateY(40px) rotate(-6deg); }
.js .page--right.reveal:not(.is-visible) { transform: translateY(60px) rotate(6deg); }
.js .page--left.reveal.is-visible { transform: rotate(-1.5deg); }
.js .page--right.reveal.is-visible { transform: rotate(1.2deg) translateY(24px); transition-delay: .15s; }
.js .volume__cover.reveal:not(.is-visible) { transform: translateY(40px) scale(.94); }
.js .rule.reveal { transform: scaleX(0); transition-duration: 1.2s; transition-delay: .4s; }
.js .rule.reveal.is-visible { transform: scaleX(1); }
.js .hero .reveal { transition-delay: calc(var(--d, 0) * 1ms); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .marquee__track { animation: none; }
    .marquee { overflow-x: auto; }
}

/* ============ ACCESIBILIDAD ============ */
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: .6em 1em; background: var(--paper); color: var(--ink); font-family: var(--f-mono); font-size: .8rem; }
.skip:focus { top: 12px; }

/* Títulos de volumen enlazados a su página */
.volume h3 a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .35s var(--ease); }
.volume h3 a:hover { background-size: 100% 2px; }

/* Enlaces a los libros en el pie */
.footer__books { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.4rem; margin: .4rem 0 .8rem; }
.footer__books a { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: var(--text-light-muted); }
.footer__books a:hover { color: var(--text-light); }

/* ============ PÁGINA DE LIBRO ============ */
.book-hero {
    padding: 110px 0 clamp(60px, 9vw, 110px);
    background:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 45%, var(--ink)));
    background-size: 24px 24px, 24px 24px, 100% 100%;
    color: #fff;
}
.crumbs { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; color: rgba(255, 255, 255, .7); margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.crumbs a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span[aria-current] { color: #fff; }
.book-hero__grid { display: grid; grid-template-columns: minmax(220px, 400px) 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.book-hero .label { color: rgba(255, 255, 255, .75); }
.book-hero h1 { font-size: clamp(2.8rem, 7vw, 5rem); }
.book-hero__sub { font-family: var(--f-mono); font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .8); margin: .6em 0 1.4em; }
.book-hero__summary { font-size: 1.25rem; max-width: 30em; }
.book-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; margin: 2rem 0 2.4rem; }
.book-hero__seal { font-family: var(--f-mono); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); background: #f3cf4d; padding: .5em .9em; border-radius: 99px; transform: rotate(-3deg); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0; border-top: 1px solid rgba(255, 255, 255, .25); }
.facts div { padding: .9rem 0; border-bottom: 1px solid rgba(255, 255, 255, .25); }
.facts dt { font-family: var(--f-mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.facts dd { margin: .2em 0 0; font-family: var(--f-title); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.book-hero__cover .book { --ry: -14deg; }
@media (max-width: 800px) {
    .book-hero__grid { grid-template-columns: 1fr; }
    .book-hero__cover { max-width: 260px; }
    .facts { grid-template-columns: repeat(2, 1fr); }
}

.book-inside__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.book-inside h3 { font-size: 1.3rem; margin: 1.6rem 0 .8rem; }
.book-inside p { max-width: 36em; }
.case-types { display: grid; gap: .5rem; }
.case-types__hint { margin: -.4rem 0 .9rem; font-size: .62rem; }
.case-type { background: var(--paper-2); border-left: 3px solid var(--c); transition: background .25s; }
.case-type[open] { background: #fff; box-shadow: 0 10px 24px -16px rgba(22, 19, 15, .5); }
.case-type summary { cursor: pointer; list-style: none; position: relative; padding: .6rem 2.6rem .6rem .9rem; font-weight: 600; }
.case-type summary::-webkit-details-marker { display: none; }
.case-type summary::after { content: "+"; position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: 1.2rem; font-weight: 400; color: var(--c); transition: transform .3s var(--ease); }
.case-type[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.case-type summary:hover { color: var(--c); }
.case-type p { margin: 0; padding: 0 .9rem .9rem; font-size: .98rem; line-height: 1.55; color: var(--text-muted); max-width: none; }
.case-type[open] p { animation: unfold .35s var(--ease); }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
.book-inside__page { transform: rotate(1.2deg); }
.js .book-inside__page.reveal:not(.is-visible) { transform: translateY(40px) rotate(5deg); }
.js .book-inside__page.reveal.is-visible { transform: rotate(1.2deg); }
.book-inside__page figcaption { position: absolute; left: 0; bottom: -2rem; margin: 0; font-size: .62rem; }
@media (max-width: 860px) { .book-inside__grid { grid-template-columns: 1fr; } .book-inside__page { max-width: 460px; } }

.book-steps { padding: clamp(70px, 10vw, 120px) 0; }
.steps--dark { grid-template-columns: repeat(3, 1fr); margin-top: 1.5rem; }
.steps--dark p { color: var(--text-light-muted); }
@media (max-width: 800px) { .steps--dark { grid-template-columns: 1fr; } }

.faq__list { max-width: 760px; border-top: 1px solid rgba(22, 19, 15, .2); }
.faq details { border-bottom: 1px solid rgba(22, 19, 15, .2); }
.faq summary { cursor: pointer; list-style: none; padding: 1.1rem 2.5rem 1.1rem 0; position: relative; font-family: var(--f-title); font-weight: 600; font-size: 1.2rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .3rem; top: .9rem; font-family: var(--f-mono); font-size: 1.4rem; color: var(--red); transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 1.2rem; color: var(--text-muted); max-width: 40em; }
.faq__cta { margin-top: 2.5rem; }

.shop--related .shop__grid { margin-bottom: 3rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 1.6rem; }
.pager a { text-decoration: none; font-family: var(--f-title); font-weight: 700; font-size: 1.2rem; }
.pager a:hover { color: var(--gold); }
.pager .label { margin-bottom: .3em; }
.pager__next { text-align: right; }

.notfound { min-height: 70vh; display: flex; align-items: center; padding: 140px 0 80px; }
.notfound h1 { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: .4em; }
.notfound .btn { margin-top: 1rem; }
