@import url("https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600&display=swap");

/* ============================================================
   تصميم الزمرد — أخضر الشعار الغامق مع الذهبي
   الألوان كلها هنا تحت :root — غيّرها من هنا ويتغير الموقع كله
   ============================================================ */
:root {
  --bg: #0B2218;        /* أخضر الشعار */
  --deep: #081A12;      /* أغمق للأقسام */
  --panel: #0F2B1F;     /* بطاقات */
  --gold: #C9A646;
  --gold-soft: #E2C878;
  --ivory: #EFE8D6;     /* النص */
  --muted: #A9B5AA;
  --line: rgba(201, 166, 70, .28);
  --line-soft: rgba(239, 232, 214, .12);
  --wa: #25D366;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; }
body {
  background: var(--bg); color: var(--ivory);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 16px; line-height: 1.9; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 700; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
img { display: block; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.serif { font-family: "Amiri", serif; }

/* الحاوية */
.page { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.frame-wrap, .frame { all: unset; display: block; }

/* ===== الشريط العلوي ===== */
.top { display: flex; align-items: center; justify-content: flex-start; padding: 26px 0; }
.nav { display: flex; gap: 10px; }
.nav .pill[hidden] { display: none !important; }
.nav .pill { display: inline-flex; align-items: center; height: 38px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; color: var(--muted); transition: color .2s, border-color .2s, background .2s; }
.nav .pill:hover { color: var(--ivory); border-color: var(--gold); }
.nav .pill.on { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.nav svg { display: none; }

/* ===== الهيرو (الرئيسية) — بطاقة تعبّي الشاشة ===== */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 24px 84px; }
.portrait-wrap { display: flex; flex-direction: column; align-items: center; }
.logo-box { width: min(260px, 56vw); aspect-ratio: 1; margin-bottom: 8px; mix-blend-mode: lighten; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.hero h1 { font-family: "Amiri", serif; font-size: clamp(40px, 8vw, 88px); line-height: 1.15; margin: 4px 0 0; }
.hero h1::after { content: ""; display: block; width: min(220px, 50%); height: 1px; background: var(--gold); margin: 22px auto 0; }
.scroll-cue { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; color: var(--gold); transition: border-color .2s; animation: bob 2.4s ease-in-out infinite; }
.scroll-cue:hover { border-color: var(--gold); }
.scroll-cue svg { width: 18px; height: 18px; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 5px; } }

/* حركة الدخول — مرة وحدة عند فتح الصفحة */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes glow { from { opacity: 0; transform: scale(.94); filter: blur(6px); } }
@keyframes draw { from { transform: scaleX(0); } }
.logo-box { animation: glow 1.2s cubic-bezier(.2,.7,.2,1) both; }
.hero h1 { animation: rise .9s .6s cubic-bezier(.2,.7,.2,1) both; }
.hero h1::after { animation: draw .9s 1.1s cubic-bezier(.6,0,.2,1) both; }

/* ===== الحالات ===== */
html, body { overflow-x: clip; }
.sec { position: relative; padding: 90px 0; }
.sec::before { content: ""; position: absolute; inset: 0 -100vmax; background: var(--deep); border-top: 1px solid var(--line); z-index: -1; }
.sec-title { font-family: "Amiri", serif; font-size: 40px; text-align: center; display: block; margin-bottom: 10px; }
.sec-sub { text-align: center; color: var(--muted); margin-bottom: 30px; }
.filters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 40px; }
.filters .pill { font-size: 14px; padding: 5px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); transition: .2s; }
.filters .pill:hover { color: var(--ivory); border-color: var(--gold); }
.filters .pill.on { background: var(--gold); border-color: var(--gold); color: var(--bg); }

.cases { display: flex; flex-wrap: wrap; justify-content: center; gap: 30px; }
.case { flex: 0 1 calc((100% - 60px) / 3); min-width: 0; }
.case.hide { display: none; }
.tape { display: none; }
.case .ba { aspect-ratio: 4/5; border: 1px solid var(--line); }

/* سلايدر قبل / بعد */
.ba { --pos: 50%; position: relative; overflow: hidden; user-select: none; background: var(--panel); }
.ba-layer { position: absolute; inset: 0; }
.ba-layer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba-before { clip-path: inset(0 0 0 var(--pos)); }
.ph { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; text-align: center; color: var(--muted); font-size: 13px; }
.ph svg { width: 30px; height: 30px; margin: 0 auto; opacity: .5; }
.ph b { font-weight: 500; }
.ba-after .ph { background: linear-gradient(160deg, #173a2a, #0f2b1e); padding-right: 50%; }
.ba-before .ph { background: linear-gradient(160deg, #2a2f2b, #1d211e); padding-left: 50%; }
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 1px; background: var(--gold); pointer-events: none; }
.ba-knob { position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: var(--bg); border: 1px solid var(--gold); color: var(--gold); display: grid; place-items: center; }
.ba-knob svg { width: 16px; height: 16px; }
.ba-tag { position: absolute; top: 12px; font-size: 12px; padding: 0 10px; border-radius: 999px; background: rgba(8,26,18,.75); color: var(--ivory); pointer-events: none; }
.ba-tag.b { right: 12px; }
.ba-tag.a { left: 12px; color: var(--gold); }
.ba input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; direction: ltr; }

.case-body { padding-top: 16px; }
/* لون التصنيف يجي من لوحة التحكم — يظهر كنقطة صغيرة جنب الاسم */
.case-cat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); -webkit-background-clip: text !important; background-clip: text !important; }
.case-cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: inherit; -webkit-background-clip: border-box !important; background-clip: border-box !important; }
.case-body h3 { font-family: "Amiri", serif; font-size: 22px; margin-top: 2px; }
.case-body p { color: var(--muted); font-size: 14px; }
.case-meta { display: flex; gap: 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.case-meta i { font-style: normal; }
.case-meta b { color: var(--gold); font-weight: 500; }

/* ظهور العناصر وقت النزول */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ===== الرئيسية: صفحات كاملة تنتقل نقلة وحدة ===== */
body.snap { height: 100svh; overflow: hidden; overscroll-behavior: none; }
body.snap .top { position: fixed; top: 0; left: 0; right: 0; z-index: 40; max-width: 1100px; margin: 0 auto; padding: 26px 24px; }
/* صفحتين فوق بعض: وحدة بس ظاهرة، والتنقل نقلة كاملة بدون سكرول */
.screen { display: none; height: 100svh; padding: 90px 0 24px; }
.screen.on { display: flex; animation: swap .25s ease both; }
@keyframes swap { from { opacity: 0; } }
.screen-card { position: relative; flex: 1; min-height: 0; margin: 0; }
.contact-card { display: flex; flex-direction: column; align-items: center; justify-content: safe center; padding: 40px 24px 90px; overflow-y: auto; }
.contact-card .sec-title { margin-bottom: 0; }
.contact-card .links { width: 100%; margin-top: 26px; }
.contact-card .copy { margin-top: 26px; }
.scroll-cue.up { animation-name: bobup; }
@keyframes bobup { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* ===== صفحة الحالات ===== */
.cases-page { padding: 0 0 80px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ===== تواصل معي (الرئيسية) ===== */
.contact-sec { scroll-margin-top: 0; }
.links { max-width: 560px; margin: 30px auto 0; display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.link-row { display: flex; align-items: center; gap: 14px; padding: 16px 6px; border-bottom: 1px solid var(--line-soft); transition: background .2s, color .2s; }
.link-row:hover { background: rgba(201,166,70,.06); }
.lr-icon { width: 40px; height: 40px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--gold); }
.lr-icon svg { width: 18px; height: 18px; }
.lr-label { flex: 1; font-size: 15px; white-space: nowrap; }
.lr-val { font-size: 13px; color: var(--muted); direction: ltr; }
.link-row:hover .lr-val { color: var(--gold); }

/* ===== الفوتر ===== */
footer { position: relative; padding: 46px 0 60px; text-align: center; }
footer::before { content: ""; position: absolute; top: 0; inset-inline: -100vmax; border-top: 1px solid var(--line); }
.socials { display: flex; justify-content: center; gap: 22px; margin-bottom: 14px; }
.socials a { color: var(--ivory); opacity: .7; transition: opacity .2s, color .2s; display: inline-flex; }
.socials a:hover { opacity: 1; color: var(--gold); }
.copy { color: var(--muted); font-size: 13px; }
.sign { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 10px; direction: ltr; letter-spacing: .2em; font-size: 12px; }
.sign-mark { display: block; width: 56px; aspect-ratio: 240 / 157; background: var(--gold); -webkit-mask: url(sign.png) center / contain no-repeat; mask: url(sign.png) center / contain no-repeat; }

/* ===== السيرة الذاتية ===== */
.page-head { text-align: center; margin: 40px 0 56px; }
.page-head h1 { font-family: "Amiri", serif; font-size: clamp(40px, 6vw, 64px); animation: rise .9s .1s cubic-bezier(.2,.7,.2,1) both; }
.page-head h4 { font-weight: 400; color: var(--gold); font-size: 16px; margin-top: 6px; animation: rise .8s .35s ease both; }
.page-head::after { content: ""; display: block; width: 64px; height: 1px; background: var(--gold); margin: 26px auto 0; animation: draw .9s .55s cubic-bezier(.6,0,.2,1) both; }

.block-title h2 { font-family: "Amiri", serif; font-size: 26px; display: inline-block; margin-bottom: 18px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.cv-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 48px; }
.cv-divider { width: 1px; background: var(--line); }
.cv-grid hr { border: 0; border-top: 1px solid var(--line-soft); margin: 30px 0; }

.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before { content: ""; position: absolute; top: 6px; bottom: 0; inset-inline-start: 0; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding-inline-start: 22px; padding-bottom: 28px; }
.timeline-item::before { content: ""; position: absolute; top: 9px; inset-inline-start: -22px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 1px solid var(--gold); }
.ti-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ti-head h4 { font-family: "Amiri", serif; font-size: 21px; font-weight: 700; }
.ti-date { font-size: 13px; color: var(--muted); }
.now { display: inline-block; margin-inline-start: 8px; font-size: 11px; color: var(--bg); background: var(--gold); padding: 0 9px; border-radius: 999px; }
.ti-org { display: block; color: var(--gold); font-size: 13px; margin-top: 2px; }
.ti-org a { border-bottom: 1px solid currentColor; transition: color .2s; }
.ti-org a:hover { color: var(--ivory); }
.timeline-item ul { margin-top: 8px; padding-inline-start: 18px; font-size: 14px; color: var(--muted); line-height: 1.9; }
.timeline-item li::marker { color: var(--gold); }
.hourglass { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); }
.hourglass svg { width: 14px; height: 14px; animation: flip 3s ease-in-out infinite; }
@keyframes flip { 0%, 70% { transform: rotate(0); } 85%, 100% { transform: rotate(180deg); } }

.rows { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.row h4 { font-size: 15px; font-weight: 500; }
.row .sub { display: block; font-size: 13px; color: var(--muted); }
.row .date { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.award { display: inline-block; vertical-align: middle; margin-inline-start: 6px; font-size: 11px; color: var(--bg); background: var(--gold); padding: 0 9px; border-radius: 999px; line-height: 1.8; }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 46px; }
.chip { border: 1px solid var(--line); padding: 12px 14px; text-align: center; font-size: 13.5px; color: var(--ivory); transition: border-color .2s, color .2s; }
.chip:hover { border-color: var(--gold); color: var(--gold); }

.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border: 1px solid var(--gold); padding: 26px 30px; margin-bottom: 20px; position: relative; }
.edu::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line); pointer-events: none; }
.edu-single { grid-template-columns: 1fr; text-align: center; }
.edu h4 { font-family: "Amiri", serif; font-size: 22px; }
.edu b { color: var(--gold); font-weight: 500; font-size: 14px; }
.edu span { color: var(--muted); font-size: 14px; }

/* ===== التواصل ===== */
.contact { max-width: 560px; margin: 30px auto 60px; }
.contact h1 { font-family: "Amiri", serif; font-size: clamp(40px, 6vw, 60px); text-align: center; margin-bottom: 30px; animation: rise .9s .1s cubic-bezier(.2,.7,.2,1) both; }
.contact-grid { display: grid; gap: 0; animation: rise .9s .35s ease both; }
.wa-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px; border-radius: 999px; background: var(--wa); color: #06331b; font-weight: 600; transition: transform .15s; }
.wa-btn:hover { transform: translateY(-2px); }
.wa-btn svg { width: 26px; height: 26px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 24px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.card { border: 1px solid var(--line); padding: 28px; }
.card form { display: flex; flex-direction: column; gap: 18px; }
.card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--ivory); font: inherit; padding: 10px 2px; outline: none; transition: border-color .2s; }
.field::placeholder { color: rgba(169,181,170,.5); }
.field:focus { border-color: var(--gold); }
textarea.field { resize: none; }
.solid { display: block; }
.solid > * { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border: 1px solid var(--gold); color: var(--gold); border-radius: 999px; font-weight: 500; transition: background .2s, color .2s; }
.solid > *:hover { background: var(--gold); color: var(--bg); }
.solid svg { width: 18px; height: 18px; }

