/* OMARLAB store.
   Two themes live side by side as CSS variables under [data-theme="..."].
   To add a theme: copy one of the two blocks below, change the variables,
   add the id to site/themes.js. Everything past the theme blocks reads
   only the variables, so a new theme needs no other CSS changes unless it
   wants a different edge/shadow treatment (see --card-edge). */

@font-face {
  font-family: "Press Start 2P";
  src: url("assets/fonts/press-start-2p-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Jersey 15";
  src: url("assets/fonts/jersey-15-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
/* Pixel fonts have no Arabic glyphs; Arabic text falls back to Tajawal. */
@font-face {
  font-family: "Tajawal";
  src: url("assets/fonts/tajawal-arabic-400-normal.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
  font-family: "Tajawal";
  src: url("assets/fonts/tajawal-arabic-700-normal.woff2") format("woff2");
  font-weight: 700 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---------- theme: retro (pixel-art, the original look) ---------- */
:root,
[data-theme="retro"] {
  --bg: #12437e;             /* sampled from the logo background */
  --panel: #0c2f5a;          /* panels sitting on the background */
  --ink: #ffffff;
  --dim: rgba(255, 255, 255, 0.76);
  --grid: rgba(255, 255, 255, 0.07);
  --rule: rgba(255, 255, 255, 0.35);
  --accent-free: #7CFF9B;
  --px: 4px;
  --font-display: "Press Start 2P", "Jersey 15", "Tajawal", monospace;
  --font-body: "Jersey 15", "Tajawal", system-ui, sans-serif;
  --radius: 0px;
  --edge-style: notched; /* see .px rule below */
  --btn-weight: 700;
  --body-size: 22px;
  --show-bg-grid: block;
}

/* ---------- theme: modern (clean, system fonts, no pixel notch) ---------- */
[data-theme="modern"] {
  --bg: #0f1220;
  --panel: #171b2e;
  --ink: #f3f5fb;
  --dim: rgba(243, 245, 251, 0.7);
  --grid: rgba(255, 255, 255, 0);
  --rule: rgba(255, 255, 255, 0.16);
  --accent-free: #3ddc84;
  --px: 1px;
  --font-display: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --edge-style: soft;
  --btn-weight: 600;
  --body-size: 17px;
  --show-bg-grid: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: 1.45;
  /* Jersey 15 has one weight; never fake a bold, it smears the pixels. */
  font-synthesis: none;
  font-variant-ligatures: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
[data-theme="retro"] body { background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px); }
[data-theme="modern"] body { background-image: none; }

/* ---------- retro theme: simulated pixel look for Arabic ----------
   Press Start 2P / Jersey 15 have no Arabic glyphs, so Arabic text always
   falls back to Tajawal — a plain, non-pixel font. There is no open-license
   Arabic pixel font bundled locally (no network access at build time to
   source one — see HANDOFF-2.md #2), so this approximates the retro/pixel
   feel on Tajawal itself with harder edges, wider tracking, and a stepped
   text-shadow "notch". It is a stand-in, not a real pixel typeface — swap it
   for a bundled Arabic pixel woff2 later by adding it to the @font-face
   list above and it will be picked up automatically (Tajawal stays as the
   fallback). Scoped to retro + Arabic only; English retro and the modern
   theme (both languages) are untouched. */
html[lang="ar"][data-theme="retro"] {
  --ar-pixel-shadow:
    1px 0 0 var(--bg),
    -1px 0 0 var(--bg),
    0 1px 0 var(--bg),
    0 -1px 0 var(--bg),
    2px 2px 0 var(--ink);
}
html[lang="ar"][data-theme="retro"] h1,
html[lang="ar"][data-theme="retro"] h2,
html[lang="ar"][data-theme="retro"] h3,
html[lang="ar"][data-theme="retro"] .btn,
html[lang="ar"][data-theme="retro"] .chip,
html[lang="ar"][data-theme="retro"] .tab,
html[lang="ar"][data-theme="retro"] .brand span {
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 2px 2px 0 var(--bg);
  font-variant-ligatures: none;
  -webkit-font-smoothing: none;
}
html[lang="ar"][data-theme="retro"] body {
  letter-spacing: 0.01em;
}

img { max-width: 100%; }
a { color: inherit; }

:focus-visible {
  outline: max(var(--px), 3px) dashed var(--ink);
  outline-offset: 8px;
}
a:not(.btn):focus-visible { outline-offset: 4px; }

.wrap {
  width: min(100% - 48px, var(--wrap, 1120px));
  margin-inline: auto;
}

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -80px;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--bg);
  z-index: 20;
}
.skip:focus { top: 12px; }

/* Notched pixel edge in retro; a soft border+shadow in modern. Both driven
   by the same variables so productCard()/el() markup never has to change. */
.px, .btn, .chip, .card, .project, .state, .news-viewport {
  --edge: var(--ink);
  border-radius: var(--radius);
}
[data-theme="retro"] .px,
[data-theme="retro"] .btn,
[data-theme="retro"] .chip,
[data-theme="retro"] .card,
[data-theme="retro"] .project,
[data-theme="retro"] .state,
[data-theme="retro"] .news-viewport {
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--edge),
    0 var(--px) 0 0 var(--edge),
    calc(var(--px) * -1) 0 0 0 var(--edge),
    var(--px) 0 0 0 var(--edge);
}
[data-theme="modern"] .card,
[data-theme="modern"] .project,
[data-theme="modern"] .state,
[data-theme="modern"] .news-viewport {
  box-shadow: 0 1px 0 0 var(--rule) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--rule);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: var(--px) solid var(--ink);
}
[data-theme="modern"] .site-header {
  background: color-mix(in srgb, var(--bg) 92%, black);
  border-bottom-color: var(--rule);
  backdrop-filter: saturate(140%) blur(6px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-block: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font: 400 15px/1 var(--font-display);
}
[data-theme="modern"] .brand { font-weight: 800; font-size: 19px; letter-spacing: 0.02em; }
.brand img { image-rendering: pixelated; }
[data-theme="modern"] .brand img { image-rendering: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.nav a { text-decoration: none; font-weight: 600; }
.nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: var(--px);
  text-underline-offset: 6px;
}

.pickers { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.picker-group { display: flex; align-items: center; gap: 8px; }
.picker-label { font-size: 0.7em; color: var(--dim); white-space: nowrap; }
.picker-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- buttons and chips ---------- */

.btn, .chip {
  display: inline-block;
  margin: var(--px);
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-body);
  font-weight: var(--btn-weight);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
}
.btn { padding: 8px 20px; font-size: var(--body-size); }
.chip { padding: 4px 14px; font-size: calc(var(--body-size) * 0.9); }
.chip-picker { padding: 3px 12px; font-size: 0.72em; }
.chip-sub { font-size: calc(var(--body-size) * 0.8); opacity: 0.92; }

.btn:hover { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 var(--px) var(--ink); }
[data-theme="modern"] .btn:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn:active, .chip:active { transform: translateY(var(--px)); }

.btn-ghost, .chip { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 var(--px) var(--ink); }
[data-theme="retro"] .btn-ghost, [data-theme="retro"] .chip { box-shadow: none; }
.btn-ghost:hover, .chip:hover { background: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.btn.is-off {
  background: transparent;
  color: var(--dim);
  --edge: var(--rule);
  box-shadow: inset 0 0 0 var(--px) var(--rule);
  cursor: default;
}
.btn.is-off:active { transform: none; }

/* ---------- purchase confirmation dialog ----------
   Built by shared.js openCheckoutConfirm(). Every "Buy now" click opens this
   before any buy_url is reached — see shared.js for why it's the only place
   allowed to open one. Not a <dialog> element (keeps behavior identical and
   simple across older WebViews some visitors may use), just a fixed overlay. */

.checkout-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
}
.checkout-confirm {
  width: min(100%, 460px);
  max-height: min(90vh, 640px);
  overflow-y: auto;
  padding: 24px;
  background: var(--panel);
  border: var(--px) solid var(--ink);
  box-shadow: 0 1px 0 0 var(--rule) inset, 0 12px 32px rgba(0, 0, 0, 0.4);
}
[data-theme="modern"] .checkout-confirm { border-color: var(--rule); }
.checkout-confirm h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.35;
}
.checkout-confirm-body { margin: 0 0 16px; color: var(--dim); font-size: 0.92em; line-height: 1.5; }
.checkout-confirm-links {
  list-style: none;
  margin: 0 0 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border-inline-start: 3px solid var(--ink);
  font-size: 0.9em;
}
.checkout-confirm-links a { color: var(--ink); }
.checkout-confirm-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 0.88em;
  line-height: 1.5;
  cursor: pointer;
}
.checkout-confirm-checkbox-row input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; cursor: pointer; }
.checkout-confirm-required { margin: 0 0 12px; color: #ff8a8a; font-size: 0.85em; }
.checkout-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.checkout-confirm-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.checkout-confirm-actions .btn:disabled:hover { background: var(--ink); color: var(--bg); }

.buy-block { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 220px; }
.buy-note { margin: 0; color: var(--dim); font-size: 0.62em; line-height: 1.4; text-align: end; }
.contact-note {
  padding: 8px 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.72em;
  text-align: start;
  max-width: 100%;
}

/* ---------- hero ---------- */

.hero { padding-block: 64px 8px; }
.hero .wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero h1 {
  margin: 0 0 24px;
  font: 400 clamp(20px, 3vw, 29px) / 1.65 var(--font-display);
}
[data-theme="modern"] .hero h1 { font-weight: 800; }
.hero p {
  max-width: 30em;
  margin: 0 0 32px;
  color: var(--dim);
  font-size: 1.1em;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: calc(var(--px) * -1); }

/* The retro logo's blue equals the page background, so "lighten" lets the
   grid show through it. Modern theme has a darker background, so the logo
   is shown plainly with a soft panel behind it instead. */
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: lighten;
  animation: scan 0.9s steps(9) both;
}
[data-theme="modern"] .hero-art img {
  mix-blend-mode: normal;
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
@keyframes scan {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}
[data-theme="modern"] .hero-art img { animation: fade-up 0.5s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Screen-reader-only text: visually hidden but still announced. Used for the
   mini ticker's accessible readout (the animated strip itself is aria-hidden). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- compact bar: no-shipping notice + mini news ticker ----------
   Sits directly under the header (which is itself sticky/pinned — see
   .site-header above), in normal document flow otherwise (NOT sticky/fixed
   itself) — it scrolls away with the rest of the page like any other
   section once the visitor scrolls past it. */

.mini-bar { margin-top: 0; }

.no-shipping {
  margin: 0 0 10px;
  padding: 10px 16px;
  background: var(--panel);
  color: var(--dim);
  font-size: 0.82em;
  line-height: 1.5;
  border-inline-start: calc(var(--px) * 2) solid var(--accent-free);
}
[data-theme="modern"] .no-shipping { border-radius: var(--radius); }

/* The strip itself: a small, full-bleed bar. Empty state is solid black with
   no text at all (per Omar's spec) — .is-empty simply drops the track content
   (renderMiniTicker() clears it) and forces the background to black. */
.mini-ticker {
  overflow: hidden;
  background: var(--panel);
  border-block: var(--px) solid var(--ink);
  min-height: 40px;
  display: flex;
  align-items: center;
}
[data-theme="modern"] .mini-ticker { border-block-color: var(--rule); }
.mini-ticker.is-empty { background: #000; border-color: #000; }

.mini-ticker-track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: mini-ticker-scroll 28s linear infinite;
}
/* RTL: text direction is still left-to-right motion per spec ("يتحرك جهة
   اليمين باستمرار" = keeps moving toward the right), so the animation is the
   same in both directions — only the glyph shaping inside each item flips
   via dir="auto" on the item itself. */
@keyframes mini-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.mini-ticker-run {
  display: flex;
  flex-shrink: 0;
  gap: 64px;
  padding-inline-end: 64px;
  white-space: nowrap;
}
.mini-ticker-item {
  font-family: var(--font-body);
  font-size: 0.9em;
  color: var(--ink);
}
.mini-ticker:hover .mini-ticker-track,
.mini-ticker:focus-within .mini-ticker-track { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .mini-ticker-track { animation: none; }
}

/* ---------- tabs ---------- */

.tabs-wrap { margin-block: 28px 0; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: var(--px) solid var(--ink);
  padding-bottom: 0;
}
[data-theme="modern"] .tabs { border-bottom-color: var(--rule); }
.tab {
  margin: 0;
  padding: 10px 22px;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-body);
  font-weight: var(--btn-weight);
  font-size: var(--body-size);
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  top: var(--px);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--panel);
  box-shadow:
    calc(var(--px) * -1) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink),
    0 calc(var(--px) * -1) 0 0 var(--ink);
}
[data-theme="modern"] .tab[aria-selected="true"] {
  box-shadow: none;
  border: 1px solid var(--rule);
  border-bottom-color: var(--panel);
}
.tabpanel { padding-block: 40px 0; }

