/* ==========================================================================
   Service gallery pages (tile-flooring.html, painting-drywall.html) ·
   page-specific layer. Everything leans on tokens.css + main.css;
   no raw values, only vars.
   ========================================================================== */

/* ---- Page head: a dark band so the transparent header has a dark
     ground at the top, same as the hero on the home page. --------------- */
.tf-head {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding-block: calc(var(--header-h) + var(--s-9)) var(--s-10) var(--s-9);
  position: relative;
}
.tf-head .rule-accent { margin-block: var(--s-4) 0; }
.tf-head h1 {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  max-width: 20ch;
}
.tf-head .tf-lead {
  margin-top: var(--s-5);
  font-size: var(--fs-lead);
  line-height: var(--lh-body);
  color: var(--text-on-dark-2);
  max-width: 54ch;
}
.tf-head .tf-back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-7);
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--text-on-dark);
}
.tf-head .tf-back:hover { color: var(--accent); }
.tf-head .tf-back svg { transition: transform var(--t-fast) var(--ease-out); }
.tf-head .tf-back:hover svg { transform: translateX(-3px); }

/* ---- Gallery grid ------------------------------------------------------ */
.tf-grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .tf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .tf-grid { grid-template-columns: repeat(3, 1fr); } }

.tf-grid figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.tf-grid figure:nth-child(2) { --delay: 100ms; }
.tf-grid figure:nth-child(3) { --delay: 200ms; }

.tf-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: var(--rule);
  background: var(--white);
  overflow: hidden;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.tf-thumb img {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1.001); /* keeps the hover scale off the raster on paint */
  transition: transform var(--t-slow) var(--ease-out);
}
.tf-thumb:hover img,
.tf-thumb:focus-visible img { transform: scale(1.05); }
.tf-thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.tf-grid figcaption {
  font-size: var(--fs-small);
  color: var(--text-body);
}
.tf-grid figcaption strong {
  display: block;
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  font-size: var(--fs-label);
}

/* ---- Lightbox -----------------------------------------------------------
   A dark dialog over the page, in the same ink ground as the menu.       */
.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 9, 12, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: clamp(48px, 7vw, 72px) clamp(16px, 4vw, 48px);
}
.lb[hidden] { display: none; }

.lb__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: min(1280px, 100%);
}
.lb__stage picture,
.lb__stage img {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.lb__cap {
  color: var(--text-on-dark-2);
  font-size: var(--fs-small);
  text-align: center;
  max-width: 60ch;
}

.lb__close,
.lb__prev,
.lb__next {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--hairline-dark);
  background: var(--ink-2);
  color: var(--text-on-dark);
  cursor: pointer;
}
.lb__close:hover, .lb__prev:hover, .lb__next:hover { border-color: var(--steel); }
.lb__close:focus-visible, .lb__prev:focus-visible, .lb__next:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}
.lb__close { top: clamp(12px, 2vw, 20px); right: clamp(12px, 2vw, 20px); }
.lb__prev { left: clamp(8px, 2vw, 24px); top: 50%; transform: translateY(-50%); }
.lb__next { right: clamp(8px, 2vw, 24px); top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lb__prev, .lb__next { top: auto; bottom: clamp(12px, 3vw, 20px); transform: none; }
}
.lb__close svg, .lb__prev svg, .lb__next svg { width: 20px; height: 20px; }

/* ---- Video (single-clip gallery pages, e.g. trim & carpentry) ---------- */
.tf-video {
  margin: 0;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.tf-video--portrait { max-width: 640px; margin-inline: auto; }
.tf-video video {
  display: block;
  width: 100%;
  height: auto;
  border: var(--rule);
  background: var(--ink);
}
.tf-video figcaption {
  font-size: var(--fs-small);
  color: var(--text-body);
}
.tf-video figcaption strong {
  display: block;
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  font-size: var(--fs-label);
}

@media (prefers-reduced-motion: reduce) {
  .tf-thumb img { transition: none; }
}

/* While the lightbox is open the page behind must not scroll. */
html.lb-open { overflow: hidden; }

