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

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --hl: rgba(79, 70, 229, 0.16);
  --on-accent: #ffffff;
  --success: #047857;
  --success-soft: #ecfdf5;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --tex-image: url('bg-texture-light.jpg');
  --notch-bg: #ffffff;
  --notch-text: #475569;
  --notch-text-hi: #0f172a;
  --notch-pill: rgba(15, 23, 42, 0.07);
  --notch-cta-bg: #0f172a;
  --notch-cta-text: #ffffff;
  --notch-shadow: rgba(15, 23, 42, 0.12);
  --tex-opacity: 0.36;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
  --radius: 12px;
  --max-w: 1040px;
}

:root[data-theme="dark"] {
  --bg: #0b0f17;
  --surface: #0f1420;
  --card: #121826;
  --text: #e5e7eb;
  --muted: #a3afc2;
  --faint: #8a96a8;
  --border: #1f2937;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-text: #a5b4fc;
  --hl: rgba(129, 140, 248, 0.28);
  --on-accent: #0b0f17;
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.1);
  --nav-bg: rgba(11, 15, 23, 0.8);
  --tex-image: url('bg-texture.jpg');
  --notch-bg: #000000;
  --notch-text: #a1a1aa;
  --notch-text-hi: #ffffff;
  --notch-pill: rgba(255, 255, 255, 0.12);
  --notch-cta-bg: #ffffff;
  --notch-cta-text: #000000;
  --notch-shadow: rgba(0, 0, 0, 0.5);
  --tex-opacity: 0.27;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

html { background: var(--bg); }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--tex-image) center / cover no-repeat;
  opacity: var(--tex-opacity);
  pointer-events: none;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: transparent;
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
strong { font-weight: 600; color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ── NAV: notch hanging from the top edge ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  background: var(--notch-bg);
  border-radius: 0 0 22px 22px;
  filter: drop-shadow(0 6px 18px var(--notch-shadow));
}
/* Inverted curves where the notch meets the top edge */
nav::before, nav::after {
  content: '';
  position: absolute;
  top: 0;
  width: var(--flare);
  height: var(--flare);
  pointer-events: none;
}
nav { --flare: 16px; }
nav::before { left: calc(-1 * var(--flare)); background: radial-gradient(circle at 0 100%, transparent calc(var(--flare) - 0.5px), var(--notch-bg) var(--flare)); }
nav::after { right: calc(-1 * var(--flare)); background: radial-gradient(circle at 100% 100%, transparent calc(var(--flare) - 0.5px), var(--notch-bg) var(--flare)); }
.nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 56px;
  padding: 0 10px 0 24px;
  gap: 16px;
}
.nav-logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--notch-text-hi);
  text-decoration: none;
  white-space: nowrap;
  justify-self: start;
}
.nav-right { display: flex; align-items: center; gap: 6px; justify-self: end; }
.nav-links { position: relative; display: flex; gap: 2px; list-style: none; }
.nav-pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--notch-pill);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), width 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.nav-links a {
  position: relative;
  display: block;
  padding: 7px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--notch-text);
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.2s ease;
}
.nav-links a.lit, .nav-links a.active { color: var(--notch-text-hi); }
nav .btn-cta {
  background: var(--notch-cta-bg);
  color: var(--notch-cta-text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.82rem;
}
nav .btn-cta:hover { background: var(--notch-cta-bg); filter: brightness(0.92); }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--faint); }
nav .icon-btn {
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--notch-text);
  transition: color 0.2s, background 0.2s;
}
nav .icon-btn:hover { color: var(--notch-text-hi); background: var(--notch-pill); }
/* Sun/moon stacked in the toggle; the outgoing icon spins away as the other spins in */
#theme-toggle { position: relative; }
#theme-toggle svg {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
:root[data-theme="dark"] .icon-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* Whole-page cross-fade when the theme changes (View Transitions) */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
  animation-timing-function: ease;
}
@media (prefers-reduced-motion: reduce) {
  #theme-toggle svg { transition: none; }
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--faint); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent-soft);
  text-decoration: none;
}
.pill-link:hover { text-decoration: underline; }

