@import url('https://fonts.googleapis.com/css2?family=Old+Standard+TT:ital,wght@0,400;0,700;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@200..900&display=swap');

/* File: style.css */

/* Base typography and layout */

body {
  margin: 0;
  padding: 0;
  font-family: "Old Standard TT", 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 400;
  color: #4f57d3;
  line-height: 1em;
  text-decoration: none;
}

.container {
  max-width: 1800px;
  margin: 120px auto 40px;
  padding: 0 60px; 
  box-sizing: border-box;
}

.text-box p {
  text-align: justify;
  text-align-last: left;
}

.smaller {
  font-size: 12px;
}

a, a:link, a:visited {
  color: #4f57d3;  /* link normal color */
  text-decoration: none;
}

a:hover, a:active {
  color: #e1ff00;  /* link hover/active color */
  font-style: italic; /* link hover/active style */
}

/* Header navigation */
header {
  position: fixed;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 100px;
  flex-wrap: wrap; /* allow wrapping if needed */
  gap: 10px; /* add spacing when wrapping occurs */
  z-index: 999;
  box-sizing: border-box;
}

.site-title {
  margin-right: 20px;
  font-size: 18px;
  white-space: nowrap;
  flex-shrink: 0; /* prevent shrinking too small */
  background-color: white;
}

.nav {
  display: flex;
  gap: 40px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav-item {
  position: relative;
  cursor: pointer;
  font-size: 18px;
  line-height: 1.2em;
}

.nav a {
  background-color: white;
  width: max-content;
  white-space: nowrap; 
}

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-20%);
  padding: 10px;
  flex-direction: column;
  z-index: 999;
  box-sizing: border-box;
  text-align: left;
}

.dropdown a {
  background-color: #e1ff00;
  width: max-content; /* ✨ auto-fit to content width */
  white-space: nowrap; /* Prevent line breaks */
}

.nav-item:hover .dropdown {
  display: flex;
}

/* About page full background */
.about-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url('/images/aboutbg.gif');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  padding: 30px 20px;
  position: relative;
  animation: fadeInBackground 0.6s ease-in-out forwards;
  opacity: 0;
  box-sizing: border-box;
}

@keyframes fadeInBackground {
  to {
    opacity: 1;
  }
}

.about-page::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(254, 253, 253, 0.4);
  z-index: 0;
}

/* About content */
.about-content {
  max-width: 800px;
  width: 100%;
  position: relative;
  z-index: 2;
  padding: 20px;
  box-sizing: border-box;
}


/*Project list*/
.projectlist {
  position: relative; /* to anchor absolute elements inside */
}

.projectlist-items {
  list-style: none;
  padding: 0;
  margin: 0;
  width:100%;
  height:850px;
  max-width: 1200px;
}

.projectlist-item {
  position: absolute;
  transition: transform 0.5s ease;
  cursor: pointer;
}

