/* ============================================================
   ROOTS FINISHED BASEMENTS — THE WORK
   Real project gallery, sorted by build stage.
   Uses the site's existing :root tokens with safe fallbacks.
   ============================================================ */

#roots-work {
  --w-olive: var(--olive, #3a3b36);
  --w-olive-dark: var(--olive-dark, #2c2d28);
  --w-olive-deep: var(--olive-deep, #22231f);
  --w-gold: var(--gold, #af8841);
  --w-gold-bright: var(--gold-bright, #b89248);
  --w-gold-soft: var(--gold-soft, #d9c890);
  --w-cream: var(--cream, #ece2c8);
  --w-paper: var(--paper, #f6f4ec);
  --w-grey-light: var(--grey-light, #bcb8a8);
  --w-cond: var(--cond, "Avenir Next Condensed", "Arial Narrow", sans-serif);
  --w-sans: var(--sans, "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif);
  --w-script: var(--script, "Snell Roundhand", "Savoye LET", cursive);

  background: var(--w-olive-deep);
  color: var(--w-paper);
  padding: 96px 0 104px;
  position: relative;
  overflow: hidden;
}

#roots-work::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
}

.w-wrap {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Heading ---------- */

.w-kicker {
  font-family: var(--w-cond);
  font-size: 12px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--w-gold);
  margin: 0 0 18px;
}

.w-title {
  font-family: var(--w-cond);
  font-weight: 700;
  font-size: clamp(34px, 6vw, 62px);
  line-height: .98;
  letter-spacing: .005em;
  text-transform: uppercase;
  margin: 0 0 22px;
  color: #fff;
}

.w-sub {
  font-family: var(--w-sans);
  max-width: 620px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--w-grey-light);
  margin: 0 0 38px;
}

/* ---------- Stage filter ---------- */

.w-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.w-filter {
  font-family: var(--w-cond);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--w-grey-light);
  background: transparent;
  border: 1px solid rgba(236, 226, 200, .22);
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
}

.w-filter:hover { color: var(--w-cream); border-color: rgba(175, 136, 65, .6); }

.w-filter[aria-pressed="true"] {
  color: var(--w-olive-deep);
  background: var(--w-gold);
  border-color: var(--w-gold);
  font-weight: 600;
}

.w-count {
  font-family: var(--w-cond);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(188, 184, 168, .65);
  margin: 0 0 30px;
}

/* ---------- Grid ---------- */

.w-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

.w-item {
  position: relative;
  margin: 0;
  border: 0;
  padding: 0;
  background: var(--w-olive-dark);
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: 4 / 3;
  display: block;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transform: translateY(14px);
  animation: wFade .5s ease forwards;
}

@keyframes wFade { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .w-item { animation: none; opacity: 1; transform: none; }
}

.w-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .7s cubic-bezier(.2, .7, .2, 1), filter .5s;
  filter: saturate(.94);
}

.w-item:hover img,
.w-item:focus-visible img { transform: scale(1.05); filter: saturate(1.06); }

.w-item:focus-visible { outline: 2px solid var(--w-gold); outline-offset: 3px; }

.w-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 16px 14px;
  background: linear-gradient(transparent, rgba(20, 21, 18, .88));
  font-family: var(--w-cond);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--w-cream);
  text-align: left;
  pointer-events: none;
}

.w-item .w-stage-tag {
  display: block;
  color: var(--w-gold-soft);
  font-size: 10px;
  letter-spacing: .26em;
  margin-bottom: 3px;
}

.w-item .w-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(20, 21, 18, .55);
  border: 1px solid rgba(236, 226, 200, .5);
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: background .3s;
}

.w-item .w-play::after {
  content: "";
  border-left: 14px solid var(--w-cream);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 4px;
}

.w-item:hover .w-play { background: rgba(175, 136, 65, .85); }

/* Wide feature tiles keep the grid from feeling like a contact sheet */
.w-item.is-wide { grid-column: span 2; aspect-ratio: 16 / 9; }

@media (max-width: 620px) {
  .w-item.is-wide { grid-column: span 1; aspect-ratio: 4 / 3; }
}

.w-empty {
  font-family: var(--w-sans);
  color: var(--w-grey-light);
  padding: 40px 0;
  grid-column: 1 / -1;
}

/* ---------- Lightbox ---------- */

.w-lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(16, 17, 14, .965);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.w-lb.is-open { display: flex; }

.w-lb-media {
  max-width: min(1280px, 94vw);
  max-height: 82vh;
  display: block;
  object-fit: contain;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}

.w-lb-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 26px;
  text-align: center;
  font-family: var(--w-cond);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--w-cream);
  padding: 0 70px;
}

.w-lb-cap span { display: block; color: var(--w-gold-soft); font-size: 10px; letter-spacing: .3em; margin-bottom: 6px; }

.w-lb-btn {
  position: absolute;
  background: rgba(236, 226, 200, .08);
  border: 1px solid rgba(236, 226, 200, .25);
  color: var(--w-cream);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background .2s, border-color .2s;
}

.w-lb-btn:hover { background: rgba(175, 136, 65, .85); border-color: var(--w-gold); }
.w-lb-close { top: 20px; right: 20px; }
.w-lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.w-lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

@media (max-width: 620px) {
  .w-lb-prev { left: 10px; }
  .w-lb-next { right: 10px; }
  .w-lb-btn { width: 44px; height: 44px; }
  .w-lb-cap { padding: 0 20px; bottom: 16px; }
  #roots-work { padding: 72px 0 80px; }
}

body.w-lb-open { overflow: hidden; }
