/* ============================================
   PROJECT DETAIL PAGE - savage.design
   Individual portfolio item
   ============================================ */

/* Override full-screen lock from index.css */
html, body {
  height: auto !important;
  min-height: 100% !important;
  overflow: auto !important;
}

/* Scroll lock when lightbox is open */
html.lightbox-open,
html.lightbox-open body {
  overflow: hidden !important;
}

/* Container */
.project-container {
  position: relative;
  z-index: 2;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 100px 48px 80px;
  box-sizing: border-box;
}

/* Back button */
.project-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  text-decoration: none;
  font-size: 14px;
  height: auto;
  line-height: 1.5;
  padding: 8px 16px;
}

/* Hero image */
.project-hero {
  margin-bottom: 40px;
  border-radius: 0;
  overflow: hidden;
}

.project-hero--has-lightbox {
  position: relative;
}

.project-hero__image {
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.05);
}

/* Hero lightbox trigger overlay */
.project-hero__trigger {
  position: absolute;
  inset: 0;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1;
  display: block;
  padding: 0;
}

.project-hero__trigger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.project-hero__zoom-icon {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.project-hero__trigger:hover .project-hero__zoom-icon,
.project-hero__trigger:focus-visible .project-hero__zoom-icon {
  opacity: 1;
}

/* ============================================
   Project Content
   ============================================ */

.project-content__title {
  font-size: var(--h3-size);
  line-height: var(--h3-line-height);
  margin-bottom: 16px;
}

/* Category badges */
.project-content__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.badge-pill {
  padding: 5px 14px;
  background: rgba(255, 208, 0, 0.12);
  border: 1px solid rgba(255, 208, 0, 0.3);
  border-radius: 9999px;
  font-family: var(--font-secondary);
  font-size: 12px;
  font-weight: 300;
  color: var(--color-accent);
  text-transform: capitalize;
}

/* Meta row */
.project-content__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-family: var(--font-secondary);
  font-size: var(--p-sm-size);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
}

.meta-sep {
  opacity: 0.3;
}

/* Description */
.project-content__description {
  margin-bottom: 40px;
}

.project-content__description p {
  font-size: var(--p-size);
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.85);
}

/* Section titles */
.project-content__section-title {
  font-size: var(--h5-size);
  line-height: var(--h5-line-height);
  margin-bottom: 12px;
  color: var(--color-accent);
}

/* Technologies */
.project-content__tech {
  margin-bottom: 32px;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-tag {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-family: var(--font-secondary);
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.7);
}

/* Challenges & Solutions */
.project-content__challenges,
.project-content__solutions {
  margin-bottom: 32px;
}

.project-content__challenges p,
.project-content__solutions p {
  font-size: var(--p-size);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.75);
}

/* CTA */
.project-content__cta {
  margin: 40px 0;
  text-align: center;
}

/* ============================================
   Gallery
   ============================================ */

.project-content__gallery {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

/* Base gallery item (SSR state — plain <figure>) */
.gallery-item {
  display: block;
  margin: 0;
}

.gallery-item__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.03);
}

.gallery-item__caption {
  padding: 8px 12px;
  font-family: var(--font-secondary);
  font-size: 11px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
}

/* Interactive gallery item (JS-enhanced — <button>) */
.gallery-item--interactive {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-align: left;
  aspect-ratio: 16 / 9;
  transition: border-color 200ms ease, transform 200ms ease;
}

.gallery-item--interactive:hover {
  border-color: rgba(255, 208, 0, 0.3);
  transform: translateY(-2px);
}

.gallery-item--interactive .gallery-item__image {
  height: 100%;
  aspect-ratio: auto;
}

.gallery-item--interactive:hover .gallery-item__image {
  transform: scale(1.03);
  transition: transform 300ms ease;
}

.gallery-item--interactive:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.gallery-item--interactive .gallery-item__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 200ms ease;
}

.gallery-item--interactive:hover .gallery-item__caption {
  transform: translateY(0);
}

/* ============================================
   Lightbox
   ============================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox__content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 80px;
}

.lightbox__image-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}

.lightbox__picture {
  display: block;
}

.lightbox__image {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity 150ms ease;
}

.lightbox__image.is-loading {
  opacity: 0.3;
}

.lightbox__caption {
  margin-top: 12px;
  text-align: center;
  font-family: var(--font-secondary);
  font-size: var(--p-sm-size);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  max-width: 600px;
}

.lightbox__counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-secondary);
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.1em;
}

/* Lightbox nav buttons */
.lightbox__close,
.lightbox__prev,
.lightbox__next {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 200ms ease, border-color 200ms ease;
  padding: 0;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: black;
}

.lightbox__close:focus-visible,
.lightbox__prev:focus-visible,
.lightbox__next:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  line-height: 1;
}

.lightbox__prev {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
}

.lightbox__next {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
}

/* ============================================
   Related Projects
   ============================================ */

.project-content__related {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.related-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 200ms ease, border-color 200ms ease;
  text-decoration: none;
  display: block;
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 208, 0, 0.2);
}

.related-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.related-card__title {
  padding: 12px 16px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 800;
  color: var(--color-white);
}

/* ============================================
   Responsive - Tablet
   ============================================ */

@media (min-width: 800px) and (max-width: 1279px) {
  .project-container {
    padding: 90px 32px 60px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .lightbox__content {
    padding: 50px 60px;
  }
}

/* ============================================
   Responsive - Mobile
   ============================================ */

@media (max-width: 799px) {
  .project-container {
    padding: 80px 16px 40px;
  }

  .project-hero__image {
    max-height: 40vh;
  }

  .project-content__meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .gallery-item__caption {
    font-size: 10px;
    padding: 6px 8px;
  }

  .lightbox__content {
    padding: 60px 16px;
  }

  .lightbox__prev {
    left: 8px;
  }

  .lightbox__next {
    right: 8px;
  }

  .lightbox__image {
    max-height: calc(100vh - 140px);
  }

  .lightbox__close {
    top: 12px;
    right: 12px;
  }

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