/* ===========================================================
   TMME — book detail page styles
   =========================================================== */

/* SelawikBook — heavier font face used on book-detail and about pages.
   The base 'Selawik' family in tmme-base.css is tuned for the homepage
   (Semilight body, Semibold bold). Book-detail pages need more contrast,
   so this declares a distinct family name with Regular/Bold weights.
   The :root override below puts SelawikBook first in --tmme-font-body
   for weights 400 and 700; weights 300 (Light) and 500 (Medium) fall
   through to 'Selawik' which still has them.
   IMPORTANT: keep these @font-face rules OUTSIDE any @layer block —
   that way they participate in font-matching at the highest priority.
   The variable override below also keeps this load-order-independent. */
@font-face {
    font-family: 'SelawikBook';
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/selawik/selawkl.woff2') format('woff2');
}
@font-face {
    font-family: 'SelawikBook';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/selawik/selawk.woff2') format('woff2');
}
@font-face {
    font-family: 'SelawikBook';
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/selawik/selawk-medium.woff2') format('woff2');
}
@font-face {
    font-family: 'SelawikBook';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('/assets/fonts/selawik/selawkb.woff2') format('woff2');
}

@layer reset, base, layout, components, utilities;

@layer reset {
    *, *::before, *::after { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; }
    img { max-width: 100%; height: auto; display: block; }
    a { color: inherit; text-decoration: none; }
    button { font: inherit; cursor: pointer; }
    ul { list-style: none; padding: 0; margin: 0; }
}

@layer base {
    :root {
        --color-text: #000;
        --color-bg: #fff;
        --color-circle: rgba(0, 0, 0, 0.05);
        --color-rule: #d9d9d9;
        --color-accent: rgb(94, 173, 187);
        --color-cart-bg: rgb(250, 249, 245);

        /* Override the inherited Selawik stack to put SelawikBook (Regular/Bold)
           first; missing weights (300, 500) fall through to base 'Selawik'. */
        --tmme-font-body: 'SelawikBook', 'Selawik', 'Segoe UI', system-ui, sans-serif;
        --font-body: var(--tmme-font-body);

        --container-max: 1140px;
        --container-pad: 20px;

        --z-circle: 0;
        --z-content: 2;
        --z-header: 5;
        --z-topbar: 6;
        --z-cart: 50;
    }

    body {
        font-family: var(--font-body);
        font-size: 16px;
        line-height: 24px;
        color: var(--color-text);
        background: var(--color-bg);
        overflow-x: hidden;
        position: relative;
    }

    /* Grey circle behind hero — centered horizontally */
    body::before {
        content: "";
        position: absolute;
        top: -570px;
        left: 50%;
        transform: translateX(-50%);
        width: 1140px;
        height: 1140px;
        border-radius: 50%;
        background: var(--color-circle);
        z-index: var(--z-circle);
        pointer-events: none;
    }
}

@layer layout {
    .container {
        max-width: var(--container-max);
        margin: 0 auto;
        padding-left: var(--container-pad);
        padding-right: var(--container-pad);
        width: 100%;
    }
}

