/* ==========================================================================
   Monograph: Jimmy Cheng Hiang Jong
   White and khaki. Instrument Serif carries the voice (as on the live site),
   Hanken Grotesk carries the reading. Engine styles live in
   vendor/scrollcraft/scrollcraft.css and are themed here through tokens only.
   Everything that moves every frame moves by transform or opacity.
   ========================================================================== */
:root {
  --sc-canvas: #FFFFFF;
  --sc-surface: #F6F4EF;            /* near-white, only behind images while they load */
  --sc-ink: #1F1D19;
  --sc-ink-soft: #5F584A;
  --sc-accent: #B9A47A;
  --sc-accent-ink: #1F1D19;
  --sc-font-display: "Instrument Serif", Georgia, serif;
  --sc-font-text: "Hanken Grotesk", system-ui, sans-serif;
  --sc-font-mono: "Hanken Grotesk", system-ui, sans-serif;
  --sc-shadow-color: 40 25% 30%;
  --sc-edge: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  --khaki-deep: #CBBB98;
  --khaki-label: #7A6845;
  --hair: color-mix(in oklab, var(--sc-ink) 14%, transparent);
  --wall: #FFFFFF;
  --khaki-pale: #F5F1E8;            /* the one warm ground: the contact page */
  --bar-h: 60px;

  /* scale: everything one notch smaller than the engine defaults */
  --sc-t-sm:   clamp(0.8rem, 0.78rem + 0.12vw, 0.88rem);
  --sc-t-base: clamp(0.94rem, 0.9rem + 0.16vw, 1.03rem);
  --sc-t-lg:   clamp(1.08rem, 1rem + 0.35vw, 1.3rem);
  --sc-t-xl:   clamp(1.3rem, 1.15rem + 0.7vw, 1.75rem);
  --sc-t-2xl:  clamp(1.7rem, 1.35rem + 1.5vw, 2.5rem);
  --sc-t-3xl:  clamp(2.2rem, 1.55rem + 2.7vw, 3.7rem);
  --sc-section: clamp(3.8rem, 6.5vw, 8rem);
  --sc-gutter:  clamp(1.1rem, 4vw, 4rem);
  --sc-maxw:    76rem;
}

