/* My VN Shelf — relationship graph v1
   The same room as the shelf, with a star chart spread out on the desk:
   ink ground, paper text, one lamp-amber accent. */

@font-face {
  font-family: "Shelf Serif";
  src: url("/fonts/shelf-serif-v1.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .28s;
  animation-timing-function: cubic-bezier(.22, .61, .36, 1);
}

:root {
  color-scheme: dark;
  --ink: #0a0b0a;
  --ink-deep: #060706;
  --ink-soft: #121412;
  --paper: #eee9df;
  --text: #d8d5cd;
  --muted: #a6aaa2;
  --faint: #747b74;
  --amber: #b89b68;
  --sage: #8fa596;
  --lamp: 224 196 142;
  --line: rgb(238 233 223 / .1);
  --line-strong: rgb(238 233 223 / .22);
  --serif: "Shelf Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --bar-h: 56px;
  --panel-w: 380px;
  --edge: 24px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  height: 100%;
  overflow: hidden;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* lamp light pooled at the top of the room, as on the shelf */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 560px at 10% -12%, rgb(var(--lamp) / .05), transparent 70%),
    radial-gradient(760px 520px at 104% -6%, rgb(129 153 138 / .035), transparent 72%),
    radial-gradient(1200px 800px at 50% 58%, rgb(var(--lamp) / .018), transparent 70%);
}

/* paper grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgb(var(--lamp) / .28); color: var(--paper); }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 4px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── canvas + dust ────────────────────────────────────── */

#graph {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.dust {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* barely-there specks drifting through the dark, like the shelf's motes
   but far fainter; they live in CSS so the canvas can rest when idle */
.dust i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: rgb(255 244 222);
  box-shadow: 0 0 6px 1px rgb(var(--lamp) / .35);
  filter: blur(var(--b));
  opacity: 0;
  animation: drift var(--t) ease-in-out var(--d) infinite;
}

@keyframes drift {
  0% { opacity: 0; transform: translate(0, 0); }
  25% { opacity: var(--o); }
  50% { transform: translate(calc(var(--dx) * .5), calc(var(--dy) * .55)); }
  75% { opacity: var(--o); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}

/* ── top bar ──────────────────────────────────────────── */

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--bar-h);
  padding: 0 var(--edge);
  border-bottom: 1px solid var(--line);
  background: rgb(10 11 10 / .72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: fade .9s var(--ease) both;
}

@keyframes fade {
  from { opacity: 0; }
}

.bar-start {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex: none;
}

.back {
  position: relative;
  padding: 4px 0;
  font: 400 13px/1 var(--serif);
  letter-spacing: .06em;
  color: var(--muted);
  transition: color .35s var(--ease);
}

.back span {
  display: inline-block;
  margin-right: 2px;
  transition: transform .45s var(--ease);
}

.back:hover { color: var(--paper); }

.back:hover span { transform: translateX(-3px); }

.bar-title {
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid var(--line);
  font: 500 18px/1 var(--serif);
  letter-spacing: .08em;
  color: var(--paper);
}

.controls {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}

.seg {
  display: flex;
  align-items: center;
  gap: 18px;
}

.seg + .seg {
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.seg-label { display: none; }

.seg button,
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  font: 500 13px/1 var(--sans);
  letter-spacing: .08em;
  color: var(--faint);
  cursor: pointer;
  transition: color .35s var(--ease);
}

.seg button:hover { color: var(--text); }

.seg button[aria-pressed="true"] { color: var(--paper); }

.seg button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s var(--ease);
}

.seg button[aria-pressed="true"]::after { transform: scaleX(1); }

/* layer swatches double as the colour key */
.sw {
  flex: none;
  display: inline-block;
  opacity: .35;
  transition: opacity .35s var(--ease);
}

[aria-pressed="true"] > .sw { opacity: 1; }

/* The chart's marks in miniature, shared by the layer buttons, the
   legend and the panel: ring, open square, dot, diamond, triangle. */
.mk {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.mk-producer {
  width: 9px;
  height: 9px;
  border: 1px solid rgb(184 155 104 / .85);
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--lamp) / .95) 0 1px, transparent 1.6px);
}

.mk-group {
  width: 7px;
  height: 7px;
  border: 1px solid rgb(238 233 223 / .5);
}

.mk-scenario {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(238 233 223);
}

