:root {
  --gallery-ink: oklch(0.17 0.012 165);
  --gallery-ink-soft: oklch(0.34 0.014 165);
  --gallery-muted: oklch(0.46 0.012 165);
  --gallery-line: oklch(0.86 0.008 165);
  --gallery-surface: oklch(0.985 0.002 165);
  --gallery-surface-alt: oklch(0.955 0.006 165);
  --gallery-green: oklch(0.37 0.075 162);
  --gallery-green-dark: oklch(0.29 0.06 162);
  --gallery-white: oklch(1 0 0);
  --gallery-danger: oklch(0.54 0.19 27);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --z-sticky: 20;
  --z-dialog: 80;
  --z-toast: 100;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  color: var(--gallery-ink);
  background: var(--gallery-surface);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  font-family: "Avenir Next", Avenir, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--gallery-ink);
  background: var(--gallery-surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.viewer-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--gallery-green);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: var(--z-toast);
  padding: 10px 16px;
  color: var(--gallery-white);
  background: var(--gallery-green-dark);
  transform: translateY(-160%);
  transition: transform 180ms var(--ease-out-expo);
}
.skip-link:focus { transform: translateY(0); }

.gallery-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 32px;
  padding: 10px clamp(22px, 4vw, 72px);
  color: var(--gallery-ink);
  background: color-mix(in oklch, var(--gallery-surface) 94%, transparent);
  border-bottom: 1px solid var(--gallery-line);
  backdrop-filter: blur(14px);
}

.gallery-brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  font-weight: 650;
  letter-spacing: .04em;
}

.gallery-brand__mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--gallery-white);
  background: var(--gallery-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}

.gallery-brand__logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  object-fit: contain;
}

.gallery-brand__text { white-space: nowrap; }

.gallery-header__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 2.5vw, 38px);
  font-size: 14px;
  font-weight: 520;
}

.gallery-header__nav a {
  position: relative;
  padding: 9px 0;
  color: var(--gallery-ink-soft);
}

.gallery-header__nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  background: var(--gallery-green);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 240ms var(--ease-out-expo);
}

.gallery-header__nav a:hover,
.gallery-header__nav a[aria-current="page"] { color: var(--gallery-ink); }
.gallery-header__nav a:hover::after,
.gallery-header__nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

.gallery-header__contact,
.album-contact {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  color: var(--gallery-white);
  background: var(--gallery-green-dark);
  border: 1px solid var(--gallery-green-dark);
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
  transition: background-color 180ms ease, transform 180ms ease;
}

.gallery-header__contact:hover,
.album-contact:hover { background: var(--gallery-ink); }
.gallery-header__contact:active,
.album-contact:active { transform: translateY(1px); }

.gallery-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr);
  align-items: end;
  min-height: min(660px, 70dvh);
  padding: clamp(74px, 10vw, 150px) clamp(22px, 6vw, 104px) clamp(70px, 8vw, 120px);
  color: var(--gallery-white);
  background: var(--gallery-ink);
}

.gallery-intro__context {
  margin: 0 0 30px;
  color: oklch(0.76 0.02 165);
  font-size: clamp(13px, 1.2vw, 16px);
  letter-spacing: .12em;
}

.gallery-intro h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3rem, 7.3vw, 6rem);
  font-weight: 530;
  line-height: 1.05;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.gallery-intro__note {
  align-self: end;
  padding: 24px 0 6px;
  border-top: 1px solid oklch(0.42 0.012 165);
}

.gallery-intro__note p {
  max-width: 34ch;
  margin: 0 0 34px;
  color: oklch(0.77 0.014 165);
  font-size: 15px;
  line-height: 1.8;
  text-wrap: pretty;
}

.gallery-intro__note span {
  color: var(--gallery-white);
  font-size: 13px;
  font-weight: 620;
}

.catalog-controls {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr);
  gap: clamp(30px, 6vw, 96px);
  padding: clamp(48px, 6vw, 86px) clamp(22px, 6vw, 104px);
  background: var(--gallery-white);
  border-bottom: 1px solid var(--gallery-line);
}

.catalog-search {
  align-self: start;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--gallery-ink);
}