/* ---------- base ---------- */
html.smooth-scroll { scroll-behavior: auto; }
body { font-weight: 400; }
::selection { background: var(--sc-accent); color: var(--sc-ink); }
:focus-visible { outline: 1.5px solid var(--khaki-label); outline-offset: 3px; }
img { height: auto; }
.mono { font-family: var(--sc-font-display); font-style: italic; font-size: var(--sc-t-base); letter-spacing: 0; line-height: 1.3; }
.label { color: var(--khaki-label); }
/* Justified like the live site: whole words only, last line left, no automatic word splitting. */
.justify { text-align: justify; text-align-last: left; text-justify: inter-word; hyphens: manual; -webkit-hyphens: manual; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--sc-gutter); top: -100px; z-index: 100; padding: var(--sc-2) var(--sc-3); background: var(--sc-ink); color: var(--sc-canvas); }
.skip:focus { top: var(--sc-2); }
.ground-white { background: var(--sc-canvas); color: var(--sc-ink); }
.ground-khaki { background: var(--sc-surface); color: var(--sc-ink); }
.ground-deep { background: var(--khaki-pale); color: var(--sc-ink); --sc-ink-soft: #4E473A; --hair: rgba(31, 29, 25, .16); }
h1, h2, h3, .fp-name, .colophon-line, .profile-lead, .index-list strong, .pager strong, .work-meta h3, .rail-end strong,
.arch-cats strong, .arch-row strong, .arch-interior strong, .sheet-title .sub, .fp-caption strong, .record-block li strong {
  font-family: var(--sc-font-display); font-weight: 400; letter-spacing: -0.012em;
}
/* a link whose underline draws in from the left */
.rail-end .go, .sheet-return, .fp-caption a, .index-contact a {
  text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px;
  transition: background-size 420ms var(--sc-ease-out), color 160ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .rail-end .go, .sheet-return, .fp-caption a, .index-contact a { background-size: 0% 1px; }
  .rail-end:hover .go, .sheet-return:hover, .fp-caption a:hover, .index-contact a:hover { background-size: 100% 1px; }
}

/* ---------- header: logo, a floating capsule of sections, a round menu button ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: var(--sc-z-chrome); height: var(--bar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sc-5);
  padding-inline: var(--sc-gutter); pointer-events: none;
  transition: transform 560ms var(--sc-ease-out);
}
.bar > * { pointer-events: auto; }
.bar.is-tucked { transform: translateY(-130%); }
.index-open .bar { transform: none; }
.bar-brand { justify-self: start; display: block; padding: 6px; text-decoration: none; }
.capsule { position: relative; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); border: 1px solid color-mix(in oklab, var(--sc-ink) 12%, transparent);
  box-shadow: 0 12px 32px -20px hsl(var(--sc-shadow-color) / .6); font-size: 0.84rem;
  transition: opacity 300ms var(--sc-ease-out), transform 300ms var(--sc-ease-out); }
.capsule a { position: relative; z-index: 1; padding: 7px 14px; border-radius: 999px; text-decoration: none; white-space: nowrap; transition: color 300ms var(--sc-ease-out), background-color 200ms var(--sc-ease-out); }
.capsule a.is-active, .capsule a[aria-current="page"] { color: var(--sc-canvas); }
.capsule-pill { position: absolute; left: 0; top: 4px; bottom: 4px; width: 0; border-radius: 999px; background: var(--sc-ink); opacity: 0;
  transition: transform 520ms var(--sc-ease-out), width 520ms var(--sc-ease-out), opacity 300ms var(--sc-ease-out); }
@media (hover: hover) and (pointer: fine) {
  .capsule a:not(.is-active):not([aria-current="page"]):hover { background: color-mix(in oklab, var(--sc-ink) 7%, transparent); }
}
.index-open .capsule { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.bar-menu { justify-self: end; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%;
  background: var(--sc-ink); color: var(--sc-canvas); cursor: pointer; box-shadow: 0 12px 30px -16px hsl(var(--sc-shadow-color) / .7);
  transition: transform 200ms var(--sc-ease-out), background-color 200ms var(--sc-ease-out); }
.bar-menu:hover { background: #3A352C; }
.bar-menu:active { transform: scale(0.96); }
.bar-menu .bars { display: grid; gap: 5px; width: 16px; }
.bar-menu .bars i { display: block; height: 1.5px; background: currentColor; transition: transform 420ms var(--sc-ease-out); }
.index-open .bar-menu .bars i:first-child { transform: translateY(3.25px) rotate(45deg); }
.index-open .bar-menu .bars i:last-child { transform: translateY(-3.25px) rotate(-45deg); }

/* logo: the supplied mark, assembled in three bands, with the CHJ signature */
.logo { position: relative; display: block; width: 29px; height: 38px; flex: none; }
.logo-piece { position: absolute; inset: 0; overflow: hidden; }
.logo-piece img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.logo-piece--top { clip-path: inset(0 0 65% 0); }
.logo-piece--middle { clip-path: inset(33% 0 33% 0); }
.logo-piece--bottom { clip-path: inset(65% 0 0 0); }
.logo-sig { position: absolute; top: calc(100% + 1px); left: 50%; color: var(--khaki-label); font-size: 9px; font-style: italic; letter-spacing: 0.14em; line-height: 1; white-space: nowrap; transform: translateX(-50%) rotate(-5deg); }
@media (prefers-reduced-motion: no-preference) {
  .logo-piece--top img { animation: logo-top 1400ms cubic-bezier(.34,0,.14,1) both; }
  .logo-piece--middle img { animation: logo-mid 1400ms cubic-bezier(.34,0,.14,1) both; }
  .logo-piece--bottom img { animation: logo-bot 1400ms cubic-bezier(.34,0,.14,1) both; }
  .logo-sig { animation: logo-sig 620ms cubic-bezier(.34,0,.14,1) 820ms both; }
}
@keyframes logo-top { 0% { opacity: 0; transform: translate3d(-8px,-12px,0) rotate(-2deg) scale(.95); } 60%,100% { opacity: 1; transform: none; } }
@keyframes logo-mid { 0%,22% { opacity: 0; transform: translate3d(10px,6px,0) rotate(1.5deg) scale(.95); } 72%,100% { opacity: 1; transform: none; } }
@keyframes logo-bot { 0%,34% { opacity: 0; transform: translate3d(-6px,12px,0) rotate(1.5deg) scale(.95); } 84%,100% { opacity: 1; transform: none; } }
@keyframes logo-sig { 0%,34% { opacity: 0; transform: translateX(-50%) rotate(-11deg) scale(.95); } 100% { opacity: 1; transform: translateX(-50%) rotate(-5deg); } }

/* ---------- index: the contents page ---------- */
.index-panel {
  position: fixed; inset: 0; z-index: calc(var(--sc-z-chrome) - 1);
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--sc-8); align-items: center;
  padding: calc(var(--bar-h) + var(--sc-6)) var(--sc-gutter) var(--sc-7); background: var(--sc-canvas);
  visibility: hidden; clip-path: inset(0 0 100% 0);
  transition: clip-path 640ms var(--sc-ease-drawer), visibility 0s 640ms;
}
.index-open .index-panel { visibility: visible; clip-path: inset(0); transition: clip-path 640ms var(--sc-ease-drawer); }
.index-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); }
.index-list li { border-bottom: 1px solid var(--hair); overflow: hidden; }
.index-list a { display: grid; grid-template-columns: 3.4rem 1fr; align-items: baseline; padding: var(--sc-3) 0; text-decoration: none; }
.index-list .mono { color: var(--khaki-label); transition: color 240ms var(--sc-ease-out); }
.index-list strong { display: block; font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.4rem); line-height: 1.04; transform-origin: 0 50%; transition: transform 520ms var(--sc-ease-out), color 240ms var(--sc-ease-out); }
.index-list a:hover strong, .index-list a:focus-visible strong { transform: translateX(18px); }
.index-list a:hover .mono, .index-list a:focus-visible .mono { color: var(--sc-ink); }
.index-list:hover a:not(:hover) strong { color: color-mix(in oklab, var(--sc-ink) 45%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .index-list a { transform: translateY(105%); transition: transform 720ms var(--sc-ease-out); transition-delay: calc(var(--n) * 55ms + 120ms); }
  .index-open .index-list a { transform: none; }
  .index-side { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--sc-ease-out) 360ms, transform 600ms var(--sc-ease-out) 360ms; }
  .index-open .index-side { opacity: 1; transform: none; }
}
.index-side { display: grid; gap: var(--sc-5); }
.index-plate { position: relative; margin: 0; aspect-ratio: 4 / 3; background: var(--sc-surface); overflow: hidden; }
.index-plate img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 500ms var(--sc-ease-out), transform 900ms var(--sc-ease-out); }
.index-plate img.is-on { opacity: 1; transform: none; }
.index-plate figcaption { position: absolute; left: var(--sc-3); bottom: var(--sc-3); padding: 2px 8px; background: var(--sc-canvas); font-size: 0.95rem; }
.index-contact { margin: 0; display: grid; gap: var(--sc-2); justify-items: start; font-size: 0.95rem; }
body.index-open { overflow: hidden; }

