/* Hazem Abdelhamid portfolio
   Look: a radiology reading screen. Blue-black film, light-box white,
   cyan for anything you can click, amber only for "model output" annotations. */

:root {
  color-scheme: dark;
  --bg: #07111a;
  --surface: #0c1924;
  --surface-2: #11222f;
  --line: #1c3040;
  --line-strong: #2c475a;
  --text: #e7eef3;
  --muted: #93a7b7;
  --accent: #52d6e6;
  --accent-ink: #032026;
  --amber: #f5b83f;
  --ok: #3ddc84;
  --grid: rgba(147, 167, 183, 0.16);
  --box: #f5b83f;          /* detection boxes sit on photos, so they keep one color in both themes */
  --box-ink: #211600;
  --font: "Archivo", "Alexandria", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --gutter: clamp(20px, 4vw, 40px);
  --header-h: 68px;
  interpolate-size: allow-keywords;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f8;
  --surface: #ffffff;
  --surface-2: #e6edf2;
  --line: #d3dee6;
  --line-strong: #aebfcc;
  --text: #0b1823;
  --muted: #4b5f6f;
  --accent: #00717e;
  --accent-ink: #ffffff;
  --amber: #a35e00;
  --ok: #138a4a;
  --grid: rgba(11, 24, 35, 0.11);
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

:root[lang="ar"] body { line-height: 1.85; }

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.1; font-weight: 700; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; }

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

/* Bilingual copy: every text exists twice, the page language decides which one shows */
html[lang="ar"] [data-l="en"],
html:not([lang="ar"]) [data-l="ar"] { display: none !important; }

/* Arabic letters must never be tracked: spacing breaks the joins between them */
:root[lang="ar"] :is(h1, h2, h3, .brand, .btn, .chip) { letter-spacing: 0 !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.container { width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  min-height: 48px;
  padding: 0 1.35em;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 84%, var(--text)); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn .icon { width: 19px; height: 19px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
  backdrop-filter: saturate(1.3) blur(14px);
}

.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-inline-end: auto;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* Monogram inside detection-box corner brackets */
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 0.8rem;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: 0.02em;
  background:
    linear-gradient(var(--box) 0 0) left top / 9px 2px,
    linear-gradient(var(--box) 0 0) left top / 2px 9px,
    linear-gradient(var(--box) 0 0) right top / 9px 2px,
    linear-gradient(var(--box) 0 0) right top / 2px 9px,
    linear-gradient(var(--box) 0 0) left bottom / 9px 2px,
    linear-gradient(var(--box) 0 0) left bottom / 2px 9px,
    linear-gradient(var(--box) 0 0) right bottom / 9px 2px,
    linear-gradient(var(--box) 0 0) right bottom / 2px 9px;
  background-repeat: no-repeat;
}

.nav-list { display: flex; gap: 2px; }
.nav-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.nav-list a:hover { color: var(--text); }
.nav-list a[aria-current="true"] { background: var(--surface-2); color: var(--text); }

.controls { display: flex; gap: 8px; }
.lang-btn { font-size: 0.95rem; }
.lang-btn [lang="ar"] { font-size: 1.15rem; line-height: 1; }

.i-moon { display: none; }
:root[data-theme="light"] .i-sun { display: none; }
:root[data-theme="light"] .i-moon { display: block; }

.menu-btn, .i-close { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-block: clamp(40px, 7vw, 96px) clamp(64px, 9vw, 120px);
  overflow: hidden;
}

/* Faint pixel grid, the raw material of every image model */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--grid) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 65% 70% at 72% 45%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 65% 70% at 72% 45%, #000 25%, transparent 75%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.85fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
}

.hero-text { container-type: inline-size; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent);
}

.hero-name {
  margin-top: 26px;
  font-size: clamp(2.6rem, 7vw, 6rem);
  font-size: clamp(2.5rem, 14.6cqi, 6.25rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 0.93;
  letter-spacing: -0.035em;
}
.hero-name .line { display: block; }
:root[lang="ar"] .hero-name { line-height: 1.25; font-size: clamp(2.6rem, 13cqi, 5.6rem); }

.roles {
  display: flex;
  flex-wrap: wrap;
  margin-top: 26px;
  font-size: clamp(1.1rem, 2.1vw, 1.4rem);
  font-weight: 600;
}
.roles li { white-space: nowrap; }
/* Separator trails each item, so a wrapped line never starts with a slash */
.roles li:not(:last-child)::after {
  content: "/";
  content: "/" / "";
  margin-inline: 0.5em;
  color: var(--line-strong);
  font-weight: 400;
}

.pitch { max-width: 54ch; margin-top: 18px; color: var(--muted); font-size: 1.125rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.95rem;
}
.hero-meta li { display: inline-flex; align-items: center; gap: 8px; }

/* Portrait with object-detection overlay */
.portrait { justify-self: end; width: min(100%, 440px); }

.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 6px;
  background: #0a1520;
  outline: 1px solid var(--line-strong);
  outline-offset: 9px;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }

