:root {
  color-scheme: dark;
  --bg: #0f0f0d;
  --panel: rgba(18, 18, 15, 0.62);
  --panel-border: rgba(255, 244, 214, 0.12);
  --text-main: #f5ecd7;
  --text-soft: rgba(245, 236, 215, 0.78);
  --text-faint: rgba(245, 236, 215, 0.58);
  --accent: #d6b16e;
  --accent-strong: #ebc67e;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
  background: radial-gradient(circle at top, rgba(73, 73, 54, 0.4), transparent 36%), var(--bg);
  color: var(--text-main);
}

body {
  min-height: 100vh;
}

.gallery-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
}

.gallery-backdrop {
  position: fixed;
  inset: -2%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  filter: blur(28px) saturate(0.92) brightness(0.38);
  transform: scale(1.08);
  transition: background-image 220ms ease;
  opacity: 0.9;
}

.gallery-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 6, 5, 0.45), rgba(6, 6, 5, 0.78)),
    radial-gradient(circle at top right, rgba(214, 177, 110, 0.12), transparent 28%);
}

.gallery-header,
.gallery-stage,
.gallery-meta {
  position: relative;
  z-index: 1;
}

.gallery-header {
  width: min(1320px, 100%);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.gallery-kicker {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
}

.gallery-header h1 {
  margin: 0;
  font-size: clamp(34px, 4.8vw, 58px);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.gallery-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 214, 0.18);
  background: rgba(20, 20, 17, 0.46);
  color: var(--text-main);
  text-decoration: none;
  backdrop-filter: blur(12px);
}

.gallery-stage {
  width: min(1320px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  gap: 16px;
  align-items: center;
}

.gallery-frame {
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 8, 7, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.gallery-track {
  display: flex;
  transition: transform 300ms ease;
  touch-action: pan-y;
}

.gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 18px;
}

.gallery-slide img {
  display: block;
  width: 100%;
  height: min(72vh, 880px);
  object-fit: contain;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.28);
}

.nav-button {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 17, 14, 0.58);
  color: var(--text-main);
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 244, 214, 0.12);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.nav-button:hover,
.nav-button:focus-visible {
  color: #fff4d3;
  background: rgba(34, 34, 28, 0.76);
}

.gallery-meta {
  width: min(1320px, 100%);
  margin: 18px auto 0;
  padding: 18px 20px 20px;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.gallery-meta-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.gallery-counter {
  min-width: 110px;
  font-size: 22px;
  color: var(--accent-strong);
}

.gallery-caption h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 600;
}

.gallery-caption p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.6;
}

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

.thumb-button {
  border: 0;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  aspect-ratio: 4 / 3;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.thumb-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-radius: 16px;
  transition: border-color 180ms ease, background 180ms ease;
  background: rgba(0, 0, 0, 0.18);
}

.thumb-button.is-active::after {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.02);
}

@media (max-width: 960px) {
  .gallery-shell {
    padding: 14px 10px 18px;
  }

  .gallery-header {
    margin-bottom: 14px;
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-home-link {
    min-height: 40px;
  }

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

  .gallery-slide {
    padding: 10px;
  }

  .gallery-slide img {
    height: min(58vh, 560px);
    border-radius: 16px;
  }

  .nav-button {
    width: 46px;
    height: 46px;
    font-size: 28px;
  }

  .gallery-meta {
    margin-top: 12px;
    padding: 14px 12px 14px;
    border-radius: 22px;
  }

  .gallery-meta-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .gallery-counter {
    min-width: 0;
    font-size: 18px;
  }

  .gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .thumb-button {
    flex: 0 0 88px;
    border-radius: 12px;
  }

  .thumb-button::after {
    border-radius: 12px;
  }
}
