:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #e9edf1;
  --surface-strong: #dce3e9;
  --text: #111820;
  --text-soft: #53606d;
  --line: rgba(17, 24, 32, 0.12);
  --line-strong: rgba(17, 24, 32, 0.2);
  --accent: #087c87;
  --accent-bright: #00a8b6;
  --accent-soft: rgba(0, 168, 182, 0.13);
  --nav-bg: rgba(244, 246, 248, 0.84);
  --hero-glow: rgba(0, 168, 182, 0.18);
  --shadow: 0 24px 80px rgba(20, 32, 43, 0.11);
  --shadow-soft: 0 14px 40px rgba(20, 32, 43, 0.07);
  --code-bg: #111820;
  --code-text: #dce7eb;
  --code-muted: #7f919d;
  --max-width: 1180px;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --header-height: 78px;
  --ease: cubic-bezier(.2,.75,.2,1);
}

html[data-theme="dark"] {
  --bg: #0b1118;
  --surface: #111922;
  --surface-soft: #151f29;
  --surface-strong: #1c2935;
  --text: #ecf2f5;
  --text-soft: #9daeb9;
  --line: rgba(236, 242, 245, 0.11);
  --line-strong: rgba(236, 242, 245, 0.2);
  --accent: #22b8c5;
  --accent-bright: #58d4de;
  --accent-soft: rgba(34, 184, 197, 0.12);
  --nav-bg: rgba(11, 17, 24, 0.82);
  --hero-glow: rgba(34, 184, 197, 0.18);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.22);
  --code-bg: #080d12;
  --code-text: #dbe8ec;
  --code-muted: #71828d;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.shell {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.sr-only {
  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: fixed;
  left: 16px;
  top: 12px;
  z-index: 999;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transition: transform .2s ease;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid transparent;
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.site-header.is-scrolled {
  background: var(--nav-bg);
  border-color: var(--line);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .06);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent-bright);
  font-size: 12px;
  letter-spacing: .08em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.primary-nav > a {
  position: relative;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  transition: color .2s ease;
}

.primary-nav > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -7px;
  height: 1px;
  background: var(--accent);
  transition: right .25s var(--ease);
}

.primary-nav > a:hover,
.primary-nav > a:focus-visible { color: var(--text); }
.primary-nav > a:hover::after,
.primary-nav > a:focus-visible::after { right: 0; }

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease;
}

.theme-toggle:hover { transform: rotate(8deg); border-color: var(--accent); }
.theme-icon { width: 18px; height: 18px; }
html[data-theme="dark"] .theme-icon-moon,
html:not([data-theme="dark"]) .theme-icon-sun { display: none; }

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle span:not(.sr-only) {
  display: block;
  width: 18px;
  height: 1.5px;
  margin: 4px auto;
  background: var(--text);
  transition: transform .25s ease, opacity .25s ease;
}

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: calc(var(--header-height) + 72px) 0 80px;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hero-glow), transparent 64%);
  filter: blur(10px);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  align-items: center;
  gap: clamp(56px, 8vw, 120px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--accent-bright);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.hero h1 {
  max-width: 830px;
  margin: 0;
  font-size: clamp(46px, 6.4vw, 88px);
  line-height: .99;
  letter-spacing: -.055em;
  font-weight: 780;
}

.hero h1 span {
  color: transparent;
  -webkit-text-stroke: 1px var(--text-soft);
  opacity: .72;
}

.hero-lead {
  max-width: 710px;
  margin: 30px 0 0;
  color: var(--text-soft);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  margin-top: 38px;
}

.button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  transition: transform .2s var(--ease), box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

.button svg { width: 16px; height: 16px; transition: transform .2s ease; }
.button:hover { transform: translateY(-2px); }
.button:hover svg { transform: translateX(2px); }
.button:focus-visible, .project-link:focus-visible, .text-link:focus-visible, .primary-nav a:focus-visible, .contact-socials a:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }

.button-primary {
  background: var(--accent);
  color: #061014;
  box-shadow: 0 12px 34px var(--accent-soft);
}
.button-primary:hover { background: var(--accent-bright); box-shadow: 0 16px 40px var(--accent-soft); }

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.button-secondary:hover { border-color: var(--accent); }

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 32px;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: color .2s ease;
}
.hero-links a:hover { color: var(--accent-bright); }
.hero-links svg { width: 17px; height: 17px; }

