:root {
  --bg: #f5f5f7;
  --bg-rgb: 245, 245, 247;
  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --surface-soft: #fbfbfd;
  --text: #1d1d1f;
  --text-rgb: 29, 29, 31;
  --muted: #6e6e73;
  --muted-strong: #424245;
  --line: rgba(var(--text-rgb), 0.1);
  --line-strong: rgba(var(--text-rgb), 0.18);
  --accent: #0066cc;
  --accent-rgb: 0, 102, 204;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --accent-strong: #004f9f;
  --warm: #b25f1a;
  --warm-rgb: 178, 95, 26;
  --warm-soft: rgba(var(--warm-rgb), 0.1);
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-strong: rgba(0, 0, 0, 0.14);
  --radius: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Inter", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --surface: #161617;
  --surface-rgb: 22, 22, 23;
  --surface-soft: #1d1d1f;
  --text: #f5f5f7;
  --text-rgb: 245, 245, 247;
  --muted: #a1a1a6;
  --muted-strong: #d2d2d7;
  --line: rgba(var(--text-rgb), 0.11);
  --line-strong: rgba(var(--text-rgb), 0.18);
  --accent: #2997ff;
  --accent-rgb: 41, 151, 255;
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --accent-strong: #7cc0ff;
  --warm: #ffb36c;
  --warm-rgb: 255, 179, 108;
  --warm-soft: rgba(var(--warm-rgb), 0.14);
  --shadow: rgba(0, 0, 0, 0.32);
  --shadow-strong: rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
}

.page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 24px 72px;
}

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

h1,
h2,
h3,
h4 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  margin: 0 auto;
  font-size: clamp(3.45rem, 8vw, 7.7rem);
  line-height: 0.93;
}

h2 {
  max-width: 920px;
  font-size: clamp(2.35rem, 5vw, 5.2rem);
  line-height: 0.98;
}

h3 {
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 2rem);
  line-height: 1.1;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  margin: 0 -24px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(var(--bg-rgb), 0.78);
  backdrop-filter: saturate(180%) blur(18px);
}

.logo {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
}

