:root {
  --bg: #121212;
  --surface: #1c1c1c;
  --text: #e8e6e3;
  --muted: #9b9893;
  --accent: #d9c7a3;
  --gap: 6px;
  --row: 260px;
  --pad: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus { left: var(--pad); top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header and footer */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 28px var(--pad) 24px;
}
.site-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.site-header nav { display: flex; gap: 20px; }
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--text); }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--accent); }

main { padding: 0 var(--pad); }

h1, h2 { font-weight: 600; letter-spacing: 0.01em; }
h1 { font-size: 1.6rem; margin: 0 0 16px; }
h2 { font-size: 1.2rem; margin: 0 0 16px; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 48px var(--pad) 32px;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }

/* Justified grid: each tile grows in proportion to its aspect ratio, so rows
   fill the width without cropping. The ::after filler stops the last row stretching. */

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}
.grid::after {
  content: "";
  flex-grow: 1e6;
}
.tile {
  flex: var(--r) 1 calc(var(--r) * var(--row));
  display: block;
  background: var(--surface);
  overflow: hidden;
}
.tile img {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity 0.2s;
}
.tile[hidden] { display: none; }
.tile:hover img { opacity: 0.85; }
.tile:target { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Albums */

.album-head { margin-bottom: 24px; max-width: 70ch; }
.album-head p { color: var(--muted); margin: 0 0 8px; }

.albums-section { margin-top: 56px; }
.albums {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px var(--gap);
}
.albums a { display: block; text-decoration: none; }
.albums img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--surface);
  margin-bottom: 10px;
}
.albums a:hover img { opacity: 0.85; }
.album-title { font-weight: 600; margin-right: 8px; }
.album-count { color: var(--muted); font-size: 0.9rem; }

.notfound { padding: 48px 0; max-width: 60ch; }
.notfound p { color: var(--muted); }

/* PhotoSwipe caption */

.pswp__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px var(--pad) 18px;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.75));
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}
.pswp__caption:empty { display: none; }
.pswp__caption > * { display: block; }
.pswp__caption a { pointer-events: auto; color: var(--accent); }
.pswp__caption .meta,
.pswp__caption .exif { color: var(--muted); font-size: 0.8rem; }
.pswp__caption strong { font-weight: 600; }

@media (max-width: 600px) {
  :root { --row: 140px; --gap: 4px; }
  .site-header { padding-top: 20px; padding-bottom: 16px; }
  .site-footer { flex-direction: column; }
}

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