/* ==========================================================================
   abdullah1.com — portfolio styles
   ========================================================================== */

/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Noto Sans Arabic";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/noto-sans-arabic-arabic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* ---------- Design tokens ---------- */
:root {
  --bg: #f6f5f1;
  --bg-alt: #eeece5;
  --surface: #ffffff;
  --ink: #14161a;
  --ink-2: #3a3f48;
  --muted: #5d6370;
  --line: #dcd9cf;
  --line-strong: #c6c2b5;
  --accent: #a58b4c;
  --accent-ink: #6e5a27;
  --accent-soft: rgba(165, 139, 76, 0.12);
  --tier: #a3a8b2;
  --success: #1c7a43;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 12px 32px -12px rgba(20, 22, 26, 0.12);
  --inverse-bg: #14161a;
  --inverse-ink: #f6f5f1;
  --inverse-line: rgba(246, 245, 241, 0.2);
  --inverse-accent: #d3bf88;

  --font: "Manrope", "Noto Sans Arabic", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 18px;
  --radius-sm: 10px;
  --header-h: 68px;
  --gutter: clamp(16px, 4vw, 32px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f12;
    --bg-alt: #121519;
    --surface: #171a1f;
    --ink: #ecebe6;
    --ink-2: #c9cbd0;
    --muted: #979da8;
    --line: #262a31;
    --line-strong: #353a43;
    --accent: #c8b27a;
    --accent-ink: #d8c590;
    --accent-soft: rgba(200, 178, 122, 0.12);
    --tier: #b9bec8;
    --success: #4ade80;
    --danger: #f97066;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
    --inverse-bg: #1c2026;
    --inverse-ink: #ecebe6;
    --inverse-line: rgba(236, 235, 230, 0.16);
    --inverse-accent: #d8c590;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f12;
  --bg-alt: #121519;
  --surface: #171a1f;
  --ink: #ecebe6;
  --ink-2: #c9cbd0;
  --muted: #979da8;
  --line: #262a31;
  --line-strong: #353a43;
  --accent: #c8b27a;
  --accent-ink: #d8c590;
  --accent-soft: rgba(200, 178, 122, 0.12);
  --tier: #b9bec8;
  --success: #4ade80;
  --danger: #f97066;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  --inverse-bg: #1c2026;
  --inverse-ink: #ecebe6;
  --inverse-line: rgba(236, 235, 230, 0.16);
  --inverse-accent: #d8c590;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 750; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
p, li { text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::selection { background: var(--accent); color: #111; }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: 760px; }

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; color: var(--bg); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-inline-end: auto;
}
.brand:hover { color: var(--ink); }
.brand__mark { width: 34px; height: 28px; flex: none; }
.brand__brace { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.brand__tier { fill: var(--tier); }
.brand__tier--accent { fill: var(--accent); }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.site-nav a:not(.btn) {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 550;
  transition: color 0.2s, background-color 0.2s;
}
.site-nav a:not(.btn):hover,
.site-nav a.is-active { color: var(--ink); background: var(--accent-soft); }
.site-nav__cta { margin-inline-start: 8px; }
.site-nav__lang { display: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}
.lang-switch:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }

.site-header__tools { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}
.nav-toggle { display: none; }

/* ---------- Buttons & links ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { color: var(--bg); background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn--ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn--sm { min-height: 40px; padding: 0 18px; font-size: 0.92rem; }
.btn__meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.btn.is-disabled { opacity: 0.55; cursor: not-allowed; }
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading .btn__label { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-link {
  font-weight: 650;
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.text-link:hover { text-decoration-color: currentColor; }

/* ---------- Shared typography ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.section { padding-block: clamp(72px, 10vw, 128px); }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 64px); }
.section__head > * + * { margin-top: 14px; }
.section__title { font-size: clamp(1.9rem, 3.6vw, 2.9rem); letter-spacing: -0.03em; }
.section__lead { color: var(--muted); font-size: 1.1rem; }

.prose > * + * { margin-top: 1em; }
.prose p { color: var(--ink-2); }
.prose__title { margin-top: 1.6em !important; font-size: 1.05rem; letter-spacing: -0.01em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 550;
  line-height: 1.3;
}
.chip--tech {
  font-family: var(--mono);
  font-size: 0.78rem;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- Hero ---------- */
.hero { padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(48px, 6vw, 72px); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.75fr);
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}
.hero__copy > * + * { margin-top: 22px; }
.hero__heading { font: inherit; letter-spacing: normal; }
.hero__heading > span { display: block; }
.hero__heading .eyebrow + .hero__title { margin-top: 22px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-2);
}
.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 20%, transparent);
}