.hero-visual { position: relative; }

.portrait-frame {
  position: relative;
  width: min(100%, 430px);
  margin-left: auto;
  aspect-ratio: 1 / 1.12;
  isolation: isolate;
}

.portrait-frame::before {
  content: "";
  position: absolute;
  inset: 7% -7% -7% 7%;
  z-index: -1;
  border: 1px solid var(--line-strong);
  border-radius: 46% 46% 28% 28%;
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: -22px;
  z-index: -2;
  border: 1px dashed var(--line);
  border-radius: 50%;
  animation: spin 42s linear infinite;
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  border-radius: 46% 46% 28% 28%;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  filter: saturate(.88) contrast(1.02);
}

.portrait-glow {
  position: absolute;
  inset: 18% 8% 0;
  z-index: -1;
  border-radius: 50%;
  background: var(--accent);
  opacity: .18;
  filter: blur(54px);
}

.portrait-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--nav-bg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}
.portrait-badge svg { width: 16px; height: 16px; color: var(--accent-bright); }
.badge-engineering { left: -12%; bottom: 27%; }
.badge-photography { right: -11%; top: 19%; }

.hero-orbit {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
}
.hero-orbit-one { width: 200px; height: 200px; left: -110px; top: 25%; }
.hero-orbit-two { width: 82px; height: 82px; left: 8%; bottom: -42px; border-color: var(--accent-soft); }

@keyframes spin { to { transform: rotate(360deg); } }

.section { padding: clamp(88px, 10vw, 145px) 0; }
.section-heading { max-width: 650px; }
.section-heading h2 {
  margin: 0;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.08;
  letter-spacing: -.045em;
}
.section-heading > p:not(.eyebrow), .split-heading > p {
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: 18px;
}

.section-about { border-bottom: 1px solid var(--line); }

.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 62px;
}

.focus-card {
  position: relative;
  min-height: 315px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform .3s var(--ease), border-color .3s ease, background-color .3s ease;
}
.focus-card:hover { transform: translateY(-7px); border-color: var(--accent); }
.focus-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -70px;
  bottom: -70px;
  border-radius: 50%;
  background: var(--accent-soft);
  transition: transform .4s var(--ease);
}
.focus-card:hover::after { transform: scale(1.35); }

.card-number {
  position: absolute;
  top: 24px;
  right: 26px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.focus-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 66px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-bright);
}
.focus-icon svg { width: 24px; height: 24px; }
.focus-card h3 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.focus-card p { margin: 14px 0 0; color: var(--text-soft); }

.section-experience { background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.experience-layout {
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: clamp(60px, 10vw, 145px);
  align-items: start;
}
.sticky-heading { position: sticky; top: calc(var(--header-height) + 40px); }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
}
.text-link svg { width: 16px; height: 16px; color: var(--accent-bright); transition: transform .2s ease; }
.text-link:hover svg { transform: translate(2px, -2px); }

.timeline {
  position: relative;
  border-left: 1px solid var(--line-strong);
}
.timeline-item {
  position: relative;
  padding: 3px 0 56px 44px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute;
  left: -7px;
  top: 9px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--surface-soft);
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--accent);
}
.timeline-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.timeline-meta span + span::before { content: "•"; margin-right: 12px; color: var(--accent-bright); }
.timeline-item h3 { margin: 0; font-size: clamp(26px, 3vw, 35px); line-height: 1.15; letter-spacing: -.035em; }
.timeline-organization { margin: 8px 0 14px !important; color: var(--accent-bright) !important; font-weight: 750; }
.timeline-item > p { max-width: 670px; margin: 0; color: var(--text-soft); }

.section-work { border-bottom: 1px solid var(--line); }
.split-heading {
  max-width: none;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 40px;
  align-items: end;
}
.split-heading > p { max-width: 480px; justify-self: end; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 62px;
}

