:root {
  --ivory: #FAF7F2;
  --card: #FFFDF9;
  --ink: #2E2A26;
  --muted: #7A7166;
  --bronze: #B08D57;
  --bronze-dark: #96733F;
  --line: #E7DCC8;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
}
h1, h2, .lb-counter { font-family: "Playfair Display", Georgia, serif; }

/* Header */
.site-header { text-align: center; padding: 42px 20px 10px; }
.date-line {
  margin: 0;
  color: var(--bronze-dark);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 500;
}
.rule { width: 56px; height: 2px; background: var(--bronze); margin: 16px auto; border-radius: 2px; }
.site-header h1 { margin: 0 0 8px; font-size: 2.15rem; font-weight: 600; line-height: 1.2; }
.subtitle { margin: 0; color: var(--muted); font-size: 1rem; }
@media (min-width: 760px) { .site-header h1 { font-size: 2.9rem; } }

/* Hero cover */
.hero { margin: 26px 0 0; }
.hero img {
  display: block;
  width: 100%;
  height: min(76vh, 720px);
  object-fit: cover;
  object-position: center 30%;
}

/* Sticky section nav */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 4px;
  justify-content: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 760px) { .section-nav { justify-content: center; } }
.section-nav a {
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
}
.section-nav a:hover, .section-nav a:focus-visible { background: #F1E8D8; color: var(--bronze-dark); }

/* Sections + masonry */
main { max-width: 1240px; margin: 0 auto; padding: 8px 14px 30px; }
.notice { text-align: center; color: var(--muted); padding: 44px 0; }
.notice.error { color: #A33B2E; }
.album { margin: 34px 0 10px; scroll-margin-top: 64px; }
.album-head { text-align: center; margin: 0 6px 18px; }
.album-head h2 { margin: 0 0 4px; font-size: 1.55rem; font-weight: 600; }
.album-head .vi { color: var(--bronze-dark); font-size: 1.02rem; margin: 0 0 4px; }
.album-meta { color: var(--muted); font-size: 0.9rem; margin: 0; }

.grid { columns: 2; column-gap: 12px; }
@media (min-width: 900px) { .grid { columns: 3; column-gap: 16px; } }
.tile {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  break-inside: avoid;
  border-radius: var(--radius);
}
@media (min-width: 900px) { .tile { margin-bottom: 16px; } }
.tile img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #EFE8DA;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.tile:hover img, .tile:focus-visible img {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(46, 42, 38, 0.18);
}
.tile:focus-visible { outline: 3px solid var(--bronze); outline-offset: 2px; }

/* Admin marking (only rendered for admin sessions) */
.tile-wrap { position: relative; break-inside: avoid; margin: 0 0 12px; }
@media (min-width: 900px) { .tile-wrap { margin-bottom: 16px; } }
.tile-wrap .tile { margin: 0; }
.tile-wrap.is-marked .tile img { outline: 4px solid #C0392B; outline-offset: -4px; }
.mark-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid #fff;
  background: rgba(46, 42, 38, 0.55);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.mark-btn.is-marked { background: #C0392B; }
.admin-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: #2E2A26;
  color: #F3EDE2;
  font-size: 0.9rem;
  box-shadow: 0 -4px 18px rgba(46, 42, 38, 0.25);
}
.admin-bar[hidden] { display: none; }
.admin-bar a { color: #E9C987; font-weight: 600; text-decoration: none; white-space: nowrap; }
body.has-admin-bar { padding-bottom: 58px; }

/* Footer */
.site-footer { text-align: center; color: var(--muted); font-size: 0.88rem; padding: 10px 20px 38px; }
.logout {
  margin-top: 10px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.logout:hover { color: var(--bronze-dark); border-color: var(--bronze); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(24, 20, 16, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; max-width: 94vw; text-align: center; }
.lb-figure img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: 8px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.65);
}
.lb-figure figcaption { margin-top: 12px; color: #F3EDE2; font-size: 1rem; }
.lb-counter { color: var(--bronze); font-size: 0.95rem; margin-top: 4px; letter-spacing: 0.06em; }
.lb-close, .lb-nav, .lb-download {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #F3EDE2;
  border: 0;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}
.lb-close { top: 14px; right: 14px; }
.lb-download { top: 14px; right: 74px; font-size: 1.25rem; }
.lb-mark {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #F3EDE2;
  border: 0;
  border-radius: 999px;
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.lb-mark:hover { background: rgba(255, 255, 255, 0.22); }
.lb-mark.is-marked { background: #C0392B; }
.lb-mark[hidden] { display: none; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-close:hover, .lb-nav:hover, .lb-download:hover { background: rgba(255, 255, 255, 0.22); }
@media (max-width: 640px) {
  .lb-prev { left: 4px; } .lb-next { right: 4px; }
  .lb-nav { width: 42px; height: 42px; opacity: 0.85; }
}
