/* Power On v2: project case study pages (/projects/<slug>/). The components of /assets/css/project.css, redrawn in the
   V2 tokens (both themes). Hooks used by /assets/js/project.js stay the same: .ba-slider[data-ba], .ba-before,
   .ba-after, .ba-handle, a[data-lightbox], video[data-pj-loop], .pj-lightbox. */

.sec-sub { margin-top: 20px; color: var(--fg-2); max-width: 62ch; }
.wt-img img.pos-desk { object-position: 50% 55%; }
.wt-img img.pos-chand { object-position: 50% 30%; }

/* ---------- hero: breadcrumb, copy, the vertical loop ---------- */
.pj-hero { padding: calc(var(--nav-h) + clamp(24px, 3vw, 40px)) 0 clamp(48px, 5vw, 80px); }
.pj-hero .crumbs { margin-bottom: clamp(40px, 5vw, 72px); }
.pj-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 40px clamp(40px, 5vw, 88px); }
.pj-hero h1 { font-size: clamp(40px, 5vw, 80px); max-width: 15ch; }
.pj-hero .lead { margin-top: clamp(20px, 2vw, 28px); color: var(--fg-2); max-width: 46ch; }
.pj-hero-media {
  position: relative; width: min(360px, 30vw); aspect-ratio: 9 / 16; overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--rule);
}
.pj-hero-media img, .pj-hero-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-hero-media video { z-index: 1; }
/* completion month and Share, under the buttons */
.pj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; margin-top: 20px; }
/* projects still under way ("Active work"): a live status in place of the completion month, and a tag on the photo */
.pj-live { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font: 500 12px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.pj-live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.pj-live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent); opacity: 0; animation: pj-live 2.4s ease-out infinite; }
@keyframes pj-live { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pj-live-dot::after { animation: none; } }
.pj-live-tag { position: absolute; left: 12px; top: 12px; z-index: 2; padding: 5px 9px; background: rgba(10, 10, 9, .78); color: #f5f3ee; border: 1px solid rgba(245, 243, 238, .22); }

/* ---------- facts strip: a drawing-set title block ---------- */
.pj-facts-section { padding: 0 0 clamp(64px, 7vw, 104px); }
.pj-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.pj-fact { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.pj-fact dt { margin-bottom: 10px; color: var(--accent); font: 500 12px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.pj-fact dd { margin: 0; color: var(--fg); font-size: 16px; line-height: 1.45; }
.pj-facts.pj-facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- section heads and copy ---------- */
.pj-head { margin-bottom: clamp(36px, 4.5vw, 64px); }
.pj-head h2 .ln { max-width: 22ch; }
/* What we did, The challenge, Behind the walls: the heading in the sticky left column (core.css .csplit), 1024px and up;
   the steps two by two beside it */
@media (min-width: 1024px) {
  .csplit-h .pj-head h2 { font-size: clamp(28px, 2.9vw, 44px); line-height: 1.06; letter-spacing: -0.025em; }
  .csplit-b > .pj-steps:first-child { margin-top: 0; }
  .csplit-b .pj-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.pj-copy { max-width: 64ch; color: var(--fg-2); font-size: clamp(17px, 1.3vw, 19px); line-height: 1.7; }

/* ---------- project video: a portrait film, centred under a centred heading, sized to fit the screen height ---------- */
#video .pj-head { justify-content: center; text-align: center; }
#video .pj-head h2 .ln { margin-inline: auto; }
.pj-video { width: min(420px, 100%, calc((100svh - var(--nav-h) - 48px) * 9 / 16)); min-width: min(300px, 100%); margin-inline: auto; aspect-ratio: 9 / 16; overflow: hidden; background: #000; border: 1px solid var(--rule); }
.pj-video video { width: 100%; height: 100%; display: block; object-fit: cover; background: #000; }

/* ---------- before / after sliders: one centred column, its heading on the same left edge ---------- */
.ba-stack { display: grid; gap: 48px; max-width: 900px; margin-inline: auto; }
#before-after .pj-head { max-width: 900px; margin-inline: auto; }
.ba-figure { margin: 0; }
.ba-figure figcaption, .pj-pair-caption { margin-top: 14px; color: var(--fg-2); font-size: 15px; line-height: 1.6; }
.ba-slider {
  --ba-pos: 50%;
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-3);
  touch-action: pan-y; -webkit-user-select: none; user-select: none; cursor: ew-resize;
}
.ba-slider img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.ba-before { z-index: 1; clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0); }
.ba-label {
  position: absolute; top: 12px; z-index: 3; padding: 5px 8px; pointer-events: none;
  background: var(--scrim); color: var(--paper); font: 500 11px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.ba-label-before { left: 12px; }
.ba-label-after { right: 12px; background: var(--brass-l); color: var(--ink); }
.ba-handle {
  position: absolute; top: 0; bottom: 0; left: var(--ba-pos); z-index: 4; width: 48px; margin-left: -24px;
  display: flex; align-items: center; justify-content: center; outline: none; cursor: ew-resize;
}
.ba-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--paper); box-shadow: 0 0 0 1px rgba(17, 16, 16, .25); }
.ba-knob {
  position: relative; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); color: var(--ink); font-size: 16px; font-weight: 500;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .38); transition: transform 300ms var(--ease);
}
.ba-handle:focus-visible .ba-knob { box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--signal), 0 10px 28px rgba(0, 0, 0, .38); }
.ba-slider.is-dragging .ba-knob, .ba-handle:hover .ba-knob, .ba-handle:focus-visible .ba-knob { transform: scale(1.08); }
/* "Then & now" (active work): two dated photos side by side, no slider (different spots, same job) */
.tn-stack { display: grid; gap: 48px; max-width: 900px; margin-inline: auto; }
.tn-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tn-fig { position: relative; margin: 0; }
.tn-fig a { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-3); cursor: zoom-in; }
.tn-fig img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 900ms var(--ease); }
.tn-tag { position: absolute; left: 10px; top: 10px; padding: 5px 9px; background: rgba(10, 10, 9, .78); color: #f5f3ee; border: 1px solid rgba(245, 243, 238, .22); pointer-events: none; }
.tn-row figcaption { margin-top: 14px; color: var(--fg-2); font-size: 15px; line-height: 1.5; }
@media (hover: hover) { .tn-fig a:hover img { transform: scale(1.03); } }
@media (prefers-reduced-motion: reduce) { .tn-fig img { transition: none; } .tn-fig a:hover img { transform: none; } }
@media (max-width: 600px) { .tn-pair { grid-template-columns: minmax(0, 1fr); } }
.ba-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }

/* side-by-side pair (different angles) */
.pj-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
.pj-pair figure { margin: 0; position: relative; overflow: hidden; background: var(--bg-3); aspect-ratio: 1 / 1; }
.pj-pair img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-pair.pj-pair-4x3 figure { aspect-ratio: 4 / 3; }
.pj-pair .ba-label { top: 12px; left: 12px; right: auto; }

/* ---------- check lists ---------- */
.pj-list { display: grid; max-width: 860px; border-top: 1px solid var(--rule); }
.pj-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--rule); color: var(--fg); font-size: 17px; line-height: 1.55; }
.pj-list li::before {
  content: ""; width: 14px; height: 8px; margin: 7px 0 0 4px;
  border-left: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: rotate(-45deg);
}
.pj-list.cols { max-width: none; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gap); }

/* ---------- step strip ---------- */
.pj-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px var(--gap); margin-top: clamp(36px, 4vw, 56px); }
.pj-step { margin: 0; min-width: 0; border-top: 1px solid var(--rule); }
.pj-step-media { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--bg-3); margin-top: 16px; }
.pj-step-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 900ms var(--ease); }
a.pj-step-media { cursor: zoom-in; }
a.pj-step-media:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.pj-step-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 16px 0 0; }
.pj-step-num { color: var(--accent); font: 500 12px/1.5 var(--mono); letter-spacing: .14em; }
.pj-step-title { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.pj-step-text { flex-basis: 100%; margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.55; }

/* ---------- photo gallery + lightbox ---------- */
.pj-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.pj-gallery li { min-width: 0; }
.pj-gallery a { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-3); cursor: zoom-in; }
.pj-gallery img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 900ms var(--ease); }
.pj-gallery a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) {
  a.pj-step-media:hover img, .pj-gallery a:hover img { transform: scale(1.03); }
}