.catalog-search > i { color: var(--gallery-green-dark); font-size: 20px; }
.catalog-search input {
  width: 100%;
  min-height: 42px;
  padding: 0;
  color: var(--gallery-ink);
  background: transparent;
  border: 0;
  font-size: 16px;
  outline: 0;
}
.catalog-search input::placeholder { color: var(--gallery-muted); opacity: 1; }

.catalog-search__clear {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--gallery-muted);
  background: transparent;
  border: 0;
}

.catalog-search__submit {
  min-height: 40px;
  padding: 0 16px;
  color: var(--gallery-white);
  background: var(--gallery-ink);
  border: 1px solid var(--gallery-ink);
  font-size: 13px;
  font-weight: 650;
}
.catalog-search__submit:hover { background: var(--gallery-green-dark); border-color: var(--gallery-green-dark); }

.filter-dimensions { display: grid; gap: 32px; }
.filter-group {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.filter-group__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--gallery-ink);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.filter-group__label i { color: var(--gallery-green); font-size: 18px; }
.filter-list { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip {
  min-height: 34px;
  padding: 5px 13px;
  color: var(--gallery-ink-soft);
  background: transparent;
  border: 1px solid var(--gallery-line);
  font-size: 13px;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.filter-chip:hover { color: var(--gallery-green-dark); border-color: var(--gallery-green); }
.filter-chip:active { transform: translateY(1px); }
.filter-chip.is-active {
  color: var(--gallery-white);
  background: var(--gallery-green-dark);
  border-color: var(--gallery-green-dark);
}
.filter-chip--nested { font-size: 12px; }

.active-filter-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
  color: var(--gallery-ink-soft);
  border-top: 1px solid var(--gallery-line);
  font-size: 13px;
}
.active-filter-summary button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  color: var(--gallery-green-dark);
  background: transparent;
  border: 0;
  font-weight: 650;
}

.catalog-results {
  min-height: 560px;
  padding: clamp(70px, 8vw, 128px) clamp(22px, 6vw, 104px) clamp(90px, 10vw, 160px);
}
.catalog-results__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: clamp(38px, 5vw, 72px);
}
.catalog-results__heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  font-weight: 540;
  line-height: 1.1;
  letter-spacing: -.025em;
}
.catalog-results__heading p { margin: 0; color: var(--gallery-muted); font-size: 13px; }

.album-catalog {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(14px, 2vw, 28px);
  row-gap: clamp(42px, 6vw, 88px);
}
.catalog-card { grid-column: span 4; min-width: 0; }
.catalog-card:nth-child(5n + 1) { grid-column: span 5; }
.catalog-card:nth-child(5n + 2) { grid-column: span 3; padding-top: clamp(28px, 5vw, 76px); }
.catalog-card:nth-child(5n + 3) { grid-column: span 4; }
.catalog-card--featured { grid-column: span 7 !important; padding-top: 0 !important; }
.catalog-card__link { display: block; }
.catalog-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--gallery-surface-alt);
}
.catalog-card--featured .catalog-card__media { aspect-ratio: 16 / 10; }
.catalog-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 380ms ease, transform 650ms var(--ease-out-expo);
}
.catalog-card__media.is-loaded img { opacity: 1; }
.catalog-card__link:hover .catalog-card__media img { transform: scale(1.045); }
.catalog-card__media--missing {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--gallery-muted);
}
.catalog-card__media--missing i { font-size: 32px; }
.catalog-card__media--missing span { font-size: 12px; }
.catalog-card__count {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 8px 11px;
  color: var(--gallery-white);
  background: color-mix(in oklch, var(--gallery-ink) 90%, transparent);
  font-size: 12px;
  font-weight: 620;
}
.catalog-card__body { padding: 18px 2px 0; }
.catalog-card__context {
  margin: 0 0 9px;
  color: var(--gallery-green-dark);
  font-size: 12px;
  font-weight: 650;
}
.catalog-card h3 {
  margin: 0;
  font-size: clamp(1.28rem, 2vw, 1.8rem);
  font-weight: 580;
  line-height: 1.25;
  letter-spacing: -.018em;
  text-wrap: balance;
}
.catalog-card__description {
  display: -webkit-box;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--gallery-muted);
  font-size: 13px;
  line-height: 1.7;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.catalog-card__action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--gallery-ink);
  font-size: 13px;
  font-weight: 650;
}
.catalog-card__action i { transition: transform 200ms var(--ease-out-expo); }
.catalog-card__link:hover .catalog-card__action i { transform: translate(3px, -3px); }

