/* ==========================================================================
   Ahmed Ali Qadir — editorial direction
   Warm off-white ground, tight display type, sections that invert to dark.
   Type craft: sub-1 line-height and negative tracking that scales with size.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* colour — light ground */
  --paper: #F2F0EA;
  --paper-raised: #E9E6DE;
  --ink: #14121B;
  --ink-muted: #56506A;
  --accent: #5B44C4;
  --accent-hover: #4733A8;
  --rule: rgba(20, 18, 27, 0.14);

  /* colour — inverted sections */
  --dark: #14121F;
  --dark-deep: #0B0A12;
  --dark-ink: #F1EFF7;
  --dark-muted: #A6A0BA;
  --dark-accent: #B9A8FF;
  --dark-rule: rgba(241, 239, 247, 0.16);

  /* surface-aware aliases — flipped wholesale by .invert */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: var(--ink-muted);
  --brand: var(--accent);
  --brand-hover: var(--accent-hover);
  --hairline: var(--rule);
  --on-brand: #FFFFFF;

  /* type */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Tracking tightens as size grows — the single biggest lever on how
     expensive large type looks. */
  --display: clamp(3rem, 1.6rem + 7vw, 7.5rem);
  --h2: clamp(2rem, 1.3rem + 3.4vw, 3.75rem);
  --h3: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --lead: clamp(1.375rem, 1rem + 1.9vw, 2.75rem);
  --body: 1.0625rem;
  --small: 0.9375rem;
  --label: 0.6875rem;

  --track-display: -0.045em;
  --track-h2: -0.038em;
  --track-h3: -0.028em;
  --track-lead: -0.024em;
  --track-label: 0.1em;

  --leading-display: 0.9;
  --leading-h2: 1.02;
  --leading-lead: 1.18;
  --leading-body: 1.6;
  --leading-prose: 1.7;
  --measure: 62ch;

  /* space */
  --s1: 0.25rem; --s2: 0.5rem;  --s3: 0.75rem; --s4: 1rem;
  --s6: 1.5rem;  --s8: 2rem;    --s12: 3rem;   --s16: 4rem;
  --s24: 6rem;   --s32: 8rem;

  --radius: 6px;
  --radius-pill: 999px;

  --dur-fast: 180ms;
  --dur: 260ms;
  --dur-slow: 620ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --container: 1240px;
  --gutter: 1.5rem;
  --rhythm: clamp(5rem, 3rem + 8vw, 9rem);
}

/* Inverted sections swap the aliases; every component below reads the alias
   and needs no knowledge of which ground it is sitting on. */
.invert {
  --bg: var(--dark);
  --fg: var(--dark-ink);
  --fg-muted: var(--dark-muted);
  --brand: var(--dark-accent);
  --brand-hover: #C9BCFF;
  --hairline: var(--dark-rule);
  --on-brand: var(--dark-deep);
  background: var(--bg);
  color: var(--fg);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--body);
  font-weight: 400;
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, video { max-width: 100%; display: block; }

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

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

:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

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

.skip-link {
  position: absolute; left: var(--s4); top: -100px; z-index: 300;
  background: var(--accent); color: #fff;
  padding: var(--s3) var(--s4); border-radius: var(--radius);
  font-size: var(--small); font-weight: 500;
}
.skip-link:focus { top: var(--s4); }

/* --------------------------------------------------------------------------
   3. Type
   -------------------------------------------------------------------------- */
.display {
  font-size: var(--display);
  font-weight: 700;
  line-height: var(--leading-display);
  letter-spacing: var(--track-display);
}

h2, .h2 {
  font-size: var(--h2);
  font-weight: 700;
  line-height: var(--leading-h2);
  letter-spacing: var(--track-h2);
}

h3, .h3 {
  font-size: var(--h3);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: var(--track-h3);
}

/* Lead copy is set at display scale, not body scale. */
.lead {
  font-size: var(--lead);
  font-weight: 500;
  line-height: var(--leading-lead);
  letter-spacing: var(--track-lead);
  max-width: 22ch;
}
.lead-wide { max-width: 34ch; }