/* ==========================================================================
   1 · Frontispiece: a wall, one opening, the drawing becomes the building
   ========================================================================== */
.fp-stage { background: var(--wall); overflow: hidden; --cut: 0; --open: 0; --copy: 0; --ox: 0px; --oy: 0px; --sf: 1.8; --sw: 2.9; }
.fp-plot { position: absolute; inset: 0; }
/* The opening and the plate share one rectangle. The plate (far) grows to cover the frame;
   the wall (near) grows faster and flies past, which is what reads as depth. */
.fp-opening, .fp-scene {
  position: absolute; right: var(--sc-gutter); top: calc(var(--bar-h) + 8vh);
  width: min(56vw, calc((100vh - var(--bar-h) - 18vh) * 1.6)); aspect-ratio: 1.6;
}
.fp-scene { overflow: hidden; will-change: transform; transform: translate(calc(var(--ox) * var(--open)), calc(var(--oy) * var(--open))) scale(calc(1.08 + (var(--sf) - 1.08) * var(--open))); }
.fp-scene img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 60%; }
/* The drawing is revealed by two opposite translations, never by repainting a clip. */
.fp-drawing-mask { position: absolute; inset: 0; overflow: hidden; will-change: transform; transform: translateY(calc(var(--cut) * 100%)); }
.fp-drawing-mask .fp-drawing { will-change: transform; transform: translateY(calc(var(--cut) * -100%)); }
.fp-cut { position: absolute; inset: 0; will-change: transform; transform: translateY(calc(var(--cut) * 100%)); pointer-events: none; opacity: calc(1 - var(--done, 0)); }
.fp-cut::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: var(--sc-ink); box-shadow: 0 1px 0 rgba(255,255,255,.6); }
.fp-datum { position: absolute; top: 0; right: 9%; display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 4px; transform: translateY(calc(-100% - 3px)) scale(calc(1 / (1.08 + (var(--sf) - 1.08) * var(--open)))); transform-origin: 100% 100%; background: rgba(255, 255, 255, .9); color: var(--sc-ink); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fp-datum::before { content: ""; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
/* The wall: one stage-sized layer with a hole cut by JS, scaled about the hole's centre. */
.fp-wall { position: absolute; inset: 0; z-index: 2; background: var(--wall); pointer-events: none; will-change: transform;
  transform: translate(calc(var(--ox) * var(--open)), calc(var(--oy) * var(--open))) scale(calc(1 + (var(--sw) - 1) * var(--open))); }
/* Until JS has cut the hole the wall stays out of the way; the stage behind the plate is already wall-coloured. */
.fp-wall:not([style*="clip-path"]) { display: none; }
.fp-opening { z-index: 2; pointer-events: none; will-change: transform;
  box-shadow: inset 22px 26px 34px -22px rgba(70, 58, 34, .42), inset 0 0 0 1px rgba(31, 29, 25, .5);
  transform: translate(calc(var(--ox) * var(--open)), calc(var(--oy) * var(--open))) scale(calc(1 + (var(--sw) - 1) * var(--open))); }
.fp-copy { position: absolute; z-index: 3; left: var(--sc-gutter); bottom: 9vh; width: min(46vw, 42rem);
  transform: translateY(calc(var(--copy) * -72px)); opacity: calc(1 - var(--copy) * 1.25); }
.fp-name { margin: 0 0 var(--sc-5); font-size: clamp(3rem, 1rem + 5.6vw, 7.2rem); line-height: 0.92; }
.fp-name span { display: block; margin-top: 0.06em; font-style: italic; font-size: 0.62em; line-height: 1; }
.fp-intro { margin: 0; max-width: 32ch; color: var(--sc-ink-soft); font-size: var(--sc-t-base); line-height: 1.6; }
.fp-plate-label { position: absolute; z-index: 3; top: calc(var(--bar-h) + 8vh); left: var(--sc-gutter); display: grid; gap: 4px; margin: 0; opacity: calc(1 - var(--copy) * 1.5); }
/* A museum label on the render: solid paper, so the type never sits on the image. */
.fp-caption { position: absolute; z-index: 4; left: var(--sc-gutter); bottom: 8vh; display: grid; justify-items: start; gap: var(--sc-2); max-width: 34rem;
  padding: var(--sc-4) var(--sc-6) var(--sc-4) var(--sc-5); background: #FFFFFF; box-shadow: 0 10px 30px -18px hsl(var(--sc-shadow-color) / .5); }
.fp-caption strong { font-size: var(--sc-t-xl); line-height: 1.1; }

/* ==========================================================================
   2 · Profile
   ========================================================================== */
.profile { padding-block: var(--sc-section); }
.profile-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--sc-7) var(--sc-gutter); }
.profile-head h2 { margin: 0 0 var(--sc-6); font-size: var(--sc-t-3xl); line-height: 0.95; }
.profile-facts { margin: 0; display: grid; gap: var(--sc-4); }
.profile-facts div { padding-top: var(--sc-3); border-top: 1px solid var(--hair); }
.profile-facts dt { margin-bottom: 4px; }
.profile-facts dd { margin: 0; font-size: var(--sc-t-sm); line-height: 1.5; }
.profile-lead { margin: 0 0 var(--sc-7); font-size: var(--sc-t-xl); line-height: 1.3; }
.profile-lead b { font-weight: 400; font-style: italic; }
.profile-copy { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sc-6); color: var(--sc-ink-soft); }
.profile-copy p { margin: 0; }

