@import url('https://fonts.googleapis.com/css2?family=El+Messiri:wght@400;500;600;700&family=Tajawal:wght@300;400;500;700;900&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #f5f1e8;
  --bg-2: #ebe5d6;
  --bg-3: #e2dbc6;
  --ink: #1f1c15;
  --ink-2: #4d473b;
  --ink-3: #807966;
  --line: #d6cdb6;
  --line-2: #c0b594;
  --accent: #5d7a44;
  --accent-d: #485e34;
  --accent-2: #b08a4a;
  --accent-3: #8a5e3a;
  --paper: #fcf9f0;
  --shadow: 0 1px 2px rgba(28,24,18,.04), 0 8px 24px rgba(28,24,18,.06);
  --shadow-lg: 0 4px 12px rgba(28,24,18,.06), 0 24px 48px rgba(28,24,18,.10);
}

html, body { margin: 0; padding: 0; scroll-behavior: smooth; }
html { touch-action: pan-x pan-y; }
body {
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, .display { font-family: 'El Messiri', 'Tajawal', serif; font-weight: 600; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
img { max-width: 100%; display: block; }

main { position: relative; z-index: 1; }

/* ============== HERITAGE DOODLES BG ============== */
.bg-doodles {
  position: absolute; top: 0; right: 0; left: 0;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  color: var(--ink);
}
.doodle {
  position: absolute;
  opacity: .055;
  will-change: transform;
  transition: opacity .3s;
}
.doodle svg { width: 100%; height: auto; display: block; }

/* ============== HEADER ============== */
.hdr {
  position: fixed; top: 0; right: 0; left: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 40%, transparent);
  transition: transform .5s cubic-bezier(.4,0,.2,1), opacity .5s ease, background .4s ease, border-color .4s ease;
}
.hdr.hdr-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.hdr.over-hero {
  background: color-mix(in oklab, var(--bg) 50%, transparent);
  border-bottom-color: color-mix(in oklab, var(--line) 30%, transparent);
  color: var(--ink);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
}
.hdr-brand { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.hdr-brand-logo {
  height: 42px; width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(28,24,18,.08));
  transition: opacity .25s;
}
.hdr-brand-logo:hover { opacity: .85; }

/* ── نص بديل عن الشعار في الهيدر ── */
.hdr-brand-text {
  font-family: 'El Messiri', 'Tajawal', serif;
  font-size: 26px; font-weight: 700;
  line-height: 1; letter-spacing: .5px;
  color: inherit;
  background: linear-gradient(135deg, #5d7a44 0%, #b08a4a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity .25s;
  display: inline-block;
}
.hdr-brand-text:hover { opacity: .85; }

.hdr-brand-tag {
  font-size: 11px; opacity: .55; margin-top: 1px;
  font-family: 'Tajawal', sans-serif; font-weight: 400;
}

/* ── نص بديل في الـ drawer ── */
.drawer-brand-text {
  font-family: 'El Messiri', 'Tajawal', serif;
  font-size: 32px; font-weight: 700;
  line-height: 1.1; letter-spacing: .5px;
  margin: 0 0 6px;
  background: linear-gradient(135deg, #5d7a44 0%, #b08a4a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}
.hdr-nav { display: none; gap: 4px; align-items: center; }
@media (min-width: 980px) { .hdr-nav { display: flex; } }
.hdr-nav button {
  padding: 8px 16px; font-size: 14.5px; border-radius: 999px;
  font-weight: 500; color: inherit; opacity: .85;
  transition: all .25s;
}
.hdr-nav button:hover { opacity: 1; background: color-mix(in oklab, currentColor 8%, transparent); }
.hdr-nav button.active { opacity: 1; background: color-mix(in oklab, currentColor 14%, transparent); }
.hdr-right { display: flex; align-items: center; gap: 10px; }
.hdr-beta {
  font-family: 'Tajawal', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
  color: var(--accent-d);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  user-select: none;
}
.menu-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  border: 1px solid color-mix(in oklab, currentColor 18%, transparent);
  transition: all .3s;
}
.menu-btn:hover { background: color-mix(in oklab, currentColor 10%, transparent); }
.menu-btn svg { width: 20px; height: 20px; }
@media (min-width: 980px) { .menu-btn { display: none; } }

/* drawer */
.drawer {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: 80px 24px 24px;
  transform: translateY(-100%); transition: transform .4s cubic-bezier(.6,.05,.3,1);
  visibility: hidden;
}
.drawer.open { transform: translateY(0); visibility: visible; }
.drawer button {
  text-align: right; padding: 18px 4px;
  font-family: 'El Messiri', serif; font-size: 22px; font-weight: 500;
  border-bottom: 1px solid var(--line);
}
.drawer-close {
  position: absolute; top: 18px; left: 18px; width: 42px; height: 42px;
  border-radius: 12px; border: 1px solid var(--line);
  display: grid; place-items: center; padding: 0 !important;
}
.drawer-logo {
  display: flex; flex-direction: column;
  align-items: flex-start;
  padding: 4px 4px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
  cursor: pointer;
}

/* ============== HERO (illustrated, mountains + houses) ============== */
.hero {
  position: relative;
  height: 100vh; min-height: 640px;
  width: 100%; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  isolation: isolate;
  background: linear-gradient(180deg, #f8ecd2 0%, #f1dfb1 60%, #ead29a 100%);
}


/* sky overlay */
.hero-sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 75% 10%, rgba(255,225,170,.55), transparent 60%),
    radial-gradient(ellipse 60% 80% at 20% 0%, rgba(255,240,210,.4), transparent 60%);
  pointer-events: none;
}

/* floating glints */
.hero-stars { position: absolute; inset: 0; pointer-events: none; }
.star-glint {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255, 240, 200, .85);
  box-shadow: 0 0 12px rgba(255, 220, 170, .8);
  animation: twinkle 4s ease-in-out infinite;
}
.star-glint.s1 { animation-delay: 0s; }
.star-glint.s2 { animation-delay: .6s; width: 3px; height: 3px; }
.star-glint.s3 { animation-delay: 1.2s; }
.star-glint.s4 { animation-delay: 1.8s; width: 5px; height: 5px; }
.star-glint.s5 { animation-delay: 2.4s; }
.star-glint.s6 { animation-delay: 3.0s; width: 3px; height: 3px; }
@keyframes twinkle {
  0%, 100% { opacity: .3; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ── Sky Art (upper hero decoration) ── */
.hero-sky-art {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden; z-index: 1;
}

.hero-sky-motto {
  position: absolute; top: 11%; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; white-space: nowrap;
  font-family: 'El Messiri', serif; font-size: clamp(11px, 1.6vw, 15px);
  color: #6b4a2a; opacity: .38; letter-spacing: .12em; font-weight: 600;
  animation: fadeIn 1.4s ease both .4s;
}
.hsm-line {
  display: block; width: clamp(30px, 6vw, 70px); height: 1px;
  background: linear-gradient(90deg, transparent, #b08a4a, transparent);
}

.hero-orn-ring {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%);
  width: min(260px, 55vw); opacity: .7;
  animation: fadeIn 2s ease both .2s;
}

.hero-bird {
  position: absolute; opacity: .32;
  animation: birdSoar 9s ease-in-out infinite;
}
@keyframes birdSoar {
  0%   { transform: translateY(0)    rotate(-4deg) scaleX(1);   opacity: .28; }
  25%  { transform: translateY(-10px) rotate( 2deg) scaleX(1);  opacity: .38; }
  50%  { transform: translateY(-4px)  rotate(-2deg) scaleX(1);  opacity: .32; }
  75%  { transform: translateY(-12px) rotate( 3deg) scaleX(1);  opacity: .40; }
  100% { transform: translateY(0)    rotate(-4deg) scaleX(1);   opacity: .28; }
}

/* hero content */
.hero-content-illust {
  position: relative; z-index: 3;
  text-align: center; color: var(--ink);
  padding: clamp(48px, 7vh, 72px) 20px 0;
  max-width: 760px;
  margin: 0 auto;
  will-change: transform, opacity;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}

.hero-ornament {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  margin: 0 auto 18px;
}
.hero-ornament .line {
  width: 50px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
}
.hero-ornament-text {
  font-family: 'El Messiri', serif;
  font-size: 13px; letter-spacing: 5px; font-weight: 500;
  color: var(--accent-3);
}
@keyframes fadeIn { to { opacity: 1; } }

.hero-logo-wrap {
  position: relative;
  width: clamp(280px, 62vw, 560px);
  margin: 0 auto;
}

.hero-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 24px rgba(28,24,18,.14));
}

/* ── نص بديل عن الشعار في قسم الـ Hero ── */
.hero-logo-text {
  position: relative;
  z-index: 1;
  font-family: 'El Messiri', 'Tajawal', serif;
  font-weight: 700;
  font-size: clamp(48px, 12vw, 130px);
  line-height: 1.05;
  letter-spacing: 1px;
  text-align: center;
  margin: 0;
  padding: 18px 0;
  background: linear-gradient(135deg, #4a6336 0%, #6b8a4f 35%, #b08a4a 70%, #8a6a3a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(91,121,68,.18));
}

/* ── سحاب متحرك خلف الشعار ── */
.hero-logo-clouds {
  position: absolute;
  inset: -20px -70px;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.hlc {
  position: absolute;
  overflow: visible;
}

/* سحابة 1 — يسار */
.hlc-1 { width: 220px; height: 44px; top: 24%; left: -30px; animation: hlcRight 13s ease-in-out infinite; }

/* سحابة 2 — يمين */
.hlc-2 { width: 195px; height: 40px; top: 60%; right: -30px; animation: hlcLeft 15s ease-in-out infinite; animation-delay: -6s; }

@keyframes hlcRight {
  0%   { transform: translateX(0);    }
  50%  { transform: translateX(18px); }
  100% { transform: translateX(0);    }
}
@keyframes hlcLeft {
  0%   { transform: translateX(0);     }
  50%  { transform: translateX(-18px); }
  100% { transform: translateX(0);     }
}

.hero-tagline-illust {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 6px;
  font-family: 'El Messiri', serif;
  font-size: clamp(15px, 3.2vw, 19px);
  font-weight: 500;
  color: var(--accent-3);
  letter-spacing: 1px;
}
.hero-tagline-illust .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
}

.hero-subtitle-illust {
  font-family: 'Tajawal', sans-serif;
  font-size: clamp(14px, 2.6vw, 16px);
  font-weight: 400;
  margin: 12px auto 0; max-width: 520px;
  color: var(--ink-2); line-height: 1.95;
}

.hero-cta { display: none; }

/* ── مؤشر التمرير ─────────────────────────── */
.hero-scroll-indicator {
  position: relative;
  z-index: 5;
  background: transparent; border: none; padding: 6px;
  cursor: pointer;
  margin-top: clamp(110px, 20vh, 190px);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}

/* دائرة السهم */
.hsi-mouse {
  width: 50px; height: 50px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.75);
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
  transition: background .25s, box-shadow .25s;
}
.hero-scroll-indicator:hover .hsi-mouse {
  background: rgba(255,255,255,.18);
  box-shadow: 0 6px 26px rgba(0,0,0,.22);
}

/* نص "مرر" */
.hsi-label {
  display: block; margin-top: 8px;
  font-family: 'El Messiri', serif; font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.8); letter-spacing: .2em;
  text-align: center;
}

