/* Base */
body {
  margin: 0;
  background: #202020;
  color: #f5f5f5;
  font-family: Calibri, Arial, sans-serif;
}

a,
a:hover,
a:focus {
  color: inherit;
  text-decoration: none;
}

.photo-page,
.photo-page * {
  box-sizing: border-box;
}

.photo-page {
  min-height: 100vh;
  padding: 24px 34px 46px;
  overflow-x: hidden;
  background: #202020;
}

.photo-page.is-author {
  padding: 24px 34px 0;
  background: #202020;
  color: #202020;
}

.photo-dropdown,
.home-photo-frame,
.photo-thumb,
.detail-frame,
.author-portrait {
  border-radius: 0;
}

.photo-nav button,
.photo-dropdown a,
.gallery-hover-preview,
.gallery-hover-preview img,
.gallery-pagination a,
.gallery-pagination span,
.detail-control {
  border-radius: 4px;
}

/* Header */
.photo-header {
  position: relative;
  z-index: 30;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-logo {
  position: absolute;
  top: 50%;
  left: 0;
  width: 38px;
  height: 38px;
  border: 2px solid #f5f5f5;
  border-radius: 50%;
  color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-50%);
}

.photo-logo:hover,
.photo-logo:focus {
  background: #f5f5f5;
  color: #202020;
}

.photo-page.is-author .photo-logo {
  background: #f5f5f5;
  color: #202020;
}

/* Navigation */
.photo-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.photo-nav-item {
  position: relative;
}

.photo-nav-item::after {
  content: "";
  position: absolute;
  z-index: 45;
  top: 100%;
  left: 50%;
  display: none;
  width: max(100%, 236px);
  height: 12px;
  transform: translateX(-50%);
}

.photo-nav-item:hover::after,
.photo-nav-item.is-open::after {
  display: block;
}

.photo-nav button,
.photo-dropdown a {
  display: block;
  padding: 9px 14px;
  border: 2px solid #f5f5f5;
  background: #202020;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.photo-nav button {
  appearance: none;
  cursor: pointer;
}

.photo-nav button:hover,
.photo-nav button:focus,
.photo-nav-item.is-open button,
.photo-nav-item.is-active button,
.photo-dropdown a:hover,
.photo-dropdown a:focus {
  background: #f5f5f5;
  color: #202020;
}

.photo-dropdown {
  position: absolute;
  z-index: 50;
  top: calc(100% + 12px);
  left: 50%;
  display: none;
  min-width: 236px;
  border: 2px solid #f5f5f5;
  background: #202020;
  transform: translateX(-50%);
}

.photo-nav-item.is-open .photo-dropdown,
.photo-nav-item:hover .photo-dropdown {
  display: block;
}

.photo-dropdown a {
  padding: 11px 16px;
  border: 0;
  line-height: 1.25;
  text-align: center;
}

/* Page Layout */
.photo-content {
  max-width: 1360px;
  margin: 24px auto 0;
}

.photo-page.is-author .photo-content {
  max-width: none;
  min-height: calc(100vh - 88px);
  margin: 24px -34px 0;
  background: #f5f5f5;
}

.empty-gallery {
  margin-top: 120px;
  color: #f5f5f5;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

/* Homepage */
.home-photo {
  min-height: calc(100vh - 134px);
}

.home-photo-stage {
  position: relative;
  min-height: calc(100vh - 150px);
}

.home-photo-frame {
  --home-frame-padding: 24px;
  --home-image-max-width: calc(100vw - 156px);
  --home-image-max-height: calc(100vh - 250px);
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  padding: var(--home-frame-padding);
  background: #f5f5f5;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 260ms ease;
  z-index: 0;
}

.home-photo-frame.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.home-photo-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--home-image-max-width);
  max-height: var(--home-image-max-height);
  object-fit: contain;
}

.home-photo-frame.has-image-size img {
  width: min(
    var(--home-image-width),
    var(--home-image-max-width),
    calc(var(--home-image-max-height) * var(--home-image-ratio))
  );
  max-width: none;
  max-height: none;
  aspect-ratio: var(--home-image-ratio);
}

.photo-caption {
  color: #f5f5f5;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
}

.home-photo-frame .photo-caption {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  min-width: min(420px, 80vw);
  transform: translateX(-50%);
}

/* Gallery */
.gallery-page {
  padding-bottom: 34px;
}

.gallery-page h1,
.detail-heading h1 {
  position: static;
  visibility: visible;
  margin: 0 0 28px;
  color: #f5f5f5;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
}

