/* Mohammed Abdullah, portfolio. Plain CSS, no build step. */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  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;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f6f4f1;
  --bg-raise: #eeeae4;
  --media-bg: #ebe6df;
  --ink: #1b1917;
  --ink-2: #4a4541;
  --ink-3: #67615b;
  --line: #e1dbd3;
  --line-strong: #cfc7bd;
  --chip: #eae5df;
  --accent: #8a1538;
  --accent-hover: #6f0f2c;
  --button: #8a1538;
  --button-hover: #6f0f2c;
  --on-button: #ffffff;
  --on-accent: #ffffff;
  --selection: rgb(138 21 56 / 0.16);

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t: 180ms;

  --gutter: clamp(1.25rem, 5vw, 3rem);
  --radius: 10px;
  --radius-sm: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121010;
    --bg-raise: #1c1918;
    --media-bg: #1e1a19;
    --ink: #eee9e4;
    --ink-2: #b3aca5;
    --ink-3: #968f88;
    --line: #2a2523;
    --line-strong: #3a3431;
    --chip: #231f1d;
    --accent: #ee8fa6;
    --accent-hover: #f6b3c3;
    --button: #9e1c43;
    --button-hover: #b42652;
    --on-button: #ffffff;
    --on-accent: #121010;
    --selection: rgb(238 143 166 / 0.24);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  scrollbar-color: var(--line-strong) var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  caret-color: var(--accent);
}

::selection { background: var(--selection); color: var(--ink); }

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
.nw { white-space: nowrap; }
ul, ol { padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

.prose a,
.text-link {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--t) var(--ease-out), text-decoration-color var(--t) var(--ease-out);
}
.prose a:hover,
.text-link:hover { color: var(--accent); text-decoration-color: currentColor; }

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

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

.icon {
  width: 1.125rem; height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: var(--gutter); top: 0.75rem;
  z-index: 20;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--t) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

/* ---------- Layout ---------- */
.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.intro {
  padding: 4.5rem 0 3rem;
}

@media (min-width: 64em) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    column-gap: clamp(3rem, 6vw, 6rem);
  }
  .intro {
    position:sticky;
    top: 0;
    height: fit-content;
    display: flex;
    flex-direction: column;
    padding: 6rem 0;
  }
  .content { padding: 6rem 0 4rem; }
}

