/* The Beholder's Atlas v2 · base: tokens per face, the shell, the drawer, search, shared parts.
   Each face's own layout lives in its own file (one.css, cn.css, jp.css, west.css, film.css). */

/* ---------------------------------------------------------------- tokens */
:root {
  --sys-zh: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Zen Hei", sans-serif;
  --bar-h: 56px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --measure: 40rem;
}
[data-face="one"] {
  --bg: #F3F3F1; --fg: #141414; --dim: #6B6B68; --faint: #A4A4A0; --rule: #D3D3CF; --card: #FAFAF8; --acc: #141414; --acc2: #2F5D7C;
  --f-body: "Hanken Grotesk", var(--sys-zh); --f-disp: "Hanken Grotesk", var(--sys-zh); --f-ui: "Hanken Grotesk", var(--sys-zh);
  --w-body: 400; --w-bold: 600; --lh: 1.66; --fs: 18px;
}
[data-face="cn"] {
  --bg: #E7E6E1; --fg: #1E2124; --dim: #5B6064; --faint: #9A9C9B; --rule: #C7C6BF; --card: #EEEDE8; --acc: #2F5D7C; --acc2: #4E8A72; --seal: #B5322A;
  --f-body: "Alegreya", "LXGW WenKai", serif; --f-disp: "Ma Shan Zheng", "LXGW WenKai", serif; --f-ui: "Alegreya", "LXGW WenKai", serif; --f-grand: "Zhi Mang Xing", "Ma Shan Zheng", serif;
  --w-body: 400; --w-bold: 700; --lh: 1.72; --fs: 19px;
}
[data-face="jp"] {
  --bg: #F4F2EB; --fg: #1C1B1A; --dim: #6A6660; --faint: #A39E95; --rule: #D9D4C8; --card: #F8F6F0; --acc: #1F4E8C; --acc2: #B83A5B; --gold: #C8A44D;
  --f-body: "Zen Old Mincho", "Noto Serif SC", serif; --f-disp: "Zen Old Mincho", "Noto Serif SC", serif; --f-ui: "Zen Old Mincho", "Noto Serif SC", serif;
  --w-body: 400; --w-bold: 700; --lh: 1.78; --fs: 18px;
}
[data-face="west"] {
  --bg: #FDFDFB; --fg: #111111; --dim: #63635F; --faint: #A6A6A1; --rule: #BDBDB8; --card: #FFFFFF; --acc: #D13A26; --acc2: #1E56A0; --yel: #F2B630; --red: #D13A26; --blu: #1E56A0;
  --f-body: "Libre Caslon Text", "Noto Serif SC", serif; --f-disp: "Cinzel", "Noto Serif SC", serif; --f-ui: "Libre Caslon Text", "Noto Serif SC", serif;
  --w-body: 400; --w-bold: 700; --lh: 1.7; --fs: 17px;
}
[data-face="film"] {
  --bg: #F1F3F2; --fg: #161616; --dim: #626664; --faint: #9EA3A1; --rule: #CDD2D0; --card: #FFFFFF; --acc: #D9792B; --acc2: #CC2E2E;
  --f-body: "Jost", var(--sys-zh); --f-disp: "Jost", var(--sys-zh); --f-ui: "Jost", var(--sys-zh); --f-mono: "Courier Prime", "Courier New", monospace;
  --w-body: 400; --w-bold: 600; --lh: 1.66; --fs: 18px;
}
[data-theme="dark"] [data-face="one"], [data-theme="dark"][data-face="one"] { --bg: #101010; --fg: #EDEDEA; --dim: #9A9A96; --faint: #5F5F5C; --rule: #2C2C2A; --card: #171717; --acc: #EDEDEA; --acc2: #6F95B2; }
[data-theme="dark"] [data-face="cn"], [data-theme="dark"][data-face="cn"] { --bg: #121314; --fg: #D9D6CC; --dim: #8E8B83; --faint: #5C5A55; --rule: #2B2C2C; --card: #18191A; --acc: #6F95B2; --acc2: #79AE95; --seal: #C24A3A; }
[data-theme="dark"] [data-face="jp"], [data-theme="dark"][data-face="jp"] { --bg: #0F0D0C; --fg: #E8E1D0; --dim: #9A9184; --faint: #5E574E; --rule: #2E2924; --card: #161311; --acc: #D2AE57; --acc2: #D0607A; --gold: #D2AE57; }
[data-theme="dark"] [data-face="west"], [data-theme="dark"][data-face="west"] { --bg: #0E1B3D; --fg: #E9E4D2; --dim: #9DA3B5; --faint: #5B6481; --rule: #2D3B60; --card: #12224A; --acc: #C9A24A; --acc2: #5B8BD6; --yel: #E9C25A; --red: #D9573F; --blu: #5B8BD6; }
[data-theme="dark"] [data-face="film"], [data-theme="dark"][data-face="film"] { --bg: #0A0A0B; --fg: #D8D8D4; --dim: #8C8C88; --faint: #4E4E4B; --rule: #232324; --card: #121213; --acc: #E9A23B; --acc2: #E04848; }

/* ---------------------------------------------------------------- reset and type */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-weight: var(--w-body); font-size: var(--fs); line-height: var(--lh);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; transition: background-color .5s var(--ease), color .5s var(--ease); overflow-x: hidden; }
body.dw-open { overflow: hidden; }
em, i, cite, address, dfn, var { font-style: normal; }   /* the site sets nothing in italics */
strong, b { font-weight: var(--w-bold); }
strong.kp { font-weight: var(--w-bold); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: color-mix(in srgb, var(--acc) 26%, transparent); }
.v { writing-mode: vertical-rl; text-orientation: upright; }
.han { font-family: var(--f-disp); }

/* ---------------------------------------------------------------- the ground */
.ground { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.plate { position: relative; overflow: hidden; }
.plate > canvas.cv { position: absolute; inset: 0; display: block; }
.plate-missing { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--fg) 6%, transparent) 8px 9px); }

/* ---------------------------------------------------------------- bar */
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 40; height: var(--bar-h); display: flex; align-items: center; gap: 22px; padding: 0 clamp(14px, 3vw, 36px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent; transition: transform .45s var(--ease), border-color .3s, background-color .5s; font-family: var(--f-ui); }
body.scrolled .bar { border-bottom-color: var(--rule); }
body.bar-hide .bar { transform: translateY(-100%); }
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1.1; min-width: 0; }
.brand .b1 { font-family: "Hanken Grotesk", var(--sys-zh); font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand .b2 { font-family: "Hanken Grotesk", var(--sys-zh); font-size: 11px; color: var(--dim); white-space: nowrap; }
.faces { display: flex; gap: 2px; margin: 0 auto; }
.faces a { display: flex; align-items: baseline; gap: 7px; padding: 6px 11px 7px; border-radius: 999px; text-decoration: none; color: var(--dim); transition: color .25s, background-color .25s; }
.faces a:hover { color: var(--fg); }
.faces a[aria-current="page"] { color: var(--fg); background: color-mix(in srgb, var(--fg) 7%, transparent); }
.faces .fn { font-family: "Hanken Grotesk", var(--sys-zh); font-size: 13.5px; }
.fm { font-weight: 400; font-size: 19px; line-height: 1; }
[data-f="one"] .fm, .fm.f-one { font-family: "Hanken Grotesk", var(--sys-zh); font-weight: 300; }
[data-f="cn"] .fm, .fm.f-cn { font-family: "Ma Shan Zheng", serif; font-size: 21px; }
[data-f="jp"] .fm, .fm.f-jp { font-family: "Zen Old Mincho", "Noto Serif SC", serif; font-weight: 900; }
[data-f="west"] .fm, .fm.f-west { font-family: "Noto Serif SC", serif; font-weight: 900; }
[data-f="film"] .fm, .fm.f-film { font-family: "Jost", var(--sys-zh); font-weight: 300; }
.more { display: flex; gap: 16px; font-family: "Hanken Grotesk", var(--sys-zh); font-size: 13.5px; }
.more a { text-decoration: none; color: var(--dim); }
.more a:hover, .more a[aria-current="page"] { color: var(--fg); }
.tools { display: flex; gap: 6px; align-items: center; font-family: "Hanken Grotesk", var(--sys-zh); font-size: 13px; }
.tb { padding: 6px 10px; border-radius: 999px; color: var(--dim); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tb:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 6%, transparent); }
.tb kbd { font: 11px/1 "Hanken Grotesk", sans-serif; padding: 3px 5px; border: 1px solid var(--rule); border-radius: 4px; color: var(--dim); }
.th i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
@media (max-width: 1080px) { .more { display: none; } .tb kbd { display: none; } }
@media (max-width: 760px) {
  :root { --bar-h: 100px; }
  .bar { flex-wrap: wrap; height: auto; padding-top: 8px; gap: 4px 10px; }
  .brand { order: 1; flex: 1; }
  .tools { order: 2; }
  .faces { order: 3; width: 100%; margin: 0 0 6px; justify-content: space-between; }
  .faces a { padding: 6px 8px; }
  .faces .fn { font-size: 12.5px; }
  .tb[data-act="search"] .sl { display: none; }
}

/* ---------------------------------------------------------------- pages */
main { min-height: 100vh; }
.page { padding-top: var(--bar-h); position: relative; }
.page.enter { animation: pageIn .9s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 56px); }
section { position: relative; }
.sh { max-width: var(--measure); margin: 0 0 30px; }
.sh h2 { font-family: var(--f-disp); font-size: clamp(28px, 3.6vw, 44px); line-height: 1.15; margin-bottom: 12px; }
.sh p { color: var(--dim); margin: 0; }
.prose p, .lede p { max-width: var(--measure); }
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } .page.enter { animation: none; } html { scroll-behavior: auto; } }

