:root {
  color-scheme: light;
  --ink: #262326;
  --muted: #625861;
  --line: #ded8dc;
  --accent: #a80076;
  --wash: #faf5f8;
  --surface: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font: 0.92rem/1.55 Verdana, Arial, Helvetica, sans-serif;
}

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site {
  width: min(100% - 30px, 50rem);
  margin-inline-start: 15px;
  padding: 0.8rem 0 3rem;
}

.site-header { margin-bottom: 1.85rem; }

.banner {
  display: grid;
  grid-template-columns: 526fr 238fr;
  align-items: start;
  width: min(100%, 764px);
}

.banner a { display: block; }
.banner img { display: block; width: 100%; height: auto; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  justify-content: center;
  padding-block: 0.35rem 0.95rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.site-nav a { text-underline-offset: 0.18em; }
.site-nav a:hover,
.site-nav a[aria-current],
.back:hover { color: var(--accent); }

.skip-link {
  position: absolute;
  top: 0;
  left: 1rem;
  translate: 0 -120%;
  z-index: 2;
  border: 1px solid var(--line);
  padding: 0.65rem 0.85rem;
  background: var(--surface);
}

.skip-link:focus { translate: 0 0; }

.back {
  display: inline-block;
  color: var(--muted);
  font-size: 0.84rem;
  text-underline-offset: 0.17em;
}

.page-title {
  margin: 0 0 1.15rem;
  font-size: clamp(1.45rem, 3.8vw, 2rem);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.back + .page-title { margin-top: 0.55rem; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { min-width: 0; margin: 0; }

.album-link {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.album-link:hover,
.photo-link:hover { border-color: var(--accent); }

.photo-link {
  display: block;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.tile-image {
  --tile-padding: 0.4rem;
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--wash);
}

.tile-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: var(--tile-padding);
  object-fit: contain;
}

.album-name {
  display: block;
  padding: 0.65rem 0.8rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.tile figcaption {
  padding: 0.42rem 0.12rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.lightbox {
  width: min(100% - 1.5rem, 50rem);
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  overflow: auto;
  border: 1px solid var(--line);
  padding: 0.9rem;
  color: var(--ink);
  background: var(--surface);
}

.lightbox::backdrop { background: rgba(31, 24, 29, 0.81); }

.lightbox-header,
.lightbox-footer { display: flex; align-items: center; gap: 0.6rem; }
.lightbox-header { justify-content: space-between; margin-bottom: 0.65rem; }
.lightbox-footer { justify-content: center; margin-top: 0.7rem; }
.lightbox figure { margin: 0; text-align: center; }

.lightbox figure img {
  display: block;
  width: 100%;
  height: min(62vh, 32rem);
  height: min(62dvh, 32rem);
  object-fit: contain;
  background: var(--wash);
}

.lightbox figure figcaption { margin-top: 0.45rem; overflow-wrap: anywhere; }
.lightbox figure figcaption:empty { display: none; }
.lightbox-position { margin: 0; color: var(--muted); font-size: 0.82rem; }
.lightbox-title { margin: 0; font-size: 0.9rem; }

.lightbox button {
  min-height: 44px;
  border: 1px solid #bcb2b9;
  padding: 0.42rem 0.7rem;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.lightbox button:hover { border-color: var(--accent); color: var(--accent); }

@media (width <= 46rem) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (width <= 34rem) {
  .site { width: calc(100% - 1.2rem); margin-inline-start: 0.6rem; }
  .site-header { margin-bottom: 1.35rem; }
  .site-nav { gap: 0.25rem 0.68rem; font-size: 0.81rem; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .album-name { padding: 0.55rem 0.62rem; font-size: 0.84rem; }
  .tile-image { --tile-padding: 0.28rem; }
  .lightbox { padding: 0.6rem; }
}
