/*
Theme Name:   x4wood
Theme URI:    https://x4wood.com/
Description:  Warm Modern Craft storefront for x4wood — Egyptian lumber, doors, and crafted goods. Arabic-first, RTL. A clean Storefront child theme.
Author:       x4wood
Author URI:   https://x4wood.com/
Template:     storefront
Version:      1.0.0
Text Domain:  x4wood
*/

/* ===========================================================================
   x4wood — Warm Modern Craft
   Design tokens
   =========================================================================== */
:root {
    --bg:          #ffffff;   /* clean white — page */
    --bg-soft:     #f6f3ee;   /* warm off-white — alternating sections */
    --surface:     #ffffff;   /* cards */
    --ink:         #1f1a15;   /* primary text — near-black warm */
    --ink-soft:    #463b30;
    --muted:       #8a7a63;   /* secondary text */
    --walnut:      #6b4423;   /* primary accent / buttons */
    --walnut-deep: #4a2e17;   /* button hover */
    --sage:        #6f7e5c;   /* secondary accent */
    --clay:        #b07d4a;   /* warm highlight */
    --gold:        #b8862f;   /* brass/gold — prices, highlights */
    --line:        #e6e1d6;   /* hairline borders */
    --dark:        #241910;   /* dark sections / footer */
    --dark-2:      #302114;

    --radius:    18px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --shadow-sm: 0 2px 12px -6px rgba(42, 32, 24, .25);
    --shadow:    0 26px 60px -28px rgba(42, 32, 24, .45);
    --maxw:      1180px;
    --gutter:    clamp(1.25rem, 4vw, 2.5rem);

    --font-display: 'Rubik', 'Tajawal', system-ui, sans-serif;
    --font-body:    'IBM Plex Sans Arabic', 'Rubik', system-ui, sans-serif;
    --wood-tint:    var(--bg);
}

/* ===========================================================================
   Base
   =========================================================================== */
html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body.x4 {
    background-color: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16.5px;
    line-height: 1.75;
    font-weight: 400;
}

.x4 h1, .x4 h2, .x4 h3, .x4 h4,
.x4 .site-title, .storefront-product-section h2 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--ink);
    line-height: 1.18;
}
.x4 p { color: var(--ink-soft); }

/* Base link colour applies ONLY to plain content links (no class), so it never
   overrides classed components like .x4-btn / .x4-add / the wordmark. */
.x4 a { text-decoration: none; transition: color .18s ease; }
.x4 a:not([class]) { color: var(--walnut); }
.x4 a:not([class]):hover { color: var(--walnut-deep); }

::selection { background: var(--clay); color: #fff; }

.x4-container { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* shared eyebrow + section heads */
.x4-eyebrow {
    display: inline-flex; align-items: center; gap: .55rem;
    font-family: var(--font-display); font-size: .8rem; font-weight: 500;
    letter-spacing: .04em; color: var(--walnut);
    text-transform: none; margin: 0 0 1rem;
}
.x4-eyebrow::before { content: ''; width: 1.6rem; height: 1px; background: currentColor; opacity: .6; }
.x4-eyebrow--light { color: var(--clay); }

.x4-sec-head { max-width: 46rem; margin: 0 0 2.75rem; }
.x4-sec-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.7rem); margin: 0 0 .6rem; }
.x4-sec-head p { font-size: 1.08rem; color: var(--muted); margin: 0; max-width: 38rem; }
.x4-sec-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; max-width: none; }

.x4-morelink {
    font-family: var(--font-display); font-weight: 500; font-size: .95rem;
    color: var(--ink); border-bottom: 1.5px solid var(--clay); padding-bottom: .25rem; white-space: nowrap;
}
.x4-morelink:hover { color: var(--walnut); border-color: var(--walnut); }

/* ===========================================================================
   Buttons
   =========================================================================== */
