/* =========================================================
   مكتبة البيان — "طاولة البروفة" Design System v2
   ورق · حبر · طباعة · CMYK · خط عربي
   ========================================================= */
:root {
  /* ألوان */
  --paper: #F4F1EA;
  --paper-2: #EAE4D8;
  --paper-3: #FBF9F4;
  --ink: #0E1726;
  --ink-2: #394154;
  --blue: #283A8F;          /* أزرق الشعار */
  --blue-2: #3A4FB5;
  --navy: #131A44;
  --navy-2: #1C245C;
  --c: #00A0DC; --m: #E4007C; --y: #FFD400; --k: #0E1726;
  --on-navy-2: #BCC3EA;
  --on-blue-2: #D5DAF5;
  --rule: rgba(14, 23, 38, .14);

  /* خطوط */
  --f-display: "Alexandria", "IBM Plex Sans Arabic", sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Alexandria", sans-serif;
  --f-editorial: "Noto Naskh Arabic", "IBM Plex Sans Arabic", serif;

  /* سلم الأحجام — fluid بين 390 و 1440 */
  --fs-display: clamp(2.5rem, 1.6rem + 3.7vw, 4.5rem);
  --fs-h2: clamp(2rem, 1.45rem + 2.25vw, 3.375rem);
  --fs-h3: clamp(1.375rem, 1.18rem + .8vw, 1.875rem);
  --fs-h4: clamp(1.125rem, 1.05rem + .3vw, 1.3125rem);
  --fs-lead: clamp(1.0625rem, 1rem + .28vw, 1.25rem);
  --fs-body: 1.0625rem;
  --fs-small: .9375rem;
  --fs-label: .8125rem;

  /* ارتفاع الأسطر — العربية تحتاج مساحة للنقاط والهمزات */
  --lh-display: 1.34;
  --lh-head: 1.38;
  --lh-sub: 1.5;
  --lh-body: 1.9;
  --track-display: 0;
  --track-head: 0;

  --pad: clamp(20px, 5vw, 72px);
  --r: 2px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}
html[lang="en"] {
  --lh-display: 1.02; --lh-head: 1.08; --lh-sub: 1.3; --lh-body: 1.62;
  --track-display: -0.035em; --track-head: -0.025em;
  --fs-display: clamp(2.75rem, 1.7rem + 4.3vw, 5.25rem);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--fs-body)/var(--lh-body) var(--f-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-kerning: normal; -webkit-tap-highlight-color: transparent;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; font-weight: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
p { text-wrap: pretty; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: var(--r); }
.gov :focus-visible, .stationery :focus-visible, .finale :focus-visible { outline-color: var(--y); }
html { scrollbar-color: var(--blue) var(--paper-2); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--blue); border: 2px solid var(--paper-2); border-radius: 8px; }
.num { font-variant-numeric: tabular-nums lining-nums; direction: ltr; unicode-bidi: isolate; letter-spacing: .01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 16px; transition: top .2s var(--ease-out); }
.skip:focus { top: 12px; }
.ico { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; flex: none; }
.ico svg { width: 100%; height: 100%; }
[dir="rtl"] .dir-icon { transform: scaleX(-1); }
[dir="ltr"] .flip .dir-icon { transform: scaleX(-1); }
[dir="rtl"] .flip .dir-icon { transform: none; }

/* ---------- Typography system ---------- */
.t-display, .hero-title, .end-title {
  font-family: var(--f-display); font-weight: 700; font-size: var(--fs-display);
  line-height: var(--lh-display); letter-spacing: var(--track-display); text-wrap: balance;
}
.h2 { font: 700 var(--fs-h2)/var(--lh-head) var(--f-display); letter-spacing: var(--track-head); text-wrap: balance; }
.h3 { font: 600 var(--fs-h3)/var(--lh-sub) var(--f-display); letter-spacing: calc(var(--track-head) * .5); text-wrap: balance; }
.lead { font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--ink-2); max-width: 52ch; }
html[lang="ar"] .lead, html[lang="ar"] .hero-sub, html[lang="ar"] .statement { font-family: var(--f-editorial); font-weight: 500; }
.note { font-size: var(--fs-small); line-height: var(--lh-body); color: var(--ink-2); max-width: 60ch; }
.label { font: 500 var(--fs-label)/1.4 var(--f-display); }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--ink); --fg: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-height: 52px; padding: 0 1.45em;
  background: var(--bg); color: var(--fg); border: 1.5px solid var(--bg); border-radius: 999px;
  font: 600 1rem/1.2 var(--f-body); white-space: nowrap; cursor: pointer; user-select: none;
  transition: transform 140ms var(--ease-out), background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-ink { --bg: var(--ink); --fg: var(--paper); }