.mk-art {
  width: 5.5px;
  height: 5.5px;
  margin: 0 1px;
  background: rgb(129 153 138);
  transform: rotate(45deg);
}

.mk-music {
  width: 8px;
  height: 7px;
  background: rgb(138 152 176);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.mk-work,
.mk-dim,
.mk-ghost {
  width: 7px;
  height: 10px;
  border-radius: 1px;
}

.mk-work {
  background: #6f6656;
  box-shadow: inset 0 1px 0 rgb(184 155 104 / .9), 0 0 8px 1px rgb(var(--lamp) / .35);
}

.mk-dim { background: #2b2e2c; }

.mk-ghost {
  border: 1px dashed rgb(238 233 223 / .4);
  background: rgb(18 20 18 / .7);
}

.sw-arc {
  width: 9px;
  height: 5px;
  border: 1px solid rgb(184 155 104 / .85);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}

/* search: the shelf's underlined field */
.find {
  position: relative;
  flex: none;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 232px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color .35s var(--ease);
}

.search:focus-within { border-color: var(--amber); }

.search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  font: 400 13px/1.6 var(--sans);
  color: var(--paper);
  -webkit-appearance: none;
  appearance: none;
}

.search input::placeholder { color: var(--faint); }

.search input::-webkit-search-cancel-button { display: none; }

.search kbd {
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font: 500 10px/1 var(--sans);
  color: var(--faint);
  transition: opacity .25s var(--ease);
}

.search:focus-within kbd { opacity: 0; }

.find-cancel { display: none; }

.suggest {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgb(14 15 14 / .96);
  box-shadow: 0 18px 40px -16px rgb(0 0 0 / .8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: drop .28s var(--ease) both;
}

@keyframes drop {
  from { opacity: 0; transform: translateY(-4px); }
}

.suggest li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color .2s var(--ease);
}

.suggest li[aria-selected="true"] { background: rgb(238 233 223 / .05); }

.suggest .s-kind {
  grid-row: span 2;
  font: 500 10px/1.9 var(--sans);
  letter-spacing: .16em;
  color: var(--faint);
}

.suggest li[aria-selected="true"] .s-kind { color: var(--amber); }

.suggest .s-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 500 14px/1.5 var(--serif);
  color: var(--paper);
}

.suggest .s-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--faint);
}

.suggest .s-empty {
  display: block;
  padding: 12px 16px;
  font: 400 13px/1.6 var(--serif);
  color: var(--faint);
  cursor: default;
}

.bar-mobile { display: none; }

/* ── zoom + legend ────────────────────────────────────── */

.zoom {
  position: fixed;
  right: var(--edge);
  bottom: var(--edge);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .6s var(--ease), opacity .6s var(--ease);
  animation: fade 1.2s .6s var(--ease) both;
}

.zoom button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgb(10 11 10 / .6);
  font: 300 17px/1 var(--sans);
  color: var(--muted);
  cursor: pointer;
  transition: color .35s var(--ease), border-color .35s var(--ease);
}

.zoom button:hover {
  color: var(--amber);
  border-color: rgb(184 155 104 / .6);
}

.zoom svg,
.icon-btn svg,
.panel-close svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
}

.has-panel .zoom { transform: translateX(calc(-1 * var(--panel-w))); }

.legend {
  position: fixed;
  left: var(--edge);
  bottom: calc(var(--edge) - 4px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  max-width: 560px;
  font: 400 11px/1.4 var(--sans);
  letter-spacing: .08em;
  color: var(--faint);
  pointer-events: none;
  animation: fade 1.2s .9s var(--ease) both;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* a little more air between the three families of marks */
.legend-gap { margin-left: 10px; }

.legend-note {
  flex-basis: 100%;
  color: rgb(184 155 104 / .8);
}

/* ── detail panel ─────────────────────────────────────── */

.panel {
  position: fixed;
  top: var(--bar-h);
  right: 0;
  bottom: 0;
  z-index: 8;
  width: var(--panel-w);
  border-left: 1px solid var(--line);
  background: rgb(11 12 11 / .9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .6s var(--ease), visibility 0s linear .6s;
}

.panel.is-open {
  transform: none;
  visibility: visible;
  transition: transform .6s var(--ease), visibility 0s;
}

.panel-grip { display: none; }

.panel-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--faint);
  cursor: pointer;
  transition: color .35s var(--ease);
}

.panel-close:hover { color: var(--paper); }

.panel-body {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 34px 32px 56px;
  scrollbar-width: thin;
  scrollbar-color: #2b302c transparent;
}

.panel-body > * { animation: rise .6s var(--ease) both; }

.panel-body > :nth-child(2) { animation-delay: .05s; }
.panel-body > :nth-child(3) { animation-delay: .1s; }
.panel-body > :nth-child(n + 4) { animation-delay: .15s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

.p-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font: 500 10.5px/1 var(--sans);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--faint);
}

