/* ── Landing page: hero + closed book ── */
.site {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(55vmax 42vmax at 50% 46%, rgba(230, 200, 130, 0.09), transparent 64%),
        radial-gradient(120vmax 95vmax at 50% 40%, var(--navy-800), var(--navy-950) 74%);
}
.site::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.05;
    mix-blend-mode: overlay;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 180px 180px;
}
body.reader-shown .site { visibility: hidden; }

/* top bar */
.site-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: calc(var(--safe-t) + 16px) max(20px, var(--safe-r)) 0 max(20px, var(--safe-l));
}
.site-logo { display: block; flex: none; }
.site-logo img { display: block; height: 30px; width: auto; }
.site-links { display: flex; align-items: center; gap: 18px; }
.site-link {
    display: none;
    font-size: 13.5px;
    color: var(--cream-mute);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    transition: color 200ms ease, border-color 200ms ease;
}
.site-link:hover, .site-link:focus-visible { color: var(--gold-bright); border-color: var(--gold-line); }

/* hero grid — mobile first: head / book / actions / categories */
.hero {
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "book" "actions" "cats";
    align-content: center;
    justify-items: center;
    row-gap: 18px;
    padding: 14px 20px calc(28px + var(--safe-b));
    text-align: center;
}
.hero-head { grid-area: head; display: flex; flex-direction: column; align-items: center; }
.hero-book { grid-area: book; }
.hero-actions { grid-area: actions; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.hero-cats { grid-area: cats; width: 100%; }

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 11.5px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
}
.hero-title {
    margin-top: 10px;
    font-weight: 300;
    font-size: clamp(34px, 10vw, 46px);
    line-height: 1.12;
    letter-spacing: -0.005em;
    color: var(--cream);
}
.hero-tagline {
    margin-top: 4px;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(20px, 5.4vw, 26px);
    line-height: 1.25;
    color: var(--gold-bright);
}
.hero-desc {
    display: none;
    margin-top: 18px;
    max-width: 30em;
    font-size: 16.5px;
    line-height: 1.7;
    color: var(--cream-dim);
}
.hero-buttons { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: min(100%, 340px); }
.hero-buttons .btn-ghost { display: none; }
.hero-meta { font-size: 12.5px; letter-spacing: 0.04em; color: var(--cream-mute); }

.hero-cats-title { margin-bottom: 10px; font-size: 12.5px; letter-spacing: 0.06em; color: var(--cream-mute); }
.hero-cats-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 -20px;
    padding: 2px 20px 6px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
}
.hero-cats-list::-webkit-scrollbar { display: none; }
.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid rgba(245, 240, 230, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--cream);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
    scroll-snap-align: start;
    transition: border-color 200ms ease, background-color 200ms ease, color 200ms ease, transform 200ms ease;
}
.chip-count { font-size: 11.5px; font-weight: 400; color: var(--gold); }
@media (hover: hover) {
    .chip:hover { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-pale); }
}
.chip:active { transform: scale(0.97); }

/* ── closed book ── */
.hero-book {
    --bw: clamp(176px, calc((100vh - 330px) * 0.7074), 290px);
    --bw: clamp(176px, calc((100svh - 330px) * 0.7074), 290px);
    position: relative;
    padding: 6px 22px 26px 8px;
    perspective: 1800px;
}
.book {
    position: relative;
    display: block;
    width: var(--bw);
    aspect-ratio: 1100 / 1555;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.book img { -webkit-user-drag: none; }
.book:focus-visible { outline-offset: 10px; border-radius: 6px; }
.book-float, .book-tilt, .book-body {
    position: absolute;
    inset: 0;
    display: block;
    transform-style: preserve-3d;
}
.book-float { animation: book-float 7s ease-in-out infinite; }
@keyframes book-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.book-tilt { transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); }
.book-body {
    transform: rotateY(-17deg) rotateX(5deg) rotateZ(-1deg);
    transition: transform 700ms var(--ease-out);
}
.book-inner {
    position: absolute;
    inset: 0.9% 0 0.9% 0;
    display: block;
    overflow: hidden;
    border-radius: 1px 4px 4px 1px;
    background: #f7f2e8;
    transform: translateZ(-1px);
    box-shadow: inset 10px 0 18px -10px rgba(0, 0, 0, 0.45);
}
.book-inner img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book-edges {
    position: absolute;
    top: 1.3%; bottom: 1.3%;
    right: -11px;
    width: 12px;
    display: block;
    border-radius: 0 3px 3px 0;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.35), transparent 45%, rgba(0, 0, 0, 0.18)),
        repeating-linear-gradient(180deg, #f1e7d1 0 1px, #cdbd9a 1px 2px);
    box-shadow: 1px 0 0 rgba(0, 0, 0, 0.35);
    transform: translateZ(-2px);
}
.book-cover {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: 2px 6px 6px 2px;
    transform-origin: 0 50%;
    transform: translateZ(1px) rotateY(0deg);
    transition: transform 800ms var(--ease-out);
    box-shadow:
        0 2px 0 1px rgba(0, 0, 0, 0.35),
        0 40px 70px -26px rgba(0, 0, 0, 0.85),
        0 14px 30px -12px rgba(0, 0, 0, 0.6);
}
.book-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book-spine {
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 5.5%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(255, 255, 255, 0.14) 45%, rgba(0, 0, 0, 0.1) 70%, transparent);
    pointer-events: none;
}
.book-sheen {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 28%, rgba(255, 255, 255, 0.24) var(--sheen, 46%), transparent 64%);
    mix-blend-mode: soft-light;
    pointer-events: none;
}
.book-shadow {
    position: absolute;
    left: 4%; right: -4%;
    bottom: -8px;
    height: 36px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.62), transparent 70%);
    filter: blur(3px);
    transition: transform 700ms var(--ease-out), opacity 700ms var(--ease-out);
    pointer-events: none;
}
@media (hover: hover) {
    .book:hover .book-body { transform: rotateY(-9deg) rotateX(3deg) rotateZ(-0.5deg) translateY(-10px); }
    .book:hover .book-cover { transform: translateZ(1px) rotateY(-19deg); }
    .book:hover .book-shadow { transform: scale(0.9); opacity: 0.7; }
}
.book.is-peek .book-cover { animation: book-peek 1500ms var(--ease-out) 1; }
@keyframes book-peek {
    0%, 100% { transform: translateZ(1px) rotateY(0deg); }
    45% { transform: translateZ(1px) rotateY(-22deg); }
}
.book.is-launching { visibility: hidden; }
body.reader-open .book-float { animation-play-state: paused; }

