:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --fg: #edebe9;
  --muted: #8c8c8c;
  --gold: #e8a530;
  --card: #121212;
  --raised: #1f1f1f;
  --line: #242424;
  --serif: "Playfair Display", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body:has(dialog[open]) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; }
img { display: block; max-width: 100%; }
.wrap { max-width: 1280px; margin-inline: auto; padding-inline: 24px; }
.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bar { width: 80px; height: 2px; background: var(--gold); }
.gold { color: var(--gold) !important; }
.link:hover, .back:hover { color: var(--gold); }

/* nav + footer */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; background: rgb(10 10 10 / .8); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-bottom: 1px solid rgb(36 36 36 / .5); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 16px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #000; border: 1px solid var(--line); font: 700 18px var(--serif); color: var(--fg); }
.brand b { display: block; font: 600 20px/1.2 var(--serif); letter-spacing: .5px; color: var(--fg); transition: color .2s; }
.brand:hover b { color: var(--gold); }
.nav-btn { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; transition: color .2s, border-color .2s; }
.nav-btn:hover { color: var(--gold); border-color: var(--gold); }
.brand small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .3em; color: var(--muted); }
footer { margin-top: 80px; padding: 48px 24px; border-top: 1px solid rgb(36 36 36 / .5); text-align: center; }
footer b { display: block; margin-bottom: 4px; font: 400 18px var(--serif); }
footer small { font-size: 12px; text-transform: uppercase; letter-spacing: .3em; color: var(--muted); }
footer .bar { width: 32px; height: 1px; margin: 24px auto; opacity: .4; }
footer p { font-size: 12px; color: rgb(140 140 140 / .5); }

/* home */
.hero { position: relative; height: 85vh; min-height: 500px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-inline: 24px; text-align: center;
  background: linear-gradient(rgb(10 10 10 / .7), rgb(10 10 10 / .4), var(--bg)), var(--img, none) center / cover; }
.hero h1 { margin-bottom: 24px; font-size: clamp(48px, 10vw, 96px); font-weight: 700; }
.chev { position: absolute; bottom: 32px; left: calc(50% - 12px); font-size: 24px; color: var(--muted); }
.sec { padding-block: 80px; }
.eyebrow { margin-bottom: 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .3em; color: var(--muted); }
.sec h2 { margin-bottom: 48px; font-size: clamp(30px, 4vw, 36px); }
.divider { display: flex; align-items: center; gap: 24px; font-size: 11px; text-transform: uppercase; letter-spacing: .3em; color: var(--muted); white-space: nowrap; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 32px; }
.cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: var(--raised); }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(0 0 0 / .8), rgb(0 0 0 / .2), transparent); opacity: 0; transition: opacity .5s; }
.card:hover .cover img { transform: scale(1.05); }
.card:hover .cover::after { opacity: 1; }
.card h3 { margin: 16px 0 6px; font-size: 20px; font-weight: 600; transition: color .2s; }
.card:hover h3 { color: var(--gold); }
.card .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge { position: absolute; top: 12px; right: 12px; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: rgb(0 0 0 / .6); backdrop-filter: blur(4px); font-size: 12px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.meta span { display: flex; align-items: center; gap: 6px; }
.desc { margin-top: 8px; font-size: 14px; color: rgb(140 140 140 / .8); }
.empty { padding-block: 96px; text-align: center; font-size: 14px; color: rgb(140 140 140 / .4); }
.empty .i { display: block; margin: 0 auto 24px; font-size: 64px; color: rgb(140 140 140 / .2); }
.empty b { display: block; margin-bottom: 8px; font: 400 24px var(--serif); }

/* gallery page: justified rows, every photo in a row gets the same height */
.page { min-height: 70vh; padding-top: 96px; }
.back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 32px; font-size: 14px; color: var(--muted); transition: color .2s; }
.page h1 { margin-bottom: 12px; font-size: clamp(36px, 5vw, 48px); }
.page > .bar { width: 64px; margin: 24px 0 48px; opacity: .6; }
.grid { --h: 260px; display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ""; flex-grow: 1e4; }
.grid a { flex: var(--r) 1 calc(var(--r) * var(--h)); max-width: calc(var(--r) * var(--h) * 1.8); background: var(--raised); }
.grid img { width: 100%; height: auto; transition: opacity .3s; }
.grid a:hover img { opacity: .85; }
@media (max-width: 640px) { .grid { --h: 140px; gap: 4px; } }

/* lightbox */
#lb { width: 100%; height: 100%; max-width: none; max-height: none; padding: 0; border: 0; background: var(--bg); color: var(--fg); }
#lb[open] { display: flex; align-items: center; justify-content: center; }
#lb-img { max-width: calc(100% - 32px); max-height: calc(100% - 136px); object-fit: contain; user-select: none; }
#lb-bar { position: absolute; inset: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 12px 16px; }
#lb-count { margin-right: auto; font-size: 13px; letter-spacing: .1em; color: var(--muted); }
.icon-btn { display: grid; padding: 10px; border: 0; border-radius: 50%; background: none; color: var(--fg); font-size: 20px; cursor: pointer; transition: color .2s, background .2s; }
.icon-btn:hover { color: var(--gold); background: rgb(255 255 255 / .06); }
#lb-prev, #lb-next { position: absolute; top: calc(50% - 24px); font-size: 28px; }
#lb-prev { left: 8px; }
#lb-next { right: 8px; }
#toast { position: absolute; bottom: 32px; left: 50%; translate: -50%; padding: 8px 16px; border-radius: 99px; background: var(--fg); color: var(--bg); font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#toast.on { opacity: 1; }

/* admin */
.form { display: grid; gap: 16px; max-width: 560px; }
.new { display: grid; gap: 16px; }
#up:has([name=gallery_id] option:not([value=""]):checked) .new { display: none; }
label { display: grid; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); }
input, select, textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); font: 15px var(--sans); text-transform: none; letter-spacing: normal; }
.btn { padding: 10px 20px; border: 1px solid var(--gold); border-radius: 8px; background: var(--gold); color: var(--bg); font: 500 14px var(--sans); cursor: pointer; }
.btn.ghost { border-color: var(--line); background: none; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: wait; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.sub { margin: 64px 0 24px; font-size: 28px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--muted); }
.table td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line); }
.table .link { color: var(--fg); }
.table img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-top: 48px; }
.tile { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tile img { grid-column: 1 / -1; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.tile button { padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--muted); font: 12px var(--sans); cursor: pointer; }
.tile button:hover { color: var(--gold); }

@media (prefers-reduced-motion: no-preference) {
  .hero h1, .hero .bar { animation: rise .9s ease-out both; }
  .chev { animation: bob 2s ease-in-out infinite; }
  @supports (animation-timeline: view()) {
    .card, .sec h2 { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes bob { 50% { transform: translateY(8px); } }