.btn-blue { --bg: var(--blue); --fg: #fff; }
.btn-paper { --bg: var(--paper); --fg: var(--navy); }
.btn-line { background: transparent; color: var(--ink); border-color: currentColor; }
@media (hover: hover) and (pointer: fine) {
  .btn-ink:hover { --bg: var(--blue); }
  .btn-blue:hover { --bg: var(--navy); }
  .btn-paper:hover { --bg: var(--y); }
  .btn-line:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
}

/* ---------- proof marks ---------- */
.crop { position: absolute; width: 22px; height: 22px; pointer-events: none; color: var(--ink); opacity: .32; }
.crop::before, .crop::after { content: ""; position: absolute; background: currentColor; }
.crop::before { width: 22px; height: 1px; } .crop::after { width: 1px; height: 22px; }
.crop.tl { top: 92px; left: 14px; } .crop.tl::before { top: 10px; } .crop.tl::after { left: 10px; }
.crop.tr { top: 92px; right: 14px; } .crop.tr::before { top: 10px; } .crop.tr::after { right: 10px; }
.crop.bl { bottom: 30px; left: 14px; } .crop.bl::before { bottom: 10px; } .crop.bl::after { left: 10px; }
.crop.br { bottom: 30px; right: 14px; } .crop.br::before { bottom: 10px; } .crop.br::after { right: 10px; }
.cmyk { display: grid; grid-template-columns: repeat(7, 1fr); height: 10px; }
.cmyk i:nth-child(1) { background: var(--c); } .cmyk i:nth-child(2) { background: var(--m); }
.cmyk i:nth-child(3) { background: var(--y); } .cmyk i:nth-child(4) { background: var(--k); }
.cmyk i:nth-child(5) { background: var(--blue); } .cmyk i:nth-child(6) { background: var(--paper-2); }
.cmyk i:nth-child(7) { background: var(--navy); }

/* حافة ورق ممزق إجرائية بين المشاهد — يولّدها app.js */
.tear { position: absolute; inset-inline: 0; top: -22px; height: 24px; background: inherit; pointer-events: none; z-index: 1; }
section { position: relative; }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 40; height: 80px;
  display: flex; align-items: center; gap: 24px; padding: 0 var(--pad);
  transition: background-color 250ms ease, box-shadow 250ms ease;
}
.nav.solid { background: rgba(244, 241, 234, .95); box-shadow: 0 1px 0 rgba(14, 23, 38, .08); }
.nav.on-dark:not(.solid) { color: var(--paper); }
/* الشعار على لسان ورقي معلّق — يبقى واضحاً فوق كل الخلفيات */
.brand {
  flex: none; align-self: flex-start; display: grid; place-items: center;
  height: 96px; padding: 12px 14px 10px; background: var(--paper-3);
  border-radius: 0 0 6px 6px; box-shadow: 0 10px 24px -14px rgba(14, 23, 38, .45);
  transition: height 300ms var(--ease-out), padding 300ms var(--ease-out);
}
.brand-logo { height: 72px; width: auto; transition: height 300ms var(--ease-out); }
.nav.solid .brand-logo { height: 58px; }
.nav.solid .brand { height: 76px; padding: 8px 12px; }
.nav-links { display: flex; gap: clamp(14px, 2vw, 30px); margin-inline: auto; }
.nav-links a { font: 500 .9688rem/1.4 var(--f-body); position: relative; padding: 6px 0; }
.nav-links a::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform 220ms var(--ease-out);
}
[dir="ltr"] .nav-links a::after { transform-origin: left; }
.nav-links a[aria-current="true"]::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) { .nav-links a:hover::after { transform: scaleX(1); } }
.nav-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(14, 23, 38, .16); font: 500 .9375rem/1 var(--f-body);
  transition: background-color 200ms ease, border-color 200ms ease, transform 140ms var(--ease-out);
}
.nav.on-dark:not(.solid) .tool { border-color: rgba(244, 241, 234, .3); }
.tool:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .tool:hover { background: rgba(14, 23, 38, .06); } .nav.on-dark:not(.solid) .tool:hover { background: rgba(244, 241, 234, .1); } }
.tool kbd { font: 500 .75rem/1 var(--f-body); padding: 3px 6px; border-radius: 4px; background: rgba(14, 23, 38, .07); }
.nav.on-dark:not(.solid) .tool kbd { background: rgba(244, 241, 234, .14); }
html[lang="ar"] .lang { font-family: "IBM Plex Sans Arabic", sans-serif; }
html[lang="en"] .lang { font-family: var(--f-display); }
.menu-btn { display: none; width: 40px; padding: 0; justify-content: center; }
.sheet {
  position: fixed; inset: 80px 0 0; z-index: 39; background: var(--paper); padding: 40px var(--pad);
  overflow: auto; opacity: 0; transform: translateY(-8px);
  transition: opacity 220ms var(--ease-out), transform 260ms var(--ease-out);
}
.sheet.open { opacity: 1; transform: none; }
.sheet-links a { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); font: 600 var(--fs-h3)/var(--lh-sub) var(--f-display); }

