/* ============================================================
   MERLEX HOMES — project.css
   merlexhomes.com/projects/

   PURPOSE: Styles exclusive to project detail pages.
   All shared styles (nav, footer, typography, variables,
   reset) are inherited from the parent stylesheet via the
   <link> tag in each project HTML file.

   IMPORTANT: This file does NOT redefine:
   - CSS custom properties (:root variables)
   - CSS reset
   - Navigation styles
   - Footer styles
   - Shared typography (.h1, .h2, .label, etc.)
   Those all live in ../style.css which is already linked.

   This file ONLY contains:
   1. Project header (title + tags)
   2. Main photo viewer (full-bleed + arrows)
   3. Thumbnail gallery (rail + controls)
   4. Next Project section
   5. Lightbox overlay
   6. Project-specific responsive overrides
   ============================================================ */


/* ── Link parent stylesheet — do not remove ── */
/* Note: Each project HTML file links ../style.css first,
   then this file second, so all shared tokens are available */


/* ============================================================
   1. PROJECT HEADER
   Contains the back link, project title, and tag pills.
   ============================================================ */
.proj-header {
  padding-top: calc(var(--nav-h) + 40px); /* clear the fixed nav */
  padding-bottom: 36px;
  padding-left: var(--pad);
  padding-right: var(--pad);
  border-bottom: 1px solid var(--rule);
}

/* "← Portfolio" back link */
.proj-back {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
  margin-bottom: 20px;
}
.proj-back:hover { color: var(--green); }

/* Project name headline */
.proj-title {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 200;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--green);
  line-height: 1.05;
  margin-bottom: 20px;
}

/* Tag pills row (type, location, size) */
.proj-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Individual tag pill — dark green background, white text */
.proj-tag {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--green);
  border: 1px solid var(--green);
  padding: 6px 16px;
  border-radius: 2px;
}


/* ============================================================
   2. MAIN PHOTO VIEWER
   Full-width photo with previous/next arrows overlaid.
   ============================================================ */

/* Container — clips arrows and photo to page width */
.proj-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--warmer);
  cursor: default;
}

/* The main displayed photo */
.proj-main-img {
  width: 100%;
  height: 80vh;
  min-height: 520px;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease; /* smooth fade when switching photos */
}

/* Photo counter badge (e.g. "2 / 8") — bottom right */
.proj-counter {
  position: absolute;
  bottom: 20px;
  right: 28px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(14, 35, 24, 0.5);
  padding: 5px 14px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Previous / Next arrow buttons overlaid on the photo */
.proj-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--white);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  transition: background 0.25s, border-color 0.25s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.proj-arrow:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.9);
}
.proj-arrow-prev { left: 28px; }
.proj-arrow-next { right: 28px; }

/* Hidden element — zoom hint disabled */
.proj-zoom-hint { display: none; }


/* ============================================================
   3. THUMBNAIL GALLERY
   White background strip with scrollable photo thumbnails.
   The strip uses two layers:
     .proj-rail-viewport — the fixed visible window (overflow hidden)
     .proj-rail         — the inner scrolling track (transform moves it)
   ============================================================ */
.proj-gallery {
  background: var(--white);
  padding: 40px var(--pad) 96px; /* generous bottom space before Next Project */
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* Outer flex row: [left arrow] [viewport] [right arrow] */
.proj-rail-outer {
  display: flex;
  align-items: stretch;
}

/* Left / Right scroll buttons — anchored outside the photo strip */
.proj-rail-btn {
  flex-shrink: 0;
  width: 52px;
  background: var(--white);
  border: none;
  border-right: 1px solid var(--rule);
  color: var(--muted);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  z-index: 2;
  position: relative;
}
.proj-rail-btn:last-child {
  border-right: none;
  border-left: 1px solid var(--rule);
}
.proj-rail-btn:hover {
  color: var(--green);
  background: var(--warm); /* subtle warm tint — not a full green fill */
}
/* Dimmed when at the start or end of the rail */
.proj-rail-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: default;
}

