:root {
  color-scheme: dark;
  --bg: #05080d;
  --bg-soft: #0c121b;
  --surface: #0e1621;
  --surface-strong: #111d2d;
  --text: #eaf1fb;
  --muted: #9eb0c8;
  --line: #203248;
  --line-soft: rgba(95, 129, 166, 0.32);
  --accent: #54b5ff;
  --accent-soft: rgba(84, 181, 255, 0.19);
  --shadow: 0 26px 52px rgba(2, 8, 16, 0.45);
  --scroll-y: 0px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f6fb;
  --bg-soft: #eef3fa;
  --surface: #ffffff;
  --surface-strong: #f7fbff;
  --text: #102236;
  --muted: #4b6078;
  --line: #d4e0ee;
  --line-soft: rgba(67, 102, 138, 0.22);
  --accent: #0064b8;
  --accent-soft: rgba(0, 100, 184, 0.14);
  --shadow: 0 24px 44px rgba(11, 39, 73, 0.1);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: clamp(5.2rem, 7vw, 6.3rem);
}

body {
  min-height: 100dvh;
  overflow-x: clip;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.65;
  background:
    radial-gradient(circle at 12% -5%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 33%),
    radial-gradient(circle at 90% 12%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-soft) 42%, var(--bg));
  background-position: 0 calc(var(--scroll-y) * -0.15), 0 calc(var(--scroll-y) * -0.09), 0 0;
  transition: background-color 0.35s ease, color 0.35s ease;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: 0.11;
  background-image: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0);
  background-size: 4px 4px;
}

.ambient-glow {
  position: fixed;
  inset: -40dvh -20vw auto;
  height: 70dvh;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%);
  transform: translateY(calc(var(--scroll-y) * -0.18));
}

a {
  color: inherit;
}

.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;
}

.container {
  width: min(1720px, calc(100% - clamp(1rem, 2.2vw, 2.4rem)));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
}

.topbar {
  min-height: 4.4rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
}

.brand {
  font-size: 1.08rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.site-nav {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: color 0.22s ease;
}

.site-nav a:hover {
  color: var(--text);
}

.theme-toggle {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.theme-toggle .icon {
  width: 1.08rem;
  height: 1.08rem;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

main {
  padding-top: clamp(1.2rem, 1.7vw, 2rem);
  padding-bottom: 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: clamp(1.1rem, 2.9vw, 2.8rem);
  align-items: center;
  padding: clamp(1rem, 0.8rem + 1.2vw, 2rem);
  border-bottom: 1px solid var(--line-soft);
}

.hero-copy h1 {
  margin: 0 0 0.55rem;
  font-size: clamp(2rem, 1.3rem + 2vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.intro-line,
.bio-block {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: clamp(1rem, 0.94rem + 0.2vw, 1.12rem);
}

.intro-line {
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  font-weight: 580;
}

.bio-block {
  margin-top: 0.7rem;
}

.meta-line {
  margin: 0.7rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta-line svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.location-divider {
  margin-inline: 0.6rem;
}

.social-row {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.social-row a {
  width: 2.28rem;
  height: 2.28rem;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.social-row a:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.social-row svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.hero-photo-wrap {
  justify-self: end;
}

.hero-photo {
  width: clamp(108px, 14vw, 186px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  isolation: isolate;
}

#work {
  position: relative;
  isolation: isolate;
}

#work > .work-bg-art {
  --art-x: -999px;
  --art-y: -999px;
  --art-r: 128px;
  position: absolute;
  right: clamp(0.8rem, 1.6vw, 1.4rem);
  top: var(--work-art-top, clamp(12rem, 17vw, 15rem));
  width: clamp(340px, 34vw, 560px);
  aspect-ratio: 1068 / 712;
  pointer-events: none;
  z-index: 0;
  contain: paint;
}

#work > .work-bg-art .work-bg-art-base,
#work > .work-bg-art .work-bg-art-spotlight {
  position: absolute;
  inset: 0;
  background: url("assets/mcmc.jpg") center center / contain no-repeat;
  pointer-events: none;
}

#work > .work-bg-art .work-bg-art-base {
  opacity: 0.14;
}

#work > .work-bg-art .work-bg-art-spotlight {
  opacity: 0.82;
  -webkit-mask-image: radial-gradient(
    circle var(--art-r) at var(--art-x) var(--art-y),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 26%,
    rgba(0, 0, 0, 0.72) 56%,
    rgba(0, 0, 0, 0.34) 78%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: radial-gradient(
    circle var(--art-r) at var(--art-x) var(--art-y),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 26%,
    rgba(0, 0, 0, 0.72) 56%,
    rgba(0, 0, 0, 0.34) 78%,
    rgba(0, 0, 0, 0) 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  will-change: mask-image;
}

#work > * {
  position: relative;
  z-index: 1;
}

.section {
  margin-top: clamp(1rem, 1.3vw, 1.6rem);
}

.section h2 {
  margin: 0 0 0.95rem;
  font-size: clamp(1.42rem, 1.15rem + 0.95vw, 2rem);
  line-height: 1.15;
}

#about,
#work,
#past {
  scroll-margin-top: clamp(5.2rem, 7vw, 6.3rem);
}

.role-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 2.1vw, 1.5rem);
  max-width: min(980px, 100%);
}

.role-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 1rem;
  background: linear-gradient(
    150deg,
    color-mix(in srgb, var(--surface) 94%, transparent),
    color-mix(in srgb, var(--surface-strong) 92%, transparent)
  );
  min-height: clamp(180px, 24vh, 250px);
  box-shadow: var(--shadow);
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition:
    opacity 0.32s ease,
    transform 0.39s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.36s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease;
}

.role-card:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 30px 56px color-mix(in srgb, var(--accent) 10%, rgba(2, 8, 16, 0.52));
}

