:root {
  color-scheme: light;
  --bg: #fafaf8;
  --text: #1a1a18;
  --text-muted: #6b6b63;
  --accent: #2b4d3f;
  --border: #e8e8e4;
  --hover-bg: #f2f2ee;
  --shadow: 0 14px 40px rgba(20, 24, 20, 0.08);
  --shadow-soft: 0 24px 60px rgba(20, 24, 20, 0.07);
  --hero-wash: url("/assets/hero-wash.svg");
  --film-strip: url("/assets/films-strip.svg");
  --blueprint: url("/assets/blueprint-grid.svg");
  --patent-mark: url("/assets/patent-mark.svg");
  --max-width: 720px;
  --outer-width: 1080px;
  --section-space: 80px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111412;
  --text: #f4f3ee;
  --text-muted: #b2b1a7;
  --accent: #8fb4a2;
  --border: #292d28;
  --hover-bg: #171b18;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

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

button {
  color: inherit;
  font: inherit;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 30;
  padding: 0.7rem 0.95rem;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  top: 1rem;
}

.site-shell {
  min-height: 100vh;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  transition:
    border-color 220ms ease,
    background-color 220ms ease,
    backdrop-filter 220ms ease;
}

.site-nav.scrolled {
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(calc(100% - 2rem), var(--outer-width));
  margin: 0 auto;
  min-height: 72px;
}

.nav-brand,
.nav-back {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1;
}

.nav-links,
.nav-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link,
.nav-meta a,
.theme-toggle {
  position: relative;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.nav-link::after,
.nav-meta a::after,
.footer-link::after,
.inline-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.12rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}

.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-meta a:hover::after,
.nav-meta a:focus-visible::after,
.footer-link:hover::after,
.footer-link:focus-visible::after,
.inline-link:hover::after,
.inline-link:focus-visible::after {
  transform: scaleX(1);
}

.theme-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.nav-link:hover,
.nav-link:focus-visible,
.nav-meta a:hover,
.nav-meta a:focus-visible,
.footer-link:hover,
.footer-link:focus-visible,
.inline-link:hover,
.inline-link:focus-visible {
  color: var(--accent);
}

.container {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.hero {
  position: relative;
  width: min(calc(100% - 2rem), var(--outer-width));
  margin: 0 auto;
  padding: 70px 0 var(--section-space);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 14px 0 auto;
  height: 320px;
  background: center top / cover no-repeat var(--hero-wash);
  opacity: 0.06;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 2.75rem;
  width: min(100%, 860px);
  margin: 0 auto;
}

.portrait-wrap {
  width: 160px;
  height: 160px;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  justify-self: center;
  box-shadow: var(--shadow);
  background:
    radial-gradient(circle at 55% 32%, rgba(242, 242, 238, 0.96), rgba(232, 232, 228, 0.92));
}

:root[data-theme="dark"] .portrait-wrap {
  background:
    radial-gradient(circle at 55% 32%, rgba(41, 45, 40, 0.98), rgba(25, 28, 25, 0.95));
}

.portrait-wrap img {
  width: 112%;
  height: 112%;
  max-width: none;
  object-fit: cover;
  object-position: 63% 24%;
  filter: grayscale(30%) sepia(15%);
  transform: scale(0.97);
  opacity: 0;
  animation: photo-enter 700ms ease 260ms forwards;
  transition:
    filter 600ms ease,
    transform 600ms ease;
}

.portrait-wrap:hover img,
.portrait-wrap:focus-within img {
  filter: grayscale(0%) sepia(0%);
  transform: scale(1);
}

.hero-copy {
  max-width: 560px;
}

.hero-name,
.cv-name {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
}

.hero-tagline,
.cv-title {
  margin: 1rem 0 0;
  font-weight: 300;
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.load-sequence {
  opacity: 0;
  transform: translateY(16px);
  animation: rise-in 560ms ease forwards;
}

.beat-1 {
  animation-delay: 40ms;
}

.beat-2 {
  animation-delay: 220ms;
}

.beat-3 {
  animation-delay: 420ms;
}

.section {
  padding: var(--section-space) 0;
}

.prose p,
.thread p {
  margin: 0 0 1.7rem;
  font-size: 1rem;
}

.prose p:last-child,
.thread p:last-child {
  margin-bottom: 0;
}

.section-label {
  margin: 0 0 1.15rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: lowercase;
}

.current-list {
  border-top: 1px solid var(--border);
}

.current-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.current-row dt {
  margin: 0;
  color: var(--text-muted);
  font-family: "DM Mono", "SFMono-Regular", monospace;
  font-size: 0.8125rem;
}

.current-row dd {
  margin: 0;
  font-size: 0.9375rem;
}

.films-strip {
  width: 100%;
  height: 84px;
  border-radius: 4px;
  background: center / cover no-repeat var(--film-strip);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.films-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.film-card {
  padding: 1rem 1rem 0.95rem;
  border-radius: 4px;
  transition: background-color 180ms ease, border-radius 180ms ease;
}

.film-card:hover,
.film-card:focus-within {
  background: var(--hover-bg);
  border-radius: 4px;
}

.film-title,
.metric-value {
  font-family: "Cormorant Garamond", Georgia, serif;
}

.film-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.film-director {
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.films-note,
.cv-note {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

.site-footer {
  padding: 48px 0 56px;
}

.footer-links,
.cv-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer-link,
.inline-link {
  position: relative;
}

.footer-sep {
  color: var(--border);
}

.cv-hero {
  position: relative;
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 72px 0 44px;
}

.cv-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 210px;
  background: center top / cover no-repeat var(--blueprint);
  opacity: 0.08;
  pointer-events: none;
}

.cv-hero-inner {
  position: relative;
}

.cv-title {
  font-size: 1rem;
}

.cv-thread {
  padding-top: 16px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  padding: 1.2rem 1.1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: color-mix(in srgb, var(--bg) 90%, white);
}

:root[data-theme="dark"] .metric-card {
  background: color-mix(in srgb, var(--bg) 94%, black);
}

.metric-value {
  margin: 0;
  color: var(--accent);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
}

.metric-text {
  margin: 0.45rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.timeline {
  position: relative;
  margin-top: 0.25rem;
  padding-left: 1.6rem;
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 2rem;
}

.timeline-dot {
  position: absolute;
  left: -1.98rem;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.timeline-item:hover .timeline-dot,
.timeline-item:focus-within .timeline-dot {
  animation: pulse 360ms ease 1;
}

.timeline-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 500;
}

.timeline-date {
  margin: 0.15rem 0 0.7rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.timeline-body {
  margin: 0;
  font-size: 0.95rem;
}

.patent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 1rem;
  padding: 1.1rem 1.15rem;
  border-left: 2px solid var(--accent);
  background: #f0f5f2;
  border-radius: 0 4px 4px 0;
}

:root[data-theme="dark"] .patent-card {
  background: #18211d;
}

.patent-copy h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 500;
}

.patent-copy p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.patent-filed {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.patent-icon {
  align-self: start;
  width: 64px;
  height: 64px;
  background: center / contain no-repeat var(--patent-mark);
}

.skills-text,
.education-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.cv-footer {
  padding: 40px 0 56px;
}

.cv-footnote {
  margin: 0.8rem 0 0;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-style: italic;
  text-align: center;
}

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

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

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes photo-enter {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 767px) {
  :root {
    --section-space: 48px;
  }

  .nav-inner {
    min-height: 64px;
    align-items: flex-start;
    padding: 0.85rem 0;
  }

  .nav-links,
  .nav-meta {
    gap: 0.85rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .hero {
    padding-top: 42px;
  }

  .hero::before {
    height: 260px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .portrait-wrap {
    order: -1;
  }

  .hero-copy {
    max-width: none;
  }

  .current-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .films-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .patent-card {
    grid-template-columns: 1fr;
  }
}