.catalog-status,
.catalog-empty,
.catalog-error {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  text-align: center;
}
.catalog-status > p,
.catalog-empty > p { max-width: 52ch; margin: 0; color: var(--gallery-muted); font-size: 14px; }
.catalog-empty > i { color: var(--gallery-green); font-size: 42px; }
.catalog-empty h3,
.catalog-error h3 { margin: 0; font-size: 22px; font-weight: 600; }
.catalog-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }
.catalog-skeleton { display: flex; gap: 8px; }
.catalog-skeleton span {
  width: 42px;
  height: 58px;
  background: var(--gallery-surface-alt);
  animation: gallery-pulse 1.2s ease-in-out infinite alternate;
}
.catalog-skeleton span:nth-child(2) { animation-delay: 120ms; }
.catalog-skeleton span:nth-child(3) { animation-delay: 240ms; }

.catalog-error {
  grid-template-columns: auto minmax(0, 420px) auto;
  justify-content: center;
  text-align: left;
}
.catalog-error > i { color: var(--gallery-danger); font-size: 32px; }
.catalog-error p { margin: 4px 0 0; color: var(--gallery-muted); font-size: 14px; }
.catalog-error__actions { display: flex; gap: 8px; }
.catalog-load-more {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-top: clamp(42px, 6vw, 84px);
}
.catalog-load-more .button { gap: 8px; }
.catalog-load-more > span { min-height: 18px; color: var(--gallery-muted); font-size: 12px; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 17px;
  border: 1px solid var(--gallery-ink);
  font-size: 13px;
  font-weight: 650;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.button:active { transform: translateY(1px); }
.button--dark { color: var(--gallery-white); background: var(--gallery-ink); }
.button--dark:hover { background: var(--gallery-green-dark); border-color: var(--gallery-green-dark); }
.button--line { color: var(--gallery-ink); background: transparent; }
.button--line:hover { color: var(--gallery-white); background: var(--gallery-ink); }

.gallery-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 42px clamp(22px, 6vw, 104px);
  color: oklch(0.76 0.014 165);
  background: var(--gallery-ink);
  font-size: 13px;
}
.gallery-footer p { margin: 0; color: var(--gallery-white); font-size: 15px; font-weight: 600; }
.gallery-footer div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 28px; }
.gallery-footer a { color: var(--gallery-white); text-decoration: underline; text-underline-offset: 4px; }

/* Album detail */
.album-page { background: var(--gallery-surface); }
.album-draft-banner {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px clamp(18px, 4vw, 64px);
  color: oklch(0.98 0.008 95);
  background: oklch(0.35 0.075 78);
  font-size: 12px;
  letter-spacing: .02em;
}
.album-draft-banner i { font-size: 17px; }
.album-draft-banner strong { font-size: 13px; }
.album-draft-banner a { margin-left: auto; text-decoration: underline; text-underline-offset: 4px; }
.album-headerbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  min-height: 70px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 10px clamp(18px, 4vw, 64px);
  background: color-mix(in oklch, var(--gallery-surface) 94%, transparent);
  border-bottom: 1px solid var(--gallery-line);
  backdrop-filter: blur(14px);
}
.album-back,
.album-contact { font-size: 13px; font-weight: 620; }
.album-back { justify-self: start; display: inline-flex; align-items: center; gap: 9px; color: var(--gallery-ink-soft); }
.album-back:hover { color: var(--gallery-green-dark); }
.gallery-brand--compact { justify-self: center; }

.album-main { min-height: calc(100dvh - 70px); }
.album-hero {
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(320px, .92fr);
  min-height: calc(100dvh - 70px);
  background: var(--gallery-white);
}
.album-hero__cover { position: relative; min-height: 620px; overflow: hidden; background: var(--gallery-surface-alt); }
.album-hero__cover img { width: 100%; height: 100%; object-fit: cover; }
.album-hero__cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gallery-muted); }
.album-hero__cover-fallback i { font-size: 48px; }
.album-hero__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(54px, 8vw, 120px) clamp(28px, 7vw, 112px);
}
.album-breadcrumb { display: flex; align-items: center; gap: 7px; margin-bottom: clamp(44px, 7vw, 90px); color: var(--gallery-muted); font-size: 12px; }
.album-breadcrumb a:hover { color: var(--gallery-green-dark); }
.album-breadcrumb i { font-size: 12px; }
.album-hero__meta { margin: 0 0 16px; color: var(--gallery-green-dark); font-size: 13px; font-weight: 650; }
.album-hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 5.8vw, 5.8rem);
  font-weight: 540;
  line-height: 1.04;
  letter-spacing: -.035em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.album-hero__description { max-width: 58ch; margin: 28px 0 0; color: var(--gallery-ink-soft); font-size: 15px; line-height: 1.85; text-wrap: pretty; }