.project-card {
  min-height: 405px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(26px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform .3s var(--ease), border-color .3s ease;
}
.project-card:hover { transform: translateY(-6px); border-color: var(--accent); }
.project-featured {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 20%, rgba(66, 206, 216, .24), transparent 28%),
    linear-gradient(145deg, #10222c, #071015 72%);
  color: #eef9fa;
}
.project-featured::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  bottom: -100px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(255,255,255,.025), 0 0 0 70px rgba(255,255,255,.018);
}
.project-code { background: var(--code-bg); color: var(--code-text); }

.project-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.project-topline > svg { width: 24px; height: 24px; color: var(--accent-bright); }
.project-tag {
  padding: 7px 11px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .8;
}
.project-featured .project-tag, .project-code .project-tag { color: #a7bac3; }
.project-kicker { margin: 0 0 12px; color: var(--accent-bright); font-size: 13px; font-weight: 800; letter-spacing: .05em; }
.project-card h3 { max-width: 550px; margin: 0; font-size: clamp(27px, 3.2vw, 39px); line-height: 1.14; letter-spacing: -.035em; }
.project-card h3 + p { max-width: 590px; margin: 17px 0 0; color: var(--text-soft); }
.project-featured h3 + p, .project-code h3 + p { color: #a9bac2; }
.project-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}
.project-link svg { width: 16px; height: 16px; color: var(--accent-bright); transition: transform .2s ease; }
.project-link:hover svg { transform: translate(3px, -3px); }
.skill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 23px; }
.skill-list span { padding: 6px 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: #a9bac2; font-size: 11px; font-weight: 700; }

.section-code { background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.code-layout {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: clamp(50px, 8vw, 105px);
  align-items: center;
}
.code-window {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-md);
  background: var(--code-bg);
  box-shadow: var(--shadow);
  transform: rotate(-1.3deg);
}
.window-bar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 17px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.window-bar span { width: 8px; height: 8px; border-radius: 50%; background: #53636d; }
.window-bar span:nth-child(2) { opacity: .72; }
.window-bar span:nth-child(3) { opacity: .45; }
.window-bar p { margin: 0 0 0 8px; color: var(--code-muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.code-window pre { margin: 0; padding: clamp(28px, 5vw, 48px); overflow-x: auto; }
.code-window code { color: var(--code-text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(12px, 1.4vw, 15px); line-height: 1.85; }
.code-keyword { color: #d87ab1; }
.code-string { color: #80d7b1; }
.toolkit-list { margin-top: 34px; border-top: 1px solid var(--line); }
.toolkit-list div { display: grid; grid-template-columns: 110px 1fr; gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.toolkit-list span { color: var(--text-soft); font-size: 13px; }
.toolkit-list strong { font-size: 14px; font-weight: 750; }

.section-contact { padding-bottom: clamp(88px, 10vw, 130px); }
.contact-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 50px;
  align-items: center;
  overflow: hidden;
  padding: clamp(38px, 7vw, 80px);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1195a1, #04646f);
  color: #f4ffff;
  box-shadow: 0 24px 80px rgba(0, 128, 140, .22);
}
.contact-panel::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -130px;
  bottom: -180px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(255,255,255,.04), 0 0 0 110px rgba(255,255,255,.025);
}
.contact-panel > * { position: relative; z-index: 1; }
.contact-panel .eyebrow { color: #b9f5f9; }
.contact-panel h2 { margin: 0; font-size: clamp(42px, 5vw, 68px); line-height: 1; letter-spacing: -.05em; }
.contact-panel p:not(.eyebrow) { max-width: 570px; margin: 20px 0 0; color: rgba(244,255,255,.8); font-size: 18px; }
.contact-actions { justify-self: end; text-align: right; }
.button-light { background: #f4ffff; color: #073e45; }
.button-light:hover { background: #ffffff; box-shadow: 0 14px 36px rgba(0,0,0,.17); }
.button-light svg { width: 17px; height: 17px; }
.contact-socials { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 20px; margin-top: 21px; }
.contact-socials a { color: rgba(244,255,255,.82); font-size: 13px; font-weight: 750; text-decoration: none; }
.contact-socials a:hover { color: #fff; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--text-soft);
  font-size: 12px;
}
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--text); text-decoration: none; font-weight: 750; }
.footer-inner a:hover { color: var(--accent-bright); }

.reveal { opacity: 1; transform: none; }
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .72s var(--ease), transform .72s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .hero { min-height: auto; padding-top: calc(var(--header-height) + 72px); }
  .hero-grid { grid-template-columns: 1fr; gap: 80px; }
  .hero-copy { max-width: 850px; }
  .hero-visual { width: min(76vw, 430px); margin-inline: auto; }
  .portrait-frame { margin: 0; }
  .focus-grid { grid-template-columns: 1fr 1fr; }
  .focus-card:last-child { grid-column: 1 / -1; }
  .experience-layout { grid-template-columns: 1fr; gap: 60px; }
  .sticky-heading { position: static; }
  .code-layout { grid-template-columns: 1fr; }
  .code-window { transform: none; }
  .contact-panel { grid-template-columns: 1fr; }
  .contact-actions { justify-self: start; text-align: left; }
  .contact-socials { justify-content: flex-start; }
}

@media (max-width: 760px) {
  :root { --header-height: 68px; }
  .shell { width: min(calc(100% - 28px), var(--max-width)); }
  .brand-text { font-size: 14px; }

  /* Keep the translucent, blurred top bar on mobile. */
  .site-header,
  .site-header.is-scrolled,
  .legal-page .site-header,
  .legal-page .site-header.is-scrolled {
    background: var(--nav-bg);
    border-color: var(--line);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
  }

  .site-header.is-menu-open {
    background: var(--bg);
    box-shadow: none;
  }

  html.nav-open,
  body.nav-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .nav-toggle { display: block; position: relative; z-index: 102; }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(5.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(4) { transform: translateY(-5.5px) rotate(-45deg); }

  .primary-nav {
    /* The header is fixed, so an absolute panel stays attached to the viewport
       while remaining compatible with backdrop-filter on the header. */
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 101;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 18px;
    padding: 40px 32px max(32px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity .25s ease, visibility .25s ease, transform .25s ease;
  }
  .primary-nav.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
  .primary-nav > a { font-size: clamp(30px, 9vw, 44px); letter-spacing: -.04em; color: var(--text); }
  .primary-nav > a::after { bottom: 0; }
  .theme-toggle { margin-top: 12px; }

  .hero { padding-top: calc(var(--header-height) + 56px); }
  .hero h1 { font-size: clamp(44px, 13vw, 68px); }
  .hero-lead { font-size: 17px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .button { width: 100%; }
  .hero-links { gap: 18px; }
  .hero-visual { width: min(82vw, 380px); }
  .badge-engineering { left: -5%; }
  .badge-photography { right: -5%; }

  .section { padding: 84px 0; }
  .section-heading h2 { font-size: clamp(36px, 11vw, 50px); }
  .focus-grid, .project-grid, .split-heading { grid-template-columns: 1fr; }
  .focus-card, .focus-card:last-child { grid-column: auto; }
  .split-heading > p { justify-self: start; }
  .project-card { min-height: 360px; }
  .timeline-item { padding-left: 32px; }
  .contact-panel { padding: 38px 24px; border-radius: 24px; }
  .button-light { font-size: 12px; padding-inline: 15px; }
  .toolkit-list div { grid-template-columns: 1fr; gap: 3px; }
  .footer-inner { padding: 25px 0; flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer-inner p:nth-child(2) { display: none; }
}

@media (max-width: 440px) {
  .portrait-badge { padding: 8px 11px; font-size: 10px; }
  .badge-engineering { left: -3%; bottom: 20%; }
  .badge-photography { right: -3%; top: 12%; }
  .hero-links a { font-size: 12px; }
  .project-card { padding: 25px 21px; border-radius: 24px; }
  .contact-socials { gap: 13px; }
}

@media print {
  :root, html[data-theme="dark"] {
    --bg: #fff;
    --surface: #fff;
    --surface-soft: #fff;
    --text: #111;
    --text-soft: #444;
    --line: #ccc;
    --accent: #006d75;
    --accent-bright: #006d75;
  }
  body { font-size: 11pt; }
  body::before, .site-header, .hero-orbit, .portrait-badge, .section-code, .section-contact, .site-footer { display: none !important; }
  .hero { min-height: auto; padding: 20px 0 35px; border: 0; }
  .hero-grid { grid-template-columns: 1.4fr .6fr; gap: 30px; }
  .hero h1 { font-size: 34pt; }
  .hero-lead { font-size: 11pt; }
  .hero-actions { display: none; }
  .hero-links { margin-top: 14px; }
  .portrait-frame { width: 180px; aspect-ratio: 1; }
  .portrait-frame::before, .portrait-frame::after, .portrait-glow { display: none; }
  .portrait-frame img { border-radius: 50%; }
  .section { padding: 32px 0; break-inside: avoid; }
  .section-heading h2 { font-size: 26pt; }
  .focus-grid { margin-top: 24px; gap: 10px; }
  .focus-card { min-height: 0; padding: 16px; box-shadow: none; }
  .focus-icon { margin-bottom: 20px; }
  .section-experience { background: #fff; }
  .experience-layout { grid-template-columns: .65fr 1.35fr; gap: 30px; }
  .project-grid { margin-top: 24px; }
  .project-card { min-height: 0; padding: 20px; gap: 20px; box-shadow: none; color: #111 !important; background: #fff !important; }
  .project-card h3 + p, .project-featured h3 + p, .project-code h3 + p { color: #444; }
  .skill-list span { color: #333; border-color: #bbb; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { text-decoration: none; }
}

.email-link { display: inline-block; }
.email-noscript {
  max-width: 32rem;
  margin: 0;
  color: rgba(244,255,255,.82);
  font-size: 13px;
}


/* Legal notice */
/* Keep the legal-page navigation pinned to the viewport as on the résumé. */
.legal-page .site-header {
  position: fixed;
  inset: 0 0 auto;
  background: var(--nav-bg);
  border-color: var(--line);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .06);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.legal-page .site-header.is-scrolled {
  background: var(--nav-bg);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.footer-links > * + *::before {
  content: "·";
  margin-right: 22px;
  color: var(--text-soft);
  pointer-events: none;
}

.legal-main {
  min-height: 100svh;
  padding: calc(var(--header-height) + 72px) 0 96px;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
  gap: clamp(56px, 8vw, 120px);
  align-items: start;
}

.legal-intro {
  position: sticky;
  top: calc(var(--header-height) + 42px);
}

.legal-intro h1 {
  margin: 12px 0 22px;
  font-size: clamp(48px, 7vw, 86px);
  line-height: .95;
  letter-spacing: -.06em;
}

.legal-intro > p:not(.eyebrow) {
  max-width: 34rem;
  margin: 0;
  color: var(--text-soft);
  font-size: 18px;
}

.legal-back {
  margin-top: 34px;
}

.legal-content {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.legal-section {
  padding: clamp(28px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
}

.legal-section:last-child { border-bottom: 0; }

.legal-section h2 {
  margin: 0 0 18px;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
  letter-spacing: -.035em;
}

.legal-section p {
  max-width: 48rem;
  margin: 0 0 14px;
  color: var(--text-soft);
}

.legal-section p:last-child { margin-bottom: 0; }
.legal-section strong { color: var(--text); }
.legal-address { font-style: normal; color: var(--text-soft); }

.legal-email {
  color: var(--accent-bright);
  font-weight: 750;
  text-decoration: none;
}

.legal-email:hover,
.legal-email:focus-visible { text-decoration: underline; }

.legal-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; }
  .legal-intro { position: static; }
}

@media (max-width: 760px) {
  .footer-links { flex-wrap: wrap; gap: 8px 20px; }
  .footer-links > * + *::before { margin-right: 20px; }
  .legal-main { padding-top: calc(var(--header-height) + 48px); }
  .legal-content { border-radius: 24px; }
  .legal-section { padding: 28px 22px; }
}

@media print {
  .legal-main { min-height: auto; padding: 0; }
  .legal-layout { grid-template-columns: 1fr; gap: 28px; }
  .legal-intro { position: static; }
  .legal-content { border: 0; box-shadow: none; }
  .legal-section { padding: 18px 0; }
  .legal-back { display: none; }
}