/* السهم */
.hsi-arrow { width: 18px; height: auto; display: block; }
.hsi-arrow path { stroke: rgba(255,255,255,.9) !important; }

/* سهم للأسفل — انيميشن متتالية */
.hsi-arrow-down { display: block; animation: arrowChase 1.8s ease-in-out infinite; }
.hsi-arrow-up   { display: none; }

@keyframes arrowChase {
  0%        { transform: translateY(-5px); opacity: 0; }
  30%, 70%  { transform: translateY(0);   opacity: 1; }
  100%      { transform: translateY(5px);  opacity: 0; }
}

/* جوال */
@media (max-width: 768px) {
  .hsi-arrow-down { display: none; }
  .hsi-arrow-up   { display: block; animation: arrowChaseUp 1.8s ease-in-out infinite; }
}

@keyframes arrowChaseUp {
  0%        { transform: translateY(5px);  opacity: 0; }
  30%, 70%  { transform: translateY(0);    opacity: 1; }
  100%      { transform: translateY(-5px); opacity: 0; }
}

@keyframes arrowBounceUp {
  0%,100% { transform: translateY( 4px); opacity: .5; }
  50%     { transform: translateY(-4px); opacity: 1;  }
}

/* scene wrap - bottom layered mountains */
.hero-scene-wrap {
  position: absolute; left: 0; right: 0; bottom: 0;
  width: 100%; height: 55%;
  z-index: 1;
  pointer-events: none;
  will-change: transform;
  animation: sceneRise 1.4s cubic-bezier(.2,.85,.3,1) both .2s;
}
@keyframes sceneRise {
  from { transform: translateY(50%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.faifa-scene {
  width: 100%; height: 100%; display: block;
}
.faifa-scene .layer-far, .faifa-scene .layer-mid, .faifa-scene .layer-front {
  transform-origin: center bottom;
  will-change: transform;
}
.faifa-scene .terr-far path, .faifa-scene .terr-mid path, .faifa-scene .terr-front path {
  stroke-dasharray: 200; stroke-dashoffset: 200;
  animation: drawTerrace 2s cubic-bezier(.2,.85,.3,1) forwards;
}
.faifa-scene .terr-far path { animation-delay: 1.1s; }
.faifa-scene .terr-mid path { animation-delay: 1.3s; }
.faifa-scene .terr-front path { animation-delay: 1.5s; }
@keyframes drawTerrace {
  to { stroke-dashoffset: 0; }
}
.faifa-scene .houses-mid g, .faifa-scene .houses-front g {
  opacity: 0;
  transform: translateY(15px);
  animation: houseIn .7s cubic-bezier(.2,.85,.3,1) forwards;
}
.faifa-scene .houses-mid g:nth-child(1) { animation-delay: 1.6s; }
.faifa-scene .houses-mid g:nth-child(2) { animation-delay: 1.75s; }
.faifa-scene .houses-mid g:nth-child(3) { animation-delay: 1.85s; }
.faifa-scene .houses-mid g:nth-child(4) { animation-delay: 1.95s; }
.faifa-scene .houses-front g:nth-child(1) { animation-delay: 2.0s; }
.faifa-scene .houses-front g:nth-child(2) { animation-delay: 2.1s; }
.faifa-scene .houses-front g:nth-child(3) { animation-delay: 2.2s; }
.faifa-scene .houses-front g:nth-child(4) { animation-delay: 2.3s; }
.faifa-scene .houses-front g:nth-child(5) { animation-delay: 2.4s; }
.faifa-scene .houses-front g:nth-child(6) { animation-delay: 2.5s; }
.faifa-scene .houses-front g:nth-child(7) { animation-delay: 2.6s; }
@keyframes houseIn {
  to { opacity: 1; transform: translateY(0); }
}

.hero-scroll-btn {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink); cursor: pointer;
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in oklab, var(--accent-d) 25%, transparent);
  transition: all .3s;
  font-size: 12px; letter-spacing: 3px; font-weight: 500;
  font-family: 'El Messiri', serif;
}
.hero-scroll-btn:hover { background: rgba(255,255,255,.85); transform: translateX(-50%) translateY(-3px); box-shadow: 0 8px 22px rgba(28,24,18,.12); }
.hero-scroll-btn svg { width: 14px; height: 14px; animation: bounce 2s infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* ============== SECTIONS ============== */
section { position: relative; z-index: 1; }
.sec-pad { padding: 52px 20px; }
@media (min-width: 768px) { .sec-pad { padding: 72px 40px; } }

.container { max-width: 1100px; margin: 0 auto; position: relative; z-index: 2; }

.sec-head { text-align: center; margin-bottom: 30px; }
.sec-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'El Messiri', serif;
  font-size: 13px; letter-spacing: 4px; font-weight: 500;
  color: var(--accent);
  margin-bottom: 14px;
}
.sec-eyebrow::before, .sec-eyebrow::after {
  content: ''; width: 22px; height: 1px; background: var(--accent); opacity: .5;
}
.sec-title {
  font-family: 'El Messiri', serif;
  font-size: clamp(32px, 6.5vw, 52px);
  line-height: 1.1; margin: 0 0 16px;
  font-weight: 700;
}
.sec-desc {
  font-size: 16px; line-height: 1.9;
  color: var(--ink-2); max-width: 620px; margin: 0 auto;
}

.reveal { opacity: 0; transform: translateY(40px); transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal.d1 { transition-delay: .08s; }
.reveal.d2 { transition-delay: .16s; }
.reveal.d3 { transition-delay: .24s; }
.reveal.d4 { transition-delay: .32s; }

/* ============== ABOUT SECTION ============== */
.about-section { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.about-grid {
  display: grid; grid-template-columns: 1fr; gap: 36px;
  align-items: center;
}
@media (min-width: 880px) { .about-grid { grid-template-columns: 1.1fr 1fr; gap: 60px; } }
.about-text { line-height: 2; color: var(--ink-2); font-size: 16px; }
.about-text p { margin: 0 0 18px; }
.about-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  margin-top: 30px;
}
.about-stat {
  padding: 22px 18px; border-radius: 18px;
  background: var(--paper); border: 1px solid var(--line);
  text-align: center;
}
.about-stat-num {
  font-family: 'El Messiri', serif; font-size: 38px; font-weight: 700;
  color: var(--accent); line-height: 1; margin-bottom: 4px;
}
.about-stat-lbl { font-size: 13px; color: var(--ink-3); font-weight: 500; }

.about-illust {
  position: relative; aspect-ratio: 4/5;
  border-radius: 24px; overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  box-shadow: var(--shadow-lg);
}
.about-illust-img {
  position: absolute; inset: 0;
  background-image: url('assets/faifa-day.jpg');
  background-size: cover; background-position: center 30%;
  filter: saturate(.92);
}
.about-illust-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(20,16,10,.85) 100%);
  display: flex; align-items: flex-end; padding: 24px;
}
.about-illust-overlay div { color: #fff; font-family: 'El Messiri', serif; font-size: 18px; font-weight: 600; }
.about-illust-overlay small { display: block; opacity: .75; font-weight: 400; font-size: 13px; margin-top: 4px; }

/* ============== ACCORDION CATEGORIES ============== */
.cat-accordion { display: flex; flex-direction: column; gap: 14px; }

.cat-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  transition: border-color .4s ease, box-shadow .4s ease;
  scroll-margin-top: 90px;
}
.cat-item.open {
  border-color: color-mix(in oklab, var(--cat-accent, var(--accent)) 70%, var(--line));
  box-shadow: var(--shadow-lg);
}

