/* =============================================================
   MODERN THEME - Copied Classic Cover Mockups (LWP_Modern_Cover, v4.22.2)
   ============================================================= */
/* FAITHFUL COPY of the Classic mockup styling (inc/mockups/mockup-styles.css)
   rendered under a new class family (lwp-mck-*), per the owner directive of
   2026-11-11: copy ALL Classic styling first with new Modern-only class
   names; modernize only after the copied baseline is approved. The 4.22.0/1
   "cover plates" (covers as flat photography on quiet plates) are replaced
   by this — the 3D book, the eReader device and their listing/landing
   sizing rules are copied with their values (perspective, rotateY angles,
   gradients, shadows, page-edge thickness, zoom factors) intact.

   Where a selector had no counterpart in the Modern templates it was NOT
   copied: .lwp-mockup-side-by-side (never emitted), .ab_authorImageColumn +
   workLayout2/4 padding blocks (Classic-only work layouts), the
   .lwp-showcase-mockup scaling family and the .carousel-item /
   .showcase-item context sizing (the Modern showcase block uses its own
   markup and never renders lwp-mockup classes).

   AGENTS.md rule 3 exception (documented here on purpose): the copied
   declarations below are physical-object facts (Kindle frame #1a1a1a,
   white page-edge gradient, black rgba shadows, #4d9077 default spine
   tint), not palette tints, so they keep their literal Classic values.
   --cover-color is rewritten per-book by inc/mockups/modern-cover.js,
   sampling the cover art into a vertical gradient exactly like the Classic
   sampler does on .lwp-book-3d__cover.

   Structure = Classic source of truth, section by section:
   1. landing mockups (.lwp-mck-container / -single / -overlap + book3d/ereader)
   2. listing mockups (.lwp-mck-listing wrapper + --listing variants + combo)
   3. MODERN SLOT ADAPTATION (last) — the only NEW rules in this file,
      needed where a copied value cannot live inside a fixed Modern slot
      (.lwp-ms-card-media browse card, .lwp-ms-detail-cover detail row,
      .lwp-mw-hero-cover hero). Loaded AFTER lwp-modern-work/series css
      (functions.php dep) so its slot overrides win their cascade ties. */

/* ===== 1. Landing (single-work hero) ===== */

.lwp-mck-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    max-width: 100%;
    overflow: visible;
}

/* 3D book (copied .lwp-book-3d) */
.lwp-mck-book3d {
    --book-thickness: 26px;
    --cover-color: #4d9077;
    perspective: 1000px;
    max-width: 250px;
    margin: 0 auto;
}

.lwp-mck-book3d__inner {
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-25deg);
}

/* Book pages (page-edge plane) */
.lwp-mck-book3d__inner::before {
    position: absolute;
    content: " ";
    left: 100%;
    top: 1%;
    width: calc(var(--book-thickness) * 2);
    height: 98%;
    transform: translate(-55%, 0) rotateY(90deg);
    background: linear-gradient(90deg,
            #fff 0%,
            hsl(0, 0%, 94%) 5%,
            #fff 10%,
            hsl(0, 0%, 94%) 15%,
            #fff 20%,
            hsl(0, 0%, 94%) 25%,
            #fff 30%,
            hsl(0, 0%, 94%) 35%,
            #fff 40%,
            hsl(0, 0%, 94%) 45%,
            #fff 50%,
            hsl(0, 0%, 94%) 55%,
            #fff 60%,
            hsl(0, 0%, 94%) 65%,
            #fff 70%,
            hsl(0, 0%, 94%) 75%,
            #fff 80%,
            hsl(0, 0%, 94%) 85%,
            #fff 90%,
            hsl(0, 0%, 94%) 95%,
            #fff 100%);
}

/* Rear cover plane + drop shadow */
.lwp-mck-book3d__inner::after {
    content: "";
    position: absolute;
    top: 0;
    left: 1%;
    width: 100%;
    height: 100%;
    transform: translateZ(calc(var(--book-thickness) * -1));
    background: var(--cover-color);
    border-radius: 0 2px 2px 0;
    box-shadow: 5px 8px 17px 9px rgba(0, 0, 0, 0.5);
}

.lwp-mck-book3d__cover {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0px 2px 2px 0px;
    transform: translateZ(var(--book-thickness));
    box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.1);
    object-fit: fill; /* Fill to fit - stretches to exact dimensions (copied) */
}