.x4-btn {
    display: inline-flex; align-items: center; gap: .6rem;
    font-family: var(--font-display); font-weight: 500; font-size: .98rem;
    padding: .95em 1.7em; border-radius: var(--radius-pill);
    background: var(--walnut); color: #fff; border: 1.5px solid var(--walnut);
    cursor: pointer; transition: transform .16s ease, background .18s ease, box-shadow .18s ease;
    box-shadow: 0 10px 24px -12px rgba(107, 68, 35, .7);
}
.x4-btn:hover { background: var(--walnut-deep); border-color: var(--walnut-deep); color: #fff; transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(74, 46, 23, .8); }
.x4-btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); box-shadow: none; }
.x4-btn--ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); transform: translateY(-2px); box-shadow: none; }
.x4-btn--light { background: var(--clay); border-color: var(--clay); }
.x4-btn--light:hover { background: #fff; color: var(--ink); border-color: #fff; }
.x4-btn .ar { font-feature-settings: 'ss01'; }

/* arrow that points correctly in RTL */
.x4-arrow::after { content: '←'; font-family: var(--font-display); }

/* ===========================================================================
   Header (restyled Storefront)
   =========================================================================== */
.x4-announce {
    background: var(--dark); color: #f0e4cd;
    font-family: var(--font-display); font-size: .82rem; letter-spacing: .01em;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .55rem var(--gutter);
}
.x4-announce strong { color: var(--clay); font-weight: 600; }
.x4-announce-msg { opacity: .92; }
.x4-announce-phone {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    color: var(--clay); font-weight: 600; font-size: .85rem;
}
.x4-announce-phone:hover { color: #fff; }
.x4-announce-phone svg { flex: none; }
@media (max-width: 720px) {
    .x4-announce { justify-content: center; }
    .x4-announce-msg { display: none; }
}

/* ---- Benefits / trust band ---- */
.x4-benefits { background: var(--bg-soft); border-block: 1px solid var(--line); }
.x4-benefits-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; padding-block: 1.6rem; }
.x4-benefit { display: flex; align-items: center; gap: .85rem; }
.x4-benefit + .x4-benefit { border-inline-start: 1px solid var(--line); padding-inline-start: 1.5rem; }
.x4-benefit svg { width: 2rem; height: 2rem; flex: none; fill: var(--walnut); }
.x4-benefit b { display: block; font-family: var(--font-display); font-weight: 500; font-size: .98rem; color: var(--ink); line-height: 1.2; }
.x4-benefit span { font-size: .82rem; color: var(--muted); }
@media (max-width: 860px) {
    .x4-benefits-grid { grid-template-columns: repeat(2, 1fr); gap: 1.1rem 1.5rem; }
    .x4-benefit:nth-child(odd) { border-inline-start: none; padding-inline-start: 0; }
}
@media (max-width: 460px) {
    .x4-benefits-grid { grid-template-columns: 1fr 1fr; }
    .x4-benefit { flex-direction: column; text-align: center; gap: .4rem; }
    .x4-benefit + .x4-benefit { border-inline-start: none; padding-inline-start: 0; }
}

.x4 .site-header {
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--line);
    padding: .9rem 0;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 1px 0 rgba(31, 26, 21, .02);
}
.x4 .col-full { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* wordmark */
.x4-brand { margin: 0; }
.x4-wordmark {
    font-family: var(--font-display); font-weight: 700; font-size: 1.7rem;
    letter-spacing: -.03em; color: var(--ink); line-height: 1; display: inline-block;
}
.x4-wordmark span { color: var(--clay); }
.x4-wordmark:hover { color: var(--ink); }
.x4-wordmark:hover span { color: var(--walnut); }

/* logo — transparent X4 WOOD emblem (dark "wood" on light header, light "wood" in footer) */
.x4-logo { display: inline-block; line-height: 0; }
.x4-logo img {
    height: 50px; width: auto; max-width: 100%; display: block;
    transition: transform .2s ease, opacity .2s ease;
}
.x4-logo:hover img { transform: translateY(-1px); opacity: .92; }
.x4-logo--footer img { height: 56px; }
@media (max-width: 480px) { .x4-logo img { height: 40px; } }

/* navigation */
.x4 .main-navigation { display: flex; align-items: center; }
.x4 .main-navigation ul { font-family: var(--font-display); }
.x4 .main-navigation ul li a {
    color: var(--ink-soft); font-weight: 500; font-size: .98rem; padding: .4rem .9rem;
    position: relative;
}
.x4 .main-navigation ul li a:hover,
.x4 .main-navigation ul li.current-menu-item a { color: var(--walnut); }
.x4 .main-navigation ul li a::after {
    content: ''; position: absolute; inset-inline: .9rem; bottom: -.1rem; height: 2px;
    background: var(--clay); transform: scaleX(0); transform-origin: center; transition: transform .2s ease;
}
.x4 .main-navigation ul li a:hover::after,
.x4 .main-navigation ul li.current-menu-item a::after { transform: scaleX(1); }

/* cart + search */
.x4 .site-header .site-search,
.x4 .site-header-cart { display: inline-flex; align-items: center; }
.x4 .site-header-cart .cart-contents {
    background: var(--walnut); color: #fff; border-radius: var(--radius-pill);
    padding: .55em 1.1em; font-family: var(--font-display); font-weight: 500; font-size: .9rem;
}
.x4 .site-header-cart .cart-contents:hover { background: var(--walnut-deep); color: #fff; }
.x4 .site-header-cart .amount { color: #fff; }
.x4 .site-header-cart .count { background: var(--clay); }

/* account — person-icon link to My Account (login/register, or "حسابي") */
.x4-account-header { display: inline-flex; align-items: center; }
.x4-account-header a {
    display: inline-flex; align-items: center; gap: .4em;
    background: transparent; border: 1px solid var(--line); color: var(--ink);
    border-radius: var(--radius-pill); padding: .5em 1em;
    font-family: var(--font-display); font-weight: 500; font-size: .88rem;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.x4-account-header a:hover { background: var(--walnut); border-color: var(--walnut); color: #fff; }
.x4-account-header svg { flex: 0 0 auto; }
/* Mobile: also shown in Storefront's handheld footer bar at the bottom (see
   .storefront-handheld-footer-bar below) — customers asked for My Account to be
   reachable from both places, so keep this header link too, just icon-only to
   save space next to the logo/search/cart in the narrow header row. */
@media (max-width: 768px) {
    .x4-account-header a { padding: .5em; }
    .x4-account-header span { display: none; }
}

/* ===========================================================================
   Mobile handheld footer bar (Storefront core) — account / search / cart.
   Storefront's default only carries background/text colour from the header
   colour-scheme customizer setting, which here is a near-white on white — the
   bar is nearly invisible against the page. Give it a solid, high-contrast
   surface of its own so it reads clearly as a persistent nav bar.
   ========================================================================= */
.x4 .storefront-handheld-footer-bar {
    background: var(--walnut) !important;
    color: #fff !important;
    border-top: none;
    box-shadow: 0 -6px 20px -8px rgba(31, 26, 21, .35);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.x4 .storefront-handheld-footer-bar ul li > a {
    border-inline-start-color: rgba(255, 255, 255, .22) !important;
    color: #fff !important;
}
.x4 .storefront-handheld-footer-bar ul li > a::before { color: #fff !important; }
.x4 .storefront-handheld-footer-bar ul li.cart .count {
    background: var(--clay); color: #fff; border-color: var(--walnut);
}

/* ---------------------------------------------------------------------------
   Header layout — Storefront lays the header out with a percentage float grid
   (.site-branding{float;width:73.9%}, .site-search{float;width:21.7%}, …) that
   fights the RTL document and scatters logo/search/nav/cart. Replace both header
   rows with a clean flex bar.
   --------------------------------------------------------------------------- */
.x4 #masthead .col-full,
.x4 .storefront-primary-navigation .col-full {
    display: flex; align-items: center; justify-content: space-between;
    gap: clamp(.85rem, 2.5vw, 1.75rem); box-sizing: border-box; width: 100%;
}
/* kill Storefront's .col-full clearfix pseudo-elements so they aren't flex items */
.x4 #masthead .col-full::before, .x4 #masthead .col-full::after,
.x4 .storefront-primary-navigation .col-full::before,
.x4 .storefront-primary-navigation .col-full::after { content: none; display: none; }

.x4 #masthead .site-branding,
.x4 #masthead .site-search,
.x4 .storefront-primary-navigation .main-navigation,
.x4 .storefront-primary-navigation .site-header-cart {
    float: none !important; width: auto !important; margin: 0 !important; clear: none !important;
}
.x4 #masthead .site-branding { flex: 0 0 auto; }
.x4 #masthead .site-search   { flex: 1 1 auto; min-width: 0; max-width: 360px; }
.x4 #masthead .site-search .widget,
.x4 #masthead .site-search form { margin: 0; }
.x4 #masthead .site-search .search-field { width: 100%; box-sizing: border-box; }
.x4-logo img { max-width: 100%; }

.x4 .storefront-primary-navigation { padding-block: .35rem; }
.x4 .storefront-primary-navigation .main-navigation { flex: 1 1 auto; }
.x4 .storefront-primary-navigation .site-header-cart { flex: 0 0 auto; }

/* Desktop: render the primary menu as a clean flex row (no float dependency,
   since we removed the clearfix above). Mobile drawer is left to Storefront. */
@media (min-width: 769px) {
    .x4 .main-navigation .primary-navigation { width: 100%; }
    .x4 .main-navigation .primary-navigation > ul {
        display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .35rem;
        margin: 0; padding: 0; list-style: none;
    }
    .x4 .main-navigation .primary-navigation > ul > li { float: none; margin: 0; }
}

/* Mobile menu toggle — restyle as a walnut pill; Storefront's 3-bar hamburger
   pseudo-elements sit at left:1em and collide with RTL text, so drop them and
   prefix a ☰ glyph via the Arabic label. (We don't touch `display`, so Storefront
   still shows it only on mobile.) */
.x4 .menu-toggle {
    float: none !important; max-width: none; text-align: center;
    border: none; border-radius: var(--radius-pill);
    background: var(--walnut); color: #fff;
    font-family: var(--font-display); font-weight: 500; font-size: .9rem;
    padding: .6em 1.2em;
}
.x4 .menu-toggle:hover { background: var(--walnut-deep); color: #fff; }
.x4 .menu-toggle::before, .x4 .menu-toggle::after,
.x4 .menu-toggle span::before { content: none !important; display: none !important; }

/* ---------------------------------------------------------------------------
   Navigation dropdown — door types (ابواب → ميلامين / مصفحة / PVC).
   Storefront ships no styling that fits our flex RTL bar, so build the panel.
   --------------------------------------------------------------------------- */
/* caret hint on any parent item (uses ::before so it won't clash with the
   animated underline on ::after) */
.x4 .main-navigation li.menu-item-has-children > a::before {
    content: '⌄'; font-size: .85em; line-height: 1; margin-inline-end: .35em;
    position: relative; top: -.12em; opacity: .6;
}

@media (min-width: 769px) {
    .x4 .main-navigation .primary-navigation li.menu-item-has-children { position: relative; }
    .x4 .main-navigation .primary-navigation ul.sub-menu {
        position: absolute; top: calc(100% + .35rem); inset-inline-start: 0; z-index: 200;
        min-width: 13.5rem; margin: 0; padding: .4rem; list-style: none;
        background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius-sm); box-shadow: var(--shadow);
        opacity: 0; visibility: hidden; transform: translateY(6px);
        transition: opacity .15s ease, transform .15s ease, visibility .15s;
    }
    .x4 .main-navigation .primary-navigation li.menu-item-has-children:hover > ul.sub-menu,
    .x4 .main-navigation .primary-navigation li.menu-item-has-children:focus-within > ul.sub-menu {
        opacity: 1; visibility: visible; transform: translateY(0);
    }
    .x4 .main-navigation .primary-navigation ul.sub-menu li { display: block; width: 100%; margin: 0; }
    .x4 .main-navigation .primary-navigation ul.sub-menu li a {
        display: block; width: 100%; box-sizing: border-box;
        padding: .55rem .85rem; border-radius: var(--radius-sm);
        font-size: .95rem; font-weight: 500; color: var(--ink-soft); white-space: nowrap;
    }
    .x4 .main-navigation .primary-navigation ul.sub-menu li a:hover,
    .x4 .main-navigation .primary-navigation ul.sub-menu li.current-menu-item a {
        background: var(--bg-soft); color: var(--walnut);
    }
    .x4 .main-navigation .primary-navigation ul.sub-menu li a::after { content: none; } /* no underline inside the panel */
}

/* Mobile drawer: show the door types inline + indented under ابواب (Storefront
   hides sub-menus behind a toggle that isn't present in our header). */
@media (max-width: 768px) {
    /* The mobile drawer is a SECOND menu render inside .handheld-navigation, which
       Storefront collapses with visibility:hidden + max-height:0 (expanded only via
       a dropdown-toggle we don't show). Force every header sub-menu open + inline.
       !important beats Storefront regardless of selector specificity. */
    .x4 #masthead ul.sub-menu,
    .x4 .handheld-navigation ul.sub-menu,
    .x4 .main-navigation ul.sub-menu {
        position: static !important; display: block !important; float: none !important;
        opacity: 1 !important; visibility: visible !important; transform: none !important;
        max-height: none !important; height: auto !important;
        left: auto !important; right: auto !important; top: auto !important;
        margin: 0; padding: 0; border: none; box-shadow: none; background: transparent; min-width: 0;
    }
    .x4 #masthead ul.sub-menu li a {
        padding-inline-start: 1.6rem; color: var(--muted); font-size: .95rem;
    }
    .x4 #masthead .dropdown-toggle { display: none; }
}
.x4 .menu-toggle span::after { content: ' ☰'; }

/* ===========================================================================
   Home: break sections out of Storefront's narrow .col-full wrapper
   =========================================================================== */
.x4-home .site-content { padding: 0; }
.x4-home .site-content > .col-full { max-width: none; padding-inline: 0; width: 100%; }

/* ===========================================================================
   Sections rhythm
   =========================================================================== */
.x4-section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.x4-section--soft { background: var(--bg-soft); }
.x4-section--dark { background: var(--dark); color: #efe2c9; }
.x4-section--dark h2, .x4-section--dark h3 { color: #fbf2df; }
.x4-section--dark p { color: rgba(239, 226, 201, .8); }

/* ===========================================================================
   Banner — compact, commerce-first (no photo)
   =========================================================================== */
.x4-banner {
    background:
        radial-gradient(130% 150% at 100% 0%, rgba(176, 125, 74, .12), transparent 55%),
        var(--bg-soft);
    border-bottom: 1px solid var(--line);
    padding: clamp(2.4rem, 5.5vw, 4.25rem) 0;
}
.x4-banner-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: clamp(1.5rem, 4vw, 3.5rem); flex-wrap: wrap;
}
.x4-banner-copy { max-width: 46rem; }
.x4-kicker {
    display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display);
    font-weight: 500; font-size: .85rem; letter-spacing: .03em; color: var(--walnut);
    background: rgba(176, 125, 74, .12); padding: .45em 1em; border-radius: var(--radius-pill); margin: 0 0 1.2rem;
}
.x4-kicker .dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--sage); }
.x4-banner h1 {
    font-size: clamp(2rem, 4.8vw, 3.4rem); font-weight: 700; line-height: 1.14; margin: 0 0 1rem;
    letter-spacing: -.02em;
}
.x4-banner h1 .accent { color: var(--walnut); }
.x4-banner-sub { font-size: clamp(1.02rem, 1.6vw, 1.18rem); line-height: 1.7; color: var(--ink-soft); margin: 0; max-width: 44rem; }
.x4-banner-ctas { display: flex; flex-wrap: wrap; gap: .9rem; flex: none; }

/* ===========================================================================
   Category tiles — "shop by category"
   =========================================================================== */
.x4-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.4rem, 2.6vw, 2rem); }
.x4-cat {
    position: relative; display: block; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.x4-cat:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.x4-cat-photo { aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-soft); }
.x4-cat-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.x4-cat:hover .x4-cat-photo img { transform: scale(1.05); }
.x4-cat-info {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.3rem;
}
.x4-cat-text { display: flex; flex-direction: column; }
.x4-cat-name { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--ink); line-height: 1.2; }
.x4-cat-sub { font-size: .9rem; color: var(--muted); margin-top: .15rem; }
.x4-cat-go {
    font-family: var(--font-display); font-weight: 500; font-size: .95rem; color: var(--walnut);
    display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
}
.x4-cat:hover .x4-cat-go { color: var(--walnut-deep); }
.x4-cat-arrow { display: inline-block; transition: transform .2s ease; }
.x4-cat:hover .x4-cat-arrow { transform: translateX(-.25rem); }

/* "all categories" CTA bar (full width, below the tiles) */
.x4-cats-all {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-top: clamp(1.4rem, 2.6vw, 2rem); padding: 1.15rem clamp(1.2rem, 3vw, 1.8rem);
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft);
    transition: background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.x4-cats-all:hover { background: var(--walnut); border-color: var(--walnut); transform: translateY(-2px); box-shadow: var(--shadow); }
.x4-cats-all-text { display: flex; flex-direction: column; }
.x4-cats-all-text b { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); line-height: 1.25; }
.x4-cats-all-text span { font-size: .92rem; color: var(--muted); }
.x4-cats-all-go { font-family: var(--font-display); font-weight: 500; color: var(--walnut); display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.x4-cats-all:hover .x4-cats-all-text b,
.x4-cats-all:hover .x4-cats-all-text span,
.x4-cats-all:hover .x4-cats-all-go { color: #fff; }
.x4-cats-all:hover .x4-cat-arrow { transform: translateX(-.25rem); }

/* ===========================================================================
   Product cards
   =========================================================================== */
.x4-grid { display: grid; gap: clamp(1.5rem, 3vw, 2.25rem); }
.x4-grid--3 { grid-template-columns: repeat(3, 1fr); }
.x4-grid--4 { grid-template-columns: repeat(4, 1fr); }

.x4-card {
    display: flex; flex-direction: column; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.x4-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: transparent; }
.x4-card-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-soft); }
.x4-card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.x4-card:hover .x4-card-photo img { transform: scale(1.06); }
.x4-tag {
    position: absolute; inset-block-start: .8rem; inset-inline-start: .8rem;
    font-family: var(--font-display); font-size: .72rem; font-weight: 500; letter-spacing: .02em;
    background: rgba(36, 25, 16, .82); color: #f3e7cf; padding: .3em .7em; border-radius: var(--radius-pill);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.x4-tag--quote { background: rgba(111, 126, 92, .92); color: #fff; }

.x4-card-body { padding: 1.15rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.x4-card-name { font-family: var(--font-display); font-weight: 500; font-size: 1.08rem; color: var(--ink); margin: 0; line-height: 1.35; }
.x4-card-desc { font-size: .9rem; color: var(--muted); margin: 0; line-height: 1.6; }
.x4-card-foot { margin-top: auto; padding-top: .9rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.x4-price { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; color: var(--walnut); }
.x4-price .woocommerce-Price-amount { color: var(--walnut); }
/* Same "was" (del) / "now" (ins) stacking as the shop grid — see the note above
   .x4.woocommerce ul.products li.product .price del. */
.x4-price del { display: block; font-size: .8em; font-weight: 400; color: var(--muted); opacity: .7; margin-block-end: .1em; }
.x4-price del .woocommerce-Price-amount { color: var(--muted); }
.x4-price ins { display: block; text-decoration: none; }
.x4-price-note { font-size: .85rem; color: var(--sage); font-weight: 500; font-family: var(--font-display); }

/* add-to-cart inside a card */
.x4-card .x4-add {
    font-family: var(--font-display); font-weight: 500; font-size: .85rem;
    padding: .55em 1.1em; border-radius: var(--radius-pill);
    background: var(--ink); color: var(--bg); border: none; white-space: nowrap;
    transition: background .18s ease, transform .16s ease;
}
.x4-card .x4-add:hover { background: var(--walnut); color: #fff; transform: translateY(-1px); }
.x4-card .x4-add.added { background: var(--sage); }
.x4-card .x4-quotelink { font-family: var(--font-display); font-weight: 500; font-size: .9rem; color: var(--walnut); display: inline-flex; gap: .35rem; }
.x4-card .x4-quotelink:hover { gap: .6rem; }

/* ---- Woods we work with (informational, not for sale) ---- */
.x4-woods { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(.8rem, 1.8vw, 1.3rem); }
.x4-wood { text-align: center; }
.x4-wood-swatch {
	aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
	background: var(--bg-soft); box-shadow: var(--shadow-sm); margin-bottom: .7rem;
}
.x4-wood-swatch img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.x4-wood:hover .x4-wood-swatch img { transform: scale(1.07); }
.x4-wood b { display: block; font-family: var(--font-display); font-weight: 500; font-size: .98rem; color: var(--ink); }
.x4-wood span { font-size: .82rem; color: var(--muted); }
@media (max-width: 860px) { .x4-woods { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .x4-woods { grid-template-columns: repeat(2, 1fr); } }

/* ===========================================================================
   Story / craft
   =========================================================================== */
.x4-story-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.x4-story-figure { position: relative; }
.x4-story-figure .main { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; box-shadow: var(--shadow); }
.x4-story-figure .main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.x4-story-figure .inset {
    position: absolute; bottom: -1.2rem; inset-inline-end: -1.2rem; width: 40%; aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm); overflow: hidden; border: 5px solid var(--surface); box-shadow: var(--shadow-sm);
}
.x4-story-figure .inset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.x4-story-body h2 { font-size: clamp(1.8rem, 4vw, 2.9rem); margin: 0 0 1.2rem; }
/* No drop-cap: Arabic letters must stay joined. Use a larger lede instead. */
.x4-lede { font-size: 1.22rem; line-height: 1.85; color: var(--ink); }
.x4-lede::first-line { font-weight: 500; }
.x4-story-body p { font-size: 1.06rem; line-height: 1.75; }
.x4-sign { font-family: var(--font-display); color: var(--muted); margin-top: 1.4rem !important; font-size: .95rem; }

.x4-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2.4rem; }
.x4-stats li { list-style: none; padding-top: 1rem; border-top: 2px solid var(--clay); }
.x4-stats b { font-family: var(--font-display); display: block; font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.x4-stats em { font-style: normal; font-size: .85rem; color: var(--muted); line-height: 1.4; display: block; }

/* ===========================================================================
   Process strip
   =========================================================================== */
.x4-process { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.2rem, 3vw, 2.2rem); margin: 0; padding: 0; counter-reset: step; }
.x4-process li { list-style: none; }
.x4-process .num { font-family: var(--font-display); font-size: .8rem; font-weight: 600; color: var(--clay); letter-spacing: .12em; }
.x4-process h3 { font-size: 1.25rem; margin: .5rem 0 .5rem; }
.x4-process p { font-size: .95rem; color: var(--muted); margin: 0; line-height: 1.6; }
.x4-process .bar { height: 2px; background: var(--line); margin-top: 1.1rem; position: relative; overflow: hidden; }
.x4-process .bar::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 35%; background: var(--walnut); }

/* ===========================================================================
   Visit / contact
   =========================================================================== */
.x4-visit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.x4-visit h2 { font-size: clamp(1.9rem, 4vw, 3rem); margin: 0 0 1.2rem; }
.x4-visit-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 2rem; margin: 2rem 0; }
.x4-visit-dl dt { font-family: var(--font-display); font-size: .78rem; letter-spacing: .08em; color: var(--walnut); margin-bottom: .35rem; text-transform: uppercase; }
.x4-visit-dl dd { margin: 0; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.55; }
.x4-visit-note { margin: 1.4rem 0 0; color: rgba(239, 226, 201, .72); font-size: .92rem; }
.x4-visit-card {
    background: var(--dark-2); border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius);
    padding: 2rem; position: relative; overflow: hidden;
}
.x4-visit-card .hours { display: grid; gap: .65rem; }
.x4-visit-card .hours div { display: flex; justify-content: space-between; padding-bottom: .65rem; border-bottom: 1px dashed rgba(255,255,255,.12); }
.x4-visit-card .hours span:first-child { color: #efe2c9; font-family: var(--font-display); }
.x4-visit-card .hours span:last-child { color: var(--clay); }
.x4-visit-card .open { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1.3rem; font-family: var(--font-display); font-size: .85rem; color: #cfe0bd; }
.x4-visit-card .open .pulse { width: .6rem; height: .6rem; border-radius: 50%; background: #8fbf6a; box-shadow: 0 0 0 0 rgba(143,191,106,.6); animation: x4pulse 2s infinite; }
@keyframes x4pulse { 70% { box-shadow: 0 0 0 8px rgba(143,191,106,0); } 100% { box-shadow: 0 0 0 0 rgba(143,191,106,0); } }

/* ===========================================================================
   WooCommerce — cohesive store pages (shop, single, cart, checkout)
   =========================================================================== */
.x4.woocommerce .site-content,
.x4 .site-content { padding-block: clamp(2.5rem, 6vw, 4rem); }
.x4 .col-full { box-sizing: border-box; }

/* Shop / category product grid — Storefront lays these out with floats, so `gap`
   is ignored and the rows touch vertically. Convert to a real CSS grid so both
   row and column spacing come from `gap` (consistent with the homepage grids). */
.x4.woocommerce ul.products {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.5rem, 3vw, 2.25rem); margin: 0; padding: 0; list-style: none;
}
.x4.woocommerce ul.products::before,
.x4.woocommerce ul.products::after { content: none; display: none; }
.x4.woocommerce ul.products.columns-1 { grid-template-columns: 1fr; }
.x4.woocommerce ul.products.columns-2 { grid-template-columns: repeat(2, 1fr); }
.x4.woocommerce ul.products.columns-3 { grid-template-columns: repeat(3, 1fr); }
.x4.woocommerce ul.products.columns-4 { grid-template-columns: repeat(4, 1fr); }
.x4.woocommerce ul.products.columns-5 { grid-template-columns: repeat(5, 1fr); }
.x4.woocommerce ul.products.columns-6 { grid-template-columns: repeat(6, 1fr); }
.x4.woocommerce ul.products li.product {
    width: auto !important; margin: 0 !important; float: none !important; clear: none !important;
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 0 0 1.2rem !important; overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.x4.woocommerce ul.products li.product:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.x4.woocommerce ul.products li.product a img { margin: 0 0 1rem; border-radius: 0; }
.x4.woocommerce ul.products li.product .woocommerce-loop-product__title { padding: 0 1.1rem; font-family: var(--font-display); font-weight: 500; font-size: 1.06rem; color: var(--ink); }
.x4.woocommerce ul.products li.product .price { padding: 0 1.1rem; color: var(--ink) !important; font-family: var(--font-display); font-weight: 600; }
.x4.woocommerce ul.products li.product .button { margin: auto 1.1rem 0; }
.x4.woocommerce ul.products li.product .price ins { text-decoration: none; }
.x4.woocommerce ul.products li.product .price del { color: var(--muted) !important; opacity: .7; }
.x4.woocommerce ul.products li.product .price:empty::before { content: 'بطلب عرض سعر'; color: var(--sage); font-weight: 500; font-size: .92em; }

/* Sale price: force "was" (del) above "now" (ins) on their own lines. Without this,
   a variable product's price RANGE (e.g. "18,000–18,720") wraps unpredictably next
   to the crossed-out range on narrow cards, sometimes interleaving old/new numbers
   on the same line. Stacking removes the ambiguity on any card width. */
.x4.woocommerce ul.products li.product .price del,
.x4.woocommerce div.product .price del {
    display: block; font-size: .85em; font-weight: 400; margin-block-end: .15em;
}
.x4.woocommerce ul.products li.product .price ins,
.x4.woocommerce div.product .price ins { display: block; }
.x4.woocommerce div.product .price del { color: var(--muted) !important; opacity: .7; }
.x4.woocommerce div.product .price ins { text-decoration: none; }

/* --- Category "chooser" tiles (li.product-category) — used by the ابواب archive,
   which shows its populated door-type subcategories instead of products. Branded to
   match the homepage .x4-cat tiles. ----------------------------------------------- */
.x4.woocommerce ul.products li.product-category {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; padding: 0 0 1.2rem !important; text-align: center;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.x4.woocommerce ul.products li.product-category:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.x4.woocommerce ul.products li.product-category > a { display: block; color: inherit; }
.x4.woocommerce ul.products li.product-category > a::after { content: none; } /* kill base link underline */
.x4.woocommerce ul.products li.product-category img {
    width: 100%; aspect-ratio: 16 / 11; height: auto; object-fit: cover; margin: 0 0 1.1rem; border-radius: 0; display: block;
}
.x4.woocommerce ul.products li.product-category .woocommerce-loop-category__title {
    font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--ink);
    padding: 0 1.1rem; margin: 0; line-height: 1.25;
}
.x4.woocommerce ul.products li.product-category .woocommerce-loop-category__title .count {
    display: block; margin-top: .25rem; padding: 0; background: none;
    font-family: var(--font-body); font-weight: 500; font-size: .9rem; color: var(--muted);
}
.x4.woocommerce ul.products li.product-category .woocommerce-loop-category__title::after {
    content: 'تصفّح ←'; display: block; margin-top: .8rem;
    font-family: var(--font-display); font-weight: 500; font-size: .95rem; color: var(--walnut);
}
.x4.woocommerce ul.products li.product-category:hover .woocommerce-loop-category__title::after { color: var(--walnut-deep); }

/* The ابواب chooser usually has 1–3 type cards — center them at a comfortable size
   instead of stretching across the 3-col product grid. */
.x4.woocommerce.term-doors ul.products,
.x4.woocommerce.term-doors ul.products[class*="columns-"] { /* beat the responsive 2-col rule */
    grid-template-columns: repeat(auto-fit, minmax(240px, 330px)); justify-content: center;
}
.x4.woocommerce.term-doors .term-description,
.x4.woocommerce.term-doors .woocommerce-products-header { text-align: center; }
.x4.woocommerce.term-doors .term-description { max-width: 46rem; margin-inline: auto; color: var(--muted); }

/* global WC buttons */
.x4.woocommerce a.button, .x4.woocommerce button.button, .x4.woocommerce input.button,
.x4.woocommerce #respond input#submit, .x4.woocommerce a.button.alt, .x4.woocommerce button.button.alt,
.x4 .button, .x4 button, .x4 input[type="submit"] {
    background: var(--walnut); color: #fff; border-radius: var(--radius-pill);
    font-family: var(--font-display); font-weight: 500; letter-spacing: 0; text-transform: none;
    padding: .8em 1.6em; border: none; transition: background .18s ease, transform .16s ease;
}
.x4.woocommerce a.button:hover, .x4.woocommerce button.button:hover, .x4.woocommerce input.button:hover,
.x4.woocommerce a.button.alt:hover, .x4.woocommerce button.button.alt:hover,
.x4 .button:hover, .x4 button:hover { background: var(--walnut-deep); color: #fff; transform: translateY(-1px); }
.x4.woocommerce span.onsale {
    background: var(--sage); color: #fff; border-radius: var(--radius-pill); min-height: auto;
    min-width: auto; padding: .25em .8em; font-family: var(--font-display); font-weight: 500;
}

/* single product */
.x4.woocommerce div.product .product_title { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.x4.woocommerce div.product p.price, .x4.woocommerce div.product span.price { color: var(--walnut); font-family: var(--font-display); font-weight: 600; }
.x4.woocommerce div.product .woocommerce-tabs ul.tabs li.active { background: var(--surface); border-bottom-color: var(--surface); }
.x4.woocommerce .quantity .qty { border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* --- Variable-product options (width / height / filling) ---------------------
   The default WooCommerce `table.variations` renders as a raw HTML table with
   unstyled native <select>s (value jammed to one edge, caret to the other, the
   "Clear" link crammed beside the last row). Rebuild it as a tidy field grid. */
.x4.woocommerce div.product form.cart { margin-bottom: 1.6rem; }

.x4.woocommerce div.product form.cart table.variations {
    display: block; width: 100%; border: none; margin: 0 0 1.3rem;
}
.x4.woocommerce div.product form.cart table.variations::before {
    content: 'اختر المواصفات'; display: block;
    font-family: var(--font-display); font-weight: 600; font-size: .82rem;
    letter-spacing: .04em; color: var(--muted); margin: 0 0 .9rem;
}
.x4.woocommerce div.product form.cart table.variations tbody {
    display: grid; gap: 1rem 1.1rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.x4.woocommerce div.product form.cart table.variations tr,
.x4.woocommerce div.product form.cart table.variations th,
.x4.woocommerce div.product form.cart table.variations td {
    display: block; width: auto; padding: 0; margin: 0; border: none; background: none;
}
.x4.woocommerce div.product form.cart table.variations th.label {
    font-family: var(--font-display); font-weight: 500; font-size: .9rem;
    color: var(--ink-soft); margin: 0 0 .45rem; line-height: 1.3;
}
.x4.woocommerce div.product form.cart table.variations th.label label { margin: 0; font-weight: 500; }

.x4.woocommerce div.product form.cart .variations select {
    -webkit-appearance: none; appearance: none; box-sizing: border-box;
    width: 100%; max-width: 100%; min-height: 48px; margin: 0; /* beat Storefront's max-width:70% */
    padding: .6em 1.1em .6em 2.6em; /* extra inline-end pad for the caret (RTL: left) */
    font-family: var(--font-body); font-size: 1rem; color: var(--ink); line-height: 1.4;
    background-color: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b4423' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 1rem center;
    cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
.x4.woocommerce div.product form.cart .variations select:hover { border-color: var(--clay); }
.x4.woocommerce div.product form.cart .variations select:focus {
    outline: none; border-color: var(--walnut); box-shadow: 0 0 0 3px rgba(107, 68, 35, .14);
}

/* "Clear" (إزالة) link — Storefront floats it (overlapping the last select);
   force it onto its own line below the fields, subtle; drop any inherited icon */
.x4.woocommerce div.product form.cart .reset_variations {
    float: none !important; clear: both; display: block; width: fit-content;
    margin: .8rem 0 0; font-family: var(--font-display);
    font-size: .85rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.x4.woocommerce div.product form.cart .reset_variations::before,
.x4.woocommerce div.product form.cart .reset_variations::after { content: none; }
.x4.woocommerce div.product form.cart .reset_variations:hover { color: var(--walnut); }

/* matched-variation price + add-to-cart row */
.x4.woocommerce div.product .single_variation_wrap { margin-top: .25rem; }
.x4.woocommerce div.product .single_variation .price {
    display: block; margin: .1rem 0 1rem;
    font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; color: var(--walnut);
}
.x4.woocommerce div.product .woocommerce-variation-add-to-cart {
    display: flex; align-items: stretch; gap: .75rem; flex-wrap: wrap;
}
.x4.woocommerce div.product .woocommerce-variation-add-to-cart .quantity { margin: 0; }
.x4.woocommerce div.product form.cart .quantity .qty {
    width: 4.5rem; min-height: 48px; text-align: center; box-sizing: border-box;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 1rem;
}
.x4.woocommerce div.product .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    flex: 1 1 auto; min-width: 12rem; min-height: 48px;
}
.x4.woocommerce-message, .x4.woocommerce-info, .x4 .woocommerce-message, .x4 .woocommerce-info {
    /* Storefront ships these boxes with white text for a coloured fill; we use a
       warm cream fill, so the text must be dark ink or it vanishes (e.g. the
       "no products found" notice). */
    border-top-color: var(--sage); background: var(--bg-soft); color: var(--ink-soft);
}
.x4 .woocommerce-message a, .x4 .woocommerce-info a { color: var(--walnut); font-weight: 500; }

/* "prices don't include shipping" notice — cart + checkout (x4-checkout.php) */
.x4-shipping-note {
    display: flex; align-items: flex-start; gap: .65rem;
    max-width: var(--maxw); margin: 0 auto 1.75rem; padding: .85rem 1.1rem;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
    color: var(--ink-soft); font-size: .92rem; line-height: 1.6;
}
.x4-shipping-note svg { flex: none; margin-top: .1rem; fill: var(--walnut); }
.x4 .woocommerce-message a:hover, .x4 .woocommerce-info a:hover { color: var(--walnut-deep); }
.x4 .woocommerce-message::before, .x4 .woocommerce-info::before { color: var(--sage); }
.x4 .woocommerce-error { border-top-color: var(--clay); }

/* page titles on shop/category */
.x4 .storefront-breadcrumb { color: var(--muted); }
.x4 .woocommerce-products-header__title.page-title,
.x4 .entry-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 4vw, 2.8rem); }

/* ===========================================================================
   Footer (restyled Storefront)
   =========================================================================== */
.x4 .site-footer { background: var(--dark); color: #d9c8a8; border-top: none; padding: clamp(3rem, 6vw, 4.5rem) 0 0; font-size: .95rem; }
/* Storefront's Customizer inline CSS sets `.site-footer a:not(.button):not(.components-button){color:#333}`
   — specificity (0,3,1), which beats a plain `.x4 .site-footer a`. Mirror its :not() chain
   under .x4 to win, so links read as warm cream on the dark footer instead of near-black. */
.x4 .site-footer a:not(.button):not(.components-button) { color: #e7d9bd; }
.x4 .site-footer a:not(.button):not(.components-button):hover { color: var(--clay); text-decoration: underline; text-underline-offset: 3px; }
.x4-footer { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 2.5rem; padding-bottom: 3rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.x4-footer .x4-wordmark { color: #fbf2df; font-size: 2rem; }
.x4-footer p { color: rgba(217, 200, 168, .75); max-width: 24rem; }
.x4-footer h4 { font-family: var(--font-display); color: #fbf2df; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 1.1rem; }
.x4-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.x4-footer-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.4rem 0; font-size: .85rem; color: rgba(217,200,168,.6); }
.x4-footer-bar .pays { display: inline-flex; gap: .5rem; align-items: center; }
.x4-footer-bar .pays span { background: rgba(255,255,255,.08); border-radius: 6px; padding: .25em .6em; font-family: var(--font-display); font-size: .75rem; }

/* ===========================================================================
   Responsive
   =========================================================================== */
@media (max-width: 1000px) {
    .x4-banner-inner { flex-direction: column; align-items: flex-start; }
    .x4-story-grid, .x4-visit-grid { grid-template-columns: 1fr; }
    .x4-story-figure { max-width: 26rem; }
    .x4-footer { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    .x4-footer { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .x4-grid--4 { grid-template-columns: repeat(2, 1fr); }
    .x4-grid--3 { grid-template-columns: repeat(2, 1fr); }
    .x4-cats { grid-template-columns: repeat(2, 1fr); }
    .x4.woocommerce ul.products[class*="columns-"] { grid-template-columns: repeat(2, 1fr); }
    .x4-process, .x4-stats { grid-template-columns: repeat(2, 1fr); }
    .x4-sec-head--row { flex-direction: column; align-items: flex-start; gap: .8rem; }
}
@media (max-width: 540px) {
    .x4-grid--4, .x4-grid--3 { grid-template-columns: 1fr 1fr; }
    /* keep categories 2-up on phones; stack each tile's label + CTA to fit */
    .x4-cat-info { flex-direction: column; align-items: flex-start; gap: .35rem; padding: .85rem 1rem; }
    .x4-cat-name { font-size: 1.1rem; }
    .x4-visit-dl { grid-template-columns: 1fr; }
    .x4-banner-ctas { width: 100%; }
    .x4-banner-ctas .x4-btn { flex: 1; justify-content: center; }
    .x4-cats-all { flex-direction: column; align-items: flex-start; gap: .6rem; }
}

/* ===========================================================================
   TEAM — فريق العمل (page-team.php / [x4_team])
   ========================================================================= */
.x4-team .x4-sec-head { margin-bottom: 2.5rem; }
.x4-team-lede,
.x4-team-intro { max-width: 60ch; margin: .75rem auto 0; color: var(--muted); font-size: 1.05rem; line-height: 1.9; }

.x4-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(1.25rem, 3vw, 2rem);
}

.x4-team-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease;
}
.x4-team-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.x4-team-photo { position: relative; aspect-ratio: 4 / 5; background: var(--bg-soft); overflow: hidden; }
.x4-team-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.x4-team-initial {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 4rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--walnut), var(--clay));
}

.x4-team-body { display: flex; flex-direction: column; gap: .5rem; flex: 1; padding: 1.25rem 1.25rem 1.4rem; }
.x4-team-name { margin: 0; font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--ink); }
.x4-team-role { color: var(--walnut); font-weight: 600; font-size: .9rem; }
.x4-team-bio  { flex: 1; margin: .1rem 0 0; color: var(--muted); font-size: .95rem; line-height: 1.8; }

.x4-team-contact { display: flex; gap: .5rem; margin-top: .75rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.x4-team-contact a.x4-team-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--radius-pill);
    background: var(--bg-soft); color: var(--walnut);
    transition: background .2s ease, color .2s ease, transform .2s ease;
}
.x4-team-contact a.x4-team-ic:hover { background: var(--walnut); color: #fff; transform: translateY(-2px); }

.x4-team-empty { padding: 3rem 0; text-align: center; color: var(--muted); }

/* ===========================================================================
   GALLERY — معرض الأعمال (page-gallery.php / [x4_gallery])
   ========================================================================= */
.x4-gallery-sec .x4-sec-head { margin-bottom: 2.5rem; }

.x4-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: clamp(1rem, 2.5vw, 1.5rem);
}

/* Specificity note: the global ".x4 button" reset (.x4 + type selector = one
   class + one type) otherwise beats a plain ".x4-gallery-item" class selector
   and re-paints these as walnut pill buttons. Double-scoping with the parent
   grid class (two classes) outranks it regardless of source order. */
.x4-gallery-grid .x4-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease;
}
.x4-gallery-grid .x4-gallery-item:hover { background: none; color: inherit; transform: translateY(-4px); box-shadow: var(--shadow); }

.x4-gallery-photo { position: relative; aspect-ratio: 4 / 3; background: var(--bg-soft); overflow: hidden; }
.x4-gallery-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.x4-gallery-item:hover .x4-gallery-photo img { transform: scale(1.05); }

.x4-gallery-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(31, 26, 21, .28);
}
.x4-gallery-play svg {
    width: 52px; height: 52px; padding: 14px; box-sizing: border-box;
    border-radius: 50%; background: rgba(255,255,255,.92); color: var(--walnut);
    transform: translateX(-2px);
}

.x4-gallery-cap {
    position: absolute; inset-inline: 0; bottom: 0;
    padding: 1.6rem .9rem .7rem;
    background: linear-gradient(to top, rgba(20,15,10,.78), transparent);
    color: #fff; font-size: .92rem; font-weight: 500; text-align: start;
    opacity: 0; transform: translateY(6px);
    transition: opacity .2s ease, transform .2s ease;
}
.x4-gallery-item:hover .x4-gallery-cap { opacity: 1; transform: translateY(0); }

/* Lightbox */
.x4-lightbox {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(15, 11, 8, .92);
    display: flex; align-items: center; justify-content: center;
    padding: clamp(1rem, 4vw, 3rem);
}
.x4-lightbox[hidden] { display: none; }
.x4-lightbox-body { max-width: 100%; max-height: 100%; }
.x4-lightbox-body img { display: block; max-width: 100%; max-height: 88vh; border-radius: var(--radius-sm); margin-inline: auto; }
.x4-lightbox-body video { display: block; max-width: 100%; max-height: 88vh; border-radius: var(--radius-sm); margin-inline: auto; }
.x4-lightbox-frame { width: min(90vw, 960px); aspect-ratio: 16 / 9; }
.x4-lightbox-frame iframe { width: 100%; height: 100%; border: 0; border-radius: var(--radius-sm); }
.x4-lightbox .x4-lightbox-close {
    position: absolute; top: clamp(.75rem, 2vw, 1.5rem); inset-inline-end: clamp(.75rem, 2vw, 1.5rem);
    width: 44px; height: 44px; padding: 0; margin: 0; border-radius: 50%; border: 0; cursor: pointer;
    -webkit-appearance: none; appearance: none;
    background: rgba(255,255,255,.12); color: #fff; font-size: 1.6rem; line-height: 1;
    font-family: inherit; font-weight: 400; letter-spacing: normal;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease;
}
.x4-lightbox .x4-lightbox-close:hover { background: rgba(255,255,255,.25); color: #fff; transform: none; }

/* ===========================================================================
   PARTNERS — شركاؤنا (page-partners.php / [x4_partners])
   ========================================================================= */
.x4-partners-sec .x4-sec-head { margin-bottom: 2.5rem; }

.x4-partners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: clamp(1rem, 2.5vw, 1.5rem);
}

.x4-partner-card {
    display: flex; align-items: center; justify-content: center;
    height: 120px; padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease;
}
a.x4-partner-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.x4-partner-card img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    filter: grayscale(1) opacity(.7);
    transition: filter .25s ease;
}
a.x4-partner-card:hover img { filter: grayscale(0) opacity(1); }

.x4-partner-name { font-family: var(--font-display); font-weight: 600; color: var(--ink-soft); text-align: center; }

/* ===========================================================================
   LEGAL — سياسات المتجر (page-legal.php: terms / sales / refund / privacy)
   ========================================================================= */
.x4-legal-wrap { max-width: 46rem; }
.x4-legal-head { margin-bottom: 2.25rem; }
.x4-legal-head h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin: 0; }

.x4-legal-body { font-size: 1.02rem; line-height: 1.95; color: var(--ink-soft); }
.x4-legal-body h2 {
    font-size: 1.25rem; margin: 2.4rem 0 .9rem; padding-top: 1.6rem;
    border-top: 1px solid var(--line);
}
.x4-legal-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.x4-legal-body p { margin: 0 0 1.1rem; }
.x4-legal-body ul, .x4-legal-body ol { margin: 0 0 1.1rem; padding-inline-start: 1.4rem; display: grid; gap: .5rem; }
.x4-legal-body li { color: var(--ink-soft); }
.x4-legal-body strong { color: var(--ink); }
.x4-legal-body a { color: var(--walnut); text-decoration: underline; text-underline-offset: 3px; }

/* ===========================================================================
   MERCHANT PRICING — header badge + floating toggle chip (x4-merchant-pricing.php)
   ========================================================================= */
.x4-merchant-hdr {
    align-self: center;
    margin-inline-start: .75rem;
    padding: .3rem .7rem;
    border-radius: var(--radius-pill);
    background: var(--sage);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.x4-merchant-chip {
    position: fixed;
    inset-block-end: 1.1rem;
    inset-inline-start: 1.1rem;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 168px;
    padding: .7rem .9rem .8rem;
    border-radius: var(--radius-sm);
    background: var(--walnut);
    color: #fff;
    box-shadow: var(--shadow);
    font-family: var(--font-body);
}
.x4-merchant-chip.is-normal { background: var(--ink-soft); }
.x4-merchant-chip-title { font-weight: 700; font-size: .92rem; letter-spacing: .01em; }
.x4-merchant-chip-sub   { font-size: .74rem; opacity: .85; }
.x4-merchant-chip-toggle.x4-merchant-chip-toggle,
.x4-merchant-chip a.x4-merchant-chip-toggle {
    display: inline-block;
    margin-top: .45rem;
    padding: .32rem .8rem;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: .76rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background .2s ease;
}
.x4-merchant-chip a.x4-merchant-chip-toggle:hover { background: rgba(255, 255, 255, .3); }

/* native sale price — keep the struck original muted, the new price in brand gold */
.x4 .price del { color: var(--muted); opacity: .8; font-weight: 400; margin-inline-end: .35rem; }
.x4 .price ins { text-decoration: none; color: var(--gold); font-weight: 700; }

@media (max-width: 768px) {
    .x4-merchant-hdr { display: none; }
    .x4-merchant-chip { inset-block-end: .8rem; inset-inline-start: .8rem; min-width: 0; padding: .55rem .75rem .65rem; }
}

/* ===========================================================================
   CUSTOM ORDER — pitch + button (single product) and its modal (x4-custom-order.php)
   ========================================================================= */
.x4-custom-order {
    margin-block: 1.5rem;
    padding: 1.1rem 1.25rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.x4-custom-order-pitch { margin: 0 0 .8rem; color: var(--ink-soft); font-size: .93rem; line-height: 1.6; }
.x4-custom-order-open,
.x4-custom-order-submit {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--walnut); color: #fff; border: none; cursor: pointer;
    border-radius: var(--radius-pill); padding: .7em 1.5em;
    font-family: var(--font-display); font-weight: 600; font-size: .95rem;
    transition: background .2s ease;
}
.x4-custom-order-open:hover,
.x4-custom-order-submit:hover { background: var(--walnut-deep); }
.x4-custom-order-submit:disabled { opacity: .6; cursor: not-allowed; }

.x4-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.x4-modal[hidden] { display: none; }
.x4-modal-backdrop { position: absolute; inset: 0; background: rgba(31, 26, 21, .55); }
.x4-modal-card {
    position: relative; z-index: 1; width: min(92vw, 440px); max-height: 88vh; overflow-y: auto;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.75rem 1.5rem 1.5rem;
}
.x4-modal-x {
    position: absolute; inset-inline-end: .9rem; inset-block-start: .7rem;
    background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer;
}
.x4-modal-x:hover { color: var(--ink); }
.x4-modal-card h3 { margin: 0 0 .3rem; font-family: var(--font-display); color: var(--ink); }
.x4-modal-sub { margin: 0 0 1.1rem; color: var(--muted); font-size: .88rem; }
.x4-modal-card .form-row { margin-bottom: .9rem; }
.x4-modal-card label { display: block; margin-bottom: .35rem; font-size: .88rem; font-weight: 500; color: var(--ink-soft); }
.x4-modal-card .required { color: var(--clay); }
.x4-modal-card input[type="tel"],
.x4-modal-card input[type="email"],
.x4-modal-card textarea {
    width: 100%; box-sizing: border-box; padding: .65em .8em; border: 1px solid var(--line);
    border-radius: var(--radius-sm); font-family: var(--font-body); font-size: .92rem; color: var(--ink);
}
.x4-modal-card textarea { resize: vertical; }
.x4co-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.x4-modal-msg { min-height: 1.2em; margin: .5rem 0 0; font-size: .85rem; }
.x4-modal-msg.is-ok { color: var(--sage); font-weight: 600; }
.x4-modal-msg.is-error { color: #b3432f; font-weight: 600; }
.x4-custom-order-submit { width: 100%; margin-top: .3rem; }

/* ===========================================================================
   LOGIN / REGISTER TOGGLE (x4-accounts-phone.php) — tabs above #customer_login,
   default to "حساب جديد" (register); degrades to the old stacked layout if JS
   doesn't run (no .x4-auth-toggle class gets added, tabs just sit above both).
   ========================================================================= */
.x4-auth-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
/* .x4-auth-tabs .x4-auth-tab (not just .x4-auth-tab) — Storefront/WooCommerce's
   own ".woocommerce button" rule is (0,1,1); a bare single-class selector here
   (0,1,0) would lose to it, so this needs the extra ancestor class to win. */
.x4-auth-tabs .x4-auth-tab {
    flex: 1 1 auto; background: none; border: none; cursor: pointer;
    padding: .8em .5em; margin-bottom: -1px; border-bottom: 2px solid transparent;
    font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--muted);
    transition: color .15s ease, border-color .15s ease;
}
.x4-auth-tabs .x4-auth-tab[aria-selected="true"] { color: var(--walnut); border-bottom-color: var(--walnut); }
.x4-auth-tabs .x4-auth-tab:hover { color: var(--ink); }

#customer_login.x4-auth-toggle { display: block; } /* override Storefront's col2-set float/columns */
#customer_login.x4-auth-toggle .u-column1,
#customer_login.x4-auth-toggle .u-column2 { width: 100%; float: none; margin: 0; }
#customer_login.x4-auth-toggle .u-column1 { display: none; }
#customer_login.x4-auth-toggle.x4-show-login .u-column1 { display: block; }
#customer_login.x4-auth-toggle.x4-show-login .u-column2 { display: none; }

/* Registration: phone is the primary field (shown first), email is clearly optional */
.woocommerce-form-register { display: flex; flex-direction: column; }
.woocommerce-form-register .form-row:has(#reg_billing_phone) { order: -1; }
.woocommerce-form-register label[for="reg_email"] .required { display: none; }
.woocommerce-form-register label[for="reg_email"]::after {
    content: " (اختياري)"; font-weight: 400; font-size: .82em; color: var(--muted);
}
