/* ---------------------------------------------------------------
   Top section (header + hero) — responsive
   The artwork is a single wide illustration (2:1), so from xl up
   the block keeps that ratio and everything inside scales in vw with it.
   Below xl the ratio is dropped: the box grows with its content, the
   absolutely-placed book/pencils give way to the in-flow pair in the
   markup, and the type falls back to sizing that fits a narrow screen.
   ---------------------------------------------------------------- */
#hero-top {
    background-position: center bottom;
}

/* Desktop artwork: assets/hero/top-hero.webp (2560x1280). The full-width
   source ("hero image.png", 5:2) is scaled to 2560 wide and its sky extended
   upward to reach 2:1, rather than cropped from the side — a side crop
   enlarges the podium and pushes it under the copy. This keeps the podium
   where the old art had it (centre ~74.5% across, top face 80-88% down), so
   the book sits at the same right offset and is stretched 100% 100%
   without distortion. */
@media (min-width: 1024px) {
    #hero-top {
        background-image: url('../assets/hero/top-hero.webp');
    }
}

@media (min-width: 1280px) {
    #hero-top {
        aspect-ratio: 2 / 1;
    }
}

/* ------------------------------------------------------------------
   The book on the podium is a carousel of flat cover scans now
   (js/modules/hero-books.js) rather than one fixed 3D mockup, so it is
   bound the same way the New Launches shelf binds its covers: the
   .book-3d shell in css/02-book-shelf.css draws the fore edge, the
   spine crease and the turn around the artwork. Only what differs is
   set here — this one is the size of two shelf slots and is the first
   thing on the page, so it is turned further and bound thicker, and
   its shell fills a card sized in % of the hero rather than a slot on
   a fixed-height track.
   ------------------------------------------------------------------ */
.hero-book-card .book-3d {
    /* Turned the opposite way to the shelf, which is what the podium art has
       always wanted: the spine edge goes back, the fore edge comes forward, so
       the page block reads as a real side face instead of a painted strip. */
    --book-turn: -12deg;
    --book-thickness: 8%;
    width: 100%;
    /* The cover crossfade (js/modules/hero-books.js) fades the shell, so the
       drawn edges go with the artwork instead of hanging in the air. */
    transition: opacity 420ms ease;
}

.hero-book-card .book-cover {
    /* The card carries the width; the cover fills it and the shell
       shrink-wraps to whatever height the artwork's ratio gives. */
    width: 100%;
    height: auto;
    max-height: none;
}

.hero-book-card .book-3d,
.hero-book-card .book-cover {
    border-radius: 3px 6px 6px 3px;
}

.hero-book-card .book-3d::before {
    border-radius: 0 4px 4px 0;
}

@media (prefers-reduced-motion: reduce) {
    .hero-book-card .book-3d { transition: none; }
}

/* ------------------------------------------------------------------
   Mobile hero book — parked on the podium painted into top-new-mobile.png
   (864x1821). The podium's top face sits at y 1481-1571 with its centre
   at x 455, so the contact point is 15.7% up from the bottom of the art
   and 52.7% across. Two regimes, because `bg-cover` switches axis at the
   point where min-h stops being 230vw and clamps to 1080px (W ~ 470px):
   below that the art is scaled by height, above it by width.
   ------------------------------------------------------------------ */
[data-hero-book-card-mobile] {
    left: 51.6%;
    transform: translateX(-50%);
    /* Width-driven, because the .book-3d shell has to hug the artwork for its
       fore edge to land on the cover's own edge. The third term is the old
       `max-height: 30vh` restated as a width: covers run about 1.35 tall. */
    width: min(42vw, 210px, 22vh);
    bottom: 15.7%;
}

[data-hero-shadow-mobile] {
    left: 51.6%;
    transform: translateX(-50%);
    width: 30vw;
    height: 3.4vw;
    bottom: 15.2%;
}

@media (min-width: 470px) {
    [data-hero-book-card-mobile] {
        bottom: 15.7%;
    }

    [data-hero-shadow-mobile] {
        bottom: 15.2%;
    }
}

/* Keep the text above the artwork on narrow screens, including Safari with
   its toolbar expanded. The background and podium use the same width scale. */
@media (max-width: 1023px) {
    #hero-top {
        height: auto;
        min-height: 100vh;
        min-height: 100svh;
        background-size: 100% auto;
        background-position: center bottom;
    }

    #hero-top > #site-header {
        flex-shrink: 0;
    }

    #hero {
        flex: 1 0 auto;
        /* Podium offset + book height allowance + clearance below the copy. */
        padding-bottom: calc(33.1vw + min(63vw, 315px) + 32px);
    }

    [data-hero-book-card-mobile] {
        left: 52.7%;
        width: min(42vw, 210px);
        bottom: 33.1vw;
    }

    [data-hero-shadow-mobile] {
        left: 52.7%;
        bottom: 32vw;
    }
}

/* The gap between the headline and the copy is set here rather than left to
   the mt-* utilities in the markup, so the clearance is one number to tune. */
#hero h1 + p,
#hero p {
    margin-top: 1.25rem;
}

@media (min-width: 1024px) {

    #hero h1 + p,
    #hero p {
        margin-top: 2.5rem;
    }
}

/* Headline + copy scale with the art instead of jumping at breakpoints */
#hero h1 > span {
    font-size: min(10.3vw, 51px);
}

#hero h1 > span.font-brush {
    font-size: min(8.8vw, 46px);
}

#hero p {
    font-size: clamp(13px, 3.6vw, 16px);
}

@media (min-width: 1280px) {
    #hero h1 > span {
        font-size: min(5.1vw, 90px);
    }

    #hero h1 > span.font-brush {
        font-size: min(5.2vw, 92px);
    }

    #hero p {
        font-size: clamp(14px, 1.15vw, 19px);
    }
}

/* Hero Section */
.hero {
    position: relative;
    padding: 150px 0 100px;
    background: linear-gradient(135deg, var(--light-blue) 0%, #dbeafe 100%);
    overflow: hidden;
}

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 10;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-title {
    color: var(--dark-blue);
    line-height: 1.1;
    margin-bottom: 25px;
}

.hero-title text {
    display: block;
}

.hero-title {
    font-weight: 800;
    font-size: 68px;
}

.hero-title .brush-text {
    font-family: var(--font-brush);
    font-weight: 700;
}

.hero-title .brush-text.red {
    font-size: 58px;
    color: var(--brush-red);
}

.hero-title .brush-text.blue {
    font-size: 64px;
    color: var(--brush-blue);
}

.hero-paragraph {
    font-weight: 400;
    font-size: 20px;
    color: var(--text-dark);
    margin-bottom: 40px;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.book-mockup {
    width: 300px;
    height: 400px;
    background: white;
    border-radius: 10px 20px 20px 10px;
    box-shadow: -5px 10px 30px rgba(0,0,0,0.2), inset 5px 0 15px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
    transform: perspective(1000px) rotateY(-15deg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 15px solid #f1f1f1;
}

.book-cover {
    text-align: center;
    color: var(--dark-blue);
}

.podium {
    position: absolute;
    bottom: -50px;
    width: 400px;
    height: 100px;
    background: linear-gradient(to bottom, #fde047, #eab308);
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 20px 30px rgba(0,0,0,0.1);
}

.podium::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 20px;
    width: 360px;
    height: 90px;
    background: #fef08a;
    border-radius: 50%;
}

