:root {
  --bg-canvas: #f4e9d8;
  --bg-velvet: #fce3be;
  --bg-shadow: rgba(56, 33, 16, 0.24);
  --ink: #392519;
  --ink-soft: rgba(57, 37, 25, 0.72);
  --accent-amber: #f4a259;
  --accent-rose: #de6e6e;
  --accent-mint: #9ac1aa;
  --accent-sun: #ffd27d;
  --frame-width: min(88vw, 1280px);
  --carousel-size: clamp(320px, 58vw, 640px);
  --shadow-lg: 0 40px 120px rgba(51, 29, 15, 0.28);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff9f0 0%, #f4dcc3 56%),
    radial-gradient(circle at bottom right, #f6d9aa 0%, #f0c7a0 50%),
    linear-gradient(130deg, #fce7cd, #f8d3b0 54%, #d6a680 100%);
  position: relative;
  overflow-x: hidden;
}

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

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' fill='rgba(0,0,0,0.18)' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.24;
  animation: drift 12s linear infinite;
  z-index: 1;
}

.light-leak {
  position: fixed;
  top: -20vh;
  width: 70vw;
  height: 70vw;
  pointer-events: none;
  background: radial-gradient(
    circle,
    rgba(250, 164, 97, 0.55) 0%,
    rgba(248, 223, 176, 0.18) 45%,
    transparent 70%
  );
  filter: blur(60px);
  mix-blend-mode: screen;
  z-index: 0;
  animation: glowPulse 16s ease-in-out infinite;
}

.light-leak--left {
  left: -25vw;
  animation-delay: -3s;
}

.light-leak--right {
  right: -25vw;
  animation-delay: 5s;
}

.hero {
  position: relative;
  z-index: 2;
  max-width: var(--frame-width);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem) 0;
  text-align: center;
}

.hero__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(249, 196, 142, 0.4);
  border: 1px solid rgba(62, 40, 19, 0.25);
  box-shadow: 0 8px 16px rgba(255, 139, 71, 0.2);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__title {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: clamp(2.6rem, 4.9vw, 4.4rem);
  font-weight: 700;
  margin: 1rem auto 1.2rem;
  max-width: 18ch;
  line-height: 1.07;
  text-shadow: 0 7px 32px rgba(0, 0, 0, 0.18);
}

.hero__subtitle {
  font-size: clamp(1rem, 1.2vw + 0.8rem, 1.25rem);
  margin: 0 auto;
  max-width: 60ch;
  color: var(--ink-soft);
  line-height: 1.7;
}

.hero__controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(0.9rem, 1.4vw, 1.4rem);
  margin-top: clamp(1.5rem, 3vw, 2.6rem);
  flex-wrap: wrap;
}

.control-btn {
  font-family: "Montserrat", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff4e5 0%, #fddfb7 50%, #f7c897 100%);
  border: 2px solid rgba(52, 33, 19, 0.12);
  border-radius: 999px;
  padding: 0.75rem 1.8rem;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 12px 38px rgba(63, 33, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 280ms ease, box-shadow 280ms ease,
    letter-spacing 220ms ease;
  position: relative;
  overflow: hidden;
}

.control-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0) 55%
  );
  transform: translateX(-110%);
  transition: transform 420ms ease;
}

.control-btn:hover,
.control-btn:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 18px 46px rgba(84, 43, 0, 0.24);
  letter-spacing: 0.08em;
}

.control-btn:hover::after,
.control-btn:focus-visible::after {
  transform: translateX(0);
}

.gallery {
  position: relative;
  z-index: 2;
  max-width: var(--frame-width);
  margin: clamp(1rem, 3vw, 2.6rem) auto clamp(3rem, 6vw, 5rem);
  padding: clamp(1.5rem, 5vw, 3rem);
}

.film-strip {
  height: 62px;
  width: calc(var(--frame-width) + 12vw);
  max-width: calc(100% + 12vw);
  margin: 0 auto;
  border-radius: 8px;
  background-image: linear-gradient(
      to right,
      transparent 0,
      transparent 15px,
      rgba(0, 0, 0, 0.18) 15px,
      rgba(0, 0, 0, 0.18) 25px,
      transparent 25px,
      transparent 40px
    ),
    linear-gradient(
      to right,
      rgba(62, 35, 15, 0.75),
      rgba(47, 26, 10, 0.9),
      rgba(36, 18, 6, 0.8)
    );
  background-size: 55px 100%, 100% 100%;
  opacity: 0.55;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.25));
}