.cat-trigger {
  width: 100%; padding: 20px 20px;
  display: flex; align-items: center; gap: 14px;
  text-align: right;
  cursor: pointer;
  transition: background .3s;
}
@media (min-width: 640px) { .cat-trigger { padding: 24px 28px; gap: 18px; } }
.cat-trigger:hover { background: color-mix(in oklab, var(--cat-accent, var(--accent)) 5%, transparent); }

.cat-trigger-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 14%, var(--paper));
  color: var(--cat-accent, var(--accent));
  transition: transform .4s, background .4s, color .4s;
}
@media (min-width: 640px) { .cat-trigger-icon { width: 52px; height: 52px; } }
.cat-item.open .cat-trigger-icon { transform: scale(1.05); background: var(--cat-accent, var(--accent)); color: #fff; }
.cat-trigger-icon svg { width: 22px; height: 22px; }

.cat-trigger-info { flex: 1; min-width: 0; }
.cat-trigger-name {
  font-family: 'El Messiri', serif;
  font-size: clamp(17px, 4vw, 21px); font-weight: 600;
  margin: 0; line-height: 1.3;
}
.cat-trigger-meta {
  font-size: 12.5px; color: var(--ink-3); margin-top: 3px;
  font-family: 'Tajawal', sans-serif;
}

.cat-trigger-more {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'El Messiri', serif;
  font-size: 13px; font-weight: 500;
  color: var(--cat-accent, var(--accent));
  padding: 7px 14px; border-radius: 999px;
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 10%, transparent);
  flex-shrink: 0;
  transition: all .3s;
}
.cat-trigger-more .more-arrow {
  transition: transform .4s cubic-bezier(.2,.7,.2,1);
  display: inline-flex;
}
.cat-item.open .cat-trigger-more {
  background: var(--cat-accent, var(--accent));
  color: #fff;
}
.cat-item.open .cat-trigger-more .more-arrow { transform: rotate(180deg); }
.cat-trigger-more svg { width: 13px; height: 13px; }
@media (max-width: 420px) {
  .cat-trigger-more .more-label { display: none; }
  .cat-trigger-more { padding: 7px 10px; }
}

.cat-panel {
  max-height: 0; overflow: hidden;
  transition: max-height .55s cubic-bezier(.2,.7,.2,1);
}
.cat-item.open .cat-panel { max-height: 3000px; }

.cat-panel-inner {
  padding: 6px 20px 24px;
  border-top: 1px solid color-mix(in oklab, var(--cat-accent, var(--accent)) 25%, transparent);
}
@media (min-width: 640px) { .cat-panel-inner { padding: 6px 28px 30px; } }

.cat-members {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 560px) {
  .cat-members { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .cat-members { grid-template-columns: repeat(3, 1fr); }
}

.cat-more-wrap {
  display: flex; justify-content: center; margin-top: 20px;
  padding-top: 18px; border-top: 1px dashed var(--line);
}
.cat-more-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 12%, transparent);
  color: var(--cat-accent, var(--accent));
  transition: all .25s;
}
.cat-more-btn:hover { background: var(--cat-accent, var(--accent)); color: #fff; }
.cat-more-btn svg { width: 14px; height: 14px; }

/* member card */
.member-card {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 14px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
  border-radius: 14px;
  align-items: center;
  cursor: pointer;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), border-color .25s, box-shadow .3s, background .25s;
}
.member-card:hover {
  transform: translateY(-2px);
  border-color: var(--cat-accent, var(--accent));
  background: var(--paper);
  box-shadow: var(--shadow);
}

.avatar {
  width: 74px; height: 74px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  display: grid; place-items: center;
  font-family: 'El Messiri', serif; font-size: 28px; font-weight: 700;
  color: var(--cat-accent, var(--accent));
  position: relative; flex-shrink: 0;
  border: 1px solid var(--line);
}
.avatar::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in oklab, var(--cat-accent, var(--accent)) 10%, transparent) 5px 6px);
}
.avatar span { position: relative; }

.member-info { min-width: 0; }
.member-name {
  font-family: 'El Messiri', serif;
  font-size: clamp(13px, 3.2vw, 15.5px); font-weight: 600;
  margin: 0 0 3px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-title {
  font-size: 13px; color: var(--cat-accent, var(--accent)); font-weight: 500; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-work {
  font-size: 12px; color: var(--ink-3);
  display: flex; align-items: center; gap: 6px;
}
.member-work svg { width: 11px; height: 11px; flex-shrink: 0; }
.member-bio { font-size: 13px; color: var(--ink-2); margin-top: 8px; line-height: 1.65; display: none; }
.member-arrow {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  flex-shrink: 0; color: var(--ink-3);
  transition: all .25s;
}
.member-card:hover .member-arrow {
  background: var(--cat-accent, var(--accent));
  border-color: var(--cat-accent, var(--accent));
  color: #fff;
}
.member-arrow svg { width: 12px; height: 12px; transform: scaleX(-1); }

/* ============== RECURSIVE TREE ============== */
.tree-section { background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%); }

.tree-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
@media (min-width: 640px) { .tree-card { padding: 32px 26px; } }

.tree-root-cap {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 22px; padding-bottom: 22px;
  border-bottom: 1px dashed var(--line);
}
.tree-root-cap-mark {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-family: 'El Messiri', serif; font-weight: 700; font-size: 26px;
  box-shadow: 0 10px 28px color-mix(in oklab, var(--accent) 35%, transparent);
  margin-bottom: 12px;
  position: relative;
}
.tree-root-cap-mark::before, .tree-root-cap-mark::after {
  content: ''; position: absolute;
  top: 50%; width: 28px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.tree-root-cap-mark::before { right: 100%; margin-right: 8px; background: linear-gradient(90deg, transparent, var(--accent)); }
.tree-root-cap-mark::after { left: 100%; margin-left: 8px; }
.tree-root-cap-name {
  font-family: 'El Messiri', serif;
  font-size: 22px; font-weight: 700; color: var(--ink);
}
.tree-root-cap-tag {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
  letter-spacing: 1px;
}

/* recursive tree node */
.tn {
  position: relative;
  padding-right: 22px;
  padding-bottom: 4px;
}
.tn::before {
  content: '';
  position: absolute;
  top: 16px; bottom: 0;
  right: 8px;
  width: 1px;
  background: color-mix(in oklab, var(--accent) 35%, var(--line));
}
.tn.is-last::before { bottom: auto; height: 16px; }
.tn-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  position: relative;
  min-height: 32px;
}
.tn-row::before {
  content: '';
  position: absolute;
  top: 50%; right: -14px;
  width: 14px; height: 1px;
  background: color-mix(in oklab, var(--accent) 35%, var(--line));
}
.tn-root > .tn-row::before { display: none; }
.tn-root > .tn-row { padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px dashed var(--line); }

.tn-marker {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all .3s;
}
.tn-marker::after {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  transition: all .3s;
}
.tn-d0 > .tn-row .tn-marker { width: 28px; height: 28px; background: var(--accent); border-color: var(--accent); }
.tn-d0 > .tn-row .tn-marker::after { width: 12px; height: 12px; background: #fff; }
.tn-d1 > .tn-row .tn-marker { width: 22px; height: 22px; }
.tn-d1 > .tn-row .tn-marker::after { width: 9px; height: 9px; }
.tn-d2 > .tn-row .tn-marker { background: color-mix(in oklab, var(--accent-2) 18%, var(--paper)); border-color: var(--accent-2); }
.tn-d2 > .tn-row .tn-marker::after { background: var(--accent-2); }
.tn-d3 > .tn-row .tn-marker { width: 14px; height: 14px; background: var(--bg-2); border-color: var(--accent-3); }
.tn-d3 > .tn-row .tn-marker::after { width: 4px; height: 4px; background: var(--accent-3); }
.tn-d4 > .tn-row .tn-marker { width: 11px; height: 11px; }
.tn-d4 > .tn-row .tn-marker::after { width: 3px; height: 3px; }

.tn-name {
  font-family: 'El Messiri', serif;
  font-size: 15px; font-weight: 600;
  color: var(--ink); line-height: 1.3;
  flex: 1; min-width: 0;
}
.tn-d0 > .tn-row > .tn-name { font-size: 19px; color: var(--accent-d); font-weight: 700; }
.tn-d1 > .tn-row > .tn-name { font-size: 17px; color: var(--ink); font-weight: 700; }
.tn-d2 > .tn-row > .tn-name { font-size: 14.5px; color: var(--accent-3); font-weight: 600; }
.tn-d3 > .tn-row > .tn-name { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.tn-d4 > .tn-row > .tn-name { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }

.tn-children {
  padding-right: 14px;
}
.tn-children .tn:last-child { padding-bottom: 0; }

/* tree reveal animation */
.tn { opacity: 0; transform: translateX(-10px); transition: opacity .5s ease, transform .5s ease; }
.tree-card.in .tn { opacity: 1; transform: translateX(0); }
.tree-card.in .tn-d0 { transition-delay: .05s; }
.tree-card.in .tn-d1 { transition-delay: .15s; }
.tree-card.in .tn-d2 { transition-delay: .25s; }
.tree-card.in .tn-d3 { transition-delay: .35s; }
.tree-card.in .tn-d4 { transition-delay: .45s; }

.tree-cta { text-align: center; margin-top: 30px; }

.full-tree-wrap { padding: 0; }
.full-tree-wrap .tree-card { padding: 30px 22px; }
@media (min-width: 640px) { .full-tree-wrap .tree-card { padding: 42px 36px; } }

/* ============== TREE FEATURE CARD (home) ============== */
.tree-feature-section {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}

.tree-feature-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  cursor: pointer;
  text-align: right;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), border-color .3s, box-shadow .4s;
  box-shadow: var(--shadow);
  position: relative;
}
@media (min-width: 760px) {
  .tree-feature-card { grid-template-columns: 320px 1fr; }
}
.tree-feature-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle 400px at top right, color-mix(in oklab, var(--accent) 6%, transparent), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}
.tree-feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}
.tree-feature-card:hover::before { opacity: 1; }

