/* Beyond the Blueprint: visitor guide
   Palette and type follow the exhibition signage: black type on white,
   the warm grey of the gallery walls, Sofia Pro and Bembo. */

@font-face { font-family: "Sofia Pro"; font-weight: 300; font-display: swap; src: url("fonts/sofiapro-light.woff2") format("woff2"); }
@font-face { font-family: "Sofia Pro"; font-weight: 400; font-display: swap; src: url("fonts/sofiapro-regular.woff2") format("woff2"); }
@font-face { font-family: "Sofia Pro"; font-weight: 500; font-display: swap; src: url("fonts/sofiapro-medium.woff2") format("woff2"); }
@font-face { font-family: "Bembo Std"; font-weight: 600; font-display: swap; src: url("fonts/bembo-semibold.woff2") format("woff2"); }

:root {
  --paper: #FFFFFF;
  --ink: #161616;
  --stone: #6D6B66;
  --wall: #D9D6CF;
  --hairline: rgba(22, 22, 22, 0.14);
  --sheet: #F4F3F0;
  --sans: "Sofia Pro", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Bembo Std", "Bembo", Garamond, "Times New Roman", "Songti SC", "Noto Serif SC", serif;
  --gutter: clamp(22px, 6vw, 44px);
  --measure: 35rem;
  --header: 64px;
  color-scheme: light dark;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211; --ink: #ECEAE5; --stone: #9C9A94; --wall: #262523;
    --hairline: rgba(236, 234, 229, 0.14); --sheet: #1A1A19;
  }
}
:root[data-theme="dark"] {
  --paper: #121211; --ink: #ECEAE5; --stone: #9C9A94; --wall: #262523;
  --hairline: rgba(236, 234, 229, 0.14); --sheet: #1A1A19;
}

*, *::before, *::after { box-sizing: inherit; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header) + env(safe-area-inset-top, 0px) + 12px); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.62 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[lang="zh"] { font-weight: 400; }

/* Logo: black roundel on light, white on dark */
.logo { display: block; }
.logo img { width: 100%; height: auto; }
.logo .on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo .on-light { display: none; }
  :root:not([data-theme="light"]) .logo .on-dark { display: block; }
}
:root[data-theme="dark"] .logo .on-light { display: none; }
:root[data-theme="dark"] .logo .on-dark { display: block; }

