/* Fonts are hosted in this repo, so no third party sees your visitors. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  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: "IBM Plex Sans Arabic";
  src: url("fonts/plex-arabic-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("fonts/plex-arabic-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("fonts/plex-arabic-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

:root {
  --midnight: #0a1830;
  --deep: #0f2347;
  --edge: #5f86c9;
  --frost: #eaf0f9;
  --mist: #9fb2d1;
  --amber: #f4b45a;
  --sans: "Bricolage Grotesque", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--frost);
  background:
    radial-gradient(1100px 700px at 88% -8%, #1d3f78 0%, rgba(29, 63, 120, 0) 62%),
    var(--midnight);
  background-repeat: no-repeat;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { line-height: 1.95; }

p { margin: 0 0 1rem; max-width: 62ch; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.12; }
.muted { color: var(--mist); }

a { color: var(--frost); text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { color: #fff; text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0.5rem;
  background: var(--frost);
  color: var(--midnight);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  z-index: 20;
}
.skip:focus { inset-inline-start: 0.5rem; }

/* ---------- header ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem var(--gutter);
  max-width: 1240px;
  margin-inline: auto;
}
.brand {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--frost);
}
.lang { display: flex; gap: 0.25rem; }
.lang button {
  background: transparent;
  color: var(--mist);
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.lang button:hover { color: var(--frost); }
.lang button[aria-pressed="true"] {
  color: var(--midnight);
  background: var(--frost);
}

main { max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
  padding-block: clamp(1.5rem, 6vh, 4rem) clamp(4rem, 12vh, 8rem);
  min-height: min(82vh, 760px);
}
.hero-copy { align-self: end; padding-bottom: 1rem; }
h1 {
  font-size: clamp(2.7rem, 7.2vw, 6.2rem);
  font-stretch: 82%;
  font-weight: 650;
  letter-spacing: -0.025em;
  max-width: 11ch;
  margin-bottom: 1.5rem;
}
.lede {
  font-size: clamp(1.2rem, 2.1vw, 1.65rem);
  line-height: 1.4;
  max-width: 30ch;
  margin-bottom: 1.25rem;
}
.role { color: var(--mist); margin: 0; }

.portrait {
  margin: 0;
  width: clamp(190px, 21vw, 300px);
  perspective: 900px;
  grid-column: 2;
  grid-row: 1;
}
.portrait-inner {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(190, 210, 255, 0.22);
  box-shadow:
    0 40px 70px -28px rgba(0, 0, 0, 0.75),
    0 0 0 6px rgba(10, 24, 48, 0.55);
  transform: rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg));
  transition: transform 0.25s ease-out;
  background: var(--deep);
}
.portrait-inner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 30%;
}
.portrait-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(10, 24, 48, 0.6), rgba(10, 24, 48, 0) 45%),
    linear-gradient(135deg, rgba(95, 134, 201, 0.16), rgba(95, 134, 201, 0) 50%);
  pointer-events: none;
}

/* ---------- the memorable part: a vehicle's security layers ---------- */
.defence { position: relative; padding-block: 2rem 4rem; }
.pin { display: grid; gap: 3rem; }

.defence-copy h2 { font-size: clamp(2rem, 4.2vw, 3.4rem); font-stretch: 85%; letter-spacing: -0.02em; margin-bottom: 1.25rem; }
.intro { font-size: 1.15rem; color: var(--mist); margin-bottom: 2.25rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.6rem; }
.step { padding-inline-start: 1.25rem; border-inline-start: 2px solid rgba(159, 178, 209, 0.28); }
.step h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.3rem; }
.step-d p { margin: 0; color: var(--mist); }