.pj-lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: transparent; color: var(--paper); overflow: hidden; }
.pj-lightbox::backdrop { background: rgba(17, 16, 16, .94); }
.pj-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.pj-lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 0 72px; }
.pj-lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 128px); width: auto; height: auto; }
.pj-lightbox figcaption { max-width: 720px; text-align: center; color: var(--mist); font-size: 15px; line-height: 1.5; }
.pj-lb-btn {
  position: absolute; z-index: 2; width: 52px; height: 52px; display: grid; place-items: center;
  border: 1px solid rgba(245, 243, 238, .3); background: rgba(17, 16, 16, .6); color: var(--paper);
  font: 400 24px/1 var(--font); cursor: pointer;
}
.pj-lb-btn:hover { border-color: var(--paper); }
.pj-lb-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.pj-lb-close { top: 16px; right: 16px; }
.pj-lb-prev { left: 12px; top: 50%; margin-top: -26px; }
.pj-lb-next { right: 12px; top: 50%; margin-top: -26px; }
.pj-lb-zoom { position: absolute; z-index: 2; top: 16px; right: 80px; display: flex; gap: 8px; }
.pj-lb-zoom .pj-lb-btn { position: static; width: 44px; height: 44px; margin-top: 4px; }
/* zoom (PO.zoom): the viewer's own gestures, never the browser's page zoom or a scroll behind it */
.pj-lightbox[open] { touch-action: none; overscroll-behavior: contain; }
.pj-lightbox img { transform-origin: 50% 50%; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
@media (hover: hover) and (pointer: fine) {
  .pj-lightbox img { cursor: zoom-in; }
  .pj-lightbox.is-zoomed img { cursor: grab; }
  .pj-lightbox.is-panning img { cursor: grabbing; }
}
.pj-lb-count { position: absolute; top: 32px; left: 20px; color: var(--mist); font: 500 12px/1 var(--mono); letter-spacing: .14em; }

/* ---------- related links: the link index look ---------- */
.pj-related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gap); border-top: 1px solid var(--rule); }
.pj-related a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 14px 0;
  border-bottom: 1px solid var(--rule); color: var(--fg); text-decoration: none; font-size: 18px; font-weight: 500; letter-spacing: -0.01em;
}
.pj-related a::after { content: "\2192"; color: var(--fg-3); transition: transform 500ms var(--ease); }
.pj-related a:hover { color: var(--accent); }
.pj-related a:hover::after, .pj-related a:focus-visible::after { transform: translateX(4px); color: var(--accent); }

/* ---------- next project: the other case study, full width, before the closing call ---------- */
.pnext-sec { background: var(--ink); }
.pnext { position: relative; display: block; overflow: hidden; color: var(--paper); text-decoration: none; }
.pnext-img { display: block; aspect-ratio: 21 / 9; max-height: 82vh; min-height: 420px; overflow: hidden; background: var(--ink-2); }
.pnext-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1600ms var(--ease); }
.pnext:hover .pnext-img img, .pnext:focus-visible .pnext-img img { transform: scale(1.05); }
.pnext::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(17, 16, 16, .9) 0%, rgba(17, 16, 16, .55) 38%, rgba(17, 16, 16, 0) 72%); }
.pnext-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: grid; justify-items: start; gap: 12px; padding-bottom: clamp(32px, 4.5vw, 72px); }
.pnext .kw { margin: 0; color: var(--brass-l); }
.pnext-l, .pnext .done { color: var(--mist); }
.pnext-t { max-width: 18ch; font-size: clamp(32px, 4.2vw, 64px); line-height: 1.02; font-weight: 500; letter-spacing: -0.03em; }
.pnext-t .arr { display: inline-block; transition: transform 500ms var(--ease); }
.pnext:hover .pnext-t .arr, .pnext:focus-visible .pnext-t .arr { transform: translateX(6px); }
.pnext:focus-visible { outline: 2px solid var(--signal); outline-offset: -6px; }
/* a portrait photo (the salon reception) gets a taller band, framed on its upper part */
.pnext-img.is-portrait { aspect-ratio: 16 / 9; }
.pnext-img.is-portrait img { object-position: 50% 30%; }
@media (max-width: 767px) { .pnext-img, .pnext-img.is-portrait { aspect-ratio: 4 / 5; min-height: 0; max-height: 78vh; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .pj-facts, .pj-facts.pj-facts-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pj-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .pj-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .pj-hero-media { order: -1; width: 100%; max-height: 72vh; }
  .pj-facts, .pj-facts.pj-facts-3 { grid-template-columns: minmax(0, 1fr); }
  .ba-row { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .pj-pair { gap: 10px; }
  .pj-list.cols { grid-template-columns: minmax(0, 1fr); }
  .pj-steps { gap: 28px 12px; }
  .pj-step-title { font-size: 16px; }
  .pj-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pj-related { grid-template-columns: minmax(0, 1fr); }
  .pj-lightbox figure { padding: 0 8px; }
  .pj-lb-prev, .pj-lb-next { top: auto; bottom: 16px; margin-top: 0; }
  .pj-lightbox img { max-height: calc(100vh - 176px); }
  .ba-label { top: 10px; font-size: 10px; }
  .ba-label-before { left: 10px; } .ba-label-after { right: 10px; }
}
@media (max-width: 479px) { .pj-hero .p-acts .btn { flex: 1 1 100%; } }
@media (prefers-reduced-motion: reduce) {
  .pj-hero-media video { display: none; }
}