@layer components {

    /* Hero */
    .hero {
        position: relative;
        z-index: var(--z-content);
    }
    .hero__inner {
        padding-top: 120px;
        padding-bottom: 145px;
        padding-left: 0;
        padding-right: 0;
        display: flex;
        align-items: flex-start;
        gap: 20px;
    }

    .hero__cover {
        flex: 0 1 576px;
        min-width: 0;
        padding-right: 80px;
        position: relative;
        display: flex;
        justify-content: flex-end;
        align-items: flex-start;
        height: 449px;
    }
    /* The shadow is drawn from a frame that takes the cover's own size, in % of the cover: 508 x 674 for
       a 284 x 449 cover. Its solid part then ends at the cover's bottom edge for every shape (square
       board books, wide cloth covers, tall booklets) instead of showing below shorter covers. */
    .hero__frame {
        position: relative;
        flex: 0 1 284px;
        max-width: 284px;
        min-width: 0;
    }
    .hero__frame::after {
        content: "";
        position: absolute;
        right: 0;
        top: 0;
        width: 178.87%;   /* 508 / 284 */
        height: 150.11%;  /* 674 / 449 */
        background: url("/assets/images/shadows/book-cover-shadow.png")
                    no-repeat right top / 100% 100%;
        z-index: 0;
        opacity: 0.8;
        pointer-events: none;
    }
    .hero__cover img {
        position: relative;
        z-index: 1;
        display: block;   /* no gap under the picture, so the frame is exactly the cover's height */
        width: 100%;
        max-width: 284px;
        min-width: 0;
        height: auto;
    }

    .hero__text {
        flex: 0 1 544px;
        min-width: 0;
        padding: 72px 10px 0;  /* shrunk from 80px so status/title/subtitle sit 8px higher; .book-subtitle's mb (or .book-title's mb when no subtitle) absorbs the same 8px so author and below stay put */
    }

    .breadcrumbs {
        font-size: 12px;
        line-height: 18px;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: var(--color-text);
        margin-bottom: 52px;
    }
    .breadcrumbs__sep { margin: 0 6px; }

    .book-title {
        font-size: 33px;
        font-weight: 400;
        line-height: 44.8px;
        letter-spacing: 4.7px;
        text-transform: uppercase;
        color: var(--color-text);
        margin: 0 0 60px;  /* default = no-subtitle case; +8 absorbs the 8px shrunk from .hero__text padding-top so author stays fixed */
    }
    /* When a subtitle follows, revert title margin-bottom to the original 52px;
       .book-subtitle's own mb takes over the +8 absorption duty. */
    .book-title:has(+ .book-subtitle) { margin-bottom: 52px; }
    .book-author {
        font-size: 25px;
        font-weight: 300;
        line-height: 25px;
        margin: 0 0 20px;
    }
    /* Price — custom dropdown (closed: bare trigger, open: floating grey panel) */
    .book-price {
        display: flex;
        flex-direction: column;
        gap: 14px;
        margin: 0 0 32px;
        max-width: 220px;
    }
    .book-price__select {
        position: relative;
        align-self: flex-start;
    }
    .book-price__trigger {
        display: inline-flex;
        align-items: center;
        gap: 12px;
        background: transparent;
        border: none;
        padding: 8px 4px 8px 0;
        font-family: var(--font-body);
        font-size: 14px;
        font-weight: 500;
        letter-spacing: 0.4px;
        line-height: 1;
        color: var(--color-text);
        cursor: pointer;
        min-height: 24px;
    }
    .book-price__trigger:focus { outline: none; }
    .book-price__trigger:focus-visible {
        outline: 2px solid var(--color-accent);
        outline-offset: 6px;
    }
    .book-price__chevron {
        flex: 0 0 auto;
        color: var(--color-text);
        transition: transform 200ms ease;
    }
    .book-price__select[data-open="true"] .book-price__chevron {
        transform: rotate(180deg);
    }
    .book-price__list {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        min-width: 100%;
        margin: 0;
        padding: 10px;
        background: #f2f2f2;
        border: none;
        border-radius: 4px;
        box-shadow:
            0 12px 32px -8px rgba(0, 0, 0, 0.18),
            0 4px 10px -4px rgba(0, 0, 0, 0.08);
        list-style: none;
        z-index: 10;
        opacity: 0;
        transform: translateY(-6px) scale(0.985);
        transform-origin: top left;
        transition: opacity 180ms ease, transform 180ms ease;
        pointer-events: none;
    }
    .book-price__select[data-open="true"] .book-price__list {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
    .book-price__option {
        padding: 14px 28px 14px 22px;
        font-family: var(--font-body);
        font-size: 14px;
        font-weight: 400;
        letter-spacing: 0.3px;
        line-height: 1;
        color: var(--color-text);
        cursor: pointer;
        border-radius: 3px;
        transition: background 120ms ease;
        white-space: nowrap;
    }
    .book-price__option:hover,
    .book-price__option:focus {
        background: rgba(0, 0, 0, 0.06);
        outline: none;
    }
    .book-price__option[aria-selected="true"] {
        font-weight: 500;
    }
    .book-price__option:active {
        transform: scale(0.98);
    }
    .book-price__amount {
        font-size: 22px;
        font-weight: 400;
        line-height: 1;
        color: var(--color-text);
        font-feature-settings: "tnum" 1, "lnum" 1;
        display: inline-flex;
        align-items: baseline;
        gap: 8px;
    }
    .book-price__currency {
        font-size: 12px;
        font-weight: 500;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: var(--color-accent);
    }

    /* ADD TO CART button */
    .buy-from__main {
        background: #000;
        color: #fff;
        padding: 12px 24px;
        font-size: 12px;
        font-weight: 500;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        border: none;
        border-radius: 0;
        line-height: 12px;
        min-width: 170px;
        height: 36px;
        text-align: center;
        transition: background 120ms ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
    }
    .buy-from__main:hover { background: #333; }

    /* Meta row */
    .meta {
        position: relative;
        z-index: var(--z-content);
        background: var(--color-bg);
    }
    .meta__inner {
        padding-top: 22px;
        padding-bottom: 22px;
        border-top: 1px solid var(--color-rule);
        border-bottom: 1px solid var(--color-rule);
        display: grid;
        /* --meta-cols is set on the element: catalogue items can have fewer than 4 details. */
        grid-template-columns: repeat(var(--meta-cols, 4), 1fr);
        gap: 20px;
        text-align: center;
    }
    .meta__label {
        font-size: 16px;
        font-weight: 500;
        margin: 0 0 4px;
        line-height: 16px;
    }
    .meta__value {
        font-size: 16px;
        font-weight: 300;
        margin: 0;
        line-height: 16px;
    }

    /* Description */
    .description { position: relative; z-index: var(--z-content); }
    .description__inner { padding: 100px 20px 20px; }
    .description__inner p {
        font-size: 16px;
        line-height: 28.8px;
        margin: 0 0 14.4px;
        font-weight: 400;
    }
    .description__inner p.lede { font-weight: 500; }
    /* Bullet / numbered lists inside a publisher description: same type as the paragraphs. */
    .description__inner ul,
    .description__inner ol { margin: 0 0 14.4px; padding-left: 20px; }
    .description__inner ul { list-style: disc; }
    .description__inner ol { list-style: decimal; }
    .description__inner li { font-size: 16px; line-height: 28.8px; font-weight: 400; }
    .description__inner strong { font-weight: 500; }
    .description__inner em,
    .description__inner i { font-style: italic; }

    /* Reviews */
    .reviews { position: relative; z-index: var(--z-content); }
    .reviews__inner { padding: 0 20px 60px; }
    .reviews__heading {
        font-size: 26px;
        font-weight: 400;
        letter-spacing: 5px;
        text-transform: uppercase;
        margin: 28px 0 32px;
        line-height: 1.2;
    }
    .review { margin-bottom: 22px; }
    .review p { margin: 0 0 4px; line-height: 28.8px; font-size: 16px; }
    .review__source { font-style: italic; }
    .details-list { margin: 0; padding-left: 0; }
    .details-list li { margin-bottom: 12px; line-height: 28.8px; font-size: 16px; }
    .details-list strong { font-weight: 500; }

    /* Books rows ("Other Books" / "Recommended") */
    .books-row {
        position: relative;
        z-index: var(--z-content);
        padding: 0;
    }
    .books-row + .books-row { padding-top: 0; }
    .books-row:last-of-type { padding-bottom: 60px; }
    .books-row .container {
        max-width: 1140px;
        padding-left: 0;
        padding-right: 0;
    }
    .books-row__heading {
        font-size: 26px;
        font-weight: 400;
        letter-spacing: 5px;
        text-transform: uppercase;
        text-align: center;
        margin: 8px 0 16px;
        padding: 32px 0;
        line-height: 1.2;
    }
    /* Two-card layout (Other Books by this Author) — centered, fixed widths */
    .books-row__grid--two {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 48px;
        row-gap: 32px;
    }
    .books-row__grid--two .book-card { flex: 0 0 228px; }

    /* Five-card layout (Recommended): a centred, wrapping row with the old grid's column widths
       (1140 / 5 = 228px). A full row sits exactly where the grid put it; fewer books, or the
       last books on a wrapped line, are centred like "Other Books" (owner, 14 Nov 2026). */
    .books-row__grid--five {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 1140px;
        margin: 48px auto 0;
        row-gap: 32px;
    }
    .books-row__grid--five .book-card {
        flex: 0 0 20%;
        max-width: 228px;
        padding: 0 10px;
    }
    .books-row__grid--five .book-card__image {
        width: 100%;
        max-width: 188px;
        aspect-ratio: 188 / 286;
        height: auto;
    }
    .book-card {
        display: block;
        color: var(--color-text);
        padding: 0 20px;
        text-align: left;
    }
    /* Cards show the whole cover, standing on the bottom of the box like the listing pages, so square
       and wide covers are no longer cut. The shadow is a drop-shadow, which follows the picture itself
       rather than the box (a box shadow drew a rectangle around the empty space above short covers). */
    .book-card__image {
        width: 188px;
        height: 286px;
        margin: 0 auto;
        overflow: visible;
        position: relative;
    }
    .book-card__image img,
    .book-card__image .cover-missing {
        filter: drop-shadow(-12px 6px 10px rgba(0, 0, 0, 0.3));
    }
    .book-card__image img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center bottom;
        position: relative;
        z-index: 1;
    }
    .book-card__text { padding-top: 16px; }
    .book-card__title {
        font-size: 18px;
        font-weight: 400;
        margin: 0;
        line-height: 25.5px;
    }
    .book-card__author {
        font-size: 17px;
        font-weight: 400;
        font-style: italic;
        margin: 0;
        line-height: 25.5px;
    }
    .book-card__title {
        line-height: 27px;
    }

    /* Floating cart */
    .floating-cart {
        position: fixed;
        right: 24px; bottom: 24px;
        background: var(--color-cart-bg);
        width: 56px; height: 56px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
        border: none;
        z-index: var(--z-cart);
    }
    .floating-cart__badge {
        position: absolute;
        top: -6px; right: -6px;
        background: #000; color: #fff;
        width: 22px; height: 22px;
        border-radius: 50%;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── Product image carousel ── */
    .product-carousel {
        position: relative;
        z-index: var(--z-content);
        padding-top: 40px;
    }
    .carousel-widget {
        position: relative;
        background: rgb(250, 250, 250);
        overflow: hidden;
    }
    .carousel-track {
        display: flex;
        transition: transform 320ms ease;
        will-change: transform;
    }
    .carousel-slide {
        flex: 0 0 100%;
        min-width: 0;
    }
    .carousel-slide img {
        width: 100%;
        height: 480px;
        object-fit: contain;
        display: block;
    }
    .carousel-ctrl {
        position: absolute;
        top: 0;
        bottom: 40px;
        width: 50px;
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: rgba(0, 0, 0, 0.35);
        z-index: 2;
        transition: color 120ms ease;
    }
    .carousel-ctrl:hover { color: rgba(0, 0, 0, 0.75); }
    .carousel-ctrl--prev { left: 0; }
    .carousel-ctrl--next { right: 0; }
    .carousel-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
        padding: 10px 0 12px;
        background: rgb(250, 250, 250);
    }
    .carousel-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: transparent;
        border: 1.5px solid rgb(114, 171, 191);
        padding: 0;
        cursor: pointer;
        transition: background 120ms ease;
    }
    .carousel-dot--active { background: rgb(114, 171, 191); }
    .carousel-dot:hover { background: rgba(114, 171, 191, 0.5); }

    /* ── Lifestyle section ── */
    .lifestyle-section {
        position: relative;
        z-index: var(--z-content);
    }
    .lifestyle-section__content {
        display: flex;
        flex-direction: column;
        gap: 100px;
        padding: 50px 0 100px;
    }
    .lifestyle-section__banner img {
        width: 100%;
        height: auto;
        display: block;
        aspect-ratio: 5000 / 2637;
        object-fit: cover;
    }
    .lifestyle-section__quote {
        margin: 0 auto;
        max-width: 760px;
        padding: 0 30px;
        text-align: center;
    }
    .lifestyle-section__quote p {
        font-size: 25px;
        font-family: var(--font-body);
        color: rgb(81, 77, 71);
        line-height: 35px;
        margin: 0;
    }

    /* ═══════════════════════════════════════
       TMME ADDITIONS — subtitle, publisher, status badge, sale price, sold-out CTA.
       Designed to slot into the existing hero text column without disturbing the
       layout for books that don't use these features.
       ═══════════════════════════════════════ */

    /* Subtitle — sits under .book-title. Negative top margin pulls subtitle close
       to the title (title-subtitle gap = 52 + (-45) = 7px). The 25px bottom margin
       gives a wider breath between subtitle and author. Net flow contribution is
       +5px vs the no-subtitle case, which is absorbed by the
       .book-subtitle ~ .book-author rule below so the credits line stays put. */
    .book-subtitle {
        font-size: 18px;
        font-weight: 300;
        line-height: 25.2px;
        letter-spacing: 0.3px;
        color: var(--color-text);
        opacity: 0.78;
        margin: -50px 0 38px;  /* title-subtitle gap tightened from 7px → 2px; mb +5 keeps author/credits at same Y */
    }

    /* When subtitle precedes author, trim 5px from author's bottom margin to
       cancel the +5px the subtitle's new margins introduced — so .book-credits
       (or any element below author) sits at the same Y position as a
       subtitle-less hero. */
    .book-subtitle ~ .book-author {
        margin-bottom: 15px;
    }

    /* Combined translator + publisher line — single paragraph that renders
       "Translated by X | Publisher" (or just one side when the other is null). */
    .book-credits {
        font-size: 16px;
        font-weight: 300;
        line-height: 16px;
        margin: 0 0 36px;
    }
    .book-credits em { font-style: italic; }
    .book-credits__sep {
        display: inline-block;
        margin: 0 6px;
        opacity: 0.5;
    }

    /* Status badge (pre-order / sold-out) — small uppercase line above .book-title.
       Color-coded; no background fill, to fit the minimal hero aesthetic.
       Negative top margin (-39px = own 11px height + 28px bottom margin) cancels
       its flow contribution so the title stays at its natural Y even when the
       badge is present. */
    .book-status {
        display: block;
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 2.5px;
        text-transform: uppercase;
        line-height: 1;
        margin: -39px 0 28px;
    }
    .book-status--pre-order { color: rgb(140, 100, 50); }
    /* Charcoal grey (not red) — keeps the warm-red exclusively for the sale-price
       treatment, so "out of stock" and "on sale" don't share a hue. */
    .book-status--sold-out  { color: rgb(80, 80, 80); }

    /* Sale-price treatment — inline within .book-price__amount.
       Original price renders in a true neutral grey (not opacity-fade);
       sale price keeps the warm-red checkout emphasis; a uppercase
       "Save XX%" microcopy chip sits after the sale price. */
    .book-price__original {
        text-decoration: line-through;
        text-decoration-thickness: 1px;
        text-decoration-color: rgb(180, 180, 180);
        font-size: 16px;
        color: rgb(160, 160, 160);
        font-weight: 400;
        margin-right: 6px;
    }
    .book-price__sale {
        color: rgb(140, 30, 30);
        font-weight: 500;
    }
    .book-price__savings {
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: rgb(140, 30, 30);
        margin-left: 4px;
        align-self: center;
        white-space: nowrap;
    }

    /* Sold-out variant of the primary CTA — visually disabled, not interactive. */
    .buy-from__main--sold-out {
        background: rgb(160, 160, 160);
        cursor: not-allowed;
    }
    .buy-from__main--sold-out:hover { background: rgb(160, 160, 160); }
}