/* eReader device (copied .lwp-ereader-frame) */
.lwp-mck-ereader {
    width: 220px;
    height: 320px;
    background: #1a1a1a;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    margin: 40px 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid #333;
}

.lwp-mck-ereader__screen {
    width: 180px;
    height: 260px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.lwp-mck-ereader__screen img {
    width: 100%;
    height: 100%;
    object-fit: fill; /* Fill to fit - stretches to exact dimensions (copied) */
    display: block;
}

.lwp-mck-single {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
}

/* Overlapped book + eReader (copied .lwp-mockup-overlap) */
.lwp-mck-overlap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    position: relative;
    width: 100%;
}

/* Auto-scale overlap mockup using CSS zoom (with Firefox fallback) —
   copied breakpoint ladder 1199/1060/999/800 incl. @supports fallbacks */
@media (max-width: 1199px) {
    .lwp-mck-overlap {
        zoom: 0.9;
    }
    /* Firefox fallback */
    @supports not (zoom: 0.9) {
        .lwp-mck-overlap {
            transform: scale(0.9);
            transform-origin: center;
        }
    }
}

@media (max-width: 1060px) {
    .lwp-mck-overlap {
        zoom: 0.8;
    }
    /* Firefox fallback */
    @supports not (zoom: 0.8) {
        .lwp-mck-overlap {
            transform: scale(0.8);
            transform-origin: center;
        }
    }
}

@media (max-width: 999px) {
    .lwp-mck-overlap {
        zoom: 0.55;
    }
    /* Firefox fallback */
    @supports not (zoom: 0.55) {
        .lwp-mck-overlap {
            transform: scale(0.55);
            transform-origin: center;
        }
    }
}

@media (max-width: 800px) {
    .lwp-mck-overlap {
        zoom: 0.55;
    }
    /* Firefox fallback */
    @supports not (zoom: 0.55) {
        .lwp-mck-overlap {
            transform: scale(0.55);
            transform-origin: center;
        }
    }
}

.lwp-mck-overlap .lwp-mck-ereader--overlap {
    z-index: 2;
    margin: 0 -30px 0 0 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    position: relative;
    order: 1;
    transform: scale(1.1);
    transform-origin: center center;
}

.lwp-mck-overlap .lwp-mck-book3d {
    z-index: 1;
    margin: 0 !important;
    position: relative;
    order: 2;
}

/* Force consistent mockup dimensions at all screen sizes (copied block —
   in Classic it sits AFTER the overlap rules and repeats them; keeping it
   separate keeps the copy traceable to its source) */
.lwp-mck-ereader {
    width: 220px !important;
    height: 320px !important;
    min-width: 220px !important;
    min-height: 320px !important;
    max-width: 220px !important;
    max-height: 320px !important;
}

.lwp-mck-ereader__screen {
    width: 180px !important;
    height: 260px !important;
    min-width: 180px !important;
    min-height: 260px !important;
    max-width: 180px !important;
    max-height: 260px !important;
}

/* Ensure overlap positioning is never overridden */
.lwp-mck-overlap .lwp-mck-ereader--overlap {
    margin: 0 -30px 0 0 !important;
    transform: scale(1.1) !important;
}

/* Force consistent 3D book dimensions in overlap layout */
.lwp-mck-overlap .lwp-mck-book3d {
    width: 250px !important;
    min-width: 250px !important;
    max-width: 250px !important;
}

.lwp-mck-overlap .lwp-mck-book3d__cover {
    width: 250px !important;
    min-width: 250px !important;
    max-width: 250px !important;
    height: auto !important;
}

/* ===== 2. Listing views (browse cards, detail rows) ===== */

