/* Work (01): project grid, filters and map view (js/projects.js, js/work-map.js, js/work-panel.js). The case-study
   dialog's rules are in css/case-study.css, which js/case-study.js loads with the dialog's code, off the first paint. */

.work [hidden], .case-study [hidden] { display: none !important; }

/* ---------- toolbar ---------- */
/* after a chip click the toolbar may scroll up (js/projects.js); html's scroll-padding already clears the header */
.work-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-bottom: clamp(32px, 4vw, 56px); padding-bottom: 18px; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.work-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.work-views { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; }
.work-views .chip { border-color: transparent; min-height: 32px; padding-inline: 16px; }
.work-toolbar .chip { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; }
@media (hover: hover) { .work-toolbar .chip:hover { border-color: var(--fg); } }
.work-toolbar .chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.work-filters .chip::before { content: ""; width: 6px; height: 6px; flex: none; border: 1px solid currentColor; transition: background var(--t-fast) var(--ease); }
.work-filters .chip[aria-pressed="true"]::before { background: var(--amber); border-color: var(--amber); }
/* project count per chip (aria-hidden: the result line below says it in words) */
.chip-n { font-variant-numeric: tabular-nums; opacity: 0.6; }
.chip[aria-pressed="true"] .chip-n { opacity: 1; }
/* "Showing 4 of 6 projects": the filter's live region, visible between the filters and the view switch */
.work-count { margin: 0 0 0 auto; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.04em; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .work-toolbar .chip, .work-views .chip { min-height: 44px; } }
@media (forced-colors: active) { .work-toolbar .chip[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; } }

/* ---------- static project links (generated into #work-grid for crawlers and no-JS visits; the cards replace them) ---------- */
.wk-static { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.wk-static a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; padding: 18px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.wk-static-t { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); line-height: 1.1; }
.wk-static-s { font-size: var(--fs-sm); color: var(--muted); }
.wk-static a:hover .wk-static-t { color: var(--amber); }

/* ---------- editorial grid: slot n sets span and media aspect (see LAYOUT in js/work-shared.js) ---------- */
.work-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2.2vw, 32px); row-gap: clamp(48px, 5.5vw, 88px); align-items: start; }
.wk-item { --span: 6; --ar: 4 / 3; grid-column: span var(--span); min-width: 0; }
.wk-item[data-slot="1"] { --span: 8; --ar: 16 / 10; }
.wk-item[data-slot="2"] { --span: 4; --ar: 10 / 13; }
.wk-item[data-slot="3"] { --span: 7; --ar: 3 / 2; }
.wk-item[data-slot="4"] { --span: 5; --ar: 21 / 20; }
.wk-item[data-slot="5"] { --span: 5; --ar: 21 / 20; }
.wk-item[data-slot="6"] { --span: 7; --ar: 3 / 2; }

/* ---------- card ----------
   Cards render in their final state. Hover (only where a pointer can hover, so a tap never leaves it stuck on) eases
   the photo in a little and draws the corners in amber; a press (any pointer) gives the image a small give. Keyboard
   focus has the same cues as hover. Reduced motion keeps the colour changes and drops the transforms. */
.wk-card { display: block; color: inherit; text-decoration: none; outline: none; -webkit-tap-highlight-color: transparent; }
.wk-media { --grid: transparent; position: relative; aspect-ratio: var(--ar); overflow: hidden; isolation: isolate; transition: transform 160ms var(--ease);
  background-color: var(--blueprint); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; background-position: -1px -1px; }
.wk-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wk-media img.is-missing { display: none; }
.wk-photo { transition: transform 300ms var(--ease); }
/* a photo card waits on a plain dark ground; the panels and the missing-photo note sit on raised slate */
.wk-media:not(.wk-media--panel):not(.no-photo) { background: var(--ink-2); }
.wk-card:focus-visible .wk-media { outline: 2px solid var(--focus); outline-offset: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .wk-card:active .wk-media { transform: scale(0.985); transition-duration: 100ms; }
}

