/* ═══════════════════════════════════════════════════════════
   PORTFOLIO — listing grid + project detail
   Shared by projects.html and project.html. Inherits tokens,
   cursor, CRT overlay and nav from style.css / nav.css.
   ═══════════════════════════════════════════════════════════ */

/* style.css locks scrolling for the fixed landing page; these pages scroll. */
body.page-scroll,
html:has(body.page-scroll) {
  overflow-y: auto;
  overflow-x: hidden;
  height: auto;
  min-height: 100%;
}

body.page-scroll {
  background: var(--bg);
  /* Clear of the CRT barrel on both sides. */
  padding: 0 clamp(24px, 6vw, 96px);
}

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  position: relative;
  z-index: var(--z-content);
}

/* The nav is fixed over scrolling content; without a scrim the mark lands on
   top of project imagery and becomes unreadable. Fades out so it never reads
   as a solid bar. */
body.page-scroll .site-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(251, 251, 251, 0.96) 0%,
    rgba(251, 251, 251, 0.82) 52%,
    rgba(251, 251, 251, 0) 100%
  );
}

/* ══════════ PAGE ENTRANCE ══════════
   Header pieces rise in sequence on load, same easing and direction as the
   home page so arriving here feels continuous with leaving there. Kept to
   opacity + transform so it stays on the compositor. */

.page-eyebrow { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }
.page-title   { animation: riseIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.13s both; }
.page-sub     { animation: riseIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both; }
.filters      { animation: riseIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.31s both; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Page header ─────────────────────────────────────────── */
.page-head {
  padding: clamp(96px, 14vh, 168px) 0 clamp(34px, 5vh, 64px);
}

.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--fg-dim);
  margin-bottom: 18px;
}
.page-eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(64px, 13vw, 200px);
  line-height: 0.86;
  letter-spacing: 0.01em;
  color: var(--fg);
}

.page-sub {
  margin-top: 20px;
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.65;
  /* Not --fg-dim: at 25% this sits right on top of the contour lines and
     becomes genuinely hard to read. */
  color: rgba(17, 17, 17, 0.62);
}

/* ── Filters ─────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: clamp(40px, 7vh, 84px);
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  position: relative;
  border: 1px solid var(--border);
  background: transparent;
  padding: 11px 20px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--fg-dim);
  text-transform: uppercase;
  transition:
    color 0.35s var(--ease-out-quint),
    border-color 0.35s var(--ease-out-quint),
    background 0.35s var(--ease-out-quint);
}

.filter-btn:hover { color: var(--fg); border-color: var(--border-strong); }

.filter-btn.is-active {
  color: #fff;
  background: var(--fg);
  border-color: var(--fg);
}

.filter-count {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  opacity: 0.55;
}

/* ── Grid ────────────────────────────────────────────────── */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(40px, 6vw, 96px) clamp(28px, 4vw, 64px);
  padding: clamp(40px, 5vh, 68px) 0 clamp(80px, 12vh, 160px);
}

/* Aligned media frames keep website screenshots easy to compare. */
.work-card:nth-child(even) { margin-top: 0; }

.work-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  opacity: 1;
  transform: none;
}
.work-card.is-in { opacity: 1; transform: translateY(0); }

/* Filtered-out cards collapse out of flow entirely. */
.work-card.is-hidden { display: none; }

.work-media {
  position: relative;
  overflow: hidden;
  background: var(--fg-dimmer);
  aspect-ratio: 16 / 9;
}

.work-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Preserve the whole composition, including navigation and page edges. */
  transform: none;
  transition: transform 1.05s var(--ease-out-quint), filter 0.7s var(--ease-out-quint);
  filter: none;
}

/* Reveal the card without scaling or cropping the artwork inside it. */
.work-card:not(.is-in) .work-media img {
  transform: none;
  filter: none;
}

/* Labels and artwork are visible together, without a delayed scroll reveal. */
.work-meta {
  opacity: 1;
  transform: none;
}
.work-card.is-in .work-meta { opacity: 1; transform: translateY(0); }