/* Header */
.masthead {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: calc(var(--header) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.masthead .home { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.masthead .logo { width: 40px; }
.masthead .home span { font: 400 0.8rem/1.2 var(--sans); letter-spacing: 0.08em; }
.index-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink);
  font: 400 0.9rem var(--sans); text-decoration: none; cursor: pointer;
}
.index-btn i { display: grid; gap: 4px; }
.index-btn i::before, .index-btn i::after { content: ""; width: 14px; height: 1px; background: currentColor; }

main { display: block; }
.measure { padding: 0 var(--gutter); max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; }

/* Section opening: echoes the vinyl panels on the walls */
.opening { padding: 52px 0 40px; }
.whereabouts { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 18px; font: 500 0.88rem var(--sans); }
.whereabouts .floor { font-weight: 400; color: var(--stone); }
h1 { font: 300 clamp(2.15rem, 9.5vw, 3.4rem)/1.04 var(--sans); text-transform: uppercase; letter-spacing: 0.005em; margin: 0 0 28px; }
.lead { font: 600 1.42rem/1.35 var(--serif); margin: 0 0 26px; }
.prose p { margin: 0 0 1.05em; }
.count { margin: 26px 0 0; padding-top: 16px; border-top: 1px solid var(--hairline); font-size: 0.92rem; color: var(--stone); }

/* Cover */
.cover .logo { width: 120px; margin: 0 0 40px; }
.cover h1 { font-size: clamp(2.9rem, 14vw, 4.6rem); margin-bottom: 18px; }
.cover .subtitle { font: 400 0.95rem var(--sans); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 30px; }
.cover .when { margin: 0; color: var(--stone); font-size: 0.98rem; line-height: 1.5; }
.designers { margin-top: 12px; }
.designers h2 { font: 500 0.92rem var(--sans); margin: 0 0 14px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.designers ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; }
.designers li { break-inside: avoid; }
.designers button {
  display: block; width: 100%; text-align: left; padding: 7px 0; border: 0; background: none; color: var(--ink);
  font: 400 0.92rem/1.3 var(--sans); cursor: pointer;
}
.designers button [lang="zh"] { display: block; color: var(--stone); font-size: 0.85rem; }
.designers .hint { font-size: 0.85rem; color: var(--stone); margin: 18px 0 0; }

/* Credits (prologue) */
.credits { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 20px; margin: 36px 0 0; padding-top: 22px; border-top: 1px solid var(--hairline); font-size: 0.92rem; line-height: 1.45; }
.credits dt { font-weight: 500; margin-bottom: 2px; }
.credits dd { margin: 0; }
.partners { margin: 30px 0 0; padding-top: 18px; border-top: 1px solid var(--hairline); font-size: 0.92rem; }
.partners h3 { font: 500 0.92rem var(--sans); margin: 0 0 8px; }
.partners p { margin: 0; color: var(--stone); }

/* Artworks: each work hangs on a field of gallery-wall grey */
.work { padding: 0 0 48px; }
.work + .work { padding-top: 12px; }
.wall {
  margin: 0 calc(-1 * var(--gutter)) 24px;
  padding: clamp(28px, 9vw, 64px) clamp(28px, 11vw, 80px);
  background: var(--wall);
  display: flex; justify-content: center;
}
.wall img { width: auto; max-height: 62vh; height: auto; box-shadow: 0 1px 2px rgba(0,0,0,.10), 0 10px 26px rgba(0,0,0,.10); }
.label { display: grid; grid-template-columns: 3.3rem 1fr; column-gap: 8px; }
.label .no { margin: 0; font: 500 0.88rem/1.9 var(--sans); }
.label .body { min-width: 0; }
.label .artist { margin: 0; font: 500 1rem/1.4 var(--sans); }
.label .artist [lang="zh"] { margin-left: 6px; font-weight: 400; }
.label h3 { margin: 2px 0 0; font: 600 1.34rem/1.28 var(--serif); }
.label h3 .year { font: 300 1rem var(--sans); color: var(--stone); white-space: nowrap; }
.label .meta { margin: 10px 0 16px; font-size: 0.9rem; line-height: 1.5; color: var(--stone); }
.label .meta span { display: block; }
.film { margin: 8px 0 18px; }
.film .frame { position: relative; aspect-ratio: 16 / 9; background: var(--wall); }
.film iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.film figcaption { font-size: 0.88rem; color: var(--stone); padding-top: 8px; }

/* Onward */
.onward { display: block; margin: 24px 0 0; padding: 26px 0 30px; border-top: 1px solid var(--ink); text-decoration: none; }
.onward small { display: block; font-size: 0.85rem; color: var(--stone); margin-bottom: 6px; }
.onward strong { display: block; font: 300 1.55rem/1.15 var(--sans); text-transform: uppercase; }
.onward em { display: block; font-style: normal; font-size: 0.9rem; color: var(--stone); margin-top: 10px; max-width: 26rem; }

.venue { margin-top: 32px; padding: 28px var(--gutter) 52px; border-top: 1px solid var(--hairline); font-size: 0.88rem; color: var(--stone); line-height: 1.55; }
.venue .inner { max-width: var(--measure); margin: 0 auto; display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start; }
.venue p { margin: 0; }
.venue strong { color: var(--ink); font-weight: 500; }

/* Index: contents, search, jump to any work */
.toc { list-style: none; margin: 0; padding: 0; }
.toc > li { border-top: 1px solid var(--hairline); }
.toc > li:last-child { border-bottom: 1px solid var(--hairline); }
.toc .row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 12px; padding: 16px 0; text-decoration: none; }
.toc .l { display: block; font-size: 0.85rem; color: var(--stone); margin-bottom: 2px; }
.toc .t { display: block; font: 300 1.3rem/1.2 var(--sans); text-transform: uppercase; }
.toc .f { font-size: 0.85rem; color: var(--stone); }
.toc .here { display: inline-block; margin-left: 8px; padding: 0 6px; font-size: 0.72rem; line-height: 1.6; border: 1px solid var(--stone); color: var(--ink); vertical-align: 1px; }
.toc details { margin: -6px 0 14px; }
.toc summary { cursor: pointer; font-size: 0.88rem; color: var(--stone); padding: 4px 0; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: "+"; display: inline-block; width: 1.1em; }
.toc details[open] summary::before { content: "−"; }
.toc .works, .results { list-style: none; margin: 6px 0 0; padding: 0; }
.toc .works a, .results a { display: grid; grid-template-columns: 3rem 1fr; gap: 8px; padding: 7px 0; text-decoration: none; font-size: 0.93rem; line-height: 1.35; }
.toc .works b, .results b { font-weight: 500; }
.toc .works span small, .results span small { display: block; color: var(--stone); font-size: 0.84rem; }