.tree-feature-art {
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 8%, var(--bg-2)) 0%, var(--bg-3) 100%);
  display: grid; place-items: center;
  padding: 32px 24px;
  color: var(--accent-d);
  position: relative;
  min-height: 240px;
}
.tree-feature-art::before {
  content: '';
  position: absolute; inset: 16px;
  border: 1px dashed color-mix(in oklab, var(--accent) 30%, transparent);
  border-radius: 18px;
  pointer-events: none;
}
.tree-feature-art svg { width: 100%; max-width: 220px; height: auto; display: block; }
.tree-feature-card:hover .tree-feature-art svg {
  animation: treePulse 1.6s ease-in-out infinite;
}
@keyframes treePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.tree-feature-content {
  padding: 30px 26px;
  display: flex; flex-direction: column; gap: 14px;
}
@media (min-width: 640px) {
  .tree-feature-content { padding: 38px 36px; }
}

.tree-feature-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  font-family: 'El Messiri', serif;
  font-size: 13px; font-weight: 500;
  align-self: flex-start;
}

.tree-feature-title {
  font-family: 'El Messiri', serif;
  font-size: clamp(22px, 4.5vw, 30px);
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  color: var(--ink);
}

.tree-feature-desc {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.85;
  margin: 0;
}

.tree-feature-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 6px 0;
}
.tree-feature-stats > div {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tree-feature-stats strong {
  font-family: 'El Messiri', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.tree-feature-stats span {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 500;
  text-align: center;
}

.tree-feature-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-family: 'El Messiri', serif;
  font-size: 14.5px; font-weight: 600;
  align-self: flex-start;
  transition: all .25s;
}
.tree-feature-cta svg { transform: scaleX(-1); transition: transform .3s; }
.tree-feature-card:hover .tree-feature-cta {
  background: var(--accent-d);
  box-shadow: 0 10px 24px color-mix(in oklab, var(--accent) 35%, transparent);
}
.tree-feature-card:hover .tree-feature-cta svg { transform: scaleX(-1) translateX(-4px); }

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-family: 'El Messiri', serif;
  font-size: 15px; font-weight: 600;
  transition: all .25s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); transform: translateY(-1px); box-shadow: 0 10px 24px color-mix(in oklab, var(--accent) 30%, transparent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); background: color-mix(in oklab, var(--ink) 5%, transparent); }
.btn svg { width: 16px; height: 16px; }

/* ============== CONTACT SECTION ============== */
.contact-section { background: var(--paper); border-top: 1px solid var(--line); }

.contact-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 880px) { .contact-grid { grid-template-columns: 1.4fr 1fr; gap: 32px; } }

.contact-form-card { padding: 24px; border-radius: 22px; background: var(--bg); border: 1px solid var(--line); }
@media (min-width: 640px) { .contact-form-card { padding: 34px; } }

.contact-topic-select {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.contact-topic-select label {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  white-space: nowrap; flex-shrink: 0;
}
.contact-topic-select select {
  flex: 1; padding: 9px 14px; border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink);
  font-family: 'El Messiri', serif; font-size: 14px;
  cursor: pointer; transition: border-color .2s;
  appearance: auto;
}
.contact-topic-select select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 15%, transparent);
}

.contact-tab-desc {
  font-size: 14px; color: var(--ink-2);
  margin-bottom: 18px; line-height: 1.8;
  background: var(--bg-2); padding: 12px 16px;
  border-radius: 12px;
  border-right: 3px solid var(--accent);
}

.contact-info-card { padding: 26px; border-radius: 22px; background: var(--bg); border: 1px solid var(--line); align-self: start; }
.contact-info-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.contact-info-row:last-child { border-bottom: 0; }
.contact-info-row > svg {
  flex-shrink: 0; width: 22px; height: 22px;
  padding: 9px; box-sizing: content-box;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  border-radius: 10px;
}
.contact-info-row .lbl { font-size: 12px; color: var(--ink-3); font-family: 'El Messiri', serif; }
.contact-info-row .val { font-size: 14.5px; color: var(--ink); font-weight: 500; margin-top: 2px; }

/* ============== FORMS ============== */
.field { display: flex; flex-direction: column; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; font-family: 'El Messiri', serif; }
.field label .req { color: var(--accent-3); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink);
  font-family: 'Tajawal', sans-serif; font-size: 14.5px;
  transition: border-color .2s, background .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.field textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
.field-search { position: relative; }
.field-search > svg { position: absolute; top: 38px; left: 14px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.field-search input { padding-left: 38px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; gap: 14px; } }

.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 16px; border: 2px dashed var(--line); border-radius: 14px;
  text-align: center; cursor: pointer;
  transition: all .2s;
  font-size: 13.5px; color: var(--ink-3);
}
.file-drop:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in oklab, var(--accent) 4%, transparent); }
.file-drop svg { width: 26px; height: 26px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 14px 22px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 500; font-family: 'El Messiri', serif;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toastIn .4s cubic-bezier(.2,.7,.2,1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============== SUBPAGES ============== */
.page-pad { padding: 110px 20px 80px; }
@media (min-width: 768px) { .page-pad { padding: 140px 40px 100px; } }

.page-head { margin-bottom: 36px; }
.page-title {
  font-family: 'El Messiri', serif;
  font-size: clamp(32px, 6vw, 50px);
  margin: 0 0 12px; font-weight: 700; line-height: 1.15;
}
.page-sub { font-size: 16px; color: var(--ink-2); max-width: 700px; line-height: 1.8; }

.filters {
  display: grid; grid-template-columns: 1fr; gap: 12px;
  padding: 18px; border-radius: 20px;
  background: var(--paper); border: 1px solid var(--line);
  margin-bottom: 28px;
}
@media (min-width: 720px) { .filters { grid-template-columns: 1.5fr 1fr 1fr auto; align-items: end; } }
.filter-reset { padding: 12px 18px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; font-weight: 500; transition: all .2s; background: var(--bg); }
.filter-reset:hover { border-color: var(--ink); }

.results-count { font-size: 14px; color: var(--ink-3); margin-bottom: 16px; }
.empty { padding: 60px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; color: var(--ink-3); }

.member-list { display: flex; flex-direction: column; gap: 12px; }

/* profile */
.profile-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--ink-2); margin-bottom: 16px;
  padding: 8px 14px 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); transition: all .2s; background: var(--paper);
}
.profile-back:hover { color: var(--ink); border-color: var(--ink-2); }
.profile-back svg { width: 14px; height: 14px; transform: scaleX(-1); }