.work-card:hover .work-media img,
.work-card:focus-visible .work-media img {
  transform: none;
  filter: none;
}

/* Sweep that crosses the image on hover — same CRT scan language. */
.work-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.26) 50%,
    transparent 62%
  );
  transform: translateX(-120%);
  transition: transform 0.9s var(--ease-out-quint);
  pointer-events: none;
}
.work-card:hover .work-media::after { transform: translateX(120%); }

.work-index {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 19px;
  color: #fff;
  mix-blend-mode: difference;
  letter-spacing: 0.05em;
}

.work-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}

.work-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(21px, 2.1vw, 34px);
  line-height: 1.08;
  letter-spacing: 0.015em;
  color: var(--fg);
  transition: opacity 0.35s var(--ease-out-quint);
}
.work-card:hover .work-title { opacity: 0.62; }

.work-tag {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-dim);
  white-space: nowrap;
}

.work-empty {
  padding: 80px 0;
  text-align: center;
  font-family: var(--font-ui);
  color: var(--fg-dim);
  letter-spacing: 0.1em;
}

/* ═══════════ SHARED SECTION PRIMITIVES ═══════════
   Used by both the case study and the resume. They live here rather than in
   resume.css because project.html doesn't load that stylesheet. */

.section { padding: clamp(56px, 9vh, 110px) 0 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-bottom: clamp(28px, 4vh, 46px);
}

.section-nr {
  font-family: var(--font-mono);
  font-size: 20px;
  color: rgba(17, 17, 17, 0.42);
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  letter-spacing: 0.02em;
  color: var(--fg);
}

.section-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 9px 15px;
  border: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.68);
  transition: border-color 0.3s var(--ease-out-quint), color 0.3s var(--ease-out-quint);
}
.tag:hover { border-color: var(--border-strong); color: var(--fg); }

/* ═══════════ CASE STUDY ═══════════ */

.case-lede {
  max-width: 34ch;
  margin: clamp(40px, 7vh, 80px) 0 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.1vw, 42px);
  line-height: 1.22;
  letter-spacing: 0.01em;
  color: var(--fg);
}

.case-body {
  max-width: 64ch;
  margin: 0;
  font-size: 16px;
  line-height: 1.78;
  color: rgba(17, 17, 17, 0.76);
}

/* ── Approach steps ── */
.case-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(28px, 4vw, 56px);
  counter-reset: step;
}

.case-step {
  counter-increment: step;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

/* The step number is generated, so the markup stays a plain ordered list. */
.case-step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 19px;
  color: var(--accent);
}

.case-step-title {
  margin: 0 0 9px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 30px);
  letter-spacing: 0.02em;
  color: var(--fg);
}

.case-step-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(17, 17, 17, 0.72);
}

/* ── Stack ── */
.stack-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(26px, 4vw, 56px);
}

.stack-group h3 {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.52);
}

/* ── Outcomes ── */
.case-outcomes {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 68ch;
}

.case-outcomes li {
  position: relative;
  padding: 0 0 18px 30px;
  font-size: 16px;
  line-height: 1.72;
  color: rgba(17, 17, 17, 0.78);
}

.case-outcomes li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 12px;
  height: 1px;
  background: var(--accent);
}

.case-note {
  margin: clamp(40px, 6vh, 68px) 0 0;
  padding: 20px 24px;
  border-left: 2px solid var(--border-strong);
  max-width: 64ch;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.7;
  color: rgba(17, 17, 17, 0.6);
}

@media (max-width: 780px) {
  .case-steps { grid-template-columns: 1fr; }
  .stack-groups { grid-template-columns: 1fr; gap: 30px; }
}

/* ── Footer ── */
.site-foot {
  padding: 40px 0 56px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.site-foot a { color: inherit; text-decoration: none; }
.site-foot a:hover { color: var(--fg); }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 900px) {
  .work-grid { gap: 48px 28px; }
}

