:root {
  --paper: #e8e4dc;
  --surface: #f6f3ec;
  --ink: #161814;
  --muted: #666a61;
  --line: rgba(22, 24, 20, 0.22);
  --forest: #19483a;
  --night: #11130f;
  --cream: #f4f0e6;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:has(dialog[open]) {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  padding: 0 clamp(20px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: var(--cream);
  background: var(--forest);
  font: 500 1rem/1 Georgia, "Iowan Old Style", "Times New Roman", serif;
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
  color: var(--muted);
  font-size: 0.88rem;
}

nav a,
footer a {
  border-bottom: 1px solid transparent;
  transition:
    color 160ms ease,
    border-color 160ms ease;
}

nav a:hover,
nav a:focus-visible,
footer a:hover,
footer a:focus-visible {
  color: var(--ink);
  border-color: currentColor;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.045em;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(3.6rem, 8vw, 8rem);
  line-height: 0.82;
}

.collection {
  padding: clamp(82px, 11vw, 160px) clamp(12px, 2vw, 30px);
}

.collection__head {
  width: min(1420px, 100%);
  margin: 0 auto clamp(42px, 7vw, 86px);
  padding: 0 clamp(8px, 2vw, 24px);
}

.gallery {
  width: min(1420px, 100%);
  margin: 0 auto;
  column-count: 3;
  column-gap: clamp(10px, 1.4vw, 20px);
}

.gallery__loading {
  column-span: all;
  padding: 80px 0;
  color: var(--muted);
  text-align: center;
}

.gallery-item {
  position: relative;
  margin: 0 0 clamp(10px, 1.4vw, 20px);
  break-inside: avoid;
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 550ms ease,
    transform 550ms ease;
}

.gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item button {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: #fff;
  background: #c8c3b8;
  cursor: zoom-in;
  text-align: left;
}

.gallery-item img {
  width: 100%;
  height: auto;
  transition:
    filter 320ms ease,
    transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gallery-item button:hover img,
.gallery-item button:focus-visible img {
  filter: saturate(1.04) contrast(1.02);
  transform: scale(1.02);
}

.gallery-item button:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 3px;
}

.noscript-message {
  padding: 40px;
  border: 1px solid var(--line);
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(20px, 3vw, 48px);
  color: var(--muted);
  background: var(--paper);
  font-size: 0.82rem;
}

footer p {
  margin: 0;
}

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: #f7f4eb;
  background: rgba(10, 11, 9, 0.97);
}

.lightbox::backdrop {
  background: rgba(10, 11, 9, 0.97);
}

.lightbox__stage {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: minmax(52px, 1fr) minmax(0, 12fr) minmax(52px, 1fr);
  align-items: center;
  padding: 70px 18px 22px;
}

.lightbox figure {
  display: grid;
  min-width: 0;
  height: 100%;
  margin: 0;
  grid-template-rows: minmax(0, 1fr);
}

.lightbox figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox__close,
.lightbox__nav {
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}

.lightbox__close {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(247, 244, 235, 0.76);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lightbox__close span {
  font-size: 1.5rem;
  line-height: 0.7;
}

.lightbox__nav {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(247, 244, 235, 0.3);
  border-radius: 50%;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.lightbox__nav:hover {
  color: var(--night);
  background: var(--cream);
}

@media (max-width: 940px) {
  .gallery {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .site-header {
    min-height: 64px;
  }

  nav a:first-child {
    display: none;
  }

  h1 {
    font-size: clamp(3.9rem, 19vw, 6rem);
  }

  .collection {
    padding-right: 8px;
    padding-left: 8px;
  }

  .collection__head {
    padding: 0 12px;
  }

  .gallery {
    column-count: 1;
    column-gap: 0;
  }

  .gallery-item {
    margin-bottom: 8px;
  }

  .lightbox__stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) 58px;
    padding: 64px 12px 10px;
  }

  .lightbox figure {
    grid-column: 1 / -1;
  }

  .lightbox__nav {
    grid-row: 2;
  }

  .lightbox__nav--previous {
    grid-column: 1;
  }

  .lightbox__nav--next {
    grid-column: 2;
  }

  .lightbox__close {
    top: 20px;
    right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .gallery-item {
    opacity: 1;
    transform: none;
  }
}
