:root {
  --pw-ink: #111113;
  --pw-muted: #60626b;
  --pw-paper: #fbfbf7;
  --pw-glow: rgba(20, 20, 20, 0.08);
  --pw-card: #ffffff;
  --pw-border: rgba(0, 0, 0, 0.06);
  --pw-shadow: rgba(17, 17, 19, 0.18);
}

html.dark {
  --pw-ink: #f2f2f2;
  --pw-muted: #a5a7ae;
  --pw-paper: #0f1013;
  --pw-glow: rgba(0, 0, 0, 0.4);
  --pw-card: #16181d;
  --pw-border: rgba(255, 255, 255, 0.08);
  --pw-shadow: rgba(0, 0, 0, 0.6);
}

.pw-gallery {
  padding: clamp(2.5rem, 7vw, 6rem) clamp(1.5rem, 6vw, 5rem) clamp(4rem, 10vw, 7rem);
  color: var(--pw-ink);
  font-family: var(--font-body), system-ui, sans-serif;
  max-width: 1320px;
  margin: 0 auto;
}

.pw-sparse {
  position: relative;
  display: block;
  min-height: 60vh;
}

.pw-sparse-item {
  position: relative;
  width: clamp(220px, 34vw, 520px);
  aspect-ratio: var(--pw-w) / var(--pw-h);
  margin: clamp(24px, 6vw, 90px);
  margin-left: clamp(14px, 6vw, 120px);
  --pw-x: 0px;
  --pw-y: 0px;
  transform: translate3d(var(--pw-x), var(--pw-y), 0);
}

.pw-sparse-item:nth-child(4n + 1) {
  width: clamp(260px, 42vw, 620px);
  margin-left: clamp(0px, 2vw, 40px);
}

.pw-sparse-item:nth-child(4n + 2) {
  width: clamp(200px, 28vw, 420px);
  margin-left: clamp(12px, 10vw, 220px);
}

.pw-sparse-item:nth-child(4n + 3) {
  width: clamp(260px, 38vw, 560px);
  margin-left: clamp(6px, 18vw, 320px);
}

.pw-sparse-item:nth-child(4n + 4) {
  width: clamp(230px, 32vw, 480px);
  margin-left: clamp(0px, 8vw, 140px);
}

@media (min-width: 1024px) {
  .pw-sparse-item:nth-child(4n + 1) {
    margin-left: 0;
  }
  .pw-sparse-item:nth-child(4n + 2) {
    margin-left: auto;
    margin-right: 0;
  }
  .pw-sparse-item:nth-child(4n + 3) {
    margin-left: clamp(80px, 12vw, 220px);
  }
  .pw-sparse-item:nth-child(4n + 4) {
    margin-left: clamp(220px, 42vw, 720px);
  }
}

@media (max-width: 900px) {
  .pw-sparse-item {
    width: min(100%, 520px);
    margin: 30px auto;
  }
  .pw-sparse-item:nth-child(even) {
    margin-left: auto;
  }
}

.pw-head {
  max-width: 720px;
  margin: 0 auto 2rem;
  text-align: center;
}

.pw-kicker {
  font-family: var(--font-captions), system-ui, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--pw-muted);
  margin-bottom: 0.75rem;
}

.pw-title {
  font-family: var(--font-headings), serif;
  font-size: clamp(2rem, 3vw, 3rem);
  margin-bottom: 0.75rem;
}

.pw-subtitle {
  color: var(--pw-muted);
  font-size: 1rem;
  line-height: 1.6;
  font-family: var(--font-body), system-ui, sans-serif;
}

.pw-sparse-item {
  opacity: 1;
}

.pw-animate .pw-sparse-item {
  opacity: 0;
  --pw-y: 24px;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.pw-animate .pw-sparse-item.is-visible {
  opacity: 1;
  --pw-y: 0px;
}

.pw-hover .pw-frame {
  transition: box-shadow 0.3s ease;
}

.pw-hover:hover .pw-frame {
  box-shadow: 0 18px 32px var(--pw-shadow);
}

.pw-frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--pw-card);
  border: 1px solid var(--pw-border);
  box-shadow: 0 12px 26px var(--pw-glow);
  overflow: hidden;
}

.pw-rounded {
  border-radius: 18px;
}

.pw-link {
  display: block;
  color: inherit;
  text-decoration: none;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

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

.pw-cap {
  padding: 0.75rem 1rem 1rem;
  font-size: 0.9rem;
  color: var(--pw-muted);
  font-family: var(--font-captions), system-ui, sans-serif;
}