/* Copied .lwp-listing-mockup wrapper */
.lwp-mck-listing {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Listing-specific 3D book — constrained and simplified (copied) */
.lwp-mck-book3d--listing {
    --book-thickness: 18px;
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    margin: 0 !important;
    perspective: 800px;
}

.lwp-mck-book3d--listing .lwp-mck-book3d__inner {
    transform: rotateY(-20deg) scale(0.95);
    transform-origin: center center;
}

.lwp-mck-book3d--listing .lwp-mck-book3d__cover {
    width: 100%;
    height: auto;
    display: block;
}

/* Reduce page effects for listings to prevent overflow (copied) */
.lwp-mck-book3d--listing .lwp-mck-book3d__inner::before {
    width: calc(var(--book-thickness) * 1.5);
}

/* Slightly reduce shadows for listings (copied) */
.lwp-mck-book3d--listing .lwp-mck-book3d__inner::after {
    box-shadow: 3px 6px 12px 6px rgba(0, 0, 0, 0.4);
}

/* Listing-specific eReader — constrained (copied) */
.lwp-mck-ereader--listing {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-width: unset !important;
    min-height: unset !important;
    padding: 25px 20px !important;
    margin: 0 !important;
}

.lwp-mck-ereader--listing .lwp-mck-ereader__screen {
    width: 100% !important;
    height: auto !important;
}

.lwp-mck-ereader--listing .lwp-mck-ereader__screen img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Listing-specific combo layout — heavily constrained (copied) */
.lwp-mck-combo {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 200px;
    overflow: hidden;
}

.lwp-mck-combo .lwp-mck-ereader--listing {
    position: absolute;
    left: -5%;
    width: 65%;
    z-index: 1;
    padding: 18px 15px !important;
}

.lwp-mck-combo .lwp-mck-book3d--listing {
    position: relative;
    right: -10%;
    width: 55%;
    z-index: 2;
}

.lwp-mck-combo .lwp-mck-book3d--listing .lwp-mck-book3d__inner {
    transform: rotateY(-18deg) scale(0.9);
}

/* ===== 3. MODERN SLOT ADAPTATION (new rules — copied from the Classic
   context-sizing sections where a Modern slot is the equivalent slot) ===== */

/* Distortion guard: the fixed-slot img rules (.lwp-ms-card-media img,
   .lwp-ms-detail-cover img — width/height 100%, object-fit cover) exist to
   letterbox FLAT covers into their aspect-ratio slots. They must not also
   stretch the copied mockups, whose imgs are sized by their own copied
   rules above. This re-asserts those values with slot-scoped selectors. */
.lwp-ms-card-media .lwp-mck-listing .lwp-mck-book3d__cover,
.lwp-ms-detail-cover .lwp-mck-listing .lwp-mck-book3d__cover {
    width: 100% !important;
    height: auto !important;
    object-fit: fill !important;
}

/* Browse-card slot sizing (copied .series-grid-item.lwp-listing-mockup
   section — the Modern browse card is the equivalent slot) */
.lwp-ms-card-media .lwp-mck-book3d--listing {
    max-width: 180px;
}

.lwp-ms-card-media .lwp-mck-ereader--listing {
    max-width: 200px;
    padding: 20px 16px !important;
}

.lwp-ms-card-media .lwp-mck-combo {
    min-height: 180px;
}

/* Detail-row slot sizing (copied .series-detail-item.lwp-listing-mockup
   section — the Modern detail row is the equivalent slot) */
.lwp-ms-detail-cover .lwp-mck-listing {
    max-height: 200px;
    min-height: 150px;
}

.lwp-ms-detail-cover .lwp-mck-book3d--listing {
    max-width: 120px;
}

.lwp-ms-detail-cover .lwp-mck-ereader--listing {
    max-width: 140px;
    padding: 15px 12px !important;
}

.lwp-ms-detail-cover .lwp-mck-combo {
    transform: scale(0.85);
    min-height: 150px;
}

/* Responsive adjustments for listing mockups (copied, Modern selectors) */
@media (max-width: 768px) {
    .lwp-mck-book3d--listing {
        --book-thickness: 14px;
    }

    .lwp-ms-card-media .lwp-mck-book3d--listing {
        max-width: 150px;
    }

    .lwp-mck-ereader--listing {
        padding: 18px 15px !important;
    }

    .lwp-mck-combo {
        min-height: 160px;
    }
}

@media (max-width: 480px) {
    .lwp-mck-book3d--listing {
        --book-thickness: 12px;
    }

    .lwp-mck-book3d--listing .lwp-mck-book3d__inner {
        transform: rotateY(-15deg) scale(0.95);
    }

    .lwp-mck-combo .lwp-mck-ereader--listing {
        padding: 12px 10px !important;
    }

    .lwp-mck-ereader--listing {
        padding: 15px 12px !important;
    }

    .lwp-mck-combo {
        min-height: 140px;
    }
}

/* Ensure listing mockups never overflow their containers (copied) */
.lwp-mck-listing * {
    box-sizing: border-box;
}

/* ===== 4. MODERNIZATION — eReader skin (2026-11-12, approved by John after testing) =====
   First attempt at modernizing the eReader for Modern mode (directive 2026-11-12:
   "how can we modernize the ebook mockup … try adjusting it then prompting me to
   test"). Same device silhouette, same fixed screen size and slot geometry as the
   copied Classic baseline — only the SKIN changes (body gradient, ring→hairline,
   tight layered shadow, recessed screen, glass gloss, hero offset removed). All
   selectors stay .lwp-mck-scoped; removing this block restores the copied baseline
   exactly. */

/* Device skin: gradient graphite instead of flat #1a1a1a; the gray ring border
   becomes a near-invisible hairline highlight; the big 32px diffuse blur shadow
   becomes a tight layered contact shadow (John's no-blur-smudge rule); hero
   standalone loses its 40px top-left offset so the device centers in the slot. */
.lwp-mck-ereader {
    background: linear-gradient(165deg, #2e2e33 0%, #232327 52%, #1a1a1e 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    box-shadow:
        0 10px 22px -8px rgba(0, 0, 0, 0.55),
        0 2px 6px rgba(0, 0, 0, 0.35);
    margin: 0;
}

/* Faint screen-glass gloss across the device (drawn above the static screen
   child; pointer-events none; scales with the combo's transform:scale(1.1)). */
.lwp-mck-ereader::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 26%, rgba(255, 255, 255, 0) 46%);
    pointer-events: none;
}

