:root {
  --cream: #fff9ee;
  --paper: #f8edda;
  --ink: #241917;
  --muted: #7c6d61;
  --burgundy: #7b1e3a;
  --burgundy-dark: #3d0a1a;
  --gold: #d4a855;
  --forest: #24463a;
  --line: rgba(123, 30, 58, 0.16);
  --shadow: 0 22px 70px rgba(36, 25, 23, 0.16);
  --display: "Playfair Display", Georgia, serif;
  --body: "Cormorant Garamond", Georgia, serif;
  --ui: Poppins, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d4a855' fill-opacity='0.045'%3E%3Cpath d='M32 8l3 9 9 3-9 3-3 9-3-9-9-3 9-3 3-9zm0 32l2 6 6 2-6 2-2 6-2-6-6-2 6-2 2-6z'/%3E%3C/g%3E%3C/svg%3E");
  font-family: var(--body);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img, video { max-width: 100%; display: block; }

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(255, 249, 238, 0.92);
  border-bottom: 1px solid rgba(212, 168, 85, 0.28);
  backdrop-filter: blur(14px);
}

.brand {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--burgundy);
  letter-spacing: 0.03em;
}

.brand em { color: var(--gold); font-style: italic; }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.5vw, 28px);
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(123, 30, 58, 0.72);
}

.nav-links a:hover { color: var(--burgundy); }

.hero {
  min-height: 88svh;
  position: relative;
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #111;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% center;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(22, 13, 10, 0.76), rgba(22, 13, 10, 0.28) 54%, rgba(22, 13, 10, 0.56)),
    linear-gradient(0deg, rgba(22, 13, 10, 0.8), transparent 50%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 0 0 clamp(38px, 8vh, 76px);
  color: white;
}

.hero h1 {
  margin: 0;
  max-width: 860px;
  font-family: var(--display);
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 0.82;
  letter-spacing: 0;
  text-shadow: 0 8px 34px rgba(0, 0, 0, 0.45);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 26px 0 30px;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 249, 238, 0.82);
}

.hero-meta span {
  width: 74px;
  height: 1px;
  background: var(--gold);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--ui);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--gold), #efd47d); color: var(--burgundy-dark); }
.btn.secondary { background: rgba(255, 249, 238, 0.12); border-color: rgba(255, 249, 238, 0.42); color: var(--cream); }
.btn.dark { background: var(--burgundy); color: var(--cream); }
.btn.light { background: rgba(255, 249, 238, 0.78); border-color: rgba(212, 168, 85, 0.32); color: var(--burgundy); }

.section {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(54px, 8vw, 96px) 0;
}

.section-head {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  margin-bottom: clamp(28px, 5vw, 52px);
}
.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.5rem, 8vw, 5.6rem);
  line-height: 0.9;
  color: var(--burgundy);
}
.section-head p {
  max-width: 620px;
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  line-height: 1.45;
  color: rgba(123, 30, 58, 0.58);
}

.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(220px, 70vw);
}
.rule::before, .rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.rule span {
  width: 11px;
  height: 11px;
  rotate: 45deg;
  border: 1px solid var(--gold);
  background: rgba(212, 168, 85, 0.18);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}
.stat {
  min-height: 118px;
  padding: 24px;
  background: rgba(255, 249, 238, 0.82);
}
.stat strong {
  display: block;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
  color: var(--forest);
}
.stat span {
  display: block;
  margin-top: 8px;
  font-family: var(--ui);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: rgba(123, 30, 58, 0.62);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 150px;
  gap: 12px;
}
.preview-grid a {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
}
.preview-grid a:nth-child(1) { grid-column: span 3; grid-row: span 2; }
.preview-grid a:nth-child(2) { grid-column: span 2; }
.preview-grid a:nth-child(3) { grid-column: span 1; }
.preview-grid a:nth-child(4) { grid-column: span 2; }
.preview-grid a:nth-child(5) { grid-column: span 2; }
.preview-grid a:nth-child(6) { grid-column: span 2; }
.preview-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms ease;
}
.preview-grid a:hover img { transform: scale(1.04); }

.gallery-shell { padding-top: 34px; }
.gallery-title {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.gallery-title h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.86;
  color: var(--burgundy);
}
.gallery-title p {
  margin: 10px 0 0;
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(123, 30, 58, 0.5);
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
}

.find-shell .gallery-title { align-items: start; }

.find-panel {
  padding: 24px 0 34px;
  margin-bottom: 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.find-panel-head,
.result-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.find-panel-head h2,
.result-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 5vw, 3.7rem);
  line-height: 0.95;
  color: var(--burgundy);
}

.find-panel-head p,
.result-head p {
  margin: 8px 0 0;
  font-family: var(--ui);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(123, 30, 58, 0.52);
}

.selected-faces {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 520px;
}

