/* =========================================================
   الموقع الشخصي — سعد الزارع
   غرفة داكنة واحدة، والأشياء فيها مضاءة: التوقيع، لقطات البرامج.
   الألوان من الشعار: الحبر الداكن، الأبيض، السماوي، الأزرق.
   ========================================================= */
@font-face {
  font-family: "Alexandria";
  src: url("fonts/Alexandria.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* الألوان: أرضية واحدة، حبر واحد، لون فعل واحد */
  --bg: #0f1114;
  --surface: #171a1f;
  --surface-2: #20242b;
  --ink: #eceef1;
  --muted: #a7acb4;
  --accent: #0adcf2;      /* السماوي: للفعل الأساسي فقط */
  --blue: #0784f2;        /* الأزرق: خط التوقيع */
  --field: #eceef1;

  /* خمسة مقاسات فقط */
  --t-xl: clamp(2.75rem, 1.4rem + 4.3vw, 5rem);       /* 44 → 80 */
  --t-l: clamp(1.75rem, 1.2rem + 1.7vw, 2.5rem);       /* 28 → 40 */
  --t-m: clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);      /* 20 → 24 */
  --t-body: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);  /* 17 → 18 */
  --t-s: 0.9375rem;                                     /* 15 */

  --m: clamp(1rem, 0.4rem + 2.4vw, 2.5rem);   /* هامش الصفحة: متساوٍ على الجانبين */
  --gap: clamp(7rem, 4rem + 8vw, 12.5rem);     /* بين الأقسام */
  --max: 1360px;
  --r: 12px;                                    /* زاوية واحدة للصفحة كلها */
  --rail: 64px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--rail) + 24px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Alexandria", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: var(--t-body);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
h1, h2, h3 { font-weight: 400; }
ul, ol { list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--max); margin-inline: auto; }
.skip {
  position: absolute; inset-inline-start: var(--m); top: -100px; z-index: 50;
  background: var(--accent); color: var(--bg); padding: 10px 16px; text-decoration: none; border-radius: var(--r);
}
.skip:focus { top: 12px; }

/* ---------- الأزرار: شكل واحد، مستدير بالكامل ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px; white-space: nowrap;
  background: var(--accent); color: var(--bg);
  font-weight: 500; font-size: var(--t-body); text-decoration: none;
  border-radius: 999px; border: 0; cursor: pointer;
  transition: transform 0.3s var(--ease-out), background-color 0.25s, color 0.25s;
}
.btn:hover { background: var(--ink); transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn svg { width: 20px; height: 20px; }
.btn-sm { min-height: 42px; padding: 0 20px; font-size: var(--t-s); }
.btn-quiet { background: var(--surface-2); color: var(--ink); }
.btn-quiet:hover { background: #2b3038; }

/* ---------- الشاشة الأولى: التوقيع فوق السطر ---------- */
.stage {
  height: calc(50svh - var(--rail) / 2);
  min-height: 300px;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 32px var(--m) 0;
}
.sig { position: relative; aspect-ratio: 1640 / 530; }
.sig .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.sig .layer-main { fill: var(--ink); }
.sig .layer-dot { fill: var(--accent); }
.sig .layer-line { fill: var(--blue); }
.sig-hero {
  /* أسفل التوقيع يلامس السطر كما تجلس الكتابة على السطر */
  width: min(70vw, calc((50svh - var(--rail) / 2 - 40px) * 3.09));
  margin-bottom: -2.4%;
}

