/* =====================================================================
   Public site styles. No framework: tokens, layout, components.
   Dark is the default theme; [data-theme="light"] swaps the tokens.
   Logical properties (inline/block) keep the layout ready for RTL.
   ===================================================================== */

:root {
  --bg: #071022;
  --bg-elev: #0B1730;
  --surface: #0E1B36;
  --surface-2: #12223F;
  --line: rgba(140, 170, 230, .14);
  --line-strong: rgba(140, 170, 230, .28);
  --text: #E7EDF9;
  --text-2: #A9B6D1;
  --muted: #7F8DAB;
  --blue: #4C86FF;
  --blue-strong: #2F6BF0;
  --blue-soft: rgba(76, 134, 255, .14);
  --cyan: #46C2F0;
  --chip-bg: rgba(255, 255, 255, .94);
  --success: #3DD68C;
  --danger: #FF7B7B;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 18px 40px -24px rgba(0, 0, 0, .8);
  --shadow-hover: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 26px 50px -24px rgba(0, 0, 0, .9);
  --grid-line: rgba(120, 160, 255, .09);
  --header-bg: rgba(7, 16, 34, .72);

  --radius: 16px;
  --radius-sm: 10px;
  --container: 1180px;
  --gutter: clamp(18px, 4vw, 32px);
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F3F6FC;
  --bg-elev: #EAF0FA;
  --surface: #FFFFFF;
  --surface-2: #F6F8FD;
  --line: rgba(12, 26, 53, .10);
  --line-strong: rgba(12, 26, 53, .20);
  --text: #0C1A35;
  --text-2: #3A4A6A;
  --muted: #5D6B88;
  --blue: #1F5EEA;
  --blue-strong: #174DC4;
  --blue-soft: rgba(31, 94, 234, .10);
  --cyan: #0E8FC0;
  --chip-bg: #FFFFFF;
  --success: #12935A;
  --danger: #C62828;
  --shadow: 0 1px 2px rgba(12, 26, 53, .05), 0 14px 30px -22px rgba(12, 26, 53, .35);
  --shadow-hover: 0 2px 4px rgba(12, 26, 53, .06), 0 24px 44px -24px rgba(12, 26, 53, .45);
  --grid-line: rgba(31, 94, 234, .08);
  --header-bg: rgba(243, 246, 252, .82);
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
main:focus { outline: none; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden, .hp-field {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; inset-inline-start: 16px; top: -60px; z-index: 100;
  background: var(--blue-strong); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 46px; padding: .7em 1.25em; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: .975rem; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .bi { font-size: 1.05em; }
.btn-primary { background: var(--blue-strong); color: #fff; box-shadow: 0 10px 24px -14px var(--blue-strong); }
.btn-primary:hover { background: var(--blue); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--blue); color: var(--text); background: var(--blue-soft); }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { cursor: progress; opacity: .8; transform: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface); }
.icon-btn .bi { font-size: 1.15rem; }

.spinner { display: none; width: 1em; height: 1em; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background-color .3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1.5px solid var(--blue); border-radius: 10px; font-size: .85rem; letter-spacing: .02em;
  color: var(--text); background: var(--blue-soft);
}
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nav { margin-inline-start: auto; }
.site-nav ul { list-style: none; display: flex; gap: 4px; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: .95rem;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.site-nav a:hover, .site-nav a.is-current { color: var(--text); background: var(--surface); text-decoration: none; }
.header-actions { display: flex; gap: 8px; margin-inline-start: 8px; }
.site-nav:empty + .header-actions, .header-actions:only-child { margin-inline-start: auto; }
.nav-toggle { display: none; }
[data-theme="dark"] [data-icon-dark], [data-theme="light"] [data-icon-light] { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-grid; }
  .header-actions { margin-inline-start: auto; }
  .site-nav {
    position: absolute; inset-inline: 0; top: 100%;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px; display: none;
  }
  .site-nav.is-open { display: block; animation: drop .2s var(--ease); }
  .site-nav ul { flex-direction: column; }
  .site-nav a { padding: 12px; }
  .no-js-nav .site-nav, html:not(.js) .site-nav { position: static; display: block; background: none; border: 0; padding: 0; }
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; overflow: hidden; padding-block: clamp(48px, 8vw, 96px) clamp(64px, 9vw, 112px); }
.hero-backdrop {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
}
.hero-backdrop::after {
  content: ""; position: absolute; width: 620px; height: 620px; inset-inline-end: -120px; top: -160px;
  background: radial-gradient(circle, rgba(76, 134, 255, .22), transparent 62%);
}
[data-theme="light"] .hero-backdrop::after { background: radial-gradient(circle, rgba(31, 94, 234, .12), transparent 62%); }
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero-id { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 20px; }
.hero-name { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.hero-role { color: var(--blue); font-weight: 600; font-size: 1rem; padding-inline-start: 14px; border-inline-start: 1px solid var(--line-strong); }
.hero-heading { font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.1; letter-spacing: -.025em; max-width: 18ch; text-wrap: balance; }
.hero-desc { margin-top: 20px; color: var(--text-2); font-size: clamp(1.02rem, 1.6vw, 1.15rem); max-width: 56ch; }
.hero-highlights { list-style: none; margin-top: 26px; display: grid; gap: 10px; }
.hero-highlights li { display: flex; gap: 10px; align-items: flex-start; color: var(--text); }
.hero-highlights .bi { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 2px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: .95rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* portrait in a drafting frame */
.portrait { margin: 0; justify-self: end; width: 100%; max-width: 440px; }
.portrait-frame { position: relative; padding: 14px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg-elev); }
.portrait-frame img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 30%; border-radius: 2px; }
.tick { position: absolute; width: 22px; height: 22px; border-color: var(--blue); border-style: solid; border-width: 0; }
.tick-a { top: -7px; inset-inline-start: -7px; border-top-width: 2px; border-inline-start-width: 2px; }
.tick-b { top: -7px; inset-inline-end: -7px; border-top-width: 2px; border-inline-end-width: 2px; }
.tick-c { bottom: -7px; inset-inline-start: -7px; border-bottom-width: 2px; border-inline-start-width: 2px; }
.tick-d { bottom: -7px; inset-inline-end: -7px; border-bottom-width: 2px; border-inline-end-width: 2px; }
.title-block { border: 1px solid var(--line-strong); border-top: 0; background: var(--bg-elev); }
.title-block dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; }
.title-block dl > div { padding: 10px 14px; border-top: 1px solid var(--line); min-width: 0; }
.title-block dl > div:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.title-block dl > div:last-child:nth-child(odd) { grid-column: 1 / -1; border-inline-end: 0; }
.title-block dt { font-size: .75rem; color: var(--muted); }
.title-block dd { margin: 0; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-inline-end: 8px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(61, 214, 140, .18); }

/* one load animation: the frame draws in */
@media (prefers-reduced-motion: no-preference) {
  .js .portrait-frame { animation: frame-in .9s var(--ease) both; }
  .js .tick { animation: tick-in .6s var(--ease) .45s both; }
  .js .title-block { animation: rise .7s var(--ease) .35s both; }
  .js .hero-copy > * { animation: rise .7s var(--ease) both; }
  .js .hero-copy > :nth-child(2) { animation-delay: .06s; }
  .js .hero-copy > :nth-child(3) { animation-delay: .12s; }
  .js .hero-copy > :nth-child(4) { animation-delay: .18s; }
  .js .hero-copy > :nth-child(5) { animation-delay: .24s; }
}
@keyframes frame-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes tick-in { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .portrait { justify-self: start; max-width: 400px; order: -1; }
  .hero-heading { max-width: none; }
}

/* ---------------------------------------------------------------- sections */
.section { padding-block: clamp(64px, 9vw, 112px); border-top: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); letter-spacing: -.02em; }
.section-head p { margin-top: 12px; color: var(--text-2); font-size: 1.05rem; }