.film-strip--top {
  transform: rotate(-1.3deg) translateY(-20px);
}

.film-strip--bottom {
  transform: rotate(1.2deg) translateY(20px);
}

.carousel-frame {
  position: relative;
  display: grid;
  gap: clamp(2.4rem, 5vw, 4.4rem);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85), #ffeaca 90%);
  border-radius: 32px;
  padding: clamp(2.3rem, 5vw, 3.8rem);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(141, 91, 45, 0.25);
  overflow: hidden;
}

@media (min-width: 960px) {
  .carousel-frame {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: center;
  }
}

.carousel-shadow {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.65),
    rgba(255, 227, 185, 0.4) 45%,
    rgba(244, 195, 142, 0.32) 60%,
    rgba(178, 116, 78, 0.4) 100%
  );
  opacity: 0.68;
  pointer-events: none;
  z-index: 0;
}

.carousel-stack {
  position: relative;
  min-height: clamp(380px, 60vw, 680px);
  display: grid;
  place-items: center;
  perspective: 1600px;
  z-index: 1;
}

.polaroid {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--carousel-size);
  max-width: 100%;
  background: #fdf9f4;
  border-radius: 14px 14px 16px 16px;
  padding: clamp(1rem, 1.8vw, 1.4rem);
  box-shadow: 0 40px 120px rgba(75, 45, 30, 0.45),
    inset 0 0 0 1px rgba(45, 23, 8, 0.08);
  transform-origin: center 60%;
  transform: translate(-50%, -50%) rotate(var(--rotation, 8deg))
    scale(var(--scale, 0.8));
  opacity: 0;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 600ms ease, filter 600ms ease;
  cursor: pointer;
  user-select: none;
  pointer-events: none;
}

.polaroid:nth-child(odd) {
  --rotation: -6deg;
}

.polaroid:nth-child(even) {
  --rotation: 7deg;
}

.polaroid.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(-2deg) scale(1.12);
  filter: drop-shadow(0 45px 85px rgba(80, 42, 12, 0.35));
  pointer-events: auto;
  z-index: 3;
}

.polaroid.is-prev,
.polaroid.is-next {
  opacity: 0.88;
  pointer-events: auto;
  z-index: 2;
  transform: translate(-50%, -50%)
    translateX(var(--offset, -210px))
    rotate(var(--rotation, 7deg))
    scale(0.92);
}

.polaroid.is-prev {
  --offset: -220px;
}

.polaroid.is-next {
  --offset: 220px;
}

.polaroid.is-far {
  opacity: 0.35;
  transform: translate(-50%, -50%) scale(0.7) rotate(12deg)
    translateY(160px);
  z-index: 1;
}

.polaroid__figure {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #20140f;
  aspect-ratio: 4 / 5;
  display: grid;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.polaroid__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  filter: saturate(0.82) contrast(1.08) sepia(0.32);
  transition: transform 1.4s ease, filter 1.4s ease;
}

.polaroid.is-active .polaroid__figure img {
  transform: scale(1.02);
  filter: saturate(1) contrast(1.1) sepia(0.18);
}

.polaroid:hover .polaroid__figure img {
  transform: scale(1.08) rotate(0.6deg);
}

.polaroid__tape {
  position: absolute;
  height: 52px;
  width: 96px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  background: linear-gradient(
      rgba(255, 255, 255, 0.6),
      rgba(255, 255, 255, 0.08)
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.4),
      rgba(255, 255, 255, 0.4) 6px,
      rgba(255, 255, 255, 0.2) 6px,
      rgba(255, 255, 255, 0.2) 12px
    );
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.6s ease;
  border-radius: 12px;
}

.polaroid__tape--top {
  top: -18px;
}

.polaroid__tape--bottom {
  bottom: -22px;
  transform: translateX(-50%) rotate(1.5deg);
}

.polaroid.is-active .polaroid__tape {
  opacity: 1;
}

