/* ============================================================================
   Laymoun custom hero (image + text) — replaces the Slider Revolution home hero.
   Rendered by the [laymoun_hero] shortcode (inc/laymoun-hero.php).
   Content (text / link / images) comes from the page; ALL presentation is here.

   Desktop banner geometry (laymoun-hero-desktop[-rtl].jpg, 4822x778 = 6.2:1):
   the owner artwork (references/hero-2.png, 2022x778, basket inset ~319px from
   the trailing edge with grass continuing past it) mirror-extended with
   seamless white+grass so the IMAGE is always wider-ratio than the hero box
   (box measured ~2.6:1 up to ~5:1 on short laptops). Because of that invariant,
   `cover` always fits the image BY HEIGHT → the top is never cropped (the
   basket keeps its 67px headroom) and any horizontal excess is trimmed on the
   extension side (the basket corner is the anchored corner). Grass blades start
   at y=585/778 → grass band = bottom 24.8% of the hero AT EVERY SIZE, which is
   what lets the text block below clamp above it with a plain `bottom: 25%`.
   ========================================================================== */

.laymoun-hero {
    position: relative;
    width: 100vw;
    margin-inline-start: calc(50% - 50vw);   /* full-bleed; logical margin so it also works in RTL */
    max-width: 100vw;
    background-image: var(--hero-bg);
    background-repeat: no-repeat;
    background-position: right bottom;
    background-size: cover;
    background-color: #fff;
    /* Full-screen hero: fill the viewport below the site header and the home
       category bar. Both heights are MEASURED and published by the bar's script
       (inc/laymoun-category-bar.php): --lm-header-block and --lm-cats-block. The
       px values here are only the fallback before that script runs, set to the
       header as measured on 2026-10-02 (80px ≥1200, 100px 992–1199, 82px below).
       The old fixed 59/63px had drifted and pushed the hero ~20px past the fold
       below 1200px (app repo docs/plans/54). The 440px floor keeps the composition
       usable on very short windows (page scrolls a little instead of squashing the
       hero to a sliver — below ~440px the Arabic text no longer fits the white
       band above the grass). */
    min-height: calc(100vh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px));
    min-height: max(440px, calc(100vh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px)));
    min-height: max(440px, calc(100svh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px)));
}

/* Overlay constrained to the site container width, centred over the full-bleed image.
   1170px = the theme's fixed Bootstrap .container (970px on 992–1199px screens,
   fluid below 992) — measured live; the header logo, category bar and page
   content all start on that line. */
.laymoun-hero__inner {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);   /* centre reliably in both LTR and RTL */
    height: 100%;
    width: 100%;
    max-width: 1170px;
}

/* 992–1199px: container is 970 but the theme grid keeps 15px column padding
   here (it cancels at ≥1200), so the PAGE CONTENT — what the cards align to —
   is 940 wide. Measured live. */
@media (min-width: 992px) and (max-width: 1199px) {
    .laymoun-hero__inner { max-width: 940px; }
}

.laymoun-hero__text {
    position: absolute;
    /* The text lives in a band that ends ABOVE the grass (grass = bottom 24.8%
       of the hero, see header note) and is vertically centred inside it — so it
       can never overlap the grass, in English or Arabic, at any window size. */
    top: 16%;
    bottom: calc(25% + 12px);
    inset-inline-start: 30px;     /* same inset as the category cards (.laymoun-cats
                                     30px padding) → the text starts exactly on the
                                     content line; mirrors automatically in RTL */
    width: min(46%, 540px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;      /* inline-start in a column flex: left in LTR, right in RTL */
    justify-content: center;
    text-align: start;
}

.laymoun-hero__heading {
    margin: 0 0 4px;
    font-size: clamp(28px, 2.7vw, 52px);
    font-weight: 700;
    line-height: 1.05;
    color: #1c1c1c;
}

.laymoun-hero__sub {
    margin: 0 0 18px;
    font-size: clamp(24px, 2.4vw, 46px);
    font-weight: 300;
    line-height: 1.05;
    color: #1c1c1c;
}

.laymoun-hero__lead {
    margin: 0 0 26px;
    /* No width cap on desktop (owner: keep the sentence on one line) — the 540px
       text column is the only limit, so it still wraps gracefully on narrower
       desktops; mobile re-caps it at 32ch below. */
    max-width: none;
    font-size: clamp(14px, 1.05vw, 18px);
    line-height: 1.6;
    color: #444;
}

.laymoun-hero__btn {
    display: inline-block;
    padding: 13px 30px;
    border-radius: 40px;
    background: #186034;          /* brand green — matches the slider button */
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    transition: background .2s ease;
}
.laymoun-hero__btn::after { content: " \203A"; }        /* › chevron, like the original */
.laymoun-hero__btn:hover  { background: #124927; color: #fff; }

@media (min-width: 768px) {
    [dir="rtl"] .laymoun-hero {
        background-position: left bottom;
    }
}

/* ── Height cap by width (owner 2026-10-08) ───────────────────────────────────
   The hero fills the window height, and the image is fitted by HEIGHT, so in a
   tall window (1560×1370) or an upright tablet (820×1180, 1024×1366) the basket
   grew and slid under the text. Measured at 1920×1080: the basket's leading
   edge sits ~1.32 × the hero height from the trailing edge (922px at 700px);
   the text ends at its content line + ~11.1 × the subheading size. These caps
   keep ≥40px between the two. Ordinary laptop/desktop windows are shorter than
   the cap, so they still end exactly at the fold (1280×800, 1366×768, 1440×900,
   1920×1080 unchanged). Logical geometry, so the RTL mirror holds too.
   The cap sits INSIDE min-height (max(floor, min(fill, cap))), not in a
   max-height: min-height is what sizes this box, and CSS lets min-height win
   over a smaller max-height, so a max-height here is silently ignored. */
@media (min-width: 1200px) {
    .laymoun-hero {
        min-height: max(440px, min(calc(100vh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px)), calc(17.6vw + 390px)));
        min-height: max(440px, min(calc(100svh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px)), calc(17.6vw + 390px)));
    }
}
@media (min-width: 992px) and (max-width: 1199px) {
    .laymoun-hero {
        min-height: max(440px, min(calc(100vh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px)), calc(17.6vw + 303px)));
        min-height: max(440px, min(calc(100svh - var(--lm-header-block, 80px) - var(--lm-cats-block, 0px)), calc(17.6vw + 303px)));
    }
}

