/* Evgeny Shcherba — photographs */

:root {
  --paper: #f2eee6;
  --paper-2: #e6dfd3;
  --ink: #171614;
  --muted: #6d665c;
  --accent: #8a5a3b;
  --max: 1360px;
  --pad: clamp(1.25rem, 4vw, 4.5rem);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141311;
    --paper-2: #1e1c19;
    --ink: #ece7dd;
    --muted: #a49b8d;
    --accent: #c98f63;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html.is-locked {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("/assets/grain.png");
  background-repeat: repeat;
  background-size: 96px 96px;
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  body::after {
    opacity: 0.03;
    mix-blend-mode: screen;
  }
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

::selection {
  background: var(--accent);
  color: var(--paper);
}

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

/* Gallery: two photographs per row */

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(1rem, 2.6vw, 2.6rem);
  row-gap: clamp(1.6rem, 3.6vw, 3.4rem);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 4.5rem) var(--pad) clamp(2rem, 5vw, 5rem);
  align-items: start;
}

.plate {
  min-width: 0;
  margin: 0;
}

.plate__frame {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-2);
  text-decoration: none;
}

.plate__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.plate__frame:hover img,
.plate__frame:focus-visible img {
  transform: scale(1.022);
}

.plate figcaption {
  padding-top: 0.7rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-transform: uppercase;
}

.plate__title {
  color: var(--ink);
  transition: color 0.3s ease;
}

.plate:hover .plate__title {
  color: var(--accent);
}

/* Lightbox */

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 9, 8, 0.97);
  color: #f2eee6;
}

.lightbox::backdrop {
  background: rgba(10, 9, 8, 0.97);
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.3rem;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: clamp(3.6rem, 6vw, 6.5rem);
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 12rem);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.lightbox__caption {
  text-align: center;
}

.lightbox__title {
  font-size: 0.95rem;
}

.lightbox button {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  border: 1px solid rgba(242, 238, 230, 0.28);
  border-radius: 50%;
  background: transparent;
  color: #f2eee6;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.lightbox button:hover {
  background: rgba(242, 238, 230, 0.12);
  border-color: rgba(242, 238, 230, 0.55);
}

.lightbox__close {
  top: 1.4rem;
  right: 1.4rem;
  font-size: 1.4rem;
}

.lightbox__prev {
  top: 50%;
  left: 1.4rem;
  transform: translateY(-50%);
}

.lightbox__next {
  top: 50%;
  right: 1.4rem;
  transform: translateY(-50%);
}

/* Error page */

.error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  min-height: 100svh;
  padding: var(--pad);
  text-align: center;
}

.error__code {
  margin: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.error h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.error a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-underline-offset: 0.18em;
}

/* Responsive */

@media (max-width: 720px) {
  .gallery {
    grid-template-columns: 1fr;
  }

  .lightbox__figure {
    padding: 3.8rem 1rem 4.6rem;
  }

  .lightbox__img {
    max-height: calc(100vh - 11rem);
  }

  .lightbox__prev {
    top: auto;
    bottom: 1.2rem;
    left: calc(50% - 3.4rem);
    transform: none;
  }

  .lightbox__next {
    top: auto;
    right: calc(50% - 3.4rem);
    bottom: 1.2rem;
    transform: none;
  }

  .lightbox__close {
    top: 1rem;
    right: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body::after,
  .lightbox {
    display: none !important;
  }

  .gallery {
    max-width: none;
    padding: 0;
  }

  .plate {
    break-inside: avoid;
  }
}
