/* ============================================================
   Matjar Suite — Default storefront theme
   RTL-first via CSS logical properties (works for ar & en).
   Palette: ink #1B2430 · surface #F6F7F4 · teal #0F6E5D · amber #E0A526
   ============================================================ */

:root {
    --ink: #1B2430;
    --surface: #F6F7F4;
    --card: #FFFFFF;
    --primary: #0F6E5D;
    --primary-ink: #0B5346;
    --accent: #E0A526;
    --line: #E3E6E0;
    --muted: #5C6672;
    --danger: #B3261E;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 6px 24px rgba(27, 36, 48, 0.08);
    --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--surface);
    color: var(--ink);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-ink); }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.container {
    width: min(1120px, 100% - 2.5rem);
    margin-inline: auto;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--primary-ink); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--accent); color: var(--ink); }
.btn--accent:hover { background: #c8921d; color: var(--ink); }
.btn--outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn--outline:hover { background: var(--primary); color: #fff; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Announcement bar ---------- */
.announcement {
    background: var(--ink);
    color: var(--surface);
    text-align: center;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}
.announcement a { color: var(--accent); font-weight: 600; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    inset-block-start: 0;
    z-index: 40;
    background: var(--card);
    border-block-end: 1px solid var(--line);
}
.site-header__inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: 64px;
}
.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.brand:hover { color: var(--primary); }

.main-nav { display: none; margin-inline-start: auto; }
.main-nav ul { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.main-nav a { color: var(--ink); font-weight: 500; }
.main-nav a:hover { color: var(--primary); }

/* Burger button (mobile) */
.burger {
    margin-inline-start: auto;
    inline-size: 44px;
    block-size: 44px;
    display: grid;
    place-items: center;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.burger span,
.burger span::before,
.burger span::after {
    content: "";
    display: block;
    inline-size: 20px;
    block-size: 2px;
    background: var(--ink);
    position: relative;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.burger span::before { position: absolute; inset-block-start: -6px; }
.burger span::after { position: absolute; inset-block-start: 6px; }
body.nav-open .burger span { background: transparent; }
body.nav-open .burger span::before { transform: translateY(6px) rotate(45deg); }
body.nav-open .burger span::after { transform: translateY(-6px) rotate(-45deg); }

/* Mobile drawer */
.drawer {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    inline-size: min(320px, 85vw);
    background: var(--card);
    z-index: 60;
    padding: 1.5rem;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
    overflow-y: auto;
}
[dir="rtl"] .drawer { transform: translateX(105%); }
body.nav-open .drawer { transform: translateX(0); }
.drawer ul { list-style: none; margin: 1rem 0 0; padding: 0; }
.drawer li + li { border-block-start: 1px solid var(--line); }
.drawer a { display: block; padding: 0.9rem 0.25rem; color: var(--ink); font-weight: 600; }
.drawer__close {
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    inline-size: 40px;
    block-size: 40px;
    font-size: 1.1rem;
    cursor: pointer;
}
.scrim {
    position: fixed;
    inset: 0;
    background: rgba(27, 36, 48, 0.5);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
body.nav-open .scrim,
body.popup-open .scrim--popup { opacity: 1; pointer-events: auto; }

/* ---------- Hero slider ---------- */
.hero { margin-block: 1.5rem; }
.hero__track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    scrollbar-width: none;
    border-radius: var(--radius);
}
.hero__track::-webkit-scrollbar { display: none; }
.hero__slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-block-size: 340px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-ink) 60%, var(--ink) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: clamp(1.5rem, 5vw, 3.5rem);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}
.hero__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(27,36,48,0.55), rgba(27,36,48,0.05));
}
[dir="rtl"] .hero__slide::after {
    background: linear-gradient(270deg, rgba(27,36,48,0.55), rgba(27,36,48,0.05));
}
.hero__content { position: relative; z-index: 1; max-inline-size: 32rem; }
.hero__content h1, .hero__content h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    line-height: 1.25;
}
.hero__content p { margin: 0 0 1.25rem; font-size: 1.05rem; opacity: 0.92; }
.hero__nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-block-start: 0.75rem;
}
.hero__nav button {
    inline-size: 38px;
    block-size: 38px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--card);
    cursor: pointer;
    font-size: 1rem;
}