/* ── desktop: copy on the left, book on the right ── */
@media (min-width: 900px) {
    .site-logo img { height: 34px; }
    .site-link { display: inline-block; }
    .site-top { padding: calc(var(--safe-t) + 26px) 48px 0; }
    .hero {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "head book" "actions book" "cats book";
        grid-template-rows: auto auto auto;
        align-content: center;
        justify-items: start;
        column-gap: clamp(48px, 7vw, 120px);
        row-gap: 0;
        padding: 24px 56px 56px;
        text-align: left;
    }
    .hero-head { align-items: flex-start; }
    .hero-eyebrow::before { content: ""; width: 36px; height: 1px; background: var(--gold-line); }
    .hero-title { font-size: clamp(44px, 4.6vw, 68px); margin-top: 18px; white-space: nowrap; }
    .hero-tagline { font-size: clamp(24px, 2.3vw, 32px); }
    .hero-desc { display: block; }
    .hero-actions { align-items: flex-start; margin-top: 34px; width: auto; gap: 14px; }
    .hero-buttons { flex-direction: row; width: auto; gap: 12px; }
    .hero-buttons .btn-ghost { display: inline-flex; }
    .hero-cats { margin-top: 38px; max-width: 560px; }
    .hero-cats-title { margin-bottom: 12px; }
    .hero-cats-list { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
    .hero-book {
        --bw: clamp(240px, min(calc((100vh - 190px) * 0.61), 31vw), 430px);
        align-self: center;
        justify-self: center;
        padding: 10px 30px 36px 12px;
    }
    .book-edges { right: -14px; width: 15px; }
    .book-shadow { bottom: -14px; height: 46px; }
}
@media (min-width: 900px) and (max-height: 700px) {
    .hero-title { font-size: clamp(42px, 4.2vw, 58px); margin-top: 12px; }
    .hero-desc { margin-top: 12px; }
    .hero-actions { margin-top: 24px; }
    .hero-cats { margin-top: 26px; }
}

/* phones held sideways: copy beside the book so the button stays on screen */
@media (min-width: 600px) and (max-width: 899px) and (max-height: 540px) {
    .site-top { padding-top: calc(var(--safe-t) + 10px); }
    .site-logo img { height: 26px; }
    .hero {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "head book" "actions book" "cats book";
        justify-items: start;
        align-content: center;
        column-gap: 32px;
        row-gap: 0;
        padding: 6px max(28px, var(--safe-r)) calc(12px + var(--safe-b)) max(28px, var(--safe-l));
        text-align: left;
    }
    .hero-head { align-items: flex-start; }
    .hero-title { font-size: 34px; margin-top: 6px; }
    .hero-tagline { font-size: 20px; }
    .hero-actions { align-items: flex-start; margin-top: 14px; gap: 8px; }
    .hero-buttons { width: auto; }
    .btn-primary { height: 48px; }
    .hero-cats { margin-top: 14px; max-width: 100%; min-width: 0; }
    .hero-cats-title { display: none; }
    .hero-book { --bw: clamp(140px, calc((100svh - 70px) * 0.64), 230px); align-self: center; padding: 4px 18px 20px 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .book-float { animation: none; }
    .book.is-peek .book-cover { animation: none; }
    .book-body, .book-cover, .book-shadow { transition: none; }
}
