/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #000;
  --fg: #ececec;
  --muted: #8a8a8a;
  --line: #222;
  --gap: clamp(24px, 3.2vw, 80px);
  /* Outer margin is deliberately larger than the gap between photos, so the
     feed reads as one centred block. Header, gallery and footer share it, so
     the logo and nav line up with the first and last columns. */
  --pad: clamp(20px, 7vw, 120px);
  --max-width: 1680px;
  --font: "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.lightbox-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.page {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(8px, 2vw, 32px) var(--pad) 0;
}

/* ---------- header / footer ---------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(20px, 3.5vw, 40px) var(--pad);
}

.site-logo {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.site-nav a {
  color: var(--muted);
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
}

.site-nav a[aria-current="page"] { border-bottom-color: var(--fg); }

.site-footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--pad) 2.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.site-footer p { margin: 0; }

/* ---------- gallery ---------- */
.gallery {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}

.gallery__column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  container-type: inline-size; /* lets tiles size their stagger from the column width */
}

.tile {
  display: block;
  padding: 0;
  border: 0;
  background: #0b0b0b; /* placeholder while the image loads */
  cursor: zoom-in;
  width: 100%;
  /* Extra space above the photo (set per tile by gallery.js) for the staggered look.
     Fallback first, then the exact column-relative value where supported. */
  margin-top: calc(var(--stagger, 0) * 30vw);
}

@supports (width: 1cqw) {
  .tile { margin-top: calc(var(--stagger, 0) * 100cqw); }
}

.tile img {
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.tile img.is-loaded { opacity: 1; }

.tile:hover img { opacity: 0.92; }

/* ---------- lightbox ---------- */
.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.97);
  color: var(--fg);
  overflow: hidden;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop { background: #000; }

.lightbox__image {
  max-width: calc(100vw - 2 * clamp(1rem, 8vw, 7rem)); /* room for the arrows */
  max-height: calc(100vh - 6rem);
  max-height: calc(100dvh - 6rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox__counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

.lightbox__button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 2.25rem/1 var(--font);
  cursor: pointer;
  transition: color 0.2s;
}

.lightbox__button:hover { color: var(--fg); }

.lightbox__close { top: 0.75rem; right: 0.75rem; }
.lightbox__prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 0.5rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 639px) {
  /* Swipe navigates on touch screens; keep the corners clear. */
  .lightbox__prev,
  .lightbox__next { display: none; }
}

/* ---------- text pages ---------- */
.prose {
  max-width: 60ch;
  padding-top: clamp(1rem, 4vw, 3rem);
}

.prose h1 {
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.prose p { margin: 0 0 1.25rem; color: #cfcfcf; }

.prose a {
  color: var(--fg);
  border-bottom: 1px solid var(--muted);
  transition: border-color 0.2s;
}

.prose a:hover { border-bottom-color: var(--fg); }

/* ---------- misc ---------- */
.noscript { color: var(--muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
