:root {
  --bg: #ffffff;
  --text: #1c1c1c;
  --muted: #767676;
  --line: #e7e7e7;
  --accent: #1c1c1c;
  --heart: #d6455d;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px;
  border: 1px solid var(--accent);
  background: var(--accent); color: #fff;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border-radius: 0;
}
.btn:hover { opacity: .88; }
.btn.small { padding: 8px 16px; font-size: 11px; }
.btn.ghost { background: transparent; border-color: #fff; color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.12); opacity: 1; }
.btn.link { background: none; border-color: transparent; color: var(--text); }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 100; padding: 10px 18px; background: #1c1c1c; color: #fff; font-size: 14px;
  animation: toast 4s forwards;
}
.toast.error { background: #a5283b; }
@keyframes toast { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* ---------- centered pages (password, messages) */
.center-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 16px;
}
.center-page .brand {
  font-family: var(--serif); font-size: 18px; letter-spacing: .2em; text-transform: uppercase;
  text-decoration: none; margin-bottom: 48px; color: var(--muted);
}
.center-page h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 6vw, 48px); margin: 0 0 4px; line-height: 1.15; }
.center-page p { color: var(--muted); max-width: 440px; }
.date { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 4px 0 0; }
.password-form { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 340px; margin-top: 36px; }
.password-form label { color: var(--muted); font-size: 14px; }
.password-form input {
  padding: 12px 14px; border: 1px solid var(--line); font: inherit; text-align: center; border-radius: 0;
}
.password-form input:focus { outline: none; border-color: var(--text); }

/* ---------- homepage */
.home-header { text-align: center; padding: 72px 16px 40px; }
.brand-title {
  font-family: var(--serif); font-weight: 400; letter-spacing: .22em; text-transform: uppercase;
  font-size: clamp(26px, 5vw, 40px); margin: 0;
}
.tagline { color: var(--muted); margin: 8px 0 0; letter-spacing: .06em; }
.home { max-width: 1280px; margin: 0 auto; padding: 0 16px 48px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px 28px; }
@media (max-width: 400px) { .cards { grid-template-columns: 1fr; } }
.card { text-decoration: none; display: block; }
.card-img { position: relative; aspect-ratio: 3 / 2; background: #f3f3f3; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.card:hover .card-img img { transform: scale(1.03); }
.card h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 14px 0 0; text-align: center; }
.card .date { text-align: center; }
.lock { position: absolute; top: 10px; right: 10px; font-size: 14px; background: rgba(255,255,255,.85); padding: 2px 6px; }
.about { max-width: 640px; margin: 80px auto 0; text-align: center; font-family: var(--serif); font-size: 21px; line-height: 1.6; }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; }

.site-footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px;
  padding: 40px 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ---------- gallery */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 420px;
  background: #222 var(--cover) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center; text-align: center; color: #fff;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.45)); }
.hero-inner { position: relative; padding: 0 16px; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 8vw, 76px); line-height: 1.05; margin: 0; }
.hero-sub { margin: 10px 0 0; font-size: 16px; opacity: .92; }
.hero-date { margin: 10px 0 30px; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; opacity: .9; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar-title { display: flex; flex-direction: column; min-width: 0; }
.bar-brand { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.bar-gallery { font-family: var(--serif); font-size: 22px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tab {
  background: none; border: 0; padding: 8px 12px; cursor: pointer;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab span { margin-left: 2px; }
.bar .btn { margin-left: 8px; }

.admin-note { text-align: center; font-size: 13px; color: var(--muted); background: #faf6e8; margin: 0; padding: 8px 16px; }

.grid-wrap { padding: 8px 8px 48px; max-width: 1800px; margin: 0 auto; }
.grid { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; }
.tile { position: relative; background: #f2f2f2; overflow: hidden; cursor: zoom-in; flex: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s ease; }
.tile img.loaded { opacity: 1; }
.tile .fav-btn {
  position: absolute; right: 8px; bottom: 8px;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.35); color: #fff; font-size: 18px; cursor: pointer;
  opacity: 0; transition: opacity .2s;
}
.tile:hover .fav-btn, .tile .fav-btn.on { opacity: 1; }
.tile .fav-btn.on { color: var(--heart); background: rgba(255,255,255,.9); }
@media (hover: none) { .tile .fav-btn { opacity: 1; background: rgba(0,0,0,.25); } }

/* ---------- lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: #fff;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: 64px 1fr 64px;
}
.lb-top {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
}
.lb-count { font-size: 12px; letter-spacing: .12em; color: var(--muted); }
.lb-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; font-size: 22px; cursor: pointer; text-decoration: none; color: var(--text);
}
.icon-btn:hover { background: #f2f2f2; }
#lb-fav.on { color: var(--heart); }
.lb-stage { margin: 0; grid-row: 2; grid-column: 2; display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.lb-stage { position: relative; }
.lb-stage img {
  width: 100%; height: 100%; object-fit: contain;
  user-select: none; -webkit-user-drag: none;
}
.lightbox.loading .lb-stage::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 2px solid rgba(255,255,255,.6); border-top-color: #1c1c1c; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lb-nav { grid-row: 2; border: 0; background: none; font-size: 44px; color: var(--muted); cursor: pointer; }
.lb-nav:hover { color: var(--text); }
.lb-nav.prev { grid-column: 1; }
.lb-nav.next { grid-column: 3; }
.lb-name { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0; padding-bottom: env(safe-area-inset-bottom); }
@media (max-width: 640px) {
  .lightbox { grid-template-columns: 0 1fr 0; }
  .lb-nav { display: none; }
}

/* ---------- dialogs */
.modal {
  border: 0; padding: 28px; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal::backdrop { background: rgba(0,0,0,.45); }
.modal h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 8px; }
.modal p { color: var(--muted); margin: 0 0 16px; }
.modal label { display: block; font-size: 13px; margin-bottom: 14px; }
.modal input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--line); font: inherit; border-radius: 0;
}
.modal input:focus { outline: none; border-color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-error { color: #a5283b !important; font-size: 14px; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.choice {
  display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line);
  text-decoration: none; cursor: pointer;
}
.choice:hover { border-color: var(--text); }
.choice span { color: var(--muted); font-size: 13px; }

/* ---------- icons */
.icon { display: inline-block; flex: none; vertical-align: -0.14em; }
.lb-nav .icon, .av-nav .icon { stroke-width: 1.25; }