/* ==========================================================================
   3 · Highlighted projects (pan rail)
   ========================================================================== */
.works-stage { display: flex; align-items: center; background: var(--sc-canvas); box-shadow: inset 0 1px 0 var(--hair), inset 0 -1px 0 var(--hair); }
.rail { gap: clamp(1.5rem, 3vw, 3.5rem); padding-inline: var(--sc-gutter); align-items: stretch; }
/* Phones: the rail is a native swipe strip instead of a pinned, scroll-driven pan. */
.is-swipe .works-stage { position: relative; height: auto; display: block; padding-block: var(--sc-section); }
.is-swipe .rail { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--sc-gutter); scrollbar-width: none; padding-bottom: var(--sc-2); }
.is-swipe .rail::-webkit-scrollbar { display: none; }
.is-swipe .rail > * { scroll-snap-align: start; }
.is-swipe .rail-lead { align-content: start; width: 62vw; padding-top: var(--sc-2); }
.rail > * { flex: none; }
.rail-lead { width: min(26rem, 30vw); display: grid; align-content: center; gap: var(--sc-4); }
.rail-lead h2 { margin: 0; font-size: var(--sc-t-3xl); line-height: 0.95; }
.rail-lead p { margin: 0; color: var(--sc-ink-soft); max-width: 30ch; }
.work-card { width: clamp(18rem, 40vw, 37rem); display: grid; grid-template-rows: auto 1fr; gap: var(--sc-4); text-decoration: none; color: inherit; }
.work-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 10.5; background: var(--sc-surface); }
.work-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 1100ms var(--sc-ease-out); }
.work-meta { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: var(--sc-1) var(--sc-3); align-items: baseline; }
.work-meta .num { grid-row: span 3; font-size: var(--sc-t-xl); color: var(--khaki-label); }
.work-meta h3 { margin: 0; font-size: var(--sc-t-2xl); line-height: 1; }
.work-meta .cat { justify-self: end; }
.work-meta p { grid-column: 2 / -1; margin: 0; color: var(--sc-ink-soft); font-size: var(--sc-t-sm); max-width: 48ch; }
.work-meta .scope { grid-column: 2 / -1; color: var(--khaki-label); }
.rail-end { width: min(23rem, 30vw); display: grid; align-content: center; gap: var(--sc-5); text-decoration: none; color: inherit; }
.rail-end strong { font-size: var(--sc-t-3xl); line-height: 0.95; }
.rail-end strong em { font-style: italic; }
.rail-end p { margin: 0; color: var(--sc-ink-soft); max-width: 26ch; }
.rail-end .go { justify-self: start; }
@media (hover: hover) and (pointer: fine) {
  .work-card:hover .work-frame img { transform: scale(1.045); }
}