/* reading lists */
.rpath { margin: 30px 0 0; border-top: 1px solid var(--rule); }
.rpath > summary { list-style: none; cursor: pointer; padding: 14px 0; display: flex; gap: 12px; align-items: baseline; font-family: var(--f-ui); color: var(--dim); }
.rpath > summary::-webkit-details-marker { display: none; }
.rpath > summary::before { content: "+"; width: 14px; display: inline-block; color: var(--fg); }
.rpath[open] > summary::before { content: "\2212"; }
.rpath > summary:hover { color: var(--fg); }
.rpath .cnt { font-size: .82em; color: var(--faint); }
.rlist { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 16px; }
.ritem { display: grid; gap: 3px; padding-left: 26px; position: relative; max-width: 52rem; font-size: .92em; line-height: 1.55; }
.ritem::before { content: ""; position: absolute; left: 0; top: .62em; width: 12px; height: 1px; background: var(--fg); }
.ritem.lv2::before { width: 8px; } .ritem.lv3::before { width: 4px; }
.rmeta { font-size: .8em; color: var(--dim); }
.rz { color: var(--dim); }
.rn { color: var(--dim); }

/* gallery of real pictures */
.gallery { display: flex; gap: 22px; overflow-x: auto; padding: 6px 2px 18px; scroll-snap-type: x proximity; cursor: grab; scrollbar-width: thin; }
.gallery.dragging { cursor: grabbing; }
.gitem { flex: 0 0 auto; width: 260px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; }
.gitem.gone { display: none; }
.gimg { display: block; height: 220px; overflow: hidden; background: color-mix(in srgb, var(--fg) 5%, transparent); }
.gimg img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.gitem:hover .gimg img { transform: scale(1.04); }
.gcap { display: grid; gap: 2px; font-size: 14px; line-height: 1.4; }
.gcap span { color: var(--dim); }