/* ---------- sections ---------- */

.section { padding-block: 72px 0; }
.section h2 {
  margin: 0 0 14px;
  font: 400 clamp(18px, 2.4vw, 24px) / 1.4 var(--font-display);
}
[data-theme="modern"] .section h2 { font-weight: 800; }
.lede { margin: 0 0 32px; max-width: 40em; color: var(--dim); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px calc(var(--px) * -1); }
.filters-sub { margin-top: -4px; margin-bottom: 28px; }
.filters:last-of-type { margin-bottom: 36px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 36px;
  padding: var(--px);
}

/* ---------- product card ---------- */

.card { display: flex; flex-direction: column; background: var(--panel); overflow: hidden; }
/* The image+title link to product.html; strip default link styling so it
   reads as part of the card, not as inline text. The buy button below it is
   a separate control, not nested inside this link. */
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover h3,
.card-link:focus-visible h3 { text-decoration: underline; }
.card-media {
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border-bottom: var(--px) solid var(--ink);
  overflow: hidden;
}
[data-theme="modern"] .card-media { border-bottom-color: var(--rule); }
.card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-media img.is-placeholder { object-fit: contain; padding: 26px; image-rendering: pixelated; }
[data-theme="modern"] .card-media img.is-placeholder { image-rendering: auto; opacity: 0.6; }
.card-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 8px; }
.card h3 { margin: 0; font-family: var(--font-body); font-size: 1.27em; font-weight: 700; line-height: 1.1; }
.card p {
  margin: 0;
  color: var(--dim);
  font-size: var(--body-size);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 16px 20px 20px;
}
.price { font: 400 15px / 1.4 var(--font-display); }
[data-theme="modern"] .price { font-weight: 700; font-size: 1em; }
.price-text { font-family: var(--font-body); font-size: var(--body-size); font-weight: 700; line-height: 1.2; }
.price-free { color: var(--accent-free); }