.photo-grid {
  --gallery-row-height: clamp(155px, 13vw, 205px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
}

.photo-thumb {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: calc(var(--gallery-row-height) * var(--thumb-ratio, 1));
  border: 2px solid #f5f5f5;
  overflow: hidden;
  background: #111111;
}

.photo-thumb img {
  display: block;
  width: 100%;
  height: var(--gallery-row-height);
  object-fit: cover;
}

.gallery-hover-preview {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  width: max-content;
  max-width: calc(100vw - 48px);
  border: 4px solid #f5f5f5;
  background: #f5f5f5;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transform-origin: center center;
  transition: opacity 100ms ease, transform 100ms ease;
}

.gallery-hover-preview.is-visible {
  opacity: 1;
  transform: scale(1);
}

.gallery-hover-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(840px, calc(100vw - 48px));
  max-height: min(560px, calc(100vh - 190px));
  object-fit: contain;
}

.gallery-hover-preview span {
  display: block;
  padding: 16px 22px;
  background: #f5f5f5;
  color: #2d4d7b;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
}

/* Pagination */
.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.gallery-pagination a,
.gallery-pagination span {
  width: 34px;
  height: 34px;
  border: 2px solid #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5f5f5;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

.gallery-pagination i,
.gallery-pagination svg {
  display: block;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  font-size: 13px;
  line-height: 1;
}

.gallery-pagination a:hover,
.gallery-pagination a:focus,
.gallery-pagination .is-current {
  background: #f5f5f5;
  color: #202020;
}

.gallery-pagination .is-disabled {
  opacity: 0.32;
}

/* Photo Detail */
.photo-detail {
  position: relative;
  left: 50%;
  width: calc(100vw - 68px);
  min-height: calc(100vh - 134px);
  padding: 0 0 54px;
  transform: translateX(-50%);
}

.detail-heading {
  position: relative;
  pointer-events: none;
}

.detail-heading h1 {
  margin-bottom: 20px;
  padding: 0 110px;
}

.detail-shell {
  width: fit-content;
  max-width: 100%;
  margin: -58px auto 0;
}

.detail-toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.detail-toolbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.detail-control {
  position: relative;
  z-index: 6;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 2px solid #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5f5f5;
  font-size: 0;
  line-height: 1;
}

.detail-control i,
.detail-control svg {
  display: block;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  font-size: 13px;
  line-height: 1;
}

.detail-close i,
.detail-close svg {
  width: 14px;
  height: 14px;
  font-size: 14px;
}

.detail-control:hover,
.detail-control:focus,
.detail-close:hover,
.detail-close:focus {
  background: #f5f5f5;
  color: #202020;
}

.detail-control.is-disabled {
  opacity: 0.24;
}

.detail-frame {
  --detail-frame-padding: 24px;
  --detail-stage-max-width: calc(100vw - 68px);
  --detail-image-max-width: max(1px, calc(var(--detail-stage-max-width) - (2 * var(--detail-frame-padding))));
  --detail-image-max-height: max(140px, calc(100vh - 285px));
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: var(--detail-frame-padding);
  background: #f5f5f5;
  user-select: none;
  -webkit-user-select: none;
}

.detail-image-wrap {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
}

.detail-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--detail-image-max-width);
  max-height: var(--detail-image-max-height);
  object-fit: contain;
  opacity: 1;
  transition: opacity 150ms ease;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.photo-detail.is-detail-leaving .detail-frame img,
.photo-detail.is-detail-entering .detail-frame img {
  opacity: 0;
}

.detail-frame.has-image-size img {
  width: min(
    var(--detail-image-width),
    var(--detail-image-max-width),
    calc(var(--detail-image-max-height) * var(--detail-image-ratio))
  );
  max-width: none;
  max-height: none;
  aspect-ratio: var(--detail-image-ratio);
}

.detail-image-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  display: block;
  width: 50%;
  text-decoration: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.detail-image-nav-prev {
  left: 0;
  cursor: url("../images/cursor-photo-prev.svg") 16 16, pointer;
}

.detail-image-nav-next {
  right: 0;
  cursor: url("../images/cursor-photo-next.svg") 16 16, pointer;
}

.detail-meta {
  position: relative;
  min-height: 24px;
  margin-top: 28px;
  padding: 0 82px;
}

.detail-meta .photo-caption {
  margin: 0;
}

