.hero__masthead {
    font-family: var(--font-display);
}

.book-stage {
    position: relative;
    align-self: center;
    display: grid;
    grid-template-areas: 'book';
    align-items: center;
    min-inline-size: 0;
    padding-block: 1rem clamp(4.75rem, 9svh, 7.5rem);
}

.book-closed,
.book-open {
    container-type: inline-size;
    grid-area: book;
    min-inline-size: 0;
}

.book-closed {
    justify-self: start;
    inline-size: min(100%, clamp(23rem, 44vw, 44rem));
}

.book-cover {
    display: grid;
    inline-size: 100%;
    justify-items: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--paper-strong);
}

.book-cover__face {
    position: relative;
    isolation: isolate;
    display: block;
    inline-size: calc(100% - 10px);
    border-radius: 3px 5px 5px 3px;
    box-shadow: -3px 3px 0 1px #0a2324, -2px 10px 0 #091e20, 2px 19px 32px #000b;
}

.book-cover__face::before {
    position: absolute;
    z-index: -1;
    inset: 6px -10px -10px 0;
    border: 3px solid #103438;
    border-radius: 3px 6px 6px 4px;
    background: repeating-linear-gradient(0deg, #92653a 0 1px, #c6a779 1px 3px);
    content: '';
}

.book-cover__face img {
    inline-size: 100%;
    border-radius: inherit;
    transition: filter 180ms ease;
}

.book-cover:hover img {
    filter: brightness(1.13);
}

.book-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-block-size: 44px;
    padding-inline: 0.55rem;
    color: var(--paper-strong);
    font: 700 1.16rem/1.2 var(--font-display);
    text-shadow: 0 2px 8px #000;
}

.book-label .diamond {
    color: #d6a867;
    inline-size: 0.55rem;
    block-size: 0.55rem;
}

.book-cover .book-label {
    margin-block-start: 0.7rem;
}

.book-cover:hover .book-label,
.book-close:hover {
    text-decoration: underline;
    text-underline-offset: 0.23em;
}

.book-closed .actions {
    margin-block-start: clamp(0.55rem, 1.8svh, 1rem);
}

.book-stage .button {
    font-family: var(--font-display);
    font-weight: 700;
}

.book-open {
    visibility: hidden;
    justify-self: center;
    inline-size: min(100%, 72rem, max(30rem, calc((100svh - 13.75rem) * 1.96)));
    text-align: center;
    pointer-events: none;
}

.book-stage[data-open] .book-open {
    visibility: visible;
    pointer-events: auto;
}

.book-stage[data-open] .book-closed,
.book-stage[data-turning] .book-closed,
.book-stage[data-turning] .book-open {
    visibility: hidden;
    pointer-events: none;
}

