
/* =========================
   WORK CATEGORY PAGES
========================= */

.work-detail {
    min-height: 75vh;
    padding: 110px 8% 90px;
}


/* =========================
   BACK TO WORK LINK
========================= */

.back-link {
    display: inline-block;
    margin-bottom: 55px;
    color: inherit;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.7;
}

.back-link:hover {
    opacity: 1;
}


/* =========================
   PAGE HEADING
========================= */

.work-hero {
    text-align: center;
    margin-bottom: 70px;
}

.work-hero h1 {
    font-size: clamp(38px, 5vw, 68px);
    font-weight: 500;
    line-height: 1.1;
    margin: 0 0 18px;
}

.work-hero p {
    font-size: 16px;
    line-height: 1.6;
    color: #777;
    margin: 0;
}


/* =========================
   GENERAL PROJECT GALLERY
========================= */

.work-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.work-gallery img {
    display: block;
    width: 100%;
    height: auto;
}

.empty-projects {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 260px;
    background: #f7f7f7;
    color: #888;
    text-align: center;
    padding: 24px;
}


/* =========================
   DROPDOWN MENU
========================= */

.dropdown.open .dropdown-content {
    display: block;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}


/* =========================
   CONCEPT ART PHOTO GRID
========================= */

.gallery-tile {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: none;
    overflow: hidden;
    background: #f0f0f0;
    cursor: url("images/hover-piggy-cursor.png?v=2") 64 64, pointer;
    text-align: left;
}

.gallery-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-tile:hover img {
    transform: scale(1.05);
}

.gallery-tile:focus-visible {
    outline: 3px solid #555;
    outline-offset: 3px;
}

.gallery-tile span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px 16px 12px;
    color: white;
    font-size: 14px;
    background: linear-gradient(
        transparent,
        rgba(0, 0, 0, 0.6)
    );
}


/* =========================
   ENLARGED IMAGE VIEWER
========================= */

.image-lightbox {
    border: none;
    padding: 40px;
    max-width: 96vw;
    max-height: 96vh;
    background: transparent;
    overflow: visible;
    text-align: center;
}

.image-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.88);
}

.image-lightbox img {
    display: block;
    max-width: min(1200px, 85vw);
    max-height: 82vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    border: none;
    background: transparent;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: url("images/hover-piggy-cursor.png?v=2") 64 64, pointer;
}


/* =========================
   STORYBOARD TITLE
========================= */

.work-gallery.storyboard-gallery > .storyboard-title {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
    justify-self: center;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1.12;
    font-weight: 500;
    color: #444;
    margin: 0;
    text-wrap: balance;
}
.work-gallery.storyboard-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
}

/* Same size for video and slides */

.storyboard-gallery .embed-wrapper {
    width: 100%;
    max-width: none;
    aspect-ratio: 16 / 9;
}

/* Make iframe fill its container */

.storyboard-gallery .embed-wrapper iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}


/* =========================
   MOBILE RESPONSIVE
========================= */

@media (max-width: 768px) {

    .work-detail {
        padding: 80px 5% 60px;
    }

    .back-link {
        margin-bottom: 40px;
    }

    .work-hero {
        margin-bottom: 45px;
    }

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

    .work-gallery.storyboard-gallery {
               grid-template-columns: 1fr;
        gap: 30px;
    }

    .storyboard-gallery .embed-wrapper {
        width: 100%;
    }

    .image-lightbox {
        padding: 30px 10px;
    }

    .image-lightbox img {
        max-width: 90vw;
        max-height: 80vh;
    }
}

/* Full-width portfolio artwork: one image per row, without crops or overlays */
.work-gallery:not(.storyboard-gallery) {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
}

.work-gallery:not(.storyboard-gallery) .gallery-tile {
    width: 100%;
    aspect-ratio: auto;
    overflow: visible;
    background: transparent;
}

.work-gallery:not(.storyboard-gallery) .gallery-tile img {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: none;
}

.work-gallery:not(.storyboard-gallery) .gallery-tile:hover img {
    transform: none;
}

.work-gallery:not(.storyboard-gallery) .gallery-tile span {
    display: none;
    background: none;
}

/* In-page enlarged image viewer */
.portfolio-lightbox {
  padding: 0;
  border: 0;
  max-width: 96vw;
  max-height: 96vh;
  overflow: visible;
  background: transparent;
  color: #fff;
}
.portfolio-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.88);
}
.portfolio-lightbox img {
  display: block;
  max-width: 94vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 12px 50px rgba(0,0,0,.35);
}
.portfolio-lightbox-close {
  position: absolute;
  top: -20px;
  right: -14px;
  z-index: 2;
  background: #222;
  border: 1px solid #777;
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 27px;
  cursor: url("images/hover-piggy-cursor.png?v=2") 64 64, pointer;
}

/* Storyboard video and slides side-by-side on desktop */
.work-gallery.storyboard-gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: none;
  gap: 30px;
  margin-bottom: 32px;
}
.work-gallery.storyboard-gallery .embed-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.work-gallery.storyboard-gallery .storyboard-title {
  text-align: center;
  margin: 0 0 8px;
}
.animation-video {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.animation-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Keep both storyboard embeds readable on narrower screens. */
@media (max-width: 768px) {
  .work-gallery.storyboard-gallery {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Explicit viewport centering: the site-wide reset removes dialog margins. */
.portfolio-lightbox[open] {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  width: max-content;
  height: max-content;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
}
.portfolio-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100dvh - 48px);
  object-fit: contain;
}
.portfolio-lightbox-close {
  top: 8px;
  right: 8px;
}

/* Space multiple animation videos consistently. */
.animation-video + .animation-video {
  margin-top: 32px;
}

/* Label the lead video in the animation section. */
.animation-section-title {
  text-align: center;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 500;
  margin: 0 0 24px;
}

/* Santa intro artwork at the top of the backgrounds page */
.work-gallery .background-intro-image {
    grid-column: 1 / -1;
    width: 100%;
    height: auto;
    object-fit: contain;
}
