/* === Reset & Custom Properties === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #1a0a00;
  --honey-gold: #F5A623;
  --honey-bright: #FFD700;
  --cream: #FFF8E7;
  --polaroid-bg: #FFFDF5;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  background: var(--bg-dark);
  color: var(--cream);
  font-family: 'Lora', serif;
}

.hidden {
  display: none !important;
}

/* Honeycomb background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50V16L28 0l28 16v34L28 66zm0 34L0 84V50l28-16 28 16v34L28 100z' fill='none' stroke='%23F5A623' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 56px 100px;
}

/* === Splash Screen === */
.splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  transition: opacity 0.3s ease;
}

.splash-messages {
  position: relative;
  min-height: 4em;
  text-align: center;
  padding: 0 1.5rem;
  width: 100%;
  max-width: 600px;
}

.splash-msg {
  position: absolute;
  width: 100%;
  left: 0;
  opacity: 0;
  font-family: 'Dancing Script', cursive;
  font-size: clamp(2rem, 8vw, 3.5rem);
  color: var(--cream);
  text-shadow: 0 0 20px rgba(245, 166, 35, 0.4);
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s ease, text-shadow 0.5s ease;
}

.splash-msg.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  text-shadow: 0 0 30px rgba(245, 166, 35, 0.6), 0 0 60px rgba(245, 166, 35, 0.2);
}

.splash-prompt {
  margin-top: 4rem;
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: var(--honey-gold);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  cursor: pointer;
  text-shadow: 0 0 12px rgba(245, 166, 35, 0.3);
}

.splash-prompt.visible {
  opacity: 1;
  transform: translateY(0);
  animation: pulse 2s 0.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* === Floating Bees === */
.floating-bees {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.bee {
  position: absolute;
  width: 28px;
  height: 28px;
  opacity: 0.6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='55' rx='22' ry='28' fill='%23F5A623'/%3E%3Cellipse cx='50' cy='55' rx='22' ry='28' fill='none' stroke='%231a0a00' stroke-width='2'/%3E%3Cline x1='35' y1='45' x2='65' y2='45' stroke='%231a0a00' stroke-width='3'/%3E%3Cline x1='33' y1='55' x2='67' y2='55' stroke='%231a0a00' stroke-width='3'/%3E%3Cline x1='35' y1='65' x2='65' y2='65' stroke='%231a0a00' stroke-width='3'/%3E%3Cellipse cx='36' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.7' transform='rotate(-30 36 30)'/%3E%3Cellipse cx='64' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.7' transform='rotate(30 64 30)'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.bee-1 { top: 10vh; left: 5vw; animation: drift1 18s ease-in-out infinite; }
.bee-2 { top: 30vh; left: 80vw; animation: drift2 22s ease-in-out infinite; }
.bee-3 { top: 60vh; left: 40vw; animation: drift3 20s ease-in-out infinite; }
.bee-4 { top: 80vh; left: 15vw; animation: drift4 25s ease-in-out infinite; }
.bee-5 { top: 45vh; left: 65vw; animation: drift5 19s ease-in-out infinite; }

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(15vw, -8vh) rotate(10deg); }
  50% { transform: translate(8vw, 12vh) rotate(-5deg); }
  75% { transform: translate(-5vw, 5vh) rotate(8deg); }
}

@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-12vw, 10vh) rotate(-8deg); }
  50% { transform: translate(-20vw, -5vh) rotate(6deg); }
  75% { transform: translate(-8vw, -12vh) rotate(-4deg); }
}

@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(10vw, 8vh) rotate(5deg); }
  50% { transform: translate(-12vw, 15vh) rotate(-10deg); }
  75% { transform: translate(5vw, -5vh) rotate(3deg); }
}

@keyframes drift4 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(20vw, -10vh) rotate(-6deg); }
  50% { transform: translate(10vw, 8vh) rotate(12deg); }
  75% { transform: translate(-10vw, -3vh) rotate(-8deg); }
}

@keyframes drift5 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-8vw, 12vh) rotate(7deg); }
  50% { transform: translate(15vw, 5vh) rotate(-9deg); }
  75% { transform: translate(5vw, -10vh) rotate(4deg); }
}

/* === Transition Overlay === */
.transition {
  position: fixed;
  inset: 0;
  z-index: 310;
  pointer-events: none;
  display: none;
}

.transition.active {
  display: block;
}