.reveal { transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal:not(.is-visible) { opacity: 0; transform: translateY(18px); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease), background-color .3s var(--ease);
}
.card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.prose { color: var(--text-2); font-size: 1.05rem; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 1em; }
.prose ul { padding-inline-start: 1.25em; display: grid; gap: .35em; }
.prose strong { color: var(--text); }
.prose-sm { font-size: .95rem; }

/* about */
.about-grid { display: grid; gap: clamp(28px, 5vw, 64px); }
.about-grid.has-image { grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); align-items: start; }
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 25%; border-radius: var(--radius); border: 1px solid var(--line); }
.about-copy .section-head { margin-bottom: 20px; }
.about-copy .prose { max-width: 68ch; }
.facts { margin: 32px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts > div { background: var(--surface); padding: 18px 20px; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-weight: 600; }
@media (max-width: 760px) { .about-grid.has-image { grid-template-columns: 1fr; } .about-photo { max-width: 320px; } }

/* technologies */
.tech-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tech {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.tech:hover { border-color: var(--blue); transform: translateY(-2px); }
.tech-icon, .chip-icon, .card-icon, .why-icon {
  flex: none; display: inline-grid; place-items: center; overflow: hidden;
}
.tech-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--chip-bg); font-size: 1.45rem; color: #1b2a4a; box-shadow: inset 0 0 0 1px rgba(12, 26, 53, .06); }
.tech-icon img { width: 26px; height: 26px; object-fit: contain; }
.tech-name { font-weight: 600; font-size: .95rem; line-height: 1.3; overflow-wrap: anywhere; }

/* services */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.service { padding: 26px; }
.card-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); font-size: 1.4rem; margin-bottom: 18px; }
.card-icon img { width: 28px; height: 28px; object-fit: contain; }
.service h3 { font-size: 1.15rem; margin-bottom: 8px; }
.service p { color: var(--text-2); font-size: .97rem; }