/* ==========================================================================
   4 · Practice
   ========================================================================== */
.practice { padding-block: var(--sc-section); }
.practice-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--sc-8) var(--sc-gutter); align-items: start; }
.practice h2 { margin: 0 0 var(--sc-5); font-size: var(--sc-t-3xl); line-height: 0.95; }
.practice-copy { position: sticky; top: calc(var(--bar-h) + var(--sc-6)); }
.practice-copy p { margin: 0 0 var(--sc-4); max-width: 44ch; color: var(--sc-ink-soft); }
.practice-copy .current { padding-top: var(--sc-3); border-top: 1px solid var(--hair); color: var(--sc-ink); }
.practice-record { display: grid; gap: var(--sc-8); }
.record-block h3 { margin: 0 0 var(--sc-3); }
.record-block ol, .tools { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--sc-ink); }
.record-block li { display: grid; grid-template-columns: minmax(10rem, 1fr) 2fr; gap: var(--sc-1) var(--sc-4); padding: var(--sc-4) 0; border-bottom: 1px solid var(--hair); }
.record-block li strong { font-size: var(--sc-t-xl); line-height: 1.1; }
.record-block li span { color: var(--sc-ink-soft); font-size: var(--sc-t-sm); }
.record-block li .when { grid-row: span 2; color: var(--khaki-label); padding-top: 0.3em; }
.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tools li { padding: var(--sc-3) var(--sc-2) var(--sc-3) 0; border-bottom: 1px solid var(--hair); font-size: var(--sc-t-sm); }

/* ==========================================================================
   5 · Colophon: centred, quiet, and it holds
   ========================================================================== */
.colophon { display: grid; grid-template-rows: 1fr auto; padding: calc(var(--bar-h) + var(--sc-5)) var(--sc-gutter) 0; text-align: center; }
.colophon-centre { align-self: center; display: grid; justify-items: center; gap: var(--sc-5); }
.colophon-kicker { margin: 0; color: #4B4334; }
.colophon-line { margin: 0; font-size: clamp(2.2rem, 1.3rem + 2.8vw, 4.1rem); line-height: 0.95; }
.colophon-line span { display: block; font-style: italic; }
.colophon-mail { font-family: var(--sc-font-display); font-size: clamp(1.3rem, 1rem + 1.1vw, 2rem); line-height: 1.15; text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 4px; overflow-wrap: anywhere; transition: color 160ms var(--sc-ease-out); }
.colophon-mail:hover { color: #4B4334; }
.colophon-links { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sc-2) var(--sc-6); font-size: 0.95rem; }
.colophon-links a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em; }
.colophon-links a:hover { color: #4B4334; }
.colophon-mark { width: 34px; height: 44px; margin-top: var(--sc-3); }
.colophon-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sc-2) var(--sc-5); padding: var(--sc-5) 0 calc(var(--sc-5) + env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); color: var(--sc-ink-soft); text-align: left; }