.scene { perspective: 1500px; perspective-origin: 50% 35%; display: grid; place-items: center; min-height: 420px; }
.stack {
  --p: 1;
  position: relative;
  width: min(72vw, 340px);
  aspect-ratio: 1;
  transform-style: preserve-3d;
  transform: rotateX(62deg) rotateZ(calc(-38deg + var(--p) * 12deg)) translateZ(calc(var(--p) * -95px));
}
.plate {
  --i: 0;
  position: absolute;
  inset: 0;
  border-radius: 26px;
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--i) * (16px + var(--p) * 78px)));
  border: 1px solid rgba(150, 185, 245, 0.42);
  background-color: rgba(30, 62, 120, 0.55);
  transition: border-color 0.4s, background-color 0.4s, box-shadow 0.4s;
}
.plate::after {            /* the plate's thickness */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #061226;
  transform: translateZ(-9px);
}
.pl1 { --i: 0; background-image: linear-gradient(rgba(150,185,245,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(150,185,245,.2) 1px, transparent 1px); background-size: 22px 22px; }
.pl2 { --i: 1; background-image: repeating-radial-gradient(circle at 50% 50%, rgba(150,185,245,.24) 0 1px, transparent 1px 26px); }
.pl3 { --i: 2; background-image: repeating-linear-gradient(0deg, rgba(150,185,245,.26) 0 8px, transparent 8px 22px); }
.pl4 { --i: 3; background-image: radial-gradient(rgba(150,185,245,.4) 1.4px, transparent 1.6px); background-size: 20px 20px; }

/* the layer you're reading about lights up */
.stack[data-active="0"] .pl1,
.stack[data-active="1"] .pl2,
.stack[data-active="2"] .pl3,
.stack[data-active="3"] .pl4 {
  border-color: var(--amber);
  background-color: rgba(120, 90, 40, 0.5);
  box-shadow: 0 0 40px rgba(244, 180, 90, 0.35);
}

/* scroll mode: the section is tall and the content stays pinned while you scroll */
@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  .defence.scroll-mode { height: 380vh; padding-block: 0; }
  .defence.scroll-mode .pin {
    position: sticky;
    top: 0;
    height: 100vh;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 4vw;
  }
  .defence.scroll-mode .scene { height: 100%; }
  .defence.scroll-mode .stack { width: min(30vw, 400px); }
  .defence.scroll-mode .step { opacity: 0.4; transition: opacity 0.4s, border-color 0.4s; }
  .defence.scroll-mode .step.is-active { opacity: 1; border-color: var(--amber); }
  .defence.scroll-mode .step-d { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s ease; }
  .defence.scroll-mode .step-d p { overflow: hidden; min-height: 0; }
  .defence.scroll-mode .step.is-active .step-d { grid-template-rows: 1fr; }
  .defence.scroll-mode .steps { gap: 1.1rem; }
}
@media (min-width: 900px) {
  .pin { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
}

/* ---------- about / education / contact ---------- */
.about { padding-block: clamp(3rem, 9vh, 6rem); }
.about h2, .edu h2, .contact h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-stretch: 88%; margin-bottom: 1.25rem; }
.about p { font-size: 1.25rem; line-height: 1.6; max-width: 36em; }
html[lang="ar"] .about p { line-height: 1.95; }

.edu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  padding-block: clamp(2.5rem, 6vh, 4rem);
  border-top: 1px solid rgba(159, 178, 209, 0.2);
}
@media (min-width: 860px) {
  .edu { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4rem; }
}
.edu-degree { font-size: 1.25rem; font-weight: 500; margin-bottom: 0.25rem; }
.edu p { margin-bottom: 0.4rem; }
.edu-repo { font-size: 1.15rem; font-weight: 500; margin-top: 1.25rem; }

/* both photos share one height, so their tops and bottoms line up */
.edu-photos { container-type: inline-size; }
.photo-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  height: min(360px, calc((100cqw - 12px) / 2));
}
.photo-row img {
  display: block;
  height: 100%;
  width: auto;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(190, 210, 255, 0.2);
  box-shadow: 0 28px 50px -26px rgba(0, 0, 0, 0.7);
}

.contact {
  padding-block: clamp(2.5rem, 6vh, 4rem) clamp(4rem, 10vh, 7rem);
  border-top: 1px solid rgba(159, 178, 209, 0.2);
}
.ln { font-size: clamp(1.15rem, 2.2vw, 1.5rem); font-weight: 500; margin-bottom: 0.75rem; overflow-wrap: anywhere; }

.foot {
  max-width: 1240px;
  margin-inline: auto;
  padding: 1.75rem var(--gutter) 3rem;
  font-size: 0.9rem;
  color: var(--mist);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.foot p { margin: 0; }

/* ---------- Arabic ---------- */
html[lang="ar"] h1,
html[lang="ar"] .brand { font-family: "Bricolage Grotesque", sans-serif; }
html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.4; font-stretch: 100%; }
html[lang="ar"] h1 { direction: ltr; text-align: right; }
html[lang="ar"] .ln { direction: ltr; text-align: right; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 0; }
  .portrait { grid-column: 1; grid-row: 1; width: 148px; justify-self: end; margin-top: 0.75rem; }
  .hero-copy { grid-row: 2; }
  .scene { min-height: 380px; }
  .stack { width: min(56vw, 260px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .portrait-inner, .plate { transition: none; }
}
