* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --paper: #f6f5f2;
  --surface: #fffdfa;
  --ink: #282425;
  --muted: #645b60;
  --accent: #68334a;
  --line: #d9d1d1;
  --serif: Lora, 'jf-lanyangming', 'Noto Serif TC', 'Yu Mincho', 'PMingLiU', serif;
  --sans: system-ui, 'Microsoft JhengHei', sans-serif;
}
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem var(--sans); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gallery-page { height: 100dvh; overflow: hidden; font: 200 1rem var(--serif); }
.corner-entry {
  position: absolute;
  z-index: 1;
  inset-block-start: max(.7rem, env(safe-area-inset-top));
  inset-inline-start: max(.75rem, env(safe-area-inset-left));
  display: grid;
  min-height: 2rem;
  align-items: center;
  padding: .15rem .55rem;
  border: 1px solid var(--line);
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  font: 300 .78rem var(--serif);
  text-decoration: none;
}
.close {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.wall-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 24px 5vw;
  scrollbar-color: #a68c9a transparent;
  scrollbar-width: thin;
}
.gallery-page .wall-scroll { height: 100%; overflow-y: hidden; scrollbar-width: none; }
.gallery-page .wall-scroll::-webkit-scrollbar { display: none; }
.wall { position: relative; min-width: 1px; margin: 0; }
.tile {
  position: absolute;
  display: block;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
}
.tile:is(button) { cursor: pointer; }
.tile:is(button):hover { border-color: var(--accent); }
.gallery-page .art-tile,
.gallery-page .art-tile:hover { border-color: transparent; background-clip: padding-box; }
.tile.is-selected { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 1; }
.work-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.work-image.is-cover { object-fit: cover; }
.art-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  width: 100%;
  height: 100%;
  padding: 12px;
  text-align: center;
  color: var(--accent);
  background: #eeebe8;
  font: clamp(1rem, 2.7vw, 2.1rem)/1.25 var(--serif);
}
.placeholder-size { font: .78rem var(--sans); color: var(--muted); }
.placeholder-title { font-weight: 300; }
.caption-tile { padding: clamp(8px, .8rem, 13px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.caption-content { display: block; }
.caption-tile.caption-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.caption-title, .caption-copy { display: block; overflow-wrap: anywhere; }
.caption-title { font: 300 calc(1rem * var(--caption-scale, 1))/1.3 var(--serif); }
.caption-copy { margin-top: .35em; font: 200 calc(.85rem * var(--caption-scale, 1))/1.5 var(--serif); white-space: pre-wrap; }
/* Keep Lora for Latin characters while the justfont classes request Chinese glyphs. */
.jf-active :is(.wall, .detail-copy) :is(.jf-lanyangming-book, .jf-lanyangming-light) { font-family: var(--serif) !important; }
.gallery-notice { position: fixed; left: .75rem; bottom: .75rem; margin: 0; padding: .3rem .55rem; background: var(--surface); font-size: .8rem; }
[hidden] { display: none !important; }
.work-dialog {
  position: fixed;
  width: 70vw;
  max-width: 1400px;
  max-height: 90dvh;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 18px 70px #251a2a24;
  overflow: visible;
}
.work-dialog::backdrop { background: #28202690; }
.dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: min(76dvh, 850px);
}
.close { position: absolute; top: 14px; right: 14px; z-index: 1; font-size: 1.5rem; }
.detail-image { background: #eeebe8; min-width: 0; min-height: 0; }
.detail-copy { padding: 4.25rem clamp(1.25rem, 4vw, 3.5rem) 2rem; overflow: auto; }
.language-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
.language {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: .35rem .6rem;
  min-height: 2.25rem;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
}
.language[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: white; }
.detail-copy h2 { font: 300 clamp(1.7rem, 3vw, 3.25rem)/1.15 var(--serif); margin: 1.5rem 0 .5rem; overflow-wrap: anywhere; }
.work-year, .work-medium { color: var(--muted); margin: .4rem 0; font-size: .9rem; overflow-wrap: anywhere; }
.work-paragraph { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
body:has(.work-dialog[open]) { overflow: hidden; }
@media (width > 720px) {
  .detail-copy h2 { font-size: clamp(1.4rem, 2.2vw, 2.125rem); }
}
@media (max-width: 720px) {
  .wall-scroll { padding-block: 16px; }
  .work-dialog { width: calc(100% - 16px); max-height: 96dvh; }
  .dialog-body { display: block; height: min(91dvh, 850px); overflow-y: auto; }
  .detail-image { height: min(52dvh, 440px); }
  .detail-copy { padding: 1.5rem 1.2rem 2rem; overflow: visible; }
}
