/* ─── Reset ─── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── Scrollbar stability ─── */
html { overflow-y: scroll; }

/* ─── Body base ─── */
body {
  font-family: 'Avenir', 'Avenir Next', 'Nunito Sans', -apple-system, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Logo base ─── */
.logo {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.3s;
}

/* ─── Grid animations ─── */
@keyframes gridFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes itemSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Image placeholder outline ─── */
.grid-item::before {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: 1;
  border: 2px dashed #ddd;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.grid-item.img-loaded::before {
  opacity: 0;
}

/* ─── Masonry column containers (created by JS for row-first ordering) ─── */
.masonry-col {
  flex: 1;
  min-width: 0;
}

/* ─── Grid item structural base ─── */
.grid-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* After slide-in animation completes, kill fill-mode so transitions work */
.grid-item.anim-complete {
  animation: none;
  opacity: 1;
  transform: none;
}

.grid-item img {
  width: 100%;
  display: block;
}

/* ─── Hover overlay structural base ─── */
.hover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.grid-item:hover .hover-overlay {
  opacity: 1;
}

/* Hide hover overlays when browsing a single project */
.project-active .grid-item:hover .hover-overlay {
  opacity: 0;
}

/* ─── Hover title base ─── */
.hover-title {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  color: white;
  text-align: center;
}

/* ─── Lightbox structure ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lightbox.open {
  display: flex;
}

.lightbox .lightbox-x {
  position: absolute;
  top: 0;
  right: 0;
  padding: 15px 15px 15px 50px;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 502;
}

/* Stage: overflow-hidden viewport for the image track */
.lightbox-stage {
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  cursor: default;
  touch-action: none;
}

/* Track: horizontal strip of 5 images, translated to center the current one */
.lightbox-track {
  display: flex;
  align-items: center;
  gap: 2vw;
  position: relative;
}

.lightbox-slot {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.lightbox-slot img {
  max-height: 80vh;
  max-width: 70vw;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

/* Placeholder outline while image loads */
.lightbox-slot:not(.loaded) {
  outline: 2px dashed #ddd;
  outline-offset: -2px;
}

/* Center slot: default cursor on wrapper, zoom-out only on image */
.lightbox-slot:nth-child(3) {
  cursor: default;
}
.lightbox-slot:nth-child(3) img {
  cursor: zoom-out;
}

/* Animation classes */
.lightbox-track.animating {
  transition: transform 0.4s ease;
}
.lightbox-track.animating .lightbox-slot {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Video overlay — centered over the main image */
.lightbox-video {
  position: absolute;
  max-height: 80vh;
  max-width: 70vw;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  z-index: 1;
}

/* Video loading spinner — inside center slot div */
.lightbox-spinner {
  position: absolute;
  top: 23px;
  right: 23px;
  z-index: 2;
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.9);
  border-radius: 50%;
  animation: lbSpin 0.7s linear infinite;
}
@keyframes lbSpin { to { transform: rotate(360deg); } }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 48px;
  color: rgba(0,0,0,0.3);
  cursor: pointer;
  padding: 20px;
  transition: color 0.2s;
  z-index: 501;
  user-select: none;
}
.lightbox-nav:hover { color: rgba(0,0,0,0.7); }
.lightbox-stage:has(.lightbox-slot:nth-child(1):hover) .lightbox-prev,
.lightbox-stage:has(.lightbox-slot:nth-child(2):hover) .lightbox-prev,
.lightbox-stage:has(.lightbox-slot:nth-child(4):hover) .lightbox-next,
.lightbox-stage:has(.lightbox-slot:nth-child(5):hover) .lightbox-next {
  color: rgba(0,0,0,0.7);
}
.lightbox-prev { left: 0; padding: 200px 60px 200px 20px; }
.lightbox-next { right: 0; padding: 200px 20px 200px 60px; }

/* Small screens: single image, no previews, no animation */
@media (max-width: 900px) {
  .lightbox-track { gap: 0; }
  .lightbox-slot img { max-width: 96vw; max-height: 88vh; }
  .lightbox-slot:not(.loaded) { outline: none; }
  .lightbox-video { max-width: 96vw; max-height: 88vh; }
  .lightbox-spinner { top: 12px; right: 12px; }
  .lightbox-prev { left: 16px; padding: 30px 100px 30px 20px; }
  .lightbox-next { right: 16px; padding: 30px 20px 30px 100px; }
}

/* ─── Lightbox metadata ─── */
.lightbox-meta {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-family: 'Nunito Sans', sans-serif;
  color: #999;
  pointer-events: auto;
  z-index: 501;
  line-height: 1.2;
  padding-top: 12px;
  white-space: nowrap;
}
.lightbox-meta-project {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #666;
  margin-bottom: 4px;
}
.lightbox-meta-comma {
  font-weight: 400;
  letter-spacing: 0;
}
.lightbox-meta-label {
  font-family: 'Avenir', 'Avenir Next', 'Nunito Sans', -apple-system, sans-serif;
  font-weight: 400;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: #999;
}
.lightbox-meta-section {
  font-family: 'Avenir', 'Avenir Next', 'Nunito Sans', -apple-system, sans-serif;
}
.lightbox-meta-link {
  cursor: pointer;
  transition: color 0.2s;
  text-decoration: none;
  color: inherit;
}
.lightbox-meta-link:hover {
  color: var(--orange, #ff4a32);
  text-decoration: underline;
}
.lightbox-meta-sep {
  margin: 0 8px;
  opacity: 0.5;
}
.lightbox-meta-value {
  /* Non-clickable version when no callback */
}

/* ─── Mobile navigation ─── */
.hamburger {
  display: none;
  position: fixed;
  top: 68px;
  left: 24px;
  z-index: 201;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span:not(.hamburger-badge) {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text, #2A2725);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.hamburger span:not(.hamburger-badge) + span:not(.hamburger-badge) { margin-top: 5px; }
.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hamburger-badge {
  position: absolute;
  top: 0;
  right: -2px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--orange, #ff4a32);
  color: white;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Nunito Sans', sans-serif;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
}
.hamburger-badge:empty { display: none; }
.hamburger.open .hamburger-badge { display: none; }

.filter-count {
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--orange, #ff4a32);
  color: white;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Nunito Sans', sans-serif;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  display: inline-block;
}
.filter-count:empty { display: none; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.3);
}
.sidebar-backdrop.visible { display: block; }

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

/* ─── Filter visibility ─── */
.grid-item.filtered-out {
  display: none;
}

/* ─── Badge base ─── */
.badge {
  position: fixed;
  z-index: 300;
  border-radius: 100px;
  font-weight: 500;
}

/* ─── 12-column grid ─── */
.g-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--g-gap, 40px);
}
.g-col-1  { grid-column: span 1; }
.g-col-2  { grid-column: span 2; }
.g-col-3  { grid-column: span 3; }
.g-col-4  { grid-column: span 4; }
.g-col-5  { grid-column: span 5; }
.g-col-6  { grid-column: span 6; }
.g-col-7  { grid-column: span 7; }
.g-col-8  { grid-column: span 8; }
.g-col-9  { grid-column: span 9; }
.g-col-10 { grid-column: span 10; }
.g-col-11 { grid-column: span 11; }
.g-col-12 { grid-column: span 12; }

@media (max-width: 768px) {
  .g-row { grid-template-columns: 1fr; }
  [class*="g-col-"] { grid-column: span 1; }
}

/* ─── Content pages ─── */
#content-page-content {
  position: relative;
  z-index: 1;
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 115px 40px 100px;
}
#content-page-content.visible { display: block; }
#content-page-content.content-page-has-sidebar { margin-left: var(--sidebar-w, 220px); }

/* ─── 404 page ─── */
.not-found-page {
  text-align: center;
  padding: 80px 20px;
}
.not-found-code {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 120px;
  letter-spacing: 6px;
  color: var(--orange);
  line-height: 1;
  margin: 0 0 16px;
}
.not-found-text {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 32px;
}
.not-found-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--orange);
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.25s;
}
.not-found-link:hover {
  border-bottom-color: var(--orange);
}

.header-nav-link.active { color: var(--orange); }

@media (max-width: 768px) {
  #content-page-content { padding: 115px 20px 80px; }
  #content-page-content.content-page-has-sidebar { margin-left: 0; }
}
