/* A quiet information layer; the approved camera, objects and materials stay intact. */
.portfolio-intro {
  position: fixed; z-index: 2; top: 118px; left: 20px; right: 20px;
  text-align: center; pointer-events: none; transition: opacity .2s;
}
.portfolio-intro h1 { font: 500 15px/1.45 Arial, sans-serif; letter-spacing: -.2px; margin: 0; color: #41483f; }
.portfolio-intro p { font: 11px/1.6 Arial, sans-serif; color: #737b70; margin: 6px 0 0; }
.portfolio-intro p span { display: inline-block; width: 1px; height: 9px; background: #aab0a3; margin: 0 9px; }
#index-toggle {
  position: fixed; z-index: 3; top: 24px; left: 24px; display: flex; align-items: center; gap: 9px;
  min-height: 40px; border: 1px solid #76806d30; border-radius: 24px; padding: 10px 15px;
  background: #fafbf4dc; color: #596353; font: 11px/1 Arial, sans-serif; cursor: pointer;
}
#index-toggle svg { width: 14px; height: 14px; }
#index-toggle:hover { background: #fff; border-color: #76806d80; }
#index-toggle:disabled { cursor: default; }
.selection-bar {
  position: fixed; z-index: 2; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: min(660px, calc(100% - 80px)); display: grid; grid-template-columns: 1fr auto;
  gap: 14px 24px; padding-top: 17px; border-top: 1px solid #68766030; color: #3b4636;
  transition: opacity .2s; pointer-events: auto;
}
.selection-heading { display: flex; gap: 13px; align-items: center; margin-bottom: 6px; }
.selection-heading h2 { margin: 0; font: 600 16px/1.35 Arial, sans-serif; letter-spacing: -.35px; }
#selection-count { font: 9px/1.4 ui-monospace, monospace; color: #7a8276; white-space: nowrap; }
#selection-meta { margin: 0; font: 11px/1.5 Arial, sans-serif; color: #6a7462; }
#selection-type { display: none; }






.chapter-stepper { display: none; }
body.booting .portfolio-intro, body.booting .selection-bar, body.booting #index-toggle,
body:not([data-phase="browse"]) .selection-bar,
body:not([data-phase="browse"]) #index-toggle { opacity: 0; visibility: hidden; pointer-events: none; }

/* An existing case can use both the cartridge transition and the direct route. */
#chapter-detail.is-case { background: #fbf7f3; overflow: hidden; }
#chapter-detail.is-case > article, #chapter-detail.is-case > .site-sound,
#chapter-detail.is-case > .detail-close { display: none; }
.case-frame { display: block; width: 100%; height: 100%; border: 0; background: #fbf7f3; }
.case-frame[hidden] { display: none; }

@media (max-width: 650px) {


  .portfolio-intro { top: 101px; }
  .portfolio-intro h1 { font-size: 14px; }
  .portfolio-intro p { font-size: 10px; margin-top: 5px; }
  .selection-bar { bottom: max(22px, env(safe-area-inset-bottom)); width: calc(100% - 40px); gap: 14px 12px; padding-top: 15px; }
  .selection-copy { min-width: 0; }
  .selection-heading { gap: 10px; }
  .selection-heading h2 { font-size: 16px; }
  #selection-meta { font-size: 11px; }


  .chapter-stepper { grid-row: 1; grid-column: 2; display: flex; gap: 6px; align-items: center; }
  .chapter-stepper button { width: 38px; height: 38px; padding: 0; border: 1px solid #71806635; border-radius: 50%; color: #516644; background: #f7f9ef70; font: 16px Arial; cursor: pointer; }
  .chapter-stepper button:disabled { opacity: .3; cursor: default; }
  .explore-note { top: 58%; }
}
@media (min-width: 651px) and (max-height: 620px) {
  .portfolio-intro { top: 100px; }
  .portfolio-intro h1 { font-size: 13px; }
  .portfolio-intro p { font-size: 10px; margin-top: 3px; }

  .selection-bar { bottom: 18px; padding-top: 12px; }
}
@media (max-width: 650px) and (max-height: 700px) {
  .portfolio-intro { top: 88px; }
  .selection-bar { bottom: 12px; gap: 5px 12px; padding-top: 9px; }

  .explore-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .portfolio-intro, .selection-bar { transition: none; }
}
.index-list button:disabled { cursor: default; opacity: .55; }
.index-list button:disabled:hover { background: none; }

#home-language {
  position: fixed;
  top: var(--sound-top, 24px);
  right: calc(var(--sound-right, 24px) + 110px);
  z-index: 3;
}
.language-toggle {
  min-height: 40px; padding: 0 12px; border: 1px solid #76806d45;
  border-radius: 22px; background: #fafbf4ef; color: #344331;
  font: 600 12px/1.2 Arial, sans-serif; cursor: pointer;
}
body:not([data-phase="browse"]) #home-language, body.booting #home-language { visibility: hidden; }
body.gallery-mode { overflow-x: hidden; overflow-y: auto; }
.gallery-mode > main { position: fixed; inset: 0; height: 100%; min-height: 0; pointer-events: none; }
.gallery-mode .selection-bar, .gallery-mode .explore-note { opacity: 0; visibility: hidden; pointer-events: none; }


#work-index {
  position: relative;
  width: min(100% - 80px, 990px);
  max-height: none;
  padding: 0 0 68px;
  margin: var(--directory-start, 246px) auto 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}
#work-index[hidden] { display: none; }
#work-index h2 { margin: 0 0 24px; font: 600 13px/1.4 Arial, sans-serif; color: #596353; }
#work-index .index-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 34px 28px; }
#work-index .index-list { margin: 0; padding: 0; list-style: none; }
#work-index li { min-width: 0; border: 0; }
#work-index button {
  display: grid; grid-template-columns: 1fr; align-content: start;
  width: 100%; min-width: 0; gap: 7px; padding: 0 0 10px; background: none;
  border: 0; text-align: left; color: inherit; cursor: pointer;

}
#work-index strong { margin-top: 7px; font-size: 17px; }
#work-index small { margin: 0; color: #58634f; font-size: 13px; line-height: 1.45; }
#work-index [data-current] strong::after { content: " ·"; color: #607347; }
.directory-slot { display: block; height: clamp(155px, 21vw, 220px); }
#work-index { opacity: var(--directory-copy, 0); }
#work-index[inert] { pointer-events: none; }
#work-index button:focus-visible { outline: 2px solid #617854; outline-offset: 6px; }
@media (max-width: 650px) {
  #home-language { right: calc(var(--sound-right, 18px) + 48px); }
  #home-language .language-toggle { min-width: 37px; padding-inline: 6px; }

  #index-toggle svg { width: 12px; }
  #work-index { width: calc(100% - 36px); }
  #work-index .index-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px 14px; }
  #work-index strong { font-size: 15px; }
  #work-index small { font-size: 12px; }
}

@media (max-width:650px) { .directory-slot { height: clamp(130px, 39vw, 185px); } }

/* Same live identity across both layouts; only its target geometry changes. */
body {
  --home-brand-width: 280px;
  --home-brand-top: 28px;
  --directory-brand-width: 220px;
  --directory-brand-top: 20px;
  --home-intro-top: 136px;
  --directory-intro-top: 154px;
}
body > header {
  inset: 0 0 auto;
  z-index: 5;
  height: 0;
  padding: 0 !important;
}
body > header::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 110px;
  background: linear-gradient(#fff 70%, #fff0);
  opacity: 0;
  transition: opacity 240ms ease;
}
body.gallery-target > header::before { opacity: 1; }
body > header .logo, #chapter-detail > .logo {
  position: fixed;
  top: max(var(--brand-top),env(safe-area-inset-top));
  left: calc(50% + var(--header-brand-offset));
  width: var(--brand-width);
  max-width: none;
  height: auto;
  aspect-ratio: 1015 / 325;
  margin-left: calc(var(--brand-width) / -2);
  pointer-events: auto;
}
body > header .logo img, #chapter-detail > .logo img { display: block; width: 100%; height: auto; }
.logo {
  --brand-width: var(--home-brand-width);
  --brand-top: var(--home-brand-top);
  --header-brand-offset: 12px;
}
.gallery-target .logo {
  --brand-width: var(--directory-brand-width);
  --brand-top: var(--directory-brand-top);
  --header-brand-offset: 9px;
}
.logo.site-brand--reading {
  --brand-width: var(--header-brand-inner);
  --brand-top: var(--header-brand-top);
  --header-brand-offset: 8px;
}
body.entering > header .logo { animation: none; }
.portfolio-intro { top: var(--home-intro-top); z-index: 2; }
.gallery-target .portfolio-intro { position: absolute; top: var(--directory-intro-top); }
.portfolio-intro h1 { font: 600 28px/1.35 Arial,sans-serif; letter-spacing: normal; }
.portfolio-intro p { font: 400 14px/1.5 Arial,sans-serif; margin: 6px 0 0; }
#index-toggle, #home-language { z-index: 6; top: max(var(--header-inset), env(safe-area-inset-top)); }
#index-toggle { left: var(--header-edge-left); }
#home-language { right: calc(var(--header-edge-right) + var(--header-sound-width) + var(--header-gap)); }
#index-toggle, #home-language .language-toggle {
  min-width: var(--header-control);
  min-height: var(--header-control);
  padding: 0 12px;
  font: var(--header-font);
  color: #596353;
  background: #fafbf4dc;
  border-color: #76806d30;
}
#index-toggle:focus-visible, #home-language .language-toggle:focus-visible {
  outline: 2px solid #52634b;
  outline-offset: 4px;
}
/* Fade the reading surface independently so the shared mark can travel at full opacity. */
#chapter-detail.is-about, #chapter-detail.is-case {
  opacity: 1;
  background: transparent;
}
#chapter-detail > iframe { opacity: 0; transition: opacity 160ms ease; }
#chapter-detail.is-visible > iframe { opacity: 1; }
#chapter-detail.is-about::before, #chapter-detail.is-case::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: #f8f7f3;
  transition: opacity 160ms ease;
}
#chapter-detail.is-visible::before { opacity: 1; }
#chapter-detail.is-visible > iframe { transition-delay: 55ms; }