@media (max-width: 680px) {
  .work-grid { grid-template-columns: 1fr; padding-top: 44px; }
  .work-card:nth-child(even) { margin-top: 0; }
  .site-foot { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .work-card,
  .work-meta,
  .gallery-figure { opacity: 1 !important; transform: none !important; }

  .page-eyebrow,
  .page-title,
  .page-sub,
  .filters { animation: none !important; }

  /* Without this the un-revealed state would stick, leaving every image
     permanently zoomed and desaturated. */
  .work-card:not(.is-in) .work-media img {
    transform: none !important;
    filter: none !important;
  }

  .work-media::after { display: none; }
}

/* Website previews keep their original proportions and remain separate from
   the project link, so the pause control never nests inside an anchor. */
.work-card-link { display: block; color: inherit; text-decoration: none; }
.work-card-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 8px; }
.work-media--video, .work-media--scroll { aspect-ratio: 16 / 9; }
.work-preview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.work-preview.is-playing { opacity: 1; }
.work-preview-label, .preview-toggle {
  position: absolute;
  z-index: 2;
  padding: 8px 11px;
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.25;
  background: rgba(251,251,251,.94);
  color: #292827;
}
.work-preview-label { right: 14px; bottom: 14px; pointer-events: none; }
.preview-toggle { top: 14px; right: 14px; border: 0; }
.preview-toggle:focus-visible { outline: 2px solid #292827; outline-offset: 3px; }
.preview-toggle[hidden] { display: none; }
.work-card .work-media--scroll img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  transform: translateY(0);
  filter: none;
  transition: transform .65s cubic-bezier(.22,1,.36,1);
}
.work-card .work-media--video > img { transform: none; filter: none; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .work-card:hover .work-media--scroll img {
    transform: translateY(var(--preview-travel, 0px));
    transition: transform var(--preview-duration, 12s) linear;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .work-card-link:focus-visible .work-media--scroll img {
    transform: translateY(var(--preview-travel, 0px));
    transition: transform var(--preview-duration, 12s) linear;
  }
}
@media (max-width: 600px) {
  .work-preview-label, .preview-toggle { padding: 7px 9px; font-size: 8px; }
  .work-preview-label { bottom: 9px; right: 9px; }
  .preview-toggle { top: 9px; right: 9px; }
}

/* Preview controls sit outside the artwork, keeping logos and navigation clear. */
.work-preview-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 34px;
  padding-bottom: 10px;
}
.work-preview-bar .work-index {
  position: static;
  color: rgba(17,17,17,.5);
  mix-blend-mode: normal;
  line-height: 1;
}
.work-preview-bar .work-preview-label {
  position: static;
  padding: 0;
  margin-left: auto;
  background: none;
  color: rgba(17,17,17,.62);
}
.work-preview-bar .preview-toggle {
  position: static;
  padding: 6px 9px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--fg);
}
.page-scroll .page-grain-canvas { opacity: .018; }
.page-scroll .page-scanlines { opacity: .32; }
.page-scroll .bg-noise { opacity: .02; }

/* Cinematic gallery: the homepage room, subdued behind the artwork. */
body.projects-gallery {
  --bg: #0b0c0d;
  --bg-boot: #080909;
  --fg: #f3e8d5;
  --fg-dim: #c4b7a4;
  --fg-dimmer: rgba(243, 232, 213, .06);
  --accent: #d9bc8f;
  --border: rgba(229, 211, 176, .22);
  --border-strong: rgba(229, 211, 176, .48);
  color-scheme: dark;
}

.projects-gallery .bg-layer {
  background:
    linear-gradient(180deg, rgba(6, 8, 11, .35), rgba(6, 8, 11, .78)),
    url('../images/cinematic-interior.webp') center / cover no-repeat,
    #0b0c0d;
}
.projects-gallery .fluid-canvas { opacity: .65; }
@media (prefers-reduced-motion: reduce), (pointer: coarse) {
  .projects-gallery .fluid-canvas { display: none; }
}