/* ══ Profile ID Card ══════════════════════════════════════════ */
.pic-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}
.pic-banner {
  height: 80px;
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--cat-accent, var(--accent)) 28%, var(--bg-2)) 0%,
    color-mix(in oklab, var(--cat-accent, var(--accent)) 10%, var(--bg-3)) 100%
  );
  position: relative;
}
.pic-banner::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 75% 50%,
    color-mix(in oklab, var(--cat-accent, var(--accent)) 20%, transparent) 0%,
    transparent 65%);
}
.pic-action-bar {
  position: absolute;
  top: 12px; left: 14px;
  display: flex; gap: 6px; z-index: 2;
}
.pic-action-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
}
.pic-action-btn:hover { background: rgba(255,255,255,.5); transform: scale(1.06); }
.pic-tree-btn {
  background: var(--cat-accent, var(--accent));
  border-color: color-mix(in oklab, var(--cat-accent, var(--accent)) 60%, transparent);
  color: #fff;
  animation: tree-btn-pulse 2.4s ease-in-out infinite;
}
.pic-tree-btn:hover {
  animation: none;
  background: var(--cat-accent, var(--accent));
  box-shadow: 0 4px 14px color-mix(in oklab, var(--cat-accent, var(--accent)) 50%, transparent);
}
@keyframes tree-btn-pulse {
  0%   { box-shadow: 0 0 0 0   color-mix(in oklab, var(--cat-accent, var(--accent)) 55%, transparent); }
  60%  { box-shadow: 0 0 0 8px color-mix(in oklab, var(--cat-accent, var(--accent)) 0%,  transparent); }
  100% { box-shadow: 0 0 0 0   color-mix(in oklab, var(--cat-accent, var(--accent)) 0%,  transparent); }
}
.pic-avatar {
  width: 140px; height: 140px; border-radius: 24px;
  border: 3px solid var(--paper);
  box-shadow: 0 4px 18px color-mix(in oklab, var(--cat-accent, var(--accent)) 22%, rgba(0,0,0,.1));
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  display: grid; place-items: center;
  font-family: 'El Messiri', serif; font-size: 48px; font-weight: 700;
  color: var(--cat-accent, var(--accent));
  position: relative; z-index: 1;
  margin: -70px auto 0;
  overflow: hidden;
}
.pic-identity {
  text-align: center;
  padding: 10px 20px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.pic-name {
  font-family: 'El Messiri', serif;
  font-size: clamp(16px, 5.2vw, 24px);
  font-weight: 700; line-height: 1.3;
  margin: 0; color: var(--ink);
  white-space: normal;
}
.pic-details {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.pic-detail-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 55%, transparent);
  font-size: 13.5px; color: var(--ink-2);
}
.pic-detail-row:last-child { border-bottom: none; }
.pic-detail-row svg { flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; color: var(--cat-accent, var(--accent)); }

/* ══ Tree Path Modal ══════════════════════════════════════════ */
/* ══ Update Request Modal ══ */
.upd-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.upd-modal {
  background: var(--paper);
  border-radius: 20px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 60px rgba(0,0,0,.2);
  overflow: hidden;
  animation: tpm-in .22s cubic-bezier(.2,.8,.2,1);
}
.upd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.upd-title {
  display: flex; align-items: center; gap: 7px;
  font-family: 'El Messiri', serif; font-size: 16px; font-weight: 700;
  color: var(--ink);
}
.upd-close {
  width: 30px; height: 30px; border-radius: 8px;
  border: none; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-2);
}
.upd-form { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.upd-member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 12%, var(--bg-2));
  color: var(--cat-accent, var(--accent));
  border-radius: 50px; padding: 5px 12px;
  font-size: 13px; font-weight: 600; align-self: flex-start;
}
.upd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upd-submit { width: 100%; margin-top: 4px; justify-content: center; }
.upd-success {
  padding: 36px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
}
.upd-success p { font-size: 15px; color: var(--ink-2); }

.tpm-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: tpm-fade .18s ease;
}
@keyframes tpm-fade { from { opacity:0 } to { opacity:1 } }
.tpm-modal {
  background: var(--paper);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.04);
  width: 320px; max-width: 100%;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  direction: rtl;
  animation: tpm-scale .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes tpm-scale {
  from { opacity:0; transform: scale(.88) translateY(12px) }
  to   { opacity:1; transform: scale(1)   translateY(0) }
}
.tpm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--paper);
  border-radius: 22px 22px 0 0; z-index: 1;
}
.tpm-title {
  display: flex; align-items: center; gap: 8px;
  font-family: 'El Messiri', serif; font-size: 15px; font-weight: 700; color: var(--ink);
}
.tpm-title svg { color: var(--cat-accent, var(--accent)); width:16px; height:16px; }
.tpm-close {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.tpm-close:hover { background: var(--bg-2); color: var(--ink); }
.tpm-body { padding: 20px 18px 6px; }
.tpm-step {
  display: flex; gap: 14px; align-items: flex-start;
}
.tpm-track {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; width: 20px;
}
.tpm-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--line) 80%, var(--ink-3));
  background: var(--bg);
  flex-shrink: 0; margin-top: 4px;
  transition: all .2s;
}
.tpm-first .tpm-dot {
  width: 14px; height: 14px; background: var(--accent); border-color: var(--accent);
}
.tpm-last .tpm-dot {
  width: 18px; height: 18px; margin-top: 2px;
  background: var(--cat-accent, var(--accent));
  border-color: var(--cat-accent, var(--accent));
  box-shadow: 0 0 0 5px color-mix(in oklab, var(--cat-accent, var(--accent)) 16%, transparent);
}
.tpm-line {
  width: 2px; flex: 1; min-height: 22px;
  background: linear-gradient(to bottom,
    color-mix(in oklab, var(--line) 80%, var(--ink-3)),
    color-mix(in oklab, var(--cat-accent, var(--accent)) 35%, var(--line))
  );
  margin: 3px 0;
}
.tpm-content {
  display: flex; flex-direction: column; gap: 1px;
  padding-bottom: 22px; flex: 1; min-width: 0;
}
.tpm-last .tpm-content { padding-bottom: 8px; }
.tpm-depth {
  font-size: 10px; color: var(--ink-3);
  font-family: 'Tajawal', sans-serif; letter-spacing: .4px;
  text-transform: none;
}
.tpm-label {
  font-family: 'El Messiri', serif;
  font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.3;
}
.tpm-first .tpm-label { color: var(--accent); font-size: 14.5px; font-weight: 700; }
.tpm-last  .tpm-label { color: var(--cat-accent, var(--accent)); font-size: 15px; font-weight: 700; }
.tpm-last  .tpm-depth { color: var(--cat-accent, var(--accent)); opacity: .65; }
.tpm-footer {
  padding: 10px 16px 16px;
  border-top: 1px solid var(--line);
}
.tpm-footer .btn { width: 100%; justify-content: center; font-size: 13.5px; }

.profile-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px;
  padding: 22px 18px 18px;
  border-radius: 20px;
  background: var(--paper); border: 1px solid var(--line);
  margin-bottom: 16px;
}
.profile-hero-info { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; }
@media (min-width: 640px) {
  .profile-hero { flex-direction: row; text-align: right; gap: 22px; padding: 24px 28px; }
  .profile-hero-info { align-items: flex-start; }
}
.profile-avatar {
  width: 110px; height: 110px; border-radius: 22px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  display: grid; place-items: center;
  font-family: 'El Messiri', serif; font-size: 40px; font-weight: 700;
  color: var(--cat-accent, var(--accent));
  position: relative; border: 1px solid var(--line);
}
@media (min-width: 640px) { .profile-avatar { width: 130px; height: 130px; font-size: 48px; border-radius: 24px; } }
.profile-avatar::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in oklab, var(--cat-accent, var(--accent)) 12%, transparent) 7px 8px);
}
.profile-avatar span { position: relative; }
.profile-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 15%, transparent);
  color: var(--cat-accent, var(--accent));
  font-size: 12px; font-weight: 500; font-family: 'El Messiri', serif;
  margin-bottom: 8px;
}
.profile-name {
  font-family: 'El Messiri', serif;
  font-size: clamp(17px, 4.5vw, 26px);
  margin: 0 0 4px; line-height: 1.3; font-weight: 700;
  white-space: normal; overflow: visible;
}
.profile-role { font-family: 'El Messiri', serif; font-size: clamp(12px, 3vw, 14px); color: var(--cat-accent, var(--accent)); margin-bottom: 2px; }
.profile-work { font-size: clamp(11.5px, 2.8vw, 13px); color: var(--ink-3); display: flex; align-items: center; gap: 4px; }

