/* UziTech portfolio
   Idea: three-phase wiring. Red, yellow and blue conductors stand for the three
   layers of Uzair's work (Power, Network, Intelligence). Motion is "current":
   things energise, pulse and scan. All motion is switched off for visitors who
   ask their device to reduce motion. */

/* ---------- Tokens ---------- */
:root {
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: #d64541;
  --y: #e3b23c;
  --b: #3b7dd8;
  --radius-s: 4px;
  --radius-m: 12px;
  --wrap: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
[data-theme="dark"] {
  --bg: #17212b;
  --bg-raised: #1d2935;
  --bg-band: #131c25;
  --ink: #e9edf1;
  --ink-soft: #a9b5c0;
  --rule: #2f3e4c;
  --accent-text: #f0c35a;
  --r-text: #ef6b67;
  --b-text: #7aa9ec;
  --focus: #f0c35a;
  --grid-dot: rgba(233, 237, 241, .09);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);
}
[data-theme="light"] {
  --bg: #eef1f4;
  --bg-raised: #ffffff;
  --bg-band: #e3e8ed;
  --ink: #16202a;
  --ink-soft: #4d5b68;
  --rule: #cbd3db;
  --accent-text: #8a6100;
  --r-text: #b3302c;
  --b-text: #2560b3;
  --focus: #2560b3;
  --grid-dot: rgba(22, 32, 42, .1);
  --shadow: 0 18px 40px -20px rgba(22, 32, 42, .3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.6;
  transition: background-color .3s, color .3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; font-weight: 700; }
p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
@media (min-width: 900px) { /* quieter behind the reading column, livelier in the margins */
  .bg-canvas {
    -webkit-mask-image: linear-gradient(90deg, #000 0, rgba(0,0,0,.4) 22%, rgba(0,0,0,.4) 78%, #000 100%);
            mask-image: linear-gradient(90deg, #000 0, rgba(0,0,0,.4) 22%, rgba(0,0,0,.4) 78%, #000 100%);
  }
}
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 20; background: var(--ink); color: var(--bg); padding: .5rem .9rem; border-radius: var(--radius-s); }
.skip:focus { top: 1rem; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav__inner { display: flex; align-items: center; gap: 1.25rem; height: 3.75rem; }
.wordmark { font-variation-settings: "wdth" 125; font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -.01em; }
.wordmark span { color: var(--accent-text); }
.nav__inner > nav { margin-left: auto; }
.nav__links { display: flex; gap: 1.1rem; list-style: none; }
.nav__links a { text-decoration: none; color: var(--ink-soft); font-size: .9rem; position: relative; padding: .3rem 0; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; border-radius: 2px;
  background: var(--accent-text); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav__links a:hover, .nav__links a[aria-current="true"] { color: var(--ink); }
.nav__links a:hover::after, .nav__links a[aria-current="true"]::after { transform: scaleX(1); }
.menu-btn { display: none; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: .5rem; flex: none;
  background: none; border: 1px solid var(--rule); border-radius: 999px;
  color: var(--ink-soft); font: inherit; font-size: .85rem; padding: .3rem .7rem .3rem .4rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-soft); }
.theme-toggle__track { width: 1.9rem; height: 1.05rem; border-radius: 999px; background: var(--rule); position: relative; }
.theme-toggle__knob { position: absolute; top: .15rem; left: .15rem; width: .75rem; height: .75rem; border-radius: 50%; background: var(--accent-text); transition: transform .3s var(--ease); }
[data-theme="light"] .theme-toggle__knob { transform: translateX(.85rem); }

/* scroll progress: the three phases in sequence */
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress span {
  display: block; height: 100%; transform-origin: left; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--r), var(--y) 50%, var(--b));
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; min-height: 2.9rem; padding: 0 1.3rem;
  border-radius: var(--radius-s); font-weight: 600; font-size: .98rem; text-decoration: none;
  border: 1px solid transparent; position: relative; overflow: hidden;
  transition: transform .2s var(--ease), background-color .2s, color .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary::before {
  content: ""; position: absolute; inset: 0; transform: translateX(-110%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transition: transform .6s var(--ease);
}
.btn--primary:hover::before { transform: translateX(110%); }
.btn--ghost { border-color: var(--rule); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-soft); }
.btn--big { min-height: 3.4rem; padding: 0 1.8rem; font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem); overflow: hidden; }
.hero__grid-bg {
  position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(circle, var(--grid-dot) 1.2px, transparent 1.3px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 75% 40%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 70% at 75% 40%, #000 20%, transparent 75%);
}
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }

.status-pill {
  display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 1.5rem;
  padding: .35rem .85rem .35rem .65rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--bg-raised); color: var(--ink-soft); font-size: .88rem;
}
.status-pill__dot { width: .55rem; height: .55rem; border-radius: 50%; background: #3fbf7f; box-shadow: 0 0 0 0 rgba(63,191,127,.6); }

h1 { font-size: clamp(3rem, 8vw, 6.2rem); font-variation-settings: "wdth" 118; font-weight: 800; letter-spacing: -.025em; line-height: .92; }
.reveal-name__line { display: block; overflow: hidden; padding-bottom: .04em; }
.reveal-name__line > span { display: inline-block; }
.reveal-name__line:nth-child(2) > span { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }

.hero__role { margin-top: 1.25rem; font-size: clamp(1.1rem, 2vw, 1.35rem); font-variation-settings: "wdth" 88; font-weight: 600; }
.hero__vision { margin-top: 1.25rem; max-width: 30ch; font-size: clamp(1.3rem, 2.5vw, 1.75rem); line-height: 1.28; color: var(--ink-soft); }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* Portrait with a rotating three-phase ring */
.portrait-wrap { position: relative; width: clamp(13rem, 26vw, 20rem); aspect-ratio: 1; display: grid; place-items: center; }
.portrait-glow {
  position: absolute; inset: 8%; border-radius: 50%; filter: blur(42px); opacity: .45;
  background: conic-gradient(from 0deg, var(--r), var(--y), var(--b), var(--r));
}
.portrait-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--r) 0 30%, transparent 30% 33.3%, var(--y) 33.3% 63.3%, transparent 63.3% 66.6%, var(--b) 66.6% 96.6%, transparent 96.6%);
  -webkit-mask: radial-gradient(circle, transparent calc(70.5% - 4px), #000 calc(70.5% - 3px));
          mask: radial-gradient(circle, transparent calc(70.5% - 4px), #000 calc(70.5% - 3px));
}
.portrait {
  margin: 0; position: relative; width: 86%; aspect-ratio: 1; border-radius: 50%;
  background: var(--bg-raised); overflow: hidden; display: grid; place-items: center;
  box-shadow: 0 0 0 6px var(--bg);
}
.portrait picture, .portrait img { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait img { object-fit: cover; }
.portrait img.is-missing { display: none; }
.portrait__monogram { font-size: clamp(3rem, 6vw, 4.5rem); font-weight: 800; font-variation-settings: "wdth" 125; color: var(--ink-soft); }

/* Three-phase band */
.phases { list-style: none; margin: clamp(3rem, 7vw, 4.5rem) 0 0; display: grid; gap: .9rem; }
.phase { display: grid; grid-template-columns: minmax(3rem, 1fr) 25rem; align-items: center; gap: 1rem; }
.phase__line { height: 3px; border-radius: 2px; background: var(--c); position: relative; transform-origin: left center; }
.phase__line::after {
  content: ""; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%);
  border-radius: 50%; border: 3px solid var(--c); background: var(--bg);
}
.phase__pulse {
  position: absolute; top: 50%; left: 0; width: 46px; height: 7px; transform: translate(-50%, -50%);
  border-radius: 7px; opacity: 0;
  background: radial-gradient(ellipse at center, #fff 0 20%, var(--c) 45%, transparent 72%);
  filter: blur(.5px);
}
.phase__label { text-decoration: none; color: var(--ink-soft); font-size: .98rem; padding-left: .5rem; }
.phase__label strong { display: inline-block; min-width: 6.5rem; color: var(--ink); font-variation-settings: "wdth" 110; font-weight: 700; }
.phase__label:hover strong { text-decoration: underline; }
.phase--r { --c: var(--r); }
.phase--y { --c: var(--y); }
.phase--b { --c: var(--b); }

/* ---------- Stats ---------- */
.stats { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--bg-band) 82%, transparent); }
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 1.9rem 1.25rem 1.9rem 0; }
.stat + .stat { padding-left: 1.5rem; border-left: 1px solid var(--rule); }
.stat__num { font-size: clamp(2.2rem, 4.5vw, 3.2rem); font-weight: 800; font-variation-settings: "wdth" 115; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__num small { font-size: .42em; font-weight: 600; margin-left: .15em; color: var(--ink-soft); }
.stat__label { margin-top: .5rem; color: var(--ink-soft); font-size: .93rem; max-width: 22ch; }

/* ---------- Sections ---------- */
.section { padding: clamp(4rem, 9vw, 6.5rem) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section--band { background: color-mix(in srgb, var(--bg-band) 82%, transparent); }
h2 { font-size: clamp(2rem, 4.4vw, 3rem); font-variation-settings: "wdth" 112; font-weight: 800; letter-spacing: -.02em; }
.section__lede { margin-top: .9rem; max-width: 60ch; color: var(--ink-soft); }
.subhead { margin-top: 4rem; font-size: 1.5rem; font-variation-settings: "wdth" 110; }

/* Shared card with a cursor-following glow */
.card {
  position: relative; background: var(--bg-raised); border: 1px solid var(--rule); border-radius: var(--radius-m);
  padding: 1.4rem 1.5rem 1.5rem; isolation: isolate;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; opacity: 0; transition: opacity .3s;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--c, var(--y)) 16%, transparent), transparent 65%);
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--c, var(--y)) 55%, var(--rule)); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.about__lead { margin-top: 1.25rem; font-size: clamp(1.2rem, 2.2vw, 1.45rem); line-height: 1.4; max-width: 38ch; }
.about__body { margin-top: 1rem; color: var(--ink-soft); max-width: 60ch; }
.facts { display: grid; border-top: 1px solid var(--rule); margin-top: .5rem; }
.facts div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-soft); font-size: .9rem; font-variation-settings: "wdth" 85; }
.facts dd { font-weight: 500; }