.album-hero__tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 24px; }
.album-hero__tags a { padding: 5px 10px; color: var(--gallery-ink-soft); border: 1px solid var(--gallery-line); font-size: 12px; }
.album-hero__tags a:hover { color: var(--gallery-green-dark); border-color: var(--gallery-green); }
.album-open-button {
  width: min(100%, 360px);
  min-height: 74px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 13px;
  margin-top: clamp(44px, 7vw, 88px);
  padding: 13px 18px;
  color: var(--gallery-white);
  background: var(--gallery-green-dark);
  border: 1px solid var(--gallery-green-dark);
  text-align: left;
  transition: background-color 180ms ease, transform 180ms ease;
}
.album-open-button:hover { background: var(--gallery-ink); }
.album-open-button:active { transform: translateY(1px); }
.album-open-button:disabled { cursor: not-allowed; opacity: .52; }
.album-open-button > i { grid-row: 1 / 3; font-size: 24px; }
.album-open-button > span { font-weight: 660; }
.album-open-button > small { color: oklch(0.84 0.015 165); font-size: 11px; }

.album-children {
  padding: clamp(72px, 9vw, 132px) clamp(20px, 6vw, 104px);
  color: var(--gallery-white);
  background: var(--gallery-ink);
}
.album-children__heading { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 28px; margin-bottom: clamp(34px, 5vw, 62px); }
.album-children__heading p { grid-column: 1 / -1; margin: 0; color: oklch(0.72 0.06 160); font-size: 11px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
.album-children__heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 4rem); font-weight: 540; line-height: 1.08; letter-spacing: -.025em; }
.album-children__heading > span { color: oklch(0.76 0.01 165); font-size: 12px; }
.album-children__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 30px); }
.album-child-card a { display: block; }
.album-child-card__media { min-height: 180px; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; color: oklch(0.7 0.01 165); background: oklch(0.23 0.012 165); }
.album-child-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 520ms var(--ease-out-expo), opacity 220ms ease; }
.album-child-card__media i { font-size: 34px; }
.album-child-card__media > span { font-size: 12px; }
.album-child-card__copy { display: grid; gap: 9px; padding-top: 17px; }
.album-child-card__copy small { color: oklch(0.7 0.025 165); font-size: 11px; }
.album-child-card__copy strong { font-size: clamp(1.15rem, 2vw, 1.65rem); font-weight: 560; line-height: 1.25; }
.album-child-card__copy > span { display: inline-flex; align-items: center; gap: 7px; color: oklch(0.78 0.07 160); font-size: 12px; }
.album-child-card a:hover .album-child-card__media img { transform: scale(1.035); }
.album-child-card a:hover .album-child-card__copy > span i { transform: translate(2px, -2px); }

