/* ---------------- GLOBAL ---------------- */

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
}

/* ---------------- HEADER ---------------- */

header {
  height: 100vh;
  background-image: url("Images/john_background.jpg");
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

header h1 {
  font-weight: 700;
  color: white;
  font-size: clamp(40px, 15.5vw, 220px);
  margin-top: 0;
  margin-left: -1.5%;
  letter-spacing: 0px;
  white-space: nowrap;
  overflow: visible;
  transition: letter-spacing 0.1s linear, opacity 0.2s ease;
}

header h1 .line {
  display: block;
  white-space: nowrap;
}

/* ---------------- NAV BAR ---------------- */

.nav {
  position: absolute;
  bottom: 30px;
  left: 30px;
  right: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-left {
  display: flex;
  gap: 40px;
}

.nav a {
  font-weight: 400;
  font-size: 20pt;
  color: white;
  text-decoration: none;
  position: relative;
  letter-spacing: 0;
  transition: letter-spacing 0.25s ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background-color: white;
  transition: width 0.25s ease;
}

.nav a:hover {
  letter-spacing: 5px;
}

.nav a:hover::after {
  width: 100%;
}

.year {
  font-weight: 300;
  font-size: 12pt;
  color: white;
}

/* ---------------- WORK SECTION ---------------- */

#work_section {
  background-color: #fcf5fa;
  display: flex;
  gap: 40px;
  padding: 80px 40px;
  box-sizing: border-box;
  width: 100%;

  /* sticky reliability */
  overflow: visible;
}

/* Sticky labels */
.work-labels {
  /* stable fixed-ish width so gallery can grow */
  flex: 0 0 220px;
  width: 220px;

  position: sticky;
  top: 100px;
  height: fit-content;
  align-self: flex-start;
}

.work-labels ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.work-labels li {
  font-size: 12pt;
  font-weight: 300;
  color: #3d3725;
  margin-bottom: 16px;
  cursor: pointer;
  transition: opacity 0.25s ease, font-weight 0.25s ease;
}

.work-labels li a {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Gallery fills remaining width */
.work-gallery {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0px;
}

.work-item {
  display: block; /* important if .work-item is an <a> */
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;

  opacity: 0;
  transform: translateX(40px);
  transition: transform 0.55s ease, opacity 0.95s ease;
}

/* Ensure images always fill their tile cleanly */
.work-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.45s ease;
}

.work-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.work-item.is-active img {
  opacity: 0.6;
}

.work-labels li.is-active {
  font-weight: 500;
  opacity: 1;
}

.work-labels li.is-dimmed {
  opacity: 0.5;
}

.work-labels li:hover {
  font-weight: 500;
}

/* ================= MOBILE WORK SECTION FIX ================= */

/* Overlay label pulled from data-title="" on each .work-item */
.work-item::after {
  content: attr(data-title);
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;

  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.2;

  background: rgba(0, 0, 0, 0.65);
  color: white;
  border-radius: 10px;

  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;

  pointer-events: none;
}

/* Desktop hover shows label */
.work-item:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------- ABOUT SECTION ---------------- */

#about_section {
  background-color: #fcf5fa;
  padding: 120px 80px;
  transition: background-color 0.5s ease;
}

.about-container {
  display: flex;
  gap: 80px;
  align-items: center;
}

.about-image {
  width: 40%;
  opacity: 0;
  transform: translateX(-40px);
  transition: transform 0.35s ease, opacity 0.45s ease;
}

.about-image img {
  width: 100%;
  height: auto;
  display: block;
}

.about-text {
  width: 60%;
  color: white;
  font-weight: 400;
  font-size: 18px;
  text-align: right;
}

.about-email {
  margin-top: 60px;
  font-weight: 600;
  font-size: clamp(20px, 5vw, 70px);
  color: white;
  text-align: center;
}

#about_section.active {
  background-color: #391df2;
}

#about_section.active .about-image {
  opacity: 1;
  transform: translateX(0);
}

/* ---------------- PROJECT PAGE ---------------- */

body.project-page {
  background-color: white;
}

.project-header {
  height: 50px;
  position: relative;
}

/* ================= CLOSE (X) BUTTON — SIMPLIFIED ================= */

.close-btn {
  position: fixed;
  top: 20px;
  right: 20px;

  font-size: 28px;
  line-height: 1;
  text-decoration: none;
  color: black;

  z-index: 10000;
  cursor: pointer;

  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: rotate(90deg);
}

/* ---------------- PROJECT CONTENT ---------------- */

.project-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding-bottom: 80px;
  padding-left: 5%;
  padding-right: 5%;
}

/* Hero image at the top */
.hero-image {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 40px auto;
}

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

/* Portrait grid for the rest of the images */
.portrait-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 80px auto;
}

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

.project-content img,
.video-wrapper,
.project-gif {
  width: 100%;
  max-width: none;
}

.project-intro {
  max-width: 900px;
  margin: 0 auto 3rem auto;
}

.project-title {
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.project-meta {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 1.5rem;
}

.project-description {
  line-height: 1.6;
  max-width: 700px;
}

/* Video wrapper */
.video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* GIF */
.project-gif {
  width: 100%;
  height: auto;
  display: block;
}

/* PDF wrapper to match project content */
.pdf-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 40px auto;
  aspect-ratio: 16/9;
}

.pdf-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Full-width PDF styling */
.pdf-fullwidth {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  height: 1000px;
}

.pdf-fullwidth iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ---------------- PAGE TRANSITIONS ---------------- */

.page {
  min-height: 100vh;
  transform-origin: center;
  opacity: 0;
}

.page.is-entering {
  animation: pageEnter 0.8s cubic-bezier(.25,.8,.25,1) forwards;
}

.page.is-exiting-up {
  animation: pageExitUp 0.6s ease forwards;
}

.page.is-exiting-down {
  animation: pageExitDown 0.6s ease forwards;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(60px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pageExitUp {
  to { opacity: 0; transform: scale(0.96); filter: blur(2px); }
}

@keyframes pageExitDown {
  to { opacity: 0; transform: translateY(80px) scale(0.98); filter: blur(2px); }
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 900px) {
  /* hide left labels on mobile */
  .work-labels {
    display: none;
  }

  .work-gallery {
    width: 100%;
    grid-template-columns: 1fr;
  }

  #work_section {
    padding: 40px 20px;
  }

  /* Make tiles taller on mobile */
  .work-item {
    aspect-ratio: 4 / 5;

    /* IMPORTANT: don't depend on animation on mobile */
    opacity: 1 !important;
    transform: none !important;
  }

  /* Always show overlay label on mobile */
  .work-item::after {
    opacity: 1;
    transform: none;
  }

  .about-container {
    flex-direction: column;
    text-align: center;
  }

  .about-text {
    text-align: center;
    width: 100%;
  }

  .about-image {
    width: 100%;
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 600px) {
  #work_section {
    padding: 40px 20px;
  }
  #about_section {
    padding: 50px 3%;
  }
  .about-text {
  width: 95%;
  color:white;
  font-size: 16px;
  text-align: left;
}
.nav a {
  font-size: 16pt;
}
header {
  height: 60vh;
}
header h1{
  text-align:center;
}
}

@media (min-width:1500px) {
  .work-gallery{
    margin-right:10%;
  }
  .about-text {
  font-size: 25px;
}
#about_section {
    padding: 50px 10%;
  }
}