/* ============================================================================
   Anamorphics: /work index (work.php) and project pages (project.php).
   Loaded after tokens -> kit -> site. The first half is the case-study
   vocabulary carried over from the retired case-studies.css (hero, stats,
   meta list, facts, quote, captions, filters); the rest is new.
   ========================================================================= */

/* ================================================== carried primitives */
.workHero { padding: calc(var(--s-9) + 40px) 0 var(--s-8); border-bottom: 1px solid var(--line); }
.workHero__row { display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: var(--s-7); }
.workHero h1.workHero__title { max-width: 14ch; font-size: clamp(38px, 5.2vw, 78px); line-height: 1.08; }
.workHero__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: end; margin-top: var(--s-8); }
.workHero__lede { margin: 0; }
.workHero__stats { display: flex; gap: 48px; justify-content: flex-end; }
.stat { text-align: right; }
.stat__n { font-family: var(--font-display); font-weight: 300; font-size: 46px; line-height: 1;
  letter-spacing: -0.02em; color: var(--fg); }
.stat__n .accent { color: var(--accent-500); }
.stat__l { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 10px; }
@media (max-width: 860px) {
  .workHero__row { flex-direction: column; gap: 12px; align-items: flex-start; }
  .workHero__foot { grid-template-columns: 1fr; gap: 28px; }
  .workHero__stats { justify-content: flex-start; gap: 32px; }
  .stat, .stat__n { text-align: left; }
}

.cs__sub { font-family: var(--font-serif); font-style: italic; font-weight: 300; color: var(--accent-500); }
.cs__lede { font-family: var(--font-serif); font-style: italic; font-weight: 300; font-size: var(--fs-xl);
  line-height: 1.42; color: var(--fg); margin: 0; }
.cs__body { font-size: var(--fs-md); line-height: 1.62; color: var(--fg-2); max-width: 60ch; margin: 0; }
.cs__body + .cs__body { margin-top: 1.1em; }

.meta-list { display: grid; gap: 0; }
.meta-list__row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); }
.meta-list__row:last-child { border-bottom: 1px solid var(--line); }
.meta-list__k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); }
.meta-list__v { font-family: var(--font-sans); font-size: 13px; color: var(--fg); text-align: right; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.facts__cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 24px 22px; }
.facts__n { font-family: var(--font-display); font-weight: 300; font-size: 34px; line-height: 1; letter-spacing: -0.02em; color: var(--fg); }
.facts__n .accent { color: var(--accent-500); }
.facts__l { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 12px; line-height: 1.5; }
@media (max-width: 720px) { .facts { grid-template-columns: repeat(2, 1fr); } }

.cs__quote { font-family: var(--font-serif); font-style: italic; font-weight: 300; font-size: clamp(26px, 3.4vw, 44px);
  line-height: 1.3; color: var(--fg); letter-spacing: -0.01em; text-wrap: balance; margin: 0; max-width: 24ch; }
.cs__quote .q { color: var(--accent-500); }
.cs__cite { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 24px; }
.cs2__quote-block { border-left: 1px solid var(--accent-700); padding-left: 32px; }

figure { margin: 0; }
.fig__cap { display: flex; justify-content: space-between; gap: 16px; padding-top: 12px; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 var(--gutter) var(--s-7); }
.filter { background: transparent; border: 1px solid var(--line); color: var(--fg-2); padding: 9px 16px; border-radius: 0;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out); }
.filter:hover { color: var(--fg); border-color: var(--line-strong); }
.filter.is-active { color: var(--ink-900); background: var(--paper-200); border-color: var(--paper-200); }
.filter:focus-visible { outline: var(--focus-ring); outline-offset: 3px; }

/* ================================================== /work index */
.work-index .am-sw__row.is-hidden { display: none; }
.work-empty { padding: var(--s-6) var(--gutter); color: var(--fg-3); }

.archive { padding: 0 0 var(--s-8); }
.arch-list { list-style: none; margin: 0; padding: 0 var(--gutter); }
.arch-list__row { display: grid; grid-template-columns: 112px 1.4fr 1fr 1fr; gap: 24px; align-items: baseline;
  padding: 16px 0; border-top: 1px solid var(--line); }