.album-preview { padding: clamp(80px, 10vw, 150px) clamp(20px, 6vw, 104px) clamp(100px, 12vw, 180px); }
.album-preview__heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: clamp(38px, 5vw, 70px); }
.album-preview__heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.7rem); font-weight: 540; letter-spacing: -.025em; }
.album-preview__heading p { margin: 0; color: var(--gallery-muted); font-size: 13px; }
.photo-preview-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(10px, 1.5vw, 22px); }
.photo-preview {
  position: relative;
  grid-column: span 4;
  aspect-ratio: 4 / 5;
  padding: 0;
  overflow: hidden;
  background: var(--gallery-surface-alt);
  border: 0;
}
.photo-preview:nth-child(7n + 2),
.photo-preview:nth-child(7n + 6) { grid-column: span 5; }
.photo-preview:nth-child(7n + 3),
.photo-preview:nth-child(7n + 7) { grid-column: span 3; }
.photo-preview--lead { grid-column: span 7; aspect-ratio: 16 / 10; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.015); transition: opacity 300ms ease, transform 550ms var(--ease-out-expo); }
.photo-preview.is-loaded img { opacity: 1; }
.photo-preview:hover img { transform: scale(1.04); }
.photo-preview__number { position: absolute; right: 0; bottom: 0; z-index: 2; padding: 7px 10px; color: var(--gallery-white); background: var(--gallery-ink); font-size: 11px; }
.photo-preview__loading { position: absolute; inset: 0; background: var(--gallery-surface-alt); animation: gallery-pulse 1.2s ease-in-out infinite alternate; }
.photo-preview.is-loaded .photo-preview__loading { display: none; }
.photo-preview.has-error::after { content: "图片加载失败"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--gallery-muted); font-size: 12px; }

.album-loading { min-height: calc(100dvh - 70px); display: grid; grid-template-columns: 1fr 1fr; align-items: center; background: var(--gallery-white); }
.album-loading__image { align-self: stretch; background: var(--gallery-surface-alt); animation: gallery-pulse 1.1s ease-in-out infinite alternate; }
.album-loading__text { display: grid; gap: 14px; padding: 12%; }
.album-loading__text span { display: block; height: 20px; background: var(--gallery-surface-alt); animation: gallery-pulse 1.1s ease-in-out infinite alternate; }
.album-loading__text span:first-child { width: 32%; }
.album-loading__text span:nth-child(2) { width: 88%; height: 64px; }
.album-loading__text span:nth-child(3) { width: 64%; }
.album-loading > p { position: absolute; left: -9999px; }
.album-page-error { min-height: calc(100dvh - 70px); padding: 30px; }

/* Immersive viewer */
.album-viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  color: oklch(0.95 0.006 165);
  background: transparent;
  border: 0;
  overflow: hidden;
}
.album-viewer::backdrop { background: oklch(0.08 0.012 165 / .98); }
.album-viewer__shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 2px auto 92px;
  color: oklch(0.96 0.006 165);
  background: oklch(0.105 0.012 165);
}
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(15px, 3vw, 38px);
  border-bottom: 1px solid oklch(0.26 0.012 165);
}
.viewer-header__identity { min-width: 0; display: flex; align-items: baseline; gap: 16px; }
.viewer-header__identity > span:first-child { max-width: min(60vw, 680px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 620; }
.viewer-counter { color: oklch(0.7 0.012 165); font-size: 12px; white-space: nowrap; }
.viewer-icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: oklch(0.96 0.006 165);
  background: transparent;
  border: 1px solid oklch(0.34 0.012 165);
  font-size: 21px;
}
.viewer-icon-button:hover { background: oklch(0.22 0.012 165); }
.viewer-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(84px, .13fr) minmax(0, 1fr) minmax(84px, .13fr);
  align-items: stretch;
  overflow: hidden;
}
.viewer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0;
  color: oklch(0.72 0.01 165);
  background: transparent;
  border: 0;
  font-size: 12px;
  transition: color 160ms ease, background-color 160ms ease;
}
.viewer-nav i { font-size: 25px; }
.viewer-nav:hover { color: var(--gallery-white); background: oklch(0.15 0.012 165); }
.viewer-nav:disabled { cursor: default; opacity: .3; }
.viewer-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
  user-select: none;
}
.viewer-canvas.is-zoomed { cursor: grab; }
.viewer-canvas.is-zoomed:active { cursor: grabbing; }
.viewer-media {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform-origin: center;
  will-change: transform;
}
.viewer-media img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.viewer-media img.is-ready { opacity: 1; }
.viewer-image-loading,
.viewer-image-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: oklch(0.72 0.01 165);
  font-size: 13px;
}
.viewer-image-loading i { font-size: 26px; animation: viewer-spin 900ms linear infinite; }
.viewer-image-error i { color: oklch(0.72 0.12 27); font-size: 34px; }
.viewer-image-error button { padding: 8px 14px; color: var(--gallery-white); background: transparent; border: 1px solid oklch(0.45 0.012 165); font-size: 12px; }
.viewer-progress { height: 2px; background: oklch(0.2 0.012 165); overflow: hidden; }
.viewer-progress span { display: block; width: 100%; height: 100%; background: oklch(0.7 0.1 160); transform: scaleX(0); transform-origin: left; }
.viewer-progress span.is-running { animation: viewer-progress 5s linear forwards; }
.viewer-controls {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(14px, 3vw, 38px);
  border-top: 1px solid oklch(0.26 0.012 165);
}
.viewer-controls__group { display: flex; align-items: center; gap: 6px; }
.viewer-control {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  color: oklch(0.84 0.008 165);
  background: transparent;
  border: 1px solid oklch(0.31 0.012 165);
  font-size: 12px;
  white-space: nowrap;
}
.viewer-control:hover { color: var(--gallery-white); background: oklch(0.2 0.012 165); }
.viewer-control:disabled { cursor: not-allowed; opacity: .35; }
.viewer-control--primary { min-width: 82px; color: var(--gallery-white); background: var(--gallery-green-dark); border-color: var(--gallery-green-dark); }
.viewer-control--primary:hover { background: oklch(0.42 0.08 162); }
.viewer-control--ratio { min-width: 64px; }
.viewer-thumbnails {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px clamp(14px, 3vw, 38px) 14px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: oklch(0.38 0.012 165) transparent;
}
.viewer-thumbnail {
  width: 54px;
  height: 66px;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  background: oklch(0.18 0.012 165);
  border: 1px solid transparent;
  opacity: .58;
}
.viewer-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.viewer-thumbnail:hover { opacity: .86; }
.viewer-thumbnail.is-active { border-color: oklch(0.72 0.1 160); opacity: 1; }