/* ---------- Sections & product grid ---------- */
.section { margin-block: 3rem; }
.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-block-end: 1.25rem;
}
.section__head h2 { margin: 0; font-size: 1.45rem; }
.section__head a { font-weight: 600; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card__media {
    aspect-ratio: 1 / 1;
    background: var(--surface) center / cover no-repeat;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 2rem;
}
.card__body { padding: 1rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.card__body h3 { margin: 0; font-size: 1.02rem; line-height: 1.45; }
.card__body h3 a { color: var(--ink); }
.card__body h3 a:hover { color: var(--primary); }
.price { font-weight: 700; color: var(--primary); margin-block-start: auto; }
.price del { color: var(--muted); font-weight: 400; margin-inline-start: 0.5rem; font-size: 0.85em; }

.chip {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-ink);
    background: rgba(15, 110, 93, 0.1);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    inline-size: fit-content;
}

/* Category filter pills */
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block: 1rem 1.5rem; }
.pills a {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 500;
}
.pills a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.searchbar { display: flex; gap: 0.5rem; max-inline-size: 480px; }
.searchbar input { flex: 1; }

/* ---------- Product page ---------- */
.product {
    display: grid;
    gap: 2rem;
    margin-block: 2rem;
}
@media (min-width: 820px) {
    .product { grid-template-columns: 1fr 1fr; align-items: start; }
}
.product__gallery { position: sticky; inset-block-start: 90px; }
.product__main-img {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    background: var(--card) center / cover no-repeat;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 3rem;
}
.product__thumbs { display: flex; gap: 0.5rem; margin-block-start: 0.75rem; }
.product__thumbs img {
    inline-size: 72px;
    block-size: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    cursor: pointer;
}
.product__info h1 { margin: 0.25rem 0 0.75rem; font-size: 1.8rem; line-height: 1.3; }
.product__price { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-block: 0.75rem; }
.product__desc { color: var(--muted); }
.product__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 1.5rem; }

/* ---------- Pages & forms ---------- */
.prose { max-inline-size: 760px; margin-block: 2rem; }
.prose h1 { font-size: 1.9rem; }
.prose h2 { font-size: 1.4rem; margin-block-start: 2rem; }
.prose h3 { font-size: 1.15rem; margin-block-start: 1.5rem; }
.prose p, .prose li { color: #2b3440; }

.form { max-inline-size: 560px; display: grid; gap: 1rem; margin-block: 1.5rem; }
.form label { font-weight: 600; display: block; margin-block-end: 0.35rem; }
.form input, .form textarea {
    inline-size: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    background: var(--card);
}
.form input:focus, .form textarea:focus { border-color: var(--primary); outline: none; }
.form .error { color: var(--danger); font-size: 0.85rem; margin-block-start: 0.3rem; }
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    background: rgba(15, 110, 93, 0.12);
    color: var(--primary-ink);
    border: 1px solid rgba(15, 110, 93, 0.3);
    font-weight: 600;
}
/* Honeypot — visually removed, still in the DOM for bots */
.hp-field { position: absolute; inset-inline-start: -9999px; opacity: 0; block-size: 0; overflow: hidden; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 0.75rem; margin-block: 2rem; }