.reveal-card {
  opacity: 0;
  transform: translateY(56px) scale(0.986);
  filter: blur(8px);
  transition-delay: calc(var(--card-order, 0) * 60ms);
}

.reveal-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.role-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 43%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.role-card:hover::after {
  opacity: 1;
}

.role-meta {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.02em;
  font-size: 0.72rem;
  color: var(--muted);
}

.role-date {
  margin: 0.34rem 0 0.08rem;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.045em;
  color: color-mix(in srgb, var(--muted) 88%, var(--text));
}

.inline-link-icon {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.26rem;
  vertical-align: text-bottom;
  color: var(--muted);
  transition: color 0.2s ease;
}

.inline-link-icon:hover {
  color: var(--accent);
}

.inline-link-icon svg {
  width: 1rem;
  height: 1rem;
}

.role-card h3 {
  margin: 0.5rem 0 0.52rem;
  font-size: clamp(1.16rem, 1rem + 0.5vw, 1.4rem);
  line-height: 1.2;
}

.role-card p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  margin-top: 0.8rem;
  padding: 1rem 0 2rem;
  border-top: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  #work > .work-bg-art {
    right: 0.75rem;
    width: clamp(240px, 42vw, 380px);
  }

  .hero-photo-wrap {
    order: -1;
    justify-self: end;
    margin-bottom: 0.55rem;
  }

  .role-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: auto;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand theme"
      "nav nav";
    gap: 0.55rem 0.8rem;
    padding: 0.78rem 0;
  }

  .brand {
    grid-area: brand;
  }

  .site-nav {
    grid-area: nav;
    justify-self: start;
    gap: 1rem;
  }

  .theme-toggle {
    grid-area: theme;
    justify-self: end;
  }

  main {
    padding-top: 1rem;
  }

  .hero {
    padding: 0.6rem 0 1rem;
  }

  #work > .work-bg-art {
    display: none;
  }

  .role-card {
    min-height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation: none !important;
    transition: none !important;
  }

  .ambient-glow {
    transform: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .reveal-card {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