/* السطر */
.rail {
  position: sticky; top: 0; z-index: 20;
  height: var(--rail);
  background: var(--bg);
  padding-inline: var(--m);
}
.rail-in {
  max-width: var(--max); height: 100%; margin-inline: auto;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; column-gap: 32px;
}
.rail-mark {
  display: block; width: 0; margin-inline-end: -32px; overflow: hidden; opacity: 0;
  transition: opacity .35s, width .45s var(--ease-out), margin .45s var(--ease-out);
}
.rail-mark svg { width: 64px; height: auto; }
.rail-mark .ink { fill: var(--ink); } .rail-mark .c1 { fill: var(--accent); } .rail-mark .c2 { fill: var(--blue); }
.rail-title { display: flex; align-items: center; gap: 14px; font-size: var(--t-l); font-weight: 500; line-height: 1; white-space: nowrap; letter-spacing: -0.01em; }
.rail-title span { font-weight: 300; color: var(--ink); }
.rail-line { font-size: var(--t-body); max-width: 44ch; color: var(--ink); padding-inline-start: 4vw; }
.rail-nav { display: flex; align-items: center; gap: clamp(14px, 2.2vw, 30px); font-size: var(--t-s); }
.rail-nav a:not(.btn) {
  position: relative; text-decoration: none; padding: 10px 2px; font-weight: 400; transition: color .2s;
}
.rail-nav a:not(.btn)::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 4px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .3s var(--ease-out);
}
.rail-nav a:not(.btn):hover::after, .rail-nav a.on::after { transform: scaleX(1); }

/* حين يرسو السطر في الأعلى تظهر علامة التوقيع الصغيرة ويختفي سطر التعريف */
.rail.docked .rail-mark { width: 64px; margin-inline-end: 0; opacity: 1; }
.rail.docked .rail-title { font-size: var(--t-m); }
.rail-title { transition: font-size .35s var(--ease-out); }
.rail .rail-line { transition: opacity .3s; }
.rail.docked .rail-line { opacity: 0; pointer-events: none; }

.stage-foot { display: none; }

/* ---------- عناوين الأقسام ---------- */
.h-sec { font-size: var(--t-l); font-weight: 500; line-height: 1.25; letter-spacing: -0.01em; }

/* ---------- برامجي ---------- */
.work { padding: clamp(40px, 6vh, 72px) var(--m) var(--gap); }
.work-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 32px;
  margin-bottom: clamp(32px, 4vw, 56px);
}
.work-note { color: var(--muted); font-size: var(--t-body); }

.proj { --accent-p: var(--blue); }
.proj + .proj { margin-top: var(--gap); }
.proj-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 40px; margin-bottom: clamp(28px, 3vw, 44px); }
.proj-id { display: flex; align-items: center; gap: 18px; }
.proj-icon { width: 72px; height: 72px; flex: none; border-radius: 16px; padding: 10px; background: #f0f7ff; transition: transform .5s var(--ease-out); }
.proj:hover .proj-icon { transform: rotate(-6deg); }
.proj-name { font-size: var(--t-xl); font-weight: 400; line-height: 1; letter-spacing: -0.02em; }
.proj-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 12px; font-size: var(--t-s); color: var(--muted); }
.proj-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 96px); margin-top: clamp(48px, 5vw, 80px); align-items: start; }
.proj-tag { font-size: var(--t-m); font-weight: 400; line-height: 1.5; margin-bottom: 16px; }
.proj-desc { max-width: 52ch; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 28px; }
.stats dt { font-size: var(--t-s); color: var(--muted); }
.stats dd { font-size: var(--t-body); font-weight: 400; }
.proj-links { display: flex; flex-wrap: wrap; gap: 12px; }

/* اللقطة: الشيء المضاء في الغرفة */
.shot { position: relative; }
.screens { position: relative; aspect-ratio: 1000 / 640; border-radius: var(--r); overflow: hidden; background: var(--surface); }
.screens img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.6s ease;
}
.screens img.on { opacity: 1; }
.shot-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 20px; }
.shot-cap { font-size: var(--t-s); color: var(--muted); }
.switch {
  position: relative; display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface-2);
}
.switch button {
  position: relative; z-index: 1; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: none;
  cursor: pointer; font-size: var(--t-s); color: var(--ink); transition: color .25s;
  display: inline-flex; align-items: center; gap: 8px;
}
.switch button:hover { color: var(--accent); }
.switch button svg { width: 16px; height: 16px; }
.switch button[aria-pressed="true"], .switch button[aria-pressed="true"]:hover { color: var(--bg); background: var(--ink); }
.switch button { transition: color .25s, background-color .35s; }