/* ---------- HERO ---------- */
.hero {
  min-height: 100svh; padding: 120px var(--pad) 0;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: 1fr auto auto;
  column-gap: clamp(16px, 3vw, 48px); overflow: hidden;
  background: radial-gradient(circle at 1px 1px, rgba(14, 23, 38, .075) 1px, transparent 1.5px) 0 0 / 22px 22px, var(--paper);
}
.hero-copy { align-self: center; padding-block: 16px 48px; position: relative; z-index: 2; }
.hl { display: block; overflow: hidden; padding-block: .04em .12em; margin-block: -.04em -.12em; }
.hl > span { display: inline-block; }
.hl.accent { color: var(--blue); }
.hero-sub { margin-top: 1.5rem; max-width: 42ch; font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--ink-2); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }

.hero-stage { position: relative; min-height: 520px; align-self: stretch; color: var(--ink); }
.hero-stage canvas { position: absolute; inset: -4% -6% 0; width: 112%; height: 104%; opacity: 0; transition: opacity 500ms ease; }
.hero-stage.gl-on canvas { opacity: 1; }
.hero-stage.gl-on .fallback { opacity: 0; visibility: hidden; transition: opacity 400ms ease, visibility 0s 400ms; }
.reg { position: absolute; width: 40px; bottom: 10%; inset-inline-start: 4%; opacity: .4; pointer-events: none; }

/* بديل ثابت أنيق عند عدم دعم WebGL أو الأجهزة الضعيفة */
.fallback { position: absolute; inset: 0; perspective: 1200px; }
.fallback > div { position: absolute; border-radius: var(--r); box-shadow: 0 2px 2px rgba(14, 23, 38, .06), 0 30px 50px -24px rgba(19, 26, 68, .45); }
.fb-sheet {
  width: min(56%, 330px); aspect-ratio: 1 / 1.414; left: 50%; top: 50%; translate: -50% -52%;
  background: var(--paper-3); transform: rotateX(8deg) rotateY(-12deg) rotateZ(-3deg); display: grid; place-items: center; padding: 14%;
}
.fb-sheet img { width: 100%; }
.fb-bar { position: absolute; bottom: 5%; left: 10%; width: 32%; height: 2.2%; background: linear-gradient(90deg, var(--c) 0 25%, var(--m) 0 50%, var(--y) 0 75%, var(--k) 0); }
.fb-card { width: 34%; aspect-ratio: 1.7; left: 4%; top: 6%; background: var(--paper-3); transform: rotate(12deg); display: grid; place-items: center start; padding: 3% 6%; }
.fb-card img { height: 72%; width: auto; }
.fb-note { width: 22%; aspect-ratio: 1; left: 8%; bottom: 10%; background: var(--y); transform: rotate(-12deg); }
.fb-sticker { width: 17%; aspect-ratio: 1; right: 8%; bottom: 14%; border-radius: 50% !important; background: var(--paper-3); display: grid; place-items: center; padding: 3%; transform: rotate(14deg); }
.fb-sticker img { width: 80%; }

.lanes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); position: relative; z-index: 2; }
.lanes a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px 22px 0; font: 600 var(--fs-h4)/var(--lh-sub) var(--f-display); }
[dir="ltr"] .lanes a { padding: 22px 24px 22px 0; }
[dir="rtl"] .lanes a { padding: 22px 0 22px 24px; }
.lanes li + li a { padding-inline-start: 24px; border-inline-start: 1px solid var(--rule); }
.lanes .ico { color: var(--blue); transition: transform 220ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  [dir="rtl"] .lanes a:hover .ico { transform: translateX(-4px); }
  [dir="ltr"] .lanes a:hover .ico { transform: translateX(4px); }
}
.hero .cmyk { grid-column: 1 / -1; margin-inline: calc(var(--pad) * -1); }