.profile-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 880px) { .profile-grid { grid-template-columns: 2fr 1fr; } }
.card-panel { padding: 18px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
@media (min-width: 640px) { .card-panel { padding: 22px; } }
.panel-title {
  font-family: 'El Messiri', serif;
  font-size: 18px; font-weight: 600;
  margin: 0 0 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.panel-title svg { width: 18px; height: 18px; color: var(--accent); }
.panel-text { font-size: 15px; line-height: 1.95; color: var(--ink-2); }
.info-list { display: flex; flex-direction: column; gap: 12px; }
.info-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.info-row:last-child { border-bottom: 0; }
.info-row .k { color: var(--ink-3); }
.info-row .v { color: var(--ink); font-weight: 500; text-align: left; }
.timeline { display: flex; flex-direction: column; gap: 18px; }
.tl-item { position: relative; padding-right: 24px; }
.tl-item::before {
  content: ''; position: absolute; right: 6px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}
.tl-item::after {
  content: ''; position: absolute; right: 10px; top: 22px; bottom: -14px;
  width: 2px; background: var(--line);
}
.tl-item:last-child::after { display: none; }
.tl-year { font-size: 12px; color: var(--accent); font-weight: 600; font-family: 'El Messiri', serif; }
.tl-text { font-size: 14px; color: var(--ink-2); margin-top: 4px; line-height: 1.7; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.profile-edit-btn {
  width: 36px; height: 36px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
}

/* ── Profile Tree Path — single scrollable row ── */
.profile-tree-path {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 7%, var(--paper));
  border: 1px solid color-mix(in oklab, var(--cat-accent, var(--accent)) 22%, transparent);
  margin-bottom: 12px;
  overflow: hidden;
}
.ptp-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cat-accent, var(--accent));
  flex-shrink: 0;
  white-space: nowrap;
  padding-left: 8px;
  border-left: 1.5px solid color-mix(in oklab, var(--cat-accent, var(--accent)) 28%, transparent);
}
.ptp-label svg { width: 12px; height: 12px; }
.ptp-chain {
  /* LTR so root→leaf reads left to right, › points forward */
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ptp-chain::-webkit-scrollbar { display: none; }
.ptp-node {
  font-size: 11.5px;
  font-family: 'El Messiri', serif;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid color-mix(in oklab, var(--cat-accent, var(--accent)) 18%, var(--line));
  background: var(--paper);
  color: var(--ink-2);
  white-space: nowrap;
  flex-shrink: 0;
  direction: rtl; /* Arabic text inside */
}
.ptp-root {
  background: color-mix(in oklab, var(--cat-accent, var(--accent)) 10%, var(--paper));
  border-color: color-mix(in oklab, var(--cat-accent, var(--accent)) 45%, transparent);
  color: var(--cat-accent, var(--accent));
  font-weight: 600;
}
.ptp-leaf {
  background: var(--cat-accent, var(--accent));
  border-color: var(--cat-accent, var(--accent));
  color: #fff;
  font-weight: 700;
}
.ptp-sep {
  color: var(--ink-3);
  font-size: 11px;
  flex-shrink: 0;
  line-height: 1;
  opacity: .6;
}
.ptp-go {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklab, var(--cat-accent, var(--accent)) 28%, transparent);
  background: var(--paper);
  color: var(--cat-accent, var(--accent));
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.ptp-go:hover { background: color-mix(in oklab, var(--cat-accent, var(--accent)) 14%, var(--paper)); }
.ptp-go svg { width: 12px; height: 12px; }

/* ── atb-badges (multiple members in column browser) ── */
.atb-badges { display: flex; flex-direction: column; gap: 3px; }

/* ── atr-members-list ── */
.atr-members-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }

/* ── Branch Mates ── */
.branch-mates-list { display: flex; flex-direction: column; gap: 6px; }
.branch-mate-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--bm-accent, var(--accent)) 20%, var(--line));
  background: color-mix(in oklab, var(--bm-accent, var(--accent)) 5%, var(--paper));
  cursor: pointer; text-align: right; width: 100%;
  transition: background .2s, transform .2s;
}
.branch-mate-item:hover {
  background: color-mix(in oklab, var(--bm-accent, var(--accent)) 12%, var(--paper));
  transform: translateX(-2px);
}
.branch-mate-item svg { color: var(--bm-accent, var(--accent)); flex-shrink: 0; transform: scaleX(-1); }
.bm-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: color-mix(in oklab, var(--bm-accent, var(--accent)) 18%, var(--bg-2));
  color: var(--bm-accent, var(--accent));
  font-family: 'El Messiri', serif; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.bm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bm-name {
  font-family: 'El Messiri', serif; font-size: 13px; font-weight: 600;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bm-title { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============== FOOTER ============== */
.footer {
  background: var(--bg-2); border-top: 1px solid var(--line);
  padding: 50px 20px 30px; position: relative; z-index: 2;
}
.footer-grid { display: grid; gap: 30px; grid-template-columns: 1fr; max-width: 1100px; margin: 0 auto; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer h4 { font-family: 'El Messiri', serif; font-size: 15px; font-weight: 600; margin: 0 0 14px; }
.footer p, .footer a, .footer button { font-size: 14px; color: var(--ink-2); line-height: 1.9; display: block; padding: 2px 0; text-align: right; }
.footer a:hover, .footer button:hover { color: var(--ink); }
.footer-bot {
  max-width: 1100px; margin: 30px auto 0;
  padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  font-size: 13px; color: var(--ink-3);
}

/* ============================================================
   تسليط الضوء على مسار الشجرة
============================================================ */

/* العقد على المسار */
.tn.tn-on-path > .tn-row .tn-marker {
  background: var(--accent-d) !important;
  border-color: var(--accent-d) !important;
  box-shadow: 0 0 0 3px rgba(93,122,68,.2);
}
.tn.tn-on-path > .tn-row > .tn-name { color: var(--accent-d) !important; font-weight: 700 !important; }
.tn.tn-on-path::before { background: var(--accent) !important; width: 2px !important; }

/* العقدة الهدف (نهاية المسار) */
.tn.tn-target > .tn-row .tn-marker {
  background: var(--accent-d) !important;
  box-shadow: 0 0 0 6px rgba(93,122,68,.2);
  animation: treeTargetPulse 1.8s ease-in-out infinite;
}
.tn.tn-target > .tn-row > .tn-name,
.tn.tn-target > .tn-row > .tn-name-link {
  background: var(--accent) !important;
  color: #fff !important;
  padding: 4px 12px !important;
  border-radius: 8px !important;
}
@keyframes treeTargetPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(93,122,68,.25); }
  50%      { box-shadow: 0 0 0 9px rgba(93,122,68,.10); }
}

/* عقدة مرتبطة بعضو (قابلة للنقر) */
.tn.tn-member > .tn-row .tn-name-link {
  cursor: pointer;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.tn.tn-member > .tn-row .tn-name-link:hover { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; }
.tn-member-tag {
  font-size: 10.5px; background: rgba(93,122,68,.12); color: var(--accent-d);
  border-radius: 4px; padding: 1px 6px; font-weight: 600; white-space: nowrap;
}

/* breadcrumb مسار الشخص */
/* ── مسار الشخص في الشجرة ── */
.tree-path-breadcrumb {
  background: color-mix(in oklab, var(--accent) 7%, var(--paper));
  border: 1.5px solid color-mix(in oklab, var(--accent) 25%, transparent);
  border-radius: 14px; padding: 14px 18px;
  margin-bottom: 20px; direction: rtl;
  box-shadow: 0 2px 10px rgba(93,122,68,.08);
}
.tree-path-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--accent-d);
  letter-spacing: .04em; margin-bottom: 10px;
  text-transform: uppercase;
}
.tree-path-title svg { color: var(--accent); }
.tree-path-chain {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 2px;
}
.tree-path-node {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 99px;
  font-size: 13px; font-family: 'El Messiri', serif;
  background: var(--paper); border: 1px solid var(--line);
  color: var(--ink-2);
}
.tree-path-node-icon { font-style: normal; font-size: 12px; }
.tree-path-root  { background: color-mix(in oklab, var(--accent) 12%, var(--paper)); border-color: var(--accent); color: var(--accent-d); font-weight: 600; }
.tree-path-target { background: var(--accent-d); border-color: var(--accent-d); color: #fff; font-weight: 700; }
.tree-path-arrow { color: var(--ink-3); font-size: 14px; padding: 0 2px; line-height: 1; }

/* بانر تحديد الشخص في صفحة الشجرة */
.tree-highlight-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: color-mix(in oklab, var(--accent) 6%, var(--paper));
  border: 1px solid color-mix(in oklab, var(--accent) 18%, transparent);
  border-radius: 12px; padding: 12px 18px; margin-bottom: 20px; font-size: 14px; color: var(--ink-2);
}
.tree-hl-status { font-size: 12px; color: var(--accent-d); background: rgba(93,122,68,.1); padding: 2px 10px; border-radius: 99px; }
.tree-hl-notfound { color: var(--accent-3) !important; background: rgba(138,94,58,.08) !important; }

/* دليل قراءة الشجرة — أعلى الصفحة */
.tree-guide-top {
  display: flex; flex-wrap: wrap; gap: 10px 20px;
  background: color-mix(in oklab, var(--accent) 5%, var(--paper));
  border: 1px solid color-mix(in oklab, var(--accent) 15%, transparent);
  border-radius: 12px; padding: 12px 18px; margin-bottom: 18px;
  font-size: 13px; color: var(--ink-2);
}
.tree-guide-item { display: flex; align-items: center; gap: 8px; }
.tree-guide-dot {
  width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0;
  border: 2px solid transparent;
}

