:root {
  --bg: #f8f5f1;
  --panel: #fffcf9;
  --text: #3f3632;
  --muted: #6f6259;
  --gold: #c8a778;
  --line: #e5d6c6;
  --shadow: 0 22px 45px rgba(52, 36, 28, 0.18);
}
* { box-sizing: border-box; }
html, body { scroll-behavior: smooth; }
body { margin: 0; font-family: 'Montserrat', sans-serif; color: var(--text); background: var(--bg); position: relative; }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url('../graphics/wedding-photo-background.png') center/cover no-repeat;
  opacity: 0.72;
}
h1,h2,h3 { font-family: 'Cormorant Garamond', serif; margin: 0; font-weight: 500; }
.container { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }

.hero {
  min-height: 92vh;
  position: relative;
  display: grid;
  align-items: center;
  padding: 7rem 0 5rem;
  overflow: hidden;
  background-image: linear-gradient(rgba(20, 15, 11, 0.35), rgba(20, 15, 11, 0.52)), url('https://images.unsplash.com/photo-1519741497674-611481863552?auto=format&fit=crop&w=2200&q=80');
  background-size: cover;
  background-position: center;
  color: #fff;
}
.top-nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.brand { font-family: 'Cormorant Garamond', serif; font-size: 2rem; letter-spacing: .08em; color: var(--gold); }
.nav-links { display: flex; gap: 2.2rem; }
.nav-links a { text-decoration: none; text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600; color: #5e5149; }

.hero-content { width: min(1000px, calc(100% - 2rem)); position: relative; z-index: 1; margin: 0 auto; }
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .78rem; color: #e9d5b3; }
.hero h1 { font-size: clamp(3rem, 9vw, 6.1rem); max-width: 430px; line-height: .96; }
.hero-copy { max-width: 560px; margin: 1rem 0 2rem; line-height: 1.8; }
.cta {
  display: inline-block;
  padding: .95rem 1.8rem;
  color: #2f241d;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .74rem;
  border: 1px solid #e4d5c5;
  background: #efdecc;
}

.story, .gallery-wrap { padding: 5rem 0; }

.decorative-wrap { position: relative; }
.section-divider { display: block; width: clamp(96px, 16vw, 138px); margin: 1rem 0 1.4rem; position: relative; left: 50%; transform: translateX(-50%); opacity: .9; }

.story { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.story-kicker { text-transform: uppercase; letter-spacing: .2em; font-size: .74rem; color: #c7a886; text-align: center; margin: 0 0 .8rem; }
.story h2, .gallery-wrap h2 { text-align: center; font-size: clamp(2.2rem, 5vw, 4rem); margin-bottom: .9rem; }
.story p, .gallery-lead { max-width: 780px; margin: 0 auto; text-align: center; line-height: 1.9; color: var(--muted); }

.chapter { margin-top: 2.3rem; }

.gallery-quote {
  margin: 3.1rem auto 0;
  text-align: center;
  max-width: 760px;
  color: #8d796d;
}
.gallery-quote p {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.55rem, 3.2vw, 2.25rem);
  line-height: 1.35;
  font-style: italic;
  letter-spacing: .015em;
}
.gallery-quote p::before {
  content: '“';
  color: #d8b89a;
  margin-right: .35rem;
}
.quote-divider {
  margin: 1.1rem auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
}
.quote-divider span {
  display: block;
  width: clamp(56px, 10vw, 98px);
  height: 1px;
  background: linear-gradient(90deg, rgba(217, 187, 159, 0), rgba(217, 187, 159, .78), rgba(217, 187, 159, 0));
}
.quote-divider .heart {
  width: auto;
  height: auto;
  background: none;
  font-size: 1rem;
  color: #d2ad89;
}

.chapter h3 {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .8rem;
  color: #a4835d;
  margin-bottom: 1.2rem;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
  margin: 0 auto 1.45rem;
  scrollbar-width: none;
}
.gallery-filters::-webkit-scrollbar { display: none; }
.filter-button {
  border: 1px solid rgba(164, 131, 93, .35);
  border-radius: 999px;
  padding: .7rem 1rem;
  color: #6d594b;
  background: rgba(255, 252, 249, .68);
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}
.filter-button:hover,
.filter-button:focus-visible,
.filter-button.is-active {
  color: #fffaf6;
  background: #9f7656;
  border-color: #9f7656;
}
.filter-button:focus-visible {
  outline: 2px solid rgba(159, 118, 86, .34);
  outline-offset: 3px;
}
.filter-button:active { transform: translateY(1px); }
.gallery-status {
  margin: 1rem 0 0;
  text-align: center;
  color: #8d796d;
  font-size: .82rem;
}

.editorial-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.card {
  border: 0;
  padding: 0;
  margin: 0;
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0.34) 48%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(135deg, #efe2d4, #d8bfaa 48%, #b89473);
  background-size: 240% 100%, 100% 100%;
  min-height: 230px;
  isolation: isolate;
  animation: gallery-placeholder 1.2s ease-in-out infinite;
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.9) contrast(1.03) sepia(.06); opacity: 0; transition: opacity .18s ease, transform .55s ease; }
.card.is-loaded { animation: none; }
.card.is-loaded img { opacity: 1; }
.card.is-error {
  cursor: default;
  background:
    linear-gradient(135deg, rgba(255, 252, 249, .92), rgba(218, 196, 178, .88)),
    linear-gradient(135deg, #efe2d4, #d8bfaa 48%, #b89473);
}
.card.is-error img { opacity: 0; }
.card.is-error::after {
  content: 'Photo unavailable';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: #7e6656;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}
.card:hover img { transform: scale(1.03); }
.span-2 { grid-column: span 2; min-height: 350px; }
.span-3 { grid-column: 1 / -1; min-height: 350px; }

.reveal { opacity: 0; transform: translateY(16px); filter: blur(2px); transition: opacity .36s ease, transform .42s cubic-bezier(.22,1,.36,1), filter .42s ease; transition-delay: var(--reveal-delay, 0ms); }
.reveal.is-visible { opacity: 1; transform: translateY(0); filter: blur(0); }
.section-transition { opacity: 0; transform: translateY(12px); transition: opacity .45s ease, transform .5s cubic-bezier(.22,1,.36,1); }
.section-transition.is-visible { opacity: 1; transform: translateY(0); }

@keyframes gallery-placeholder {
  0% { background-position: 180% 0, 0 0; }
  100% { background-position: -60% 0, 0 0; }
}

.lightbox { width: min(96vw, 1300px); border: 1px solid #2e2521; padding: 0; background: #0f0c0b; color: #fff; opacity: 0; transform: translateY(10px) scale(.99); transition: opacity .3s ease, transform .3s ease; overflow: hidden; }
.lightbox[open] { opacity: 1; transform: translateY(0) scale(1); }
.lightbox::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(8px); }
.lightbox-frame { margin: 0; background: #111; }
.lightbox img { width: 100%; max-height: 78vh; object-fit: contain; display: block; background: #111; }
.lightbox-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  color: rgba(255, 248, 242, .9);
  background: rgba(15, 12, 11, .98);
  font-size: .82rem;
  line-height: 1.5;
}
#lightboxCaption { font-weight: 500; }
#lightboxCounter {
  flex: 0 0 auto;
  color: rgba(255, 248, 242, .68);
  font-variant-numeric: tabular-nums;
}
.lightbox.is-error img { min-height: 44vh; opacity: .2; }
.close, .nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  color: rgba(255, 248, 242, 0.94);
  background: rgba(20, 14, 12, 0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  transition: background-color .25s ease, border-color .25s ease, transform .25s ease, opacity .25s ease;
}
.close:hover,
.nav:hover {
  background: rgba(20, 14, 12, 0.42);
  border-color: rgba(255, 255, 255, 0.5);
}
.close:focus-visible,
.nav:focus-visible {
  outline: 2px solid rgba(245, 227, 205, 0.78);
  outline-offset: 2px;
}
.close {
  top: .8rem;
  right: .8rem;
  width: 2.15rem;
  height: 2.15rem;
  font-size: 1.05rem;
  border-radius: .5rem;
}
.nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.45rem;
  height: 2.45rem;
  font-size: 1.35rem;
  border-radius: 999px;
}
.prev { left: .7rem; }
.next { right: .7rem; }
.scroll-cue { position: absolute; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: .65rem; text-transform: uppercase; letter-spacing: .14em; font-size: .67rem; opacity: .8; transition: opacity .4s ease, transform .4s ease; }
.scroll-line { width: 2.7rem; height: 1px; background: rgba(255,255,255,.8); }

@media (max-width: 900px) {
  .hero { padding-top: 8.4rem; }
  .top-nav { padding-inline: 1rem; }
  .nav-links { gap: 1rem; }
  .editorial-grid { grid-template-columns: 1fr 1fr; }
  .span-2, .span-3 { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .hero h1 { max-width: 320px; }
  .gallery-filters { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .15rem; }
  .filter-button { flex: 0 0 auto; }
  .editorial-grid { grid-template-columns: 1fr; }
  .card, .span-2, .span-3 { min-height: 260px; }
  .lightbox { width: 100vw; max-width: 100vw; }
  .lightbox img { max-height: 74vh; }
  .lightbox-meta { padding-inline: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .reveal, .card img, .section-transition, .lightbox { transition: none; transform: none; filter: none; opacity: 1; }
}