body.projects-gallery .site-nav::before {
  background: linear-gradient(180deg, rgba(8, 9, 11, .96), rgba(8, 9, 11, .72) 52%, transparent);
}

.projects-gallery .page-head {
  padding-top: clamp(148px, 19vh, 200px);
}
.projects-gallery .page-eyebrow { color: var(--accent); }
.projects-gallery .page-title { text-shadow: 0 4px 36px rgba(0, 0, 0, .24); }
.projects-gallery .page-sub { color: var(--fg-dim); }
.projects-gallery .filter-btn { background: rgba(8, 9, 11, .38); }
.projects-gallery .filter-btn.is-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.projects-gallery .filter-btn:focus-visible,
.projects-gallery .preview-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.projects-gallery .skip-to-content { color: var(--bg); }

.projects-gallery .work-media {
  background: #141619;
  border: 1px solid var(--border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .24);
  transition: border-color .3s ease;
}
.projects-gallery .work-card:hover .work-media,
.projects-gallery .work-card:focus-within .work-media { border-color: var(--border-strong); }
.projects-gallery .work-preview-bar .work-index { color: var(--accent); }
.projects-gallery .work-preview-bar .work-preview-label { color: var(--fg-dim); }
.projects-gallery .work-meta { flex-wrap: wrap; gap: 10px 20px; }
.projects-gallery .work-title { flex: 1 1 240px; }
.projects-gallery .work-card:hover .work-title { opacity: .85; }
.projects-gallery .page-scanlines { opacity: .1; }
.projects-gallery .page-grain-canvas { opacity: .012; }
.projects-gallery .page-scanner-lines { display: none; }

@media (max-width: 680px) {
  .projects-gallery .page-head { padding-top: 124px; }
  .projects-gallery .filters { gap: 8px; padding-bottom: 32px; }
  .projects-gallery .filter-btn { padding: 11px 14px; letter-spacing: .1em; }
  .projects-gallery .work-meta { flex-direction: column; }
  .projects-gallery .work-title { flex: none; }
}

/* ═══════════ PROJECT DETAIL ═══════════
   Markup comes from tools/build-seo.mjs. The page reads top to bottom as:
   what it is (header + facts) → see it (hero) → understand it (overview
   cards, problem, approach, screens, results, stack) → where next. Body copy
   uses the UI face in sentence case; Bebas is kept for headings only. */

.pd-head,
.pd-hero,
.pd-body,
.pd-gallery { --pd-ink-2: rgba(17, 17, 17, .74); --pd-ink-3: rgba(17, 17, 17, .56); --pd-green: #15803d; --pd-radius: 14px; --pd-surface: rgba(255, 255, 255, .78); }
.project-nav { --pd-radius: 14px; --pd-surface: rgba(255, 255, 255, .78); --pd-ink-3: rgba(17, 17, 17, .56); }

.pd-label {
  display: block;
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pd-ink-3);
}

/* ── Header ── */
.pd-head {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: end;
  padding: clamp(120px, 17vh, 200px) 0 clamp(36px, 6vh, 64px);
}

.project-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pd-ink-3);
  text-decoration: none;
  transition: color .3s var(--ease-out-quint), gap .3s var(--ease-out-quint);
}
.project-back:hover, .project-back:focus-visible { color: var(--fg); gap: 16px; }

.pd-eyebrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.pd-chip {
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--pd-ink-2);
  background: var(--pd-surface);
}
.pd-chip--solid { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.project-title {
  margin: 0;
  max-width: 16ch;
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 116px);
  line-height: .92;
  letter-spacing: .005em;
  color: var(--fg);
  animation: riseIn .8s var(--ease-out-quint) .08s both;
}

.pd-summary {
  max-width: 56ch;
  margin: clamp(22px, 3vh, 32px) 0 0;
  font-size: clamp(17px, 1.3vw, 20px);
  line-height: 1.6;
  color: var(--pd-ink-2);
  animation: riseIn .8s var(--ease-out-quint) .16s both;
}