/* ==========================================================================
   Archive (projects.html)
   ========================================================================== */
.arch-head { padding: calc(var(--bar-h) + var(--sc-9)) 0 var(--sc-7); }
.arch-head h1 { margin: var(--sc-4) 0; font-size: clamp(3rem, 1.2rem + 5.6vw, 6.6rem); line-height: 0.88; }
.arch-head h1 em { font-style: italic; }
.arch-head p { margin: 0; max-width: 44ch; color: var(--sc-ink-soft); }
.arch-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: var(--sc-7); border-top: 1px solid var(--sc-ink); border-bottom: 1px solid var(--hair); }
.arch-cats a { display: grid; grid-template-columns: 2.4rem 1fr; gap: 2px var(--sc-2); padding: var(--sc-4) var(--sc-3) var(--sc-4) 0; text-decoration: none; }
.arch-cats a + a { padding-left: var(--sc-4); border-left: 1px solid var(--hair); }
.arch-cats a > span { grid-row: span 2; color: var(--khaki-label); }
.arch-cats strong { font-size: var(--sc-t-xl); transition: color 200ms var(--sc-ease-out); }
.arch-cats small { color: var(--sc-ink-soft); font-size: var(--sc-t-sm); }
.arch-cats a:hover strong { color: var(--khaki-label); }
.arch-section { padding-block: var(--sc-8); scroll-margin-top: var(--bar-h); }
.arch-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sc-4); padding-bottom: var(--sc-3); border-bottom: 1px solid var(--sc-ink); }
.arch-section-head h2 { margin: 0; font-size: var(--sc-t-2xl); }
.arch-section-head h2 .mono { margin-right: 0.35em; font-size: 0.7em; }
.arch-context { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sc-3) var(--sc-6); padding: var(--sc-4) 0; color: var(--sc-ink-soft); font-size: var(--sc-t-sm); border-bottom: 1px solid var(--hair); }
.arch-context p { margin: 0; display: grid; gap: 2px; }
.arch-context strong { display: block; color: var(--sc-ink); font-weight: 500; }
.arch-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--sc-8); }
.arch-row { display: grid; grid-template-columns: 2.6rem 1fr auto; gap: var(--sc-3); align-items: baseline; padding: var(--sc-4) 0; border-bottom: 1px solid var(--hair); text-decoration: none; }
.arch-row .num { color: var(--khaki-label); }
.arch-row strong { font-size: var(--sc-t-xl); transition: transform 420ms var(--sc-ease-out); }
.arch-row small { color: var(--sc-ink-soft); }
.arch-row .thumb { display: none; }
@media (hover: hover) and (pointer: fine) { .arch-row:hover strong { transform: translateX(8px); } }
.arch-interior { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--sc-6); align-items: end; padding-top: var(--sc-5); text-decoration: none; }
.arch-interior img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.arch-interior strong { display: block; margin: var(--sc-2) 0; font-size: var(--sc-t-2xl); }
.arch-interior small { display: block; color: var(--sc-ink-soft); }
.preview { position: fixed; top: 0; left: 0; z-index: 50; width: min(280px, 24vw); pointer-events: none; opacity: 0; transition: opacity 180ms var(--sc-ease-out); }
.preview.is-on { opacity: 1; }
.preview > * { transform: scale(.95); transform-origin: 0 50%; transition: transform 420ms var(--sc-ease-out); }
.preview.is-on > * { transform: none; }
.preview img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--sc-surface); box-shadow: 0 18px 40px -16px hsl(var(--sc-shadow-color) / .45); }
.preview span { display: block; margin-top: var(--sc-2); }

/* ==========================================================================
   Project sheet (project.html)
   ========================================================================== */