/* ---------- Intro column ---------- */
.name {
  color: var(--ink);
  font-size: clamp(2.25rem, 1.7rem + 1.8vw, 3rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.role {
  margin-top: 0.75rem;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.lede {
  margin-top: 1rem;
  max-width: 24rem;
  text-wrap: pretty;
}

.facts {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
  color: var(--ink-3);
  font-size: 0.875rem;
}
.facts li { display: inline-flex; align-items: center; gap: 0.4rem; }
.facts li + li::before {
  content: "|";
  margin-right: 0.475rem;
  border-radius: 50%;
}
/* On narrow screens the line would wrap with a dot leading the second row: use a grid instead. */
@media (max-width: 30em) {
  .facts { display: grid; grid-template-columns: auto auto; justify-content: start; gap: 0.25rem 1.5rem; }
  .facts li + li::before { display: none; }
}

/* Section nav: desktop only */
.section-nav { display: none; }

@media (min-width: 64em) {
  .section-nav { display: block; margin-top: 4rem; }
  .section-nav ol { display: grid; gap: 0.125rem; }
  .section-nav a {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    color: var(--ink-3);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color var(--t) var(--ease-out);
  }
  .section-nav a::before {
    content: "";
    width: 2rem;
    height: 1px;
    background: currentColor;
    transition: width var(--t) var(--ease-out), background-color var(--t) var(--ease-out);
  }
  .section-nav a:hover,
  .section-nav a[aria-current="true"] { color: var(--ink); }
  .section-nav a:hover::before { width: 3.5rem; }
  .section-nav a[aria-current="true"]::before { width: 4rem; background: var(--accent); height: 2px; }
  .intro{padding: 2rem 0;}
}

.reach {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
}
@media (min-width: 64em) {
  .reach { margin-top: auto; padding-top: 2.5rem; }
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.125rem 0.625rem 1rem;
  border-radius: 999px;
  background: var(--button);
  color: var(--on-button);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.005em;
  box-shadow: 0 1px 2px rgb(20 12 10 / 0.14), 0 4px 12px -4px rgb(20 12 10 / 0.22);
  transition: background-color var(--t) var(--ease-out), transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out);
}
.button:hover { background: var(--button-hover); transform: translateY(-1px); box-shadow: 0 2px 4px rgb(20 12 10 / 0.14), 0 8px 20px -6px rgb(20 12 10 / 0.28); }
.button:active { transform: translateY(0); }
.button .icon { width: 1.0625rem; height: 1.0625rem; stroke-width: 2; }
.button-meta { font-weight: 500; opacity: 0.8; font-size: 0.8125rem; }

.social { display: flex; align-items: center; gap: 0.25rem; }
.social a {
  display: inline-grid;
  place-items: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  color: var(--ink-3);
  transition: color var(--t) var(--ease-out), background-color var(--t) var(--ease-out);
}
.social a:hover { color: var(--ink); background: var(--bg-raise); }
.social .icon { width: 1.25rem; height: 1.25rem; }

.email {
  flex-basis: 100%;
  color: var(--ink-3);
  font-size: 0.875rem;
}
.email a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.22em;
  transition: color var(--t) var(--ease-out);
}
.email a:hover { color: var(--accent); }

/* ---------- Sections ---------- */
.section + .section { margin-top: 6rem; }

.section-title {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 calc(var(--gutter) * -1) 1.25rem;
  padding: 1rem var(--gutter) 0.75rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
@media (min-width: 64em) {
  .section-title {
    position: static;
    margin: 0 0 1.5rem;
    padding: 0;
    background: none;
    font-size: 1.5rem;
  }
}

.subhead {
  margin: 3.5rem 0 1rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Project rows (shared hover system) ---------- */
.rows { display: grid; gap: 0.5rem; }

.row {
  position: relative;
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 -1rem;
  transition: background-color var(--t) var(--ease-out), opacity var(--t) var(--ease-out);
}

@media (hover: hover) {
  .row:not(.lab):hover { background: var(--bg-raise); }
  .rows:has(.row:not(.lab):hover) .row:not(:hover) { opacity: 0.55; }
}

.row-title {
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.row-title a {
  transition: color var(--t) var(--ease-out);
}
/* The title link covers the whole row; secondary links sit above it. */
.row-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.row-title .icon {
  display: inline-block;
  width: 0.875rem; height: 0.875rem;
  margin-left: 0.3rem;
  vertical-align: -0.05em;
  stroke-width: 2.25;
  transition: transform var(--t) var(--ease-out);
}
@media (hover: hover) {
  .row:hover .row-title a { color: var(--accent); }
  .row:hover .row-title .icon { transform: translate(2px, -2px); }
}
.row-title a:focus-visible { outline: none; }
.row-title a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }

.row-meta {
  margin-top: 0.2rem;
  color: var(--ink-3);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.row-desc {
  margin-top: 0.5rem;
  max-width: 34rem;
  font-size: 0.9375rem;
  text-wrap: pretty;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.875rem;
}
.tags li {
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
}

.row-links {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: 0.875rem;
  font-size: 0.875rem;
}
.row-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--ink);
  font-weight: 500;
  transition: color var(--t) var(--ease-out);
}
.row-links a:hover { color: var(--accent); }
.row-links .icon { width: 0.9375rem; height: 0.9375rem; }

/* Featured work: large media above the text */
.feature .media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin-bottom: 1.125rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--media-bg);
}
.feature .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms var(--ease-out);
}
.feature .media--phones img { object-fit: contain; }
@media (hover: hover) {
  .feature:hover .media img { transform: scale(1.015); }
}
.title-logo {
  display: inline-block;
  width: 1.5rem; height: 1.5rem;
  border-radius: 6px;
  margin-right: 0.5rem;
  vertical-align: -0.35rem;
}