@layer utilities {
    .visually-hidden {
        position: absolute;
        width: 1px; height: 1px;
        padding: 0; margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

/* Between 768px–1153px: books-row switches from 5 shrinking columns to 3 fixed-width
   columns so cards wrap to a second row instead of getting smaller. */
@media (max-width: 1153px) and (min-width: 768px) {
    .books-row .container {
        padding-left: var(--container-pad);
        padding-right: var(--container-pad);
    }
    .books-row__grid--five { max-width: 684px; } /* 3 x 228px per line */
    .books-row__grid--five .book-card { flex-basis: 228px; }
}

/* Below 1100px the container loses its auto-margin breathing room, so re-apply
   the 20px horizontal padding on hero__inner that we'd zeroed out at desktop.
   Without this the cover image flushes to the viewport edge at narrow widths. */
@media (max-width: 1100px) {
    .hero__inner {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Mobile: top bar holds everything (flag + logo + hamburger); stacked hero. Matches reference's <=767 breakpoint */
@media (max-width: 767px) {
    /* Books grid 5-col -> 2-col; add container side padding for edge breathing room */
    .books-row .container { padding-left: var(--container-pad); padding-right: var(--container-pad); }
    .books-row__grid--five { row-gap: 48px; }
    .books-row__grid--five .book-card {
        flex-basis: 50%; /* 2 per line; a lone last book is centred */
        max-width: 360px;
        padding: 0 20px;
    }
    .books-row__grid--five .book-card__image {
        max-width: 100%;
    }
    /* Hero: stacked column with reference's actual mobile order:
       title -> author -> translator -> breadcrumbs -> cover -> BUY FROM.
       hero__text uses display:contents so its children become flex children of hero__inner.
       gap:0 + per-element margins to match reference's measured visual gaps at vp=758. */
    .hero__inner { flex-direction: column; align-items: stretch; padding: 122px 20px 80px; gap: 0; text-align: center; }  /* padding-top 130 → 122: shifts status/title/subtitle up 8px (mobile mirror of desktop hero__text padding shrink) */
    .hero__text { display: contents; }
    .book-title { order: 1; margin: 0 0 28px; }  /* default = no-subtitle case; +8 absorbs the 8px shrunk from hero__inner padding-top */
    .book-title:has(+ .book-subtitle) { margin-bottom: 20px; }  /* mobile mirror of desktop :has override */
    .book-author { order: 2; margin: 0 0 20px; }
    .hero__cover { order: 4; flex: 0 0 auto; padding-right: 0; height: auto; justify-content: center; margin: 0 0 60px; }
    .book-price { order: 5; margin: 0 auto 34px; gap: 20px; width: 240px; max-width: 100%; align-items: center; }  /* +6 gap between trigger and amount, -6 margin-bottom → AED line 6px closer to button without button moving */
    .book-price__select { align-self: center; }  /* override desktop's flex-start so trigger sits in the centered column */
    .breadcrumbs { order: 6; justify-content: center; margin: 0 0 80px; }
    /* Cover image stays at natural 284px width even at mobile (matches reference) */
    /* Mobile shadow: 418 x 555 for a 284 x 449 cover, ending 25px inside the cover's right edge, so the
       dark part of the shadow stays hidden behind the cover. In % of the cover, like the desktop one. */
    .hero__frame::after {
        width: 147.18%;   /* 418 / 284 */
        height: 123.61%;  /* 555 / 449 */
        right: 8.8%;      /* 25 / 284 */
    }
    /* BUY FROM at mobile: width matches the cover image (284px), centered. */
    .buy-from__main { order: 7; align-self: center; width: 284px; max-width: 100%; flex: 0 0 auto; padding: 16px; height: 48px; font-size: 16px; line-height: 16px; min-width: 0; }
    /* Title shrinks to 29px at mobile (reference uses 29px / 37.7px lh at vp <=767) */
    .book-title { font-size: 29px; line-height: 37.7px; }
    /* Top tint rectangle — solid var(--color-circle) (rgba(0,0,0,0.05)).
       width:1535px (not 100vw) — Chromium iframe rendering bug with vw on body::before paints only half-width. */
    html { background: var(--color-bg); }
    body { background: transparent; }
    body::before {
        content: "";
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 1535px;
        height: 400px;
        background: var(--color-circle);
        border-radius: 0;
        z-index: -1;
        pointer-events: none;
    }
    /* Body::after CIRCLE at mobile (matches reference's @media 991 rule):
       100vw x 100vw circle with linear-gradient making top half transparent, bottom half tinted.
       The visible bottom-half-of-circle creates the "halo" arch behind the cover area. */
    body::after {
        content: "";
        position: absolute;
        /* Wider-than-viewport ellipse so its bounding-box corners fall OFF-SCREEN —
           this is why reference's render at vp=730 is 949 wide × 730 tall (not 730×730).
           Eliminates the white corners that appear at the body::after bounding box edges. */
        width: 130vw;
        height: 100vw;
        top: min(50vw, calc(400px - 50vw));
        left: -15vw;
        border-radius: 50%;
        background: linear-gradient(transparent 0%, transparent 50%, var(--color-circle) 50%);
        z-index: -1;
        pointer-events: none;
    }
    /* The band and the arch above sit at fixed heights, so a long title ran out of the grey onto a white
       strip, and up to 540px the band (see the 540px rule) ended up to 80px above the arch (0px at 320px
       wide, 80px from 400px to 540px) and 400px from the left. The three layers below make the grey run
       from the top of the page down to whichever is lower, the arch or the top of the cover, and then
       curve away like the arch. They are opaque (the same grey laid over the page colour), so where they
       overlap the band, the arch or each other nothing turns darker; they have no hard colour stops
       inside them, which drew a light hairline on 2.6x-3.5x screens. z-index:-1 keeps them under the
       hero's text, cover and shadow; the header sits above the hero. The cover box starts 20px in from
       the page edge (.hero__inner's side padding above). */
    /* Page top down to 1px past where the arch starts (min(100vw, 400px)), so no line shows at the join. */
    .hero::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: calc(min(100vw, 400px) + 1px);
        background: linear-gradient(var(--color-circle), var(--color-circle)), var(--color-bg);
        z-index: -1;
        pointer-events: none;
    }
    /* Page top down to the top of the cover, however long the title is; exactly the page's width. */
    .hero__cover::before {
        content: "";
        position: absolute;
        bottom: 100%;
        left: -20px;
        right: -20px;
        height: 3000px;
        background: linear-gradient(var(--color-circle), var(--color-circle)), var(--color-bg);
        z-index: -1;
        pointer-events: none;
    }
    /* The arch's lower half again (130vw x 50vw, centred on 50vw like body::after), starting 1px above
       the top of the cover so no line shows where it meets the layer above: with a long title it carries
       the curve down with the cover. With a short title it lies inside the band and arch above. */
    .hero__cover::after {
        content: "";
        position: absolute;
        top: -1px;
        left: calc(-15vw - 20px);
        width: 130vw;
        height: 50vw;
        border-radius: 0 0 50% 50% / 0 0 100% 100%;
        background: linear-gradient(var(--color-circle), var(--color-circle)), var(--color-bg);
        z-index: -1;
        pointer-events: none;
    }
    /* Meta section: 2-column grid at mobile + 16px horizontal margin (inset borders) + 16px padding.
       Extra top/bottom padding so the rules sit further from ISBN row above and Pages row below. */
    /* width:auto: .container's width:100% plus these 16px margins made the row 32px wider than the phone. */
    .meta__inner { grid-template-columns: repeat(2, 1fr); width: auto; margin-left: 16px; margin-right: 16px; padding: 36px 16px; gap: 0 16px; }
    .meta__inner > * { padding: 0 0 32px; }
    .meta__inner > *:nth-last-child(-n+2) { padding-bottom: 0; }
    /* Description: gap above + wider horizontal inset so paragraphs aren't flush to viewport edge. */
    .description__inner { padding: 32px 32px 20px; }
    /* Match the same 32px inset for Details list, product carousel and lifestyle banners.
       Books-row sections (Other Books, Recommended) intentionally keep their existing 20px. */
    .reviews__inner { padding-left: 32px; padding-right: 32px; }
    .product-carousel .container,
    .lifestyle-section .container { padding-left: 32px; padding-right: 32px; }
    /* Other Books cards 2-col fill viewport at mobile (was fixed 228px which was much smaller than ref's 348px) */
    /* Stays the centred flex row from desktop (2 per line), so a single book or a third one is centred. */
    .books-row__grid--two { row-gap: 48px; }
    .books-row__grid--two .book-card { flex: 0 0 50%; max-width: none; }
    .books-row__grid--two .book-card__image { width: 100%; max-width: none; height: auto; aspect-ratio: 188 / 286; }
    .carousel-slide img { height: 260px; }
    .lifestyle-section__content { gap: 40px; padding: 32px 0 60px; }
    .lifestyle-section__quote { max-width: 100%; padding: 0 16px; }
    .lifestyle-section__quote p { font-size: 18px; line-height: 28px; }
}

/* Very small viewports: shrink the body::before circle */
@media (max-width: 540px) {
    body::before { width: 800px; height: 800px; top: -480px; }
}

@media (prefers-reduced-motion: reduce) {
    .buy-from__main { transition: none; }
    .book-card:hover .book-card__image img { transform: none; }
    .carousel-track { transition: none; }
    .book-price__chevron { transition: none; }
    .book-price__list { transition: opacity 120ms ease; transform: none !important; }
    .book-price__select[data-open="true"] .book-price__list { transform: none; }
    .book-price__option:active { transform: none; }
}

/* TMME ADDITIONS — mobile-specific overrides. At ≤767px the hero__text uses
   display:contents so children become flex children of hero__inner with explicit
   `order` set on title/author/translator/cover/price. The new TMME elements
   (status, subtitle, publisher) need their own order values so they don't
   default to order:0 and float above the title. */
@media (max-width: 767px) {
    .book-status    { order: 0; margin: -27px 0 16px; }  /* -27px = 11px height + 16px margin-bottom, so title order:1 keeps its natural position */
    .book-subtitle  { order: 1; margin: -8px 0 37px; } /* mobile mirror of desktop tightening: -5 to mt, +5 to mb keeps author/credits at same Y */
    .book-subtitle ~ .book-author { margin-bottom: 15px; }  /* mobile mirror of the layered desktop rule — needed because the unlayered .book-author { margin: 0 0 20px } above would otherwise win */
    .book-credits   { order: 3; margin: 0 0 72px; }
}

/* The grey circle and the phone arch behind the cover (body::before / body::after) are wider than the
   screen on purpose, so their edges fall off-screen. overflow-x:hidden on body did not stop phone
   browsers from widening the page to fit them (449px laid out on a 390px phone, 1070px on a 1000px
   tablet). clip cuts them off without turning body into a scroll box (the sticky header listens to
   window scrolling); browsers without clip keep the hidden from @layer base. */
html, body { overflow-x: clip; }
