/* Vivah3D — Luxury 3D Wedding Album Studio & Fullscreen Flipbook Styles */
:root {
  --book-w: 420px;
  --book-h: 540px;
}

* { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  overflow-x: hidden;
  background: #0f0c11;
  color: #f8f5f0;
}

.font-serif-display { font-family: 'Playfair Display', Georgia, serif; }
.font-serif-body { font-family: 'Cormorant Garamond', Georgia, serif; }
.font-script { font-family: 'Great Vibes', cursive; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.35); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,55,0.6); }

/* ===== LANDSCAPE 16:9 FORMAT OVERRIDES ===== */
.format-landscape {
  --book-w: 540px;
  --book-h: 350px;
}

/* ===== 3D FLIPBOOK ENGINE ===== */
.stage-3d {
  perspective: 2500px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  user-select: none;
}

.book-wrapper {
  position: relative;
  width: var(--book-w);
  height: var(--book-h);
  transition: transform 0.85s cubic-bezier(0.645, 0.045, 0.355, 1);
  transform-style: preserve-3d;
}

.book-wrapper.is-open {
  transform: translateX(50%);
}

.book-wrapper.is-back {
  transform: translateX(100%);
}

.book-shadow {
  position: absolute;
  inset: 14px -8px -22px -8px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.3) 55%, transparent 78%);
  filter: blur(18px);
  pointer-events: none;
  transform: translateZ(-40px);
  transition: all 0.85s ease;
}
.book-wrapper.is-open .book-shadow {
  left: calc(-1 * var(--book-w) - 10px);
  right: -10px;
}

.leaf {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.92s cubic-bezier(0.645, 0.045, 0.355, 1);
  cursor: pointer;
}

.leaf.flipped {
  transform: rotateY(-180deg);
}

.leaf-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: 3px 14px 14px 3px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 12px 32px rgba(0,0,0,0.3);
}

.leaf-back {
  transform: rotateY(180deg);
  border-radius: 14px 3px 3px 14px;
}

.leaf-front::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 34px;
  background: linear-gradient(to right, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.08) 38%, transparent 100%);
  pointer-events: none;
  z-index: 20;
}

.leaf-back::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 34px;
  background: linear-gradient(to left, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.08) 38%, transparent 100%);
  pointer-events: none;
  z-index: 20;
}

.leaf-front::before, .leaf-back::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.13) 0%, transparent 45%, rgba(0,0,0,0.04) 100%);
  pointer-events: none;
  z-index: 15;
}

.corner-hint {
  position: absolute;
  bottom: 8px; right: 12px;
  font-size: 10px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 25;
}
.leaf-back .corner-hint { right: auto; left: 12px; }

.hardcover-spine {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 18px;
  background: linear-gradient(to right, rgba(0,0,0,0.45), rgba(255,255,255,0.14) 40%, rgba(0,0,0,0.22) 70%, transparent);
  z-index: 22;
  pointer-events: none;
}

/* ===== 20 COLLAGE LAYOUTS ===== */
.collage-grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 6px;
  position: relative;
}