/* Screen: slightly warm paper-white instead of pure #fff, crisper radius to
   read closer to the bezel, inset hairline + soft top inset so the cover
   looks inset into the device. */
.lwp-mck-ereader__screen {
    background: #fbfaf8;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.10), inset 0 2px 6px rgba(0, 0, 0, 0.10);
}

/* The overlapped eReader (hero + listing combos) had a softer base shadow in
   the copied block — keep the overlap combo from sitting in a dark pool. */
.lwp-mck-overlap .lwp-mck-ereader--overlap {
    box-shadow:
        0 10px 22px -8px rgba(0, 0, 0, 0.55),
        0 2px 6px rgba(0, 0, 0, 0.35);
}

/* ===== 5. GAP FIX ONLY — hero combo crowding (2026-11-12, second attempt per
   John's "gap fix only" scope — pending John's test) =====
   The copied Classic combo renders a ~470px-wide pair (eReader with -30px right
   pull + scale(1.1), then the 3D book; gap 0; widths fixed with !important) and
   the hero keeps NO scaling at >=1200px — the copied zoom ladder only starts
   below 1200 and caps at 0.9 (down to 1025, where the hero grid is still two
   columns) — so at every two-column width the pair overflows the fixed 340px
   cover column to the left and crowds the title text (the original bug report).
   Scope chosen by owner (2026-11-12): GAP FIX ONLY — the copied device
   arrangement (tuck/overlap, -30px pull, scale(1.1)) stays EXACTLY as copied;
   this section only contains the whole pair inside the 340px slot (zoom 0.72 →
   ~338px, centred) so the 60px column gap between the text and the mockup is
   restored. The eReader's scale(1.1) ink stays inside the pair (tucks between
   the devices, as copied), so nothing reaches the text column. Listing slots
   (browse cards, detail rows) untouched — their combos live under
   .lwp-ms-card-media / .lwp-ms-detail-cover. Below 1025px the hero stacks
   single-column and the copied zoom ladder keeps charge. Removing this section
   restores the shipped 4.22.3 baseline exactly. */

@media (min-width: 1025px) {
    .lwp-mw-hero-cover .lwp-mck-overlap {
        zoom: 0.72; /* whole pair (both devices + copied tuck) fits inside the 340px track */
    }

    /* Firefox fallback (same pattern as the copied zoom ladder): */
    @supports not (zoom: 0.72) {
        .lwp-mw-hero-cover .lwp-mck-overlap {
            transform: scale(0.72);
            transform-origin: center center;
        }
    }
}