.scan {
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 26%;
  background: linear-gradient(to bottom, transparent, rgba(82, 214, 230, 0.28) 88%, rgba(82, 214, 230, 0.9));
  opacity: 0;
  transform: translateY(-100%);
  animation: scan 1.5s 0.25s cubic-bezier(0.45, 0, 0.25, 1) forwards;
  pointer-events: none;
}
@keyframes scan {
  0% { opacity: 1; transform: translateY(-100%); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateY(385%); }
}

.det {
  position: absolute;
  border: 1.5px solid var(--box);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  opacity: 0;
  animation: det-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.det b {
  position: absolute;
  bottom: 100%;
  left: -1.5px;
  padding: 4px 6px 3px;
  border-radius: 2px 2px 0 0;
  background: var(--box);
  color: var(--box-ink);
  font: 600 11px/1 var(--mono);
  white-space: nowrap;
}
.det-face { left: 35.6%; top: 4.6%; width: 29%; height: 27.6%; animation-delay: 1.35s; }
.det-blazer { left: 13.2%; right: 1.4%; top: 33.4%; bottom: 0.6%; animation-delay: 1.6s; }
.det-watch { left: 84.2%; top: 92.6%; width: 7.8%; bottom: 0.9%; animation-delay: 1.85s; }
.det-watch b { left: auto; right: -1.5px; }

@keyframes det-in {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: none; }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(72px, 10vw, 128px); border-top: 1px solid var(--line); }

.section-head { max-width: 760px; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2, .about-text h2 {
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.025em;
}
.section-head p { max-width: 60ch; margin-top: 14px; color: var(--muted); font-size: 1.125rem; }
:root[lang="ar"] :is(.section-head h2, .about-text h2, .contact-intro h2) { line-height: 1.35; }

/* ---------- Featured project ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding: clamp(16px, 2.6vw, 28px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.viewer { overflow: hidden; border: 1px solid #1d2a35; border-radius: 12px; background: #000; }
.ct { width: 100%; height: auto; }
.ct text { font-family: var(--mono); font-size: 9px; }
.ct-hud text { fill: #7f93a3; }
.ct-tag { fill: #211600; font-weight: 600; }
.ct-label { font-weight: 600; paint-order: stroke; stroke: #000; stroke-width: 3px; stroke-linejoin: round; }
.ct-scale text { fill: #8a9aa8; font-size: 8px; font-weight: 600; }
.ct-scale text:first-child { fill: #211600; }
.ov { opacity: 0; transition: opacity 0.35s ease; }
.ov.on { opacity: 1; }

.viewer-caption { margin-top: 10px; color: var(--muted); font-size: 0.85rem; }

.feature-body { padding-block: clamp(4px, 1vw, 12px); padding-inline: 0 clamp(4px, 1.2vw, 16px); }

.chip {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  border-radius: 6px;
  color: var(--amber);
  font-size: 0.85rem;
  font-weight: 600;
}

.feature h3 {
  margin-top: 16px;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  font-stretch: 110%;
  letter-spacing: -0.02em;
}
:root[lang="ar"] .feature h3 { line-height: 1.35; }

.dates { margin-top: 8px; color: var(--muted); font-size: 0.95rem; }
.feature-summary { margin-top: 16px; color: var(--muted); }

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 26px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 60px;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.step:hover { color: var(--text); }
.step-n { color: var(--muted); font: 600 0.75rem/1 var(--mono); }
.step[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.step[aria-selected="true"] .step-n { color: var(--accent); }

.step-panel { min-height: 3.4em; margin-top: 16px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tags > * {
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- Project folders ---------- */

.folders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px 24px;
  margin-top: 64px;
  align-items: start;
}

.folder {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  border-start-start-radius: 0;
  background: var(--surface);
  transition: border-color 0.2s;
}
.folder:hover, .folder[open] { border-color: var(--line-strong); }

.folder summary {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 24px;
  cursor: pointer;
  list-style: none;
  border-radius: inherit;
}
.folder summary::-webkit-details-marker { display: none; }

.folder-tab {
  position: absolute;
  bottom: calc(100% - 1px);
  inset-inline-start: -1px;
  padding: 6px 16px 5px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.2s;
}
.folder:hover .folder-tab, .folder[open] .folder-tab { border-color: var(--line-strong); }

.folder h3 { font-size: 1.35rem; font-weight: 700; font-stretch: 108%; letter-spacing: -0.01em; }
:root[lang="ar"] .folder h3 { line-height: 1.4; }
.folder .lede { display: block; color: var(--muted); }
.folder .tags { margin-top: 4px; }

.folder-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}
.folder-toggle .icon { transition: transform 0.3s ease; }
.folder[open] .folder-toggle .icon { transform: rotate(180deg); }
.folder[open] .t-open, .folder:not([open]) .t-close { display: none; }

