:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --bg-elevated: rgba(255, 255, 255, 0.76);
  --surface: #ffffff;
  --surface-soft: #eeeeef;
  --text: #111111;
  --muted: #66666b;
  --subtle: #8b8b91;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.18);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --max: 1180px;
  --header: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #050505;
  --bg-elevated: rgba(16, 16, 18, 0.74);
  --surface: #111113;
  --surface-soft: #1b1b1e;
  --text: #f5f5f7;
  --muted: #b7b7bd;
  --subtle: #7d7d84;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.58), transparent 34rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.09), transparent 34rem),
    linear-gradient(180deg, var(--bg), #09090a 54%, var(--bg));
}

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

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

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(18px, 4vw, 54px);
  border-bottom: 1px solid transparent;
  background: var(--bg-elevated);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.site-header[data-elevated="true"] {
  border-color: var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.brand {
  width: max-content;
  font-weight: 650;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 34px);
  color: var(--muted);
  font-size: 14px;
}

.nav-links a {
  transition: color 160ms ease;
}

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

.theme-toggle {
  justify-self: end;
  position: relative;
  width: 46px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.theme-toggle::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 180ms ease;
}

:root[data-theme="dark"] .theme-toggle::after {
  transform: translateX(18px);
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translateY(-50%);
  opacity: 0.58;
}

.theme-toggle__sun {
  left: 9px;
  background: var(--bg);
}

.theme-toggle__moon {
  right: 9px;
  box-shadow: inset -3px 0 0 var(--muted);
}

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

.hero {
  min-height: calc(100svh - var(--header));
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(320px, 1.08fr);
  align-items: center;
  gap: clamp(44px, 6vw, 86px);
  padding: clamp(52px, 8vw, 92px) 0 clamp(58px, 8vw, 104px);
}

.hero__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
}

.hero__media::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(62px);
  opacity: 0.72;
}

.hero__media img {
  position: relative;
  width: min(100%, 430px);
  height: auto;
  max-width: min(100%, 430px);
  max-height: 62svh;
  object-fit: contain;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hero__copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(58px, 9vw, 132px);
  line-height: 0.95;
  font-weight: 720;
  letter-spacing: 0;
}

h1 span {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(22px, 3vw, 42px);
  line-height: 1.05;
  font-weight: 620;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: 0;
}

.hero__lead {
  max-width: 660px;
  margin-bottom: 32px;
  color: var(--muted);
  font-size: clamp(20px, 3vw, 32px);
  line-height: 1.35;
}

.hero__actions,
.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
.contact__links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  font-size: 14px;
  font-weight: 620;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover,
.contact__links a:hover {
  transform: translateY(-1px);
  border-color: var(--text);
}

.button--primary {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.button--ghost,
.contact__links a {
  color: var(--text);
  background: var(--surface);
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 38px 0 0;
}

.hero__meta div {
  min-width: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.hero__meta dt {
  margin-bottom: 4px;
  color: var(--subtle);
  font-size: 12px;
}

.hero__meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 620;
}

.intro {
  padding: clamp(64px, 10vw, 132px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.intro p {
  width: min(980px, 100%);
  margin-bottom: 0;
  color: var(--text);
  font-size: clamp(24px, 4vw, 48px);
  line-height: 1.22;
  font-weight: 620;
}

.skills,
.works,
.timeline,
.projects,
.contact {
  padding: clamp(72px, 10vw, 136px) 0;
}

.section-heading {
  margin-bottom: clamp(30px, 5vw, 58px);
}

.section-heading--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: end;
  gap: 28px;
}

.section-heading--split > p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 17px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.skill-card {
  min-height: 252px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.skill-card span,
.work-card__kicker {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skill-card h3 {
  margin-top: auto;
}

.skill-card p,
.work-card p,
.timeline-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  align-items: start;
}

.work-card {
  grid-column: span 6;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.07);
}

.work-card[data-orientation="landscape"] {
  grid-column: span 12;
}

.work-card[data-orientation="portrait"] {
  grid-column: span 4;
}

.work-card__frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent),
    var(--surface-soft);
}

.work-card[data-orientation="portrait"] .work-card__frame {
  aspect-ratio: 9 / 16;
  min-height: 520px;
}

.work-card[data-orientation="square"] .work-card__frame {
  aspect-ratio: 1;
}

.work-card__video,
.work-card__embed {
  width: 100%;
  height: 100%;
  background: #000;
}

.work-card__video {
  object-fit: contain;
}

.work-card__embed {
  border: 0;
}

.play-loader {
  position: absolute;
  inset: auto auto 18px 18px;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 0 16px;
  color: #f5f5f7;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease;
}

.play-loader:hover {
  transform: translateY(-1px);
}

.work-card[data-loaded="true"] .play-loader {
  pointer-events: none;
  opacity: 0;
}

.work-card__body {
  padding: 22px;
}

.work-card__body h3 {
  margin-bottom: 8px;
}

.work-card__link {
  display: inline-flex;
  margin-left: 10px;
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

.work-card__kicker {
  margin-bottom: 10px;
}

.timeline-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(150px, 0.28fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 56px);
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item time {
  color: var(--subtle);
  font-size: 14px;
  font-weight: 650;
}

.timeline-item h3 {
  margin-bottom: 8px;
}

.project-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.project-cloud li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
}

.contact {
  border-top: 1px solid var(--line);
}

.contact h2 {
  max-width: 860px;
  margin-bottom: 28px;
}

.site-footer {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
  padding: 28px 0 44px;
  color: var(--subtle);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

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

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

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

  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }

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

@media (max-width: 960px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    display: none;
  }

  .hero,
  .section-heading--split,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 42px;
  }

  .hero__media {
    order: 2;
    justify-content: center;
  }

  .hero__media img {
    width: min(78vw, 360px);
    max-width: min(78vw, 360px);
    max-height: 50svh;
  }

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

  .work-card,
  .work-card[data-orientation="landscape"],
  .work-card[data-orientation="portrait"] {
    grid-column: span 12;
  }

  .work-card[data-orientation="portrait"] .work-card__frame {
    min-height: 0;
    max-height: 78svh;
  }
}

@media (max-width: 640px) {
  .section-shell,
  .site-footer {
    width: min(100% - 28px, var(--max));
  }

  .site-header {
    height: 58px;
    padding: 0 14px;
  }

  .hero__lead {
    font-size: 20px;
  }

  .hero__actions,
  .contact__links {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .contact__links a {
    width: 100%;
  }

  .hero__meta,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .skill-card {
    min-height: 220px;
  }

  .work-card__frame {
    min-height: 210px;
  }

  .work-card__body,
  .skill-card {
    padding: 18px;
  }

  .timeline-item {
    padding: 24px 0;
  }
}
