/* Dark gallery theme. The photos are the colour; everything else stays quiet. */

:root {
  --bg: #0c0c0c;
  --surface: #151515;
  --text: #e9e6e1;
  --soft: #c9c4bc;
  --muted: #8f8a83;
  --line: #242424;
  --accent: #d8b48a;

  --pad: clamp(16px, 4vw, 56px);
  --gap: 6px;
  /* Target row height in album grids. It scales with the window, so rows
     hold several photos at any width instead of one stretched one. */
  --row: clamp(150px, 24vw, 340px);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
a:hover { color: #fff; }
code { font-size: 0.9em; color: var(--soft); }

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

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 20; padding: 8px 12px; background: var(--text); color: var(--bg); }

/* Header ------------------------------------------------------------------ */

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--pad);
}

.has-hero .site-header {
  position: absolute;
  inset: 0 0 auto 0;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.5);
}

.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.header-end { display: flex; align-items: center; gap: clamp(14px, 3vw, 32px); }
.site-header nav { display: flex; gap: clamp(14px, 3vw, 28px); }

/* Language switch: the current language is filled, the other is a link. */
.lang-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-shadow: none;
}

.has-hero .lang-switch { border-color: rgb(255 255 255 / 0.28); background: rgb(0 0 0 / 0.2); }

.lang-switch a,
.lang-switch span {
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-decoration: none;
}

.has-hero .lang-switch a { color: var(--soft); }
.lang-switch a:hover { color: var(--text); background: rgb(255 255 255 / 0.08); }
.lang-switch [aria-current] { background: var(--text); color: var(--bg); }

.site-header nav a,
.crumb,
.crumb a,
.section-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
}

.has-hero .site-header nav a { color: var(--soft); }
.site-header nav a:hover,
.site-header nav a[aria-current] { color: var(--text); }

/* Home -------------------------------------------------------------------- */

.hero {
  position: relative;
  height: min(100svh, 1100px);
  min-height: 420px;
  overflow: hidden;
  background: #000;
}

.hero img { width: 100%; height: 100%; object-fit: cover; }

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgb(0 0 0 / 0.45) 0%,
    transparent 22%,
    transparent 55%,
    var(--bg) 100%
  );
}

.hero-text {
  position: absolute;
  z-index: 1;
  left: var(--pad);
  right: var(--pad);
  bottom: clamp(32px, 9vh, 104px);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.75rem, 8vw, 6rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0.8em 0 0;
  color: var(--soft);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.albums { padding: 56px var(--pad) 96px; }
.section-title { margin: 0 0 28px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 48px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.album-card { display: block; text-decoration: none; }
.album-card .frame { display: block; overflow: hidden; }

.album-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s;
}

.album-card:hover img { transform: scale(1.035); }

.album-card-title {
  display: block;
  margin-top: 14px;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.25;
}

.album-card-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 0.85rem; }
.empty { color: var(--muted); }

/* Page headers (album, about, 404) --------------------------------------- */

.page-header { max-width: 920px; padding: 32px var(--pad) 44px; }
.crumb { margin: 0; }
.crumb a:hover { color: var(--text); }

.page-title {
  margin: 0.25em 0 0.3em;
  font-family: var(--serif);
  font-size: clamp(2.3rem, 5.5vw, 4rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.lede { max-width: 62ch; margin: 0 0 0.8em; color: var(--soft); font-size: 1.1rem; }
.meta { margin: 0; color: var(--muted); font-size: 0.85rem; }
.not-found { padding-top: 12vh; padding-bottom: 20vh; }

/* Album grid: justified rows. Each tile grows in proportion to its aspect
   ratio, so every photo in a row ends up the same height, uncropped. */

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  padding: 0 var(--pad);
}

.gallery::after { content: ""; flex-grow: 1000000; }

.tile {
  position: relative;
  flex: var(--r) 1 calc(var(--r) * var(--row));
  min-width: 0;
  aspect-ratio: var(--r);
  overflow: hidden;
  cursor: zoom-in;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s;
}

.tile:hover img { opacity: 0.85; }

.album-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 72px;
  padding: 32px var(--pad) 0;
  border-top: 1px solid var(--line);
}

.album-nav a {
  font-family: var(--serif);
  font-size: 1.3rem;
  text-decoration: none;
}

.album-nav span {
  display: block;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.album-nav-next { margin-left: auto; text-align: right; }

/* Lightbox ---------------------------------------------------------------- */

.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(6 6 6 / 0.97);
  color: var(--text);
}

.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.85); }

.lb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 56px 80px 20px;
}

.lb-img {
  width: auto;
  height: auto;
  max-width: calc(100vw - 160px);
  max-height: calc(100dvh - 150px);
  object-fit: contain;
  transition: opacity 0.2s;
}

.lb-img.is-loading { opacity: 0.35; }

.lightbox figcaption { min-height: 2.6em; text-align: center; }
.lb-caption { display: block; font-family: var(--serif); font-size: 1.1rem; }
.lb-meta { display: block; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.03em; }

.lb-counter {
  position: fixed;
  top: 18px;
  left: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

.lb-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}

.lb-btn:hover { background: rgb(255 255 255 / 0.08); color: #fff; }
.lb-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.lb-close { top: 8px; right: 10px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }

/* About ------------------------------------------------------------------- */

.about { max-width: 1180px; padding: 32px var(--pad) 96px; }

.about.has-portrait {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.portrait { width: 100%; }
.prose { max-width: 62ch; }
.prose p { color: var(--soft); font-size: 1.08rem; }
.prose .page-title { margin-top: 0; }

.contact { margin: 36px 0 0; padding: 24px 0 0; list-style: none; border-top: 1px solid var(--line); }
.contact li { display: flex; gap: 16px; padding: 4px 0; }

.contact span {
  min-width: 96px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  line-height: 2.1;
  text-transform: uppercase;
}

.contact a { text-decoration-color: var(--line); text-underline-offset: 4px; }
.contact a:hover { text-decoration-color: currentColor; }

/* Footer ------------------------------------------------------------------ */

.site-footer {
  margin-top: 72px;
  padding: 28px var(--pad) 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer p { margin: 0; }

/* Small screens ----------------------------------------------------------- */

@media (max-width: 760px) {
  :root { --row: 140px; --gap: 4px; }

  .about.has-portrait { grid-template-columns: 1fr; }

  .lb-stage { padding: 56px 0 84px; }
  .lb-img { max-width: 100vw; max-height: calc(100dvh - 180px); }
  .lightbox figcaption { padding: 0 20px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
}

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