.carousel-meta {
  position: relative;
  z-index: 1;
  padding: clamp(2.1rem, 3.4vw, 3.2rem);
  border-radius: 26px;
  background: rgba(255, 243, 224, 0.82);
  border: 1px solid rgba(123, 80, 42, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 35px 75px rgba(120, 71, 33, 0.28);
  backdrop-filter: blur(7px);
}

.carousel-meta__title {
  font-family: "Playfair Display", serif;
  font-size: clamp(2.1rem, 3.2vw, 2.8rem);
  margin: 0;
  line-height: 1.12;
}

.carousel-meta__description {
  font-size: clamp(1.15rem, 1.7vw, 1.45rem);
  margin: 1.1rem 0 2rem;
  color: rgba(49, 27, 16, 0.78);
  line-height: 1.75;
}

.carousel-meta__progress {
  display: grid;
  gap: 0.65rem;
  align-items: center;
}

.meta-progress__label {
  font-family: "Montserrat", sans-serif;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: rgba(41, 19, 11, 0.65);
}

.meta-progress__value {
  font-size: 1.4rem;
  font-weight: 600;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.meta-progress__bar {
  position: relative;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(83, 50, 28, 0.18);
  overflow: hidden;
}

.meta-progress__indicator {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    rgba(255, 198, 119, 0.9),
    rgba(238, 131, 116, 0.85),
    rgba(166, 203, 176, 0.8)
  );
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
  transition: transform 420ms ease;
}

.sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.sparkles__dot {
  position: absolute;
  width: clamp(16px, 3vw, 26px);
  height: clamp(16px, 3vw, 26px);
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.9),
    rgba(255, 214, 128, 0.4),
    rgba(231, 126, 126, 0.46),
    transparent 70%
  );
  border-radius: 50%;
  filter: blur(1px);
  animation: sparkleFloat 7s ease-in-out infinite;
}

.sparkles__dot--1 {
  top: 12%;
  left: 18%;
  animation-delay: 0s;
}

.sparkles__dot--2 {
  top: 28%;
  right: 22%;
  animation-delay: 1.3s;
}

.sparkles__dot--3 {
  bottom: 18%;
  left: 12%;
  animation-delay: 2.6s;
}

.sparkles__dot--4 {
  bottom: 24%;
  right: 18%;
  animation-delay: 3.1s;
}

.sparkles__dot--5 {
  top: 40%;
  left: 50%;
  animation-delay: 4.1s;
}

.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: clamp(2rem, 4vw, 3rem) clamp(1rem, 2vw, 2rem);
  color: rgba(58, 34, 20, 0.7);
}

.footer__stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(250, 224, 185, 0.6);
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 1px dashed rgba(102, 61, 26, 0.4);
}

.footer__note {
  font-family: "Caveat", cursive;
  font-size: clamp(1.25rem, 1.9vw, 1.5rem);
  margin: 1rem auto 0;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-12%, -12%, 0);
  }
}

@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.27;
    transform: scale(1);
  }
  50% {
    opacity: 0.52;
    transform: scale(1.15);
  }
}

@keyframes sparkleFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(0.85);
    opacity: 0.55;
  }
  50% {
    transform: translate3d(0, -40px, 0) scale(1.1);
    opacity: 0.95;
  }
}

@media (max-width: 768px) {
  .hero__controls {
    flex-direction: column;
  }

  .carousel-frame {
    padding: clamp(1.2rem, 4vw, 2rem);
    gap: clamp(1.4rem, 4vw, 2rem);
  }

  .carousel-stack {
    min-height: clamp(320px, 75vw, 420px);
  }

  .polaroid {
    position: relative;
    top: auto;
    left: auto;
    transform: translateX(0) rotate(-1deg) scale(0.94);
    opacity: 1;
    margin: 0 auto;
    pointer-events: auto;
  }

  .polaroid + .polaroid {
    margin-top: 1.6rem;
  }

  .polaroid.is-prev,
  .polaroid.is-next,
  .polaroid.is-far {
    transform: translateX(0) rotate(var(--rotation, 3deg)) scale(0.9);
    opacity: 0.85;
  }

  .carousel-frame {
    display: flex;
    flex-direction: column;
  }

  .film-strip {
    display: none;
  }
}