.sheet-top { padding: calc(var(--bar-h) + var(--sc-8)) 0 var(--sc-6); }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--sc-2); margin-bottom: var(--sc-6); color: var(--sc-ink-soft); }
.crumbs a { text-decoration: none; } .crumbs a:hover { color: var(--sc-ink); }
.sheet-title { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--sc-6) var(--sc-gutter); align-items: end; }
.sheet-title h1 { margin: 0; font-size: clamp(2.6rem, 1.2rem + 4.2vw, 5.4rem); line-height: 0.92; }
.sheet-title .sub { margin: var(--sc-3) 0 0; font-size: var(--sc-t-xl); font-style: italic; color: var(--khaki-label); }
.facts { margin: 0; border-top: 1px solid var(--sc-ink); }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: var(--sc-3); padding: var(--sc-3) 0; border-bottom: 1px solid var(--hair); font-size: var(--sc-t-sm); }
.facts dd { margin: 0; }
.viewer { padding-bottom: var(--sc-6); }
.stage { position: relative; aspect-ratio: 1.5; max-height: calc(100svh - var(--bar-h) - 9rem); width: 100%; overflow: hidden; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.stage-btn { position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; margin-top: -24px; border: 1px solid color-mix(in oklab, var(--sc-ink) 30%, transparent); background: #FFFFFF; cursor: pointer; transition: background-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out); }
.stage-btn:hover { background: var(--sc-ink); color: var(--sc-canvas); }
.stage-btn:active { transform: translateY(1px); }
.stage-prev { left: var(--sc-3); } .stage-next { right: var(--sc-3); }
.stage-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sc-2) var(--sc-4); padding: var(--sc-3) 0; color: var(--sc-ink-soft); }
.stage-bar span { white-space: nowrap; }
.stage-bar button { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 0.3em; }
.thumbs { display: flex; gap: var(--sc-2); overflow-x: auto; padding: 4px 4px var(--sc-3); scroll-snap-type: x proximity; }
.thumbs button { flex: none; width: clamp(84px, 9vw, 124px); aspect-ratio: 1.414; padding: 0; border: 0; background: var(--sc-surface); cursor: pointer; opacity: .55; outline: 1px solid var(--hair); scroll-snap-align: start; transition: opacity 160ms var(--sc-ease-out); }
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button:hover { opacity: .85; }
.thumbs button[aria-current="true"] { opacity: 1; outline: 2px solid var(--sc-ink); outline-offset: 2px; }
.sheet-body { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--sc-5) var(--sc-gutter); padding-block: var(--sc-8); }
.sheet-body .lead { margin: 0; font-size: var(--sc-t-lg); line-height: 1.5; max-width: 60ch; }
.sheet-return { display: inline-block; margin-top: var(--sc-5); }
.pager { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--sc-ink); }
.pager a { display: grid; gap: var(--sc-2); padding: var(--sc-7) 0; text-decoration: none; }
.pager a + a { text-align: right; border-left: 1px solid var(--hair); padding-left: var(--sc-4); }
.pager strong { font-size: var(--sc-t-2xl); line-height: 1; transition: color 160ms var(--sc-ease-out); }
.pager a:hover strong { color: var(--khaki-label); }
.lightbox { position: fixed; inset: 0; z-index: 90; overflow: auto; background: rgba(31, 29, 25, .94); color: var(--sc-canvas); opacity: 0; visibility: hidden; transition: opacity 240ms var(--sc-ease-out), visibility 0s 240ms; }
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 240ms var(--sc-ease-out); }
.lightbox-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: var(--sc-3); padding: var(--sc-3) var(--sc-gutter); background: rgba(31, 29, 25, .9); }
.lightbox-bar .group { display: flex; align-items: center; gap: var(--sc-2); }
.lightbox-bar button { min-width: 40px; height: 40px; padding: 0 var(--sc-3); border: 1px solid rgba(255, 255, 255, .4); background: transparent; cursor: pointer; }
.lightbox-bar button:hover { background: var(--sc-canvas); color: var(--sc-ink); }
.lightbox-bar input { width: clamp(70px, 14vw, 160px); accent-color: var(--sc-accent); }
.lightbox figure { margin: 0; padding: var(--sc-4) var(--sc-gutter) var(--sc-8); }
.lightbox img { width: calc(100% * var(--zoom, 1)); max-width: none; margin-inline: auto; background: var(--sc-canvas); }
.lightbox:not(.is-zoomed) img { max-width: 100%; }
body.lightbox-open { overflow: hidden; }
.page-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sc-2) var(--sc-5); padding: var(--sc-5) var(--sc-gutter); border-top: 1px solid var(--hair); color: var(--sc-ink-soft); }

/* ==========================================================================
   Opening a project: the clicked image grows to the screen, then lifts away
   ========================================================================== */