@media (min-width: 651px) and (max-height: 700px) {
  body { --home-brand-width: 240px; --home-intro-top: 112px; }
}
@media (max-width: 650px) {
  body {
    --home-brand-width: clamp(112px, 42vw, 180px);
    --directory-brand-width: clamp(104px, 36vw, 160px);
    --home-brand-top: 20px;
    --directory-brand-top: 21px;
    --home-intro-top: 100px;
    --directory-intro-top: 125px;
    --directory-start: 214px;
  }
  .logo, .gallery-target .logo, .logo.site-brand--reading { --header-brand-offset: 4px; }
  body.gallery-target > header::before { height: 88px; }
  .portfolio-intro h1 { font-size: 24px; line-height: 1.4; }
  #index-toggle, #home-language .language-toggle { padding-inline: 8px; }
  .chapter-stepper button { width: 44px; height: 44px; }
  .selection-bar { align-items: center; }
}
@media (max-width: 420px) {
  #index-toggle svg { display: none; }
  body { --home-brand-width: clamp(116px, 35vw, 148px); }
}
@media (max-width: 375px) {
  body { --home-brand-width: 96px; --directory-brand-width: 92px; }
  .logo, .gallery-target .logo, .logo.site-brand--reading { --header-brand-offset: 0px; }
}
@media (prefers-reduced-motion: reduce) {
  #chapter-detail > iframe, #chapter-detail.is-visible > iframe, #chapter-detail.is-about::before,
  #chapter-detail.is-case::before, body > header::before { transition: none; }
}