/* Shared toast */
.toast-region {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  width: min(390px, calc(100vw - 36px));
  display: grid;
  gap: 8px;
}
.toast {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  color: var(--gallery-white);
  background: var(--gallery-ink);
  border: 1px solid oklch(0.34 0.012 165);
  font-size: 13px;
}
.toast--error .toast__icon { color: oklch(0.75 0.14 27); }
.toast--success .toast__icon { color: oklch(0.76 0.12 160); }
.toast__action,
.toast__close { color: var(--gallery-white); background: transparent; border: 0; }
.toast__action { padding: 5px 8px; border: 1px solid oklch(0.5 0.012 165); font-weight: 650; }
.toast__close { width: 30px; height: 30px; display: grid; place-items: center; }

@keyframes gallery-pulse { to { opacity: .46; } }
@keyframes viewer-spin { to { transform: rotate(360deg); } }
@keyframes viewer-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 1080px) {
  .gallery-header { grid-template-columns: 1fr auto; }
  .gallery-header__nav { display: none; }
  .catalog-controls { grid-template-columns: 1fr; }
  .catalog-search { max-width: 720px; }
  .catalog-card,
  .catalog-card:nth-child(5n + 1),
  .catalog-card:nth-child(5n + 2),
  .catalog-card:nth-child(5n + 3) { grid-column: span 6; padding-top: 0; }
  .catalog-card--featured { grid-column: span 12 !important; }
  .album-hero__content { padding-right: clamp(28px, 5vw, 70px); padding-left: clamp(28px, 5vw, 70px); }
}

