@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.woff2") format("woff2");
  font-display: swap;
  font-weight: 400 600;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}

:root {
  color-scheme: light;
  --paper: #f6f3ec;
  --ink: #22271f;
  --muted: #5c5e53;
  --accent: #8c421f;
  --rule: rgb(34 39 31 / 20%);
  --image-placeholder: #e7e2d7;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --gutter: clamp(1rem, 4.45vw, 4rem);
}

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

html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.5 var(--sans); }
h1, h2, p, figure { margin: 0; }
img { display: block; width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }

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

.wrap {
  width: min(100% - 2 * var(--gutter), 1280px);
  margin-inline: auto;
}

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  z-index: 2;
  inset: 0.75rem auto auto 0.75rem;
  padding: 0.75rem 1rem;
  color: white;
  background: var(--accent);
}

.masthead, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.masthead {
  min-height: 4.75rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark, .quiet-link, .gallery-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: none;
}

.wordmark {
  gap: 0.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.wordmark span:last-child {
  color: var(--muted);
  font-weight: 400;
}

.wordmark-mark {
  display: grid;
  place-items: center;
  flex: 0 0 1.125rem;
  height: 1.125rem;
  margin-right: 0.3rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
}

.wordmark-mark::after {
  content: "";
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: var(--accent);
}

.quiet-link {
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.quiet-link:hover, .wordmark:hover { color: var(--accent); }

.intro {
  display: grid;
  gap: 1.75rem;
  padding-block: clamp(2.25rem, 5vw, 4.25rem) clamp(3.5rem, 6vw, 5.5rem);
}

.intro-copy {
  align-self: center;
  padding-bottom: 0.5rem;
}

.intro h1, .gallery h2, .viewer-caption h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.025em;
}

.intro h1 {
  font-size: clamp(4.35rem, 11vw, 8rem);
  line-height: 0.87;
}

.intro-copy p {
  max-width: 19rem;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.6vw, 1.25rem);
  line-height: 1.45;
}

.gallery-link {
  justify-content: space-between;
  gap: 1.375rem;
  margin-top: 1.5rem;
  padding: 0.625rem 0.875rem 0.625rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease;
}

.gallery-link:hover {
  color: white;
  background: var(--accent);
}

.featured { min-width: 0; }

.featured img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 48% 55%;
  background: var(--image-placeholder);
}

.featured-caption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}

.featured-caption span:first-child {
  color: var(--ink);
  font-weight: 600;
}

.gallery {
  border-top: 1px solid var(--rule);
  padding-top: 1.75rem;
  scroll-margin-top: 0.5rem;
}

.gallery-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1.375rem;
}

.gallery h2 {
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  line-height: 0.98;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.filters button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.75rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

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

.filters button[aria-pressed="true"] {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.photo-grid {
  display: grid;
  gap: 1.875rem 1.25rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.photo { min-width: 0; }

.photo-link {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--image-placeholder);
}

.photo-link img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 220ms ease-out;
}

.photo-link:hover img, .photo-link:focus-visible img { transform: scale(1.025); }

.photo-expand {
  position: absolute;
  right: 0.625rem;
  bottom: 0.625rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}

.photo figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}

.photo-title { font-size: 0.9375rem; font-weight: 600; }
.photo-category { color: var(--muted); font-size: 0.8125rem; }

.footer {
  flex-wrap: wrap;
  min-height: 5.5rem;
  margin-top: clamp(3.25rem, 7vw, 6rem);
  border-top: 1px solid var(--rule);
  font-size: 0.875rem;
  color: var(--muted);
}

.viewer {
  --accent: #f6ae83;
  position: fixed;
  width: min(100% - 1rem, 72rem);
  height: min(100% - 1rem, 53rem);
  max-width: none;
  max-height: none;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  border: 1px solid rgb(246 243 236 / 24%);
  border-radius: 4px;
  background: #22271f;
  color: #f6f3ec;
}

.viewer::backdrop { background: rgb(19 22 18 / 83%); }

html:has(.viewer[open]) { overflow: hidden; }

.viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.viewer-top, .viewer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.viewer-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  background: #191d17;
  overflow: hidden;
}

.viewer-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.viewer-error {
  padding: 1rem;
  text-align: center;
}

.viewer-error a { color: var(--accent); }

.viewer-caption { min-width: 0; }
.viewer-caption h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1; overflow-wrap: anywhere; }
.viewer-count, .viewer-category { color: #cbcbbf; font-size: 0.875rem; }
.viewer-category { margin-top: 0.25rem; }

.viewer-controls { display: flex; gap: 0.5rem; }

.viewer-button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid #899081;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

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

@media (max-width: 420px) {
  .filters { gap: 0.3125rem; }
  .filters button { padding-inline: 0.5rem; font-size: 0.8125rem; }
}

@media (min-width: 620px) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 820px) {
  .intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.25fr);
    gap: clamp(1.5rem, 4vw, 4rem);
  }

  .intro h1 { font-size: clamp(5.45rem, 9vw, 8.4rem); }
  .intro h1 span { display: block; }
  .intro-copy { padding-bottom: 2.5rem; }
  .featured img { aspect-ratio: 1.68; }
}

@media (min-width: 1000px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .photo-link:hover img, .photo-link:focus-visible img { transform: none; }
}