.selected-chip {
  min-height: 36px;
  border: 1px solid rgba(123, 30, 58, 0.16);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(123, 30, 58, 0.08);
  color: var(--burgundy);
  font-family: var(--ui);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.selected-chip span {
  margin-left: 7px;
  color: rgba(123, 30, 58, 0.54);
}

.face-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.face-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(123, 30, 58, 0.12);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 249, 238, 0.74);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(36, 25, 23, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.face-card:hover {
  transform: translateY(-1px);
  border-color: rgba(123, 30, 58, 0.28);
}

.face-card.selected {
  border-color: rgba(123, 30, 58, 0.7);
  background: rgba(212, 168, 85, 0.18);
}

.face-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--paper);
}

.face-card-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.face-card strong {
  overflow: hidden;
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--burgundy);
}

.face-card small {
  font-family: var(--ui);
  font-size: 0.64rem;
  font-weight: 600;
  color: rgba(36, 25, 23, 0.58);
}

.result-panel { padding-top: 6px; }

.media-grid.photos {
  column-count: 4;
  column-gap: 14px;
}
.media-grid.videos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.media-card {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 14px;
  border: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  break-inside: avoid;
  box-shadow: 0 12px 34px rgba(36, 25, 23, 0.1);
}
.media-card img {
  width: 100%;
  height: auto;
  transition: transform 700ms ease;
}
.media-grid.videos .media-card img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.media-card:hover img { transform: scale(1.035); }
.play-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(0deg, rgba(61, 10, 26, 0.3), rgba(61, 10, 26, 0.04));
  pointer-events: none;
}
.play-badge span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.44);
  color: white;
  backdrop-filter: blur(8px);
}
.play-badge span::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid white;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 26px 0 10px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 74px 18px 28px;
  background: rgba(17, 10, 9, 0.94);
}
.lightbox.open { display: flex; }
.lightbox-media {
  max-width: min(1180px, 94vw);
  max-height: 78vh;
  border-radius: 8px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.6);
}
.lightbox video {
  width: min(1180px, 94vw);
  height: min(72vh, 680px);
  background: black;
}
.lightbox-top {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--cream);
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 249, 238, 0.2);
  border-radius: 999px;
  background: rgba(255, 249, 238, 0.08);
  color: var(--cream);
  cursor: pointer;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }

.empty {
  padding: 80px 20px;
  text-align: center;
  color: rgba(123, 30, 58, 0.55);
  font-size: 1.3rem;
}

#authGate {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, var(--burgundy-dark), var(--burgundy) 48%, var(--forest));
  transition: opacity 450ms ease;
}
#authGate.leaving { opacity: 0; }
.auth-panel {
  width: min(400px, 94vw);
  text-align: center;
  color: var(--cream);
}
.auth-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
}
.auth-rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 85, 0.5), transparent);
}
.auth-rule i {
  width: 11px;
  height: 11px;
  rotate: 45deg;
  border: 1px solid var(--gold);
}
.auth-mark {
  margin: 0;
  font-family: var(--display);
  font-size: 3rem;
  font-weight: 800;
}
.auth-mark em { color: var(--gold); font-style: italic; font-size: 2rem; }
.auth-date {
  margin: 4px 0 28px;
  font-family: var(--ui);
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 249, 238, 0.5);
}
.auth-copy {
  margin: 0 0 18px;
  font-size: 1.25rem;
  color: rgba(255, 249, 238, 0.76);
}
#authInput {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(212, 168, 85, 0.34);
  border-radius: 999px;
  outline: 0;
  padding: 0 20px;
  background: rgba(255, 249, 238, 0.08);
  color: var(--cream);
  text-align: center;
  font-family: var(--ui);
  letter-spacing: 0.12em;
}
#authInput::placeholder { color: rgba(255, 249, 238, 0.38); }
#authBtn {
  margin-top: 16px;
  min-width: 146px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), #efd47d);
  color: var(--burgundy-dark);
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}
#authError {
  display: none;
  margin: 14px 0 0;
  color: #f4a9ba;
  font-family: var(--ui);
  font-size: 0.74rem;
}

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 160px; }
  .preview-grid a:nth-child(n) { grid-column: span 1; grid-row: span 1; }
  .preview-grid a:nth-child(1) { grid-column: span 2; grid-row: span 2; }
  .media-grid.photos { column-count: 2; }
  .media-grid.videos { grid-template-columns: 1fr; }
  .find-panel-head, .result-head { align-items: start; flex-direction: column; }
  .selected-faces { justify-content: flex-start; }
  .lightbox-nav { top: auto; bottom: 20px; translate: none; }
}

@media (max-width: 640px) {
  .site-nav { align-items: flex-start; }
  .nav-links { flex-wrap: wrap; justify-content: flex-end; gap: 12px; font-size: 0.58rem; }
  .hero { min-height: 84svh; }
  .hero::after {
    background:
      linear-gradient(0deg, rgba(22, 13, 10, 0.84), rgba(22, 13, 10, 0.12) 58%),
      linear-gradient(90deg, rgba(22, 13, 10, 0.32), rgba(22, 13, 10, 0.16));
  }
  .hero-content { width: calc(100% - 32px); }
  .hero-meta { align-items: flex-start; flex-direction: column; gap: 12px; }
  .tabbar { overflow-x: auto; padding-bottom: 4px; }
  .face-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .media-grid.photos { column-count: 1; }
  .lightbox { padding-top: 68px; }
  .lightbox-media { max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