/* 2026-11-17 · homepage annotations: a quiet caption and a contained, live 3D collection. */
body {
  --header-sound-width: var(--header-control);
  --collection-width: min(880px, calc(100vw - 64px));
  --collection-height: min(var(--collection-content-height, 920px), calc(100dvh - 224px));
  --collection-top: calc((100dvh - var(--collection-height)) / 2);
  --collection-bottom: var(--collection-top);
  --collection-header: 96px;
  --collection-radius: 28px;
}
.portfolio-intro h1 { font-size: 25px; font-weight: 500; color: #303432; letter-spacing: .01em; }
.portfolio-intro p { font-size: 14px; color: #737875; margin-top: 10px; }
.portfolio-intro { transition: opacity 240ms ease, visibility 240ms; }
.gallery-target .portfolio-intro { opacity: 0; visibility: hidden; }
.gallery-mode:not(.gallery-target) .portfolio-intro { opacity: 0; visibility: hidden; }
/* Neutral frosted controls, all using the same surface and label treatment. */
#index-toggle, #home-language .language-toggle, body #sound.site-sound {
  color: #36383b;
  background: rgb(242 242 245 / 72%);
  border: 1px solid rgb(255 255 255 / 76%);
  box-shadow: 0 2px 8px rgb(24 29 35 / 4%), inset 0 0 0 .5px rgb(60 65 70 / 6%);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  transition: background 160ms ease, box-shadow 160ms ease;
}
#index-toggle:hover, #home-language .language-toggle:hover, body #sound.site-sound:hover {
  background: rgb(235 236 240 / 88%);
  border-color: rgb(255 255 255 / 90%);
  box-shadow: 0 3px 12px rgb(24 29 35 / 7%), inset 0 0 0 .5px rgb(60 65 70 / 7%);
}
body > header::before { display: none; }
#index-toggle:focus, #home-language .language-toggle:focus, body #sound.site-sound:focus { outline: none; }
body[data-input="keyboard"] #index-toggle:focus-visible,
body[data-input="keyboard"] #home-language .language-toggle:focus-visible,
body[data-input="keyboard"] #sound.site-sound:focus-visible { box-shadow: inset 0 0 0 2px #818992; }
body #sound.site-sound { width: var(--header-control); padding: 0; gap: 0; }
body #sound.site-sound .sound-label { display: none; }
body #sound.site-sound svg { width: 18px; height: 18px; stroke-width: 1.8; flex: none; }
#index-toggle svg { width: 16px; height: 16px; stroke-width: 1.5; flex: none; }
#index-toggle .index-icon-back { display: none; }
#index-toggle[aria-expanded="true"] .index-icon-grid { display: none; }
#index-toggle[aria-expanded="true"] .index-icon-back { display: block; }
.selection-bar {
  inset: 0; width: 100%; max-width: none; height: 100%; transform: none;
  display: block; padding: 0; border: 0; text-align: center;
  pointer-events: none; letter-spacing: normal; overflow: clip;
}
.selection-bar > .selection-copy {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.cartridge-caption {
  position: absolute; left: 0; top: 0; width: max-content; max-width: min(300px, calc(100vw - 36px));
  padding: 10px 24px 11px; border-radius: 999px; background: #fff;
  box-shadow: 0 4px 12px -5px rgb(31 43 37 / 16%), 0 12px 32px -12px rgb(31 43 37 / 12%);
  opacity: 0; pointer-events: none; will-change: transform, opacity;
}
.cartridge-caption .selection-heading { justify-content: center; gap: 8px; margin-bottom: 4px; }
.caption-title { font: 500 16px/1.25 Arial, "PingFang SC", sans-serif; color: #343b36; letter-spacing: .01em; }
.caption-number { font: 10px/1.4 ui-monospace, monospace; letter-spacing: .02em; color: #8a918d; }
.caption-meta { margin: 0; font: 12px/1.4 Arial, "PingFang SC", sans-serif; color: #737b76; }
.chapter-stepper { display: none; }
.explore-note {
  left: calc(50% - 342px); top: calc(64% - 32px); width: auto;
  display: flex; align-items: center; gap: 8px;
  color: #79836f; transform: rotate(-5deg);
}
.explore-note .explore-script { display: none; width: 148px; height: auto; }
html[lang^="zh"] .explore-note .explore-script--zh,
html[lang="en"] .explore-note .explore-script--en { display: block; }
.explore-note .explore-arrow {
  width: 72px; height: 52px; margin: -19px 0 0;
  stroke-width: 2; transform: rotate(4deg);
  stroke-linecap: round; stroke-linejoin: round;
}
body.gallery-mode { overflow: hidden; }
.gallery-mode > main { z-index: 1; }
.directory-backdrop, .directory-surface {
  position: fixed; z-index: 0; opacity: 0; pointer-events: none;
  transition: opacity 720ms cubic-bezier(.22,.68,.24,1);
}
.directory-backdrop { inset: 0; background: #e9ebef; }
.directory-surface {
  top: var(--collection-top); bottom: var(--collection-bottom);
  left: 50%; transform: translateX(-50%); width: var(--collection-width);
  border-radius: var(--collection-radius); background: #f8f9fb;
  border: 1px solid #fff;
  box-shadow: 0 24px 70px -24px rgb(32 40 52 / 18%), 0 2px 10px rgb(32 40 52 / 4%);
}
.gallery-target .directory-backdrop { opacity: 1; pointer-events: auto; }
.gallery-target .directory-surface { opacity: 1; }
.directory-backdrop[hidden], .directory-surface[hidden] { display: none; }
#work-index {
  position: fixed; z-index: 3; isolation: isolate;
  top: var(--collection-top); bottom: var(--collection-bottom);
  left: 50%; width: var(--collection-width); transform: translateX(-50%);
  margin: 0; padding: 0; overflow: hidden; border-radius: var(--collection-radius);
  display: flex; flex-direction: column; pointer-events: none;
}
#work-index[hidden] { display: none; }
.directory-heading {
  height: var(--collection-header); min-height: var(--collection-header);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 32px; pointer-events: auto;
}
#work-index .directory-heading h2 { margin: 0; font: 500 21px/1.3 Arial, "PingFang SC", sans-serif; color: #303436; }
.directory-heading p { font: 13px/1.5 Arial, "PingFang SC", sans-serif; color: #777d81; margin: 7px 0 0; }
#work-index #index-close {
  width: 36px; min-width: 44px; height: 44px; display: grid; place-items: center;
  padding: 0; margin: 0; align-content: center; border: 0; border-radius: 50%; color: #65696e; background: #e9eaee;
}
#work-index #index-close:hover { background: #dfe1e6; color: #24282c; }
.directory-scroll { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 12px 32px 32px; pointer-events: auto; scrollbar-width: thin; scrollbar-color: #c8cdd3 transparent; }
#work-index .index-list { gap: 24px 18px; max-width: 760px; width: 100%; margin-inline: auto; }
#work-index .index-list button { padding: 0 4px 8px; gap: 6px; border-radius: 12px; text-align: center; justify-items: center; }
#work-index .index-list button:hover { background: none; }
#work-index .index-list button:focus-visible { outline-offset: 0; }
#work-index strong { margin-top: 9px; font-size: 16px; font-weight: 500; color: #353b3e; }
#work-index small { font-size: 12px; color: #6d7478; line-height: 1.5; }
#work-index [data-current] strong::after { content: ""; }
#work-index [data-current] strong { color: #29372f; }
#work-index .directory-slot { width: 100%; height: clamp(154px, 17vw, 178px); }
.gallery-settled #scene {
  clip-path: inset(calc(var(--collection-top) + var(--collection-header)) calc((100vw - var(--collection-width)) / 2) var(--collection-bottom) round 0 0 var(--collection-radius) var(--collection-radius));
}
@media (max-width: 650px) {
  body { --collection-width: calc(100vw - 24px); --collection-top: 104px; --collection-bottom: 16px; --collection-header: 88px; --collection-radius: 20px; }
  .portfolio-intro { left: 24px; right: 24px; }
  .portfolio-intro h1 { font-size: 19px; }
  .portfolio-intro p { font-size: 12px; line-height: 1.6; max-width: 300px; margin: 8px auto 0; }
  .cartridge-caption { padding: 8px 12px 9px; border-radius: 12px; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 3px 9px; }
  .cartridge-caption .selection-heading { gap: 7px; margin: 0; }
  .caption-title { font-size: 14px; }
  .caption-number { font-size: 9px; }
  .caption-meta { font-size: 10px; }
  .explore-note { left: 24px; top: 75%; gap: 7px; }
  .explore-note .explore-script { width: 116px; }
  .explore-note .explore-arrow { width: 48px; height: 42px; margin-top: -18px; }
  .directory-heading { padding-inline: 20px; }
  #work-index .directory-heading h2 { font-size: 19px; }
  .directory-heading p { font-size: 12px; }
  .directory-scroll { padding: 4px 18px 24px; }
  #work-index .index-list { gap: 24px 16px; }
  #work-index .directory-slot { height: clamp(128px, 36vw, 176px); }
  #work-index strong { font-size: 15px; }
  #work-index small { font-size: 12px; }
}
@media (min-width: 651px) and (max-height: 700px) {
  body { --collection-height: min(var(--collection-content-height, 920px), calc(100dvh - 208px)); --collection-header: 80px; }
  .portfolio-intro h1 { font-size: 21px; }
  .portfolio-intro p { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .directory-backdrop, .directory-surface, .portfolio-intro { transition: none; }
}

/* Full capsule ends at every viewport size. */
.cartridge-caption { border-radius: 999px; }