/* Fixed clipping window — photos cannot bleed over the arrows */
.proj-rail-viewport {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* Scrolling inner track — JavaScript applies translateX() to scroll */
.proj-rail {
  display: flex;
  gap: 0;
  width: 100%;
  will-change: transform; /* hint to browser to use GPU for smooth scroll */
}

/* Individual thumbnail — 1/6 of the rail width, 3:2 aspect ratio */
.proj-thumb {
  flex-shrink: 0;
  width: calc(100% / 6);
  aspect-ratio: 3/2;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border-right: 1px solid var(--rule);
}
.proj-thumb:last-child { border-right: none; }

.proj-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);      /* dimmed when inactive */
  transition: filter 0.3s, transform 0.5s;
}
.proj-thumb:hover img { filter: brightness(0.85); transform: scale(1.06); }
.proj-thumb.active img { filter: brightness(1); }  /* full brightness when selected */

/* Gold bar underline on the active thumbnail */
.proj-thumb.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold);
}


/* ============================================================
   4. NEXT PROJECT SECTION
   Split layout: photo left, title + link right.
   ============================================================ */
.next-project {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--rule);
  text-decoration: none;
}

/* Photo side */
.next-project-img { overflow: hidden; height: 400px; }
.next-project-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.85);
  transition: transform 0.8s ease, filter 0.5s;
}
.next-project:hover .next-project-img img {
  transform: scale(1.04);
  filter: brightness(1);
}

/* Text side */
.next-project-content {
  padding: 72px var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--warm);
  border-left: 1px solid var(--rule);
}
.next-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}
.next-title {
  font-family: var(--display);
  font-size: clamp(24px, 2.8vw, 42px);
  font-weight: 200;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--green);
  margin-bottom: 28px;
  line-height: 1.1;
}
.next-cta {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap 0.2s, border-color 0.2s;
}
.next-project:hover .next-cta { gap: 14px; border-color: var(--green); }


/* ============================================================
   5. LIGHTBOX OVERLAY
   Full-screen dark overlay for zoomed photo viewing.
   Keyboard nav (← → Escape) is handled in JS.
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 9, 0.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.lightbox.active { opacity: 1; pointer-events: all; }
.lightbox-img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  transform: scale(0.97);
  transition: transform 0.3s;
}
.lightbox.active .lightbox-img { transform: scale(1); }
.lightbox-close {
  position: fixed;
  top: 22px;
  right: 30px;
  font-size: 26px;
  color: rgba(255, 255, 255, 0.55);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 200;
  font-family: var(--display);
  transition: color 0.2s;
  line-height: 1;
  padding: 6px;
}
.lightbox-close:hover { color: var(--white); }
.lightbox-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 18px 22px;
  transition: all 0.22s;
}
.lightbox-btn:hover { color: var(--white); border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.1); }
#lbPrev { left: 20px; }
#lbNext { right: 20px; }
.lightbox-counter {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}


/* ============================================================
   6. RESPONSIVE OVERRIDES
   Only project-specific breakpoints.
   Nav/footer responsive rules live in ../style.css.
   ============================================================ */

/* ── Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .proj-header { flex-direction: column; align-items: flex-start; padding-top: calc(var(--nav-h) + 24px); }
  .proj-main-img { height: 55vw; min-height: 280px; }
  .proj-arrow { width: 44px; height: 44px; }
  .proj-arrow-prev { left: 14px; }
  .proj-arrow-next { right: 14px; }
  .proj-gallery { padding: 28px var(--pad) 32px; }
  .proj-thumb { width: calc((100% - 30px) / 4); } /* show 4 thumbs on tablet */
  .next-project { grid-template-columns: 1fr; }
  .next-project-img { height: 260px; }
  .next-project-content { border-left: none; border-top: 1px solid var(--rule); padding: 48px var(--pad); }
}

/* ── Mobile (≤ 540px) ── */
@media (max-width: 540px) {
  .proj-thumb { width: calc((100% - 20px) / 3); } /* show 3 thumbs on mobile */
}