/* Expertise */
.group { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 2rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 3px solid var(--c); }
.group--r { --c: var(--r); --c-text: var(--r-text); }
.group--y { --c: var(--y); --c-text: var(--accent-text); }
.group--b { --c: var(--b); --c-text: var(--b-text); }
.group__name { font-size: 1.15rem; font-variation-settings: "wdth" 110; color: var(--c-text); }
.group__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1.25rem; }
.skill h4, .field h4 { font-size: 1.15rem; font-variation-settings: "wdth" 96; font-weight: 700; }
.skill p, .field p { margin-top: .5rem; color: var(--ink-soft); max-width: 46ch; }
.skill .skill__tools, .field .skill__tools { color: var(--ink); font-size: .9rem; font-variation-settings: "wdth" 82; font-weight: 500; }
.skill .skill__proof { font-size: .9rem; }
.skill__proof a { color: var(--ink); }

/* Experience */
.job { margin-top: 2.5rem; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--bg-raised); overflow: hidden; }
.job__head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding: 1.6rem 1.75rem; border-bottom: 1px solid var(--rule); }
.job__head h3 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-variation-settings: "wdth" 105; }
.job__org { margin-top: .35rem; color: var(--accent-text); font-weight: 600; }
.job__dates { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.job__dates span { font-weight: 400; color: var(--ink-soft); font-size: .92rem; }
.job__project { padding: 1.6rem 1.75rem 1.75rem; }
.job__project h4 { font-size: 1.15rem; }
.job__project > p { margin-top: .6rem; color: var(--ink-soft); max-width: 70ch; }
.figures { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.figures li { padding: 1rem 1.1rem; border-radius: var(--radius-s); background: var(--bg-band); border-left: 3px solid var(--y); }
.figures strong { display: block; font-size: 1.6rem; font-variation-settings: "wdth" 112; font-weight: 800; line-height: 1.1; }
.figures span { display: block; margin-top: .3rem; color: var(--ink-soft); font-size: .9rem; }
.job__project .source { margin-top: .9rem; color: var(--ink-soft); font-size: .82rem; }

/* Projects: featured PCB */
.feature { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); margin-top: 2.5rem; align-items: center; }
.pcb { width: 100%; height: auto; display: block; border-radius: 14px; box-shadow: var(--shadow); }
.pcb__board { fill: #123a2c; }
.pcb__traces path { fill: none; stroke: #c9a24a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.pcb__parts rect { fill: #0b1712; stroke: #2a5a47; stroke-width: 1.5; }
.pcb__pads circle { fill: #d9b45a; }
.pcb__box rect { fill: none; stroke: var(--r); stroke-width: 2.5; }
.pcb__box text { fill: #fff; font: 600 12px var(--font); paint-order: stroke; stroke: var(--r); stroke-width: 4px; }
.pcb__scan { fill: #7fe0ff; opacity: .9; }
.feature__caption { margin-top: .7rem; color: var(--ink-soft); font-size: .82rem; }
.feature__kicker { color: var(--b-text); font-weight: 600; font-size: .95rem; }
.feature__body h3 { margin-top: .4rem; font-size: clamp(1.5rem, 3vw, 2.1rem); font-variation-settings: "wdth" 108; letter-spacing: -.01em; }
.feature__body > p:not(.feature__kicker) { margin-top: .9rem; color: var(--ink-soft); }
.figures--compact { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.figures--compact li { border-left-color: var(--b); padding: .75rem .9rem; }
.figures--compact strong { font-size: 1.35rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.1rem; }
.chips li { font-size: .82rem; padding: .25rem .6rem; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-soft); }
.feature__body .feature__team { font-size: .88rem; }

.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; margin-top: 2.5rem; }
.project h3 { font-size: 1.25rem; }
.project p { margin-top: .5rem; color: var(--ink-soft); }
.project a { display: inline-block; margin-top: .9rem; font-weight: 600; }
.project__status { display: inline-block; margin-top: .9rem; font-size: .82rem; font-weight: 600; color: var(--accent-text); border: 1px solid currentColor; border-radius: var(--radius-s); padding: .1rem .5rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.25rem; margin-top: 1.75rem; }
.field { --c: var(--r); }

/* Services */
.services { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-top: 2.5rem; }
.service { position: relative; padding: 1.5rem 0 0; }
.service__bar { position: absolute; top: 0; left: 0; height: 3px; width: 2.5rem; border-radius: 2px; transition: width .5s var(--ease); }
.service:hover .service__bar { width: 100%; }
.service__bar--y { background: var(--y); }
.service__bar--r { background: var(--r); }
.service h3 { font-size: 1.15rem; }
.service p { margin-top: .5rem; color: var(--ink-soft); }
.services__cta { margin-top: 2.5rem; }

/* Certifications */
.filter { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.filter__btn {
  font: inherit; font-size: .93rem; cursor: pointer; background: none; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: var(--radius-s); padding: .45rem .85rem;
  transition: background-color .2s, color .2s, border-color .2s;
}
.filter__btn span { margin-left: .3rem; font-variation-settings: "wdth" 80; }
.filter__btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.filter__btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.certs { width: 100%; margin-top: 1.5rem; border-collapse: collapse; font-size: .97rem; }
.certs thead th { text-align: left; font-weight: 600; font-size: .85rem; color: var(--ink-soft); font-variation-settings: "wdth" 85; padding: 0 1rem .6rem 0; border-bottom: 1px solid var(--ink-soft); }
.certs tbody th, .certs td { padding: .8rem 1rem .8rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; text-align: left; }
.certs tbody tr { transition: background-color .2s; }
.certs tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.certs tbody th { font-weight: 600; }
.certs td { color: var(--ink-soft); white-space: nowrap; }
.certs td:last-child { text-align: right; padding-right: .25rem; }
.certs td a { color: var(--ink); font-weight: 600; }
.certs__note { color: var(--ink-soft); font-size: .9rem; }
.certs tr[hidden] { display: none; }
.certs tr.is-entering { animation: row-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.status { display: inline-block; margin-left: .45rem; padding: .05rem .45rem; border-radius: var(--radius-s); font-size: .78rem; font-weight: 600; border: 1px solid currentColor; vertical-align: .1em; }
.status--soon { color: var(--accent-text); }
.status--expired { color: var(--r-text); }
.certs__footnote { margin-top: 1.5rem; color: var(--ink-soft); font-size: .95rem; }

/* Leadership */
.leadership { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.leadership__intro { position: sticky; top: 6rem; }
.awards { list-style: none; margin-top: 2rem; display: grid; gap: .75rem; }
.awards li { display: flex; flex-direction: column; padding: 1rem 1.2rem; border-radius: var(--radius-s); background: var(--bg-raised); border: 1px solid var(--rule); border-left: 3px solid var(--y); }
.awards strong { font-size: 1.05rem; }
.awards span { color: var(--ink-soft); font-size: .9rem; }
.timeline { list-style: none; position: relative; padding-left: 2rem; }
.timeline::before { content: ""; position: absolute; left: 6px; top: .5rem; bottom: .5rem; width: 2px; background: var(--rule); }
.timeline::after {
  content: ""; position: absolute; left: 6px; top: .5rem; width: 2px; height: calc((100% - 1rem) * var(--fill, 0));
  background: linear-gradient(var(--r), var(--y), var(--b)); border-radius: 2px;
}
.timeline li { position: relative; padding-bottom: 2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-2rem + 1px); top: .35rem; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink-soft); z-index: 1; transition: border-color .4s, background-color .4s;
}
.timeline li.is-visible::before { border-color: var(--y); background: var(--y); }
.timeline__when { color: var(--ink-soft); font-size: .88rem; font-variant-numeric: tabular-nums; }
.timeline h3 { margin-top: .2rem; font-size: 1.15rem; }
.timeline li > p:last-child:not(.timeline__when) { margin-top: .35rem; color: var(--ink-soft); max-width: 55ch; }

/* Contact */
.contact { position: relative; overflow: hidden; isolation: isolate; text-align: center; }
.contact::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 46rem; height: 46rem; transform: translate(-50%, -50%);
  border-radius: 50%; z-index: -1; opacity: .16; filter: blur(70px);
  background: conic-gradient(from 90deg, var(--r), var(--y), var(--b), var(--r));
}
.contact__inner h2 { font-size: clamp(2.4rem, 6vw, 4rem); }
.contact__inner > p { margin: 1rem auto 0; max-width: 46ch; color: var(--ink-soft); }
.contact__inner > .contact__actions { margin-top: 2rem; }

/* Footer */
.footer { border-top: 1px solid var(--rule); padding: 2rem 0; color: var(--ink-soft); font-size: .9rem; }
.footer__inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ================= Motion (only when allowed) ================= */
@media (prefers-reduced-motion: no-preference) {
  .reveal-name__line > span { animation: rise .9s var(--ease) both; }
  .reveal-name__line:nth-child(2) > span { animation-delay: .12s; }
  @keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
  .hero__role, .hero__vision, .hero__actions, .status-pill { animation: fade-up .8s var(--ease) both; }
  .status-pill { animation-delay: .05s; }
  .hero__role { animation-delay: .3s; }
  .hero__vision { animation-delay: .4s; }
  .hero__actions { animation-delay: .5s; }
  .portrait-wrap { animation: fade-in 1.2s var(--ease) .2s both; }
  @keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes fade-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

  .status-pill__dot { animation: breathe 2.2s ease-out infinite; }
  @keyframes breathe { 0% { box-shadow: 0 0 0 0 rgba(63,191,127,.6); } 80%, 100% { box-shadow: 0 0 0 8px rgba(63,191,127,0); } }

  .portrait-ring { animation: spin 24s linear infinite; }
  .portrait-glow { animation: spin 18s linear infinite reverse; }
  @keyframes spin { to { transform: rotate(360deg); } }

  .phase__line { animation: energise 1s var(--ease) .6s both; }
  .phase--y .phase__line { animation-delay: .72s; }
  .phase--b .phase__line { animation-delay: .84s; }
  @keyframes energise { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .phase__pulse { animation: current 3.2s cubic-bezier(.5, 0, .5, 1) 1.7s infinite; }
  .phase--y .phase__pulse { animation-delay: 2.3s; }
  .phase--b .phase__pulse { animation-delay: 2.9s; }
  @keyframes current { 0% { left: 0; opacity: 0; } 10% { opacity: 1; } 85% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

  .pcb__scan { animation: scan 5s linear infinite; }
  @keyframes scan { from { transform: translateY(0); } to { transform: translateY(297px); } }
  .pcb__box { opacity: 0; }
  .pcb__box--1 { animation: detect1 5s linear infinite; }
  .pcb__box--2 { animation: detect2 5s linear infinite; }
  .pcb__box--3 { animation: detect3 5s linear infinite; }
  @keyframes detect1 { 0%, 9% { opacity: 0; } 11%, 92% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes detect2 { 0%, 39% { opacity: 0; } 41%, 92% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes detect3 { 0%, 85% { opacity: 0; } 87%, 92% { opacity: 1; } 100% { opacity: 0; } }

  .js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
  .js [data-reveal].is-visible { opacity: 1; transform: none; }
}

/* ================= Responsive ================= */
@media (max-width: 1000px) {
  .menu-btn {
    display: inline-flex; margin-left: auto; font: inherit; font-size: .9rem; cursor: pointer;
    background: none; color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: .35rem .8rem;
  }
  .nav__inner > nav { margin-left: 0; }
  .nav__links {
    position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule); padding: .5rem var(--gutter) 1rem;
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { display: block; padding: .7rem 0; font-size: 1rem; border-bottom: 1px solid var(--rule); }
  .nav__links a::after { display: none; }
  .services { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .portrait-wrap { order: -1; width: 11rem; }
  .group, .about, .leadership, .feature { grid-template-columns: 1fr; }
  .group { gap: 1.25rem; }
  .leadership__intro { position: static; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .figures { grid-template-columns: 1fr; }
  .figures--compact { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .theme-toggle__text { display: none; }
  .theme-toggle { padding: .35rem .45rem; }
  .phase { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .phase__label strong { display: block; min-width: 0; }
  .projects-grid, .services { grid-template-columns: 1fr; }
  .job__dates { text-align: left; }
  .facts div { grid-template-columns: 6rem 1fr; }

  .certs thead { display: none; }
  .certs, .certs tbody, .certs tr { display: block; }
  .certs tr { padding: .9rem 0; border-bottom: 1px solid var(--rule); }
  .certs tbody th { display: block; padding: 0; border: 0; }
  .certs td { display: inline; padding: 0; border: 0; font-size: .9rem; white-space: normal; }
  .certs td:nth-child(2)::after { content: ", "; }
  .certs td:nth-child(3)::before { content: "issued "; }
  .certs tr[data-expires] td:nth-child(3)::after { content: ", "; }
  .certs tr[data-expires] td:nth-child(4)::before { content: "valid until "; }
  .certs tr:not([data-expires]) td:nth-child(4) { display: none; }
  .certs td:last-child { display: block; text-align: left; margin-top: .35rem; }
}
