/* ============================================
   JAMASHA.COM — Sasha & Jamal Wedding Gallery
   Dark, moody, edgy aesthetic
   ============================================ */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-card: #1a1a1a;
  --text: #f0ece4;
  --text-muted: #8a8580;
  --accent: #c9a96e;
  --accent-hover: #dbb978;
  --border: #2a2a2a;
  --selection: #c9a96e;
  --overlay: rgba(0, 0, 0, 0.85);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, sans-serif;
  --radius: 4px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================
   PASSWORD GATE
   ============================================ */

#password-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}

#password-gate.unlocked {
  animation: fadeOut 0.6s ease forwards;
  pointer-events: none;
}

.gate-content {
  text-align: center;
  padding: 2rem;
}

.gate-monogram {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 300;
  letter-spacing: 0.3em;
  margin-bottom: 1rem;
  color: var(--text);
}

.gate-monogram span {
  color: var(--accent);
  font-style: italic;
  margin: 0 0.2em;
}

.gate-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
}

#password-form {
  display: flex;
  gap: 0;
  max-width: 360px;
  margin: 0 auto;
}

#password-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text);
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-family: var(--sans);
  letter-spacing: 0.2em;
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

#password-input:focus {
  border-color: var(--accent);
}

#password-form button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.9rem 1.8rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: background var(--transition);
}

#password-form button:hover {
  background: var(--accent-hover);
}

.gate-error {
  color: #e74c3c;
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* ============================================
   HERO SECTION
   ============================================ */

#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: url('../thumbs/nikkah-portraits/DSC08580_med.webp') center 30%/cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.55) 35%,
    rgba(0, 0, 0, 0.7) 60%,
    rgba(10, 10, 10, 1) 100%
  );
}

.hero-content {
  position: relative;
  text-align: center;
  z-index: 1;
  padding: 2rem;
  margin-top: 15vh;
}

.hero-names {
  font-family: var(--serif);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 300;
  letter-spacing: 0.08em;
  line-height: 1.1;
  margin-bottom: 1rem;
  text-shadow: 0 4px 30px rgba(0,0,0,0.8), 0 0 80px rgba(0,0,0,0.5);
}

.hero-names span {
  color: var(--accent);
  font-style: italic;
  font-size: 0.6em;
  vertical-align: middle;
}

.hero-date {
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3rem;
  font-weight: 500;
  text-shadow: 0 2px 20px rgba(0,0,0,0.9);
}

.hero-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  animation: bounce 2s infinite;
  transition: opacity var(--transition);
}

.hero-scroll:hover {
  opacity: 0.7;
}

/* ============================================
   SELECTION BAR
   ============================================ */

.selection-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-elevated);
  border-top: 1px solid var(--accent);
  padding: 1rem 2rem;
  animation: slideUp 0.3s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.selection-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#selection-count {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--accent);
}

.selection-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.7rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ============================================
   GALLERY SECTION
   ============================================ */

#gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.gallery-header {
  text-align: center;
  margin-bottom: 3rem;
}

.gallery-header h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.gallery-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

/* Tabs row */
.tabs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

/* Shuffle button */
.btn-shuffle {
  background: rgba(201, 169, 110, 0.08);
  border: none;
  color: var(--text-muted);
  padding: 0.55rem 1.1rem;
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition);
  white-space: nowrap;
  margin-bottom: 0.5rem;
}

.btn-shuffle svg {
  transition: transform 0.4s ease;
}

.btn-shuffle:hover {
  background: rgba(201, 169, 110, 0.15);
  color: var(--accent);
}

.btn-shuffle:hover svg {
  transform: rotate(180deg);
}

.btn-shuffle.is-shuffled {
  background: var(--accent);
  color: var(--bg);
}

.btn-shuffle.is-shuffled:hover {
  background: var(--accent-hover);
}

/* Tabs */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1rem 1.5rem;
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}

.tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
}

.tab.active::after {
  transform: scaleX(1);
}

/* Masonry Grid */
.masonry-grid {
  columns: 4;
  column-gap: 12px;
}

.photo-card {
  break-inside: avoid;
  margin-bottom: 12px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition);
}

.photo-card:hover {
  transform: scale(1.01);
}

.photo-card img {
  width: 100%;
  display: block;
  transition: filter var(--transition);
}

.photo-card:hover img {
  filter: brightness(0.85);
}

/* Lightbox favorite button */
.btn-lightbox.is-favorited {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
}

.btn-lightbox.is-favorited svg {
  fill: #e74c3c;
  stroke: #e74c3c;
}

/* Selection checkbox overlay */
.photo-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  z-index: 2;
}

.photo-card:hover .photo-check {
  opacity: 1;
}

.photo-card.selected .photo-check {
  opacity: 1;
  background: var(--accent);
  border-color: var(--accent);
}

.photo-check svg {
  width: 16px;
  height: 16px;
  stroke: white;
  stroke-width: 3;
  fill: none;
  opacity: 0;
}

.photo-card.selected .photo-check svg {
  opacity: 1;
}

.photo-card.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
}

/* Lazy loading placeholder */
.photo-card img[data-src] {
  background: var(--bg-card);
  min-height: 200px;
}

/* Infinite scroll sentinel */
#load-more-wrapper {
  text-align: center;
  padding: 3rem 0 1rem;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  z-index: 1;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  transition: opacity 0.15s ease;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  z-index: 10;
  background: none;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition);
  line-height: 1;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: all var(--transition);
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-actions {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.75rem;
}

.btn-lightbox {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition);
}

.btn-lightbox:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-lightbox.is-selected {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.lightbox-counter {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 10;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
  text-align: center;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
}

.footer-names {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.footer-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
}

/* ============================================
   DOWNLOAD PROGRESS MODAL
   ============================================ */

.download-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
}

.download-modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.download-modal h3 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 300;
  margin-bottom: 1rem;
}

.download-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.download-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

.download-status {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-4px); }
}

/* Cards load instantly — no stagger delay */

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
  .masonry-grid { columns: 3; }
}

@media (max-width: 768px) {
  .masonry-grid { columns: 2; column-gap: 8px; }
  .photo-card { margin-bottom: 8px; }

  .tabs {
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  .tab { padding: 0.8rem 1rem; font-size: 0.75rem; white-space: nowrap; }

  .selection-bar-inner {
    flex-direction: column;
    gap: 0.75rem;
  }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }

  .lightbox-actions { gap: 0.4rem; }
  .btn-lightbox { padding: 0.5rem 0.8rem; font-size: 0.75rem; }

  .photo-check { opacity: 1; }

  .tabs-row { flex-wrap: wrap; gap: 0.5rem; }

  #gallery { padding: 2rem 0.75rem 6rem; }
}

@media (max-width: 480px) {
  .masonry-grid { columns: 2; column-gap: 6px; }
  .photo-card { margin-bottom: 6px; }
  .hero-names { font-size: 2.5rem; }
}

/* ============================================
   SHARE TOAST
   ============================================ */

.share-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 3000;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes heartBurst {
  0% { opacity: 1; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.3); }
  100% { opacity: 0; transform: scale(1.5) translateY(-30px); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