.folder::details-content {
  block-size: 0;
  overflow-y: clip;
  transition: block-size 0.35s ease, content-visibility 0.35s allow-discrete;
}
.folder[open]::details-content { block-size: auto; }

.folder-body { margin-inline: 24px; padding: 18px 0 26px; border-top: 1px dashed var(--line-strong); }

.bullets { display: grid; gap: 10px; }
.bullets li { position: relative; padding-inline-start: 20px; color: var(--muted); }
.bullets li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent);
}
:root[lang="ar"] .bullets li::before { top: 0.78em; }
.bullets strong { color: var(--text); font-weight: 700; }

/* ---------- Experience ---------- */

.job { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 0 36px; }

.job-when { padding-top: 3px; color: var(--muted); font-size: 0.95rem; font-weight: 500; }

.job-body {
  position: relative;
  padding-inline-start: 34px;
  padding-bottom: 52px;
  border-inline-start: 1px solid var(--line-strong);
}
.job:last-child .job-body { padding-bottom: 4px; }
.job-body::before {
  content: "";
  position: absolute;
  inset-inline-start: -6px;
  top: 8px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 2px;
  background: var(--bg);
}

.job h3 { font-size: 1.3rem; font-weight: 700; }
:root[lang="ar"] .job h3 { line-height: 1.4; }
.org { margin-top: 6px; color: var(--muted); }
.job .bullets { margin-top: 16px; max-width: 70ch; }

/* ---------- Skills ---------- */

.skills { border-top: 1px solid var(--line); }

.skill-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px 36px;
  align-items: start;
  padding-block: 22px;
  border-bottom: 1px solid var(--line);
}
.skill-row h3 { padding-top: 6px; font-size: 1.05rem; font-weight: 700; line-height: 1.4; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(36px, 6vw, 80px);
  align-items: start;
}

.about-photo {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  outline: 1px solid var(--line-strong);
  outline-offset: 9px;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 48% 72%; }

.about-text > p { max-width: 62ch; margin-top: 18px; color: var(--muted); font-size: 1.1rem; }
.about-text h2 + p { margin-top: 24px; }

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 44px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}
.facts h3 { margin-bottom: 10px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.facts p { font-weight: 600; line-height: 1.45; }
.facts p + p:not(.sub) { margin-top: 12px; }
.facts .sub { margin-top: 2px; color: var(--muted); font-size: 0.92rem; font-weight: 400; }

/* ---------- Contact ---------- */

.contact-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  padding: clamp(28px, 5vw, 56px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.contact-intro h2 {
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.025em;
}
.contact-intro p { max-width: 46ch; margin-top: 16px; color: var(--muted); font-size: 1.125rem; }

.contact-list { display: grid; gap: 10px; align-content: start; }

.contact-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.contact-item > .icon { width: 22px; height: 22px; color: var(--accent); }
.contact-item .label { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.contact-item .value {
  display: block;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.contact-item a.value:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
:root[dir="rtl"] .contact-item .value[dir="ltr"] { text-align: right; }

/* ---------- Footer & toast ---------- */

.site-footer { padding-block: 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 60;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */

@media (max-width: 1020px) {
  .feature { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .feature-body { padding: 0 clamp(4px, 1.2vw, 16px) 8px; }
  .job { grid-template-columns: 170px minmax(0, 1fr); gap: 0 28px; }
}

@media (max-width: 880px) {
  .menu-btn { display: inline-grid; }
  .site-nav {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    display: none;
    padding: 8px var(--gutter) 18px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .nav-open .site-nav { display: block; }
  .nav-open .i-menu { display: none; }
  .nav-open .i-close { display: block; }
  .nav-list { flex-direction: column; }
  .nav-list a { padding: 13px 12px; font-size: 1.05rem; }
}

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { justify-self: center; width: min(100%, 400px); margin-top: 8px; }
  .folders { grid-template-columns: minmax(0, 1fr); margin-top: 56px; }
  /* One column: the timeline rule and its marker move from the body to the whole entry */
  .job {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    padding-inline-start: 34px;
    padding-bottom: 44px;
    border-inline-start: 1px solid var(--line-strong);
  }
  .job:last-child { padding-bottom: 4px; }
  .job::before {
    content: "";
    position: absolute;
    inset-inline-start: -6px;
    top: 8px;
    width: 11px;
    height: 11px;
    border: 2px solid var(--accent);
    border-radius: 2px;
    background: var(--bg);
  }
  .job-when { padding: 0 0 6px; }
  .job-body, .job:last-child .job-body { padding: 0; border: 0; }
  .job-body::before { display: none; }
  .skill-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .skill-row h3 { padding-top: 0; }
  .about { grid-template-columns: minmax(0, 1fr); }
  .about-photo { position: relative; top: 0; width: min(100%, 400px); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .contact-card { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .brand-name { display: none; }
  .roles { flex-direction: column; gap: 2px; }
  .roles li::after { display: none; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-row .btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .scan { display: none; }
}