.projectlist-item a {
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

/* Preview image styling */
.projectlist-preview {
  position: fixed; /* fix position relative to viewport */
  pointer-events: none; /* so it doesn’t block mouse events */
  top: 0;
  left: 0;
  width: 590px;
  height: 320px;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.project-detail {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  margin-bottom: 60px;
  min-height: 600px;
}

.project-text {
  flex: 3;
  position: sticky;
  top: 100px;
  align-self: flex-start;
  max-height: calc(100vh - 120px);
  overflow-y: scroll; /* or auto */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
  will-change: transform;
  flex-shrink: 0;
}

.project-text::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.project-text a {
  overflow-wrap: break-word;
}

.project-media {
  flex: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start; 
  justify-content: flex-start;
  min-width: 0;
}

.project-media .video-wrapper,
.project-media .slideshow {
  width: 100%;
  max-width: 1800px;
  margin-bottom: 20px;
}

.project-media iframe {
  aspect-ratio: 16 / 9;
  width: 100%;
  border: none;
  display: block;
}

.project-media img,
.project-media video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.project-media.visible img,
.project-media.visible video {
  opacity: 1;
  transform: translateY(0);
}

/* Commissions */
.commission-entry {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr; /* left | center | right */
  gap: 20px;
  border-top: 1px solid#4f57d3;
  padding-top: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.commission-entry .col {
  line-height: 1em;
}

.commission-entry .credit {
  text-align: right;
}

.commission-info {
  flex: 1;
}

.commission-info a {
  overflow-wrap: break-word;
} 

.commission-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 10px;
  padding: 10px 0;
  align-items: center;  
  justify-items: start; 
}

/* Base item */
.media-item {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.media-item.video-wrapper iframe,
.media-item.video-wrapper video {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: auto;
  border: 0;
}

/* 🔑 Optional modifiers for curated layout */
.media-item.small {
  grid-column: span 1/2; 
}

.media-item.wide {
  grid-column: span 2; /* spans 2 columns */
}
.media-item.full {
  grid-column: 1 / -1; /* spans full row */
}

/* grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  grid-gap: 50px;
  align-items: center;
  justify-content: center;
}

.grid figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.grid img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.5s ease;
  min-width: 250px;
  max-width: 1200px;
}

.grid figcaption {
  margin-top: 8px;
  font-size: 12px;
  text-align: center;
}

/* Fade in animation */
[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
  will-change: opacity, transform;
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

/**Site footer*/

body::after {
    content: "© XU YUJIE 2025";
    position: fixed; 
    bottom: 0; 
    left: 50%;
    transform: translateX(-50%); 
    text-align: center; 
    font-size: 10px; 
    padding: 10px 20px; 
    width: auto; 
    box-sizing: border-box;
    z-index: 999;
    mix-blend-mode: color-dodge;
}


/* Responsive Design */

@media (max-width: 900px) {
  .project-detail {
    flex-direction: column;
  }

  .project-text,
  .project-media {
    width: 100%;
  }

  .project-media {
    align-items: center;
  }
}


/* Extra Large Screens (Desktops, ≥1800px) */
@media (min-width: 1800px) {
  .container {
    max-width: 1800px;
    padding: 0 80px;
  }

  header {
    padding: 20px 180px;
  }
}

/* Medium Screens (Tablets, 900px–1200px) */
@media (max-width: 1200px) {
  .container {
    padding: 0 40px;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
  }

  .commission-entry {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .commission-info {
    width: 100%;
    font-size: 13px;
    margin-bottom: 20px;
  }

  .commission-media {
    width: 100%;
    justify-content: center;
  }

  .commission-media img,
  .commission-media video,
  .commission-media iframe {
    max-width: 100%;
  }
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
    grid-gap: 30px;
  }

  .project-detail {
    flex-direction: column;
  }

  .project-text,
  .project-media {
    width: 100%;
  }

   header {
    padding: 16px 25px;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .site-title {
    font-size: 16px;
  }

  .nav {
    flex-wrap: wrap;
    gap: 16px;
  }

  .nav-item,
  .nav-item a {
    font-size: 18px;
  }

  .about-content {
    font-size: 13px;
  }

  .commission-entry {
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 13px;
  }

  .commission-info {
    width: 100%;
    margin-bottom: 20px;
    padding: 0 10px;
  }

  .commission-media {
    width: 100%;
    justify-content: center;
    min-height: 240px;
  }

  .commission-media iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* Extra Small Screens (Phones, <600px) */
@media (max-width: 600px) {
  .header {
    padding: 16px 20px;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .container {
    padding: 0 20px; /* smaller padding on mobile */
  }

  .about-content {
    padding-left: 0;
    padding-right: 0;
    font-size: 12px;
  }

  .site-title {
    margin-right: 20px;
    font-size: 15px;
  }

  .grid {
    grid-template-columns: 1fr;
    grid-gap: 20px;
  }

  .grid img {
    min-width: 100%;
    max-width: 100%;
  }

  .project-text {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
  }

  .project-media iframe {
    height: auto;
    aspect-ratio: 16/9;
  }

  .commission-info {
    font-size: 12px;
    padding: 0 10px;
  }

  .commission-media {
    grid-template-columns: 1fr;
    min-height: 200px;
  }

  .commission-media iframe {
    width: 100%;
    min-height: 360px;
    aspect-ratio: 16 / 9;
  }
}

/* Smallest Screens (≤480px) */
@media (max-width: 480px) {
  .dropdown {
    left: 0;
    transform: none;
    width: 100vw;
    max-width: none;
    padding: 10px 0;
  }

   .nav {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
  }
  .nav-item {
    width: 100%;
  }

  .dropdown a {
    display: block;
    padding: 8px 12px;
  }

    .commission-info {
    font-size: 10px;
    padding: 0 10px;
  }

  .commission-media {
    min-height: 180px;
  }

  .commission-media iframe {
    width: 100%;
    min-height: 360px;
    aspect-ratio: 16 / 9;
  }
}

/* Hide slideshow on larger screens */
.mobile-slideshow-section {
  display: none;
}

@media (max-width: 768px) {
  .mobile-slideshow {
    position: relative;
    height: 100vh;
    width: 72%;
    padding: 30px 20px;
    margin: 0 auto;
  }

  .slide {
    aspect-ratio: 3 / 4;
    overflow: hidden;
    display: none; /* hide all by default */
  }

  .slide.active {
    display: block; /* only show the active one */
  }

  .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .mobile-slideshow img.active {
    opacity: 1;
    z-index: 1;
  }
}


/* Default: show desktop project list, hide mobile slideshow */
.desktop-projectlist {
  display: block;
}

/* On mobile screens: hide desktop, show mobile */
@media screen and (max-width: 768px) {
  .desktop-projectlist {
    display: none;
  }
  .mobile-slideshow-section {
    display: block;
  }
}

/* Default hamburger hidden */
.hamburger {
  display: none;
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 1001;
  color: #4f57d3; /* <-- updated color */
}

.mobile-nav {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  line-height: 1em;
  background-color: rgba(255, 255, 255, 0.73);
  backdrop-filter: blur(10px);
  padding: 80px 20px 20px;
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 1000;
  -webkit-tap-highlight-color: transparent;
}

/* Open state */
.mobile-nav.open {
  display: flex;
}

ul {
  list-style-type: none;
}

.mobile-nav li a {
  font-size: 14px;
  overflow: break-word;
}

/* NAV ITEM general */
.mobile-nav .nav-item {
  width: 100%;
  text-align: left;
  margin-bottom: 15px;
  margin-left: 35px;
}

.mobile-nav a {
  font-size: 18px;
}

/* Responsive toggle */
@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  nav:not(.mobile-nav) {
    display: none;
  }
}