.p-title {
  margin: 14px 40px 0 0;
  font: 500 22px/1.4 var(--serif);
  letter-spacing: .02em;
  color: var(--paper);
  overflow-wrap: anywhere;
}

.p-sub {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.p-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  font: 400 14px/1.5 var(--serif);
  color: var(--text);
}

.st {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.st-active { background: var(--amber); box-shadow: 0 0 8px rgb(var(--lamp) / .5); }
.st-quiet,
.st-unknown { border: 1px solid rgb(184 155 104 / .7); }
.st-dissolved { border: 1px dashed rgb(238 233 223 / .45); }

.p-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 18px;
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.p-facts dt {
  font: 500 11px/1.9 var(--sans);
  letter-spacing: .18em;
  color: var(--faint);
}

.p-facts dd {
  margin: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.p-facts b {
  margin-left: 6px;
  font: 500 15px/1 var(--serif);
  color: var(--paper);
}

.p-facts small {
  margin-left: 6px;
  font-size: 11px;
  color: var(--faint);
}

.is-finished { color: var(--amber); }
.is-wishlist { color: var(--sage); }

.p-work {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 24px;
}

.p-work .p-facts {
  grid-template-columns: 1fr;
  gap: 2px;
  margin: 0;
}

.p-work .p-facts dd + dt { margin-top: 10px; }

.p-cover {
  position: relative;
  width: 120px;
  aspect-ratio: 5 / 7;
  border-radius: 2px;
  background: var(--ink-soft);
  box-shadow: 0 2px 3px rgb(0 0 0 / .55), 0 14px 26px -14px rgb(0 0 0 / .8);
  overflow: hidden;
}

.p-cover::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 400 40px/1 var(--serif);
  color: rgb(238 233 223 / .08);
}

.p-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .9s var(--ease);
}

.p-cover img.is-loaded { opacity: 1; }

.p-cover.is-unread img { filter: saturate(.75) brightness(.9); }

/* an unshelved work: no lamp, but its cover shown large */
.p-work.is-hero {
  grid-template-columns: 148px minmax(0, 1fr);
}

.p-hero {
  position: relative;
  width: 148px;
  margin: 0;
  aspect-ratio: 5 / 7;
  border-radius: 2px;
  background: var(--ink-soft);
  box-shadow: 0 0 0 1px rgb(238 233 223 / .06), 0 2px 3px rgb(0 0 0 / .55), 0 16px 30px -14px rgb(0 0 0 / .85);
  overflow: hidden;
}

.p-hero::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 400 44px/1 var(--serif);
  color: rgb(238 233 223 / .08);
}

.p-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .9s var(--ease), filter .6s var(--ease), transform .6s var(--ease);
}

.p-hero img.is-loaded { opacity: 1; }

.p-hero.is-veiled img {
  filter: blur(14px) saturate(.6) brightness(.6);
  transform: scale(1.12);
}

.p-unveil {
  position: absolute;
  left: 50%;
  bottom: 14px;
  padding: 6px 12px;
  border: 1px solid rgb(238 233 223 / .28);
  border-radius: 999px;
  background: rgb(10 11 10 / .62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font: 400 12px/1 var(--serif);
  letter-spacing: .08em;
  color: var(--paper);
  white-space: nowrap;
  transform: translateX(-50%);
  cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease);
}

.p-unveil:hover {
  border-color: rgb(184 155 104 / .7);
  color: var(--amber);
}

.p-of { color: var(--muted); }

/* the lamp over a finished work, as on the shelf */
.p-cover.is-lit {
  box-shadow:
    0 -1px 0 rgb(184 155 104 / .8),
    0 0 0 1px rgb(var(--lamp) / .14),
    0 -6px 30px -6px rgb(var(--lamp) / .45),
    0 18px 36px -14px rgb(var(--lamp) / .3);
}

.p-sec {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.p-sec h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 10px;
  font: 500 11px/1.4 var(--sans);
  letter-spacing: .22em;
  color: var(--faint);
}

