:root {
  --ground: #f4f4f2;
  --paper: #ffffff;
  --ink: #16181d;
  --text: #3d4047;
  --muted: #6b6e76;
  --hairline: #ecece8;
  --chip: #f4f4f2;
  --text-soft: #5b5e66;
  --line-strong: #d9d9d4;
  --panel-line: #e6e6e2;
  --tile: #e9e9e5;
  --surface: #ffffff;
  --shadow-soft: rgba(20, 30, 60, 0.12);
  --mock-rings: #eef0f6;
  --mock-rulebook: #e9ecf2;
  --mock-media: #eef2ef;
  --mock-line: #e4e6ea;
  --mock-chip: #f1f2f4;
  --tag-bg: #e5efe9;
  --tag-fg: #1d5c3d;
  --btn-dark-bg: #121316;
  --btn-dark-fg: #f2f2ef;
  --btn-dark-hover: #000000;

  --card: #121316;
  --card-raised: #1c1e23;
  --card-button: #22242a;
  --card-line: #34373e;
  --card-ink: #f2f2ef;
  --card-muted: #9a9ea7;

  --red: #c8102e;
  --blue: #1f3a93;
  --green: #3ecf8e;

  --display: "Urbanist", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 12px;
  --gap: 20px;
  --pad: clamp(24px, 5vw, 64px);

  color-scheme: light;
}

/* Dark theme: set on <html data-theme="dark"> from the saved choice, else the system setting; light when neither says dark */
:root[data-theme="dark"] {
  --ground: #0b0c0e;
  --paper: #141518;
  --ink: #ecebe7;
  --text: #c6c8cd;
  --muted: #979ba4;
  --hairline: #25272c;
  --chip: #1f2126;
  --text-soft: #a8abb2;
  --line-strong: #34373e;
  --panel-line: #212328;
  --tile: #1f2126;
  --surface: #1c1e22;
  --shadow-soft: rgba(0, 0, 0, 0.45);
  --mock-rings: #191c26;
  --mock-rulebook: #181b22;
  --mock-media: #161c19;
  --mock-line: #2e3138;
  --mock-chip: #26292f;
  --tag-bg: #1d3328;
  --tag-fg: #8fd4ae;
  --btn-dark-bg: #ecebe7;
  --btn-dark-fg: #121316;
  --btn-dark-hover: #ffffff;
  --card: #18191d;
  --card-raised: #222429;
  --card-button: #26282e;
  --blue: #6f8fe0;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  transition: background-color 300ms ease, color 300ms ease;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
}

a { color: var(--ink); text-underline-offset: 0.2em; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, p { margin: 0; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--paper);
}
.skip:focus { top: 16px; }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: clamp(320px, 22vw, 400px) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  max-width: 1920px;
  margin: 0 auto;
  padding: var(--gap);
}

/* ---------- Profile card ---------- */

.card {
  position: sticky;
  top: var(--gap);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2 * var(--gap));
  max-height: calc(100dvh - 2 * var(--gap));
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--card-ink);
  box-shadow: 0 20px 50px rgba(18, 19, 22, 0.18);
  scrollbar-width: none;
}

