/* Work (01), the scroll story (js/story.js): full-screen chapters for the photographed projects, then bold
   typographic panels for the three jobs without photographs. Static blocks by default; js/motion.js pins the chapters
   (they crossfade in place) and runs the panels sideways on a track (html.pinned). */

.work { padding-top: 0; }
.story { position: relative; }
.st-label { margin: 0; font-size: var(--fs-label); font-weight: 600; line-height: 1.4; letter-spacing: 0.14em; text-transform: uppercase; }
.st-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 22px 0 0; }
.st-links .btn { min-height: 44px; }
.st-links .link-arrow { min-height: 44px; border-bottom: 0; text-decoration: underline 1px; text-underline-offset: 0.3em; text-decoration-color: rgba(var(--on-rgb), 0.45); }
@media (hover: hover) { .st-links .link-arrow:hover { text-decoration-color: var(--amber); } }

/* ---------- chapters ---------- */
.chapters { position: relative; background: var(--ink); }
.chapter { position: relative; min-height: 88vh; min-height: 88svh; display: flex; align-items: flex-end; overflow: hidden; background: var(--ink); }
.ch-media { position: absolute; inset: 0; }
.ch-media img { width: 100%; height: 100%; object-fit: cover; }
.pinned .ch-media img { will-change: transform; }
.chapter::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(var(--ink-rgb), 0.55) 0%, rgba(var(--ink-rgb), 0) 26%, rgba(var(--ink-rgb), 0.1) 46%, rgba(var(--ink-rgb), 0.9) 82%, rgba(var(--ink-rgb), 0.96) 100%),
    linear-gradient(90deg, rgba(var(--ink-rgb), 0.6), rgba(var(--ink-rgb), 0) 65%); }
/* a tall photograph (the Beach Road hall) framed whole on the right instead of cropped to a slice */
.chapter--portrait .ch-media { inset: calc(var(--header-h) + 56px) var(--gutter) 32px auto; width: min(42vw, 620px); }
.chapter--portrait .ch-media img { object-position: 50% 35%; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.chapter--portrait::before { background: linear-gradient(90deg, rgba(var(--ink-rgb), 0.98) 0%, rgba(var(--ink-rgb), 0.9) 48%, rgba(var(--ink-rgb), 0) 70%); }
/* Tengah: the photograph lifted, so the shelter sits above the title rather than under it */
.chapter--lift .ch-media { top: -24%; bottom: 24%; }
.chapter--lift .ch-media img { object-position: 50% 100%; }

.ch-copy { position: relative; z-index: 2; width: 100%; padding: calc(var(--header-h) + 40px) 0 clamp(40px, 9svh, 96px); }
.ch-copy .st-label { color: var(--amber); margin-bottom: 14px; }
.ch-title { margin: 0; font-size: clamp(3rem, 1.2rem + 7.4vw, 9.5rem); font-weight: 900; line-height: 0.86; text-wrap: balance; }
.ch-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 18px 0 0; font-size: 1.0625rem; font-weight: 600; }
.ch-meta span + span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 14px 3px -14px; background: var(--amber); }
.ch-site { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; max-width: 46rem; margin: 20px 0 0; align-items: baseline; }
.ch-site dt { color: var(--amber); }
.ch-site dd { margin: 0; font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem); line-height: 1.4; text-wrap: pretty; }
.ch-bars { display: none; }

/* pinned: the chapters share one screen and crossfade; only the one showing takes the pointer */
.pinned .chapters { height: 100vh; height: 100svh; overflow: hidden; }
.pinned .chapter { position: absolute; inset: 0; min-height: 0; pointer-events: none; }
.pinned .chapter.is-current { pointer-events: auto; }
.pinned .ch-bars { position: absolute; z-index: 3; top: calc(var(--header-h) + 22px); left: 0; right: 0; display: block; pointer-events: none; }
.ch-bars .container { display: flex; align-items: center; gap: 10px; }
.ch-bar { width: 56px; height: 3px; background: rgba(var(--on-rgb), 0.25); overflow: hidden; }
.ch-bar i { display: block; height: 100%; background: var(--amber); transform: scaleX(0); transform-origin: left; }
.ch-count { margin-left: 8px; color: var(--fg); }