.p-sec h3 small {
  font: 500 11px/1 var(--sans);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}

/* names wrap as a loose list; no separators to strand at a line start */
.p-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 0;
  font: 400 14px/1.75 var(--serif);
  color: var(--text);
}

.p-credit {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: baseline;
  gap: 0 12px;
}

.p-credit + .p-credit { margin-top: 8px; }

.p-role {
  font: 500 11px/1 var(--sans);
  letter-spacing: .16em;
  color: var(--faint);
}

.p-sep {
  margin: 0 7px;
  color: var(--faint);
  opacity: .6;
}

.p-link {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: color .3s var(--ease);
}

.p-link:hover { color: var(--paper); }

.p-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s var(--ease);
}

.p-link:hover::after { transform: scaleX(1); }

.p-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.p-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 0;
  border: 0;
  background: none;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.p-row.no-thumb { grid-template-columns: minmax(0, 1fr) auto; }

.p-thumb {
  position: relative;
  width: 24px;
  height: 34px;
  border-radius: 1px;
  background: var(--ink-soft);
  overflow: hidden;
}

.p-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.p-thumb.is-unread img { filter: saturate(.4) brightness(.6); }

.p-thumb.is-lit { box-shadow: 0 -1px 0 rgb(184 155 104 / .9), 0 0 10px rgb(var(--lamp) / .3); }

.p-thumb.is-ghost {
  outline: 1px dashed rgb(238 233 223 / .25);
  outline-offset: -1px;
  background: rgb(18 20 18 / .7);
}

.p-thumb.is-ghost img { filter: saturate(.6) brightness(.7); }

.p-thumb[data-veil] img { filter: blur(4px) saturate(.5) brightness(.55); }

.p-row-main { min-width: 0; }

.p-row-title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 400 14px/1.45 var(--serif);
  color: var(--text);
  transition: color .3s var(--ease);
}

.p-row:hover .p-row-title { color: var(--paper); }

.p-row-meta {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.p-tag {
  font: 500 11px/1 var(--sans);
  letter-spacing: .1em;
  color: var(--faint);
  white-space: nowrap;
}

.p-tag b {
  margin-left: 5px;
  font: 500 13px/1 var(--serif);
  color: var(--paper);
}

.p-tag.is-out::after {
  content: " ↗";
  font-size: 10px;
  opacity: .7;
}

.p-rel {
  display: inline-block;
  min-width: 52px;
  font: 500 11px/1 var(--sans);
  letter-spacing: .1em;
  color: var(--amber);
}

.p-row.no-thumb .p-row-title { display: flex; align-items: baseline; }

.p-row.no-thumb .p-row-title > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  font-size: 13px;
  letter-spacing: .04em;
}

.p-links a {
  color: var(--amber);
  transition: color .35s var(--ease);
}

.p-links a::after {
  content: " ↗";
  font-size: 10px;
  opacity: .7;
}

.p-links a:hover { color: var(--paper); }

.p-note {
  margin: 0;
  font: 400 13px/1.7 var(--serif);
  color: var(--faint);
}

.p-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 16px 0 0;
  font: 400 13px/1.5 var(--serif);
  color: var(--muted);
}

.p-chips span b {
  margin-left: 5px;
  font-weight: 500;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}

.p-chips .mk { margin: -2px 8px 0 0; }

/* skeleton rows while the expansion is on its way */
.sk {
  display: block;
  height: 11px;
  margin: 10px 0;
  border-radius: 1px;
  background: rgb(238 233 223 / .05);
  animation: pulse 2.4s ease-in-out infinite;
}

.sk:nth-child(2) { width: 78%; animation-delay: .12s; }
.sk:nth-child(3) { width: 64%; animation-delay: .24s; }
.sk:nth-child(4) { width: 70%; animation-delay: .36s; }

@keyframes pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

/* ── notice (loading / failure) ───────────────────────── */

.notice {
  position: fixed;
  inset: var(--bar-h) 0 0;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 18px;
  padding: 0 24px;
  text-align: center;
  font: 400 15px/1.8 var(--serif);
  letter-spacing: .04em;
  color: var(--faint);
  pointer-events: none;
  animation: fade 1.2s .3s var(--ease) both;
}

.notice[hidden] { display: none; }