.prose { max-width: var(--measure); color: var(--fg-muted); }
.prose p + p { margin-top: var(--s4); }
.prose strong { color: var(--fg); font-weight: 500; }

/* Mono earns three jobs only: labels, numerals, and the call to action. */
.label {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--brand);
}
.num {
  font-family: var(--font-mono);
  font-size: var(--label);
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

.section { padding-block: var(--rhythm); scroll-margin-top: 92px; background: var(--bg); color: var(--fg); }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s8) var(--s12);
  align-items: end;
  margin-bottom: var(--s16);
}
.section-head .label { margin-bottom: var(--s3); display: block; }
.section-head p { color: var(--fg-muted); max-width: 46ch; }

.rule { height: 1px; background: var(--hairline); border: 0; }

/* --------------------------------------------------------------------------
   5. Nav
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  top: var(--s4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--s6);
  padding: var(--s2) var(--s2) var(--s2) var(--s6);
  border-radius: var(--radius-pill);
  /* 0.80, not the 0.55 this pattern usually carries. A 55% dark pill works
     over a dark hero photo; over a light ground it composites to mid-grey
     (#787678) and light links land at 2.53:1, which fails AA outright.
     At 0.80 the pill reads #403E44 and links clear 5.49:1 on both grounds. */
  background: rgba(20, 18, 27, 0.8);
  /* saturate is what stops the blur going flat and grey over colour */
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: calc(100vw - 2 * var(--gutter));
}
.nav-name {
  font-size: var(--small);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #F1EFF7;
  white-space: nowrap;
}
.nav-name span { color: var(--dark-accent); }
.nav-links { list-style: none; display: flex; gap: var(--s4); align-items: center; }
.nav-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: rgba(241, 239, 247, 0.7);
  padding: var(--s2) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  white-space: nowrap;
}
.nav-links a:hover { color: #F1EFF7; }
.nav-links a[aria-current="true"] { color: var(--dark-accent); border-bottom-color: var(--dark-accent); }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px;
  padding: var(--s3) var(--s6);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { border-color: var(--hairline); color: var(--fg); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.btn-pill-sm {
  min-height: 34px; padding: var(--s2) var(--s4);
  font-size: 0.625rem;
  background: var(--dark-accent); color: var(--dark-deep);
}
.btn-pill-sm:hover { background: #C9BCFF; }

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-block: 9rem var(--s16);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: var(--s12);
  align-items: end;
  width: 100%;
}
.hero h1 { margin-bottom: var(--s8); }
/* The statement carries the page, but the h1 still has to say who this is —
   a recruiter scanning for ninety seconds should not have to read the nav. */
.hero-name {
  display: block;
  font-size: var(--h3);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink-muted);
  margin-bottom: var(--s4);
}
.hero-h1 .display { display: block; }
/* States the target roles plainly, rather than leaving a recruiter to infer
   them from the project mix. Muted body copy with the role names picked out
   — not accent-coloured, which is already spent on the eyebrow line above. */
.hero-roles {
  margin-top: var(--s4);
  font-size: var(--small);
  color: var(--ink-muted);
}
.hero-roles strong { color: var(--ink); font-weight: 500; }

.hero-meta { display: flex; flex-direction: column; gap: var(--s6); }
.hero-actions { display: flex; gap: var(--s3); flex-wrap: wrap; }

.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.scroll-hint {
  position: absolute; left: var(--gutter); bottom: var(--s6);
  font-family: var(--font-mono); font-size: var(--label);
  text-transform: uppercase; letter-spacing: var(--track-label);
  color: var(--ink-muted);
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-hint { animation: hint 2.6s ease-in-out infinite; }
}
@keyframes hint { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* --------------------------------------------------------------------------
   8. Marquee
   -------------------------------------------------------------------------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--hairline);
  padding-block: var(--s4);
  background: var(--bg);
  color: var(--fg);
}
.marquee-track {
  display: flex;
  width: max-content;
  gap: var(--s8);
  will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
  .marquee-track { animation: slide 46s linear infinite; }
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee-item {
  display: inline-flex; align-items: center; gap: var(--s8);
  font-family: var(--font-mono);
  font-size: var(--label);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--fg-muted);
  white-space: nowrap;
}
.marquee-item::after { content: "◆"; color: var(--brand); font-size: 0.5rem; }

