.gallery-page {
  --gallery-image-radius: 18px;
  --gallery-image-radius-mobile: 16px;
}

.gallery-page .site-header {
  padding-bottom: 12px;
}

.gallery-page .site-subtitle {
  max-width: none;
}

.gal-container {
  max-width: 1236px;
  padding: 4px 0 52px;
}

.col-md-4,
.col-md-6,
.col-md-8,
.col-md-12,
.col-sm-6,
.col-xs-12 {
  float: left;
  padding: 0 4px;
}

.col-md-4 {
  width: 33.333333%;
}

.col-md-6 {
  width: 50%;
}

.col-md-8 {
  width: 66.666667%;
}

.col-md-12 {
  width: 100%;
}

.gal-item {
  --tile-pad-x: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  padding: 4px var(--tile-pad-x);
}

.col-md-4.gal-item {
  --tile-pad-x: 24px;
}

.col-md-6.gal-item {
  --tile-pad-x: 34px;
}

.col-md-8.gal-item,
.col-md-12.gal-item {
  --tile-pad-x: 4px;
}

.gallery-row.row-4-4-4 > .col-md-4.gal-item:first-child {
  padding-left: 4px;
  padding-right: 44px;
}

.gallery-row.row-4-4-4 > .col-md-4.gal-item:nth-child(2) {
  padding-left: 24px;
  padding-right: 24px;
}

.gallery-row.row-4-4-4 > .col-md-4.gal-item:nth-child(3) {
  padding-left: 44px;
  padding-right: 4px;
}

.gallery-row.row-4-8 > .col-md-4.gal-item:first-child {
  padding-left: 4px;
  padding-right: 44px;
}

.gallery-row.row-8-4 > .col-md-4.gal-item:nth-child(2) {
  padding-left: 44px;
  padding-right: 4px;
}

.gal-item .box {
  position: relative;
  height: var(--gallery-tile-height, 500px);
  overflow: hidden;
  border: 1px solid rgba(18, 18, 16, 0.08);
  border-radius: var(--gallery-image-radius);
  background: #121210;
  box-shadow: var(--shadow-card);
}

.gallery-row::after,
.gal-container::after {
  content: "";
  display: table;
  clear: both;
}

.gal-item.empty-slot .box {
  border: none;
  background: transparent;
  box-shadow: none;
}

.gal-item.text-item .box {
  border-color: var(--line);
  background: rgba(248, 248, 245, 0.94);
}

.text-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.gallery-text-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 30px;
  line-height: 1.35;
  color: #202020;
}

.box a {
  display: block;
  height: 100%;
}

.box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.box img:hover {
  transform: scale(1.04);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  background: rgba(12, 12, 11, 0.82);
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.modal.show {
  visibility: visible;
  opacity: 1;
}

.modal-dialog {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 90vw;
  max-height: 90vh;
  margin: 50px auto;
  transform: scale(0.96);
  transition: transform 0.24s ease;
}

.modal.show .modal-dialog {
  transform: scale(1);
}

.modal-content {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--gallery-image-radius);
  background: rgba(16, 16, 14, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

.modal-body {
  position: relative;
  padding: 0;
}

.modal-body img {
  display: block;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.close,
.modal-nav {
  position: absolute;
  z-index: 1001;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(14, 14, 12, 0.72);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  user-select: none;
}

.close:hover,
.modal-nav:hover {
  background: rgba(14, 14, 12, 0.9);
  transform: translateY(-1px);
}

.close {
  top: 14px;
  right: 14px;
}

.modal-nav {
  top: 50%;
  transform: translateY(-50%);
}

.modal-nav:hover {
  transform: translateY(calc(-50% - 1px));
}

.modal-nav.prev {
  left: 18px;
}

.modal-nav.next {
  right: 18px;
}

.modal-nav.hidden {
  display: none;
}

.description {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 18px 22px 20px;
  background: linear-gradient(180deg, rgba(12, 12, 11, 0) 0%, rgba(12, 12, 11, 0.72) 100%);
  color: #fff;
}

.description h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

@media (max-width: 960px) {
  .col-md-4,
  .col-md-6,
  .col-md-8,
  .col-md-12 {
    width: 100%;
  }

  .col-md-4.gal-item,
  .col-md-6.gal-item,
  .col-md-8.gal-item,
  .col-md-12.gal-item {
    --tile-pad-x: 4px;
  }

  .gallery-row.row-4-4-4 > .col-md-4.gal-item:first-child,
  .gallery-row.row-4-4-4 > .col-md-4.gal-item:nth-child(2),
  .gallery-row.row-4-4-4 > .col-md-4.gal-item:nth-child(3),
  .gallery-row.row-4-8 > .col-md-4.gal-item:first-child,
  .gallery-row.row-8-4 > .col-md-4.gal-item:nth-child(2) {
    padding-left: 4px;
    padding-right: 4px;
  }

  .col-sm-6 {
    width: 50%;
  }

  .gal-container {
    padding-bottom: 28px;
  }

  .gal-item .box {
    height: var(--gallery-tile-height-mobile, 260px);
    border-radius: var(--gallery-image-radius-mobile);
  }

  .modal-dialog {
    width: 95%;
    margin: 18px auto;
  }
}

@media (max-width: 600px) {
  .col-sm-6 {
    width: 100%;
  }

  .text-box {
    padding: 22px;
  }

  .gallery-text-content {
    font-size: 26px;
  }

  .close,
  .modal-nav {
    width: 38px;
    height: 38px;
  }

  .modal-nav.prev {
    left: 12px;
  }

  .modal-nav.next {
    right: 12px;
  }

  .description {
    padding: 16px 16px 18px;
  }
}
