:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --text: #172026;
  --muted: #5c6770;
  --line: #d9dee3;
  --accent: #0f766e;
  --accent-warm: #a33a2b;
  --accent-soft: #edf5f3;
  --shadow: 0 18px 48px rgba(23, 32, 38, 0.1);
  --radius: 8px;
  --gutter: clamp(16px, 4vw, 40px);
  --content: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

body.preview-lock {
  overflow: hidden;
}

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

.page-shell {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 32px var(--gutter) 56px;
}

.gallery-header {
  position: relative;
  overflow: hidden;
  min-height: clamp(340px, 58vw, 560px);
  margin: 0 0 28px;
  padding: clamp(18px, 4vw, 32px) 0 clamp(24px, 5vw, 48px);
  border-top: 1px solid var(--text);
  border-bottom: 1px solid var(--text);
  display: grid;
  align-content: space-between;
  gap: 28px;
}

.gallery-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 72px, 72px 100%;
  opacity: 0.38;
}

.gallery-header::after {
  content: "PORTFOLIO";
  position: absolute;
  right: 0;
  bottom: clamp(14px, 3vw, 28px);
  z-index: -1;
  color: rgba(23, 32, 38, 0.055);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.6rem, 16vw, 12rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.8;
  pointer-events: none;
}

.header-meta {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: clamp(0.78rem, 1.7vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.header-meta span:not(:first-child) {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.title-lockup {
  display: grid;
  gap: clamp(12px, 2vw, 18px);
}

.eyebrow {
  width: fit-content;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--text);
  color: var(--text);
  background: rgba(246, 247, 248, 0.84);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  display: grid;
  gap: clamp(2px, 1vw, 12px);
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", "SimSun", "Songti SC", serif;
  font-size: clamp(4rem, 16vw, 11rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

h1 span:last-child {
  color: transparent;
  -webkit-text-stroke: 1px var(--text);
  text-stroke: 1px var(--text);
  transform: translateX(clamp(20px, 8vw, 90px));
}

.summary {
  position: relative;
  max-width: 30rem;
  margin: 0 0 0 auto;
  padding: 0 0 0 18px;
  color: var(--accent-warm);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  line-height: 1.45;
}

.summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 3px;
  height: calc(100% - 0.7em);
  background: var(--accent-warm);
}

.gallery-status {
  min-height: 48px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.gallery-status:empty {
  display: none;
}

.gallery-list {
  display: grid;
  gap: clamp(18px, 3vw, 32px);
}

.image-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.image-button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
  text-align: inherit;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.image-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.image-button:active {
  opacity: 0.92;
}

.image-shell {
  position: relative;
  min-height: 220px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 58%),
    var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(23, 32, 38, 0.04);
}

.image-shell.is-loaded {
  min-height: auto;
  background: transparent;
  box-shadow: none;
}

.gallery-image {
  width: 100%;
  height: auto;
  opacity: 0;
  transform: translateY(8px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.image-shell.is-loaded .gallery-image {
  opacity: 1;
  transform: translateY(0);
}

.error-note {
  margin: 0;
  padding: 18px;
  color: #8a1f17;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(13, 17, 18, 0.92);
  backdrop-filter: blur(12px);
  overscroll-behavior: contain;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__toolbar {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
}

.lightbox__control {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.lightbox__control:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.38);
}

.lightbox__control:active {
  transform: scale(0.96);
}

.lightbox__control:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.lightbox__control svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.lightbox__control--close {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox__stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  touch-action: none;
}

.lightbox__viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.lightbox__track {
  width: 300%;
  height: 100%;
  display: flex;
  transform: translate3d(calc(-33.333333% + var(--slide-offset, 0px)), 0, 0);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.lightbox__track.is-dragging,
.lightbox__track.is-panning {
  transition: none;
}

.lightbox__track.is-resetting .lightbox__image {
  transition: none;
}

.lightbox__panel {
  flex: 0 0 33.333333%;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox__image {
  --preview-slide-scale: 1;
  max-width: min(92vw, 1280px);
  max-height: 78dvh;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transform: translate3d(var(--preview-x, 0px), var(--preview-y, 0px), 0) scale(calc(var(--preview-scale, 1) * var(--preview-slide-scale, 1))) rotate(var(--preview-rotation, 0deg));
  transform-origin: center;
  transition:
    transform 140ms ease-out,
    opacity 180ms ease-out;
  cursor: grab;
  will-change: transform, opacity;
}

.lightbox__track.is-sliding-next .lightbox__panel:nth-child(2) .lightbox__image,
.lightbox__track.is-sliding-prev .lightbox__panel:nth-child(2) .lightbox__image {
  --preview-slide-scale: 0.92;
  opacity: 0.62;
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox__image.is-panning {
  cursor: grabbing;
  transition: none;
}

.lightbox__image--side {
  opacity: 0.62;
  transform: scale(var(--side-image-scale, 0.92));
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox__track.is-sliding-prev .lightbox__panel:nth-child(1) .lightbox__image--side,
.lightbox__track.is-sliding-next .lightbox__panel:nth-child(3) .lightbox__image--side {
  --side-image-scale: 1;
  opacity: 1;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
  transform: translateY(-50%);
  touch-action: manipulation;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.lightbox__nav:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.lightbox__nav svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.lightbox__nav--prev {
  left: max(16px, env(safe-area-inset-left));
}

.lightbox__nav--next {
  right: max(16px, env(safe-area-inset-right));
}

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

@media (max-width: 520px) {
  .page-shell {
    padding-top: 22px;
    padding-bottom: 36px;
  }

  .gallery-header {
    min-height: 360px;
  }

  .header-meta {
    grid-template-columns: 1fr;
  }

  .header-meta span:not(:first-child) {
    border-left: 0;
    padding-left: 0;
  }

  h1 span:last-child {
    transform: translateX(12px);
  }

  .summary {
    margin-left: 0;
  }

  .image-shell {
    min-height: 180px;
  }

  .lightbox__toolbar {
    justify-content: center;
    gap: 7px;
  }

  .lightbox__control {
    width: 44px;
    height: 44px;
  }

  .lightbox__image {
    max-width: 88vw;
    max-height: 74dvh;
  }

  .lightbox__nav {
    width: 44px;
    height: 64px;
    opacity: 0.82;
  }
}