/* ── SECTIONS ── */
section { padding: 72px 0; }
section.alt { background: color-mix(in srgb, var(--surface) 65%, transparent); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { margin-bottom: 32px; }
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 8px;
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ── HERO ── */
#hero { padding: 80px 0 72px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 56px;
  align-items: center;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.hero-role {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 8px;
}
h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 20px;
}
.hero-lede {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 28px;
}
.lede-hook { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.headshot {
  width: 260px;
  height: 260px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 8px var(--accent-soft);
  background: var(--surface);
}
.headshot img { width: 100%; height: 100%; object-fit: cover; }

/* Showreel */
.reel {
  position: relative;
  margin-top: 56px;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0b0f17;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 24px 60px rgba(15, 23, 42, 0.14);
}
.reel video { display: block; width: 100%; height: 100%; object-fit: cover; }
.reel button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(11, 15, 23, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, opacity 0.2s;
}
.reel button:hover { background: rgba(11, 15, 23, 0.85); }
.reel-toggle { right: 14px; bottom: 14px; width: 40px; height: 40px; }
.reel-play { inset: 0; margin: auto; width: 84px; height: 84px; opacity: 0; pointer-events: none; }
.reel-play svg { margin-left: 4px; }
.reel.idle .reel-play { opacity: 1; pointer-events: auto; }
.reel.idle .reel-toggle { opacity: 0; pointer-events: none; }
.reel .icon-play { display: none; }
.reel.paused .icon-play { display: block; }
.reel.paused .icon-pause { display: none; }
.reel:not(.ready) button { display: none; }

/* ── ABOUT ── */
.about-summary {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 760px;
  margin-bottom: 32px;
}
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.card-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 2px;
}
.card-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.card-desc { font-size: 0.9rem; color: var(--muted); }

/* ── EXPERIENCE ── */
.jobs { display: flex; flex-direction: column; gap: 16px; }
.job { padding: 24px; }
.job-head {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
}
.logo {
  width: 48px; height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.logo img { width: 100%; height: 100%; object-fit: contain; }
.job-title { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.job-company { font-size: 0.92rem; color: var(--muted); font-weight: 500; }
.job-meta { text-align: right; font-size: 0.82rem; color: var(--faint); line-height: 1.5; white-space: nowrap; }
.job-meta .dates { color: var(--text); font-weight: 600; }

.impact {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 14px 64px;
  padding: 10px 14px;
  border-radius: 10px;
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 600;
}
.impact svg { flex-shrink: 0; margin-top: 3px; }

.bullets { list-style: none; margin-left: 64px; display: flex; flex-direction: column; gap: 8px; }
.bullets li {
  position: relative;
  padding-left: 18px;
  font-size: 0.93rem;
  color: var(--muted);
}
.bullets li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--faint);
}
.job-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0 64px; }

.subroles { margin: 18px 0 0 64px; border-left: 2px solid var(--border); padding-left: 20px; display: flex; flex-direction: column; gap: 22px; }
.subrole { position: relative; }
.subrole::before {
  content: '';
  position: absolute;
  left: -27px;
  top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--faint);
}
.subrole:first-child::before { border-color: var(--accent); background: var(--accent); }
.subrole-head { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.subrole-title { font-weight: 700; font-size: 0.98rem; }
.subrole-date { font-size: 0.82rem; color: var(--faint); font-weight: 500; }
.subrole .impact, .subrole .bullets { margin-left: 0; }
.subrole .impact { margin-top: 0; }

/* ── SKILLS & EDUCATION ── */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.skill-group + .skill-group { margin-top: 20px; }
.skill-label { font-size: 0.8rem; font-weight: 700; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
}
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }

.sub-h { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 16px; }
.edu-list { display: flex; flex-direction: column; gap: 12px; }
.edu { display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; padding: 16px; }
.edu .card-icon { width: 48px; height: 48px; margin: 0; }
.edu-title { font-weight: 700; font-size: 0.95rem; line-height: 1.35; }
.edu-sub { font-size: 0.85rem; color: var(--muted); }
.edu-note { font-size: 0.85rem; color: var(--faint); margin-top: 12px; }