/* --------------------------------------------------------------------------
   8b. Story interlude
   Full-bleed plate between Experience and Work. Text sits above the media,
   never over it — a scrim over moving video is a contrast ratio you cannot
   actually measure, so the problem is designed out rather than mitigated.
   -------------------------------------------------------------------------- */
.story-stage {
  position: relative;
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: var(--dark-deep);
}
.story-stage video,
.story-stage img { width: 100%; height: 100%; object-fit: cover; }
.story-stage video { position: absolute; inset: 0; }
/* fade the plate into the section on all four edges */
.story-stage::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, var(--dark) 0%, rgba(20, 18, 31, 0) 16%,
                    rgba(20, 18, 31, 0) 84%, var(--dark) 100%),
    linear-gradient(to right, var(--dark) 0%, rgba(20, 18, 31, 0) 12%,
                    rgba(20, 18, 31, 0) 88%, var(--dark) 100%);
}

.story-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s6);
  margin-top: var(--s12);
}
.story-strip figure { margin: 0; }
.story-strip .frame {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--dark-deep);
}
.story-strip img { width: 100%; height: 100%; object-fit: cover; }
.story-strip figcaption {
  margin-top: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--label);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--fg-muted);
}
.story-note {
  margin-top: var(--s8);
  font-family: var(--font-mono);
  font-size: var(--label);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--fg-muted);
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   9. Experience
   -------------------------------------------------------------------------- */
.exp-row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) minmax(0, 1.4fr);
  gap: var(--s6) var(--s8);
  padding-block: var(--s8);
  border-top: 1px solid var(--hairline);
  align-items: start;
}
.exp-row:last-child { border-bottom: 1px solid var(--hairline); }
.exp-role { margin-bottom: var(--s2); }
.exp-org { color: var(--fg-muted); font-size: var(--small); }
.exp-body { color: var(--fg-muted); }
.exp-body li { list-style: none; padding-left: var(--s6); position: relative; }
.exp-body li + li { margin-top: var(--s3); }
.exp-body li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 12px; height: 1px; background: var(--brand);
}
.exp-body strong { color: var(--fg); font-weight: 500; }
.exp-link { display: inline-block; margin-top: var(--s4); color: var(--brand); font-weight: 500; font-size: var(--small); }
.exp-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* --------------------------------------------------------------------------
   10. Projects
   -------------------------------------------------------------------------- */
.work-row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: var(--s8);
  padding-block: var(--s12);
  border-top: 1px solid var(--hairline);
  position: relative;
}
.work-row:last-of-type { border-bottom: 1px solid var(--hairline); }
.work-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.work-title { font-size: var(--h2); font-weight: 700; letter-spacing: var(--track-h2); line-height: 1.04; }
.work-title a { transition: color var(--dur) var(--ease); }
.work-row:hover .work-title a { color: var(--brand); }
.work-sub { color: var(--fg-muted); margin-top: var(--s4); max-width: 52ch; }
.work-shot {
  margin-top: var(--s8);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--dark-deep);
  aspect-ratio: 16 / 9;
}
.work-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s6); }
.tags li { font-family: var(--font-mono); font-size: var(--label); color: var(--fg-muted); }
.work-links { display: flex; gap: var(--s6); margin-top: var(--s6); }
.work-links a { font-family: var(--font-mono); font-size: var(--label); text-transform: uppercase; letter-spacing: var(--track-label); color: var(--brand); }
.work-links a:hover { text-decoration: underline; text-underline-offset: 4px; }

