:root {
  --bg: #0b0b0d;
  --bg-2: #131316;
  --bg-3: #1a1a1f;
  --line: #26262b;
  --text: #eae8e3;
  --muted: #8f8d87;
  --accent: #c9a56d;
  --accent-soft: rgba(201, 165, 109, 0.35);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }

/* ---------- brand ---------- */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
}
.brand-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  color: var(--text);
}
.brand-sub {
  font-size: 0.58rem;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand.large .brand-name { font-size: 2.1rem; }
.brand.large .brand-sub { font-size: 0.72rem; }

.rule {
  width: 2.75rem;
  height: 1px;
  border: 0;
  margin: 2.2rem auto;
  background: var(--accent);
  opacity: 0.7;
}

/* ---------- gate (landing / password) ---------- */

.gate {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  animation: fade 0.6s ease both;
}
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  animation: fade 2.8s ease 0.4s forwards;
}

.gate-invite {
  margin: 0 0 0.9rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
}
.gate-mail {
  font-size: 0.78rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  transition: color 0.25s, border-color 0.25s;
}
.gate-mail:hover { color: var(--accent); border-color: var(--accent); }

/* staggered entrance (landing + password gate) */
.gate .brand-name,
.gate .brand-sub,
.gate .gate-invite,
.gate .gate-mail,
.gate .gate-form,
.gate .gate-error,
.gate .gate-empty {
  opacity: 0;
  animation: rise-in 0.9s ease forwards;
}
.gate .brand-name { animation-delay: 0.15s; }
.gate .brand-sub { animation-delay: 0.45s; }
.gate .rule {
  opacity: 0;
  transform: scaleX(0);
  animation: rule-in 1s ease 0.75s forwards;
}
.gate .gate-lead { opacity: 0; animation: rise-in 0.9s ease 0.9s forwards; }
.gate .gate-invite { animation-delay: 1.05s; }
.gate .gate-mail { animation-delay: 1.3s; }
.gate .gate-form { animation-delay: 1.05s; }
.gate .gate-error { animation-delay: 0.2s; }
.gate .gate-empty { animation-delay: 1.05s; }
.gate-lead {
  margin: 0 0 1.6rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
}
.gate-lead small {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.gate-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  width: min(20rem, 100%);
}
.gate-input {
  appearance: none;
  width: 100%;
  padding: 0.7rem 0.25rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-align: center;
  outline: none;
  border-radius: 0;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s;
}
.gate-input::placeholder { color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.78rem; }
.gate-input:focus { border-color: var(--accent); }
.gate-error {
  margin: 1.4rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: #d08d7c;
}
.gate-form .gate-error { margin: 0; }
.gate-empty {
  max-width: 28rem;
  color: var(--text);
}
.gate-empty h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  line-height: 1.12;
}
.gate-empty p {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.75;
  letter-spacing: 0.08em;
}
.gate-footer {
  position: fixed;
  bottom: 1.4rem;
  left: 0;
  right: 0;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  animation: fade-soft 1.4s ease 3.5s forwards;
}
.gate-footer, .gallery-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}
.footer-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.15rem;
  transition: color 0.2s, border-color 0.2s;
}
.footer-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.6rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-indent: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, background 0.25s, color 0.25s, opacity 0.25s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-solid { border-color: var(--accent); background: var(--accent); color: #131313; }
.btn-solid:hover { background: #d9b880; border-color: #d9b880; color: #131313; }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.btn.active { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { border-color: var(--accent); color: var(--accent); }

/* ---------- gallery ---------- */

.gallery { animation: fade 0.6s ease both; }

.gallery-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem 2.4rem;
  text-align: center;
}
.album-title {
  margin: 2.4rem 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.1;
  color: var(--text);
}
.album-date {
  margin-top: 0.9rem;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 2.2rem;
}
.gallery-note {
  max-width: 42rem;
  margin: 1rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--muted);
}