.arch-list__row:last-child { border-bottom: 1px solid var(--line); }
.arch-list__year, .arch-list__disc, .arch-list__sector { font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
.arch-list__name { font-family: var(--font-display); font-weight: 300; font-size: 22px; letter-spacing: -0.01em; color: var(--fg-2); }
.arch-list__sector { text-align: right; }
@media (max-width: 720px) {
  .arch-list__row { grid-template-columns: 96px 1fr; row-gap: 4px; }
  .arch-list__disc { grid-column: 2; }
  .arch-list__sector { display: none; }
}

/* ================================================== project: hero */
.pj-hero { position: relative; height: 100vh; min-height: 640px; margin-top: calc(-1 * var(--nav-h-full));
  overflow: hidden; display: flex; }
.pj-hero__media { position: absolute; inset: 0; }
.pj-hero__media .pic, .pj-hero__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* very slow drift as the hero leaves: scroll-driven, CSS only, no JS. Browsers
   without animation-timeline simply don't animate. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .pj-hero__media img { animation: pj-drift linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    @keyframes pj-drift { to { transform: scale(1.08) translateY(4%); } }
  }
}
.pj-hero__scrim { position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(16,13,11,0.92) 0%, rgba(16,13,11,0.35) 45%, rgba(16,13,11,0.55) 100%); }
.pj-hero__inner { position: relative; z-index: 2; width: 100%; display: flex; flex-direction: column;
  justify-content: space-between; padding: calc(var(--nav-h-full) + 24px) var(--gutter) var(--s-7); }
.pj-hero__top .mono { color: var(--fg-2); }
.pj-hero__top { display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid rgba(245,241,234,0.18); padding-bottom: 18px; }
.pj-back { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-2); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
.pj-back:hover { color: var(--accent-500); }
.pj-hero__name { font-family: var(--font-display); font-weight: 300; line-height: 0.94; letter-spacing: -0.035em;
  color: var(--fg); margin: 0 0 var(--s-6); font-size: clamp(52px, 10vw, 168px); text-wrap: balance; width: fit-content; }
.pj-hero__row { display: flex; justify-content: space-between; gap: 24px; align-items: baseline;
  border-top: 1px solid rgba(245,241,234,0.18); padding-top: 18px; }
@media (max-width: 720px) { .pj-hero__row { flex-direction: column; gap: 8px; } }

/* ================================================== project: body */
.pj-body { padding: var(--s-9) 0; }
.pj-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 80px; }
.pj-rail { position: sticky; top: calc(var(--nav-h-condensed) + 32px); align-self: start;
  display: flex; flex-direction: column; gap: 28px; }
.pj-rail__sub { font-size: var(--fs-lg); line-height: 1.4; margin: 0; }
/* "More on": the service pages a project belongs to; also the link under a Highlights section. */
.pj-more { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: 13px; }
.pj-more__k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); }
.pj-more a { color: var(--fg); }
.pj-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pj-toc a { display: grid; grid-template-columns: 30px 1fr; align-items: baseline; padding: 6px 0;
  font-size: 13px; color: var(--fg-3); text-decoration: none; transition: color var(--dur-base) var(--ease-out); }
.pj-toc a:hover { color: var(--fg); }
.pj-toc a.is-current { color: var(--fg); }
.pj-toc__no { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--fg-3);
  transition: color var(--dur-base) var(--ease-out); }
.pj-toc a.is-current .pj-toc__no { color: var(--accent-500); }

.pj-main { display: flex; flex-direction: column; gap: var(--s-8); min-width: 0; }
.pj-lede { max-width: 32ch; font-size: clamp(24px, 2.4vw, 34px); }
.pj-ch { display: flex; flex-direction: column; gap: var(--s-5); scroll-margin-top: calc(var(--nav-h-condensed) + 24px); }
.pj-ch__head { display: grid; grid-template-columns: auto 48px 1fr; align-items: center; gap: 16px; margin-bottom: 4px; }
.pj-ch__no { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--accent-500); }
.pj-ch__rule { height: 1px; background: var(--line-strong); }
.pj-ch__title { font-family: var(--font-display); font-weight: 300; font-size: clamp(26px, 2.6vw, 38px);
  letter-spacing: -0.02em; line-height: 1.1; margin: 0; color: var(--fg); }

/* media: the mosaic (php/mosaic.php). Every chapter spans the column, and every
   row shares one top and bottom edge. PHP solves each box's exact width and
   height as calc() against this container (--w, --h; a frame's --fh), so the
   images keep their own proportions. The 20px gaps and 32px captions here are
   AM_MZ_GAP and AM_MZ_CAP there: change them together. */