.photo-slot {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(128,128,128,0.12);
  width: 100%;
  height: 100%;
  touch-action: none;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-slot.is-draggable { cursor: grab; }
.photo-slot.is-draggable:active { cursor: grabbing; }
.photo-slot.is-selected-slot {
  outline: 2.5px solid #f59e0b;
  outline-offset: -2px;
  z-index: 12;
}

.slot-swap-pill {
  position: absolute;
  top: 5px; right: 5px;
  z-index: 14;
  background: rgba(15, 12, 17, 0.78);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.18s ease;
}
.photo-slot:hover .slot-swap-pill,
.photo-slot.is-selected-slot .slot-swap-pill { opacity: 1; }
.slot-swap-pill:hover { background: #f59e0b; color: #1c1917; }

.slot-drag-hint {
  position: absolute;
  bottom: 4px; left: 5px;
  z-index: 14;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.photo-slot:hover .slot-drag-hint,
.photo-slot.is-selected-slot .slot-drag-hint { opacity: 0.9; }

/* 1. Hero Full */
.layout-hero-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
/* 2. Classic Duo Vertical */
.layout-duo-vertical { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
/* 3. Panoramic Stack */
.layout-duo-horizontal { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
/* 4. Asymmetric 65/35 Split */
.layout-wide-duo-split { grid-template-columns: 1.65fr 1fr; grid-template-rows: 1fr; }
/* 5. Editorial Trio */
.layout-trio-editorial { grid-template-columns: 1.25fr 1fr; grid-template-rows: 1fr 1fr; }
.layout-trio-editorial .slot-0 { grid-row: span 2; }
/* 6. Ceremonial Trio */
.layout-trio-ceremony { grid-template-columns: 1fr 1fr; grid-template-rows: 1.15fr 1fr; }
.layout-trio-ceremony .slot-0 { grid-column: span 2; }
/* 7. Triple Columns */
.layout-trio-columns { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
/* 8. Royal Archway Trio */
.layout-arch-trio { grid-template-columns: 0.72fr 1.35fr 0.72fr; grid-template-rows: 1fr; }
.layout-arch-trio .slot-1 { border-radius: 999px 999px 10px 10px; }
/* 9. Polaroid Scatter */
.layout-polaroid-3 { display: block; position: relative; }
.layout-polaroid-3 .photo-slot {
  position: absolute;
  background: #ffffff;
  padding: 5px 5px 18px 5px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.22);
  border-radius: 3px;
}
.layout-polaroid-3 .slot-0 { width: 58%; height: 52%; top: 3%; left: 3%; transform: rotate(-4deg); z-index: 2; }
.layout-polaroid-3 .slot-1 { width: 56%; height: 50%; top: 14%; right: 2%; transform: rotate(5deg); z-index: 3; }
.layout-polaroid-3 .slot-2 { width: 62%; height: 48%; bottom: 2%; left: 19%; transform: rotate(-2deg); z-index: 4; }
/* 10. Royal Quartet */
.layout-quad-royal { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
/* 11. Magazine Mosaic */
.layout-quad-magazine { grid-template-columns: 1.2fr 1fr 1fr; grid-template-rows: 1.2fr 1fr; }
.layout-quad-magazine .slot-0 { grid-row: span 2; }
.layout-quad-magazine .slot-1 { grid-column: span 2; }
/* 12. Cinema Filmstrip */
.layout-filmstrip-4 {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(4, 1fr);
  padding: 6px 12px;
  background: rgba(15,15,18,0.88);
  border-radius: 8px;
  gap: 6px;
  border-left: 7px dotted rgba(212,175,55,0.55);
  border-right: 7px dotted rgba(212,175,55,0.55);
}
/* 13. Spotlight Medallion */
.layout-diamond-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; position: relative; }
.medallion-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 78px; height: 78px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5px;
  z-index: 15;
  box-shadow: 0 8px 20px rgba(0,0,0,0.34);
  pointer-events: none;
}
/* 14. Cinema Panoramic 4 (1 wide top + 3 bottom) */
.layout-cinema-panoramic-4 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1.3fr 1fr; }
.layout-cinema-panoramic-4 .slot-0 { grid-column: span 3; }
/* 15. Grand 5-Mosaic */
.layout-penta-5 { grid-template-columns: repeat(6, 1fr); grid-template-rows: 1.2fr 1fr; }
.layout-penta-5 .slot-0 { grid-column: span 3; }
.layout-penta-5 .slot-1 { grid-column: span 3; }
.layout-penta-5 .slot-2 { grid-column: span 2; }
.layout-penta-5 .slot-3 { grid-column: span 2; }
.layout-penta-5 .slot-4 { grid-column: span 2; }
/* 16. Penta Spotlight (1 center tall + 4 side squares) */
.layout-penta-spotlight { grid-template-columns: 1fr 1.4fr 1fr; grid-template-rows: 1fr 1fr; }
.layout-penta-spotlight .slot-0 { grid-column: 2; grid-row: 1 / span 2; }
.layout-penta-spotlight .slot-1 { grid-column: 1; grid-row: 1; }
.layout-penta-spotlight .slot-2 { grid-column: 1; grid-row: 2; }
.layout-penta-spotlight .slot-3 { grid-column: 3; grid-row: 1; }
.layout-penta-spotlight .slot-4 { grid-column: 3; grid-row: 2; }
/* 17. 6-Moment Portrait Grid (2x3) */
.layout-hexa-6 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); }
/* 18. Wide Gallery 6 (3x2) */
.layout-wide-gallery-6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
/* 19. Royal 7-Story */
.layout-septa-7 { grid-template-columns: 1.25fr 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.layout-septa-7 .slot-0 { grid-row: span 2; }
/* 20. Karizma 8-Photo Double Spread */
.layout-karizma-8 { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 1fr); }

/* Responsive 3D Book Sizing */
@media (max-width: 1180px) {
  :root { --book-w: 360px; --book-h: 465px; }
  .format-landscape { --book-w: 440px; --book-h: 285px; }
}
@media (max-width: 920px) {
  :root { --book-w: 310px; --book-h: 400px; }
  .format-landscape { --book-w: 360px; --book-h: 235px; }
}
@media (max-width: 680px) {
  :root { --book-w: 44vw; --book-h: 58vw; }
  .format-landscape { --book-w: 46vw; --book-h: 31vw; }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-14px); opacity: 0.72; }
}
.gold-orb {
  position: absolute;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(212,175,55,0.32), transparent 70%);
  pointer-events: none;
  animation: floatSlow 7s ease-in-out infinite;
}