/* figures with credits */
figure.pic { margin: 22px 0; }
figure.pic.gone { display: none; }
figure.pic img { width: 100%; }
figure.pic figcaption, .credit { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--dim); display: flex; flex-wrap: wrap; gap: 2px 10px; }
figcaption .ct { color: var(--fg); }
figcaption .plink { flex-basis: 100%; }

/* quotes */
blockquote.q { margin: 26px 0; padding: 0; display: grid; gap: 8px; }
.q-orig { font-family: var(--f-disp); font-size: 1.5em; line-height: 1.45; }
.q-orig.lat { font-family: var(--f-body); font-size: 1.1em; }
.q-tr { font-size: 1.02em; }
.q-src { font-size: .82em; color: var(--dim); }

/* next face */
.next-face { margin: 120px 0 0; padding: 70px clamp(18px, 4vw, 56px) 90px; background: var(--bg); color: var(--fg); display: flex; flex-direction: column; align-items: center; gap: 18px; border-top: 1px solid var(--rule); }
.next-face > a:first-child { display: grid; justify-items: center; gap: 6px; text-decoration: none; }
.next-face .nf-l { font-family: var(--f-ui); color: var(--dim); font-size: 15px; }
.next-face .fm { font-size: clamp(90px, 14vw, 160px); line-height: 1.1; transition: transform .8s var(--ease); }
.next-face a:hover .fm { transform: scale(1.06); }
.next-face .nf-n { font-family: var(--f-disp); font-size: 30px; }
.next-face .nf-s { color: var(--dim); font-family: var(--f-ui); }
.next-face .nf-one { font-family: "Hanken Grotesk", var(--sys-zh); font-size: 14px; color: var(--dim); }
.next-face[data-face="cn"] .fm { font-family: "Ma Shan Zheng", serif; }
.next-face[data-face="jp"] .fm { font-family: "Zen Old Mincho", "Noto Serif SC", serif; font-weight: 900; }
.next-face[data-face="west"] .fm { font-family: "Noto Serif SC", serif; font-weight: 900; }
.next-face[data-face="film"] .fm { font-family: "Jost", var(--sys-zh); font-weight: 300; }

