:root {
  --bg: #fdf9f4;
  --ink: #2e2a26;
  --muted: #7a7169;
  --accent: #d87a9a;
  --accent-soft: #f3d9e3;
  --card-bg: #ffffff;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(46, 42, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #f3a9c2 0%, #f8d9b0 50%, #a8d8c9 100%);
  background-attachment: fixed;
  color: var(--ink);
}

header {
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
}

header .eyebrow {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0.4rem 0 0.6rem;
}

header p.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34rem;
  margin: 0 auto;
}

.filter-bar {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.8rem;
}

.filter-bar button {
  border: 1px solid var(--accent-soft);
  background: var(--card-bg);
  color: var(--ink);
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-bar button:hover {
  border-color: var(--accent);
}

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

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.3rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.5s ease forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card .thumb-wrap {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--accent-soft);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.card:hover img {
  transform: scale(1.06);
}

.card .meta {
  padding: 0.85rem 1rem 1rem;
}

.card .meta h3 {
  margin: 0 0 0.2rem;
  font-size: 1.02rem;
}

.card .meta span {
  font-size: 0.82rem;
  color: var(--muted);
}

footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 14, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 2rem;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  max-width: min(90vw, 1000px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.zoom-viewport {
  position: relative;
  width: min(90vw, 1000px);
  height: 72vh;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #1a1512;
  cursor: zoom-in;
  touch-action: none;
}

.zoom-viewport.zoomed {
  cursor: grab;
}

.zoom-viewport.dragging {
  cursor: grabbing;
}

.zoom-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-caption {
  color: #f6ece9;
  text-align: center;
}

.lightbox-caption h3 {
  margin: 0 0 0.15rem;
}

.lightbox-caption span {
  color: #cdbfb8;
  font-size: 0.85rem;
}

.zoom-hint {
  margin-top: 0.35rem;
  color: #a8988f;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.lightbox button.close,
.lightbox button.nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.lightbox button.close:hover,
.lightbox button.nav:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox button.close {
  top: 1.2rem;
  right: 1.2rem;
}

.lightbox button.prev {
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox button.next {
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 600px) {
  .lightbox button.prev,
  .lightbox button.next {
    width: 38px;
    height: 38px;
  }
}

/* Layout switch link */
.layout-switch {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.layout-switch:hover {
  color: var(--ink);
}

/* Carousel */
.carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.carousel-track {
  display: flex;
  gap: 2.2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 1rem calc(50% - min(32vw, 320px)) 2rem;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.carousel-track::-webkit-scrollbar {
  height: 8px;
}

.carousel-track::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 999px;
}

.carousel-slide {
  flex: 0 0 auto;
  width: min(64vw, 640px);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: zoom-in;
  opacity: 0.45;
  transform: scale(0.94);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.carousel-slide.active {
  opacity: 1;
  transform: scale(1);
}

.carousel-slide .frame {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: var(--card-bg);
}

.carousel-slide .meta {
  margin-top: 0.9rem;
  text-align: center;
}

.carousel-slide .meta h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.carousel-slide .meta span {
  font-size: 0.82rem;
  color: var(--muted);
}

.car-arrow {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  color: var(--accent);
  box-shadow: var(--shadow);
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  z-index: 5;
}

.car-arrow:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.06);
}

.carousel-counter {
  text-align: center;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .car-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
  .carousel-track {
    padding: 1rem calc(50% - min(40vw, 400px)) 2rem;
  }
  .carousel-slide {
    width: min(78vw, 480px);
  }
}
