@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');

:root {
  --main-bg-color: #ebecec;
  --main-color: #313a3d;
  --red-color: #a83b43;
  --blue-color: #4A7C9D;
  --gap-desktop: 10px;
  --gap-mobile: 6px;
  --main-radius: 10px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--main-bg-color);
  color: var(--main-color);
  padding: 10px 30px 100px;
  font-family: 'Nunito', Arial, Helvetica, sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
  font-weight: 300;
  letter-spacing: -0.03rem;
}

.site-header {
  display: grid;
  grid-template-columns: repeat(2, 528px);
  gap: 10px;
  width: 1066px;
  max-width: 100%;
  margin: 0 auto 10px;
}

.site-header__title,
.site-header__hero {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
}

.site-header__title {
  overflow: hidden;
}

.site-header__hero {
  cursor: url("../img/cursor.png"), auto;
}

.site-header__author {
  position: absolute;
  top: 0;
  left: 0;
  width: min(60%, 328px);
  height: auto;
}

.site-header__wordmark {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
}

.site-header__b-portfolio {
  display: block;
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  background: var(--red-color);
  border-radius: 10px 0 10px 20px;
  width: 57px;
  height: 57px;
  padding: 0;
  border: 0;
  cursor: pointer;
  transition: filter 1s ease;
}

.site-header__b-portfolio img {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(0, 0);
}

.site-header__b-portfolio:hover {
  filter: brightness(120%);
}

.site-header__b-portfolio:hover img {
  animation: portfolioArrowHover 1s ease-in-out;
}

@keyframes portfolioArrowHover {
  0%    { transform: translate(0, 0); }
  15%   { transform: translate(3px, -3px); }
  30%   { transform: translate(0, 0); }
  45%   { transform: translate(5px, -5px); }
  60%   { transform: translate(0, 0); }
  75%   { transform: translate(3px, -3px); }
  100%  { transform: translate(0, 0); }
}

.site-header__b-shuffle {
  display: block;
  position: absolute;
  z-index: 1;
  bottom: 0;
  right: 0;
  background: var(--blue-color);
  border-radius: 20px 10px 0 10px;
  width: 57px;
  height: 57px;
  padding: 0;
  border: 0;
  cursor: pointer;
  transition: filter 1s ease;
}

.site-header__b-shuffle img {
  position: absolute;
  bottom: 0;
  right: 0;
  transform: translate(0, 0);
}

.site-header__b-shuffle:hover {
  filter: brightness(120%);
}

.site-header__b-shuffle:hover img {
  animation: shuffleRotate 5s ease-in-out;
}

@keyframes shuffleRotate {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(0, 0) rotate(1800deg);
  }
}

.site-header__hero {
  overflow: hidden;
  border-radius: 0 var(--main-radius) var(--main-radius) 0;
}

.site-header__hero-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.site-header__hero-frame.is-active {
  opacity: 1;
}

main {
  width: 100%;
}



#gallery {
  position: relative;
  width: 0;
  margin: 0 auto;
  transition: height 180ms ease;
}

.gallery-item {
  position: absolute;
  display: block;
  overflow: hidden;
  border-radius: var(--main-radius);
  background: #fff;
  transition: transform 180ms ease, opacity 120ms ease;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 1s ease-out, filter 1s ease;
}

.gallery-item:hover img {
  filter: saturate(10%);
  transform: scale(1.5);
  transition: transform 10s ease-out, filter 5s ease;
}

.gallery-item--square img {
  object-fit: cover;
}

.gallery-item.is-reordering {
  opacity: 0;
}



.site-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(1604px, 100%);
  margin: 100px auto 0;
}

.site-footer__mark {
  display: block;
  width: 260px;
  height: auto;
}

.site-footer__mark img {
  width: 100%;
  height: auto;
}

.site-footer__line {
  margin-top: -6px;
  flex: 1;
  height: 2px;
  background: #BCBFC0;
}

.site-footer__b-portfolio {
  display: block;
  position: relative;
  width: 39px;
  height: 39px;
  border-radius: 5px 0 5px 15px;
  background: var(--red-color);
  margin-top: -4px;
  transition: filter 1s ease;
}

.site-footer__b-portfolio img {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  transform: translate(0, 0);
}

.site-footer__b-portfolio:hover {
  filter: brightness(120%);
}

.site-footer__b-portfolio:hover img {
  animation: portfolioArrowHover 1s ease-in-out;
}

@keyframes portfolioArrowHover {
  0%    { transform: translate(0, 0); }
  15%   { transform: translate(3px, -3px); }
  30%   { transform: translate(0, 0); }
  45%   { transform: translate(5px, -5px); }
  60%   { transform: translate(0, 0); }
  75%   { transform: translate(3px, -3px); }
  100%  { transform: translate(0, 0); }
}





@media (max-width: 1663px) {

  .site-footer {
    width: min(1335px, 100%);
  }

}

@media (min-width: 1395px) and (max-width: 1663px) {

  .site-header {
    margin-left: max(0px, calc((100% - 1335px) / 2));
    margin-right: 0;
  }

}

@media (max-width: 1394px) {

  .site-footer {
    width: min(1066px, 100%);
  }

}

@media (max-width: 1125px) {

  .site-header {
    width: min(796px, 100%);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    width: min(796px, 100%);
  }

}