.book-spread {
    position: relative;
    isolation: isolate;
    display: grid;
    align-items: center;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    aspect-ratio: 1.96;
    gap: clamp(1.1rem, 2.8vw, 2.8rem);
    padding: clamp(2rem, 5vw, 5rem);
    border: 5px solid #12373a;
    border-radius: 10px 10px 8px 8px;
    background:
        linear-gradient(90deg, #0000 46%, #72532924 49.5%, #41292039 50%, #9b6c2c16 50.75%, #0000 54%),
        #ead7ad url('/assets/book-page.webp') center / cover;
    box-shadow: 0 3px 0 3px #1a1810, 0 9px 0 0 #96774a, 0 12px 0 2px #102b2a, 0 24px 44px #000b;
    color: #302012;
}

.book-copy h1 {
    color: #281a0e;
    font: 700 clamp(2.65rem, 6.6cqi, 5.7rem)/0.97 var(--font-display);
    letter-spacing: -0.065em;
}

.book-hook {
    margin-block: 0.7rem 0;
    font: 700 clamp(1.08rem, 1.9vw, 1.68rem)/1.17 var(--font-display);
}

.book-rule {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: clamp(0.8rem, 2.1vw, 1.6rem) auto;
    max-inline-size: 14rem;
    color: #94652f;
}

.book-rule::before,
.book-rule::after {
    flex: 1;
    block-size: 1px;
    background: currentColor;
    content: '';
}

.book-description {
    margin-inline: auto;
    max-inline-size: 36ch;
    font: 400 clamp(1rem, 1.45vw, 1.25rem)/1.4 var(--font-display);
}

.book-open .actions {
    justify-content: center;
    margin-block-start: clamp(1rem, 2vw, 1.8rem);
}

.book-open .actions:empty {
    min-block-size: 3rem;
}

.book-open .button {
    min-block-size: 3rem;
    padding: 0.65rem 0.85rem;
    color: var(--paper);
    font-size: clamp(0.95rem, 1.3vw, 1.1rem);
}

.book-open .button::before {
    border: 0;
    background: #8b6331;
}

.book-open .button::after {
    position: absolute;
    z-index: -1;
    inset: 1px;
    clip-path: var(--corner);
    background: #24190f;
    content: '';
}

.book-open .button:hover::after {
    background: #3f2a18;
}

.book-open .button:focus-visible {
    outline-color: #402813;
}

.book-open .button img {
    filter: invert(88%) sepia(27%) saturate(359%) hue-rotate(347deg);
}

.book-hunters {
    inline-size: 100%;
    object-fit: contain;
}

.book-close {
    margin-block-start: 0.85rem;
    border: 0;
    background: none;
}

.book-motion {
    position: absolute;
    z-index: 2;
    inset: 0;
    perspective: 1900px;
    perspective-origin: 50% 45%;
    pointer-events: none;
}

.book-motion__pages,
.book-motion__hinge {
    position: absolute;
}

.book-motion__pages {
    border: 4px solid #12373a;
    border-radius: 4px;
    box-shadow: 1px 8px 0 #9f7e4b, 0 13px 0 1px #102b2a, 0 22px 28px #0009;
    background: #ead7ad url('/assets/book-page.webp') right center / cover;
}

.book-motion__hinge {
    transform-origin: left center;
    transform-style: preserve-3d;
}

.book-motion__cover,
.book-motion__lining {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    border-radius: 4px;
    backface-visibility: hidden;
}

.book-motion__cover {
    object-fit: contain;
    background: #12373a;
    box-shadow: 0 8px 23px #000b;
}

.book-motion__lining {
    border: 4px solid #12373a;
    background: #ead7ad url('/assets/book-page.webp') left center / cover;
    box-shadow: 0 8px 0 #9f7e4b;
    transform: rotateY(180deg);
}

@media (max-width: 800px) {
    .book-spread {
        gap: 1.25rem;
        padding: 2rem 1.6rem;
    }
}

@media (max-width: 640px) and (orientation: portrait) {
    .book-stage {
        align-self: end;
        padding-block: 1rem max(5.1rem, calc(4rem + env(safe-area-inset-bottom)));
    }

    .book-closed {
        inline-size: 100%;
    }

    .book-open {
        inline-size: 100%;
    }

    .book-cover .book-label {
        margin-block-start: 0.55rem;
    }

    .book-closed .actions {
        justify-content: center;
    }

    .book-spread {
        aspect-ratio: auto;
        grid-template-columns: 1fr;
        padding: 1.65rem 1rem 1.35rem;
        background: #ead7ad url('/assets/parchment.webp') center / cover;
    }

    .book-copy h1 {
        font-size: clamp(2.5rem, 11.6vw, 3.65rem);
    }

    .book-hunters {
        block-size: clamp(6rem, 19svh, 11rem);
    }

    .book-description {
        max-inline-size: 26ch;
    }

    .book-open .actions {
        display: grid;
        grid-template-columns: 1.18fr 1fr;
        gap: 0.5rem;
    }

    .book-open .button {
        min-inline-size: 0;
    }

    .book-open .actions:empty {
        min-block-size: 3.1rem;
    }
}

@media (max-width: 374px) {
    .book-stage .button {
        padding-inline: 0.7rem;
        min-block-size: 3rem;
        gap: 0.45rem;
        font-size: 0.9rem;
    }

    .book-spread {
        padding: 1.1rem 0.65rem;
        gap: 0.75rem;
    }

    .book-open .button {
        padding-inline: 0.55rem;
    }

    .book-hunters {
        block-size: 5.5rem;
    }

    .book-rule {
        margin-block: 0.6rem;
    }
}

@media (max-width: 374px) and (max-height: 625px) and (orientation: portrait) {
    .book-stage {
        padding-block-end: max(4.5rem, calc(4rem + env(safe-area-inset-bottom)));
    }

    .book-hunters {
        block-size: 4.5rem;
    }

    .book-open .actions {
        margin-block-start: 0.75rem;
    }

    .book-close {
        margin-block-start: 0.5rem;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .book-stage {
        align-self: end;
        padding-block: 0.3rem 0.9rem;
    }

    .book-closed {
        inline-size: min(56vw, 22rem);
    }

    .book-closed .actions {
        display: grid;
        grid-template-columns: 1.22fr 1fr;
        gap: 0.55rem;
    }

    .book-closed .button {
        min-inline-size: 0;
        padding-inline: 0.7rem;
    }

    .book-open {
        inline-size: min(76vw, 43rem, max(25rem, calc((100svh - 8.5rem) * 2.35)));
    }

    .book-spread {
        padding: 1rem 1.5rem;
        aspect-ratio: 2.35;
    }

    .book-copy h1 {
        font-size: 2.2rem;
    }

    .book-hook {
        margin-block-start: 0.35rem;
        font-size: 1.05rem;
    }

    .book-rule {
        margin-block: 0.5rem;
    }

    .book-description {
        font-size: 0.92rem;
        line-height: 1.3;
    }

    .book-open .actions {
        display: grid;
        grid-template-columns: 1.16fr 1fr;
        gap: 0.45rem;
        margin-block-start: 0.65rem;
    }

    .book-open .button {
        min-inline-size: 0;
        min-block-size: 2.75rem;
        gap: 0.38rem;
        padding-inline: 0.55rem;
        font-size: 0.88rem;
    }

    .book-close {
        margin-block-start: 0.45rem;
    }
}