/* portfolio */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 40px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--text-2); font-weight: 500; font-size: .95rem;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.filter:hover { color: var(--text); border-color: var(--blue); text-decoration: none; }
.filter.is-active { background: var(--blue-strong); border-color: var(--blue-strong); color: #fff; }
.filter-count { font-size: .78rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.filter.is-active .filter-count { background: rgba(255, 255, 255, .2); color: #fff; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; transition: opacity .25s var(--ease); }
.project-grid.is-loading { opacity: .35; pointer-events: none; }
.project-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.project-card:hover, .project-card:focus-within { border-color: var(--line-strong); transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.project-cover { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.project-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.project-card:hover .project-cover img { transform: scale(1.04); }
.project-cover-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 2.4rem; }
.project-body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 22px; flex: 1; }
.project-cat { font-size: .85rem; color: var(--blue); font-weight: 600; }
.project-title { font-size: 1.15rem; }
.card-link { color: var(--text); }
.card-link:hover { text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid var(--cyan); outline-offset: -2px; }
.project-desc {
  color: var(--text-2); font-size: .95rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.project-more { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--text); }
.project-more .bi { transition: transform .25s var(--ease); color: var(--blue); }
.project-card:hover .project-more .bi { transform: translate(2px, -2px); }
[dir="rtl"] .project-more .bi { transform: scaleX(-1); }
.card-enter { animation: rise .5s var(--ease) both; }
.work-more { display: flex; justify-content: center; margin-top: 32px; }
.work-more[hidden] { display: none; }

/* why */
.why-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 40px; }
.why-item { display: flex; gap: 18px; padding-block: 22px; border-top: 1px solid var(--line); }
.why-icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); color: var(--blue); font-size: 1.25rem; }
.why-icon img { width: 26px; height: 26px; object-fit: contain; }
.why-item h3 { font-size: 1.08rem; margin-bottom: 6px; }
.why-item p { color: var(--text-2); font-size: .97rem; }

/* contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.contact-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.optional { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--text); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .86rem; margin-top: 6px; }
.field-error:empty { display: none; }
.form-status { font-size: .95rem; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; }
.form-status:empty { display: none; }
.form-status.is-success { color: var(--success); border-color: currentColor; background: rgba(61, 214, 140, .08); }
.form-status.is-error { color: var(--danger); border-color: currentColor; background: rgba(255, 123, 123, .08); }
.contact-direct { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.contact-direct p { color: var(--text-2); margin-bottom: 12px; }
.contact-direct-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); padding-top: 48px; background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 32px; padding-bottom: 36px; }
.footer-name { font-weight: 700; font-size: 1.1rem; }
.footer-role { color: var(--blue); font-weight: 600; }
.footer-text { color: var(--text-2); margin-top: 10px; max-width: 42ch; font-size: .95rem; }
.footer-nav ul, .footer-direct, .social-list { list-style: none; }
.footer-nav ul { display: grid; gap: 6px; }
.footer-nav a, .footer-direct a { color: var(--text-2); }
.footer-nav a:hover, .footer-direct a:hover { color: var(--text); }
.footer-direct { display: grid; gap: 8px; }
.footer-direct a { display: inline-flex; gap: 10px; align-items: center; overflow-wrap: anywhere; }
.social-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.social-list a { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); color: var(--text-2); transition: color .2s, border-color .2s; }
.social-list a:hover { color: var(--text); border-color: var(--blue); text-decoration: none; }
.footer-bottom { border-top: 1px solid var(--line); padding-block: 18px; color: var(--muted); font-size: .9rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- project page */
.project-hero { position: relative; overflow: hidden; padding-block: clamp(32px, 5vw, 56px) clamp(28px, 4vw, 44px); }
.project-hero .container { position: relative; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; color: var(--muted); margin-bottom: 22px; }
.crumbs li + li::before { content: "/"; margin-inline-end: 6px; color: var(--line-strong); }
.crumbs a { color: var(--text-2); }
.project-heading { font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: -.025em; max-width: 22ch; text-wrap: balance; }
.project-lead { margin-top: 16px; color: var(--text-2); font-size: clamp(1.02rem, 1.6vw, 1.18rem); max-width: 62ch; }
.project-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; align-items: flex-start; }

.demo-menu { position: relative; }
.demo-menu summary { list-style: none; }
.demo-menu summary::-webkit-details-marker { display: none; }
.demo-caret { transition: transform .2s var(--ease); font-size: .85em !important; }
.demo-menu[open] .demo-caret { transform: rotate(180deg); }
.demo-panel {
  position: absolute; z-index: 20; top: calc(100% + 8px); inset-inline-start: 0; min-width: 260px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 8px;
  box-shadow: var(--shadow-hover); animation: drop .18s var(--ease);
}
.demo-panel-title { font-size: .82rem; color: var(--muted); padding: 6px 10px 8px; }
.demo-panel ul { list-style: none; display: grid; gap: 2px; }
.demo-panel a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.demo-panel a:hover, .demo-panel a:focus-visible { background: var(--blue-soft); text-decoration: none; }
.demo-panel a .bi { color: var(--muted); }