@media (max-width: 760px) {
  .gallery-header { min-height: 64px; padding: 8px 16px; }
  .gallery-brand__mark { width: 32px; height: 32px; }
  .gallery-header__contact { padding: 8px 11px; }
  .gallery-intro { grid-template-columns: 1fr; align-content: end; min-height: 600px; padding: 76px 20px 54px; }
  .gallery-intro__note { margin-top: 48px; }
  .gallery-intro__note p { margin-bottom: 20px; }
  .catalog-controls { padding: 44px 20px; }
  .filter-group { grid-template-columns: 1fr; gap: 10px; }
  .filter-list { flex-wrap: nowrap; margin-right: -20px; padding-right: 20px; overflow-x: auto; scrollbar-width: none; }
  .filter-list::-webkit-scrollbar { display: none; }
  .filter-chip { flex: 0 0 auto; }
  .active-filter-summary { align-items: flex-start; }
  .catalog-results { padding: 64px 20px 90px; }
  .catalog-results__heading { display: block; }
  .catalog-results__heading p { margin-top: 10px; }
  .album-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 38px 10px; }
  .catalog-card,
  .catalog-card:nth-child(5n + 1),
  .catalog-card:nth-child(5n + 2),
  .catalog-card:nth-child(5n + 3),
  .catalog-card--featured { grid-column: span 1 !important; padding-top: 0 !important; }
  .catalog-card--featured:nth-child(3n + 1) { grid-column: span 2 !important; }
  .catalog-card__media,
  .catalog-card--featured .catalog-card__media { aspect-ratio: 4 / 5; }
  .catalog-card__description { display: none; }
  .catalog-card__action { margin-top: 10px; }
  .catalog-error { grid-template-columns: 1fr; text-align: center; }
  .gallery-footer { display: block; }
  .gallery-footer div { justify-content: flex-start; margin-top: 18px; }

  .album-headerbar { min-height: 62px; grid-template-columns: 1fr auto; padding: 8px 14px; }
  .gallery-brand--compact { display: none; }
  .album-contact { padding: 8px 10px; }
  .album-hero { grid-template-columns: 1fr; min-height: auto; }
  .album-hero__cover { min-height: 0; aspect-ratio: 4 / 4.5; }
  .album-hero__content { padding: 48px 20px 64px; }
  .album-breadcrumb { margin-bottom: 44px; }
  .album-hero h1 { font-size: clamp(2.5rem, 14vw, 4.6rem); }
  .album-open-button { width: 100%; margin-top: 48px; }
  .album-draft-banner { justify-content: flex-start; flex-wrap: wrap; }
  .album-draft-banner span { flex: 1 0 calc(100% - 90px); }
  .album-draft-banner a { margin-left: 27px; }
  .album-children { padding: 64px 20px 76px; }
  .album-children__heading { grid-template-columns: 1fr; }
  .album-children__grid { grid-template-columns: 1fr; gap: 34px; }
  .album-child-card__media { aspect-ratio: 16 / 10; }
  .album-preview { padding: 70px 14px 100px; }
  .album-preview__heading { display: block; padding: 0 6px; }
  .album-preview__heading p { margin-top: 9px; }
  .photo-preview-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .photo-preview,
  .photo-preview:nth-child(7n + 2),
  .photo-preview:nth-child(7n + 3),
  .photo-preview:nth-child(7n + 6),
  .photo-preview:nth-child(7n + 7),
  .photo-preview--lead { grid-column: span 1; aspect-ratio: 4 / 5; }
  .photo-preview--lead { grid-column: span 2; aspect-ratio: 16 / 10; }
  .album-loading { grid-template-columns: 1fr; }
  .album-loading__image { min-height: 52dvh; }

  .album-viewer__shell { grid-template-rows: 56px minmax(0, 1fr) 2px auto 76px; }
  .viewer-header { padding: 0 12px; }
  .viewer-stage { position: relative; grid-template-columns: 1fr; }
  .viewer-canvas { grid-area: 1 / 1; }
  .viewer-nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 48px;
    height: 64px;
    color: var(--gallery-white);
    background: oklch(0.1 0.012 165 / .72);
    transform: translateY(-50%);
  }
  .viewer-nav span { display: none; }
  .viewer-nav--previous { left: 0; }
  .viewer-nav--next { right: 0; }
  .viewer-controls { align-items: stretch; padding: 8px 10px; overflow-x: auto; }
  .viewer-controls__group { flex: 0 0 auto; }
  .viewer-controls__group--right { margin-left: auto; }
  .viewer-control { min-width: 42px; padding: 7px 10px; }
  .viewer-control:not(.viewer-control--primary):not(.viewer-control--ratio) span { display: none; }
  .viewer-control--primary { min-width: 78px; }
  .viewer-thumbnails { padding: 8px 10px 10px; }
  .viewer-thumbnail { width: 44px; height: 56px; }
}