.nav-links,
.nav-controls {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.nav-links {
  color: var(--muted);
  font-size: 0.88rem;
}

.nav-links a,
.theme-toggle {
  transition: color 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.is-active {
  color: var(--text);
}

.theme-toggle,
.button,
.filter-chip,
.case-toggle {
  font: inherit;
}

.theme-toggle,
.button,
.filter-chip,
.case-toggle {
  border: 0;
  cursor: pointer;
}

.theme-toggle {
  min-height: 32px;
  padding: 6px 11px;
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--muted-strong);
  font-size: 0.82rem;
}

.hero {
  padding-top: clamp(68px, 9vw, 126px);
}

.hero-shell {
  display: grid;
  gap: 34px;
}

.hero-main {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.eyebrow,
.section-kicker,
.panel-label,
.project-overline,
.metric-label,
.detail-label,
.contact-label,
.credential-label,
.skill-meta,
.status-badge,
.project-year,
.section-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.eyebrow,
.section-kicker,
.project-overline {
  color: var(--accent);
}

.hero-kicker {
  max-width: 820px;
  color: var(--muted-strong);
  font-size: clamp(1.24rem, 1rem + 0.9vw, 2rem);
  font-weight: 600;
  line-height: 1.22;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.02rem, 0.95rem + 0.25vw, 1.22rem);
}

.hero-actions,
.hero-links,
.project-filters,
.project-stack,
.project-links,
.contact-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-actions,
.hero-links {
  justify-content: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 600;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.ghost,
.button.subtle {
  background: transparent;
}

.button:hover,
.button:focus-visible {
  color: var(--accent-strong);
}

.button.primary:hover,
.button.primary:focus-visible {
  color: #fff;
  background: var(--accent-strong);
}

.hero-side {
  display: none;
}

.signal-panel,
.hero-links-card,
.credentials-card,
.skill-card,
.contact-card {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 48px var(--shadow);
}

.signal-panel,
.hero-links-card {
  padding: 22px;
  display: grid;
  gap: 14px;
}

.fit-grid,
.proof-strip,
.credentials-grid,
.skills-grid,
.featured-grid,
.research-grid,
.projects-grid,
.contact-grid {
  display: grid;
}

.fit-grid {
  gap: 12px;
}

.fit-item {
  display: grid;
  gap: 4px;
}

.fit-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.fit-value {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.38;
}

#proofStrip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: 0 18px 48px var(--shadow);
}

.proof-item {
  display: grid;
  gap: 4px;
  padding: 18px;
  background: var(--surface);
}

.proof-value {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 720;
  line-height: 1.1;
}

.proof-label {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.hero-links-card .button {
  width: 100%;
  background: var(--surface-soft);
}

.hero-links {
  display: grid;
  grid-template-columns: 1fr;
}

.section {
  width: min(1180px, 100%);
  margin: 74px auto 0;
  display: grid;
  gap: 26px;
}

.section-header {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.section-header p {
  max-width: 720px;
  font-size: 1.08rem;
}

.section-hint {
  justify-self: center;
  color: var(--muted);
  font-weight: 500;
}

.block-header {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.featured-block,
.research-block,
.projects-block {
  display: grid;
  gap: 18px;
}

.featured-grid,
.research-grid,
.projects-grid {
  gap: 20px;
}

.project-filters {
  justify-content: center;
}

.filter-chip {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 24px var(--shadow);
}

.filter-chip.is-active {
  background: var(--text);
  color: var(--bg);
}

.project-card {
  display: grid;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 22px 56px var(--shadow);
}

.project-card.featured {
  min-height: 100%;
  grid-template-columns: 1fr;
}

.project-card.empty {
  padding: 40px;
  text-align: center;
}

.project-visual {
  display: grid;
  align-content: center;
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.12), transparent 46%),
    var(--surface-soft);
}

.project-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-position: center;
}

.project-visual--cover img {
  object-fit: cover;
}

.project-visual--contain img {
  object-fit: contain;
  padding: clamp(16px, 3vw, 36px);
}

.project-visual figcaption {
  padding: 0 24px 24px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.38;
  text-align: center;
}

.project-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(24px, 4vw, 52px);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.project-overline {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.project-title {
  display: inline-block;
  color: var(--text);
  font-size: clamp(1.65rem, 1.1rem + 1.3vw, 2.7rem);
  font-weight: 740;
  line-height: 1.02;
}

.project-title:hover {
  color: var(--accent);
}

.project-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  flex: 0 0 auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.project-headline {
  color: var(--text);
  font-size: clamp(1.08rem, 1rem + 0.32vw, 1.32rem);
  font-weight: 650;
  line-height: 1.35;
}

.project-summary {
  font-size: 1rem;
}

.project-note {
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--warm-soft);
  color: var(--muted-strong);
  font-size: 0.95rem;
  line-height: 1.48;
}

.project-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.project-metric {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 13px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metric-value {
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 730;
  line-height: 1.1;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.project-details {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.project-details[hidden] {
  display: none;
}

.detail-row {
  display: grid;
  gap: 4px;
}

.detail-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.detail-body {
  color: var(--muted-strong);
  font-size: 0.94rem;
  line-height: 1.48;
}

.project-stack {
  gap: 7px;
}

.project-stack span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 600;
}

.project-links {
  margin-top: auto;
}

.case-toggle {
  width: fit-content;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 0.93rem;
  font-weight: 650;
}

.featured-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.featured-grid .project-visual,
.research-grid .project-visual,
.projects-grid .project-visual {
  min-height: auto;
}

.featured-grid .project-visual img,
.research-grid .project-visual img,
.projects-grid .project-visual img {
  aspect-ratio: 16 / 9;
}

.featured-grid .project-body {
  padding: clamp(24px, 3vw, 34px);
}

.featured-grid .project-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.research-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.research-grid .project-card,
.projects-grid .project-card {
  min-height: 100%;
}

.research-grid .project-body,
.projects-grid .project-body {
  padding: 24px;
}

.research-grid .project-title,
.projects-grid .project-title {
  font-size: clamp(1.45rem, 1.1rem + 0.85vw, 2.1rem);
}

.research-grid .project-metrics {
  grid-template-columns: 1fr;
}

.projects-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.credentials-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
}

.credentials-card,
.skill-card,
.contact-card {
  padding: 28px;
}

.credentials-card--lead p {
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 580;
}

.credentials-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.credential-item {
  display: grid;
  gap: 7px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 14px 36px var(--shadow);
}

.credential-value {
  color: var(--text);
  font-weight: 650;
  line-height: 1.38;
}

.skills-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.skill-card {
  display: grid;
  gap: 14px;
}

.skill-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.skill-list span {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 600;
}

.contact-card {
  display: grid;
  gap: 20px;
}

.contact-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.contact-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.contact-value {
  color: var(--text);
  font-weight: 650;
}

.contact-value a {
  color: var(--accent);
}

.footer {
  width: min(1180px, 100%);
  margin: 64px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-card[hidden] {
  display: none;
}

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

@media (max-width: 1060px) {
  .hero-side,
  .credentials-layout,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .featured-grid,
  .research-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page {
    padding-inline: 14px;
  }

  .nav {
    margin-inline: -14px;
    padding: 12px 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    gap: 14px;
  }

  .hero {
    padding-top: 54px;
  }

  .hero-side {
    display: none;
  }

  h1 {
    font-size: clamp(3rem, 14vw, 4.5rem);
  }

  h2 {
    font-size: clamp(2.4rem, 11vw, 3.7rem);
  }

  .section {
    margin-top: 68px;
  }

  .featured-grid,
  .research-grid,
  .projects-grid,
  .credentials-grid,
  .project-metrics {
    grid-template-columns: 1fr;
  }

  .project-card.featured {
    min-height: auto;
  }

  .project-body {
    padding: 22px;
  }

  .project-header {
    flex-direction: column;
  }

  .project-meta {
    justify-items: start;
  }

  .project-visual figcaption {
    padding: 0 18px 18px;
  }
}
