:root {
  --bg: #0b0b0d;
  --bg-elev: #141417;
  --fg: #e9e9ec;
  --fg-dim: #9a9aa2;
  --fg-faint: #6a6a72;
  --accent: #e8b04b;
  --line: #26262b;
  --row-h: 320px;
  --gap: 6px;
  --max-w: 1600px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Type scale — restrained so the photographs dominate. Tune here. */
  --fs-body: 0.95rem;
  --fs-meta: 0.75rem;
  --fs-small: 0.72rem;
  --fs-h2: 1rem;
  --fs-hero: clamp(1.5rem, 2.6vw, 2.1rem);
  --fs-title: clamp(1.35rem, 2.4vw, 1.9rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

/* ---------- Header / footer ---------- */
.site-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 22px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 10;
}
.brand { font-weight: 600; font-size: 0.92rem; letter-spacing: 0.2px; }
.brand-sub { color: var(--fg-faint); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.18em; }

.site-footer {
  padding: 40px;
  text-align: center;
  color: var(--fg-faint);
  font-size: var(--fs-small);
  border-top: 1px solid var(--line);
  margin-top: 60px;
}

main { max-width: var(--max-w); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

/* ---------- Index ---------- */
.intro { padding: clamp(36px, 7vw, 84px) 0 clamp(24px, 4vw, 48px); max-width: 680px; }
.intro h1 { font-size: var(--fs-hero); font-weight: 600; margin: 0 0 0.7em; letter-spacing: -0.015em; }
.intro p { color: var(--fg-dim); font-size: var(--fs-body); margin: 0 0 0.9em; max-width: 60ch; }
.intro p:last-child { margin-bottom: 0; }
.intro em { color: var(--fg-faint); font-style: italic; }

.events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(14px, 2vw, 28px);
  padding-bottom: 40px;
}
.event-card {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s ease;
}
.event-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.event-card-media {
  aspect-ratio: 3 / 2;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.event-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
.event-card:hover .event-card-media img { transform: scale(1.012); }
.event-card-body { padding: 14px 16px 18px; }
.event-card-body h2 { margin: 0 0 5px; font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.01em; }
.event-meta { margin: 0; color: var(--fg-faint); font-size: var(--fs-meta); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.event-meta span { position: relative; }

/* ---------- Event page ---------- */
.crumbs { padding: 26px 0 6px; }
.crumbs a { color: var(--fg-dim); font-size: var(--fs-meta); }
.crumbs a:hover { color: var(--fg); }

.event-head { padding: 12px 0 26px; max-width: 720px; }
.event-head h1 { font-size: var(--fs-title); font-weight: 600; margin: 0 0 0.5em; letter-spacing: -0.015em; }
.event-desc { color: var(--fg-dim); margin: 12px 0 0; font-size: var(--fs-body); }

/* ---------- Justified gallery ----------
   Photos keep their real aspect ratio (no cropping). Before JS runs, tiles are
   equal-height rows with a ragged right edge (via aspect-ratio + fixed height);
   gallery.js then justifies each row to the full width. Zero CLS because the
   aspect ratio is known up front. */
.gallery { display: flex; flex-wrap: wrap; gap: var(--gap); padding-bottom: 40px; }
/* Hide until justified (only when JS is present) to avoid a fallback->justified
   flash; .ready is added once the layout is computed. */
.js .gallery { opacity: 0; }
.js .gallery.ready { opacity: 1; transition: opacity 0.35s ease; }
.tile {
  position: relative;
  height: var(--row-h); /* fallback; gallery.js overrides with exact px */
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  cursor: zoom-in;
}
.tile picture, .tile img { width: 100%; height: 100%; display: block; }
.tile img { object-fit: cover; } /* tile matches photo aspect, so no crop */
.gallery.justified .tile { height: auto; } /* JS sets width+height inline */

@media (max-width: 700px) { :root { --row-h: 200px; } }

/* ---------- Lightbox ---------- */
.lb {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 1000;
  touch-action: none;
  user-select: none;
}
.lb.open { opacity: 1; visibility: visible; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: 0 0;
  will-change: transform;
  cursor: zoom-in;
}
.lb.zoomed .lb-img { cursor: grab; }
.lb.zoomed.grabbing .lb-img { cursor: grabbing; }

.lb-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 40px 24px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: var(--fs-meta);
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lb-caption .t { font-weight: 600; font-size: 0.85rem; }
.lb-caption .c { color: #d6d6da; }
.lb-caption .x { color: var(--accent); font-size: var(--fs-small); letter-spacing: 0.04em; }
.lb.zoomed .lb-caption { opacity: 0; }

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1.6rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease;
}
.lb-btn:hover { background: rgba(255,255,255,0.18); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close { top: 16px; right: 18px; transform: none; width: 44px; height: 44px; font-size: 1.3rem; }
.lb.zoomed .lb-btn { opacity: 0; pointer-events: none; }

.lb-counter {
  position: absolute; top: 22px; left: 24px;
  color: rgba(255,255,255,0.7); font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  *, .tile img, .event-card, .lb, .lb-img { transition: none !important; }
}