.expander { position: fixed; z-index: 400; overflow: hidden; background: var(--sc-canvas); contain: strict; pointer-events: none; }
.expander img { width: 100%; height: 100%; max-width: none; object-fit: cover; will-change: transform; }
.arrival { inset: 0; }
/* Starts lifting on the very first paint of the project page: no waiting for scripts. */
html.is-arriving::after { content: ""; position: fixed; inset: 0; z-index: 400; pointer-events: none; background: var(--sc-canvas) var(--arrive-src) var(--arrive-pos, 50% 50%) / cover no-repeat;
  animation: arrive-lift 760ms cubic-bezier(.77, 0, .18, 1) 60ms both; }
@keyframes arrive-lift { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 100% 0); } }

/* ==========================================================================
   Phone: its own composition, not a shrunk desktop
   ========================================================================== */
@media (max-width: 1020px) {
  .capsule a { padding: 9px 12px; }
}
@media (max-width: 860px) {
  :root { --bar-h: 60px; }
  .logo { width: 27px; height: 35px; }
  .bar { grid-template-columns: 1fr auto; }
  .capsule { display: none; }
  .bar-menu { width: 42px; height: 42px; }

  .index-panel { grid-template-columns: 1fr; align-content: start; gap: var(--sc-6); overflow-y: auto; padding-top: calc(var(--bar-h) + var(--sc-5)); }
  .index-list strong { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .index-plate { display: none; }

  .fp-opening, .fp-scene { left: var(--sc-gutter); right: var(--sc-gutter); top: auto; bottom: 4vh; width: auto; aspect-ratio: auto; height: 50svh; }
  .fp-copy { top: calc(var(--bar-h) + 3.5vh); bottom: auto; width: auto; right: var(--sc-gutter); }
  .fp-name { font-size: clamp(2.6rem, 13vw, 3.9rem); margin-bottom: var(--sc-3); }
  .fp-intro { font-size: var(--sc-t-sm); max-width: none; }
  .fp-plate-label { display: none; }
  .fp-scene img { object-position: 46% 70%; }
  .fp-caption { left: var(--sc-gutter); right: var(--sc-gutter); bottom: 5vh; }

  .profile-grid, .practice-grid, .sheet-title, .sheet-body { grid-template-columns: 1fr; }
  .practice-copy { position: static; }
  .profile-copy { grid-template-columns: 1fr; gap: var(--sc-4); }
  .rail-lead { width: 78vw; }
  .work-card { width: 82vw; }
  .rail-end { width: 78vw; }
  .work-meta { grid-template-columns: 2.4rem 1fr; }
  .work-meta .cat { grid-column: 2; grid-row: 2; justify-self: start; }
  .work-meta h3 { font-size: var(--sc-t-xl); }
  .tools { grid-template-columns: 1fr 1fr; }
  .record-block li { grid-template-columns: 1fr; }
  .record-block li .when { grid-row: auto; }

  .colophon-line { font-size: clamp(2.1rem, 9.5vw, 2.9rem); }
  .colophon-mail { font-size: clamp(1.15rem, 5.2vw, 1.4rem); }
  .colophon-foot { justify-content: center; text-align: center; }

  .arch-cats { grid-template-columns: 1fr 1fr; }
  .arch-cats a:nth-child(3) { padding-left: 0; border-left: 0; }
  .arch-cats a:nth-child(n+3) { border-top: 1px solid var(--hair); }
  .arch-context, .arch-list, .arch-interior { grid-template-columns: 1fr; }
  .arch-row { grid-template-columns: 64px 1fr; grid-template-rows: auto auto; row-gap: 2px; }
  .arch-row .thumb { display: block; grid-row: 1 / 3; width: 64px; height: 64px; object-fit: cover; background: var(--sc-surface); }
  .arch-row .num { display: none; }
  .arch-row small { grid-column: 2; }
  .preview { display: none; }
  .stage { aspect-ratio: 1.414; max-height: none; }
  .stage-btn { width: 40px; height: 40px; margin-top: -20px; }
  .pager strong { font-size: var(--sc-t-lg); }
}
@media (prefers-reduced-motion: reduce) {
  .fp-scene { transform: scale(1.08); }
  .fp-wall, .fp-opening, .fp-copy { transform: none; }
  .fp-drawing-mask, .fp-drawing-mask .fp-drawing { transform: none; }
  .fp-drawing-mask { opacity: calc(1 - var(--cut)); }
  .fp-cut { display: none; }
  .bar { transition: none; }
}