.hero__title {
  font-size: clamp(2.2rem, 4.5vw, 3.85rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 780;
  max-width: 19ch;
}
.hero__lead { max-width: 62ch; font-size: clamp(1.05rem, 1.4vw, 1.18rem); color: var(--ink-2); }
.hero__stack {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  max-width: 62ch;
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--ink);
}
.hero__stack-label {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 6px; }
.hero__links { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; font-size: 0.95rem; }
.hero__links a { color: var(--muted); text-decoration: none; font-weight: 550; }
.hero__links a:hover { color: var(--ink); }

.profile-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.profile-card__photo {
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 477 / 520;
  background: var(--bg-alt);
}
.profile-card__photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.profile-card__facts { margin: 0; padding: 18px 8px 6px; display: grid; gap: 12px; }
.profile-card__facts div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; font-size: 0.9rem; }
.profile-card__facts dt { color: var(--muted); font-weight: 500; }
.profile-card__facts dd { margin: 0; font-weight: 600; }

.facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(48px, 7vw, 80px);
  border-top: 1px solid var(--line);
}
.facts__item {
  display: grid;
  gap: 6px;
  padding-block: 26px 4px;
  padding-inline: 0 24px;
  align-content: start;
}
.facts__item + .facts__item { padding-inline-start: 24px; border-inline-start: 1px solid var(--line); }
.facts__value { font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 780; letter-spacing: -0.03em; line-height: 1.1; }
.facts__label { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }

/* ---------- Projects ---------- */
.projects { display: grid; gap: clamp(72px, 9vw, 120px); }

.project {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
.project:nth-child(even) .project__media { order: 2; }

.project__media {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 10;
}
.project__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.8s var(--ease);
}
.project:hover .project__media img { transform: scale(1.015); }

.project__body > * + * { margin-top: 20px; }
.project__category { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.project__category + .project__title { margin-top: 10px; }
.project__title { font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -0.03em; }
.project__summary { color: var(--ink-2); }

.project__role {
  padding: 16px 18px;
  border-inline-start: 3px solid var(--accent);
  border-start-end-radius: var(--radius-sm);
  border-end-end-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 0.96rem;
  color: var(--ink-2);
}
.project__role-title { font-weight: 750; color: var(--ink); margin-bottom: 4px; }

.project__highlights { list-style: none; display: grid; gap: 10px; font-size: 0.97rem; }
.project__highlights li,
.case__body li {
  position: relative;
  padding-inline-start: 26px;
}
.project__highlights li::before,
.case__body li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 0.62em;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-50%) rotate(-45deg);
}

.case { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.case summary::-webkit-details-marker { display: none; }
.case summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--accent-ink);
  transition: transform 0.25s var(--ease);
}
.case[open] summary::after { transform: rotate(45deg); }
.case summary:hover { color: var(--accent-ink); }
.case__body { padding-bottom: 20px; font-size: 0.97rem; color: var(--ink-2); }
.case__body h4 { margin-top: 18px; margin-bottom: 6px; font-size: 0.82rem; font-family: var(--mono); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.case__body h4:first-child { margin-top: 4px; }
.case__body ul { list-style: none; display: grid; gap: 8px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 80px); align-items: start; }
.about__head { margin-bottom: 0; }