/* Flying bee */
.transition-bee {
  position: absolute;
  top: 50%;
  right: -40px;
  width: 40px;
  height: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='55' rx='22' ry='28' fill='%23F5A623'/%3E%3Cellipse cx='50' cy='55' rx='22' ry='28' fill='none' stroke='%231a0a00' stroke-width='2'/%3E%3Cline x1='35' y1='45' x2='65' y2='45' stroke='%231a0a00' stroke-width='3'/%3E%3Cline x1='33' y1='55' x2='67' y2='55' stroke='%231a0a00' stroke-width='3'/%3E%3Cline x1='35' y1='65' x2='65' y2='65' stroke='%231a0a00' stroke-width='3'/%3E%3Cellipse cx='36' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.7' transform='rotate(-30 36 30)'/%3E%3Cellipse cx='64' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.7' transform='rotate(30 64 30)'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0;
  transform: translateY(-50%);
}

.transition.active .transition-bee {
  animation: flyIn 0.6s ease-out forwards;
}

@keyframes flyIn {
  0% { right: -40px; opacity: 0; }
  100% { right: 50%; opacity: 1; transform: translateY(-50%) translateX(50%); }
}

/* Ripple */
.transition-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,166,35,0.4) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
}

.transition.active .transition-ripple {
  animation: ripple 0.8s 0.6s ease-out forwards;
}

@keyframes ripple {
  0% { width: 0; height: 0; opacity: 1; }
  100% { width: 200vmax; height: 200vmax; opacity: 0; }
}

/* Rising bees */
.rising-bee {
  position: absolute;
  bottom: -30px;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='55' rx='22' ry='28' fill='%23F5A623'/%3E%3Cellipse cx='36' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.7' transform='rotate(-30 36 30)'/%3E%3Cellipse cx='64' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.7' transform='rotate(30 64 30)'/%3E%3C/svg%3E");
  background-size: contain;
  opacity: 0;
}

.transition.active .rising-bee {
  animation: riseUp 1.5s 1s ease-out forwards;
}

.transition.active .rising-bee:nth-child(2) { animation-delay: 1.1s; }
.transition.active .rising-bee:nth-child(3) { animation-delay: 1.15s; }
.transition.active .rising-bee:nth-child(4) { animation-delay: 1.2s; }
.transition.active .rising-bee:nth-child(5) { animation-delay: 1.3s; }

@keyframes riseUp {
  0% { bottom: -30px; opacity: 0; }
  30% { opacity: 0.8; }
  100% { bottom: 110vh; opacity: 0; }
}

/* Honey drips */
.honey-drip {
  position: absolute;
  top: 0;
  width: 14.28%;
  height: 100%;
  background: linear-gradient(to bottom, var(--honey-gold), #c47f17);
  transform: scaleY(0);
  transform-origin: top;
  opacity: 0;
}

.transition.active .honey-drip {
  animation: drip 0.6s 1.3s ease-in forwards;
}

.transition.active .honey-drip:nth-child(2) { animation-delay: 1.35s; }
.transition.active .honey-drip:nth-child(3) { animation-delay: 1.4s; }
.transition.active .honey-drip:nth-child(4) { animation-delay: 1.45s; }
.transition.active .honey-drip:nth-child(5) { animation-delay: 1.5s; }
.transition.active .honey-drip:nth-child(6) { animation-delay: 1.55s; }
.transition.active .honey-drip:nth-child(7) { animation-delay: 1.6s; }

@keyframes drip {
  0% { transform: scaleY(0); opacity: 0.9; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Gallery fade-in during transition */
.gallery.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* === Gallery Header === */
.gallery-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border-bottom: 2px solid var(--honey-gold);
  transition: visibility 0.2s, opacity 0.2s;
}

.gallery-header.header-hidden {
  visibility: hidden;
  opacity: 0;
}

.header-bee {
  display: flex;
  align-items: center;
}

.header-bee svg {
  width: 24px;
  height: 24px;
}

/* Gallery honey drip decoration */
.gallery-honey-drip {
  width: 100%;
  height: 40px;
  display: block;
}

.header-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.5rem;
  color: var(--honey-gold);
  text-shadow: 0 0 12px var(--honey-bright);
}

/* === Photo Grid === */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 16px;
}

@media (min-width: 600px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}

