:root {
  /* ألوان الهوية: docs/brand-board.webp */
  --satin: #650b2b;        /* العنابي الأساسي: الأزرار والعناوين */
  --satin-deep: #4a0820;
  --satin-soft: #fad8e1;   /* وردي فاتح */
  --gold: #d4af37;         /* ذهبي: حواف وزخارف فقط */
  --gold-ink: #7a5a14;     /* ذهبي مقروء على الخلفيات الفاتحة */
  --gold-wash: #f8e9e4;    /* بيج */
  --paper: #fff1f3;        /* كريمي */
  --card: #ffffff;
  --ink: #2b0b17;
  --muted: #6e4b57;
  --line: #f0cfd8;
  --danger: #b42318;
  --ok: #1f6f4a;
  --radius: 14px;
  /* Thmanyah خط الهوية للعربية: يعمل تلقائيًا عند إضافة ملفاته في fonts.css */
  --font-display: 'Thmanyah', 'Readex Pro', sans-serif;
  --font-body: 'Thmanyah', 'Readex Pro', system-ui, sans-serif;
  --font-latin: 'Poppins', sans-serif;
  --gutter: 16px;
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.7 var(--font-body);
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0 0 .5em; color: var(--satin); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
[id] { scroll-margin-top: 80px; } /* حتى لا تغطي الترويسة الثابتة العناوين */
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .7em 1.4em; border-radius: 999px; border: 2px solid var(--satin);
  background: var(--satin); color: #fff; font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--satin-deep); border-color: var(--satin-deep); }
.btn--ghost { background: transparent; color: var(--satin); }
.btn--ghost:hover { background: var(--satin-soft); color: var(--satin); }
.btn--small { min-height: 40px; padding: .45em 1em; font-size: .95rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- الترويسة ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgb(255 255 255 / .96); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { text-decoration: none; display: grid; line-height: 1.1; }
.brand__lat { font: 700 1.3rem/1 var(--font-latin); color: var(--satin); direction: ltr; text-align: end; }
.brand__lat span { display: block; font-size: .62em; font-weight: 600; }
.brand__ar { font-size: .78rem; color: var(--muted); }
.site-nav { display: none; gap: 24px; }
.site-nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.site-nav a:hover { color: var(--satin); }
@media (min-width: 768px) { .site-nav { display: flex; } }

/* ---------- الواجهة: الشريطان يتدلّيان مثل الشال ---------- */
.hero { position: relative; overflow: hidden; background: var(--card); border-bottom: 1px solid var(--line); }
.hero .wrap { position: relative; display: grid; gap: 28px; padding-block: 56px 72px; padding-inline: 30px; }
.band {
  position: absolute; top: 0; bottom: 0; width: 22px; z-index: 0;
  background: linear-gradient(90deg, var(--satin-deep), var(--satin) 45%, #8e1538 55%, var(--satin));
  box-shadow: inset 3px 0 0 -1px var(--gold), inset -3px 0 0 -1px var(--gold);
  clip-path: polygon(0 0, 100% 0, 100% 92%, 50% 100%, 0 92%);
}
.band--start { inset-inline-start: 0; }
.band--end { inset-inline-end: 0; }
.hero h1 { font-size: clamp(2.5rem, 11vw, 5.2rem); line-height: 1.12; margin: 0; max-width: 11ch; }
.hero__lead { font-size: 1.15rem; color: var(--muted); max-width: 34ch; margin: 0; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
#addons-list { margin-top: 16px; padding-inline-start: 1.2em; }
.hero__media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; background: var(--satin-soft); }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 900px) {
  .hero .wrap { grid-template-columns: 1.1fr .9fr; align-items: center; padding-block: 88px 104px; padding-inline: 72px; }
  .hero .wrap:has(> .hero__media[hidden]) { grid-template-columns: 1fr; }
  .hero h1 { max-width: 14ch; }
  .band { width: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  .band { animation: drape .9s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes drape { from { transform: translateY(-100%); } }
}

.facts { display: grid; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.facts > div { background: var(--card); padding: 14px var(--gutter); display: grid; gap: 2px; }
.facts strong { color: var(--satin); }
.facts span { color: var(--muted); font-size: .92rem; }
@media (min-width: 768px) { .facts { grid-template-columns: repeat(4, 1fr); } }

/* ---------- الأقسام ---------- */
.section { padding-block: 56px; }
.section--card { background: var(--card); border-block: 1px solid var(--line); }
.section__head { max-width: 60ch; margin-bottom: 28px; }
.section__head p { color: var(--muted); margin: 0; }

.products { display: grid; gap: 20px; }
@media (min-width: 720px) { .products { grid-template-columns: repeat(3, 1fr); } }
.product { display: grid; grid-template-rows: auto 1fr; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; }
.product__img { aspect-ratio: 3 / 4; background: var(--satin-soft); border-bottom: 3px solid var(--gold); }
.product__img { background: #fff; }
.product__img img { width: 100%; height: 100%; object-fit: contain; }
.product__body { padding: 16px 18px 20px; display: grid; gap: 4px; align-content: start; }
.product__body h3 { margin: 0; }
.product__price { color: var(--gold-ink); font-weight: 600; }
.product:hover h3 { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 6px; }

.categories { display: grid; gap: 20px; }
@media (min-width: 720px) { .categories { grid-template-columns: repeat(3, 1fr); } }
.category { display: grid; grid-template-rows: auto 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; text-decoration: none; color: inherit; }
.category__img { aspect-ratio: 1 / 1; background: var(--satin-soft); }
.category__img img { width: 100%; height: 100%; object-fit: cover; }
.category__body { padding: 18px 20px 22px; display: grid; gap: 6px; align-content: start; }
.category__body h3 { margin: 0; font-size: 1.4rem; }
.category__body p { margin: 0 0 12px; color: var(--muted); }
.category__body .btn { align-self: end; }
.category:hover .btn:not(.btn--ghost) { background: var(--satin-deep); border-color: var(--satin-deep); }
.category--soon .btn { cursor: default; opacity: .7; }

.tools { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tools li { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--satin-soft); color: var(--satin); font-weight: 500; }
.tools svg { width: 22px; height: 22px; flex: none; }

.price-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.price-table th, .price-table td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); }
.price-table thead th { background: var(--satin); color: #fff; font-weight: 600; }
.price-table td.num, .price-table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.price-table tr:last-child td { border-bottom: 0; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(7, 1fr); } }
.steps li { counter-increment: step; display: grid; gap: 8px; align-content: start; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--gold); color: var(--satin); font: 700 1.1rem var(--font-display);
}

.terms { display: grid; gap: 14px; }
@media (min-width: 720px) { .terms { grid-template-columns: repeat(2, 1fr); } }
.terms > div { padding: 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.terms h3 { margin-bottom: .3em; }
.terms p { margin: 0; color: var(--muted); }

.site-footer { padding-block: 32px 96px; color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

/* ---------- تنبيه العربون ---------- */
.notice {
  padding: 14px 16px; border-radius: 12px; background: var(--gold-wash); border-inline-start: 4px solid var(--gold);
  color: var(--ink); font-weight: 500;
}
.notice strong { color: var(--gold-ink); }

/* ---------- صفحة المنتج ---------- */
.product-page { display: grid; gap: 28px; padding-block: 28px 120px; }
@media (min-width: 900px) { .product-page { grid-template-columns: 1fr 1fr; align-items: start; } .product-page__media { position: sticky; top: 88px; } }
.product-page__media { border-radius: var(--radius); overflow: hidden; background: var(--satin-soft); aspect-ratio: 3 / 4; border-bottom: 4px solid var(--gold); }
.product-page__media { position: relative; margin: 0; background: #fff; }
.product-page__media img { width: 100%; height: 100%; object-fit: contain; }
.product-page__media figcaption { position: absolute; inset-inline: 12px; bottom: 12px; padding: 6px 12px; border-radius: 999px; background: rgb(255 255 255 / .92); color: var(--muted); font-size: .85rem; text-align: center; }
.product-page__media figcaption[hidden] { display: none; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.option { border: 0; padding: 0; margin: 0 0 22px; }
.option legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice label {
  display: grid; gap: 2px; min-height: 56px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); cursor: pointer; transition: border-color .15s;
}
.choice label small { color: var(--muted); font-size: .85rem; }
.choice label img { width: 56px; height: 75px; object-fit: contain; background: #fff; border-radius: 8px; margin-bottom: 4px; }
.choice label small.extra { color: var(--gold-ink); font-weight: 600; }
.choice input:checked + label { border-color: var(--satin); box-shadow: inset 0 0 0 1px var(--satin); }
.choice input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--satin); flex: none; }
.toggle img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.toggle span { flex: 1; }
.toggle b { color: var(--gold-ink); white-space: nowrap; }
.toggle:has(input:checked) { border-color: var(--satin); }
.stack { display: grid; gap: 10px; }

.design-status { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px dashed var(--gold); border-radius: 12px; background: var(--card); margin-bottom: 22px; }
.design-status img { width: 64px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--satin-soft); }
.design-status div { flex: 1; }

.summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.summary dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.summary .total { font-weight: 700; color: var(--satin); font-size: 1.15rem; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.summary .deposit { color: var(--gold-ink); font-weight: 600; }
.summary .note { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); margin-top: 4px; }

.buybar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px;
}
.buybar__price { flex: 1; line-height: 1.3; }
.buybar__price b { display: block; color: var(--satin); font-size: 1.15rem; }
.buybar__price small { color: var(--muted); }
@media (min-width: 900px) { .buybar { position: static; border: 0; padding: 0; background: none; } }

/* ---------- أداة التخصيص ---------- */
.studio { display: grid; gap: 16px; padding-block: 16px 120px; }
@media (min-width: 900px) { .studio { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
.stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; place-items: center; }
.studio > *, .checkout > *, .product-page > * { min-width: 0; } /* عناصر الشبكة لا تتقلص تحت محتواها افتراضيًا */
.stage__frame { width: 100%; max-width: 520px; overflow: hidden; }
.stage__frame canvas { border-radius: 10px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 16px; }
.add-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.add-row .btn { flex-direction: column; gap: 4px; border-radius: 12px; min-height: 64px; padding: 8px; font-size: .9rem; }
.add-row input[type=file] { display: none; }
.editor { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.editor[hidden] { display: none; }
.editor__empty { color: var(--muted); margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed=true] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--satin); }
.swatches input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: none; padding: 2px; }
.range { display: grid; gap: 4px; }
.range input { width: 100%; accent-color: var(--satin); }
.font-warning { font-size: .88rem; }

/* ---------- النماذج ---------- */
.checkout { display: grid; gap: 24px; padding-block: 24px 120px; }
@media (min-width: 900px) { .checkout { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } .checkout aside { position: sticky; top: 88px; } }
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); font: inherit; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--satin); outline: none; }
.field .hint { font-size: .88rem; color: var(--muted); }
.field .error { font-size: .9rem; color: var(--danger); font-weight: 500; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.form-error { padding: 12px 14px; border-radius: 12px; background: #fdecea; color: var(--danger); font-weight: 500; }

.cal { display: grid; gap: 18px; }
.cal__month h3 { font-size: 1rem; margin-bottom: 8px; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal__dow { text-align: center; font-size: .78rem; color: var(--muted); }
.cal__day {
  min-height: 48px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); font: 600 .95rem var(--font-body);
  color: var(--ink); cursor: pointer; display: grid; place-items: center; line-height: 1.1; padding: 2px;
}
.cal__day small { display: block; font-size: .62rem; font-weight: 500; color: var(--danger); }
.cal__day[disabled] { background: var(--paper); color: #9aa5a0; cursor: not-allowed; border-style: dashed; }
.cal__day[aria-pressed=true] { background: var(--satin); border-color: var(--satin); color: #fff; }
.cal__legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--muted); }

/* ---------- صفحة الطلب ---------- */
.done { padding-block: 32px 96px; display: grid; gap: 20px; max-width: 640px; }
.done__badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--gold-wash); color: var(--gold-ink); font-weight: 600; }
.order-number { font: 700 1.6rem var(--font-display); color: var(--satin); direction: ltr; text-align: end; }

.toast {
  position: fixed; inset-inline: var(--gutter); bottom: 88px; z-index: 50; margin-inline: auto; max-width: 420px;
  padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; text-align: center;
}
.toast--error { background: var(--danger); }