.finder { margin: 18px 0 22px; }
.finder label { display: block; font-size: 0.85rem; color: var(--stone); margin-bottom: 6px; }
.finder input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink); font: 400 1rem var(--sans); -webkit-appearance: none; appearance: none;
}
.results:empty { display: none; }
.results { margin: 0 0 20px; }
.results li { border-bottom: 1px solid var(--hairline); }
.no-match { font-size: 0.9rem; color: var(--stone); margin: 0 0 20px; }

dialog.index-sheet { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: var(--sheet); color: var(--ink); }
dialog.index-sheet::backdrop { background: var(--sheet); }
.sheet-head {
  position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: calc(var(--header) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  background: var(--sheet); border-bottom: 1px solid var(--hairline);
}
.sheet-head p { margin: 0; font: 400 0.8rem/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; }
.sheet-head p small { display: block; letter-spacing: 0; text-transform: none; color: var(--stone); font-size: 0.82rem; }
.sheet-body { padding: 4px var(--gutter) calc(48px + env(safe-area-inset-bottom, 0px)); max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; }
dialog[open].index-sheet { animation: sheet-in 0.26s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (min-width: 760px) {
  .wall { margin-left: 0; margin-right: 0; }
  .designers ul { columns: 3; }
  .credits { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open].index-sheet { animation: none; }
  html { scroll-behavior: auto; }
}
.toc .here[hidden] { display: none; }
.finder input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.designers button:disabled { cursor: default; color: var(--ink); opacity: 1; }

/* ---------- Three-page structure ---------- */
.section { padding-top: 8px; }
.section + .section { margin-top: 40px; border-top: 1px solid var(--ink); padding-top: 44px; }
.sec-head { margin-bottom: 4px; }
.section-label { margin: 0 0 12px; font: 500 0.88rem var(--sans); }
.section h2 { font: 300 clamp(1.9rem, 8vw, 2.7rem)/1.06 var(--sans); text-transform: uppercase; letter-spacing: 0.005em; margin: 0 0 24px; }
.section-works .sec-head, .section-chapter .sec-head { margin-bottom: 0; }
.section-chapter > .count { margin-bottom: 36px; }
.closing { margin-top: 26px; }
.questions { margin: 4px 0 22px; padding: 0; list-style: none; counter-reset: q; }
.questions li { counter-increment: q; display: grid; grid-template-columns: 2.4rem 1fr; padding: 12px 0; border-top: 1px solid var(--hairline); font: 600 1.18rem/1.35 var(--serif); }
.questions li:last-child { border-bottom: 1px solid var(--hairline); }
.questions li::before { content: counter(q, decimal-leading-zero); font: 500 0.88rem/1.9 var(--sans); }
.names { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; font-size: 0.93rem; line-height: 1.35; }
.names li { break-inside: avoid; padding: 5px 0; }
.section-names h2 { font-size: 1rem; font-weight: 500; text-transform: none; letter-spacing: 0; margin-bottom: 14px; padding-top: 0; }

/* Page opening for Level 1 and Level 56 */
.contents { margin-top: 8px; border-top: 1px solid var(--hairline); }
.contents p { margin: 16px 0 6px; font-size: 0.85rem; color: var(--stone); }
.contents ol { list-style: none; margin: 0; padding: 0; }
.contents a { display: block; padding: 10px 0; border-bottom: 1px solid var(--hairline); text-decoration: none; font: 300 1.2rem/1.25 var(--sans); text-transform: uppercase; }
.contents a span { display: block; font: 500 0.8rem var(--sans); text-transform: none; margin-bottom: 2px; }

/* Sticky section bar under the header */
.section-bar {
  position: sticky; top: calc(var(--header) + env(safe-area-inset-top, 0px)); z-index: 9;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.section-bar ol { list-style: none; margin: 0 auto; padding: 0 var(--gutter); display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; max-width: calc(var(--measure) + 2 * var(--gutter)); }
.section-bar ol::-webkit-scrollbar { display: none; }
.section-bar a { display: block; padding: 12px 0 10px; white-space: nowrap; text-decoration: none; font-size: 0.88rem; color: var(--stone); border-bottom: 2px solid transparent; }
.section-bar a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
html { scroll-padding-top: calc(var(--header) + 60px + env(safe-area-inset-top, 0px)); }

/* Index: floors with their sections */
.toc .subs { list-style: none; margin: -6px 0 14px; padding: 0; }
.toc .subs > li { border-top: 1px dashed var(--hairline); }
.toc .sub { display: block; padding: 9px 0; text-decoration: none; font-size: 0.98rem; }
.toc .sub .l { display: inline; margin-right: 8px; color: var(--stone); font-size: 0.85rem; }
.toc details { margin: -4px 0 10px; }
@media (min-width: 760px) { .names { columns: 3; } }
.toc .here[hidden] { display: none; }
.finder input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