.card-photo {
  position: relative;
  flex: 0 1 auto;
  aspect-ratio: 4 / 5;
  min-height: 180px;
  overflow: hidden;
  background: linear-gradient(160deg, #2a2d34, var(--card));
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { display: flex; flex-direction: column; gap: 16px; flex: 0 0 auto; padding: 28px 22px 22px; }

.card-name { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 5px 12px; border-radius: 999px;
  background: var(--card-button); color: #c9cbd1; font-size: 13px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* ---------- Circuit nav ---------- */

.circuit-nav { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; border-top: 1px dashed var(--card-line); }

.circuit { position: relative; width: 100%; aspect-ratio: 1200 / 560; }
.circuit svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.track-bed { fill: none; stroke: #24272e; stroke-width: 46; stroke-linejoin: round; }
.track-line { fill: none; stroke: #5b5f69; stroke-width: 5; stroke-linejoin: round; }
.start-line { fill: #8b8f99; }
.car { fill: var(--red); }

.turn {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  text-decoration: none;
  border-radius: 50%;
}
.turn span {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--card-ink);
  background: var(--card);
  color: var(--card-ink);
  font-size: 11px; font-weight: 700;
  transition: background-color 200ms ease, transform 200ms ease;
}
.turn:hover span { transform: scale(1.12); }
.turn.is-active span { background: var(--red); border-color: var(--red); }
.turn:focus-visible { outline-color: var(--card-ink); }

.turn-label { display: flex; align-items: baseline; gap: 10px; min-height: 22px; font-size: 15px; }
.turn-num { font-size: 12px; color: #8b8f99; font-variant-numeric: tabular-nums; }
.turn-name { color: var(--card-ink); font-weight: 600; }

.card-actions { display: flex; gap: 8px; }
.icon-btn, .email-btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; border-radius: var(--radius-sm); text-decoration: none;
}
.icon-btn { flex: 1; background: var(--card-button); color: var(--card-ink); }
.icon-btn:hover { color: var(--card-ink); background: #2c2f36; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.email-btn { flex: 2.2; background: var(--card-ink); color: var(--card); font-weight: 700; font-size: 15px; }
.email-btn:hover { color: var(--card); background: #ffffff; }
.card a:focus-visible { outline-color: var(--card-ink); }

/* ---------- Main panel ---------- */

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 28px; }
.pill { padding: 8px 14px; border-radius: 999px; background: var(--chip); font-size: 14px; }
.pill-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; transition: background-color 200ms ease, color 200ms ease; }
.pill-link:hover { background: var(--btn-dark-bg); color: var(--btn-dark-fg); }
.pill-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between;
  width: 72px; height: 38px; padding: 0 10px;
  border: 0; border-radius: 999px; background: var(--chip); color: var(--muted); cursor: pointer;
}
.theme-switch svg { position: relative; z-index: 1; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: color 250ms ease; }
.theme-switch .knob {
  position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--paper); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.theme-switch .sun { color: var(--ink); }
.theme-switch[aria-checked="true"] .knob { transform: translateX(34px); background: #3b3e46; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.theme-switch[aria-checked="true"] .sun { color: var(--muted); }
.theme-switch[aria-checked="true"] .moon { color: #f2f2ef; }
.local-time time { font-variant-numeric: tabular-nums; }
.based { text-align: right; font-size: 13px; line-height: 1.3; color: var(--muted); }
.based strong { color: var(--ink); }

section { scroll-margin-top: var(--gap); }

/* hero */
.hero {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  padding: clamp(80px, 12vw, 140px) var(--pad) clamp(64px, 9vw, 110px);
  text-align: center;
}
.hero h1 {
  font-family: var(--display); font-weight: 300;
  font-size: clamp(56px, 9vw, 112px); line-height: 1; letter-spacing: -0.04em;
  text-wrap: balance;
}
.intro { max-width: 48ch; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.6; color: var(--text-soft); }

/* gallery */
.gallery-wrap { position: relative; }
.gallery-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 var(--pad) 24px; }
.gallery-nav h2 { font-family: var(--display); font-weight: 300; font-size: clamp(40px, 5vw, 56px); letter-spacing: -0.03em; line-height: 1.05; }
.gallery-btns { display: flex; gap: 8px; }
.gallery-btn {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--paper); color: var(--ink); cursor: pointer;
  transition: background-color 200ms ease, opacity 200ms ease;
}
.gallery-btn:hover { background: var(--chip); }
.gallery-btn:disabled { opacity: 0.35; cursor: default; }
.gallery-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gallery {
  display: flex; gap: 14px;
  padding: 0 var(--pad) 100px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--pad);
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.shot {
  position: relative;
  flex: 0 0 240px; height: 300px;
  padding: 0; border: 0; border-radius: var(--radius-lg);
  overflow: hidden; cursor: zoom-in;
  background: var(--tile);
  scroll-snap-align: start;
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 500ms ease; }
.shot:hover img { transform: scale(1.04); }
.shot::after {
  content: "";
  position: absolute; inset: 55% 0 0 0;
  background: linear-gradient(to top, rgba(10, 11, 13, 0.62), transparent);
  pointer-events: none;
}
.shot-caption {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 1;
  display: flex; align-items: center; gap: 6px;
  color: #ffffff; font-size: 13px; font-weight: 600; text-align: left; line-height: 1.25;
}
.shot-caption svg { flex: 0 0 auto; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* sections */
.section { padding: 80px var(--pad); border-top: 1px solid var(--hairline); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 36px; }
.section-head h2 {
  font-family: var(--display); font-weight: 300;
  font-size: clamp(40px, 5vw, 56px); letter-spacing: -0.03em; line-height: 1.05;
}
.section-head a { font-weight: 600; font-size: 15px; }
.muted { color: var(--muted); font-size: 15px; }

/* career */
.career { list-style: none; margin: 0; padding: 0; }
.career li {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1.3fr) 150px;
  gap: 24px; align-items: baseline;
  padding: 28px 0; border-top: 1px solid var(--hairline);
}
.career li:last-child { border-bottom: 1px solid var(--hairline); }
.when { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--muted); }
.when-now { color: var(--red); }
.career h3 { font-size: 21px; font-weight: 700; }
.role { margin-top: 4px; color: var(--muted); }
.career p:not(.role) { color: var(--text); line-height: 1.6; }
.dates { text-align: right; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* projects */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; }
.project { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
button.project { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.project-tag {
  align-self: flex-start; margin-top: 12px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 600;
}
.project h3 { margin-top: 4px; font-size: 20px; font-weight: 700; }
.project p { color: var(--muted); }
.project:hover h3 { color: var(--red); }
.art { position: relative; aspect-ratio: 4 / 3; max-width: 100%; overflow: hidden; border-radius: 24px; transition: transform 300ms ease; }
.project:hover .art { transform: translateY(-4px); }
.art-rings span { position: absolute; }

.art-rings { background: var(--mock-rings); }
.art-rings span { left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; border: 1.5px solid var(--blue); }
.art-rings span:nth-child(1) { width: 44%; aspect-ratio: 1; }
.art-rings span:nth-child(2) { width: 27%; aspect-ratio: 1; }
.art-rings span:nth-child(3) { width: 9%; aspect-ratio: 1; background: var(--blue); }




/* Project previews: small, realistic mockups sized in container units so they scale with the card */
.art { container-type: inline-size; }
.art > * { position: absolute; }

.art-shot { background: #1b1b1b; }
.art-shot img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mock-bubble {
  right: 5cqw; top: 5cqw; max-width: 62cqw;
  padding: 2.4cqw 3.6cqw; border-radius: 4cqw 4cqw 1cqw 4cqw;
  background: #ffffff; color: #121316; font-size: 3.2cqw; font-weight: 600; line-height: 1.3;
  box-shadow: 0 2cqw 5cqw rgba(0, 0, 0, 0.35);
}

.art-rulebook { background: var(--mock-rulebook); }
.mock-doc {
  left: 7cqw; top: 8cqw; width: 52cqw; height: 66cqw;
  display: flex; flex-direction: column; gap: 3cqw;
  padding: 6cqw 5cqw; border-radius: 2.4cqw; background: var(--surface);
  box-shadow: 0 1.5cqw 5cqw var(--shadow-soft);
}
.mock-doc-title { font-size: 3cqw; font-weight: 700; line-height: 1.25; margin-bottom: 1.5cqw; }
.mock-line { display: block; height: 1.8cqw; border-radius: 1cqw; background: var(--mock-line); }
.mock-line.short { width: 64%; }
.mock-line.hl { background: rgba(200, 16, 46, 0.22); }
.mock-chat { right: 6cqw; bottom: 8cqw; width: 50cqw; display: flex; flex-direction: column; gap: 2.4cqw; }
.mock-q {
  align-self: flex-end; padding: 2.6cqw 3.6cqw; border-radius: 4cqw 4cqw 1cqw 4cqw;
  background: #121316; color: #ffffff; font-size: 3.1cqw; font-weight: 600; line-height: 1.3;
}
.mock-a {
  display: flex; flex-direction: column; gap: 2cqw; padding: 3.4cqw; border-radius: 4cqw 4cqw 4cqw 1cqw;
  background: var(--surface); box-shadow: 0 1.5cqw 5cqw var(--shadow-soft);
}
.mock-cite { align-self: flex-start; margin-top: 0.8cqw; padding: 1cqw 2.4cqw; border-radius: 99px; background: var(--mock-chip); color: var(--text-soft); font-size: 2.5cqw; font-weight: 600; }

.art-media { background: var(--mock-media); }
.mock-upload {
  left: 8cqw; top: 8cqw; width: 58cqw; height: 60cqw;
  border-radius: 3cqw; overflow: hidden; background: var(--surface);
  box-shadow: 0 1.5cqw 5cqw var(--shadow-soft);
}
.mock-upload img { width: 100%; height: 72%; object-fit: cover; display: block; }
.mock-tags { display: flex; flex-wrap: wrap; gap: 1.6cqw; padding: 2.6cqw; }
.mock-tags span { padding: 1cqw 2.4cqw; border-radius: 99px; background: var(--tag-bg); color: var(--tag-fg); font-size: 2.6cqw; font-weight: 600; }
.mock-queue { right: 7cqw; top: 14cqw; display: flex; flex-direction: column; gap: 2.4cqw; }
.mock-queue span {
  padding: 2.2cqw 3cqw; border-radius: 2.2cqw; background: var(--surface); color: var(--text);
  font-size: 2.7cqw; font-weight: 600; box-shadow: 0 1cqw 3cqw var(--shadow-soft);
}
.mock-queue span::before { content: ""; display: inline-block; width: 1.6cqw; height: 1.6cqw; margin-right: 1.6cqw; border-radius: 50%; background: #3ecf8e; vertical-align: middle; }

.view-more { display: flex; justify-content: center; margin-top: 44px; }
.view-more a {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 24px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-weight: 700; text-decoration: none;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.view-more a:hover { background: var(--btn-dark-bg); border-color: var(--btn-dark-bg); color: var(--btn-dark-fg); }
.view-more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* stack */
.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack-group { display: flex; flex-direction: column; gap: 14px; padding: 26px; border: 1px solid var(--hairline); border-radius: var(--radius-md); }
.stack-group h3 { font-family: var(--display); font-size: 22px; font-weight: 600; }
.stack-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stack-group li { padding: 7px 13px; border-radius: 999px; background: var(--chip); font-size: 14px; }

/* education */
.schools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.school { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 20px; row-gap: 6px; align-content: start; padding: 30px; border-radius: var(--radius-md); background: var(--chip); }
.school > :not(.school-logo) { grid-column: 2; }
.school-logo { grid-row: 1 / span 3; align-self: start; width: 64px; height: 64px; border-radius: 50%; background: #ffffff; object-fit: contain; box-shadow: 0 0 0 1px var(--hairline); }
.school-year { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.school h3 { font-family: var(--display); font-size: 28px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
.school-degree { color: var(--text); }
.sub-head { margin: 40px 0 16px; font-family: var(--display); font-size: 22px; font-weight: 600; }
.cert-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cert-list a {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 20px; border: 1px solid var(--hairline); border-radius: 18px;
  text-decoration: none; font-weight: 600; line-height: 1.35;
  transition: border-color 200ms ease;
}
.cert-list a:hover { border-color: var(--ink); color: var(--ink); }
.issuer { font-size: 13px; font-weight: 500; color: var(--muted); }
.cert-logo { width: 28px; height: 28px; margin-bottom: 8px; object-fit: contain; }

/* contact */
.contact { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 120px var(--pad) 110px; text-align: center; }
.contact h2 {
  max-width: 14ch;
  font-family: var(--display); font-weight: 300;
  font-size: clamp(44px, 6vw, 72px); line-height: 1.02; letter-spacing: -0.035em;
  text-wrap: balance;
}
.contact p { font-size: 19px; color: var(--text-soft); }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }
.btn-dark, .btn-light { padding: 16px 26px; border-radius: 14px; font-weight: 700; text-decoration: none; }
.btn-dark { background: var(--btn-dark-bg); color: var(--btn-dark-fg); }
.btn-dark:hover { color: var(--btn-dark-fg); background: var(--btn-dark-hover); }
.btn-light { border: 1px solid var(--line-strong); }

/* ---------- Dock (small screens) ---------- */

.dock { display: none; }

@media (max-width: 900px) {
  .dock {
    display: block;
    position: fixed; z-index: 20;
    left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    padding: 6px;
    border-radius: 31px;
    background: rgba(22, 24, 29, 0.56);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transform: translate(-50%, calc(100% + 40px));
    opacity: 0;
    transition: transform 380ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 240ms ease;
  }
  .dock.is-visible { transform: translate(-50%, 0); opacity: 1; }
  .dock-row { position: relative; display: flex; gap: 2px; }
  .dock-row a {
    position: relative; z-index: 1;
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
    color: #ffffff;
    transition: color 250ms ease;
  }
  .dock-row a.is-active { color: var(--ink); }
  .dock-row a:focus-visible { outline-color: #ffffff; outline-offset: -3px; }
  .dock-row svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .dock-pill {
    position: absolute; top: 0; left: 0; width: 48px; height: 48px; border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transform: translateX(var(--pill-x, 0px));
    transition: transform 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  /* The red car laps the dock's outline */
  .dock-lap { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
  .dock-oval { fill: none; stroke: rgba(255, 255, 255, 0.4); stroke-width: 1; }
  .dock-car { fill: var(--red); filter: drop-shadow(0 0 3px rgba(200, 16, 46, 0.9)); }
  .panel { margin-bottom: 96px; }
}


/* ---------- Project dialog ---------- */

.project-dialog {
  width: min(92vw, 600px); max-height: 90dvh;
  padding: 36px; border: 0; border-radius: var(--radius-lg);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.project-dialog::backdrop { background: rgba(10, 11, 13, 0.7); }
.project-dialog[open] { display: flex; flex-direction: column; gap: 14px; animation: rise 240ms ease; }
.project-dialog h2 { font-family: var(--display); font-weight: 400; font-size: 36px; letter-spacing: -0.02em; line-height: 1.1; }
.project-dialog p { color: var(--text); line-height: 1.65; }
.project-dialog .project-tag { margin-top: 6px; }
.dialog-art { aspect-ratio: 16 / 7; margin: 0; }
.dialog-note { padding: 16px 18px; border-radius: 16px; background: var(--chip); color: var(--ink) !important; font-weight: 500; }
.project-dialog .dialog-close { position: absolute; top: 48px; right: 48px; background: rgba(18, 19, 22, 0.55); z-index: 1; }
.project-dialog .dialog-close:hover { background: rgba(18, 19, 22, 0.75); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  width: 100dvw; height: 100dvh;
  margin: 0; padding: 0; border: 0;
  background: transparent; overflow: hidden;
}
.lightbox::backdrop { background: rgba(10, 11, 13, 0.9); }
.lightbox[open] { display: grid; place-items: center; animation: fade 200ms ease; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 92vw; }
.lightbox img { display: block; max-width: 92vw; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: 14px; }
.lightbox figcaption { display: flex; gap: 14px; align-items: baseline; color: #f2f2ef; font-size: 15px; }
.lb-count { color: #9a9ea7; font-size: 13px; font-variant-numeric: tabular-nums; }
.lb-btn {
  position: fixed;
  display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; border-radius: 50%; background: rgba(242, 242, 239, 0.12); color: #ffffff; cursor: pointer;
  transition: background-color 200ms ease;
}
.lb-btn:hover { background: rgba(242, 242, 239, 0.24); }
.lb-btn:focus-visible { outline-color: #ffffff; }
.lb-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

@keyframes fade { from { opacity: 0; } }

/* Short windows: the track alone is the navigation */
@media (max-height: 640px) and (min-width: 901px) {
  .turn-label { display: none; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 1080px) {
  .career li { grid-template-columns: 60px minmax(0, 1fr) 130px; }
  .career li > p { grid-column: 2 / -1; }
  .career li .dates { grid-row: 1; grid-column: 3; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .card { position: relative; top: 0; max-height: none; overflow: hidden; }
  .card-photo { flex: 0 0 auto; aspect-ratio: auto; height: 360px; }
  .circuit { max-width: 420px; }
  .cert-list { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --gap: 12px; }
  body { font-size: 16px; }
  .topbar { padding: 18px 20px; }
  .gallery { padding: 0 20px 72px; scroll-padding-inline: 20px; }
  .gallery-nav { padding: 0 20px 20px; }
  .gallery-btns { display: none; }
  .shot { flex-basis: 64vw; height: 80vw; max-width: 280px; max-height: 350px; }
  .lb-prev, .lb-next { top: auto; bottom: 20px; transform: none; }
  .lightbox img { max-height: calc(100dvh - 180px); }
  .project-dialog { padding: 24px; }
  .project-dialog .dialog-close { top: 32px; right: 32px; }
  .project-dialog h2 { font-size: 30px; }
  .section { padding: 64px 20px; }
  .career li { grid-template-columns: 1fr; gap: 6px; }
  .career li > p, .career li .dates { grid-column: auto; grid-row: auto; }
  .career li .dates { text-align: left; }
  .projects, .stack, .schools, .cert-list { grid-template-columns: 1fr; }
  .contact { padding: 88px 20px 80px; }
}