.mz { container-type: inline-size; display: flex; flex-direction: column; gap: 20px; margin-top: var(--s-3); }
.mz-row { display: flex; gap: 20px; width: var(--w); height: var(--h); }
.mz-col { display: flex; flex-direction: column; gap: 20px; width: var(--w); height: var(--h); flex: none; }
.mz-leaf { display: flex; flex-direction: column; width: var(--w); height: var(--h); flex: none; margin: 0; min-width: 0; }
.mz .pj-fig__frame, .mz .pj-page__frame { height: var(--fh); flex: none; }
.mz .pj-fig__frame .pic, .mz .pj-fig__frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mz .fig__cap { height: 32px; box-sizing: border-box; flex: none; overflow: hidden; white-space: nowrap; }
.pj-fig__frame { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--ink-800); }
.pj-fig__frame img { transition: transform 1.2s var(--ease-out); }
.pj-fig:hover .pj-fig__frame img { transform: scale(1.02); }
/* no zoom on an image alone in its row (full column width): it moves a lot of
   pixels and hints at a click that isn't there. Pairs and grids keep it.
   Michael, 2026-11-18. */
figure.pj-fig.mz-solo:hover .pj-fig__frame img { transform: none; }

/* pages: a full-length site screenshot in a fixed window. With a mouse, hovering
   (or focusing) pans down the whole page, at a speed set per image (--pan, from
   its length, in project.php) and springs back on leave. On touch, or with
   reduced motion, the window just scrolls natively instead. */
.pj-page__frame { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--ink-800); }
.mz .pj-page__frame .pic { display: block; height: 100%; }
.mz .pj-page__frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0;
  transition: object-position 0.9s var(--ease-out); }
.pj-page__frame::before { content: "↓ Full page"; position: absolute; right: 10px; bottom: 10px; z-index: 1;
  padding: 4px 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper-200); background: rgb(0 0 0 / 0.6); pointer-events: none; transition: opacity 0.3s; }
.pj-page__frame:focus-visible { outline: var(--focus-ring); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .mz .pj-page__frame:hover img, .mz .pj-page__frame:focus-visible img {
    object-position: 50% 100%; transition: object-position var(--pan, 6s) cubic-bezier(.45, 0, .55, 1); }
  .pj-page__frame:hover::before, .pj-page__frame:focus-visible::before { opacity: 0; }
}
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .pj-page__frame { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .mz .pj-page__frame .pic, .mz .pj-page__frame img { height: auto; }
}

@media (max-width: 980px) {
  .pj-grid { grid-template-columns: 1fr; gap: var(--s-7); }
  .pj-rail { position: static; }
  .pj-toc { display: none; }
}
@media (max-width: 720px) {
  /* phones: one image per line, each at its own proportions */
  .mz-row, .mz-col { flex-direction: column; width: auto; height: auto; }
  .mz-leaf { width: auto; height: auto; }
  .mz .pj-fig__frame, .mz .pj-page__frame { height: auto; aspect-ratio: var(--a); }
}

/* before / after compare. A native range input sits over the whole thing, so
   drag, touch, click-to-jump and arrow keys all work with no pointer code;
   js/project.js only maps its value onto --pos. */
.cmp { --pos: 50%; position: relative; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 3;
  background: var(--ink-800); touch-action: pan-y; }
.cmp__layer { position: absolute; inset: 0; }
.cmp__layer .pic, .cmp__layer img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cmp__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp__handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 1px; background: var(--paper-200);
  pointer-events: none; }
.cmp__handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px;
  transform: translate(-50%, -50%); border: 1px solid var(--paper-200); border-radius: 50%;
  background: rgba(16,13,11,0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cmp__label { position: absolute; top: 16px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--paper-200); background: rgba(16,13,11,0.6); padding: 5px 9px; pointer-events: none; }
.cmp__label--before { left: 16px; }
.cmp__label--after { right: 16px; }
.cmp__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.cmp:has(.cmp__range:focus-visible) { outline: var(--focus-ring); outline-offset: 4px; }
/* Screenshots (the CMS page): the frame takes the captures' own shape, so nothing is cropped,
   and the handle gets a darker ring because both layers are light. */