/* ===== الجوال ===== */
@media (max-width: 860px) {
  .case { flex-basis: 100%; max-width: 420px; }
  .cv-grid { grid-template-columns: 1fr; gap: 30px; }
  .cv-divider { display: none; }
  .chips { grid-template-columns: 1fr 1fr; }
  .edu { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .top { padding: 20px 0; }
  .hero { padding: 36px 18px 80px; }
  body.snap { padding-bottom: 0; }
  body.snap .top { position: static; padding: 0; }
  .screen { padding: 16px 0 100px; }
  .contact-card { padding: 26px 14px 76px; }
  .contact-card .sec-title { font-size: 32px; }
  .contact-card .links { margin-top: 16px; }
  .contact-card .copy { margin-top: 16px; }
  .link-row { gap: 10px; padding: 11px 4px; }
  .lr-icon { width: 34px; height: 34px; }
  .lr-label { font-size: 14px; }
  .lr-val { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
  .sec { padding: 70px 0; }
  .card { padding: 22px 18px; }

  /* شريط التنقل السفلي */
  .nav {
    position: fixed; z-index: 50; left: 50%; bottom: 14px; transform: translateX(-50%);
    width: calc(100% - 32px); max-width: 420px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 6px;
    background: rgba(8, 26, 18, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line); border-radius: 999px;
  }
  .nav .pill { display: flex; flex-direction: column; align-items: center; gap: 2px; height: auto; padding: 6px 4px; border: 0; border-radius: 999px; font-size: 11px; line-height: 1.3; }
  .nav .pill.on { background: var(--gold); color: var(--bg); }
  .nav svg { display: block; width: 19px; height: 19px; }
  body { padding-bottom: 96px; }
}

/* ===== الطباعة (A4) — صفحة وحدة، أبيض عشان الحبر ===== */
@media print {
  @page { size: A4; margin: 10mm 12mm; }
  :root { --bg: #fff; --deep: #fff; --panel: #fff; --ivory: #0B2218; --muted: #55665C; --gold: #8A6A1C; --line: rgba(138,106,28,.4); --line-soft: rgba(11,34,24,.12); }
  * { animation: none !important; transition: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; padding: 0 !important; font-size: 11px; line-height: 1.5; }
  .page { padding: 0 6px; max-width: none; }
  .top, .nav, footer, .scroll-cue { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .page-head { margin: 0 0 14px; }
  .page-head h1 { font-size: 28px; }
  .page-head h4 { font-size: 12px; margin-top: 2px; }
  .page-head::after { margin-top: 8px; }
  .cv-grid { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 24px; }
  .cv-divider { display: block; }
  .cv-grid hr { margin: 12px 0; }
  .block-title h2 { font-size: 18px; margin-bottom: 8px; }
  .timeline-item { padding-bottom: 12px; }
  .ti-head h4 { font-size: 16px; line-height: 1.25; }
  .timeline-item ul { font-size: 11px; line-height: 1.55em; margin-top: 4px; }
  .rows { gap: 8px; }
  .row h4 { font-size: 12.5px; }
  .chips { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
  .chip { padding: 6px 8px; font-size: 11px; }
  .edu { grid-template-columns: 1fr 1fr; padding: 12px 20px; margin-bottom: 0; }
  .edu.edu-single { grid-template-columns: 1fr; }
  .edu h4 { font-size: 17px; }
  .chip, .edu, .row, .timeline-item { break-inside: avoid; }
  .block-title { break-after: avoid; }
  .block-title[style] { margin-top: 16px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