.notice button,
.notice a {
  justify-self: center;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid rgb(184 155 104 / .6);
  background: none;
  font: 400 13px/1 var(--serif);
  letter-spacing: .08em;
  color: var(--amber);
  cursor: pointer;
  pointer-events: auto;
}

.notice.is-loading { animation: fade 1.2s .3s var(--ease) both, pulse 2.4s 1.5s ease-in-out infinite; }

.noscript {
  position: fixed;
  inset: 40% 0 auto;
  z-index: 4;
  text-align: center;
  font: 400 15px/1.8 var(--serif);
  color: var(--faint);
}

.noscript a { color: var(--amber); }

/* ── narrow screens ───────────────────────────────────── */

@media (max-width: 1239px) {
  .controls,
  .seg + .seg { gap: 16px; }

  .seg + .seg { padding-left: 16px; }

  .seg { gap: 14px; }

  .bar { gap: 20px; }

  .search { width: 180px; }
}

@media (max-width: 1023px) {
  .sw { display: none; }

  .search kbd { display: none; }

  .search { width: 140px; }

  .legend { display: none; }
}

@media (max-width: 759px) {
  :root {
    --bar-h: 52px;
    --edge: 16px;
  }

  .bar { gap: 12px; }

  .bar-start { gap: 14px; }

  .bar-title {
    padding-left: 14px;
    font-size: 16px;
  }

  .bar-mobile {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
  }

  .icon-btn { color: var(--muted); }

  .icon-btn[aria-expanded="true"] { color: var(--amber); }

  .icon-btn svg {
    width: 16px;
    height: 16px;
  }

  /* filters drop down from the bar as one quiet sheet */
  .controls {
    position: absolute;
    top: var(--bar-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 6px var(--edge) 14px;
    border-bottom: 1px solid var(--line);
    background: rgb(10 11 10 / .94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .35s var(--ease), transform .35s var(--ease), visibility 0s linear .35s;
  }

  .is-filtering .controls {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .35s var(--ease), transform .35s var(--ease), visibility 0s;
  }

  .seg,
  .seg + .seg {
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 12px 0;
    border-left: 0;
  }

  .seg + .seg { border-top: 1px solid var(--line); }

  .seg-label {
    display: block;
    width: 36px;
    font: 500 11px/1 var(--sans);
    letter-spacing: .2em;
    color: var(--faint);
    opacity: .7;
  }

  .sw { display: inline-block; }

  .find {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 var(--edge);
    background: rgb(10 11 10 / .97);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s var(--ease), visibility 0s linear .3s;
  }

  .is-finding .find {
    z-index: 3;
    opacity: 1;
    visibility: visible;
    transition: opacity .3s var(--ease), visibility 0s;
  }

  /* the filter and search icons would otherwise sit on top of 取消 */
  .is-finding .bar-mobile { visibility: hidden; }

  .search {
    flex: 1;
    width: auto;
  }

  .search input { font-size: 16px; }

  .find-cancel {
    display: block;
    flex: none;
    padding: 6px 0;
    border: 0;
    background: none;
    font: 400 13px/1 var(--sans);
    letter-spacing: .08em;
    color: var(--muted);
    cursor: pointer;
  }

  .suggest {
    top: 100%;
    left: 0;
    right: 0;
    width: auto;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .zoom { display: none; }

  /* the panel becomes a drawer from the bottom */
  .panel {
    top: auto;
    left: 0;
    width: auto;
    height: 56vh;
    height: 56dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    transform: translateY(100%);
    transition: transform .55s var(--ease), visibility 0s linear .55s;
  }

  .panel.is-open { transition: transform .55s var(--ease), visibility 0s; }

  .panel.is-dragging { transition: none; }

  .panel-grip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    height: 26px;
    touch-action: none;
    cursor: grab;
  }

  .panel-grip span {
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: rgb(238 233 223 / .18);
  }

  .panel-close {
    top: 14px;
    right: 10px;
  }

  .panel-body { padding: 30px 20px calc(36px + env(safe-area-inset-bottom)); }

  .p-title { font-size: 20px; }

  .p-work { grid-template-columns: 96px minmax(0, 1fr); gap: 18px; }

  .p-cover { width: 96px; }

  .p-work.is-hero { grid-template-columns: 124px minmax(0, 1fr); }

  .p-hero { width: 124px; }
}

/* a hidden tab keeps nothing moving */
.is-away .dust i { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .dust { display: none; }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