.grid {
  max-width: 1800px;
  margin: 0 auto;
  column-width: 280px;
  column-gap: 6px;
  padding: 0 6px 6px;
}
@media (max-width: 640px) {
  .grid { column-width: 150px; column-gap: 4px; padding: 0 4px 4px; }
}

.tile {
  position: relative;
  margin: 0 0 6px;
  break-inside: avoid;
  overflow: hidden;
  background: var(--bg-2);
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 640px) {
  .tile { margin-bottom: 4px; }
}
.tile img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }
.tile:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }

.tile-title {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 0.9rem 0.7rem;
  background: linear-gradient(to top, rgba(8, 8, 10, 0.85), transparent);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.tile:hover .tile-title { opacity: 1; }

.tile-check {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 1.45rem;
  height: 1.45rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(10, 10, 12, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #131313;
  transition: background 0.2s, border-color 0.2s;
}
.gallery.selecting .tile-check { display: flex; }
.gallery.selecting .tile:hover img { transform: none; }
.tile.selected .tile-check { background: var(--accent); border-color: var(--accent); }
.tile.selected .tile-check::after { content: "✓"; }
.tile.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  pointer-events: none;
}
.gallery.selecting .tile.selected img { opacity: 0.55; }

.gallery-footer {
  padding: 3.5rem 1.5rem 2.2rem;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
}

/* ---------- selection bar ---------- */

.selectbar[hidden] { display: none; }
.selectbar {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  max-width: calc(100vw - 1.6rem);
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.6rem 0.7rem 0.6rem 1.4rem;
  background: rgba(19, 19, 22, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 40;
  animation: rise 0.3s ease both;
}
.selectbar-count {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .selectbar {
    gap: 0.6rem;
    padding: 0.5rem 0.5rem 0.5rem 0.9rem;
  }
  .selectbar-count { font-size: 0.66rem; letter-spacing: 0.08em; }
  .selectbar .btn {
    padding: 0.68rem 0.95rem;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-indent: 0;
  }
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(7, 7, 9, 0.97);
  animation: fade 0.25s ease both;
}
.lightbox img {
  max-width: min(94vw, 1800px);
  max-height: 76dvh;
  object-fit: contain;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  transition: opacity 0.24s ease, transform 0.24s ease;
  will-change: opacity, transform;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox-caption {
  margin-top: 1.1rem;
  min-height: 1.1em;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--text);
}
.lightbox-caption[hidden] { visibility: hidden; }
.lightbox-nav {
  position: relative;
  width: 100%;
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
}
.lightbox-counter {
  min-width: 4.5rem;
  text-align: center;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

@media (max-width: 640px) {
  .lightbox img { max-height: 62dvh; }
  .lightbox-caption {
    position: absolute;
    left: 1.2rem;
    right: 1.2rem;
    bottom: 4.9rem;
    margin-top: 0;
    text-align: center;
  }
  .lightbox-nav {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1.6rem;
    margin-top: 0;
  }
}

.lb-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 300;
  cursor: pointer;
  padding: 0.8rem;
  line-height: 1;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s;
}
.lb-btn:hover { color: var(--accent); }
.lb-btn:focus-visible { color: var(--accent); }
.lb-btn.flash { animation: lb-flash 0.22s ease-out; }
.lb-prev, .lb-next { font-size: 1.9rem; padding: 0.4rem 0.9rem; }
.lb-close { position: absolute; top: 1rem; right: 1.2rem; font-size: 1.6rem; }
.lb-download {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem;
  text-decoration: none;
}
.lb-download-label {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.lb-download .icon { display: inline-flex; }
.lb-download svg { display: block; }

/* ---------- misc ---------- */

.spinner {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-soft { from { opacity: 0; } to { opacity: 0.75; } }
@keyframes lb-flash { 0% { color: var(--muted); } 45% { color: var(--accent); } 100% { color: var(--muted); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rule-in { from { opacity: 0; transform: scaleX(0); } to { opacity: 0.7; transform: scaleX(1); } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 0.8rem); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