/* ---------------------------------------------------------------- drawer */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .28); opacity: 0; pointer-events: none; transition: opacity .4s var(--ease); }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(680px, 100vw); background: var(--bg); color: var(--fg); overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(104%); visibility: hidden; transition: transform .55s var(--ease), visibility 0s .55s; box-shadow: -30px 0 80px rgba(0, 0, 0, .18); font-family: var(--f-body); font-size: var(--fs); line-height: var(--lh); }
.drawer.on { transform: none; visibility: visible; transition: transform .55s var(--ease), visibility 0s; }
.dw-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 14px 18px; background: linear-gradient(var(--bg) 60%, transparent); }
.dw-x { font-family: var(--f-ui); font-size: 14px; color: var(--dim); padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--bg); }
.dw-x:hover { color: var(--fg); border-color: var(--fg); }
.dw-in { padding: 0 clamp(22px, 5vw, 56px) 70px; }
.dw-head { position: relative; margin-bottom: 18px; }
.dw-mark { float: right; margin: 0 0 12px 18px; }
.dw-mark .plate { width: 92px; height: 92px; }
.dw-crumb { display: flex; flex-wrap: wrap; gap: 4px 16px; font-family: var(--f-ui); font-size: 14px; color: var(--dim); margin-bottom: 16px; }
.dw-crumb a { text-decoration: none; display: inline-flex; gap: 6px; align-items: baseline; }
.dw-crumb a:hover { color: var(--fg); }
.dw-crumb .fm { font-size: 17px; }
.dw-title { font-family: var(--f-disp); font-size: clamp(32px, 5vw, 50px); line-height: 1.08; }
.dw-term.han { font-size: clamp(54px, 9vw, 92px); }
.dw-xt { font-size: clamp(28px, 4vw, 40px); line-height: 1.18; }
.dw-alt { margin-top: 6px; color: var(--dim); font-size: 1.05em; }
.dw-life, .dw-work { color: var(--dim); font-size: .92em; margin-top: 4px; }
.dw-key { font-size: 1.18em; line-height: 1.5; margin: 22px 0; clear: both; }
.dw-body { margin-top: 20px; }
.dw-pic img { max-height: 62vh; width: auto; margin: 0 auto; }
.dw-sec { margin-top: 38px; padding-top: 16px; border-top: 1px solid var(--rule); }
.dw-sec h4 { font-family: var(--f-ui); font-size: 14px; color: var(--dim); margin: 0 0 12px; font-weight: 400; }
.dw-sec p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tchip { display: inline-flex; gap: 8px; align-items: baseline; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; font-size: 15px; }
.tchip:hover { border-color: var(--fg); }
.tchip b { font-weight: 400; font-family: var(--f-disp); }
.rel-row, .place-row { display: grid; grid-template-columns: 30px 1fr; align-items: baseline; gap: 2px 10px; width: 100%; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }
.rel-row:hover .rn1, .place-row:hover b { text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.rel-row .fm { font-size: 18px; text-align: center; }
.rel-row .rn2 { grid-column: 2; color: var(--dim); font-size: .85em; }
.rel-row .why, .place-row .why { grid-column: 2 / -1; color: var(--dim); font-size: .9em; }
.place-row { grid-template-columns: 1fr auto; }
.place-row span:not(.why) { color: var(--dim); font-size: .85em; }
.dw-pair { margin: 22px 0; }
.srcs { margin: 0; padding-left: 18px; font-size: .9em; color: var(--dim); }
.dw-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 46px; border-top: 1px solid var(--rule); padding-top: 18px; }
.dw-nav button { display: grid; gap: 2px; }
.dw-nav button:last-child { text-align: right; }
.dw-nav small { color: var(--dim); font-family: var(--f-ui); font-size: 13px; }

/* ---------------------------------------------------------------- search */
.palette { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .3); display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette.on { display: flex; }
.palette .box { width: min(640px, 92vw); background: var(--bg); color: var(--fg); border-radius: 14px; box-shadow: 0 30px 90px rgba(0, 0, 0, .3); overflow: hidden; font-family: "Hanken Grotesk", var(--sys-zh); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); padding: 18px 22px; font: 20px "Hanken Grotesk", var(--sys-zh); background: transparent; color: var(--fg); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow: auto; }
.palette li button { display: grid; grid-template-columns: 30px 1fr auto; gap: 0 10px; width: 100%; padding: 9px 12px; border-radius: 8px; align-items: baseline; }
.palette li button.sel, .palette li button:hover { background: color-mix(in srgb, var(--fg) 7%, transparent); }
.palette .pa { font-weight: 500; }
.palette small { color: var(--dim); }
.palette .pk { grid-column: 2 / -1; color: var(--dim); font-size: 14px; line-height: 1.4; }
.palette .empty { padding: 20px; color: var(--dim); }
.tip { position: fixed; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .2s; background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 8px; font: 13px/1.4 "Hanken Grotesk", var(--sys-zh); max-width: 300px; }
.tip.on { opacity: 1; }
.tip small { display: block; opacity: .7; }