.cmp--screen { aspect-ratio: 1400 / 853; }
.cmp--screen .cmp__handle { background: var(--ink-900, #100D0B); box-shadow: 0 0 0 1px rgba(255,255,255,0.5); }
.cmp--screen .cmp__handle::after { border-color: var(--paper-200); background: rgba(16,13,11,0.82);
  box-shadow: 0 2px 14px rgba(0,0,0,0.35); }
.cmp--screen .cmp__handle::before { content: "\2194"; position: absolute; top: 50%; left: 50%; z-index: 1;
  transform: translate(-50%, -50%); color: var(--paper-200); font-size: 18px; line-height: 1; }
.cmp--screen .cmp__label { top: auto; bottom: 16px; background: rgba(16,13,11,0.85); }

.pj-facts { margin-top: var(--s-5); grid-template-columns: repeat(var(--n, 4), minmax(0, 220px)); }
@media (max-width: 720px) { .pj-facts { grid-template-columns: repeat(min(var(--n, 4), 2), 1fr); } }
.pj-quote { position: relative; }
.pj-quote.is-unverified { opacity: 0.55; border-left-style: dashed; }
.pj-flag { display: inline-block; margin-bottom: 14px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: #E7A86B; border: 1px dashed #E7A86B; padding: 4px 8px; }

.pj-testimonial { border-top: 1px solid var(--line); padding-top: var(--s-6); }
.pj-testimonial blockquote { margin: 0; font-family: var(--font-serif); font-style: italic; font-weight: 300;
  font-size: clamp(20px, 1.9vw, 26px); line-height: 1.5; color: var(--fg); max-width: 46ch; }
.pj-testimonial figcaption { display: flex; flex-direction: column; gap: 4px; margin-top: 20px; }
.pj-testimonial__name { font-size: 14px; color: var(--fg); }
.pj-testimonial__role { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }

/* ================================================== project: next */
.pj-next { position: relative; display: flex; align-items: flex-end; min-height: 72vh; overflow: hidden;
  text-decoration: none; color: var(--fg); border-top: 1px solid var(--line); isolation: isolate; }
.pj-next__media { position: absolute; inset: 0; z-index: -2; }
.pj-next__media .pic, .pj-next__media img { display: block; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.04); filter: saturate(0.7) brightness(0.8);
  transition: transform 1.4s var(--ease-out), filter var(--dur-slow) var(--ease-out); }
.pj-next__scrim { position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(16,13,11,0.94), rgba(16,13,11,0.45) 60%, rgba(16,13,11,0.7)); }
.pj-next__inner { display: flex; flex-direction: column; gap: 18px; padding: var(--s-8) var(--gutter); width: 100%; }
.pj-next__label { color: var(--fg-2); }
.pj-next__name { font-family: var(--font-display); font-weight: 300; font-size: clamp(44px, 8vw, 132px);
  line-height: 0.94; letter-spacing: -0.035em; transition: color var(--dur-base) var(--ease-out); }
.pj-next__disc { display: flex; justify-content: space-between; border-top: 1px solid rgba(245,241,234,0.18);
  padding-top: 18px; color: var(--fg-2); }
.pj-next__arrow { display: inline-block; transition: transform var(--dur-base) var(--ease-out); }
.pj-next:hover .pj-next__media img, .pj-next:focus-visible .pj-next__media img { transform: scale(1); filter: none; }
.pj-next:hover .pj-next__name { color: var(--accent-500); }
.pj-next:hover .pj-next__arrow { transform: translateX(8px); }

/* ================================================== local-only review */
.pj-review { position: fixed; right: 16px; bottom: 16px; z-index: 60; max-width: min(460px, calc(100vw - 32px));
  background: rgba(16,13,11,0.94); border: 1px dashed #E7A86B; color: var(--fg); font-size: 13px; line-height: 1.5;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pj-review summary { cursor: pointer; padding: 10px 14px; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: #E7A86B; }
.pj-review ol { margin: 0; padding: 0 18px 14px 34px; max-height: 50vh; overflow: auto; display: grid; gap: 8px; color: var(--fg-2); }
.pic-missing { padding: 24px; border: 1px dashed #E7A86B; color: #E7A86B; font-family: var(--font-mono); font-size: 11px; }

/* a mosaic piece that links somewhere (Highlights): the whole tile is the link,
   the caption's right side turns accent on hover */
.mz-link { color: inherit; text-decoration: none; }
.mz-link:hover .fig__cap span:last-child, .mz-link:focus-visible .fig__cap span:last-child { color: var(--accent-500); }
.mz-link:focus-visible { outline: var(--focus-ring); outline-offset: 4px; }