.minor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s8) var(--s6); margin-top: var(--s16); }
.minor { border-top: 1px solid var(--hairline); padding-top: var(--s4); }
.minor h4 { font-size: var(--h3); font-weight: 700; letter-spacing: var(--track-h3); margin-bottom: var(--s2); }
.minor h4 a:hover { color: var(--brand); }
.minor p { color: var(--fg-muted); font-size: var(--small); }

/* --------------------------------------------------------------------------
   11. Capability list
   -------------------------------------------------------------------------- */
/* Four groups (Full Stack / AI / Cloud & DevOps / Service Management) rather
   than one flat list — the count of sixteen was never the point, being able
   to scan by category is. Numbering restarts per group: it now encodes
   position within a category, not an arbitrary total. */
.cap-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s12) var(--s16); }
.cap-group-title {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--brand);
  margin-bottom: var(--s3);
}
.cap-list { display: flex; flex-direction: column; }
.cap {
  display: flex; align-items: baseline; gap: var(--s4);
  padding-block: var(--s3);
  border-bottom: 1px solid var(--hairline);
}
.cap-name { font-weight: 500; letter-spacing: -0.015em; }
.cap-dots { flex: 1; border-bottom: 1px dotted var(--hairline); transform: translateY(-4px); }

/* --------------------------------------------------------------------------
   12. Cards (design + certifications)
   -------------------------------------------------------------------------- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); }
.card {
  padding: var(--s6);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--brand); transform: translateY(-3px); }
.card h3 { font-size: var(--h3); font-weight: 700; letter-spacing: var(--track-h3); margin-bottom: var(--s3); }
.card p { color: var(--fg-muted); font-size: var(--small); }
.card p + p { margin-top: var(--s3); }
.card-note {
  display: inline-block; margin-top: var(--s4);
  font-family: var(--font-mono); font-size: var(--label);
  text-transform: uppercase; letter-spacing: var(--track-label);
  color: var(--fg-muted);
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  padding: var(--s1) var(--s3);
}
.card-links { margin-top: var(--s6); display: flex; flex-wrap: wrap; gap: var(--s4); }
.card-links a { font-family: var(--font-mono); font-size: var(--label); text-transform: uppercase; letter-spacing: var(--track-label); color: var(--brand); }
.card-wide { grid-column: 1 / -1; }

.cert-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s6); }
.cert { border-top: 1px solid var(--hairline); padding-top: var(--s4); }
.cert h3 { font-size: var(--small); font-weight: 700; letter-spacing: -0.02em; margin-bottom: var(--s1); }
.cert p { font-size: var(--label); color: var(--fg-muted); font-family: var(--font-mono); }
.cert-flag h3 { color: var(--brand); }

/* --------------------------------------------------------------------------
   13. Contact + footer
   -------------------------------------------------------------------------- */
.contact-actions { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s12); }

.site-footer { padding-block: var(--s12); background: var(--bg); color: var(--fg); border-top: 1px solid var(--hairline); }
.site-footer .container { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.site-footer p { font-family: var(--font-mono); font-size: var(--label); text-transform: uppercase; letter-spacing: var(--track-label); color: var(--fg-muted); }

/* --------------------------------------------------------------------------
   13b. Case studies
   The index ground is already the reading surface, so these pages inherit it
   and only add long-form typography. Measure is non-negotiable here.
   -------------------------------------------------------------------------- */
.study-header { padding-block: 9rem var(--s12); }
.study-kicker {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--accent);
  margin-bottom: var(--s4);
}
.study-header h1 {
  font-size: clamp(2.5rem, 1.6rem + 4.6vw, 5.5rem);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: var(--track-display);
  max-width: 18ch;
  margin-bottom: var(--s8);
}
.study-standfirst {
  font-size: var(--lead);
  font-weight: 500;
  line-height: var(--leading-lead);
  letter-spacing: var(--track-lead);
  max-width: 30ch;
  color: var(--ink);
}

.study-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--s8);
  margin-top: var(--s16);
  padding-block: var(--s6);
  border-block: 1px solid var(--rule);
}
.study-facts dt {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--accent);
  margin-bottom: var(--s2);
}
.study-facts dd { font-size: var(--small); color: var(--ink-muted); }
.study-facts a { color: var(--accent); }
.study-facts a:hover { text-decoration: underline; text-underline-offset: 3px; }