/* registration corners (--w: tick thickness, 2 px on hover / focus) */
.wk-frame { --c: rgba(var(--on-rgb), 0.6); --l: 14px; --w: 1px; position: absolute; inset: 8px; z-index: 3; pointer-events: none; opacity: 0.8; transition: opacity var(--t-med) var(--ease);
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--l) var(--w), linear-gradient(var(--c), var(--c)) left top / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) right top / var(--l) var(--w), linear-gradient(var(--c), var(--c)) right top / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) left bottom / var(--l) var(--w), linear-gradient(var(--c), var(--c)) left bottom / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) right bottom / var(--l) var(--w), linear-gradient(var(--c), var(--c)) right bottom / var(--w) var(--l);
  background-repeat: no-repeat; }
.wk-card:focus-visible .wk-frame { --c: var(--amber); --w: 2px; opacity: 1; }

/* missing photo: a short note on the raised slate */
.wk-fallback { position: absolute; left: 16px; bottom: 14px; z-index: 2; display: none; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.16em; text-transform: uppercase; color: var(--blueprint-line); }
.wk-media.no-photo .wk-fallback { display: block; }

/* "Before / after" on the card of a project with a comparison (Tengah); static, so it reads on touch too */
.wk-tag { position: absolute; left: 16px; top: 16px; z-index: 4; padding: 5px 10px 4px; font-size: var(--fs-label, 0.75rem); line-height: 1.3; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; background: rgba(var(--ink-rgb), 0.78); border-left: 2px solid var(--amber); }

/* ---------- typographic panel: projects without photography (js/work-panel.js; card and case study) ----------
   Client and years top left, a small Singapore outline with the location dot(s) top right, the key figure or
   phrase set large at the foot. Sizes follow the panel's own width (container query units). */
.wk-media--panel, .csg-stage--panel { container-type: inline-size; color: var(--blueprint-line); }
.wk-panel { position: absolute; inset: 0; }
.pn { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; column-gap: 16px; padding: clamp(18px, 6.5cqi, 40px); }
.pn p { margin: 0; }
.pn-meta { grid-area: 1 / 1; display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-label, 0.75rem); line-height: 1.5; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blueprint-line); }
.pn-meta::before { content: ""; width: 18px; height: 1px; flex: none; margin-top: 0.75em; background: var(--amber); }
.pn-meta-t { display: flex; flex-wrap: wrap; gap: 2px 1.2em; }
.pn-meta-t > span { white-space: nowrap; }
.pn-meta-t > span + span { opacity: 0.72; }
.pn-map { position: relative; grid-area: 1 / 2 / 3 / 3; align-self: start; width: clamp(92px, 32cqi, 230px); aspect-ratio: 1000 / 584; }
.pn-map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pn-land { fill: rgba(211, 226, 224, 0.07); stroke: rgba(211, 226, 224, 0.6); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pn-dot { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--blueprint); }
.pn-dot::before { content: ""; position: absolute; inset: -5px; border: 1px solid var(--amber); border-radius: 50%; opacity: 0.45; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease); }
.wk-card:focus-visible .pn-dot::before { transform: scale(1.7); opacity: 1; }
.pn-key { grid-area: 3 / 1 / 4 / 3; display: grid; justify-items: start; gap: clamp(8px, 2cqi, 14px); }
.pn-fig { max-width: 100%; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 9.5cqi, 4.4rem); line-height: 0.96; letter-spacing: -0.02em; color: #fff; text-wrap: balance; }
.pn-w { white-space: nowrap; }
.pn-fig--num { font-size: clamp(4.5rem, 33cqi, 13rem); line-height: 0.8; letter-spacing: -0.045em; }
.pn-line { max-width: 34ch; font-size: clamp(0.9rem, 3.4cqi, 1.25rem); line-height: 1.35; color: var(--blueprint-line); text-wrap: pretty; }
.wk-card:focus-visible .pn-fig { color: var(--amber-soft); }
.pn-fig { transition: color var(--t-med) var(--ease); }
/* case study: the same panel, larger */
.pn--lg { padding: clamp(24px, 5.5cqi, 64px); }
.pn--lg .pn-meta { font-size: 13px; }
.pn--lg .pn-map { width: clamp(130px, 36cqi, 460px); }
.pn--lg .pn-dot { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; }
.pn--lg .pn-fig { font-size: clamp(2.2rem, 8cqi, 5.6rem); }
.pn--lg .pn-fig--num { font-size: clamp(5rem, 26cqi, 15rem); }
.pn--lg .pn-line { font-size: clamp(1rem, 2.4cqi, 1.4rem); }
.lang-zh .pn-fig { letter-spacing: 0.02em; word-break: keep-all; overflow-wrap: anywhere; }
.lang-zh .pn-fig--num { letter-spacing: -0.03em; }