.tag {
  align-self: flex-start;
  padding: 2px 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.86em;
  font-weight: 700;
  line-height: 1.35;
  border-radius: calc(var(--radius) * 0.5);
}
.tag-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---------- projects ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 36px;
  padding: var(--px);
}
.project { display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--panel); }
.project h3 { margin: 0; font-family: var(--font-body); font-size: 1.45em; font-weight: 700; line-height: 1.1; }
.project p { margin: 0; color: var(--dim); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.project-link { align-self: flex-start; font-weight: 700; }
.project-files {
  display: grid;
  gap: 14px;
  margin: 8px 0 0;
  padding: 18px 0 0;
  border-top: var(--px) dashed var(--rule);
  list-style: none;
}
.project-files li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.project-files .file-name { font-weight: 600; padding-top: 6px; }
.project-files .file-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ---------- news ticker ---------- */

.news { max-width: 760px; }
.news-viewport {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  min-height: 132px;
}
.news-track { position: relative; }
.news-slide {
  padding: 24px 28px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.news-slide[aria-hidden="true"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
}
[dir="rtl"] .news-slide[aria-hidden="true"] { transform: translateX(-24px); }
.news-slide[aria-hidden="false"] { opacity: 1; transform: translateX(0); animation: news-in 0.6s ease both; }
@keyframes news-in {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
[dir="rtl"] .news-slide[aria-hidden="false"] { animation-name: news-in-rtl; }
@keyframes news-in-rtl {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}
.news-slide time { color: var(--dim); font-size: 0.9em; }
.news-slide h3 { margin: 4px 0 8px; font-family: var(--font-body); font-size: 1.27em; font-weight: 700; line-height: 1.15; }
.news-slide p { margin: 0; color: var(--dim); }

.news-controls { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.news-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 var(--px) var(--rule);
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
}
[data-theme="retro"] .news-btn { box-shadow: inset 0 0 0 2px var(--ink); }
.news-btn:hover { background: var(--ink); color: var(--bg); }
.news-counter { color: var(--dim); font-size: 0.85em; }

@media (prefers-reduced-motion: reduce) {
  .news-slide, .news-slide[aria-hidden="true"], .news-slide[aria-hidden="false"] {
    transition: none;
    animation: none;
    transform: none;
  }
}

/* ---------- empty and error states ---------- */

.state { margin: var(--px); padding: 24px; background: var(--panel); grid-column: 1 / -1; }
.state strong { display: block; margin-bottom: 4px; }
.state span { color: var(--dim); }

/* ---------- footer ---------- */

.site-footer { margin-top: 96px; border-top: var(--px) solid var(--ink); background: var(--bg); }
[data-theme="modern"] .site-footer { border-top-color: var(--rule); }
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
  padding-block: 28px;
  color: var(--dim);
  font-size: 0.9em;
}
.footer-legal { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-legal a { color: var(--dim); text-decoration: none; }
.footer-legal a:hover, .footer-legal a:focus-visible { color: var(--ink); text-decoration: underline; }

/* ---------- back-link (used on product.html and legal/*.html) ---------- */

.back-link {
  display: inline-block;
  margin-block: 24px 8px;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.9em;
}
.back-link:hover, .back-link:focus-visible { color: var(--ink); text-decoration: underline; }

/* ---------- product detail page (product.html) ---------- */

.product-page { padding-block: 8px 96px; }
.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
@media (max-width: 820px) {
  .product-detail { grid-template-columns: 1fr; }
}

.product-gallery-main {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--panel);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--edge, var(--ink)),
    0 var(--px) 0 0 var(--edge, var(--ink)),
    calc(var(--px) * -1) 0 0 0 var(--edge, var(--ink)),
    var(--px) 0 0 0 var(--edge, var(--ink));
}
[data-theme="modern"] .product-gallery-main { box-shadow: 0 1px 0 0 var(--rule) inset, 0 8px 24px rgba(0, 0, 0, 0.25); border: 1px solid var(--rule); }
.product-gallery-main img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-gallery-main img.is-placeholder { object-fit: contain; padding: 40px; image-rendering: pixelated; }

.product-gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.product-gallery-thumb {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: var(--panel);
  box-shadow: inset 0 0 0 var(--px) var(--rule);
  overflow: hidden;
}
.product-gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-gallery-thumb[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.product-gallery-thumb:hover { box-shadow: inset 0 0 0 var(--px) var(--ink); }

.product-info h1 { margin: 6px 0 16px; font-family: var(--font-display); font-size: clamp(20px, 3vw, 27px); line-height: 1.3; }
.product-description { margin: 0 0 24px; color: var(--dim); line-height: 1.6; }
.product-buy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.product-buy-row .price { font-size: 1.3em; }

/* ---------- legal pages (warranty / refund-exchange / user-rights) ----------
   The policy text is authoritative Arabic regardless of the interface
   language picker (see legal/legal.js) — kept in a narrower reading column
   than the store's .wrap for long-form legibility, and always rendered rtl
   even when the picked theme/lang is ltr, since .legal-body carries its own
   lang="ar" dir="rtl". */

.legal-page { max-width: 46em; margin-inline: auto; padding-block: 8px 96px; }
.legal-body { font-family: var(--font-body); line-height: 1.7; }

.legal-store {
  margin: 0 0 4px;
  color: var(--dim);
  font-size: 0.8em;
  letter-spacing: 0.04em;
}
.legal-body h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 30px);
  line-height: 1.3;
}
.legal-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 32px;
  color: var(--dim);
  font-size: 0.85em;
}
.legal-body h2 {
  margin: 40px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.4;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
}
/* A "باب" (part) heading — one level above the numbered مادة sections,
   used only in user-rights.html. Visually heavier so the document's
   top-level structure is easy to scan. */
