/* Power On v2: /projects/ only. Shared parts (job cards, page hero, closing) are in core.css. */

/* a lead paragraph under a section heading */
.sec-sub { margin-top: 20px; color: var(--fg-2); max-width: 60ch; }

/* ---------- case studies: the homepage's two big tiles ---------- */
.wgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(40px, 3vw, 44px) var(--gap); align-items: start; }
.wt-l { grid-column: span 6; }
.wt-l .wt-img { aspect-ratio: 1 / 1; }
.wt-img img.pos-desk { object-position: 50% 55%; }
.wt-img img.pos-chand { object-position: 50% 30%; }
.wt-l .wt-cap { flex-direction: column; align-items: flex-start; gap: 8px; }
.wt-l .wt-title { font-size: clamp(24px, 2.4vw, 34px); }
.cs-desc { color: var(--fg-2); max-width: 56ch; }
.cs-links { display: flex; flex-wrap: wrap; gap: 12px 28px; }
/* links inside a card sit above the card's stretched main link */
.wt .tlink { z-index: 2; }
/* a project still under way ("Active work"): one wide row under the two case studies, photo beside the words */
.wt-act { grid-column: 1 / -1; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: auto auto 1fr; column-gap: var(--gap); align-items: start; padding-top: clamp(28px, 3vw, 40px); border-top: 1px solid var(--rule); }
.wt-act .wt-img { grid-row: 1 / 4; aspect-ratio: 4 / 3; }
.wt-act .wt-img img { object-position: 50% 24%; }
.wt-act .wt-cap { flex-direction: column; align-items: flex-start; gap: 8px; }
.wt-act .wt-title { font-size: clamp(24px, 2.4vw, 34px); }
.cs-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; }
.cs-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
@media (max-width: 599px) {
  .wgrid { gap: 48px 16px; }
  .wt-l { grid-column: 1 / -1; }
  .wt-l .wt-img { aspect-ratio: 4 / 5; }
  .wt-act { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .wt-act .wt-img { grid-row: auto; }
}

/* ---------- progress viewer (#featured-projects) ---------- */
.comparison-module { display: grid; gap: 28px; }
.project-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.project-tab {
  min-height: 48px; padding: 0 20px; border: 1px solid var(--rule); color: var(--fg-2);
  font: 500 16px/1 var(--font); letter-spacing: -0.005em;
}
.project-tab:hover { color: var(--fg); border-color: var(--fg-3); }
.project-tab.active { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.comparison-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px 32px; margin-bottom: 24px; }
.comparison-type { color: var(--accent); margin-bottom: 12px; }
.comparison-head p:not(.comparison-type) { margin-top: 12px; color: var(--fg-2); max-width: 62ch; }
.comparison-labels { display: flex; gap: 8px; }
.compare-pill { padding: 7px 10px; border: 1px solid var(--rule); color: var(--fg-2); }
.compare-pill.after { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.comparison-viewer {
  --split: 50%;
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: min(78vh, 780px);
  overflow: hidden; background: var(--bg-3); cursor: ew-resize; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.comparison-viewer:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.comparison-image {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  pointer-events: none; -webkit-user-drag: none;
  transition: opacity .38s ease, transform .65s var(--ease);
}
.after-image { z-index: 2; }
.js .comparison-image { opacity: 0; transform: scale(1.015); }
.js .comparison-viewer.has-before .before-image, .js .comparison-viewer.has-after .after-image { opacity: 1; }
.js .comparison-image.is-transitioning { transform: scale(1.022); }
.comparison-placeholder { display: none; }
.js .comparison-placeholder {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  color: var(--fg-2); transition: opacity .3s ease;
}
.js .comparison-viewer.has-before.has-after .comparison-placeholder { opacity: 0; }
/* the knob stays whole at the edges: the handle stops 34px short of them */
.comparison-handle { position: absolute; top: 0; bottom: 0; left: clamp(34px, var(--split), calc(100% - 34px)); z-index: 8; width: 0; pointer-events: none; }
.comparison-handle::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px;
  background: var(--paper); box-shadow: 0 0 0 1px rgba(17, 16, 16, .25);
}
.comparison-knob {
  position: absolute; left: 0; top: 50%; width: 68px; height: 68px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: var(--paper); color: var(--ink); box-shadow: 0 12px 32px rgba(0, 0, 0, .38);
  transform: translate(-50%, -50%); transition: transform 300ms var(--ease);
}
.comparison-knob .label { font-size: 10px; letter-spacing: .16em; }
.comparison-viewer.is-dragging .comparison-knob, .comparison-viewer:focus-visible .comparison-knob { transform: translate(-50%, -50%) scale(1.08); }
.comparison-viewer:focus-visible .comparison-knob { box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--signal), 0 12px 32px rgba(0, 0, 0, .38); }
.comparison-help { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin-top: 16px; color: var(--fg-2); font-size: 15px; }
.comparison-progress { color: var(--accent); }
/* without scripts the photo is a plain photo: no tabs, no handle */
html:not(.js) .project-tabs, html:not(.js) .comparison-handle { display: none; }
html:not(.js) .comparison-viewer { cursor: auto; }
@media (max-width: 767px) {
  .comparison-head { grid-template-columns: minmax(0, 1fr); }
  .project-tab { flex: 1 1 auto; }
  .comparison-knob { width: 58px; height: 58px; }
}

/* ---------- before / after sequences ---------- */
.seqs { display: grid; gap: clamp(56px, 6vw, 88px); }
.seq-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 32px; padding-bottom: 20px; margin-bottom: 28px; border-bottom: 1px solid var(--rule); }
.seq-head p { margin-top: 10px; color: var(--fg-2); }
.seq-head .seq-count { margin-top: 0; color: var(--accent); }
.seq-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px var(--gap); }
.seq-img { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--bg-3); }
.seq-img img { width: 100%; height: 100%; object-fit: cover; }
.seq-phase { position: absolute; left: 10px; top: 10px; padding: 5px 8px; background: var(--scrim); color: var(--paper); }
.seq-t { margin-top: 14px; font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
.seq-m { margin-top: 6px; color: var(--fg-2); font-size: 14px; line-height: 1.45; }
@media (max-width: 1023px) { .seq-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 599px) { .seq-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; } .seq-t { font-size: 15px; } }