/* الدخول: الأسطر تطلع من خلف قناع كأنها تُسحب من الطابعة */
.intro .hl > span { animation: rise 900ms var(--ease-out) both; }
.intro .hl:nth-child(2) > span { animation-delay: 70ms; }
.intro .hl:nth-child(3) > span { animation-delay: 140ms; }
.intro .hero-sub, .intro .hero-cta { animation: fadeup 700ms var(--ease-out) 260ms both; }
@keyframes rise { from { transform: translateY(110%); } to { transform: none; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- GOV : ورقة إجراءات ---------- */
.gov {
  background: var(--navy); color: var(--paper);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px);
  padding: clamp(96px, 11vw, 160px) var(--pad);
  background-image: linear-gradient(rgba(188, 195, 234, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(188, 195, 234, .06) 1px, transparent 1px);
  background-size: 48px 48px;
}
.gov .lead { color: var(--on-navy-2); }
.gov-aside { position: sticky; top: 120px; align-self: start; display: grid; gap: 1.5rem; justify-items: start; }
.gov .note { color: var(--on-navy-2); padding: 16px 18px; border: 1px dashed rgba(188, 195, 234, .4); border-radius: var(--r); }
.field {
  display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 18px;
  background: var(--navy-2); border: 1px solid rgba(188, 195, 234, .25); border-radius: var(--r);
  transition: border-color 200ms ease;
}
.field:focus-within { border-color: var(--y); }
.field .ico { color: var(--on-navy-2); }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--paper); font: 500 1.0625rem var(--f-body); caret-color: var(--y); }
.field input::placeholder { color: #A3ABDA; }
.field input::-webkit-search-cancel-button { filter: invert(1); }
.count { font-size: var(--fs-label); color: var(--on-navy-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger { margin-top: 28px; }
.ledger-group + .ledger-group { margin-top: 36px; }
.ledger-cat { display: flex; align-items: center; gap: 10px; font: 600 var(--fs-label)/1.4 var(--f-display); color: var(--y); padding-bottom: 12px; border-bottom: 1px solid rgba(188, 195, 234, .3); }
.ledger-cat::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.ledger-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: baseline; gap: 14px;
  padding: 15px 0; border-bottom: 1px dashed rgba(188, 195, 234, .18);
  font: 500 var(--fs-h4)/var(--lh-sub) var(--f-display);
}
.ledger-row .box { width: 16px; height: 16px; border: 1.5px solid rgba(188, 195, 234, .55); border-radius: 2px; align-self: center; display: grid; place-items: center; }
.ledger-row .box svg { width: 12px; height: 12px; stroke: var(--y); stroke-width: 3; fill: none; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 320ms var(--ease-out); }
.ledger-row.seen .box svg { stroke-dashoffset: 0; }
.ledger-row small { font: 400 var(--fs-label)/1.5 var(--f-body); color: var(--on-navy-2); white-space: nowrap; }
.ledger-row mark { background: rgba(255, 212, 0, .28); color: inherit; border-radius: 2px; }
.ledger-row.hit { animation: hit 1.4s var(--ease-out); }
@keyframes hit { 0%, 30% { background: rgba(255, 212, 0, .16); } 100% { background: transparent; } }
.gov .empty { margin-top: 28px; color: var(--on-navy-2); max-width: 46ch; }

/* ---------- PRINT : استوديو الطباعة ---------- */
.print { padding: clamp(96px, 11vw, 160px) var(--pad); }
.print-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: clamp(32px, 5vw, 64px); }
.print-head .lead { justify-self: end; }
.studio { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.stage {
  --tint: #E2F2FA; position: relative; background: var(--tint); border-radius: var(--r);
  display: grid; grid-template-rows: 1fr auto; min-height: 660px; overflow: hidden; perspective: 1100px;
  transition: background-color 450ms ease;
}
.stage::before, .stage::after { content: ""; position: absolute; width: 20px; height: 20px; border: 0 solid rgba(14, 23, 38, .35); pointer-events: none; }
.stage::before { top: 16px; inset-inline-start: 16px; border-top-width: 1px; border-inline-start-width: 1px; }
.stage::after { top: 16px; inset-inline-end: 16px; border-top-width: 1px; border-inline-end-width: 1px; }
.stage-art { display: grid; place-items: center; padding: 48px 40px 0; cursor: zoom-in; min-height: 400px; transform-style: preserve-3d; }
.stage-art svg {
  width: min(100%, 560px); height: auto;
  transform: rotateX(calc(var(--ty, 0) * -10deg)) rotateY(calc(var(--tx, 0) * 14deg));
  transition: transform 500ms var(--ease-out);
}
/* سحب الألواح الأربعة: تنفصل الألوان ثم تنطبق في التسجيل */
.stage-art.swap svg { animation: register 760ms var(--ease-out) both; }
@keyframes register {
  0% { opacity: 0; filter: drop-shadow(22px -6px 0 rgba(0, 160, 220, .9)) drop-shadow(-26px 10px 0 rgba(228, 0, 124, .75)) drop-shadow(8px 22px 0 rgba(255, 212, 0, .9)); clip-path: inset(0 0 100% 0); }
  35% { opacity: 1; clip-path: inset(0 0 0 0); }
  100% { opacity: 1; filter: drop-shadow(0 0 0 rgba(0, 160, 220, 0)) drop-shadow(0 0 0 rgba(228, 0, 124, 0)) drop-shadow(0 0 0 rgba(255, 212, 0, 0)); clip-path: inset(0 0 0 0); }
}
.stage-info { padding: 8px 40px 40px; display: grid; gap: 12px; justify-items: start; position: relative; z-index: 1; }
.stage-info p { max-width: 50ch; color: var(--ink-2); }
.stage-info .btn { margin-top: 8px; }
.via { font-size: var(--fs-label); color: var(--ink-2); }
.illus { position: absolute; top: 18px; inset-inline-end: 48px; font-size: .75rem; color: var(--ink-2); }
.plates { position: absolute; top: 20px; inset-inline-start: 48px; display: flex; gap: 6px; }
.plates i { width: 12px; height: 12px; border-radius: 50%; }
.plates i:nth-child(1) { background: var(--c); } .plates i:nth-child(2) { background: var(--m); } .plates i:nth-child(3) { background: var(--y); } .plates i:nth-child(4) { background: var(--k); }
.rack { display: grid; gap: 2px; max-height: 660px; overflow: auto; overscroll-behavior: contain; padding-inline-end: 4px; }
.rack button {
  display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 14px; padding: 8px;
  text-align: start; border-radius: var(--r); font: 500 var(--fs-h4)/1.45 var(--f-display);
  transition: background-color 180ms ease;
}
.rack .thumb { width: 64px; height: 48px; background: var(--paper-3); border-radius: var(--r); display: grid; place-items: center; overflow: hidden; }
.rack .thumb svg { width: 100%; height: 100%; }
.rack button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
@media (hover: hover) and (pointer: fine) { .rack button:not([aria-selected="true"]):hover { background: var(--paper-2); } }

/* ---------- STATIONERY : رفوف بعمق ---------- */
.stationery {
  background: var(--blue); color: #fff;
  padding: clamp(96px, 11vw, 160px) var(--pad);
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 5vw, 80px); align-items: start;
}
.st-head { position: sticky; top: 120px; display: grid; gap: 1.4rem; justify-items: start; }
.st-head .lead { color: var(--on-blue-2); }
.st-head .note { color: var(--on-blue-2); }
.stationery .btn-ink { --bg: var(--y); --fg: var(--ink); }
@media (hover: hover) and (pointer: fine) { .stationery .btn-ink:hover { --bg: #fff; } }
.shelf { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(200px, auto); gap: 12px; }
.shelf li {
  position: relative; background: var(--bgc, var(--paper)); color: var(--ink); border-radius: var(--r);
  display: grid; grid-template-rows: 1fr auto; padding: 16px 18px 18px;
  transform-style: preserve-3d; perspective: 800px;
  transform: rotateX(calc(var(--ty, 0) * -8deg)) rotateY(calc(var(--tx, 0) * 10deg));
  transition: transform 450ms var(--ease-out), box-shadow 450ms var(--ease-out);
}
.shelf li.xl { grid-column: span 2; grid-row: span 2; }
.shelf li.l { grid-column: span 2; }
.shelf .art { display: grid; place-items: center; min-height: 120px; transform: translateZ(0); transition: transform 450ms var(--ease-out); }
.shelf .art svg { width: 100%; max-height: 220px; }
.shelf li.xl .art svg { max-height: 380px; }
.shelf h3 { font: 600 var(--fs-h4)/var(--lh-sub) var(--f-display); transform: translateZ(0); transition: transform 450ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .shelf li.tilt { box-shadow: 0 24px 40px -20px rgba(8, 12, 40, .6); }
  .shelf li.tilt .art { transform: translateZ(46px); }
  .shelf li.tilt h3 { transform: translateZ(22px); }
}

/* ---------- GALLERY ---------- */
.gallery { padding: clamp(96px, 10vw, 140px) var(--pad); background: var(--paper-2); }
.gal-grid { margin-top: 40px; columns: 3 280px; column-gap: 14px; }
.gal-grid button { display: block; width: 100%; margin-bottom: 14px; break-inside: avoid; cursor: zoom-in; border-radius: var(--r); overflow: hidden; }
.gal-grid img { width: 100%; height: auto; transition: transform 400ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .gal-grid button:hover img { transform: scale(1.02); } }
.gal-empty { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; }
.gal-empty p { font-size: var(--fs-lead); max-width: 40ch; color: var(--ink-2); }
.gallery:has(#galGrid:empty) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
.gallery:has(#galGrid:empty) #galGrid { display: none; }
.gallery:has(#galGrid:empty) .gal-empty { margin-top: 0; justify-content: flex-end; }

/* ---------- ABOUT ---------- */
.about { padding: clamp(110px, 14vw, 200px) var(--pad); overflow: hidden; display: grid; place-items: center; text-align: center; }
.about-mark { position: absolute; width: min(62vw, 560px); opacity: .08; pointer-events: none; top: 50%; left: 50%; translate: -50% -50%; }
.statement { position: relative; max-width: 38ch; font-size: clamp(1.25rem, 1.05rem + .85vw, 1.75rem); line-height: 2; color: var(--ink); }
html[lang="en"] .statement { font-family: var(--f-display); font-weight: 500; line-height: 1.55; letter-spacing: -0.01em; max-width: 44ch; }

/* ---------- BRANCHES ---------- */
.branches { padding: clamp(96px, 11vw, 160px) var(--pad); background: var(--paper-2); }
.br-list { margin-top: clamp(32px, 5vw, 56px); display: grid; gap: 24px; }
.branch { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); background: var(--paper-3); border-radius: var(--r); overflow: hidden; }
.br-media { position: relative; min-height: 420px; background: #DCE2EE; }
.br-media img, .br-media svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.br-body { padding: clamp(28px, 4vw, 48px); display: grid; align-content: space-between; gap: 32px; }
.br-name { font: 700 var(--fs-h2)/var(--lh-head) var(--f-display); letter-spacing: var(--track-head); }
.br-area { margin-top: .5rem; font-size: var(--fs-lead); color: var(--ink-2); }
.br-meta { display: grid; gap: 10px; }
.br-meta div { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.br-meta .ico { color: var(--blue); margin-top: .3em; }
.br-acts { display: flex; flex-wrap: wrap; gap: 10px; }
.br-soon { color: var(--ink-2); font-size: var(--fs-small); }
.route-line { stroke-dasharray: 6 8; animation: dash 1.6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
.pin-pulse { transform-box: fill-box; transform-origin: center; animation: pulse 2.4s var(--ease-out) infinite; }
@keyframes pulse { from { opacity: .5; transform: scale(.6); } to { opacity: 0; transform: scale(2.4); } }

/* ---------- FINALE ---------- */
.finale { background: var(--blue); color: #fff; padding: clamp(100px, 12vw, 170px) var(--pad) 0; overflow: hidden; }
.end-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 40px; }
.end-title { display: grid; }
.end-title .kt:last-child { color: var(--y); }
.kt { display: block; clip-path: inset(0 0 0 0); }
.finale.pre .kt { clip-path: inset(0 0 100% 0); transform: translateY(30%); }
.finale.show .kt { transition: clip-path 900ms var(--ease-out), transform 900ms var(--ease-out); }
.finale.show .kt:last-child { transition-delay: 120ms; }
/* الشعار ستيكر مقصوص، تنثني زاويته عند المرور */
.sticker {
  position: relative; display: flex; align-items: center; justify-content: center; width: clamp(150px, 18vw, 240px); aspect-ratio: 1;
  background: var(--paper-3); border-radius: 50%; padding: clamp(24px, 2.6vw, 38px);
  box-shadow: 0 0 0 6px #fff, 0 26px 40px -18px rgba(4, 8, 30, .7);
  transform: rotate(-8deg); transition: transform 500ms var(--ease-out);
}
.sticker img { width: 100%; height: auto; flex: none; }
.peel {
  position: absolute; width: 34%; height: 34%; bottom: 4%; inset-inline-end: 4%; border-radius: 0 0 50% 0;
  background: linear-gradient(135deg, transparent 49%, #D9D4C8 50%, #fff 75%);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  transform-origin: 100% 100%; transform: scale(.35); opacity: .9;
  transition: transform 420ms var(--ease-out);
}
[dir="rtl"] .peel { transform: scale(-.35, .35); }
@media (hover: hover) and (pointer: fine) {
  .sticker:hover { transform: rotate(-3deg) translateY(-2px); }
  .sticker:hover .peel { transform: scale(1); }
  [dir="rtl"] .sticker:hover .peel { transform: scale(-1, 1); }
}
.who { margin-top: clamp(56px, 8vw, 110px); font: 600 var(--fs-label)/1.4 var(--f-display); color: var(--on-blue-2); padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, .3); }
.routes a {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: 20px 8px; border-bottom: 1px solid rgba(255, 255, 255, .18); transition: background-color 200ms ease;
}
.r-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); transition: background-color 200ms ease, color 200ms ease; }
.r-ico svg { width: 22px; height: 22px; }
.r-t { font: 600 var(--fs-h3)/var(--lh-sub) var(--f-display); }
.r-d { color: var(--on-blue-2); font-size: var(--fs-small); text-align: end; }
@media (hover: hover) and (pointer: fine) { .routes a:hover { background: rgba(255, 255, 255, .07); } .routes a:hover .r-ico { background: var(--y); color: var(--ink); } }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; padding: 48px 0 36px; font-size: var(--fs-small); color: var(--on-blue-2); }
.foot-id { display: flex; align-items: center; gap: 16px; margin-inline-end: auto; }
.foot-logo { display: grid; place-items: center; height: 72px; padding: 8px 12px; background: var(--paper-3); border-radius: 4px; }
.foot-logo img { height: 100%; width: auto; }
.foot a { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
@media (hover: hover) and (pointer: fine) { .foot a:hover { color: #fff; } }
.finale .cmyk { margin-inline: calc(var(--pad) * -1); }

/* ---------- floating WhatsApp ---------- */
.wa-float {
  position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); inset-inline-end: 20px; z-index: 30;
  display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 18px 0 16px; border-radius: 999px;
  background: #1F8F4E; color: #fff; font: 600 .9375rem/1 var(--f-body);
  box-shadow: 0 10px 24px -8px rgba(14, 23, 38, .45);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, opacity 250ms ease, translate 300ms var(--ease-out);
}
.wa-float .ico { width: 24px; height: 24px; }
.wa-float:active { transform: scale(0.97); }
.wa-float.hide { opacity: 0; translate: 0 16px; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .wa-float:hover { background: #17733E; } }

/* ---------- search dialog ---------- */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(14, 23, 38, .45); }
.search { width: min(680px, calc(100vw - 32px)); margin: 12vh auto auto; background: var(--paper-3); border-radius: 6px; box-shadow: 0 30px 60px -20px rgba(14, 23, 38, .5); }
.search[open] { animation: pop 200ms var(--ease-out); }
.search[open]::backdrop { animation: fade 200ms ease; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes fade { from { opacity: 0; } }
.search-box { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 64px; border-bottom: 1px solid var(--rule); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 500 1.125rem var(--f-body); color: var(--ink); caret-color: var(--blue); }
.search-box input::placeholder { color: #5F687A; }
.x { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
@media (hover: hover) and (pointer: fine) { .x:hover { background: var(--paper-2); } }
.results { max-height: 52vh; overflow: auto; padding: 8px; }
.results li a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 4px; font-weight: 500; }
.results li small { color: var(--ink-2); font-size: var(--fs-label); white-space: nowrap; }
.results li[aria-selected="true"] a { background: var(--blue); color: #fff; }
.results li[aria-selected="true"] small { color: var(--on-blue-2); }
.search .empty { padding: 20px 22px; color: var(--ink-2); }
.hint { padding: 10px 22px 14px; font-size: var(--fs-label); color: var(--ink-2); border-top: 1px solid var(--rule); }

/* ---------- lightbox ---------- */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: var(--paper); display: none; grid-template-rows: 1fr auto; padding: 24px var(--pad) 28px; }
.lightbox[open] { display: grid; animation: fade 220ms ease; }
.lightbox[open] .lb-media { animation: pop 300ms var(--ease-out); }
.lb-x { position: absolute; top: 16px; inset-inline-end: 16px; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); z-index: 2; }
.lb-fig { margin: 0; display: grid; grid-template-rows: 1fr auto; min-height: 0; gap: 12px; }
.lb-media { display: grid; place-items: center; min-height: 0; }
.lb-media svg, .lb-media img { max-width: min(100%, 1000px); max-height: 72dvh; width: 100%; height: 100%; object-fit: contain; }
.lb-fig figcaption { text-align: center; font: 600 var(--fs-h3)/var(--lh-sub) var(--f-display); }
.lb-nav { display: flex; justify-content: center; align-items: center; gap: 12px; }
.lb-nav button { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; transition: transform 140ms var(--ease-out); }
.lb-nav button:active { transform: scale(0.97); }
.lb-nav .ico { width: 22px; height: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav-links { display: none; }
  .nav-tools { margin-inline-start: auto; }
  .menu-btn { display: inline-flex; }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .rack { grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); max-height: none; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .rack button { scroll-snap-align: start; }
  .stage { min-height: 0; }
  .stationery { grid-template-columns: minmax(0, 1fr); }
  .st-head { position: static; }
}
@media (max-width: 860px) {
  .nav { height: 68px; }
  .brand { height: 78px; padding: 8px 10px; }
  .nav.solid .brand { height: 64px; padding: 6px 10px; }
  .sheet { inset: 68px 0 0; }
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; padding-top: 84px; }
  .hero-stage { min-height: 50svh; order: -1; margin-inline: calc(var(--pad) * -1); }
  .hero-stage canvas { inset: 0; width: 100%; height: 100%; }
  .hero-copy { padding-top: 0; }
  .lanes { grid-template-columns: 1fr; }
  .lanes li + li a { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--rule); }
  .gov { grid-template-columns: minmax(0, 1fr); }
  .ledger-row { grid-template-columns: 22px minmax(0, 1fr); }
  .ledger-row small { grid-column: 2; white-space: normal; margin-top: -8px; }
  .gov-aside { position: static; }
  .print-head { grid-template-columns: minmax(0, 1fr); }
  .print-head .lead { justify-self: start; }
  .shelf { grid-template-columns: repeat(2, 1fr); }
  .branch { grid-template-columns: minmax(0, 1fr); }
  .br-media { min-height: 280px; }
  .gallery:has(#galGrid:empty) { grid-template-columns: minmax(0, 1fr); }
  .gallery:has(#galGrid:empty) .gal-empty { justify-content: flex-start; }
  .search-label, .tool kbd { display: none; }
  .search-btn { width: 40px; padding: 0; justify-content: center; }
  .crop { display: none; }
  .end-top { grid-template-columns: minmax(0, 1fr); }
  .sticker { width: 150px; justify-self: end; }
}
@media (max-width: 520px) {
  .shelf { gap: 8px; grid-auto-rows: minmax(160px, auto); }
  .shelf li.xl { grid-row: span 1; }
  .stage-art { padding: 40px 16px 0; min-height: 260px; }
  .stage-info { padding: 8px 20px 24px; }
  .illus { inset-inline-end: 20px; } .plates { inset-inline-start: 20px; }
  .routes a { grid-template-columns: 40px minmax(0, 1fr); row-gap: 2px; }
  .r-ico { width: 40px; height: 40px; grid-row: span 2; }
  .r-d { text-align: start; }
  .wa-float .wa-tag { display: none; }
  .wa-float { width: 56px; padding: 0; justify-content: center; }
  .btn { width: 100%; }
  .foot-id { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .pin-pulse, .route-line { animation: none !important; }
  .finale.pre .kt { clip-path: none; transform: none; }
}

/* ---------- OFFERS : لوحة الإعلانات (يديرها المالك) ---------- */
.offers { padding: clamp(80px, 9vw, 130px) var(--pad); background: var(--paper-2); }
.offer-list { margin-top: clamp(28px, 4vw, 48px); display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: clamp(20px, 3vw, 36px); align-items: start; }
.offer {
  position: relative; background: var(--paper-3); border-radius: var(--r); overflow: hidden;
  box-shadow: 0 2px 2px rgba(14, 23, 38, .05), 0 22px 36px -24px rgba(19, 26, 68, .45);
  transform: rotate(-1.2deg); transition: transform 400ms var(--ease-out);
}
.offer.o1 { background: #FFF1A6; transform: rotate(1deg); }
.offer.o2 { transform: rotate(-.4deg); }
.offer::before { content: ""; position: absolute; top: -6px; left: 50%; width: 92px; height: 24px; translate: -50% 0; background: rgba(234, 228, 216, .85); transform: rotate(-3deg); z-index: 1; }
.offer img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.offer-body { padding: 22px 22px 24px; display: grid; gap: 10px; justify-items: start; }
.offer-body p { color: var(--ink-2); }
.offer-body small { font-size: var(--fs-label); color: var(--ink-2); }
.offer-body .btn { margin-top: 6px; }
@media (hover: hover) and (pointer: fine) { .offer:hover { transform: rotate(0deg) translateY(-2px); } }
.content-err { display: none; position: fixed; inset: auto 16px 16px; z-index: 50; padding: 14px 18px; background: var(--ink); color: var(--paper); border-radius: 4px; }
.content-error .content-err { display: block; }
[hidden] { display: none !important; }