.principles { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.principle {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.principle__index { font-family: var(--mono); font-size: 0.78rem; color: var(--accent-ink); }
.principle__title { margin: 14px 0 8px; font-size: 1.15rem; letter-spacing: -0.015em; }
.principle p { color: var(--muted); font-size: 0.95rem; }

/* ---------- Experience ---------- */
.split { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: clamp(40px, 6vw, 80px); align-items: start; }
.split__head { position: sticky; top: calc(var(--header-h) + 32px); margin-bottom: 0; }

.timeline { list-style: none; border-top: 1px solid var(--line); }
.timeline__item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.timeline__period { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); padding-top: 4px; }
.timeline__role { font-size: 1.3rem; letter-spacing: -0.02em; }
.timeline__org { margin-top: 4px; font-weight: 600; color: var(--accent-ink); font-size: 0.95rem; }
.timeline__text { margin-top: 12px; color: var(--ink-2); }

/* ---------- Expertise ---------- */
.langs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 24px;
  padding: 18px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.langs__label { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.langs__list { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; }
.langs__list li { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; }
.langs__list li { white-space: nowrap; }
.langs__list li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 9px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.2em;
}

.expertise { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.expertise__item {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.expertise__item:hover { border-color: var(--line-strong); }
.expertise__index { font-family: var(--mono); font-size: 0.78rem; color: var(--accent-ink); }
.expertise__title { margin: 14px 0 8px; font-size: 1.18rem; letter-spacing: -0.015em; }
.expertise__text { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }
.expertise .chips { margin-top: auto; }
.expertise .chip { background: var(--bg); }

/* ---------- Reviews ---------- */
.reviews { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }

.rating-card {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--inverse-line);
  border-radius: var(--radius);
  background: var(--inverse-bg);
  color: var(--inverse-ink);
}
.rating-card p { color: color-mix(in srgb, var(--inverse-ink) 80%, transparent); }
.rating-card__score { line-height: 1; }
.rating-card__value { font-size: 4rem; font-weight: 800; letter-spacing: -0.05em; color: var(--inverse-ink); }
.rating-card__max { font-size: 1.4rem; font-weight: 600; }
.rating-card .rating-card__stars { color: var(--inverse-accent); letter-spacing: 0.15em; font-size: 1.1rem; }
.rating-card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 16px 0; border-block: 1px solid var(--inverse-line); }
.rating-card__stats dt { font-size: 0.82rem; color: color-mix(in srgb, var(--inverse-ink) 70%, transparent); }
.rating-card__stats dd { margin: 0; font-size: 1.5rem; font-weight: 750; }
.rating-card .chip { background: transparent; border-color: var(--inverse-line); color: var(--inverse-ink); }
.rating-card .text-link { color: var(--inverse-accent); }
.rating-card .text-link:hover { color: var(--inverse-ink); }

.quotes { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.quote figure {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.quote blockquote { margin: 0; }
.quote blockquote p { font-size: 1.08rem; line-height: 1.55; font-weight: 550; letter-spacing: -0.01em; }
.quote blockquote p::before { content: "\201C"; color: var(--accent); margin-right: 2px; }
.quote blockquote p::after { content: "\201D"; color: var(--accent); margin-left: 2px; }
.quote figcaption { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.quote figcaption > span:last-child { display: grid; }
.quote__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 750;
}
.quote__name { font-weight: 700; }
.quote__source { color: var(--muted); font-size: 0.84rem; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(40px, 6vw, 80px); align-items: start; }
.contact__intro > * + * { margin-top: 14px; }
.contact__list { list-style: none; margin-top: 36px !important; border-top: 1px solid var(--line); }
.contact__list li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.97rem;
}
.contact__list li > span:first-child { color: var(--muted); }
.contact__list a { font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.contact__list a:hover { text-decoration: underline; }

.form {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 3.5vw, 36px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 0.9rem; font-weight: 650; }
.field label span[aria-hidden] { color: var(--accent-ink); }
.field__optional { font-weight: 450; color: var(--muted); }
.field input,
.field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 150px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: 0.8; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field [aria-invalid="true"] { border-color: var(--danger); }
.form__note { font-size: 0.86rem; color: var(--muted); }
.form__footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.form__status { font-size: 0.93rem; font-weight: 600; }
.form__status.is-error { color: var(--danger); }
.form__status.is-success { color: var(--success); }

.hp-field { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 32px; font-size: 0.9rem; color: var(--muted); }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; }
.site-footer__links a { text-decoration: none; font-weight: 550; }

/* ---------- Legal page ---------- */
.legal h1 { margin-top: 12px; }
.legal h2 { margin-top: 2.2em; font-size: 1.3rem; }
.legal__updated { color: var(--muted); font-size: 0.92rem; }

/* ---------- Reveal on scroll (only when JS runs and motion is allowed) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .expertise { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about { grid-template-columns: 1fr; }
  .reviews { grid-template-columns: 1fr; }
  .rating-card { position: static; }
}

@media (max-width: 960px) {
  :root { --header-h: 62px; }

  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    padding: 12px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .site-nav a:not(.btn) { display: block; padding: 12px 14px; font-size: 1.05rem; }
  .site-nav__cta { margin: 10px 0 0; }
  .site-nav__cta .btn { width: 100%; min-height: 48px; }
  .brand__name { font-size: 0.98rem; }

  .hero__grid { grid-template-columns: 1fr; }
  .profile-card { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 20px; align-items: center; max-width: 640px; }
  .profile-card__facts { padding-block: 4px; padding-inline: 0 8px; }

  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts__item:nth-child(3) { padding-inline-start: 0; border-inline-start: 0; }
  .facts__item:nth-child(n + 3) { border-top: 1px solid var(--line); margin-top: 22px; }

  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .project__media { order: 0; }
  .project__media { position: relative; top: 0; }

  .split { grid-template-columns: 1fr; }
  .split__head { position: static; }

  .contact { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .profile-card { grid-template-columns: 1fr; }
  .profile-card__photo { aspect-ratio: 5 / 4; }
  .profile-card__facts { padding: 16px 6px 6px; }

  .facts { grid-template-columns: 1fr; }
  .facts__item,
  .facts__item + .facts__item { padding: 20px 0 0; border-inline-start: 0; margin-top: 0; }
  .facts__item + .facts__item { border-top: 1px solid var(--line); margin-top: 20px; }

  .principles { grid-template-columns: 1fr; }
  .expertise { grid-template-columns: 1fr; }
  .langs { padding: 16px 18px; }
  .langs__list { gap: 6px 16px; }
  .quotes { grid-template-columns: 1fr; }
  .timeline__item { grid-template-columns: 1fr; gap: 8px; }
  .form__row { grid-template-columns: 1fr; }
  .contact__list li { grid-template-columns: 1fr; gap: 2px; }
  .hero__actions .btn { flex: 1 1 100%; }
}

/* ---------- Header language switch on small screens ---------- */
@media (max-width: 960px) {
  .site-header__tools .lang-switch { display: none; }
  .site-nav__lang { display: block; }
}

/* ---------- Arabic (right-to-left) typography ---------- */
/* Letter-spacing breaks the joins between Arabic letters, and Arabic needs taller lines. */
:lang(ar) { letter-spacing: 0 !important; }
html[lang="ar"] body { line-height: 1.85; }
:lang(ar) :is(h1, h2, h3, h4, .hero__title, .section__title, .project__title, .facts__value) { line-height: 1.4; }
:lang(ar) .hero__title { max-width: 22ch; font-weight: 750; }
:lang(ar) :is(.eyebrow, .project__category, .langs__label, .skills__title, .case__body h4, .hero__stack-label, .timeline__period) {
  font-family: var(--font);
  text-transform: none;
  font-size: 0.88rem;
  font-weight: 650;
}
.error-page__alt { margin-top: 32px !important; color: var(--muted); }

/* ---------- Print: a clean one-column résumé view ---------- */
@media print {
  :root { --bg: #fff; --bg-alt: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --muted: #444; --line: #ccc; }
  body { font-size: 11pt; }
  .site-header, .theme-toggle, .nav-toggle, .hero__actions, .project__actions, .form, .site-footer__links, .skip-link { display: none !important; }
  .section { padding-block: 24px; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .hero__grid, .project, .about, .split, .reviews, .contact { grid-template-columns: 1fr !important; }
  .project__media, .split__head, .rating-card { position: static !important; }
  .project, .expertise__item, .timeline__item, .quote { break-inside: avoid; }
  .case[open] summary, .case summary { display: none; }
  .case > .case__body { display: block; }
  .rating-card { background: #fff; color: #000; border: 1px solid #ccc; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; }
}

/* ---------- Error pages ---------- */
.error-page { min-height: calc(100vh - var(--header-h) - 100px); display: grid; align-items: center; }
.error-page .container > * + * { margin-top: 16px; }
.error-page .hero__actions { padding-top: 12px; display: flex; flex-wrap: wrap; gap: 12px; }

.nowrap { white-space: nowrap; }