/* التقنيات: سطر صغير تحت الوصف */
.tech { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; font-size: 0.8125rem; color: var(--muted); direction: ltr; justify-content: flex-end; }
.tech span { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--surface-2); letter-spacing: .01em; }
.swipe-hint { display: none; }
.noscript { color: var(--muted); }

/* ---------- ماذا يفعل صفحات: الفهرس الحي ---------- */
.tools { padding: 0 var(--m) var(--gap); }
.tools-grid { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: clamp(32px, 4vw, 72px); align-items: start; }
.tools-head { margin-bottom: 48px; }
.tools-head p { margin-top: 10px; max-width: 46ch; }
.names button {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 28px; width: 100%;
  padding: 10px 0; border: 0; background: none; cursor: pointer; text-align: start;
}
.names b {
  font-size: var(--t-xl); font-weight: 300; line-height: 1.05; letter-spacing: -0.02em; color: var(--muted);
  transition: color .25s, font-weight .25s;
}
.names small { font-size: var(--t-s); color: var(--muted); transition: color .25s; }
.names button:hover b, .names button[aria-pressed="true"] b { color: var(--ink); font-weight: 500; }
.names button[aria-pressed="true"] small { color: var(--ink); }
.names button:focus-visible { outline-offset: 6px; }

.desk-wrap { position: sticky; top: calc(var(--rail) + 8vh); }
.desk { position: relative; }
[data-ui].desk-pages {
  --tc: #1668E8;
  position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden;
  background-color: color-mix(in srgb, var(--tc) 6%, #111823);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M0 .5H28M.5 0V28' stroke='%231C2A3D'/%3E%3C/svg%3E");
  border: 1px solid color-mix(in srgb, var(--tc) 40%, #334155);
  transition: background-color .6s ease, border-color .6s ease;
}
[data-ui] .pg {
  --x: 50%; --y: 50%; --r: 0deg; --s: 1;
  position: absolute; left: var(--x); top: var(--y); width: 34%; aspect-ratio: 1 / 1.414;
  translate: -50% -50%; transform: rotate(var(--r)) scale(var(--s));
  background: #fff; color: #1A212D; border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 12px 28px -14px rgba(0,0,0,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-family: "Plex Arabic", "Segoe UI", sans-serif;
  transition: left .9s var(--ease-io), top .9s var(--ease-io), transform .9s var(--ease-io), opacity .6s, clip-path .9s var(--ease-io), background-color .6s;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 0);
}
[data-ui] .pg::before { content: ""; position: absolute; top: 12%; inset-inline: 16%; height: 3px; border-radius: 2px; background: var(--tc); opacity: .9; transition: background-color .6s; }
[data-ui] .pg-n { font-size: clamp(1.25rem, 2.4vw, 2.25rem); font-weight: 600; line-height: 1; }
[data-ui] .pg-t {
  font-size: 0.75rem; font-weight: 600; line-height: 1; padding: 6px 10px; border-radius: 6px;
  background: #E2E8F0; color: #475569; direction: ltr; transition: background-color .5s, color .5s;
}
[data-ui] .pg.out .pg-t { background: var(--tc); color: #fff; }
[data-ui] .pg.torn { clip-path: polygon(0 0, 100% 0, 100% 62%, 70% 74%, 82% 100%, 0 100%, 0 0); background: #CBD5E1; }
.desk-cap { margin-top: 16px; font-size: var(--t-s); color: var(--muted); min-height: 3.3em; }

/* ---------- نبذة ---------- */
.about { padding: 0 20px var(--gap); }
.panel {
  position: relative; overflow: hidden; border-radius: var(--r);
  background: var(--surface);
  max-width: calc(var(--max) + 2 * var(--m) - 40px); margin-inline: auto;
  min-height: min(110svh, 980px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px;
  padding: 56px calc(var(--m) + 16px);
}
.about-h { font-size: var(--t-xl); font-weight: 300; line-height: 1.1; letter-spacing: -0.02em; }
.about-h span { display: block; }
.about-text { display: grid; gap: 64px; align-content: start; justify-items: start; max-width: 420px; justify-self: end; }
.about-text h3 { font-size: var(--t-m); font-weight: 500; margin-bottom: 10px; }
.about-sig {
  position: absolute; inset-inline-start: -4%; bottom: -12%; width: 62%;
  pointer-events: none;
}
.about-sig svg { width: 100%; height: auto; }
.about-sig .ink { fill: var(--ink); }
.about-sig .c2 { fill: var(--blue); }

/* ---------- تواصل ---------- */
.contact { padding: 0 var(--m) var(--gap); }
.contact-col { max-width: 560px; margin-inline: auto; }
.contact-h { font-size: var(--t-m); font-weight: 400; line-height: 1.5; }
.contact-h span { display: block; }
.contact-h span:first-child { color: var(--muted); }
.field { position: relative; margin-top: 28px; }
.field input {
  width: 100%; height: 64px; border: 0; border-radius: var(--r);
  background: var(--field); color: var(--bg); padding: 0 22px 0 64px; font-size: var(--t-body); font-weight: 400;
}
.field input::placeholder { color: #5c626b; }
.field input:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: var(--r); }
.field button {
  position: absolute; top: 10px; inset-inline-end: 10px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--accent); color: var(--bg); cursor: pointer; display: grid; place-items: center;
  transition: transform .3s var(--ease-out), background-color .2s;
}
.field button:hover { background: var(--bg); color: var(--ink); transform: translateX(-3px); }
.field button:active { transform: scale(.94); }
.field button svg { width: 20px; height: 20px; }
.field-note { margin-top: 16px; font-size: var(--t-s); color: var(--muted); }
.reach { margin-top: 72px; display: grid; gap: 18px; }
.reach > div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: center; gap: 16px; }
.reach dt { font-size: var(--t-s); color: var(--muted); }
.reach dd { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: flex-start; }
.reach a { text-decoration: none; font-weight: 400; transition: color .2s; }
.reach a:hover { color: var(--accent); }
.copy {
  min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font-size: var(--t-s);
  transition: background-color .2s, color .2s, transform .2s var(--ease-out);
}
.copy:hover { background: #2b3038; }
.copy:active { transform: scale(.95); }
.copy.done { background: var(--accent); color: var(--bg); }

/* ---------- الخاتمة: سطر واحد هادئ ---------- */
.foot {
  max-width: calc(var(--max) + 2 * var(--m)); margin-inline: auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 16px;
  padding: 40px var(--m) 30px; font-size: var(--t-s); color: var(--muted);
}
.foot-links { display: flex; gap: 24px; }
.foot a { color: var(--ink); text-decoration: none; transition: color .2s; }
.foot a:hover { color: var(--accent); }
.foot-yr { justify-self: end; }

/* ---------- الحركة ---------- */
/* التوقيع يُكتب من اليمين إلى اليسار كما يُكتب الخط العربي */
.js .sig .layer { clip-path: inset(0 0 0 100%); }
.sig.drawn .layer-main { clip-path: inset(0 0 0 0); transition: clip-path 1.8s var(--ease-io) .25s; }
.sig.drawn .layer-dot { clip-path: inset(0 0 0 0); transition: clip-path .5s var(--ease-out) 2s; }
.sig.drawn .layer-line { clip-path: inset(0 0 0 0); transition: clip-path 1s var(--ease-io) 2.25s; }
.js .rail-title, .js .rail-line, .js .rail-nav { opacity: 0; transform: translateY(14px); }
.js.ready .rail-title, .js.ready .rail-line, .js.ready .rail-nav { opacity: 1; transform: none; transition: opacity .7s ease, transform .9s var(--ease-out), font-size .35s var(--ease-out); }
.js.ready .rail-line { transition-delay: .12s; }
.js.ready .rail-nav { transition-delay: .24s; }
.js.ready .rail.docked .rail-line { opacity: 0; }

.js [data-rv] > * { opacity: 0; transform: translateY(24px); }
.js [data-rv].in > * {
  opacity: 1; transform: none;
  transition: opacity .7s ease, transform .9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 75ms);
}
.js .about-h[data-rv] > * { transform: translateY(32px); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js .rail-title, .js .rail-line, .js .rail-nav, .js [data-rv] > * { opacity: 1 !important; transform: none !important; }
  .js .sig .layer { clip-path: none !important; }
}

/* ---------- الشاشات المتوسطة ---------- */
@media (max-width: 1100px) {
  .rail-line { display: none; }
  .rail-in { grid-template-columns: auto minmax(0, 1fr) auto; }
  .proj-body { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .panel { grid-template-columns: 1fr; min-height: 0; padding-bottom: 46vw; gap: 64px; }
  .about-text { justify-self: start; max-width: 520px; gap: 40px; }
  .about-sig { width: 90%; inset-inline-start: 5%; bottom: -10%; }
}

/* ---------- الجوال ---------- */
@media (max-width: 640px) {
  :root { --rail: 84px; }
  .stage { height: calc(50svh - var(--rail) / 2); padding-top: 24px; }
  .sig-hero { width: 100%; }
  .rail-in { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; }
  .rail-title { font-size: 1.75rem; flex-direction: column; align-items: flex-start; gap: 6px; line-height: 1.05; }
  .rail-title span { font-size: 1.25rem; }
  .rail.docked .rail-title { font-size: 1.25rem; flex-direction: row; align-items: center; }
  .rail { height: auto; padding-block: 12px; }
  .rail.docked { padding-block: 8px; }
  .rail.docked .rail-mark { display: none; }
  .rail-nav a:not(.btn) { display: none; }
  .stage-foot {
    display: flex; flex-direction: column; gap: 18px;
    padding: 36px 20px 0;
  }
  .stage-foot p { font-size: var(--t-body); max-width: 30ch; }
  .stage-foot .btn { width: 100%; }
  .work { padding-top: 72px; }
  .proj-links { flex-direction: column; }
  .proj-links .btn { width: 100%; min-height: 54px; }
  .shot-fit { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .shot-fit::-webkit-scrollbar { display: none; }
  .swipe-hint { display: inline; }
  .proj-body { margin-top: 40px; }
  .proj-icon { width: 58px; height: 58px; padding: 8px; }
  .tools-grid { grid-template-columns: 1fr; gap: 24px; }
  .desk-wrap { order: -1; position: sticky; top: calc(var(--rail-now, 64px) + 4px); z-index: 5; background: var(--bg); padding-bottom: 8px; }
  [data-ui].desk-pages { aspect-ratio: 16 / 10; }
  [data-ui] .pg { width: 24%; }
  .desk-cap { margin-top: 10px; min-height: 2.6em; }
  .tools-list { display: contents; }
  .tools-head { order: -2; margin-bottom: 0; }
  .names b { font-size: 9.5vw; color: var(--ink); }
  .names small { flex-basis: 100%; }
  .about { padding-inline: 10px; }
  .panel { padding: 40px 20px 72vw; gap: 48px; }
  .about-text { gap: 40px; }
  .about-h { font-size: 8.5vw; }
  .about-sig { width: 130%; inset-inline-start: -15%; bottom: -4%; }
  .reach > div { grid-template-columns: 1fr; gap: 4px; }
  .foot { grid-template-columns: 1fr; gap: 14px; padding: 48px 20px 28px; border-top: 1px solid var(--surface-2); }
  .foot-yr { justify-self: start; }
}

/* =========================================================
   واجهة صفَحات بنسخة HTML — أسلوب البرنامج نفسه داخل [data-ui]
   ========================================================= */
@font-face { font-family: "Plex Arabic"; src: url("fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

[data-ui].sw {
  --s-bg: #F8FAFC; --s-side: #FFFFFF; --s-top: #F0F7FF; --s-card: #FFFFFF; --s-line: #E2E8F0; --s-grid: #EBF2FA;
  --s-ink: #1A212D; --s-mute: #475569; --s-faint: #94A3B8; --s-save: #1A212D;
  --s-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M0 .5H28M.5 0V28' stroke='%23EBF2FA'/%3E%3C/svg%3E");
  --a: var(--tc); --soft: var(--ts);
  font-family: "Plex Arabic", "Segoe UI", Tahoma, sans-serif; font-weight: 400; line-height: 1.5;
  color: var(--s-ink); text-align: right; letter-spacing: 0;
  transition: background-color .6s ease, color .6s ease;
}
[data-ui].sw[data-theme="dark"] {
  --s-bg: #111823; --s-side: #161D29; --s-top: #1C2C42; --s-card: #1A212D; --s-line: #334155; --s-grid: #1C2A3D;
  --s-ink: #F1F5F9; --s-mute: #B8C7DD; --s-faint: #64748B; --s-save: var(--tc);
  --s-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M0 .5H28M.5 0V28' stroke='%231C2A3D'/%3E%3C/svg%3E");
  --a: var(--tcd); --soft: var(--tsd);
}
[data-ui].sw *, [data-ui].sw *::before { transition: background-color .6s ease, color .6s ease, border-color .6s ease; }
[data-ui] .sw-i { width: 18px; height: 18px; flex: none; }

/* النافذة كاملة */
.shot-fit { position: relative; width: 100%; overflow: hidden; border-radius: var(--r); }
[data-ui].sw-window {
  position: absolute; top: 0; right: 0; transform-origin: top right;
  width: 1180px; height: 740px; display: grid; grid-template-columns: 268px minmax(0, 1fr);
  background: var(--s-bg); border-radius: 14px; overflow: hidden;
}

/* الشريط الجانبي */
[data-ui] .sw-side { background: var(--s-side); padding: 22px 14px 18px; overflow: hidden; border-inline-start: 1px solid var(--s-line); }
[data-ui].sw-only-side .sw-side { border: 0; border-radius: 14px; }
[data-ui] .sw-brand { display: flex; align-items: center; gap: 10px; padding-inline: 8px; flex-direction: row-reverse; justify-content: flex-end; }
[data-ui] .sw-word { font-size: 30px; font-weight: 600; line-height: 1; }
[data-ui] .sw-mark { width: 46px; height: 39px; background: url("projects/safahat-symbol.svg") center / contain no-repeat; }
[data-ui].sw[data-theme="dark"] .sw-mark { background-image: url("projects/safahat-symbol-dark.svg"); }
[data-ui] .sw-safe {
  display: flex; align-items: center; gap: 6px; margin: 18px 4px 20px; padding: 6px 12px; border-radius: 999px;
  font-size: 11.5px; background: #EEF9F4; color: #047857;
}
[data-ui].sw[data-theme="dark"] .sw-safe { background: #1B342F; color: #6EE7B7; }
[data-ui] .sw-safe .sw-i { width: 14px; height: 14px; }
[data-ui] .sw-cat { font-size: 12.5px; font-weight: 600; color: var(--s-mute); padding-inline: 10px; margin-bottom: 4px; }
[data-ui] .sw-group { font-size: 11.5px; color: var(--s-mute); padding: 10px 10px 4px; }
[data-ui] .sw-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 8px; margin: 1px 0;
  border: 0; border-radius: 10px; background: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--s-ink);
  cursor: pointer; text-align: right;
}
[data-ui] div.sw-item { cursor: default; }
[data-ui] .sw-item:hover { background: var(--s-top); }
[data-ui] .sw-tile { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--is); color: var(--ic); }
[data-ui].sw[data-theme="dark"] .sw-tile { background: var(--isd); color: var(--icd); }
[data-ui] .sw-item.on { background: var(--ic); color: #fff; }
[data-ui] .sw-item.on .sw-tile, [data-ui].sw[data-theme="dark"] .sw-item.on .sw-tile { background: rgba(255,255,255,.2); color: #fff; }
[data-ui] .sw-item:focus-visible { outline: 2px solid var(--ic); outline-offset: 1px; }

/* الشريط العلوي ومساحة العمل */
[data-ui] .sw-main { display: grid; grid-template-rows: 64px minmax(0, 1fr); min-width: 0; }
[data-ui] .sw-top { background: var(--s-top); display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 22px; }
[data-ui] .sw-ib { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--s-card); color: #1668E8; border: 0; cursor: pointer; }
[data-ui].sw[data-theme="dark"] .sw-ib { color: #70B4FF; background: #1A2638; }
[data-ui] .sw-ib .sw-i { width: 19px; height: 19px; }
[data-ui] .sw-ib .su, [data-ui].sw[data-theme="dark"] .sw-ib .mo { display: none; }
[data-ui].sw[data-theme="dark"] .sw-ib .su { display: block; }
[data-ui] button.sw-ib:hover { transform: translateY(-1px); }
[data-ui] .sw-work { padding: 20px 24px 22px; background: color-mix(in srgb, var(--tc) 3%, var(--s-bg)); min-height: 0; display: flex; flex-direction: column; }
[data-ui] .sw-work.in > * { animation: swIn .23s cubic-bezier(.16,1,.3,1) both; }
[data-ui] .sw-work.in > :nth-child(2) { animation-delay: .04s; } [data-ui] .sw-work.in > :nth-child(3) { animation-delay: .08s; }
@keyframes swIn { from { opacity: 0; transform: translateY(6px); } }
[data-ui] .sw-crumb { font-size: 12px; color: var(--s-mute); }
[data-ui] .sw-titlerow { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 16px; }
[data-ui] .sw-title { font-size: 25px; font-weight: 600; line-height: 1.2; }
[data-ui] .sw-badge { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--soft); color: var(--a); border: 1px solid color-mix(in srgb, var(--a) 25%, transparent); }
[data-ui] .sw-badge .sw-i { width: 21px; height: 21px; }
[data-ui] .sw-cols { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; min-height: 0; flex: 1; }

/* لوحة الأداة */
[data-ui] .sw-panel { background: var(--s-card); border: 1px solid color-mix(in srgb, var(--a) 18%, var(--s-line)); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
[data-ui].sw-only-panel { width: 330px; }
[data-ui].sw-only-panel .sw-panel { min-height: 520px; }
[data-ui] .sw-add, [data-ui] .sw-save {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 10px;
  background: var(--tc); color: #fff; font-size: 13.5px; font-weight: 600;
}
[data-ui] .sw-save { background: var(--s-save); margin-top: auto; }
[data-ui] .sw-file { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--s-mute); }
[data-ui] .sw-del { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 600; background: #FEF2F2; color: #B91C1C; }
[data-ui].sw[data-theme="dark"] .sw-del { background: #43272D; color: #FCA5A5; }
[data-ui] .sw-del .sw-i { width: 13px; height: 13px; }
[data-ui] .sw-opts { display: flex; flex-direction: column; gap: 8px; }
[data-ui] .sw-h { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
[data-ui] .sw-note { font-size: 12px; color: var(--s-mute); line-height: 1.7; padding: 10px 12px; border-radius: 10px; background: var(--soft); margin: 0; }
[data-ui] .sw-radios { display: flex; flex-direction: column; gap: 8px; }
[data-ui] .sw-radio { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--s-line); font-size: 13px; font-weight: 600; }
[data-ui] .sw-radio.on { border: 1.5px solid var(--a); background: var(--soft); }
[data-ui] .sw-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--s-faint); flex: none; }
[data-ui] .sw-radio.on .sw-dot { border-color: var(--a); box-shadow: inset 0 0 0 3px var(--s-card), inset 0 0 0 8px var(--a); }
[data-ui] .sw-in { display: flex; align-items: center; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--s-line); background: var(--s-bg); font-size: 13px; direction: ltr; justify-content: flex-end; }
[data-ui] .sw-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
[data-ui] .sw-range label { display: grid; gap: 4px; font-size: 11.5px; color: var(--s-mute); }
[data-ui] .sw-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 10px; background: var(--s-bg); border: 1px solid var(--s-line); font-size: 12.5px; font-weight: 600; text-align: center; }
[data-ui] .sw-seg span { padding: 7px; border-radius: 8px; color: var(--s-mute); }
[data-ui] .sw-seg .on { background: var(--a); color: var(--s-card); }
[data-ui] .sw-sel { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--s-mute); }
[data-ui] .sw-sel span:last-child { color: var(--a); font-weight: 600; }
[data-ui] .sw-files { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
[data-ui] .sw-files li { display: flex; justify-content: space-between; align-items: center; height: 40px; padding: 0 12px; border-radius: 9px; background: var(--s-bg); border: 1px solid var(--s-line); font-size: 12.5px; }
[data-ui] .sw-files li:first-child { border-color: var(--a); background: var(--soft); }
[data-ui] .sw-files b { font-weight: 600; } [data-ui] .sw-files span { color: var(--s-mute); font-size: 11.5px; }

/* المعاينة */
[data-ui] .sw-prev { background: var(--s-card); border: 1px solid color-mix(in srgb, var(--a) 18%, var(--s-line)); border-radius: 14px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; overflow: hidden; min-height: 0; }
[data-ui] .sw-prev-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
[data-ui] .sw-prev-h b { font-size: 15px; font-weight: 600; }
[data-ui] .sw-prev-h span, [data-ui] .sw-fit { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--a); }
[data-ui] .sw-prev-h .sw-i { width: 15px; height: 15px; }
[data-ui] .sw-zoom { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 12px; color: var(--s-mute); padding-bottom: 8px; direction: ltr; }
[data-ui] .sw-zoom .sw-i { width: 15px; height: 15px; }
[data-ui] .sw-desk {
  position: relative; overflow: hidden; display: grid; place-items: start center; padding-top: 16px;
  background-color: color-mix(in srgb, var(--tc) 3%, var(--s-bg));
  background-image: var(--s-paper);
}
[data-ui] .sw-page {
  position: relative; width: 300px; aspect-ratio: 1 / 1.414; background: #fff; color: #1A212D; padding: 30px 28px;
  border-radius: 3px; box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 8px 24px -12px rgba(15,23,42,.25);
  font-size: 9.5px; line-height: 1.85;
}
[data-ui] .sw-pt { font-size: 17px; font-weight: 600; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--tc); width: max-content; }
[data-ui] .sw-page p { margin: 0 0 9px; color: #334155; }
[data-ui] .sw-pn { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 9px; color: #94A3B8; }
[data-ui] .sw-nav { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; font-size: 12px; color: var(--s-mute); }
[data-ui] .sw-nav span { display: inline-flex; align-items: center; gap: 4px; }
[data-ui] .sw-nav .sw-i { width: 14px; height: 14px; }
[data-ui] .sw-thumbs { display: flex; gap: 10px; padding: 4px 16px 14px; }
[data-ui] .sw-th { position: relative; width: 66px; padding: 5px 5px 4px; border-radius: 8px; border: 1px solid var(--s-line); background: var(--s-card); display: grid; justify-items: center; gap: 2px; }
[data-ui] .sw-th.cur { border: 2px solid var(--a); padding: 4px 4px 3px; }
[data-ui] .sw-mini { width: 54px; height: 76px; overflow: hidden; border-radius: 2px; background: #fff; }
[data-ui] .sw-mini .sw-page { width: 300px; transform: scale(.18); transform-origin: top right; box-shadow: none; }
[data-ui] .sw-th > span { font-size: 10px; color: var(--s-mute); }
[data-ui] .sw-th i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: var(--tc); color: #fff; }
[data-ui] .sw-th i .sw-i { width: 11px; height: 11px; stroke-width: 3; }