.project-cover-full { margin: 0 0 clamp(32px, 5vw, 56px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.project-cover-full img { width: 100%; max-height: 640px; object-fit: cover; }
.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(28px, 5vw, 56px); align-items: start; }
.project-layout.no-aside { grid-template-columns: minmax(0, 1fr); }
.project-main { display: grid; gap: clamp(36px, 5vw, 52px); min-width: 0; }
.project-block h2 { font-size: 1.4rem; margin-bottom: 16px; }
.feature-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.feature-list li { display: flex; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.feature-list .bi { color: var(--blue); font-size: 1.2rem; flex: none; margin-top: 1px; }
.feature-list h3 { font-size: 1rem; }
.feature-list p { color: var(--text-2); font-size: .93rem; margin-top: 4px; }

.gallery { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.gallery-mobile { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gallery-item { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); cursor: zoom-in; }
.gallery-item img { width: 100%; height: auto; transition: transform .5s var(--ease), opacity .3s; }
.gallery-item:hover img { transform: scale(1.03); }

.project-aside { position: sticky; top: 90px; display: grid; gap: 14px; }
.aside-block { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.aside-block h2 { font-size: .95rem; color: var(--muted); font-weight: 600; margin-bottom: 12px; letter-spacing: 0; }
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: .9rem; font-weight: 500; }
.chip:not(:has(.chip-icon)) { padding-inline-start: 12px; }
[dir="rtl"] .chip { padding: 6px 6px 6px 12px; }
.chip-icon { width: 26px; height: 26px; border-radius: 50%; background: var(--chip-bg); color: #1b2a4a; font-size: 1rem; }
.chip-icon img { width: 16px; height: 16px; object-fit: contain; }
.plain-list { list-style: none; display: grid; gap: 8px; }
.plain-list li { padding-inline-start: 18px; position: relative; color: var(--text-2); font-size: .95rem; }
.plain-list li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .7em; width: 6px; height: 6px; border-radius: 2px; background: var(--blue); }

.project-cta { margin-block: clamp(48px, 7vw, 88px); }
.cta-panel { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px; padding: clamp(24px, 4vw, 40px); border-radius: var(--radius); border: 1px solid var(--line-strong); background: linear-gradient(135deg, var(--blue-soft), transparent 60%), var(--surface); }
.cta-panel h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.cta-panel p { color: var(--text-2); margin-top: 6px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 900px) {
  .project-layout { grid-template-columns: 1fr; }
  .project-aside { position: static; }
}

/* lightbox */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(3, 8, 18, .94); color: #fff; }
.lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.lightbox::backdrop { background: rgba(3, 8, 18, .7); }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 10px; padding: 56px 0 24px; max-height: 100vh; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 8px; }
.lightbox figcaption { color: #c9d4ea; font-size: .9rem; text-align: center; }
.lightbox .icon-btn { color: #fff; border-color: rgba(255, 255, 255, .25); justify-self: center; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .1); }
.lightbox-close { position: absolute; top: 14px; inset-inline-end: 14px; }
[dir="rtl"] .lightbox-prev .bi, [dir="rtl"] .lightbox-next .bi { transform: scaleX(-1); }
@media (max-width: 600px) { .lightbox[open] { grid-template-columns: 44px 1fr 44px; } }

/* error page */
.error-page { position: relative; overflow: hidden; padding-block: clamp(72px, 12vw, 140px); }
.error-inner { position: relative; max-width: 640px; }
.error-code { font-size: clamp(4rem, 12vw, 7rem); font-weight: 700; line-height: 1; color: transparent; -webkit-text-stroke: 1.5px var(--blue); margin-bottom: 18px; }
.error-page h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.error-message { color: var(--text-2); margin-top: 12px; font-size: 1.08rem; }
.error-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------------------------------------------------------------- language switch & Arabic */
.lang-switch {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .92rem;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.lang-switch:hover { border-color: var(--line-strong); background: var(--surface); text-decoration: none; }
.lang-switch .bi { color: var(--blue); }
@media (max-width: 420px) { .lang-switch span { display: none; } .lang-switch { width: 42px; padding: 0; justify-content: center; } }

/* Arabic script: no negative tracking (it breaks letter joining) and a little more line height. */
[lang="ar"] body { line-height: 1.8; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3,
[lang="ar"] .hero-heading, [lang="ar"] .project-heading, [lang="ar"] .section-head h2 { letter-spacing: 0; line-height: 1.35; }
[lang="ar"] .hero-heading { max-width: 22ch; }
[lang="ar"] .brand-mark { letter-spacing: 0; }
[dir="rtl"] input[dir="ltr"] { text-align: right; }
[dir="rtl"] .hero-backdrop {
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 30% 40%, #000 20%, transparent 75%);
}
[dir="rtl"] .project-card:hover .project-more .bi { transform: scaleX(-1) translate(2px, -2px); }

/* ---------------------------------------------------------------- motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal:not(.is-visible) { opacity: 1; transform: none; }
}