@media (prefers-color-scheme: dark) {
  .feature .media img,
  .compact .thumb img {
    filter: brightness(0.8) contrast(1.04);
    transition: filter var(--t) var(--ease-out), transform 420ms var(--ease-out);
  }
  .row:hover .media img,
  .row:hover .thumb img { filter: none; }
}

/* Compact rows: thumbnail beside text */
.compact {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  column-gap: 1.25rem;
  align-items: start;
}
.compact .thumb {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin-top: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--media-bg);
}
.compact .thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 26em) {
  .compact { grid-template-columns: 5.5rem minmax(0, 1fr); column-gap: 1rem; }
}

/* Labs: text only, aligned with the compact rows' text column */
.lab .row-title { font-size: 1rem; }

/* ---------- Skills ---------- */
.skills { display: grid; gap: 1.25rem; }
.skills div {
  display: grid;
  gap: 0.25rem;
}
@media (min-width: 40em) {
  .skills div { grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1.25rem; }
}
.skills dt { color: var(--ink); font-weight: 600; font-size: 0.9375rem; }
.skills dd { font-size: 0.9375rem; text-wrap: pretty; }

/* ---------- Certifications ---------- */
.certs { border-top: 1px solid var(--line); }
.cert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.cert-name { color: var(--ink); font-weight: 600; font-size: 0.9375rem; line-height: 1.4; }
.cert-name a { transition: color var(--t) var(--ease-out); }
.cert-name a:hover { color: var(--accent); }
.cert-name .icon { display: inline-block; width: 0.8125rem; height: 0.8125rem; margin-left: 0.3rem; vertical-align: -0.05em; stroke-width: 2.25; transition: transform var(--t) var(--ease-out); }
.cert-name a:hover .icon { transform: translate(2px, -2px); }
.cert-issuer { grid-column: 1; color: var(--ink-3); font-size: 0.875rem; }
.cert-alt { grid-column: 1; justify-self: start; color: var(--ink-3); font-size: 0.875rem; }
.cert-date {
  grid-column: 2; grid-row: 1;
  color: var(--ink-3);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
[lang="ar"] {
  display: inline-block;
  white-space: nowrap;
  font-family: "Segoe UI", "Noto Naskh Arabic", "Geeza Pro", "Arial", sans-serif;
}

/* ---------- Education ---------- */
.edu {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
}
.edu-school { color: var(--ink); font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em; }
.edu-date { color: var(--ink-3); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.edu-degree { grid-column: 1 / -1; }
.edu-gpa { grid-column: 1 / -1; color: var(--ink); font-weight: 500; }
.edu-courses { grid-column: 1 / -1; margin-top: 0.75rem; max-width: 34rem; font-size: 0.9375rem; text-wrap: pretty; }

.timeline { display: grid; gap: 1.25rem; }
.timeline li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.125rem 1.5rem;
  align-items: baseline;
}
.timeline strong { color: var(--ink); font-weight: 600; font-size: 0.9375rem; }
.timeline time { color: var(--ink-3); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline p { grid-column: 1 / -1; font-size: 0.9375rem; max-width: 34rem; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.875rem;
}
.footer p + p { margin-top: 0.25rem; }

/* ---------- 404 ---------- */
.notfound {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 1rem;
  padding: var(--gutter);
  text-align: left;
  max-width: 32rem;
  margin: 0 auto;
}
.notfound .name { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.75rem); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .section-nav, .social, .skip-link, .button { display: none !important; }
  .page { display: block; }
  .intro { position: static; height: auto; padding: 0 0 1.5rem; }
  .section-title { position: static; background: none; }
  .row { break-inside: avoid; }
  .rows:has(.row:hover) .row:not(:hover) { opacity: 1; }
}
