/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Caveat", cursive;
  background: linear-gradient(135deg, #fff 0%, #fbf7f0 50%, #f0e8dc 100%);
  /* iOS Safari ignores fixed. Scroll is almost identical visually on mobile. */
  background-attachment: scroll;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Corkboard Texture Background */
.corkboard-texture {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}



.page-title {
  font-family: "Neucha", cursive;
  font-size: 58px;
  color: #5C2A0E;
  text-align: center;
  transform: rotate(-2deg);
  text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.4);
}

/* SVG Rope */
.rope-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Polaroid Container */
.polaroid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 600px;
  gap: 60px;
  padding: 90px 80px 20px;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
}

/* Individual Polaroid */
.polaroid {
  background: white;
  padding: 15px 15px 60px 15px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  position: relative;
  /* Origin at the pin/clip */
  transform-origin: 50% -10px;
  /* First move to rope position, then rotate around pin, then add sway */
  transform: translateY(var(--rope-offset, 0px)) rotate(calc(var(--rotation) + var(--sway-rotation, 0deg)));
  transition: box-shadow 0.3s ease;
  animation: fadeInPolaroid 0.8s ease-out var(--delay) both;
  cursor: pointer;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  align-self: start;
  width: 100%;
  /* Ensure it fills the grid cell width */
  /* NOTE: will-change removed from base rule — having it on all cards simultaneously
     promotes every card to its own GPU layer, consuming too much GPU memory. */
}

.polaroid:hover {
  transform: translateY(calc(var(--rope-offset, 0px) - 10px)) rotate(0deg) scale(1.08);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3), 0 8px 16px rgba(0, 0, 0, 0.15);
  z-index: 100;
  /* Only create GPU layer when card is actually being interacted with */
  will-change: transform;
}

/* Clothespin / Clip */
.clothespin {
  position: absolute;
  top: -18px;
  /* Adjusted to sit on rope */
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 18px;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  z-index: 10;
}

/* Varied Pin Colors */
.polaroid:nth-child(4n + 1) .clothespin {
  background: #e74c3c;
  /* Red */
}

.polaroid:nth-child(4n + 2) .clothespin {
  background: #3498db;
  /* Blue */
}

.polaroid:nth-child(4n + 3) .clothespin {
  background: #2ecc71;
  /* Green */
}

.polaroid:nth-child(4n + 4) .clothespin {
  background: #f1c40f;
  /* Yellow */
}

.clothespin::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 1px;
}

.clothespin::after {
  display: none;
}

.photo-frame {
  width: 100%;
  /* Fallback for browsers without aspect-ratio support */
  padding-top: 100%;
  overflow: hidden;
  background: #2a2a2a;
  border: 1px solid #e0e0e0;
  position: relative;
}

/* Override padding-top with aspect-ratio where supported */
@supports (aspect-ratio: 1) {
  .photo-frame {
    padding-top: 0;
    aspect-ratio: 1;
  }
}

.polaroid-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: sepia(0.05) contrast(1.05);
  transition: filter 0.4s ease;
  position: relative;
  z-index: 2;
}

.polaroid:hover .polaroid-photo {
  filter: sepia(0) contrast(1.1);
}

/* Polaroid developing overlay effect */
.polaroid-developing {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1a1a;
  z-index: 3;
  opacity: 1;
  transition: opacity 2.5s ease-in-out;
  pointer-events: none;
}

.polaroid.developed .polaroid-developing {
  opacity: 0;
}

@keyframes developPhoto {
  0% {
    opacity: 1;
    background: #1a1a1a;
  }

  30% {
    opacity: 1;
    background: #1a1a1a;
  }

  60% {
    opacity: 0.7;
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 50%, #1a1a1a 100%);
  }

  85% {
    opacity: 0.3;
    background: linear-gradient(135deg, #5a5a5a 0%, #4a4a4a 50%, #3a3a3a 100%);
  }

  100% {
    opacity: 0;
    background: transparent;
  }
}

.polaroid-caption {
  text-align: center;
  padding-top: 15px;
}

.polaroid-caption .role {
  font-family: "Caveat", cursive;
  font-size: 16px;
  color: #888;
  margin-bottom: 2px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.polaroid-caption .name {
  font-family: "Kelly Slab", cursive;
  font-size: 24px;
  color: #2a2a2a;
  margin: 0;
  line-height: 1.2;
}

/* Sticky Note */
.sticky-note {
  position: fixed;
  bottom: 40px;
  right: 60px;
  width: 250px;
  padding: 25px;
  background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
  box-shadow: 3px 5px 15px rgba(0, 0, 0, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  /* No continuous animation — translateZ(0) still promotes to own GPU layer */
  transform: rotate(4deg) translateZ(0);
  font-family: "Caveat", cursive;
  font-size: 22px;
  color: #5C2A0E;
  line-height: 1.6;
  z-index: 1000;
  border: 1px solid rgba(139, 90, 43, 0.1);
}

.sticky-note::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: linear-gradient(to bottom, rgba(255, 235, 59, 0.3), transparent);
}

.note-pin {
  position: absolute;
  top: -8px;
  right: 30px;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, #e74c3c 40%, #c0392b 100%);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.note-pin::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
}

/* Animations */
@keyframes fadeInPolaroid {
  from {
    opacity: 0;
    transform: translateY(calc(var(--rope-offset, 0px) + 30px)) rotate(var(--rotation)) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(var(--rope-offset, 0px)) rotate(calc(var(--rotation) + var(--sway-rotation, 0deg))) scale(1);
  }
}

@keyframes floatNote {

  0%,
  100% {
    transform: rotate(4deg) translateY(0px);
  }

  50% {
    transform: rotate(4deg) translateY(-8px);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .polaroid-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 50px;
    padding: 40px 50px 100px;
  }
}

@media (max-width: 768px) {
  .guests-nav {
    flex-direction: column;
    gap: 20px;
    padding: 30px 20px;
  }

  .page-title {
    font-size: 36px;
    order: -1;
  }

  .polaroid-container {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 30px 20px 100px;
  }

  .sticky-note {
    bottom: 20px;
    right: 20px;
    width: 200px;
    font-size: 18px;
    padding: 20px;
  }

  .polaroid {
    max-width: 350px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 28px;
  }

  .nav-pin {
    font-size: 14px;
    padding: 6px 12px;
  }

  .polaroid-caption .name {
    font-size: 20px;
  }

  .sticky-note {
    display: none;
  }
}