:root {
  --bg: #fbfbf9;
  --paper: #ffffff;
  --ink: #111111;
  --muted: #707070;
  --line: #dedede;
  --soft-line: #eeeeec;
  --accent: #2f7cff;
  --overlay: rgba(14, 14, 13, 0.68);
  --shadow: 0 22px 70px rgba(16, 16, 16, 0.08);
  --radius: 7px;
  --gutter: clamp(14px, 1.15vw, 20px);
  --max: 1540px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body.panel-open,
body.dialog-open {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

button {
  font: inherit;
}

.page-shell {
  width: min(var(--max), calc(100% - clamp(28px, 6vw, 88px)));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}

.wordmark {
  font-size: clamp(32px, 3.1vw, 54px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.14em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 56px);
  font-size: 14px;
  font-weight: 700;
}

.desktop-nav a {
  position: relative;
  padding: 10px 0;
}

.desktop-nav a::after {
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity 180ms ease, transform 180ms ease;
}

.desktop-nav a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.menu-toggle.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.scroll-rail {
  position: fixed;
  top: 180px;
  bottom: 78px;
  left: clamp(22px, 4vw, 76px);
  z-index: 5;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 22px;
  width: 30px;
  justify-items: center;
  color: #202020;
  pointer-events: none;
}

.rail-index,
.rail-arrow {
  font-size: 12px;
  line-height: 1;
}

.rail-track {
  position: relative;
  width: 1px;
  overflow: hidden;
  background: #d6d6d1;
}

.rail-progress {
  position: absolute;
  top: 0;
  left: -1px;
  width: 3px;
  height: 0%;
  border-radius: 999px;
  background: var(--accent);
}

.work-section {
  padding-top: 24px;
}

.filter-row {
  position: sticky;
  top: 82px;
  z-index: 15;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 18px 0 22px;
  overflow-x: auto;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 36px;
  padding: 0 19px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: #555;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease,
    transform 160ms ease;
}

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

.filter.is-active {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent);
}

.gallery-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: stretch;
}

.photo-card {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: #ececea;
  box-shadow: 0 1px 0 rgba(18, 18, 18, 0.05);
  cursor: pointer;
  isolation: isolate;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 520ms ease, transform 520ms ease, box-shadow 260ms ease;
}

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

.photo-card.is-hidden {
  display: none;
}

.photo-card:hover {
  box-shadow: var(--shadow);
}

.photo-card.featured {
  grid-column: span 2;
  grid-row: span 2;
  min-height: 590px;
}

.photo-card.wide {
  grid-column: span 2;
  min-height: 290px;
}

.photo-card.tall {
  grid-row: span 2;
  min-height: 520px;
}

.photo-card img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
  transition: transform 620ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 260ms ease;
}

.photo-card:hover img {
  filter: saturate(0.96) contrast(1.02);
  transform: scale(1.035);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(18px, 2vw, 30px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.44), var(--overlay));
  color: #fff;
  opacity: 0;
  transition: opacity 220ms ease;
}

.photo-card:hover .photo-overlay,
.photo-card:focus-visible .photo-overlay {
  opacity: 1;
}

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

.photo-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.photo-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.photo-meta {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-section {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: clamp(32px, 7vw, 120px);
  padding: clamp(88px, 12vw, 150px) 0 80px;
  border-top: 1px solid var(--soft-line);
  margin-top: clamp(42px, 6vw, 80px);
}

.section-kicker {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.about-section h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(34px, 5vw, 78px);
  font-weight: 500;
  line-height: 1.04;
}

.about-section p:not(.section-kicker) {
  align-self: end;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.55;
}

.contact-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 28px 0 8px;
  border-top: 1px solid var(--soft-line);
  color: #1c1c1c;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
  min-width: 0;
}

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

.wechat-button {
  min-height: 34px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: #1c1c1c;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease,
    transform 160ms ease;
}

.wechat-button:hover,
.wechat-button:focus-visible {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent);
  outline: 0;
  transform: translateY(-1px);
}

.mobile-panel {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  padding: 92px 32px 32px;
  background: rgba(251, 251, 249, 0.96);
  backdrop-filter: blur(22px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-14px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.mobile-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.mobile-panel a {
  font-size: clamp(34px, 12vw, 66px);
  font-weight: 500;
  letter-spacing: 0.08em;
}

.project-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 36px));
  max-height: min(860px, calc(100vh - 36px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.24);
}

.wechat-dialog {
  position: relative;
  width: min(420px, calc(100vw - 36px));
  padding: 46px 32px 34px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.22);
}

.wechat-dialog::backdrop {
  background: rgba(20, 20, 18, 0.5);
  backdrop-filter: blur(12px);
}

.wechat-copy {
  display: grid;
  gap: 14px;
}

.wechat-copy span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.wechat-copy strong {
  color: var(--ink);
  font-size: clamp(34px, 7vw, 54px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
}

.project-dialog::backdrop {
  background: rgba(20, 20, 18, 0.5);
  backdrop-filter: blur(12px);
}

.project-dialog img {
  width: 100%;
  max-height: min(70vh, 680px);
  display: block;
  object-fit: contain;
  background: #ececea;
}

.dialog-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: baseline;
  padding: 22px 24px 24px;
}

.dialog-copy span,
.dialog-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dialog-copy h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 500;
  line-height: 1;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  color: #111;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 1180px) {
  .page-shell {
    width: min(100% - 38px, 980px);
  }

  .scroll-rail {
    display: none;
  }

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

  .photo-card.featured {
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: calc(100% - 24px);
    padding-top: 14px;
  }

  .site-header {
    min-height: 70px;
  }

  .wordmark {
    font-size: clamp(25px, 7vw, 34px);
    letter-spacing: 0.12em;
  }

  .desktop-nav {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .work-section {
    padding-top: 4px;
  }

  .filter-row {
    top: 70px;
    justify-content: flex-start;
    margin-right: -12px;
    margin-left: -12px;
    padding: 14px 12px 18px;
  }

  .filter {
    min-width: auto;
    min-height: 34px;
    padding: 0 16px;
    font-size: 12px;
  }

  .gallery-meta {
    margin-top: 4px;
  }

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

  .photo-card,
  .photo-card.wide,
  .photo-card.tall,
  .photo-card.featured {
    grid-column: auto;
    grid-row: auto;
    min-height: auto;
    aspect-ratio: 1 / 1.18;
  }

  .photo-card:nth-child(5n + 1) {
    grid-column: span 2;
    aspect-ratio: 1.45 / 1;
  }

  .photo-overlay {
    padding: 14px;
    background: linear-gradient(180deg, transparent 28%, rgba(0, 0, 0, 0.62));
  }

  .photo-card:active .photo-overlay {
    opacity: 1;
  }

  .photo-label {
    align-items: flex-start;
    font-size: 11px;
    line-height: 1.35;
  }

  .photo-arrow {
    width: 24px;
    height: 24px;
    font-size: 15px;
  }

  .about-section {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 72px 0 58px;
  }

  .contact-section {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 30px;
    font-size: 12px;
  }

  .contact-actions {
    flex-wrap: wrap;
  }

  .dialog-copy {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .photo-card {
    opacity: 1;
    transform: none;
  }
}
