/* ==================================================
   1. PORTFOLIO PAGE
================================================== */

body.portfolio-page {
  position: relative;

  width: 100%;

  min-height: 100vh;
  min-height: 100svh;

  margin: 0;

  overflow-x: hidden;
  overflow-y: auto;

  background-image:
    url("assets/portfolio_background.png");

  background-size: cover;

  background-position:
    center center;

  background-repeat:
    no-repeat;

  background-attachment:
    fixed;
}


/* ==================================================
   2. PORTFOLIO CONTENT
================================================== */

.portfolio-content {
  position: relative;

  width: 100%;

  min-height: 100vh;
  min-height: 100svh;

  padding:
    22vh
    0
    12vh;

  z-index: 1;
}


/* ==================================================
   3. HOME BUTTON
================================================== */

.portfolio-home-button {
  position: fixed;

  top: 8px;
  left: 20px;

  z-index: 100;

  display: block;

  width: 130px;

  text-decoration: none;
}


.portfolio-home-button img {
  display: block;

  width: 100%;
  height: auto;

  object-fit: contain;

  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;

  transform: scale(1);

  transition:
    transform 150ms ease;
}


.portfolio-home-button:hover img {
  transform: scale(1.04);
}


.portfolio-home-button:active img {
  transform: scale(0.97);
}


/* ==================================================
   4. JUSTIFIED GALLERY
   电脑 / 平板使用
================================================== */

.portfolio-gallery {
  position: relative;

  width: 66vw;

  max-width: 1280px;

  margin:
    0
    auto;

  display: flex;

  flex-wrap: wrap;

  align-content: flex-start;

  gap: 14px;

  z-index: 10;
}


/* ==================================================
   5. PORTFOLIO ITEM
================================================== */

.portfolio-item {
  position: relative;

  display: block;

  flex-grow: 1;

  height: 210px;

  min-width: 80px;

  padding: 0;
  margin: 0;

  border: 0;

  overflow: hidden;

  background: transparent;

  appearance: none;
  -webkit-appearance: none;

  border-radius: 12px;
}


/* ==================================================
   6. PORTFOLIO IMAGE
================================================== */

.portfolio-item img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  object-position:
    center center;

  border-radius: 12px;

  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;

  transform: scale(1);

  opacity: 1;

  transition:
    transform 180ms ease,
    opacity 180ms ease;
}


.portfolio-item:hover img {
  transform: scale(1.025);
}


.portfolio-item:active img {
  transform: scale(0.985);
}


/* ==================================================
   7. LIGHTBOX BACKGROUND
================================================== */

.portfolio-lightbox {
  position: fixed;

  inset: 0;

  z-index: 1000;

  display: flex;

  align-items: center;
  justify-content: center;

  width: 100vw;

  height: 100vh;
  height: 100svh;

  padding:
    4vh
    7vw;

  background:
    rgba(
      255,
      255,
      255,
      0.94
    );

  opacity: 0;

  visibility: hidden;

  pointer-events: none;

  transition:
    opacity 220ms ease,
    visibility 220ms ease;
}


.portfolio-lightbox.is-open {
  opacity: 1;

  visibility: visible;

  pointer-events: auto;
}


/* ==================================================
   8. LIGHTBOX IMAGE
================================================== */

.portfolio-lightbox-image {
  display: block;

  width: auto;
  height: auto;

  max-width: 86vw;

  max-height: 92vh;
  max-height: 92svh;

  object-fit: contain;

  object-position:
    center center;

  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}


/* ==================================================
   9. LIGHTBOX CLOSE BUTTON
================================================== */

.portfolio-lightbox-close {
  position: fixed;

  top: 18px;
  right: 22px;

  z-index: 1010;

  width: 50px;
  height: 50px;

  padding: 0;
  margin: 0;

  border: 0;

  background: transparent;

  color: #FFB1FC;

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  font-size: 46px;

  font-weight: 300;

  line-height: 50px;

  text-align: center;

  appearance: none;
  -webkit-appearance: none;

  transform: scale(1);

  transition:
    transform 150ms ease;
}


