/* ============================================
   Daren & Sarah — Wedding Gallery
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Jost:wght@400;500;600&display=swap');

:root {
  --wine: #6b1f2a;
  --wine-dark: #4a1620;
  --ivory: #faf6f1;
  --paper: #fffdfb;
  --ink: #2a2420;
  --ink-soft: #6b625a;
  --gold: #a97f4f;
  --line: #e7dfd6;

  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 92vh;
}

.hero-photo {
  position: relative;
  min-height: 46vh;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh 10%;
  background: var(--paper);
}

.hero-names {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  color: var(--wine);
  margin: 0 0 1.4rem 0;
  line-height: 1.05;
}

.hero-message p {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 1.1rem 0;
  max-width: 34ch;
}

.hero-signoff {
  margin-top: 0.6rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--wine);
}

.hero-divider {
  width: 48px;
  height: 2px;
  background: var(--gold);
  margin: 1.6rem 0;
  border: none;
}

/* ---------- Gallery ---------- */

.gallery-intro {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
}

.gallery-intro h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--wine);
  margin: 0 0 0.5rem 0;
}

.gallery-intro p {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 0 4px 6rem;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}

.photo {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #eee2d8;
  cursor: pointer;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.photo:hover img {
  transform: scale(1.04);
}

.photo-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  background: rgba(42,36,32,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}

.photo-check svg {
  width: 15px;
  height: 15px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.photo.selected .photo-check {
  background: var(--wine);
  border-color: var(--wine);
}

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

.photo.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid var(--wine);
  pointer-events: none;
  z-index: 1;
}

.photo-check:focus-visible,
.photo:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Selection bar ---------- */

.selection-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--wine);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  transform: translateY(110%);
  transition: transform 0.25s ease;
  flex-wrap: wrap;
}

.selection-bar.visible {
  transform: translateY(0);
}

.selection-count {
  font-size: 0.95rem;
  font-weight: 500;
}

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

.btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.55);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover { background: rgba(255,255,255,0.12); }

.btn-primary {
  background: var(--paper);
  color: var(--wine);
  border-color: var(--paper);
}

.btn-primary:hover {
  background: #fff;
}

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

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 0.9rem 0;
  background: rgba(250,246,241,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.top-bar span {
  font-family: var(--serif);
  font-style: italic;
  color: var(--wine);
  font-size: 1.05rem;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 14, 0.94);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox.open { display: flex; }

.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 82vh;
}

.lightbox img {
  max-width: 90vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  background: rgba(42,36,32,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-check.selected {
  background: var(--wine);
  border-color: var(--wine);
}

.lightbox-check svg {
  width: 20px;
  height: 20px;
  opacity: 0;
}

.lightbox-check.selected svg { opacity: 1; }

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: none;
  color: var(--paper);
  cursor: pointer;
  padding: 0.5rem;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
}

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

.lightbox-counter {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

/* ---------- Progress overlay ---------- */

.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 14, 0.88);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  text-align: center;
  font-family: var(--sans);
}

.progress-overlay.open { display: flex; }

.progress-box p:first-child {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.progress-bar-track {
  width: 260px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.2s ease;
}

.progress-pct {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

/* ---------- Footer ---------- */

footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

footer .heart { color: var(--wine); }

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-photo { min-height: 60vh; }
  .hero-text { padding: 3rem 8%; align-items: center; text-align: center; }
  .hero-message p { max-width: 44ch; }
  .selection-bar { justify-content: center; text-align: center; }
}
