:root {
    --bg: #f5f8fc;
    --surface: #ffffff;
    --surface-soft: #eef4fb;
    --text: #102033;
    --muted: #5a6d82;
    --border: #dbe5f0;
    --accent: #0078e0;
    --accent-strong: #005fb3;
    --accent-contrast: #ffffff;
    --accent-warm: #f08800;
    --accent-warm-strong: #c96f00;
    --sponsored-bg: #fff4e5;
    --sponsored-text: #7a4200;
    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(16, 32, 51, 0.08);
    --max-width: 1200px;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #08111c;
    --surface: #0f1d2c;
    --surface-soft: #16283b;
    --text: #eaf2fb;
    --muted: #a9bdd4;
    --border: #253a52;
    --accent: #4da3ff;
    --accent-strong: #82c2ff;
    --accent-contrast: #04101d;
    --accent-warm: #ffb24d;
    --accent-warm-strong: #ffc778;
    --sponsored-bg: #3b2a10;
    --sponsored-text: #ffd28a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    [data-theme="system"] {
        --bg: #08111c;
        --surface: #0f1d2c;
        --surface-soft: #16283b;
        --text: #eaf2fb;
        --muted: #a9bdd4;
        --border: #253a52;
        --accent: #4da3ff;
        --accent-strong: #82c2ff;
        --accent-contrast: #04101d;
        --accent-warm: #ffb24d;
        --accent-warm-strong: #ffc778;
        --sponsored-bg: #3b2a10;
        --sponsored-text: #ffd28a;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
        color-scheme: dark;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3 {
    line-height: 1.25;
    margin-block: 0 0.6rem;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

h2 {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    margin-block-start: 2rem;
}

.container {
    width: min(100% - 2rem, var(--max-width));
    margin-inline: auto;
}

main {
    flex: 1;
    padding-block: 1.5rem 3rem;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -4rem;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    z-index: 100;
}

.skip-link:focus {
    top: 1rem;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px);
    border-block-end: 1px solid var(--border);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding-block: 0.75rem;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--text);
}

.primary-nav {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    max-width: 100%;
    padding-block: 0.15rem;
    scrollbar-width: thin;
}

.primary-nav a {
    color: var(--muted);
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.95rem;
}

.primary-nav a:hover {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-inline-start: auto;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    min-width: 0;
}

.search-form input {
    width: 13rem;
    max-width: 48vw;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-start-start-radius: var(--radius-sm);
    border-end-start-radius: var(--radius-sm);
    border-start-end-radius: 0;
    border-end-end-radius: 0;
    padding: 0.55rem 0.75rem;
    font: inherit;
}

.search-form button {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.55rem 0.9rem;
    font: inherit;
    font-weight: 600;
    border-start-end-radius: var(--radius-sm);
    border-end-end-radius: var(--radius-sm);
    cursor: pointer;
}

.lang-switch,
.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.7rem;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 42px;
}

.theme-toggle:hover,
.lang-switch:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.hero {
    background: linear-gradient(135deg, var(--surface), var(--surface-soft));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.5rem, 5vw, 3rem);
    margin-block: 0.5rem 1.5rem;
    box-shadow: var(--shadow);
}

.hero h1 {
    margin-block-end: 0.4rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    margin-block: 0 0.35rem;
}

.muted {
    color: var(--muted);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 1rem;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(16, 34, 32, 0.04);
    transition: transform 160ms ease, box-shadow 160ms ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.product-card__media {
    display: block;
    background: var(--surface-soft);
}

.product-card__media img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.product-card__body {
    padding: 0.85rem 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-card h3 {
    font-size: 1rem;
    margin: 0;
}

.product-card h3 a {
    color: var(--text);
}

.product-card h3 a:hover {
    color: var(--accent);
}

.price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-weight: 700;
    margin-block: 0.25rem 0;
}

.price s {
    font-weight: 400;
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    margin-block-end: 0.5rem;
}

.badge--sponsored {
    background: var(--sponsored-bg);
    color: var(--sponsored-text);
    border-color: transparent;
}

.placement {
    display: flex;
    flex-direction: column;
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    display: inline-block;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-block-end: 1rem;
}

.product-detail {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

.product-detail__media img {
    width: 100%;
    border-radius: var(--radius);
    background: var(--surface-soft);
    border: 1px solid var(--border);
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 0.5rem;
    margin-block-start: 0.5rem;
}

.gallery img {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.product-detail__body h1 {
    margin-block-start: 0.2rem;
}

.description {
    margin-block: 1rem;
}

.offers {
    display: grid;
    gap: 0.75rem;
}

.offer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.offer__merchant {
    font-weight: 700;
    margin: 0;
    flex: 1 1 100%;
}

.offer .price {
    margin: 0;
}

.button {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-contrast);
    border: 1px solid var(--accent);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    min-height: 44px;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    color: var(--accent-contrast);
    text-decoration: none;
}

.button--disabled {
    background: var(--surface-soft);
    color: var(--muted);
    border-color: var(--border);
    cursor: not-allowed;
}

.disclosure {
    margin-block-start: 1rem;
    padding: 0.75rem 0.9rem;
    border-inline-start: 4px solid var(--accent);
    background: var(--surface-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.92rem;
}

.disclosure__specific {
    display: block;
    margin-block-start: 0.35rem;
}

.notice {
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
}

.notice--small {
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
    margin-block-start: 0.35rem;
}

.search-form--page {
    max-width: 34rem;
    margin-block: 1rem 1.5rem;
}

.search-form--page input {
    width: 100%;
    max-width: none;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

.empty-state {
    text-align: center;
    padding-block: 4rem;
}

.site-footer {
    border-block-start: 1px solid var(--border);
    background: var(--surface);
    padding-block: 1.5rem;
    color: var(--muted);
}

.site-footer p {
    margin: 0.25rem 0;
}

@media (min-width: 760px) {
    .product-detail {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    }

    .product-detail__media {
        position: sticky;
        top: 6rem;
    }
}

@media (max-width: 759px) {
    .header-inner {
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        margin-inline-start: 0;
    }

    .search-form {
        flex: 1;
    }

    .search-form input {
        width: 100%;
        max-width: none;
    }

    .primary-nav {
        order: 3;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