/* === Polaroid Card === */
.polaroid {
  background: var(--polaroid-bg);
  padding: 8px 8px 32px 8px;
  border: 3px solid var(--cream);
  box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.6s ease, box-shadow 0.3s ease, opacity 0.6s ease;
  perspective: 800px;
  /* Start hidden — JS reveals with animation */
  opacity: 0;
  transform: rotateY(90deg) scale(0.8);
  transform-origin: center center;
}

.polaroid.revealed {
  opacity: 1;
  transform: rotateY(0deg) scale(1);
}

.polaroid:hover, .polaroid:active {
  transform: rotate(0deg) translateY(-8px) !important;
  box-shadow: 4px 8px 20px rgba(0, 0, 0, 0.5);
}

.polaroid-caption {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(0.7rem, 2.5vw, 0.9rem);
  color: #8B6914;
  text-align: center;
  margin-top: 6px;
  line-height: 1.2;
}

.polaroid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

/* === Loading State === */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 4rem 0;
}

.loading-bee {
  width: 30px;
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='55' rx='22' ry='28' fill='%23F5A623' opacity='0.5'/%3E%3Cellipse cx='36' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.4' transform='rotate(-30 36 30)'/%3E%3Cellipse cx='64' cy='30' rx='14' ry='8' fill='%23FFF8E7' opacity='0.4' transform='rotate(30 64 30)'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  animation: loadPulse 1.4s ease-in-out infinite;
}

.loading-bee:nth-child(2) { animation-delay: 0.2s; }
.loading-bee:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* === Error State === */
.error-state {
  text-align: center;
  padding: 4rem 2rem;
  font-style: italic;
  color: var(--honey-gold);
  font-size: clamp(1rem, 3vw, 1.3rem);
}

/* === Lightbox === */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox.hidden {
  display: none !important;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox.open .lightbox-overlay {
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 210;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 2px solid var(--cream);
  border-radius: 50%;
  color: var(--cream);
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lightbox-frame {
  position: relative;
  z-index: 205;
  background: var(--polaroid-bg);
  padding: 12px 12px 48px 12px;
  max-width: 90vw;
  max-height: 85vh;
  opacity: 0;
  transform: rotateY(-80deg) translateY(40px);
  transform-origin: left center;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.lightbox.open .lightbox-frame {
  transform: rotateY(0deg) translateY(0);
  opacity: 1;
}

.lightbox-frame.swipe-left {
  animation: swipeOutLeft 0.25s ease-in forwards;
}

.lightbox-frame.swipe-right {
  animation: swipeOutRight 0.25s ease-in forwards;
}

.lightbox-frame.swipe-in-left {
  animation: swipeInLeft 0.3s ease-out forwards;
}

.lightbox-frame.swipe-in-right {
  animation: swipeInRight 0.3s ease-out forwards;
}

@keyframes swipeOutLeft {
  to { transform: translateX(-120%) rotateZ(-8deg); opacity: 0; }
}

@keyframes swipeOutRight {
  to { transform: translateX(120%) rotateZ(8deg); opacity: 0; }
}

@keyframes swipeInLeft {
  from { transform: translateX(100%) rotateZ(5deg); opacity: 0; }
  to { transform: translateX(0) rotateZ(0deg); opacity: 1; }
}

@keyframes swipeInRight {
  from { transform: translateX(-100%) rotateZ(-5deg); opacity: 0; }
  to { transform: translateX(0) rotateZ(0deg); opacity: 1; }
}

.lightbox-caption {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  color: var(--honey-gold);
  text-align: center;
  margin-top: 10px;
  text-shadow: 0 0 8px rgba(245, 166, 35, 0.3);
}

#lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  display: block;
  object-fit: contain;
}

/* === Floating Particles === */
.particles {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  bottom: -40px;
  animation: floatUp linear forwards;
  opacity: 0;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateX(0) rotate(0deg); }
  10% { opacity: 0.7; }
  90% { opacity: 0.5; }
  100% { opacity: 0; transform: translateX(var(--drift)) rotate(var(--spin)); bottom: 110vh; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  .bee, .loading-bee, .transition-bee, .rising-bee {
    animation: none !important;
  }

  .splash-msg {
    transition-duration: 0.1s;
  }

  .polaroid {
    transition: none;
  }

  .lightbox-frame {
    transition: none;
  }

  .splash-prompt {
    animation: none;
    opacity: 1;
  }
}