/* meta: service, title, the 'On site' line, then client · years */
.wk-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; padding-top: 18px; }
.wk-meta p { margin: 0; }
.wk-line, .wk-title, .wk-challenge { grid-column: 1 / -1; }
.wk-line { display: flex; align-items: center; gap: 0; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.wk-title { margin-top: 10px; font-size: var(--fs-lg); letter-spacing: -0.01em; line-height: 1.08; }
.wk-title { background: linear-gradient(currentColor, currentColor) left 100% / 0 1px no-repeat; transition: background-size 500ms var(--ease); padding-bottom: 3px; justify-self: start; }
.wk-card:focus-visible .wk-title { background-size: 100% 1px; }
/* the site condition the job was built around, behind the 18 px amber rule used for every annotation */
.wk-meta .wk-challenge { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; font-family: var(--font-body); font-size: var(--fs-support, 0.9375rem); line-height: 1.45; color: var(--fg); text-wrap: pretty; }
.wk-challenge::before { content: ""; flex: none; width: 18px; height: 1px; margin-top: 0.72em; background: var(--amber); }
/* the Chinese 'On site' lines break at their own punctuation (，；), not one character short of a phrase */
.lang-zh :is(.wk-challenge, .cs-onsite-t) { word-break: keep-all; overflow-wrap: anywhere; }
/* client · years and "View project" share one row over one continuous hairline */
.wk-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--line); }
.wk-info, .wk-view { font-size: var(--fs-label, 0.75rem); letter-spacing: 0.1em; text-transform: uppercase; }
.wk-info { min-width: 0; color: var(--muted); text-wrap: balance; } /* on two lines the years stay whole ("2021 – / 2022" no more) */
.wk-view { display: inline-flex; gap: 8px; color: var(--fg); white-space: nowrap; transition: color var(--t-fast) var(--ease); }
.wk-arrow { transition: transform 160ms var(--ease); }
.wk-card:focus-visible .wk-view { color: var(--amber); }
@media (hover: hover) {
  .wk-card:hover .wk-frame { --c: var(--amber); --w: 2px; opacity: 1; }
  .wk-card:hover .pn-dot::before { transform: scale(1.7); opacity: 1; }
  .wk-card:hover .pn-fig { color: var(--amber-soft); }
  .wk-card:hover .wk-title { background-size: 100% 1px; }
  .wk-card:hover .wk-view { color: var(--amber); }
}
@media (prefers-reduced-motion: no-preference) {
  .wk-card:focus-visible .wk-arrow { transform: translateX(4px); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .wk-card:hover .wk-photo { transform: scale(1.03); }
  .wk-card:hover .wk-arrow { transform: translateX(4px); }
}

/* ---------- map view ---------- */
.wm { display: grid; gap: 14px; }
.wm-head { display: flex; justify-content: space-between; gap: 16px; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.wm-frame { position: relative; padding: clamp(12px, 2.4vw, 32px); border: 1px solid var(--line); background: var(--ink-2); }
/* the stage is a size container: which labels show follows its own width (it is held to the window's height too) */
.wm-stage { container: wm-stage / inline-size; position: relative; aspect-ratio: 1000 / 584; max-width: max(320px, calc((100svh - 300px) * 1.712)); margin-inline: auto; }
.wm-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.wm-grat { fill: none; stroke: rgba(var(--on-rgb), 0.07); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wm-land { fill: rgba(var(--soft-rgb), 0.08); stroke: rgba(var(--on-rgb), 0.55); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.wm-hull { fill: rgba(var(--soft-rgb), 0.05); stroke: rgba(var(--soft-rgb), 0.5); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; transition: opacity var(--t-med) var(--ease); }
.wm-hull.is-off { opacity: 0; }
.wm-gls { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-mono); font-size: var(--fs-label, 0.75rem); letter-spacing: 0.04em; color: rgba(169, 184, 185, 0.75); }
.wm-gl { position: absolute; padding: 0 3px; background: rgba(var(--ink2-rgb), 0.88); white-space: nowrap; } /* clear of the coastline */
.wm-gl--lon { top: 2px; left: calc(var(--x) * 1%); padding-left: 5px; }
.wm-gl--lat { left: 2px; top: calc(var(--y) * 1%); transform: translateY(15%); } /* under its line, clear of Tengah's label */
.wm-north { position: absolute; top: 11%; right: 1.5%; display: grid; justify-items: center; gap: 3px; font-size: var(--fs-label, 0.75rem); line-height: 1.2; color: var(--fg); }
.wm-north::before { content: ""; border: 4px solid transparent; border-top: 0; border-bottom: 8px solid var(--amber); }
.wm-north::after { content: ""; width: 1px; height: 22px; background: linear-gradient(var(--line-strong), transparent); }
.wm-scale { position: absolute; right: 2.5%; bottom: 4%; width: var(--w); height: 24px; font-size: var(--fs-label, 0.75rem); line-height: 1.2; color: var(--muted); }
.wm-scale-bar { position: absolute; inset: 0 0 auto; height: 5px; border: 1px solid rgba(var(--on-rgb), 0.6); background: linear-gradient(90deg, rgba(var(--on-rgb), 0.6) 50%, transparent 50%); }
.wm-scale > span:not(.wm-scale-bar) { position: absolute; top: 9px; transform: translateX(-50%); white-space: nowrap; }
.wm-scale > span:nth-child(2) { left: 0; transform: none; }
.wm-scale > span:nth-child(3) { left: 50%; }
.wm-scale > span:nth-child(4) { left: 100%; transform: translateX(-70%); }

/* pins: 44 px targets around a small survey-point mark */
.wm-pins { position: absolute; inset: 0; }
.wm-pin { --pin: var(--off-white); position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); z-index: 1; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--pin); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: opacity var(--t-med) var(--ease), visibility 0s; }
.wm-pin::before { content: ""; position: absolute; inset: 12px; border: 1px solid currentColor; border-radius: 50%; opacity: 0.5; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease); }
.wm-pin::after { content: ""; position: absolute; inset: 18px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px var(--ink-2); }
.wm-pin--private { --pin: var(--amber); z-index: 2; }
.wm-pin--public { --pin: var(--off-white); z-index: 2; }
.wm-pin--cluster { --pin: #b4c4c6; }
.wm-pin--cluster::after { inset: 18.5px; background: var(--ink-2); border: 1.5px solid currentColor; box-shadow: none; }
.wm-pin--cluster::before { opacity: 0.25; }
.wm-pin:hover::before, .wm-pin.is-hot::before, .wm-pin.is-active::before, .wm-pin:focus-visible::before { transform: scale(1.75); opacity: 1; }
.wm-pin:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.wm-pin.is-off { opacity: 0; visibility: hidden; transition: opacity var(--t-med) var(--ease), visibility 0s linear var(--t-med); }
.wm-pin-label { position: absolute; top: 50%; left: 36px; transform: translateY(-50%); padding: 3px 6px 2px; background: rgba(var(--ink2-rgb), 0.78); color: var(--fg); font-size: var(--fs-label, 0.75rem); line-height: 1.25; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; pointer-events: none; }
.wm-pin-label[data-side="left"] { left: auto; right: 36px; }
/* two labels that would meet on a narrower stage (js/work-map.js LABEL_V): one hangs just below its pin line, one sits just above */
.wm-pin-label[data-v="down"] { transform: translateY(-3px); }
.wm-pin-label[data-v="up"] { transform: translateY(calc(-100% + 3px)); }
.wm-pin--cluster .wm-pin-label { color: #b4c4c6; }
/* phones: the pin's number in the grid (01–06), upper right of the mark; the list under the map names them */
.wm-pin-no { position: absolute; left: 27px; bottom: 27px; display: none; padding: 1px 3px 0; background: var(--ink-2); color: currentColor; font-size: var(--fs-label, 0.75rem); line-height: 1.2; letter-spacing: 0.04em; pointer-events: none; }
.wm-pin-no[data-at] { bottom: auto; top: 50%; transform: translateY(-50%); } /* beside the mark (js/work-map.js NUMBER_AT) */
.wm-pin-no[data-at="right"] { left: 31px; }
.wm-pin-no[data-at="left"] { left: auto; right: 31px; }

/* tooltip card (hover / focus) and the inline card used on touch and narrow screens */
.wm-tip { --tx: translateX(24px); --ty: translateY(-50%); position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); z-index: 6; width: min(270px, 70vw); padding: 14px 16px 14px; border: 1px solid var(--line-strong); border-top: 2px solid var(--amber); background: var(--ink); pointer-events: none; opacity: 0; transform: var(--tx) var(--ty) translateY(6px); transition: opacity 180ms var(--ease), transform 260ms var(--ease); }
.wm-tip[data-h="left"] { --tx: translateX(calc(-100% - 24px)); }
.wm-tip[data-v="above"] { --ty: translateY(calc(-100% + 14px)); }
.wm-tip[data-v="below"] { --ty: translateY(-14px); }
.wm-tip.is-on { opacity: 1; transform: var(--tx) var(--ty); pointer-events: auto; cursor: pointer; }
.wm-tip p, .wm-sheet p { margin: 0; }
.wm-c-line { display: flex; align-items: center; gap: 8px; margin-bottom: 8px !important; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.wm-c-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--off-white); }
.wm-c-dot--private { background: var(--amber); }
.wm-c-dot--cluster { background: transparent; border: 1.5px solid #b4c4c6; }
.wm-c-title { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; line-height: 1.1; }
.wm-c-meta { margin-top: 6px !important; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.06em; color: var(--muted); }
.wm-c-coord { margin-top: 10px !important; padding-top: 8px; border-top: 1px solid var(--line); font-size: var(--fs-label, 0.75rem); color: var(--muted); }
.wm-c-hint { margin-top: 10px !important; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.wm-c-cta { margin-top: 14px; min-height: 44px; }
.wm-sheet { display: none; }
.wm-sheet-hint { font-size: var(--fs-label, 0.75rem); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.wm-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 28px; font-size: var(--fs-label, 0.75rem); letter-spacing: 0.04em; color: var(--muted); }
.wm-foot p { margin: 0; }
.wm-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.wm-legend li { display: inline-flex; align-items: center; gap: 8px; }
.wm-key { width: 9px; height: 9px; border-radius: 50%; background: var(--off-white); }
.wm-key--private { background: var(--amber); }
.wm-key--cluster { background: transparent; border: 1.5px solid #b4c4c6; }
.wm-attr { flex-basis: 100%; opacity: 0.8; }
/* phones: the projects as 48 px rows under the map; a row selects its pin (js/work-map.js) */
.wm-list { display: none; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.wm-row { --pin: var(--off-white); display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 4px 8px 8px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--fg); text-align: left; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.wm-row[data-kind="private"] { --pin: var(--amber); }
.wm-row[data-kind="cluster"] { --pin: #b4c4c6; }
.wm-row-no { font-size: var(--fs-label, 0.75rem); color: var(--pin); }
.wm-row-t { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; line-height: 1.2; }
.wm-row-s { font-size: var(--fs-sm); color: var(--muted); text-align: right; }
.wm-row[aria-pressed="true"] { box-shadow: inset 2px 0 0 var(--amber); } /* clear of the number: the row's 8 px start inset */
.wm-row[aria-pressed="true"] .wm-row-t { color: var(--amber); }
.wm-row:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
@media (max-width: 900px) { .wm-pin-label { display: none; } }
/* 12 / 13 px labels need room: below 700 px of stage (short windows) the pins are named by their hover / focus card,
   as on tablets; the decorative lat / long ticks thin to every 0.1° and leave phones altogether (aria-hidden) */
@container wm-stage (max-width: 699.98px) { .wm-pin-label { display: none; } }
@container wm-stage (max-width: 899.98px) { .wm-gl[data-odd] { display: none; } }
@container wm-stage (max-width: 419.98px) { .wm-gls { display: none; } }
@media (max-width: 720px) { .wm-pin-no, .wm-list { display: block; } }
@media (hover: none), (max-width: 720px) {
  .wm-tip { display: none !important; }
  .wm-sheet { display: block; min-height: 64px; padding: 16px; border: 1px solid var(--line); border-top: 2px solid var(--amber); background: var(--ink-2); }
  .wm-pin::before { inset: 10px; }
  .wm-pin::after { inset: 16.5px; }
  .wm-pin--cluster::after { inset: 17px; }
}
@media (max-width: 520px) { .wm-head { flex-direction: column; gap: 4px; } .wm-scale > span:nth-child(3) { display: none; } }

/* Chinese labels: a little larger, with less tracking than the Latin caps (the case study's are in css/case-study.css) */
.lang-zh :is(.wk-line, .wk-info, .wk-view, .wk-fallback, .wk-tag, .pn-meta, .wm-head, .wm-c-line, .wm-c-meta, .wm-c-coord, .wm-c-hint,
  .wm-sheet-hint, .wm-foot, .wm-pin-label, .work-count, .work-toolbar .chip) { font-size: var(--fs-label-zh, 0.8125rem); letter-spacing: 0.04em; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .wk-item[data-slot="1"] { --span: 7; --ar: 4 / 3; }
  .wk-item[data-slot="2"] { --span: 5; --ar: 15 / 16; }
  .wk-item[data-slot="3"], .wk-item[data-slot="4"], .wk-item[data-slot="5"], .wk-item[data-slot="6"] { --span: 6; --ar: 4 / 3; }
}
@media (max-width: 720px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); row-gap: 52px; }
  .wk-item, .wk-item[data-slot] { grid-column: 1 / -1; --ar: 4 / 3; }
  .wk-item[data-slot="2"] { --ar: 4 / 5; }
  /* the chips in one row that scrolls sideways edge to edge (faded at the ends); the result line and the
     Projects / Map switch share the next line. The block padding keeps focus rings clear of the scroll clip; the end
     padding (24 px fade + the ring) lets the last chip, and any chip js/projects.js slides to its scroll-padding,
     clear the fade. The start is held to the same 8 px of clearance: chips slide to the gutter + 8 px, and the start
     fade stops 6 px short of the gutter, so even the first chip at rest keeps its 5 px focus ring out of the fade.
     No scroll snap: it pulled a chip the script had just slid clear back under the fade. A chip is never wider than
     the clear part of the row (the longest label wraps on the narrowest phones). */
  .work-filters { flex: none; width: calc(100% + var(--gutter) * 2); flex-wrap: nowrap; overflow-x: auto; scroll-padding-inline: calc(var(--gutter) + 8px) 32px; scrollbar-width: none;
    margin: -6px calc(var(--gutter) * -1); padding: 6px 32px 6px var(--gutter);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 calc(var(--gutter) - 6px), #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 calc(var(--gutter) - 6px), #000 calc(100% - 24px), transparent); }
  .work-filters::-webkit-scrollbar { display: none; }
  .work-filters .chip { flex: none; max-width: 100%; text-align: left; }
  .work-toolbar { column-gap: 12px; }
  .work-count { flex: 1 1 0; min-width: 0; margin-left: 0; } /* wraps onto two lines before it pushes the switch down */
  .work-views .chip { padding-inline: 12px; }
}
/* the smallest phones: chips a little tighter, so the longest label (EN Private homes & conservation) still fits the
   clear part of the row on one line at 320 px instead of wrapping */
@media (max-width: 359.98px) { .work-filters .chip { gap: 6px; padding-inline: 10px; letter-spacing: 0.03em; } }

/* Windows High Contrast: the selected map row is marked by amber text and an inset shadow, which forced colours
   flatten; mark it in system colours (last, so it wins over the states above). The case study's: css/case-study.css */
@media (forced-colors: active) {
  .wm-row[aria-pressed="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .wm-row[aria-pressed="true"] :is(.wm-row-no, .wm-row-t, .wm-row-s) { color: HighlightText; }
  /* the amber rule before each card's On-site line would paint as Canvas and leave a gap */
  .wk-challenge::before { forced-color-adjust: none; background: CanvasText; }
  /* the north arrow's transparent borders would paint too */
  .wm-north::before { forced-color-adjust: none; border-color: transparent; border-bottom-color: CanvasText; }
}