.project-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.project-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--pd-surface);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.project-action--solid { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.project-action:hover, .project-action:focus-visible { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.project-action--solid:hover, .project-action--solid:focus-visible { background: #000; }

/* Key facts: a hairline grid, so any number of rows lines up. */
.pd-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--border);
  animation: riseIn .8s var(--ease-out-quint) .24s both;
}
.pd-facts--odd .pd-fact:last-child { grid-column: 1 / -1; }
.pd-fact { padding: 16px 18px; background: rgba(251, 251, 251, .94); }
.pd-fact dt {
  margin-bottom: 6px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pd-ink-3);
}
.pd-fact dd { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--fg); }

/* ── Hero ── */
.pd-hero {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--fg-dimmer);
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, .45);
}
.pd-hero img { display: block; width: 100%; height: auto; }
.project-hero--film { background: #e7eddd; scroll-margin-top: 110px; }
.project-film { display: block; width: 100%; aspect-ratio: 16 / 9; background: #e7eddd; }

.gallery-caption {
  margin: 0;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  color: var(--pd-ink-2);
}
.pd-fig {
  margin-right: 12px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pd-green);
}

/* ── Case study body: contents rail + sections ── */
.pd-body {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: clamp(36px, 6vw, 110px);
  padding-top: clamp(56px, 9vh, 110px);
}

.pd-toc { position: sticky; top: 120px; align-self: start; }
.pd-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.pd-toc a {
  display: flex;
  gap: 12px;
  margin-left: -1px;
  padding: 9px 0 9px 16px;
  border-left: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--pd-ink-3);
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}
.pd-toc a span { font-family: var(--font-mono); font-size: 16px; line-height: 1.1; }
.pd-toc a:hover, .pd-toc a:focus-visible { color: var(--fg); }
.pd-toc a[aria-current] { color: var(--fg); border-left-color: var(--pd-green); font-weight: 600; }
.pd-toc a[aria-current] span { color: var(--pd-green); }

.pd-section { padding-bottom: clamp(64px, 10vh, 120px); scroll-margin-top: 110px; }
.pd-h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 clamp(22px, 3vh, 34px);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: clamp(32px, 3.6vw, 52px);
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1;
  color: var(--fg);
}
.pd-nr { font-family: var(--font-mono); font-size: .5em; color: var(--pd-green); }

.pd-lede {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(22px, 2.2vw, 31px);
  font-weight: 500;
  line-height: 1.38;
  letter-spacing: -.012em;
  color: var(--fg);
}

.pd-glance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: clamp(32px, 5vh, 52px);
}
.pd-card {
  padding: 22px 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--pd-surface);
}
.pd-card .pd-label { color: var(--pd-green); }
.pd-card p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--pd-ink-2); }
.pd-card ul { list-style: none; margin: 0; padding: 0; }
.pd-card li {
  position: relative;
  padding: 5px 0 5px 18px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--pd-ink-2);
}
.pd-card li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pd-green);
}

.pd-text { max-width: 66ch; margin: 0; font-size: 17px; line-height: 1.75; color: var(--pd-ink-2); }
.pd-text--large { font-size: clamp(18px, 1.5vw, 21px); line-height: 1.65; color: var(--fg); }

.pd-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
}
.pd-step {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--pd-surface);
}
.pd-step-nr {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1;
}
.pd-step-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--fg); }
.pd-step p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--pd-ink-2); }

/* ── Images ── */
.gallery-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--fg-dimmer);
  box-shadow: 0 30px 70px -48px rgba(0, 0, 0, .4);
  transition: opacity .9s var(--ease-out-quint), transform .9s var(--ease-out-quint);
}
.pd-reveal .gallery-figure:not(.is-in) { opacity: 0; transform: translateY(34px); }
.gallery-figure img { display: block; width: 100%; height: auto; }

.pd-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.pd-zoom img { transition: transform .6s var(--ease-out-quint); }
.pd-zoom:hover img { transform: scale(1.015); }
.pd-zoom:focus-visible { outline: 2px solid var(--fg); outline-offset: -4px; }