/* ── صورة الأفاتار ─────────────────────────────────────────── */
.avatar         { position: relative; overflow: hidden; }
.profile-avatar { position: relative; overflow: hidden; }
.bm-avatar      { position: relative; overflow: hidden; }
/* موضع الصورة: --px/--py (0-100) للإزاحة، --ps (1-3) للتكبير */
.avatar-photo {
  position: absolute;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: calc(var(--px, 50) * 1%) calc(var(--py, 50) * 1%);
  transform: scale(var(--ps, 1));
  transform-origin: calc(var(--px, 50) * 1%) calc(var(--py, 50) * 1%);
  display: block;
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   Desktop Org-Chart Tree — SVG lines, LTR layout (≥900px)
============================================================ */
@media (min-width: 900px) {

  .tree-card-desktop { padding: 24px 20px 16px; }

  /* ── الحاوية الخارجية (overflow + LTR) ── */
  .org-chart-outer {
    direction: ltr;
    overflow-x: auto;
    padding: 2px 20px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
  }
  .org-chart-outer::-webkit-scrollbar       { height: 4px; }
  .org-chart-outer::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

  /* الحاوية الداخلية — position:relative لـ SVG overlay */
  .org-chart-inner {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 100%;
  }

  /* ── SVG overlay — يرسم الخطوط بإحداثيات دقيقة ── */
  .org-svg-overlay {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    overflow: visible;
    pointer-events: none;
  }

  /* خط عادي */
  .org-svg-line { stroke: var(--line-2); }

  /* خط المسار المحدد — متحرك */
  .org-svg-active {
    stroke: var(--accent-d);
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: orgDrawLine .4s var(--dly, 0s) cubic-bezier(.4,0,.2,1) forwards;
  }
  @keyframes orgDrawLine { to { stroke-dashoffset: 0; } }

  /* ── هيكل الشجرة ── */
  .org-chart {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 100%;
    position: relative;
  }

  /* كل عقدة: عمود مُمركَز */
  .org-nw {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
  }

  /* صف الأبناء — المسافة العلوية = مساحة خطوط SVG */
  .org-siblings-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 6px;
    padding-top: 28px; /* مساحة ترسم فيها خطوط SVG */
  }

  /* ── الصندوق ── */
  .org-box {
    direction: rtl;
    text-align: center;
    border-radius: 8px;
    border: 1.5px solid var(--line-2);
    background: var(--paper);
    padding: 10px 6px 6px;
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    transition: box-shadow .2s, border-color .2s, background .2s, transform .15s, opacity .25s;
    user-select: none;
  }

  .org-box-name {
    writing-mode: horizontal-tb;
    direction: rtl; text-align: center;
    font-size: 11px; line-height: 1.45;
    max-width: 90px; min-width: 50px;
    overflow: hidden; text-overflow: ellipsis;
    white-space: normal; word-break: break-word;
  }
  .org-member-name {
    writing-mode: horizontal-tb;
    direction: rtl; text-align: center;
    font-size: 9px; color: var(--accent-d); font-weight: 700; margin-top: 3px;
    display: none; align-items: center; gap: 2px;
  }
  .org-nw.org-ocp > .org-box .org-member-name,
  .org-nw.org-ocp-target > .org-box .org-member-name { display: flex; }
  .org-box-toggle {
    display: inline-block; margin-top: 4px;
    font-size: 9px; color: var(--ink-3); background: var(--bg-2);
    border-radius: 99px; padding: 0 6px; line-height: 16px;
    font-family: monospace; letter-spacing: -.5px;
  }

  /* ── ألوان حسب العمق ── */

  /* D0: الجذر — أفقي وكبير */
  .org-d0 > .org-box {
    background: var(--accent); color: #fff; border-color: var(--accent-d);
    padding: 12px 28px; border-radius: 14px;
    box-shadow: 0 4px 20px rgba(93,122,68,.28); cursor: default;
  }
  .org-d0 > .org-box .org-box-name {
    writing-mode: horizontal-tb; white-space: nowrap; max-height: none;
    font-family: 'El Messiri', serif; font-size: 18px; font-weight: 700;
    color: #fff; letter-spacing: .02em; min-height: auto;
  }
  .org-d0 > .org-box .org-box-toggle { background: rgba(255,255,255,.2); color: rgba(255,255,255,.8); }

  /* D1: فروع رئيسية */
  .org-d1 > .org-box {
    background: color-mix(in oklab, var(--accent) 10%, var(--paper));
    border-color: color-mix(in oklab, var(--accent) 45%, transparent);
    padding: 10px 5px; min-width: 30px;
  }
  .org-d1 > .org-box .org-box-name {
    font-family: 'El Messiri', serif; font-size: 12px; font-weight: 700;
    color: var(--accent-d); min-height: unset;
  }

  /* D2 */
  .org-d2 > .org-box {
    background: color-mix(in oklab, var(--accent-2) 8%, var(--paper));
    border-color: color-mix(in oklab, var(--accent-2) 38%, transparent);
    padding: 8px 5px;
  }
  .org-d2 > .org-box .org-box-name { font-size: 11px; font-weight: 600; min-height: unset; }

  /* D3 */
  .org-d3 > .org-box { background: var(--bg-2); border-color: var(--line); padding: 7px 4px; }
  .org-d3 > .org-box .org-box-name { font-size: 10.5px; color: var(--ink-2); min-height: unset; }

  /* D4+ */
  .org-d4 > .org-box,
  .org-d5 > .org-box { background: var(--bg-3); border-color: var(--line); padding: 6px 4px; border-radius: 6px; }
  .org-d4 > .org-box .org-box-name,
  .org-d5 > .org-box .org-box-name { font-size: 10px; color: var(--ink-3); min-height: unset; }

  /* Hover */
  .org-d1:hover > .org-box,
  .org-d2:hover > .org-box,
  .org-d3:hover > .org-box { box-shadow: 0 2px 10px rgba(28,24,18,.08); }

  /* مرتبط بعضو */
  .org-linked > .org-box { border-color: var(--accent-2) !important; border-style: dashed; }
  .org-linked:hover > .org-box { border-style: solid; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(28,24,18,.1); }

  /* ── تعتيم عناصر خارج المسار ── */
  .org-chart.org-has-active .org-nw:not(.org-ocp):not(.org-ocp-target) > .org-box {
    opacity: .28; filter: saturate(.15);
    transition: opacity .3s, filter .3s;
  }

  /* ── عقد المسار ── */
  .org-nw.org-ocp > .org-box {
    background: color-mix(in oklab, var(--accent) 14%, var(--paper)) !important;
    border-color: var(--accent-d) !important; border-style: solid !important;
    box-shadow: 0 0 0 3px rgba(93,122,68,.18) !important;
    opacity: 1 !important; filter: none !important;
    animation: orgNodeIn .3s var(--pd, 0ms) cubic-bezier(.2,0,.2,1.4) both;
  }
  .org-nw.org-ocp > .org-box .org-box-name { color: var(--accent-d) !important; }

  /* ── عقدة الهدف ── */
  .org-nw.org-ocp-target > .org-box {
    background: var(--accent-d) !important; border-color: var(--accent-d) !important;
    box-shadow: 0 0 0 5px rgba(93,122,68,.22), 0 6px 18px rgba(93,122,68,.22) !important;
    opacity: 1 !important; filter: none !important;
    animation: orgTargetIn .38s var(--pd, 0ms) cubic-bezier(.15,0,.2,1.6) both;
  }
  /* النص أبيض على خلفية خضراء — يتغلب على ألوان العمق */
  .org-nw.org-ocp-target > .org-box .org-box-name,
  .org-nw.org-ocp-target > .org-box .org-member-name,
  .org-nw.org-ocp-target > .org-box .org-box-toggle { color: rgba(255,255,255,.95) !important; }

  @keyframes orgNodeIn   { from { transform: scale(.93); opacity: .5; } to { transform: scale(1); opacity: 1; } }
  @keyframes orgTargetIn { from { transform: scale(.86); opacity: 0;  } to { transform: scale(1); opacity: 1; } }

  .org-hint {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 11px; color: var(--ink-3); direction: rtl; margin-top: 10px;
  }
}

/* ============== MOBILE ACCORDION TREE ============== */
.mtree-wrap {
  padding: 8px 0 32px;
  direction: rtl;
}
.mtree-root-header {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 20px; margin-bottom: 12px;
  background: var(--accent); color: #fff;
  border-radius: 14px;
  font-family: 'El Messiri', serif; font-size: 17px; font-weight: 700;
  box-shadow: 0 4px 18px rgba(93,122,68,.25);
  cursor: default;
}
.mtree-root-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; flex-shrink: 0;
}
.mtree-root-name { flex: 1; text-align: center; }
.mtree-root-tag {
  font-size: 11px; font-family: 'Tajawal', sans-serif; font-weight: 400;
  background: rgba(255,255,255,.18); border-radius: 99px; padding: 2px 10px;
  opacity: .9; flex-shrink: 0;
}