.detail-position {
  position: absolute;
  top: 2px;
  right: 0;
  margin: 0;
  color: #f5f5f5;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

/* Author */
.author-page {
  padding: 29px 24px 82px;
  background: #f5f5f5;
  color: #202020;
}

.author-inner {
  max-width: 650px;
  margin: 0 auto;
}

.author-page h1 {
  position: static;
  visibility: visible;
  margin: 0 0 34px;
  color: #202020;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
}

.author-layout {
  display: block;
}

.author-portrait {
  width: 378px;
  height: 247px;
  min-height: 0;
  margin: 0 auto;
  border: 2px solid #202020;
  background: #979797;
  display: flex;
  align-items: center;
  justify-content: center;
}

.author-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.author-text {
  max-width: 545px;
  margin: 40px auto 0;
  color: #202020;
  font-size: 18px;
  line-height: 1.82;
  text-align: left;
}

/* Error Pages */
.error-content {
  max-width: 450px;
  margin: 15px auto 0;
  text-align: center;
}

.error-content h3 {
  padding: 15px;
  font-size: 20px;
}

.error-content p {
  margin-bottom: 30px;
}

.error-content .error-content-body {
  padding-right: 15px;
  padding-left: 15px;
}

.error-content .error-content-footer {
  padding: 15px;
  border-top: 1px solid #dfdfdf;
}

/* Responsive */
@media (max-width: 1180px) {
  .photo-grid {
    --gallery-row-height: 170px;
  }
}

@media (max-width: 860px) {
  .photo-grid {
    --gallery-row-height: 150px;
  }

  .author-portrait {
    width: min(378px, 100%);
  }
}

@media (max-width: 767px) {
  .photo-page {
    padding: 18px 13px 34px;
  }

  .photo-page.is-author {
    padding: 18px 13px 0;
  }

  .photo-header,
  .photo-page.is-author .photo-header {
    min-height: auto;
    padding: 0;
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .photo-logo,
  .photo-page.is-author .photo-logo {
    position: static;
    top: auto;
    left: auto;
    margin: 0;
    transform: none;
  }

  .photo-nav {
    width: 100%;
    gap: 5px;
  }

  .photo-nav button,
  .photo-dropdown a {
    padding: 9px 10px;
    font-size: 15px;
  }

  .photo-dropdown {
    top: calc(100% + 8px);
    min-width: 196px;
  }

  .photo-nav-item::after {
    width: max(100%, 196px);
    height: 8px;
  }

  .photo-content {
    margin-top: 28px;
  }

  .photo-page.is-author .photo-content {
    min-height: calc(100vh - 136px);
    margin: 28px -13px 0;
  }

  .home-photo,
  .home-photo-stage {
    min-height: calc(100vh - 169px);
  }

  .home-photo-frame {
    --home-frame-padding: 8px;
    --home-image-max-width: calc(100vw - 32px);
    --home-image-max-height: calc(100vh - 280px);
  }

  .home-photo-frame.has-image-size img {
    width: min(
      var(--home-image-width),
      var(--home-image-max-width)
    );
  }

  .photo-caption,
  .detail-position {
    font-size: 16px;
  }

  .gallery-page h1,
  .detail-heading h1 {
    margin-bottom: 22px;
    font-size: 22px;
  }

  .photo-grid {
    gap: 9px;
  }

  .photo-thumb {
    max-width: 100%;
  }

  .gallery-hover-preview {
    display: none;
  }

  .photo-detail {
    width: calc(100vw - 16px);
    min-height: calc(100vh - 170px);
    padding: 0 0 48px;
  }

  .detail-heading h1 {
    padding: 0;
  }

  .detail-shell {
    max-width: none;
    margin-top: 0;
  }

  .detail-toolbar {
    margin-bottom: 14px;
  }

  .detail-frame {
    --detail-frame-padding: 8px;
    --detail-stage-max-width: calc(100vw - 16px);
    --detail-image-max-width: max(1px, calc(var(--detail-stage-max-width) - (2 * var(--detail-frame-padding))));
    --detail-image-max-height: max(140px, calc(100vh - 300px));
    max-width: none;
  }

  .detail-frame img {
    max-width: var(--detail-image-max-width);
    max-height: var(--detail-image-max-height);
  }

  .detail-frame.has-image-size img {
    width: min(
      var(--detail-image-width),
      var(--detail-image-max-width)
    );
  }

  .detail-meta {
    margin-top: 22px;
    padding: 0 58px;
  }

  .author-page {
    padding: 30px 18px 56px;
  }

  .author-page h1 {
    margin-bottom: 28px;
    font-size: 23px;
  }

  .author-portrait {
    width: min(378px, 100%);
    height: auto;
    aspect-ratio: 378 / 247;
  }

  .author-text {
    margin-top: 34px;
    font-size: 17px;
    line-height: 1.72;
  }
}

@media (max-width: 520px) {
  .photo-grid {
    display: block;
  }

  .photo-thumb {
    width: min(calc(var(--gallery-row-height) * var(--thumb-ratio, 1)), 100%);
    max-width: 100%;
    margin: 0 auto 9px;
  }

  .photo-thumb img {
    width: 100%;
    height: auto;
  }

  .gallery-pagination {
    flex-wrap: wrap;
  }
}