@media (min-width: 856px) and (max-width: 1125px) {

  .site-header {
    margin-left: max(0px, calc((100% - 796px) / 2));
    margin-right: 0;
  }

}


@media (max-width: 855px) {

  body {
    padding-right: 15px;
    padding-left: 15px;
    padding-bottom: 15px;
  }

  .site-header {
    grid-template-columns: 1fr;
    width: min(490px, 100%);
    gap: 10px;
  }

  .site-header__hero {
    border-radius: 0 0 var(--main-radius) var(--main-radius);
  }

}

@media (max-width: 768px) {

  body {
    padding-right: 15px;
    padding-left: 15px;
    padding-bottom: 15px;
  }

  .site-header {
    margin-bottom: 10px;
  }

  .site-header__title {
    aspect-ratio: 1.25 / 1;
  }

  .site-header__hero {
    aspect-ratio: 2 / 1;
    border-radius: var(--main-radius) 0 var(--main-radius) var(--main-radius);
  }

  .site-header__hero-frame {
    width: 120%;
    object-fit: cover;
    object-position: center 86%;
    margin-left: -60px;
  }

  .site-header__b-portfolio,
  .site-header__b-shuffle {
    width: 44px;
    height: 44px;
  }

  .site-footer {
    margin-top: 50px;
    width: min(490px, 100%);
  }

  .site-footer__mark {
    width: 162px;
  }

  .site-footer__b-portfolio {
    width: 25px;
    height: 25px;
    border-radius: 5px 0 5px 10px;
  }

}

@media (max-width: 576px) {

  body {
    padding-right: 6px;
    padding-left: 6px;
    padding-bottom: 6px;
  }

  .site-header__b-portfolio,
  .site-header__b-shuffle {
    width: 35px;
    height: 35px;
  }

  .site-header__b-portfolio {
    border-radius: 8px 0 8px 16px;
  }

  .site-header__b-shuffle {
    border-radius: 16px 8px 0 8px;
  }

  .site-header__b-portfolio img {
    width: 115%;
    height: auto;
  }

  .site-header__b-shuffle img {
    width: 95%;
    height: auto;
  }

  .site-footer {
    margin-top: 30px;
  }

}




@media (prefers-reduced-motion: reduce) {

  #gallery, .gallery-item {
    transition: none;
  }

}

.gallery-item__caption {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 10px;
  top: 10px;
  box-sizing: border-box;
  color: #FFFFFF;
  font-family: 'Nunito', Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.15;
  text-align: center;
  text-shadow:
    0 1px 1px var(--main-color),
    0 0 0.6em var(--main-color);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 250ms ease,
  transform 250ms ease,
  visibility 0s linear 250ms;
}

.gallery-item__caption.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 500ms ease,
  transform 500ms ease,
  visibility 0s;
}

.gallery-item:hover .gallery-item__caption,
.gallery-item:focus-visible .gallery-item__caption {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 500ms ease, transform 500ms ease, visibility 0s;
}

@media (max-width: 768px) {

  .gallery-item__caption {
    font-size: 12px;
  }

}



body.is-photo-viewer-open {
  overflow: hidden;
}

.photo-viewer {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  background: rgba(235, 236, 236, 0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.photo-viewer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.25s ease;
}

.photo-viewer__swiper {
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.photo-viewer .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 20px;
}

.photo-viewer .swiper-slide img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100svh - 22px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-viewer .swiper-slide.is-zoomed {
  align-items: flex-start;
  overflow: auto;
}

.photo-viewer .swiper-slide.is-zoomed img {
  max-width: none;
  max-height: none;
}

.photo-viewer__close,
.photo-viewer__autoplay,
.photo-viewer__zoom,
.photo-viewer__nav {
  appearance: none;
  border: 0;
  color: var(--main-color);
  background: rgba(213, 214, 215, 0.5);
  font: inherit;
  cursor: pointer;
}

.photo-viewer__close:hover,
.photo-viewer__autoplay:hover,
.photo-viewer__zoom:hover,
.photo-viewer__nav:hover {
  background: rgba(213, 214, 215, 0.75);
}

.photo-viewer__close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.photo-viewer__toolbar {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--main-color);
  font-size: 14px;
}

.photo-viewer__caption {
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 16px;
}

.photo-viewer__position { font-variant-numeric: tabular-nums; }

.photo-viewer__autoplay {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 17px;
}

.photo-viewer__zoom {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 17px;
}

.photo-viewer__nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 0;
  transform: translateY(-50%);
}

.photo-viewer__nav::before { font-size: 30px; }
.photo-viewer__nav--prev { left: 18px; }
.photo-viewer__nav--next { right: 18px; }
.photo-viewer__nav--prev::before { content: '‹'; }
.photo-viewer__nav--next::before { content: '›'; }

.photo-viewer__close:focus-visible,
.photo-viewer__autoplay:focus-visible,
.photo-viewer__zoom:focus-visible,
.photo-viewer__nav:focus-visible {
  outline: 2px solid var(--main-color);
  outline-offset: 3px;
}

@media (min-width: 768px) {
  .photo-viewer .swiper-slide img { max-height: 90svh; }
}

@media (max-width: 767px) {
  .photo-viewer__nav { display: none; }
  .photo-viewer__zoom { display: none; }
  .photo-viewer__toolbar { font-size: 12px; }
  .photo-viewer__autoplay { padding-inline: 8px; }
}