/* ---------- gallery: filter bar, status line, closing row ---------- */
/* one compact row: the Show switch, the Service and City menus, Clear */
.pfx { margin-bottom: 20px; }
.pfx-open, .pfx-top, .pfx-foot, .pfx-scrim { display: none; }
.pfx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.seg { display: inline-flex; border: 1px solid var(--rule); }
.seg-b { min-height: 44px; padding: 0 16px; color: var(--fg-2); font: 500 15px/1 var(--font); white-space: nowrap; }
.seg-b + .seg-b { border-left: 1px solid var(--rule); }
.seg-b:hover { color: var(--fg); }
.seg-b[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.seg-b:focus-visible { outline-offset: 2px; }
.pfx-f { display: inline-flex; align-items: center; gap: 10px; }
.pfx-l { color: var(--fg-3); }
.pfx-f select {
  -webkit-appearance: none; appearance: none; min-height: 44px; max-width: 280px; padding: 0 40px 0 14px; border: 1px solid var(--rule); border-radius: 0;
  color: var(--fg); font: 500 15px/1.2 var(--font); cursor: pointer;
  background: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%) calc(100% - 21px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--fg-2) 50%, transparent 50%) calc(100% - 15px) 50% / 6px 6px no-repeat, var(--bg);
}
.pfx-f select:hover { border-color: var(--fg-3); }
.pfx-clear { min-height: 44px; padding: 0 4px; color: var(--fg); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--accent); font-size: 15px; }
.pfx-clear:hover { color: var(--accent); }
.pfx-clear[hidden] { display: none; }
.filter-status { margin: 0 0 clamp(32px, 3.4vw, 48px); color: var(--fg-3); }
/* fewer than three results: a quiet way back to more */
.pfx-more { margin: 0 0 clamp(32px, 3.4vw, 48px); color: var(--fg-2); }
.pfx-more .tlink { margin-left: 4px; }
/* the filters need the script; without it every card simply shows */
html:not(.js) .pfx, html:not(.js) .filter-status, html:not(.js) .pfx-more { display: none; }
/* phones: a Filter button (with the active count) opens the bar as a bottom sheet */
@media (max-width: 767px) {
  .pfx-open { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--fg); color: var(--fg); font: 500 15px/1 var(--font); }
  .pfx-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 170; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 var(--pad) calc(20px + env(safe-area-inset-bottom)); background: var(--bg); color: var(--fg); border-top: 1px solid var(--rule);
    transform: translateY(100%); visibility: hidden; transition: transform 400ms var(--ease), visibility 0s linear 400ms;
  }
  .pfx.is-open .pfx-sheet { transform: none; visibility: visible; transition: transform 400ms var(--ease); }
  .pfx-scrim { display: block; position: fixed; inset: 0; z-index: 169; background: rgba(17, 16, 16, .6); opacity: 0; visibility: hidden; transition: opacity 400ms var(--ease), visibility 0s linear 400ms; }
  .pfx.is-open .pfx-scrim { opacity: 1; visibility: visible; transition: opacity 400ms var(--ease); }
  .pfx-top { display: flex; align-items: center; justify-content: space-between; min-height: 64px; border-bottom: 1px solid var(--rule); }
  .pfx-top .label { color: var(--fg-3); }
  .pfx-x { min-height: 44px; min-width: 44px; font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; text-align: right; }
  .pfx-bar { flex-direction: column; align-items: stretch; gap: 20px; padding: 24px 0; }
  .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg-b { padding: 0 6px; font-size: 14px; white-space: normal; line-height: 1.2; }
  .pfx-f { flex-direction: column; align-items: stretch; gap: 8px; }
  .pfx-f select { max-width: none; width: 100%; min-height: 48px; font-size: 16px; }
  .pfx-clear { align-self: flex-start; }
  .pfx-foot { display: block; padding-top: 8px; }
  .pfx-apply { width: 100%; }
}
.gallery-note { margin-top: clamp(48px, 5vw, 72px); color: var(--fg-3); }
.gallery-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; margin-top: 24px; padding: 32px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.gallery-cta p { margin-top: 8px; color: var(--fg-2); }
.pcta-more { margin-top: 20px; }

