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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #fafaf7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  padding: 200px;
}

@media (max-width: 1100px) {
  main {
    padding: 80px 48px;
  }
}

@media (max-width: 720px) {
  main {
    padding: 48px 24px;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

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

.catalog {
  list-style: none;
  margin: 0;
  padding: 0;
}

.catalog li {
  font-size: 15px;
  line-height: 1.35;
}

.catalog a {
  display: inline-block;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}

.catalog a:hover,
.catalog a:focus-visible {
  border-bottom-color: #1a1a1a;
}

/* ---------- Gallery + All page ---------- */

.page-header {
  margin: 0 0 64px;
}

.page-header h1 {
  margin: 0;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: 0.01em;
}

.page-header .back {
  display: inline-block;
  margin-bottom: 24px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: #6a6a6a;
  border-bottom: 1px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}

.page-header .back:hover,
.page-header .back:focus-visible {
  color: #1a1a1a;
  border-bottom-color: #1a1a1a;
}

/* balanced two-column layout — photos are pre-distributed at build time
   into the shorter column. odd-count blocks (and 1-photo blocks) put their
   last photo into .columns.featured below, which spans full width — so the
   columns never end unevenly */
.columns {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.columns.featured > .col {
  flex: 1 1 100%;
}

/* spacing between the main 2-col block and the featured full-width photo */
.gallery-block .columns + .columns,
.block-stack .columns + .columns {
  margin-top: 56px;
}

@media (max-width: 720px) {
  .columns {
    flex-direction: column;
    gap: 56px;
  }
}

/* /all/ page — gallery-grouped sections */

.gallery-block + .gallery-block {
  margin-top: 56px;
}

.gallery-block-title {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: #6a6a6a;
  margin: 0 0 20px;
}

@media (max-width: 720px) {
  .gallery-block + .gallery-block {
    margin-top: 56px;
  }
}

.photo {
  margin: 0;
}

.photo button {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  background: #efeee9;
}

.photo figcaption {
  margin-top: 12px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #6a6a6a;
  text-transform: lowercase;
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 48px;
  touch-action: pan-y;
}

.lightbox.open {
  display: flex;
}

.lightbox-stage {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.lightbox-img {
  display: block;
  max-width: 95vw;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  background: #1a1a1a;
}

.lightbox-meta {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #c8c5bd;
  text-transform: lowercase;
  text-align: center;
  max-width: 90vw;
}

.lightbox-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fafaf7;
  cursor: pointer;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease;
}

.lightbox-btn:hover,
.lightbox-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
  outline: none;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fafaf7;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, border-color 120ms ease;
}

.lightbox-nav.prev {
  left: 24px;
}

.lightbox-nav.next {
  right: 24px;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.5);
  outline: none;
}

@media (max-width: 720px) {
  .lightbox {
    padding: 16px;
  }
  .lightbox-img {
    max-height: calc(100vh - 120px);
  }
  .lightbox-nav {
    display: none;
  }
}

body.lightbox-open {
  overflow: hidden;
}