.mtree-body { display: flex; flex-direction: column; gap: 3px; }

.mtree-item {
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  transition: box-shadow .2s;
}
.mtree-item.on-path {
  border-color: color-mix(in oklab, var(--acc, var(--accent)) 55%, transparent);
  background: color-mix(in oklab, var(--acc, var(--accent)) 6%, var(--paper));
  box-shadow: 0 2px 10px rgba(93,122,68,.1);
}
.mtree-item.is-target {
  border-color: var(--accent-d);
  background: color-mix(in oklab, var(--accent-d) 10%, var(--paper));
  box-shadow: 0 0 0 3px rgba(93,122,68,.18), 0 3px 12px rgba(93,122,68,.15);
}

.mtree-row {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 9px 12px 9px calc(12px + var(--depth, 0) * 16px);
  text-align: right; font-size: 14px; color: var(--ink);
  background: transparent;
  transition: background .15s;
  border-radius: 10px;
}
.mtree-row:active { background: color-mix(in oklab, var(--ink) 5%, transparent); }

.on-path > .mtree-row { color: var(--accent-d); font-weight: 600; }
.is-target > .mtree-row { color: var(--accent-d); font-weight: 700; }

.mtree-indent-bar {
  display: block;
  width: 14px; height: 2px;
  flex-shrink: 0; align-self: center;
  border-radius: 1px;
  opacity: .75;
}

.mtree-toggle-icon {
  flex-shrink: 0;
  width: 16px; text-align: center;
  font-size: 13px; color: var(--ink-3);
  transition: transform .2s, color .2s;
}
.mtree-item.open > .mtree-row .mtree-toggle-icon { transform: rotate(0deg); }

.mtree-label { flex: 1; font-family: 'El Messiri', serif; }

.mtree-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2); flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(176,138,74,.2);
}
.on-path .mtree-dot { background: var(--accent); }

.mtree-member-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-family: 'Tajawal', sans-serif; font-weight: 500;
  background: color-mix(in oklab, var(--accent-2) 12%, transparent);
  color: var(--accent-3);
  border-radius: 99px; padding: 2px 8px;
  flex-shrink: 0;
}
.is-target .mtree-member-badge {
  background: var(--accent-d); color: #fff;
}

.mtree-count {
  font-size: 10px; color: var(--ink-3);
  background: var(--bg-2); border-radius: 99px; padding: 1px 7px;
  font-family: monospace; flex-shrink: 0;
  min-width: 20px; text-align: center;
}
.on-path .mtree-count { background: color-mix(in oklab, var(--accent) 15%, var(--bg-2)); color: var(--accent-d); }

.mtree-children {
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 0 6px 6px;
  margin-right: 14px;
  border-right: 2px solid var(--acc, var(--accent));
  border-bottom-right-radius: 6px;
  animation: mtreeSlide .2s ease both;
}
/* إزالة padding-right لتلتصق شريط الاتصال الأفقي بالخط العمودي */
.mtree-children > .mtree-item > .mtree-row {
  padding-right: 0;
}
@keyframes mtreeSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mtree-children .mtree-item {
  margin-right: calc(var(--depth, 0) * 8px);
}

/* ── depth accent colours ── */
.mtree-item.d0 { --acc: var(--accent); }
.mtree-item.d1 { --acc: var(--accent); }
.mtree-item.d2 { --acc: var(--accent-2); }
.mtree-item.d3 { --acc: var(--accent-3); }
.mtree-item.d4,
.mtree-item.d5 { --acc: var(--ink-2); }

/* ============== PAGINATION ============== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 40px; flex-wrap: wrap;
  direction: rtl;
}
.pg-btn {
  min-width: 38px; height: 38px; padding: 0 10px;
  border-radius: 10px; font-size: 14px; font-family: 'El Messiri', serif;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; cursor: pointer;
}
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-d); background: color-mix(in oklab, var(--accent) 7%, var(--paper)); }
.pg-btn.active { background: var(--accent); border-color: var(--accent-d); color: #fff; font-weight: 700; }
.pg-btn:disabled { opacity: .35; cursor: default; }
.pg-ellipsis { font-size: 16px; color: var(--ink-3); padding: 0 4px; line-height: 38px; }

/* ============== CLOUD ANIMATIONS (hero) ============== */
@keyframes cloudDrift1 {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(28px); }
  100% { transform: translateX(0); }
}
@keyframes cloudDrift2 {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(-20px); }
  100% { transform: translateX(0); }
}
@keyframes cloudDrift3 {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(16px); }
  100% { transform: translateX(0); }
}
.cloud-1 { animation: cloudDrift1 14s ease-in-out infinite; }
.cloud-2 { animation: cloudDrift2 18s ease-in-out infinite; }
.cloud-3 { animation: cloudDrift3 11s ease-in-out infinite; }

/* ============== MEMBER COMBOBOX (contact → update) ============== */
.member-combobox { position: relative; }

.member-combobox-input {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0 10px; background: var(--paper);
  transition: border-color .2s, box-shadow .2s;
}
.member-combobox-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}
.member-combobox-input.is-selected { border-color: var(--accent); }
.member-combobox-input svg { color: var(--ink-3); flex-shrink: 0; }
.member-combobox-input input {
  flex: 1; border: none; background: transparent; padding: 10px 0;
  font-family: inherit; font-size: 14px; color: var(--ink);
  outline: none;
}
.member-combobox-input input::placeholder { color: var(--ink-3); }
.member-combobox-clear {
  padding: 4px; border-radius: 6px; color: var(--ink-3);
  display: flex; align-items: center;
  transition: color .15s, background .15s;
}
.member-combobox-clear:hover { color: var(--ink); background: var(--bg-2); }

.member-combobox-selected {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 6px; padding: 8px 12px; border-radius: 8px;
  background: color-mix(in oklab, var(--accent) 8%, var(--paper));
  border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent);
  font-size: 13px;
}
.member-combobox-selected svg { color: var(--accent); flex-shrink: 0; }
.mcb-name  { font-weight: 600; color: var(--accent-d); }
.mcb-title { color: var(--ink-3); font-size: 12px; }

.member-combobox-drop {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 50;
  background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(28,24,18,.10);
  max-height: 240px; overflow-y: auto;
}
.mcb-opt {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  width: 100%; padding: 10px 14px; gap: 6px; text-align: right;
  transition: background .15s; border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.mcb-opt:last-child { border-bottom: none; }
.mcb-opt:first-child { border-radius: 10px 10px 0 0; }
.mcb-opt:last-child  { border-radius: 0 0 10px 10px; }
.mcb-opt:only-child  { border-radius: 10px; }
.mcb-opt:hover { background: color-mix(in oklab, var(--accent) 7%, var(--paper)); }
.mcb-opt-name  { font-size: 14px; color: var(--ink); font-family: 'El Messiri', serif; }
.mcb-opt-title { font-size: 12px; color: var(--ink-3); }
.mcb-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 13px; }

.field-error .member-combobox-input { border-color: #dc2626; }
.field-err-msg { display: block; margin-top: 5px; font-size: 12px; color: #dc2626; }

.field-new-value {
  background: color-mix(in oklab, var(--accent) 5%, var(--paper));
  border: 1.5px solid color-mix(in oklab, var(--accent) 20%, transparent);
  border-radius: 12px; padding: 12px 14px;
  animation: fadeSlideUp .2s ease both;
}

/* ══ Sheikh Page ══ */
.sheikh-hero .profile-avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  font-size: 44px;
}
@media (min-width: 640px) {
  .sheikh-hero .profile-avatar { width: 150px; height: 150px; font-size: 54px; }
}
.sheikh-avatar-wrap { position: relative; }
.sheikh-avatar-wrap::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 1.5px solid color-mix(in oklab, var(--accent-d) 30%, transparent);
  pointer-events: none;
}

/* ══ Hero Mobile Image Background ══════════════════════════════
   على الجوال: صورة فيفاء بدلاً من المشهد المتحرك
   على الشاشات الكبيرة: المشهد الحالي بدون تعديل
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .hero {
    background-image: url('assets/faifa-mobile.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
  }
  /* أخفِ عناصر المشهد المتحرك */
  .hero-scene-wrap,
  .hero-sky,
  .hero-sky-art { display: none; }

  /* طبقة شفافة خفيفة لضمان قراءة النصوص */
  .hero::after {
    content: '';
    position: absolute; inset: 0; z-index: 2;
    background: linear-gradient(
      180deg,
      rgba(245,232,206,.55) 0%,
      rgba(245,232,206,.25) 45%,
      rgba(245,232,206,.0)  100%
    );
    pointer-events: none;
  }
}