/* ---------- follow the work: three social tiles ---------- */
.follow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.fw { position: relative; display: block; overflow: hidden; color: var(--paper); text-decoration: none; background: var(--ink-2); }
.fw-img { display: block; aspect-ratio: 4 / 5; overflow: hidden; }
.fw-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 900ms var(--ease); }
.fw-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 64px 20px 18px;
  background: linear-gradient(to top, rgba(17, 16, 16, .88), rgba(17, 16, 16, .6) 55%, rgba(17, 16, 16, 0)); font-size: clamp(18px, 1.6vw, 22px); font-weight: 500; letter-spacing: -0.01em; }
.fw-cap svg { flex: 0 0 auto; color: var(--brass-l); }
.fw-cap .arr { margin-left: auto; transition: transform 500ms var(--ease); }
.fw:hover .fw-img img, .fw:focus-visible .fw-img img { transform: scale(1.03); }
.fw:hover .arr, .fw:focus-visible .arr { transform: translate(3px, -3px); }
.fw:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (max-width: 767px) {
  .follow { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fw-img { aspect-ratio: 16 / 9; }
}
/* the gallery is long: cards off screen skip layout and paint until they come near (their last size is remembered) */
#projectGallery > .gj { content-visibility: auto; contain-intrinsic-size: auto 720px; }