.pd-shots { display: grid; gap: clamp(28px, 4vw, 48px); }

/* Image-only projects: a two-column wall instead of a single tall stack. */
.pd-gallery {
  columns: 2;
  column-gap: clamp(16px, 2vw, 28px);
  padding-top: clamp(16px, 2vw, 28px);
}
.pd-gallery .gallery-figure { break-inside: avoid; margin-bottom: clamp(16px, 2vw, 28px); }
.pd-hero--solo { max-width: 960px; margin: 0 auto; }

.pd-lightbox {
  width: min(96vw, 1600px);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-out;
}
.pd-lightbox::backdrop { background: rgba(10, 10, 10, .88); }
.pd-lightbox img { display: block; max-width: 100%; max-height: 94vh; margin: 0 auto; border-radius: 8px; }
.pd-lightbox-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ── Results ── */
.pd-results {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
}
.pd-result {
  display: flex;
  gap: 16px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--pd-surface);
}
.pd-result p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--pd-ink-2); }
.pd-result--stat { flex-direction: column; gap: 6px; }
.pd-stat {
  font-family: var(--font-display);
  font-size: clamp(44px, 4.4vw, 64px);
  line-height: .9;
  color: var(--pd-green);
}
.pd-check {
  flex: none;
  position: relative;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(34, 197, 94, .16);
}
.pd-check::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 5px;
  width: 6px;
  height: 11px;
  border: solid var(--pd-green);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.pd-note {
  max-width: 66ch;
  margin: 24px 0 0;
  padding: 18px 22px;
  border-left: 3px solid var(--pd-green);
  border-radius: 0 var(--pd-radius) var(--pd-radius) 0;
  background: rgba(34, 197, 94, .07);
  font-size: 14px;
  line-height: 1.65;
  color: var(--pd-ink-2);
}
.pd-note .pd-label { margin-bottom: 6px; color: var(--pd-green); }

/* ── Stack ── */
.pd-stack { display: grid; gap: 0; border-top: 1px solid var(--border); }
.pd-stack-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.pd-stack-row .pd-label { margin: 0; }
.pd-stack .tag { border-radius: 999px; background: var(--pd-surface); }

/* ── Previous / next ── */
.project-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: clamp(56px, 9vh, 100px) 0 clamp(64px, 10vh, 120px);
}
.pnav {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--pd-radius);
  background: var(--pd-surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .25s ease, transform .4s var(--ease-out-quint);
}
.pnav:hover, .pnav:focus-visible { border-color: var(--border-strong); transform: translateY(-3px); }
.pnav--next { grid-template-columns: minmax(0, 1fr) 132px; text-align: right; }
.pnav--next .pnav-thumb { order: 2; }
.pnav.is-empty { visibility: hidden; }
.pnav-thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 9px; background: var(--fg-dimmer); }
.pnav-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pnav-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pd-ink-3);
}
.pnav-title { display: block; font-family: var(--font-display); font-size: clamp(22px, 2.2vw, 34px); line-height: 1; color: var(--fg); }
.pnav-meta { display: block; margin-top: 8px; font-size: 13px; color: var(--pd-ink-3); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .pd-glance { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .pd-head { grid-template-columns: 1fr; align-items: start; }
  .pd-body { grid-template-columns: 1fr; }
  .pd-toc { display: none; }
}

@media (max-width: 720px) {
  .pd-steps, .pd-results { grid-template-columns: 1fr; }
  .pd-gallery { columns: 1; }
  .pd-stack-row { grid-template-columns: 1fr; gap: 10px; }
  .project-nav { grid-template-columns: 1fr; }
  .pnav, .pnav--next { grid-template-columns: 96px minmax(0, 1fr); text-align: left; }
  .pnav--next .pnav-thumb { order: 0; }
  .gallery-caption { padding: 14px 16px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .project-title, .pd-summary, .pd-facts { animation: none; }
  .pnav, .pd-zoom img { transition: none; }
  .pnav:hover { transform: none; }
}