/* ---------- typographic panels ---------- */
.panels { position: relative; overflow: hidden; }
.track { display: block; }
.panel { position: relative; min-height: 80vh; min-height: 80svh; display: flex; align-items: center; padding: calc(var(--header-h) + 24px) 0 56px; background: var(--ink); color: var(--fg); }
.panel--ink2 { background: var(--ink-3); }
.panel--paper { --fg: var(--ink); --muted: #4a5a60; --line-strong: rgba(var(--ink-rgb), 0.32); --focus: var(--cobalt); background: var(--paper); color: var(--ink); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 72px); align-items: end; }
.pf { margin: 0; font-family: var(--font-display); font-size: clamp(4rem, 1rem + 13vw, 15rem); font-weight: 900; line-height: 0.82; text-transform: uppercase; }
.pf--long { font-size: clamp(3.2rem, 0.8rem + 8.6vw, 10.5rem); }
.pf-word { display: inline-block; overflow: hidden; vertical-align: top; padding-top: 0.04em; margin-top: -0.04em; }
.pf-word > span { display: inline-block; }
.pf-accent { color: var(--amber); }
.panel--paper .pf-accent { color: var(--cobalt); } /* the deep sea on paper: 5.1:1 */
.pf-line { max-width: 30rem; margin: 18px 0 0; font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem); text-wrap: pretty; }
.p-info .st-label { margin-bottom: 10px; color: var(--amber); }
.panel--paper .p-info .st-label, .panel--paper .p-site b { color: var(--cobalt); }
.p-info h3 { margin: 0; font-size: clamp(1.8rem, 1.2rem + 1.6vw, 2.8rem); line-height: 1; }
.p-meta { margin: 10px 0 0; font-weight: 600; }
.p-site { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid rgba(var(--on-rgb), 0.22); }
.panel--paper .p-site { border-top-color: rgba(var(--ink-rgb), 0.2); }
.p-site b { display: block; margin-bottom: 4px; color: var(--amber); }
.p-site span { font-size: 1.0625rem; }
.panel--paper .btn--primary { --btn-bg: var(--cobalt); --btn-fg: #fff; --btn-bd: var(--cobalt); }
.panel--paper .st-links .link-arrow { text-decoration-color: rgba(var(--ink-rgb), 0.45); }

/* pinned: the panels run sideways, one screen each */
.pinned .panels { height: 100vh; height: 100svh; }
.pinned .track { display: flex; width: max-content; height: 100%; }
.pinned .panel { flex: none; width: 100vw; height: 100%; min-height: 0; }

/* ---------- every project: the grid and the map below the story ---------- */
.work-all { padding-top: var(--section-y); }
.work-all-title { font-size: var(--fs-2xl); max-width: 20ch; text-wrap: balance; }

@media (max-width: 860px) {
  .panel-grid { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 28px; }
}
/* phones and tablets: the quick-contact bar (css/base.css) may sit over the foot of the screen; keep the links clear */
@media (max-width: 1080px) {
  .ch-copy, .panel { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  .chapter--portrait .ch-media { inset: calc(var(--header-h) + 48px) var(--gutter) auto; width: auto; height: 38svh; }
  .chapter--portrait::before { background: linear-gradient(180deg, rgba(var(--ink-rgb), 0) 48%, rgba(var(--ink-rgb), 0.96) 66%); }
  .ch-site { grid-template-columns: minmax(0, 1fr); }
  .ch-meta { gap: 4px 10px; font-size: 0.9375rem; }
  .ch-meta span + span::before { margin: 0 10px 3px 0; }
  .ch-title { font-size: clamp(2.6rem, 13.5vw, 4rem); }
  .pf { font-size: clamp(3.4rem, 22vw, 6rem); }
  .pf--long { font-size: clamp(2.6rem, 13vw, 4.4rem); }
}
/* short screens: tighter, so the copy and the links stay clear of the top */
@media (max-height: 700px) {
  .ch-copy { padding-top: calc(var(--header-h) + 24px); }
  .ch-site { margin-top: 12px; }
  .ch-meta { margin-top: 12px; }
  .st-links { margin-top: 14px; }
  .panel { padding-top: calc(var(--header-h) + 12px); }
  .pf-line { margin-top: 10px; }
  .p-site { margin-top: 10px; padding-top: 10px; }
}
@media (max-width: 720px) and (max-height: 700px) {
  .chapter--portrait .ch-media { height: 32svh; }
  .ch-title { font-size: clamp(2.3rem, 11vw, 3.2rem); }
  .pf--long { font-size: clamp(2.3rem, 11vw, 3.4rem); }
  .pf { font-size: clamp(3rem, 18vw, 4.6rem); }
  .ch-site dd, .p-site span { font-size: 1rem; }
  .pf-line { font-size: 1rem; }
}

/* Chinese */
.lang-zh .st-label { font-size: var(--fs-label-zh); letter-spacing: 0.04em; }
.lang-zh :is(.ch-title, .pf) { line-height: 1.04; letter-spacing: 0.02em; }
.lang-zh .pf-word { padding-top: 0.1em; margin-top: -0.1em; }
/* hanzi are square: the phrase figures a step smaller, each line whole (the data marks the one break) */
.lang-zh .pf-word { white-space: nowrap; }
.lang-zh .pf--long { font-size: clamp(2.4rem, 0.6rem + 5.6vw, 6.6rem); }
.lang-zh :is(.ch-site dd, .p-site span, .pf-line) { word-break: keep-all; overflow-wrap: anywhere; }

@media (forced-colors: active) {
  .ch-meta span + span::before, .ch-bar i { forced-color-adjust: none; background: CanvasText; }
}