/* ── Tablet (768–991px): the header switches to the compact mobile-style bar
   (hamburger + mobile logo; 82px measured 2026-10-02 — the fallback below until
   the bar's script publishes the real --lm-header-block). ──────────────────── */
@media (min-width: 768px) and (max-width: 991px) {
    /* Floor 340px, not 440px: the 440px floor was measured for desktop type;
       here the text is at its minimum sizes and the Arabic block fits a 340px
       hero's white band. The lower floor is what lets the width cap below work
       on upright tablets (768–932px wide would otherwise be held at 440px). */
    .laymoun-hero {
        min-height: calc(100vh - var(--lm-header-block, 82px) - var(--lm-cats-block, 0px));
        min-height: max(340px, min(calc(100vh - var(--lm-header-block, 82px) - var(--lm-cats-block, 0px)), calc(75.8vw - 267px)));
        min-height: max(340px, min(calc(100svh - var(--lm-header-block, 82px) - var(--lm-cats-block, 0px)), calc(75.8vw - 267px)));
    }
    /* Fluid container here (15px gutter + 30px card inset) — approximate the
       cards' 45px content line; exact alignment resumes ≥992px. */
    .laymoun-hero__text { inset-inline-start: 45px; }
}

/* ── Mobile: swap to the mobile banner, taller hero, text near the top ─────── */
@media (max-width: 767px) {
    .laymoun-hero {
        background-position: center bottom;
        background-image: var(--hero-bg-mobile, var(--hero-bg));
        /* Full-screen below the mobile header (82px measured 2026-10-02; the real
           height comes from --lm-header-block, see the base rule) */
        min-height: calc(100vh - var(--lm-header-block, 82px) - var(--lm-cats-block, 0px));
        min-height: calc(100svh - var(--lm-header-block, 82px) - var(--lm-cats-block, 0px));
    }
    .laymoun-hero__text {
        /* Mobile uses its own banner (different grass geometry) — undo the
           desktop band/flex and keep the original top-anchored placement until
           the owner supplies the final mobile artwork. */
        top: 12%;
        bottom: auto;
        display: block;
        inset-inline-start: 6%;
        width: 84%;
    }
    .laymoun-hero__heading  { font-size: 30px; }
    .laymoun-hero__sub      { font-size: 26px; margin-bottom: 12px; }
    .laymoun-hero__lead     { font-size: 14px; margin-bottom: 20px; max-width: 32ch; }
}

/* ── RTL (Arabic): flex + logical props mirror automatically; flip the chevron ── */
[dir="rtl"] .laymoun-hero__btn::after { content: " \2039"; }   /* ‹ */

/* Arabic (Cairo) sits tighter vertically — add room so the heading doesn't touch
   the subheading. 1.25/10px (not more): the taller Arabic block must still fit
   the white band above the grass at the 440px hero floor. */
[dir="rtl"] .laymoun-hero__heading { margin-bottom: 10px; line-height: 1.25; }
[dir="rtl"] .laymoun-hero__sub     { line-height: 1.25; }

/* ── Photo variant: [laymoun_hero variant="photo" image="…" image_mobile="…"] ──
   App repo docs/plans/133 (owner 2026-11-04, "Option 2: full width"). A full-width
   photo instead of the composed banner: 16:9 on desktop and tablet (cover, kept a
   little above centre so the basket handle shows), square on phones (anchored to
   the bottom, under the text). A soft white fade on the text side keeps the copy
   readable at every width; it mirrors in RTL, and the Arabic page passes a
   mirrored photo, so the basket sits opposite the text in both languages.
   Placed last so it wins over the banner rules above (same specificity). Without
   variant="photo" none of this applies and the banner hero is unchanged. */
.laymoun-hero--photo {
    background-image:
        linear-gradient(90deg, rgba(255, 255, 255, .97) 0%, rgba(255, 255, 255, .92) 28%, rgba(255, 255, 255, .5) 40%, rgba(255, 255, 255, 0) 50%),
        var(--hero-bg);
    background-size: 100% 100%, cover;
    background-position: 0 0, center 30%;
}
[dir="rtl"] .laymoun-hero--photo {
    background-image:
        linear-gradient(270deg, rgba(255, 255, 255, .97) 0%, rgba(255, 255, 255, .92) 28%, rgba(255, 255, 255, .5) 40%, rgba(255, 255, 255, 0) 50%),
        var(--hero-bg);
    background-position: 0 0, center 30%;
}
@media (max-width: 767px) {
    .laymoun-hero--photo,
    [dir="rtl"] .laymoun-hero--photo {
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, .97) 0%, rgba(255, 255, 255, .92) 36%, rgba(255, 255, 255, .5) 47%, rgba(255, 255, 255, 0) 57%),
            var(--hero-bg-mobile, var(--hero-bg));
        background-size: 100% 100%, auto 72%;
        background-position: 0 0, 46% bottom;
    }
}