/* ---------- Footer ---------- */
.site-footer {
    margin-block-start: 4rem;
    background: var(--ink);
    color: #cfd6d3;
    padding-block: 2.5rem 1.5rem;
}
.site-footer a { color: #e8ecea; }
.site-footer a:hover { color: var(--accent); }
.site-footer__grid { display: grid; gap: 1.5rem; }
@media (min-width: 700px) { .site-footer__grid { grid-template-columns: 2fr 1fr; } }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer__bottom {
    border-block-start: 1px solid rgba(255, 255, 255, 0.12);
    margin-block-start: 1.5rem;
    padding-block-start: 1rem;
    font-size: 0.85rem;
    color: #9aa6a2;
}

/* ---------- WhatsApp FAB ---------- */
.wa-fab {
    position: fixed;
    inset-block-end: 22px;
    z-index: 45;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: #25d366;
    color: #fff;
    font-weight: 700;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}
.wa-fab:hover { background: #1ebe5b; color: #fff; transform: translateY(-2px); }
.wa-fab--start { inset-inline-start: 22px; }
.wa-fab--end { inset-inline-end: 22px; }
.wa-fab svg { inline-size: 22px; block-size: 22px; fill: currentColor; }

/* ---------- Popups ---------- */
.popup {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    place-items: center;
    padding: 1.25rem;
}
.popup.open { display: grid; }
.popup__overlay { position: absolute; inset: 0; background: rgba(27, 36, 48, 0.55); }
.popup__card {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.75rem;
    max-inline-size: 430px;
    inline-size: 100%;
    box-shadow: var(--shadow);
    text-align: center;
}
.popup__card h3 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.popup__card p { margin: 0 0 1.25rem; color: var(--muted); }
.popup__close {
    position: absolute;
    inset-block-start: 0.75rem;
    inset-inline-end: 0.75rem;
    inline-size: 36px;
    block-size: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--card);
    cursor: pointer;
    font-size: 1rem;
}
.popup__coupon {
    display: inline-block;
    border: 2px dashed var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.4rem 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-block-end: 1rem;
}

/* ---------- Responsive ---------- */
@media (min-width: 900px) {
    .main-nav { display: block; }
    .burger { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   محرّك المظهر — كلاسات التأثيرات التي يفعّلها التاجر من لوحته
   (تقرأ المتغيّرات المحقونة في <head>)
   ═══════════════════════════════════════════════════════════ */

/* الزوايا والظل والخط من المتغيّرات الديناميكية */
.card, .product-card, .panel { border-radius: var(--radius); box-shadow: var(--shadow);
    background: var(--card-bg-effective, var(--card));
    border-width: var(--card-border-width, 1px); }
.btn { border-radius: var(--radius-btn); }
h1, h2, h3 { text-transform: var(--heading-transform, none); }

/* كثافة المسافات (compact/comfortable/spacious) */
.section, .container > * + * { margin-block-start: calc(1.5rem * var(--space-scale, 1)); }

/* خلفية الترويسة والتذييل من المظهر */
.site-header { background: var(--header-bg, var(--card)); }
.site-footer { background: var(--footer-bg, var(--ink)); color: var(--footer-ink, var(--surface)); }

/* ── تأثير زجاجي (glassmorphism) ── */
.fx-glass .site-header {
    background: color-mix(in srgb, var(--header-bg) 72%, transparent);
    -webkit-backdrop-filter: var(--header-blur);
    backdrop-filter: var(--header-blur);
    position: sticky; top: 0; z-index: 50;
}
.fx-glass .card, .fx-glass .product-card, .fx-glass .panel {
    background: var(--card-bg-effective);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
    border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}

/* ── ارتفاع الكروت عند المرور ── */
.fx-lift .card, .fx-lift .product-card { transition: transform .2s ease, box-shadow .2s ease; }
.fx-lift .card:hover, .fx-lift .product-card:hover {
    transform: translateY(var(--lift, -4px));
    box-shadow: 0 18px 44px rgba(27,36,48,.16);
}

/* ── بانر متدرّج ── */
.fx-gradient-hero .hero, .fx-gradient-hero .home-banner {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
}

/* ── تعبئة الأزرار: ممتلئ/محدّد/متدرّج ── */
.fill-outline .btn { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.fill-outline .btn:hover { background: var(--primary); color: #fff; }
.fill-gradient .btn { background: linear-gradient(135deg, var(--primary), var(--accent)); border: 0; color: #fff; }
.fill-gradient .btn:hover { filter: brightness(1.08); color: #fff; }

/* ── أزرار متحرّكة ── */
.fx-anim-btn .btn { position: relative; overflow: hidden; transition: transform .15s ease; }
.fx-anim-btn .btn:hover { transform: translateY(-2px); }
.fx-anim-btn .btn::after {
    content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.25);
    transform: translateX(-100%); transition: transform .4s ease;
}
.fx-anim-btn .btn:hover::after { transform: translateX(100%); }

/* ── أيقونات البرغر ── */
.burger--dots span, .burger--dots span::before, .burger--dots span::after { border-radius: 50%; width: 5px; height: 5px; }
.burger--grid span { box-shadow: 6px 0 0 currentColor, 0 6px 0 currentColor, 6px 6px 0 currentColor; }

/* ── موضع البرغر ── */
.burger-pos-end .burger { order: 3; margin-inline-start: auto; }
.burger-pos-start .burger { order: 0; }

/* ── أنماط فتح القائمة (الجوال) ── */
.burger-fullscreen .drawer { inset: 0; width: 100%; height: 100%; }
.burger-dropdown .drawer { inset-block-start: 64px; inset-inline: 0; width: 100%; height: auto;
    max-height: 70vh; border-radius: 0 0 var(--radius) var(--radius); }

/* ── تخطيطات التذييل ── */
.foot-centered .site-footer__grid { text-align: center; grid-template-columns: 1fr; justify-items: center; }
.foot-minimal .site-footer__grid { grid-template-columns: 1fr; text-align: center; }
.foot-minimal .site-footer__grid > *:not(:first-child) { display: none; }

/* أعمدة التذييل القابلة للضبط */
.site-footer__grid { display: grid; gap: 2rem; grid-template-columns: repeat(var(--footer-cols, 3), 1fr); }
@media (max-width: 720px) { .site-footer__grid { grid-template-columns: 1fr; } }