@media (max-width: 420px) {
  .gallery-brand__text { display: none; }
  .catalog-search { grid-template-columns: auto minmax(0, 1fr) auto; }
  .catalog-search__submit { display: none; }
  .catalog-card h3 { font-size: 1.08rem; }
  .catalog-card__context { font-size: 11px; }
  .catalog-card__action span { font-size: 12px; }
  .viewer-controls__group--right .viewer-control { padding-right: 8px; padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .viewer-progress span,
  .viewer-progress span.is-running {
    animation: none !important;
    transform: scaleX(1);
    opacity: .35;
  }
}

@media (prefers-contrast: more) {
  :root { --gallery-line: oklch(0.63 0.01 165); --gallery-muted: oklch(0.36 0.012 165); }
  .filter-chip, .button, .viewer-control { border-width: 2px; }
}

/* The public catalog follows the site-wide persisted theme. Viewer surfaces
   are already dark in both modes; these overrides cover every page surface. */
html[data-theme="dark"] {
  --gallery-surface: oklch(0.13 0.012 165);
  --gallery-surface-alt: oklch(0.2 0.012 165);
  --gallery-line: oklch(0.31 0.012 165);
  --gallery-muted: oklch(0.72 0.012 165);
  --gallery-ink-soft: oklch(0.82 0.01 165);
  --gallery-green: oklch(0.7 0.1 160);
  --gallery-green-dark: oklch(0.4 0.075 162);
  color-scheme: dark;
  background: var(--gallery-surface);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .gallery-header,
html[data-theme="dark"] .album-headerbar,
html[data-theme="dark"] .catalog-card h3,
html[data-theme="dark"] .album-hero h1,
html[data-theme="dark"] .album-preview__heading h2,
html[data-theme="dark"] .catalog-results__heading h2,
html[data-theme="dark"] .catalog-empty h3,
html[data-theme="dark"] .catalog-error h3 { color: oklch(0.96 0.006 165); }

html[data-theme="dark"] .gallery-header,
html[data-theme="dark"] .album-headerbar {
  background: oklch(0.13 0.012 165 / .94);
  border-color: var(--gallery-line);
}

html[data-theme="dark"] .gallery-header__nav a,
html[data-theme="dark"] .album-back,
html[data-theme="dark"] .album-hero__description,
html[data-theme="dark"] .catalog-card__description { color: var(--gallery-ink-soft); }
html[data-theme="dark"] .catalog-card__context { color: var(--gallery-green); }

html[data-theme="dark"] .gallery-brand__mark { color: var(--gallery-ink); background: oklch(0.94 0.006 165); }
html[data-theme="dark"] .catalog-controls,
html[data-theme="dark"] .album-hero { color: oklch(0.96 0.006 165); background: oklch(0.15 0.012 165); }
html[data-theme="dark"] .catalog-search { border-color: oklch(0.72 0.01 165); }
html[data-theme="dark"] .catalog-search input { color: oklch(0.96 0.006 165); }
html[data-theme="dark"] .catalog-search__submit,
html[data-theme="dark"] .button--dark { color: var(--gallery-ink); background: oklch(0.9 0.012 165); border-color: oklch(0.9 0.012 165); }
html[data-theme="dark"] .catalog-search__submit:hover,
html[data-theme="dark"] .button--dark:hover { color: var(--gallery-white); background: var(--gallery-green-dark); border-color: var(--gallery-green); }
html[data-theme="dark"] .button--line { color: oklch(0.94 0.006 165); border-color: oklch(0.7 0.01 165); }
html[data-theme="dark"] .button--line:hover { color: var(--gallery-ink); background: oklch(0.9 0.01 165); }
html[data-theme="dark"] .filter-group__label,
html[data-theme="dark"] .catalog-card__action { color: oklch(0.94 0.006 165); }
html[data-theme="dark"] .filter-chip { color: oklch(0.82 0.01 165); border-color: var(--gallery-line); }
html[data-theme="dark"] .filter-chip:hover { border-color: var(--gallery-green); }
html[data-theme="dark"] .filter-chip.is-active { color: var(--gallery-white); background: var(--gallery-green-dark); }
html[data-theme="dark"] .catalog-card__count { background: oklch(0.08 0.012 165 / .9); }
html[data-theme="dark"] .album-hero__tags a { color: oklch(0.82 0.01 165); }
html[data-theme="dark"] .album-open-button { background: var(--gallery-green-dark); border-color: var(--gallery-green-dark); }
html[data-theme="dark"] .album-open-button:hover { background: oklch(0.24 0.012 165); border-color: oklch(0.54 0.012 165); }
html[data-theme="dark"] .photo-preview__number { background: oklch(0.08 0.012 165); }
html[data-theme="dark"] .album-children { background: oklch(0.09 0.012 165); }