.study-body { padding-bottom: var(--s32); }
.study-body > * { max-width: var(--measure); }
.study-body h2 {
  font-size: var(--h2);
  margin-top: var(--s24);
  margin-bottom: var(--s6);
}
.study-body > *:first-child { margin-top: var(--s8); }
.study-body h3 {
  font-size: var(--h3);
  margin-top: var(--s12);
  margin-bottom: var(--s3);
}
.study-body p { line-height: var(--leading-prose); color: var(--ink-muted); }
.study-body p + p { margin-top: var(--s4); }
.study-body strong { color: var(--ink); font-weight: 500; }
.study-body a { color: var(--accent); }
.study-body a:hover { text-decoration: underline; text-underline-offset: 3px; }
.study-body ul, .study-body ol { margin-top: var(--s4); padding-left: var(--s6); color: var(--ink-muted); }
.study-body li { line-height: var(--leading-prose); }
.study-body li + li { margin-top: var(--s2); }
.study-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--paper-raised);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.study-body pre {
  margin-top: var(--s4);
  padding: var(--s4);
  background: var(--dark);
  color: var(--dark-ink);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  max-width: var(--measure);
}
.study-body pre code { background: none; padding: 0; }
.study-body blockquote {
  margin-top: var(--s6);
  padding-left: var(--s6);
  border-left: 2px solid var(--accent);
  color: var(--ink-muted);
  font-style: italic;
}
.study-nav {
  max-width: none;
  margin-top: var(--s24);
  padding-top: var(--s8);
  border-top: 1px solid var(--rule);
  display: flex; gap: var(--s8); flex-wrap: wrap;
}
.study-nav a {
  font-family: var(--font-mono);
  font-size: var(--label);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--accent);
}
.study-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* --------------------------------------------------------------------------
   14. Scroll progress
   -------------------------------------------------------------------------- */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 250; background: transparent;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transform-origin: left;
}

/* --------------------------------------------------------------------------
   15. Motion — per-word reveal
   Splitting.js behaviour without the dependency: words are wrapped in a
   masked span and rise into view on a stagger.
   -------------------------------------------------------------------------- */
.js .reveal-word { display: inline-block; overflow: hidden; vertical-align: top; }
.js .reveal-word > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform var(--dur-slow) var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .is-in .reveal-word > span { transform: translateY(0); }

.js .rise {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--d, 0ms);
}
.js .rise.is-in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .minor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; gap: var(--s16); }
  .portrait { max-width: 22rem; }
  .section-head { grid-template-columns: 1fr; align-items: start; gap: var(--s6); }
}

@media (max-width: 720px) {
  :root { --gutter: 1.25rem; }
  .nav { gap: var(--s3); padding-left: var(--s4); top: var(--s2); }
  .nav-name { font-size: 0.8125rem; }
  /* A flex item will not shrink below its content unless told to, which is
     what pushes the CTA off the pill at narrow widths. */
  .nav > nav { min-width: 0; }
  .nav-name, .nav .btn-pill-sm { flex: 0 0 auto; }
  .nav-links { gap: var(--s3); overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .exp-row { grid-template-columns: 1fr; gap: var(--s4); }
  .work-row { grid-template-columns: 1fr; gap: var(--s4); }
  .cap-groups { grid-template-columns: 1fr; gap: var(--s8); }
  .card-grid, .minor-grid, .cert-grid { grid-template-columns: 1fr; }
  .lead { max-width: none; }
  .hero { min-height: auto; padding-block: 8rem var(--s12); }
  .scroll-hint { display: none; }
  .contact-actions .btn, .hero-actions .btn { flex: 1 1 100%; }
}

/* --------------------------------------------------------------------------
   17. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .js .reveal-word > span { transform: none !important; }
  .js .rise { opacity: 1 !important; transform: none !important; }
  .marquee-track { animation: none !important; }
}