/* ── PROJECTS ── */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.projects.three { grid-template-columns: repeat(3, 1fr); }
.project-group + .project-group { margin-top: 40px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.group-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.group-sub { font-size: 0.85rem; color: var(--faint); }
.project-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-head .chips { margin-bottom: 14px; }
.project {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.project:hover { border-color: var(--accent); transform: translateY(-2px); }
.project .chips { margin-bottom: 14px; }
.project-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.project-desc { font-size: 0.92rem; color: var(--muted); flex: 1; }
.project.static:hover { border-color: var(--border); transform: none; }
.project-media {
  margin: -8px -8px 16px;
  height: 140px;
  border-radius: 10px;
  overflow: hidden;
  background: #0b0f17;
}
.project-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transition: transform 0.4s ease;
}
.project:hover .project-media video { transform: scale(1.03); }
.private-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface);
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}
.private-note svg { flex-shrink: 0; margin-top: 2px; color: var(--accent-text); }
.project .btn { align-self: flex-start; margin-top: 14px; }
.project-cta {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-text);
}

/* ── CONTACT ── */
.contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 36px;
}
.contact p { color: var(--muted); margin-top: 6px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }

footer {
  padding: 28px 0 40px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--faint);
}

/* ── MOTION ── */
.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;
}

/* Scroll reveal, staggered via --d */
.js .fade-in {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease var(--d, 0s), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s);
}
.js .fade-in.visible { opacity: 1; transform: none; }
.js .fade-in.settled { transition: border-color 0.15s, transform 0.15s; }

.js .reveal-chips .chip {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease var(--d, 0s), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s);
}
.js .reveal-chips.visible .chip { opacity: 1; transform: none; }

/* Highlighter sweep behind key phrases */
.hl {
  background-image: linear-gradient(var(--hl), var(--hl));
  background-repeat: no-repeat;
  background-position: 0 90%;
  background-size: 0% 42%;
  transition: background-size 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.35s;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl.in { background-size: 100% 42%; }
.impact.anim { background-size: 0% 100%; transition: background-size 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.2s; }
.impact.anim.in { background-size: 100% 100%; }

/* Count-up numbers */
.count { font-variant-numeric: tabular-nums; }

/* Rotating word in hero */
.rotator {
  display: inline-block;
  position: relative;
  vertical-align: top;
  white-space: nowrap;
  color: var(--accent-text);
  font-weight: 600;
  transition: width 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}
.rotator span {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateY(0.45em);
  filter: blur(6px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), filter 0.45s ease;
}
.rotator span.on { position: relative; opacity: 1; transform: none; filter: none; }
.rotator span.out { opacity: 0; transform: translateY(-0.45em); filter: blur(6px); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .fade-in, .js .reveal-chips .chip { opacity: 1; transform: none; transition: none; }
  .hl, .impact.anim { transition: none; }
  .rotator, .rotator span { transition: none; }
  .btn:hover, .project:hover { transform: none; }
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .projects.three { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 40px; }
  .cards-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .reel { margin-top: 36px; border-radius: 14px; }
  .reel-play { width: 64px; height: 64px; }
  .reel-toggle { right: 10px; bottom: 10px; width: 34px; height: 34px; }
  .container { padding: 0 16px; }
  .nav-links { display: none; }
  nav { width: calc(100% - 24px); --flare: 12px; }
  .nav-inner { grid-template-columns: 1fr auto; padding-left: 18px; }
  #hero { padding: 40px 0 56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .headshot { width: 120px; height: 120px; border-radius: 22px; order: -1; box-shadow: 0 0 0 6px var(--accent-soft); }
  section { padding: 56px 0; }
  .projects, .projects.three { grid-template-columns: 1fr; }
  .job { padding: 18px; }
  .job-head { grid-template-columns: 44px 1fr; gap: 12px; }
  .logo { width: 44px; height: 44px; }
  .job-meta { grid-column: 1 / -1; text-align: left; white-space: normal; }
  .job-meta br { display: none; }
  .job-meta .loc::before { content: ' · '; }
  .impact, .bullets, .job-links { margin-left: 0; }
  .subroles { margin-left: 6px; }
  .contact { padding: 24px; }
}