.portfolio-lightbox-close:hover {
  transform: scale(1.12);
}


.portfolio-lightbox-close:active {
  transform: scale(0.92);
}


/* ==================================================
   10. LIGHTBOX LEFT / RIGHT
================================================== */

.portfolio-lightbox-nav {
  position: fixed;

  top: 50%;

  z-index: 1010;

  width: 62px;
  height: 62px;

  padding: 0;
  margin: 0;

  border: 0;

  background: transparent;

  color: #FFB1FC;

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  font-size: 64px;

  font-weight: 300;

  line-height: 62px;

  text-align: center;

  appearance: none;
  -webkit-appearance: none;

  transform:
    translateY(-50%)
    scale(1);

  transition:
    transform 150ms ease,
    opacity 150ms ease;
}


.portfolio-lightbox-prev {
  left: 18px;
}


.portfolio-lightbox-next {
  right: 18px;
}


.portfolio-lightbox-nav:hover {
  transform:
    translateY(-50%)
    scale(1.12);
}


.portfolio-lightbox-nav:active {
  transform:
    translateY(-50%)
    scale(0.92);
}


/* ==================================================
   11. TABLET
================================================== */

@media (max-width: 900px) {

  .portfolio-content {
    padding-top: 18vh;
  }


  .portfolio-gallery {
    width: 76vw;

    gap: 12px;
  }


  .portfolio-item {
    height: 185px;
  }


  .portfolio-lightbox-image {
    max-width: 82vw;
  }

}


/* ==================================================
   12. MOBILE
   两列排版
================================================== */

@media (max-width: 600px) {

  body.portfolio-page {
    background-attachment: scroll;
  }


  .portfolio-content {
    padding:
      14vh
      0
      8vh;
  }


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

  .portfolio-home-button {
    top: 6px;
    left: 14px;

    width: 95px;
  }


  /* --------------------------------------------------
     Mobile Gallery
     两列网格
  -------------------------------------------------- */

  .portfolio-gallery {
    width: 90vw;

    max-width: none;

    margin:
      0
      auto;

    display: grid;

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    align-items: start;

    gap:
      10px
      10px;
  }


  /* --------------------------------------------------
     Mobile Item
     取消电脑端 Justified 尺寸
  -------------------------------------------------- */

  .portfolio-item {
    display: block;

    width: 100%;

    height: auto;

    min-width: 0;

    padding: 0;
    margin: 0;

    overflow: hidden;

    border-radius: 10px;

    background: transparent;

    flex: none !important;
  }


  /* --------------------------------------------------
     Mobile Image
     保持图片原始比例
  -------------------------------------------------- */

  .portfolio-item img {
    display: block;

    width: 100%;
    height: auto;

    object-fit: contain;

    object-position:
      center center;

    border-radius: 10px;
  }


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

  .portfolio-lightbox {
    padding:
      3vh
      12vw;
  }


  .portfolio-lightbox-image {
    max-width: 86vw;

    max-height: 88vh;
    max-height: 88svh;
  }


  /* --------------------------------------------------
     Close
  -------------------------------------------------- */

  .portfolio-lightbox-close {
    top: 10px;
    right: 10px;

    width: 44px;
    height: 44px;

    font-size: 40px;

    line-height: 44px;
  }


  /* --------------------------------------------------
     Left / Right arrows
  -------------------------------------------------- */

  .portfolio-lightbox-nav {
    width: 44px;
    height: 44px;

    font-size: 46px;

    line-height: 44px;
  }


  .portfolio-lightbox-prev {
    left: 8px;
  }


  .portfolio-lightbox-next {
    right: 8px;
  }

}


/* ==================================================
   13. REDUCED MOTION
================================================== */

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

  .portfolio-home-button img,
  .portfolio-item img,
  .portfolio-lightbox,
  .portfolio-lightbox-close,
  .portfolio-lightbox-nav {
    transition: none;
  }

}