.legal-body h2.legal-bab {
  margin-top: 56px;
  padding-bottom: 12px;
  font-size: clamp(19px, 2.6vw, 23px);
  border-bottom-width: var(--px);
  border-bottom-color: var(--ink);
}
.legal-body h3 {
  margin: 28px 0 4px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05em;
}
.legal-body p { margin: 0 0 16px; color: var(--ink); }
.legal-body > p:first-of-type + h1 + .legal-dates + h2 { margin-top: 0; }

.legal-clauses { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.legal-clauses li { margin: 0; }
.legal-num {
  display: inline-block;
  min-width: 2.6em;
  margin-inline-end: 6px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
}
.legal-subitem { padding-inline-start: 2.6em; }
.legal-letter { display: inline-block; margin-inline-end: 4px; color: var(--dim); }

/* The one placeholder line deliberately left unfilled (privacy section,
   user-rights.html — see convert.py, which tags that exact paragraph with
   this class) — a bright, impossible-to-miss warning box so it never ships
   unnoticed. Remove this rule (and the paragraph itself) once the note is
   addressed and deleted from the source text. */
.legal-owner-note {
  margin: 4px 0 20px;
  padding: 14px 16px;
  background: color-mix(in srgb, #ffb020 18%, var(--panel));
  border: var(--px) solid #ffb020;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.92em;
}

/* ---------- small screens and motion ---------- */

@media (max-width: 820px) {
  .hero { padding-top: 40px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 32px; }
  .section { padding-top: 56px; }
  .buy-block { align-items: flex-start; }
  .buy-note { text-align: start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-art img { animation: none; }
  .btn:active, .chip:active { transform: none; }
}

/* ---------- image lightbox (product page) ---------- */
.product-gallery-main.is-zoomable { cursor: zoom-in; }
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}
.lightbox-img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  width: 44px;
  height: 44px;
  font: inherit;
  font-size: 1.2em;
  line-height: 1;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--ink);
  cursor: pointer;
}
