:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --page: #f9f9f7;
  --surface: #fff;
  --ink: #181818;
  --muted: #585852;
  --line: #dcdcd6;
  --strong-line: #92928b;
  --wash: #efefeb;
  --cover: #e9e9e5;
  --shadow: #15151519;
  --veil: #25252535;
  --small: 160ms;
  --move: 260ms;
  --panel: 310ms;
  --ease: cubic-bezier(.22, .72, .24, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #161616;
  --surface: #202020;
  --ink: #f1f0eb;
  --muted: #b2b2ab;
  --line: #373735;
  --strong-line: #777772;
  --wash: #2b2b29;
  --cover: #2b2b29;
  --shadow: #0007;
  --veil: #0007;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-inline-size: 0; background: var(--page); color: var(--ink); }
h1, h2, h3, p, figure { margin: 0; }
img { display: block; max-inline-size: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button, input, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
main:focus-visible { outline: none; }
html:has(dialog[open]) { overflow: hidden; }

.sr-only, .skip:not(:focus) {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 2; inset: 8px auto auto 8px; padding: 10px 15px; background: var(--surface); }
.wrap { width: min(100% - clamp(36px, 10vw, 152px), 1184px); margin-inline: auto; }
.icon {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-ready :is(body, .page-header, .search-button, .icon-button, .text-button, .nav a, .card-category, .filters button, .page-footer, .collection-header, .card-actions, .intro, .card-meta, .card-copy, .card-domain, .result-count, #page-intro, .brand-mark, .intro-rule) {
  transition: background-color var(--move) var(--ease), color var(--move) var(--ease), border-color var(--move) var(--ease), box-shadow var(--move) var(--ease);
}

.page-header { border-bottom: 1px solid var(--line); }
.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  min-height: 73px;
}
.brand { display: inline-flex; justify-self: start; align-items: center; min-height: 44px; gap: 12px; font-size: 18px; font-weight: 750; white-space: nowrap; }
.brand-mark { position: relative; display: inline-block; width: 28px; height: 28px; border-radius: 3px; background: var(--ink); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 10px; height: 10px; border: solid var(--page); }
.brand-mark::before { top: 7px; left: 7px; border-width: 1px 0 0 1px; }
.brand-mark::after { bottom: 7px; right: 7px; border-width: 0 1px 1px 0; }
.nav { display: flex; align-self: stretch; gap: clamp(12px, 2.2vw, 35px); }
.nav a { display: inline-flex; align-items: center; padding: 0 2px; min-height: 44px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
.nav a[aria-current] { border-color: currentColor; font-weight: 650; }
.utilities { justify-self: end; display: flex; gap: 9px; }
.icon-button, .search-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 9px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.icon-button { min-width: 44px; padding: 0 9px; }
.search-button { border-color: var(--line); background: var(--surface); }
.icon-button:hover, .search-button:hover, .text-button:hover { background: var(--wash); }
kbd { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; font: 11px/1.25 var(--mono); color: var(--muted); }
.search-button kbd { margin-left: 7px; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .42fr);
  align-items: end;
  gap: clamp(20px, 5vw, 76px);
  padding: clamp(45px, 6.4vw, 88px) 0 clamp(36px, 5.3vw, 69px);
  border-bottom: 1px solid var(--strong-line);
}
.intro h1 {
  margin-inline-start: -.06em;
  font: 700 clamp(60px, 8.1vw, 124px)/1.05 var(--serif);
  letter-spacing: -.077em;
  overflow-wrap: anywhere;
}
.title-period { padding-inline-start: .08em; }
.intro-rule { width: 42px; height: 2px; margin-top: 21px; background: var(--ink); }
.intro p {
  min-width: 0;
  margin-bottom: 3px;
  padding: 2px 0 2px 20px;
  border-left: 1px solid var(--line);
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.8;
  color: var(--muted);
}

.collection-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 28px; padding: 22px 0 18px; }
.collection-name { display: flex; align-items: baseline; gap: 12px; }
.collection h2 { font-size: clamp(20px, 2vw, 25px); font-weight: 700; letter-spacing: -.03em; }
.result-count { color: var(--muted); font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filters button { min-height: 44px; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 13px; }
.filters button:hover { color: var(--ink); background: var(--wash); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.cards { display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr); align-items: start; gap: 25px 24px; }
.card { --hover-offset: 0px; --cover-scale: 1; position: relative; min-width: 0; }
.card-inner { transform: translateY(var(--hover-offset)); transition: transform var(--move) var(--ease); }
.card-cover {
  display: block;
  overflow: hidden;
  aspect-ratio: 1.93;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cover);
  transition: background-color var(--move) var(--ease), border-color var(--move) var(--ease), box-shadow var(--move) var(--ease);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: saturate(.32);
  transform: scale(var(--cover-scale));
  transform-origin: center top;
  transition: transform var(--panel) var(--ease), filter var(--panel) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover { --hover-offset: -4px; --cover-scale: 1.035; }
  .card:hover .card-cover { box-shadow: 0 9px 20px var(--shadow); }
  .card:hover .card-cover img { filter: saturate(.8); }
}
.card:focus-within .card-cover { box-shadow: 0 7px 18px var(--shadow); }
.card-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin-top: 16px; }
.card-category { padding: 3px 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 11px; }
.card-domain, .panel-domain { color: var(--muted); font: 11px/1.45 var(--mono); overflow-wrap: anywhere; }
.card h3 { margin-top: 10px; font-size: clamp(20px, 2vw, 29px); font-weight: 720; letter-spacing: -.045em; line-height: 1.33; }
.site-link { display: inline; overflow-wrap: anywhere; }
.site-link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.site-link .icon { display: inline-block; margin-left: 6px; vertical-align: .04em; width: 16px; height: 16px; color: var(--muted); }
.card-copy { margin-top: 6px; min-height: 2.8em; color: var(--muted); font-size: 13px; line-height: 1.65; }
.card-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; border-top: 1px solid var(--line); padding-top: 3px; }
.card-actions .text-button { margin-left: -8px; }
.card-actions .icon-button { margin-right: -6px; }
.favorite[aria-pressed="true"] .icon { fill: currentColor; }
.favorite .icon { transition: fill var(--small) var(--ease); }
.page-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 17px 0 24px; margin-top: 34px; border-top: 1px solid var(--line); font: 12px/1.6 var(--mono); color: var(--muted); }
.empty { padding: 39px 0 48px; border-bottom: 1px solid var(--line); color: var(--muted); }
.empty a { display: inline-flex; align-items: center; min-height: 44px; gap: 5px; color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }

dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0;
  box-shadow: 0 16px 52px var(--shadow);
}
dialog::backdrop { background: var(--veil); }
dialog[open]::backdrop { animation: backdrop-in var(--move) var(--ease) both; }
dialog.is-closing::backdrop { animation: backdrop-out var(--small) var(--ease) both; }
.command {
  inset: min(15vh, 120px) 14px auto;
  margin: 0 auto;
  width: min(100% - 28px, 560px);
  max-height: calc(100dvh - 2 * min(15vh, 120px));
  border-radius: 13px;
}
.command::backdrop { backdrop-filter: blur(4px); }
.command[open] { animation: command-in var(--move) var(--ease) both; }
.command.is-closing { animation: command-out var(--small) var(--ease) both; }
.command-input { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 17px; border-bottom: 1px solid var(--line); }
.command-input:focus-within { border-color: var(--strong-line); }
.command-input > .icon { color: var(--muted); }
.command-input input { width: 100%; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent; }
.command-input input::placeholder { color: var(--muted); opacity: 1; }
.search-results { display: grid; gap: 4px; margin: 0; padding: 8px; list-style: none; }
.search-results:empty { display: none; }
.search-results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 9px 13px; min-height: 49px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--wash); }
.search-results strong { display: block; font-size: 14px; }
.search-results small { color: var(--muted); font: 11px/1.5 var(--mono); overflow-wrap: anywhere; }
.search-empty { padding: 26px 17px; color: var(--muted); font-size: 14px; }
.search-hint { display: flex; flex-wrap: wrap; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.preview-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 520px);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border-width: 0 0 0 1px;
  overscroll-behavior: contain;
}
.preview-panel[open] { animation: panel-in var(--panel) var(--ease) both; }
.preview-panel.is-closing { animation: panel-out var(--small) var(--ease) both; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 9px clamp(17px, 5vw, 27px); font-size: 14px; font-weight: 650; }
.panel-body { padding: clamp(17px, 5vw, 27px); }
.panel-body img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: center top; background: var(--cover); border: 1px solid var(--line); border-radius: 6px; }
.panel-body figcaption { margin-top: 8px; color: var(--muted); font-size: 11px; }
.panel-category { margin: 25px 0 8px; color: var(--muted); font-size: 12px; }
.panel-body h2 { font-size: clamp(25px, 6vw, 34px); line-height: 1.26; }
.panel-domain { margin: 9px 0 13px; }
.panel-copy { color: var(--muted); font-size: 15px; line-height: 1.7; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.panel-actions .icon-button { border-color: var(--line); }
.primary-button { display: inline-flex; align-items: center; min-height: 44px; gap: 7px; padding: 0 13px; border: 1px solid var(--ink); border-radius: 6px; background: var(--ink); color: var(--page); font-size: 14px; }
.primary-button:hover { background: var(--page); color: var(--ink); }

@keyframes command-in { from { opacity: 0; transform: translateY(-9px) scale(.985); } }
@keyframes command-out { to { opacity: 0; transform: translateY(-7px) scale(.99); } }
@keyframes panel-in { from { transform: translateX(100%); } }
@keyframes panel-out { to { transform: translateX(100%); } }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes backdrop-out { to { opacity: 0; } }

@media (max-width: 700px) {
  .wrap { width: calc(100% - 36px); }
  .masthead { min-height: 59px; grid-template-columns: 1fr auto; gap: 0 10px; }
  .brand { grid-column: 1; grid-row: 1; }
  .utilities { grid-column: 2; grid-row: 1; }
  .nav { grid-column: 1 / -1; grid-row: 2; }
  .search-button kbd { display: none; }
  .intro { grid-template-columns: 1fr; gap: 16px; padding: 35px 0 27px; }
  .intro h1 { font-size: clamp(47px, 10.5vw, 70px); }
  .intro-rule { display: none; }
  .intro p { margin: 0; padding: 0; border-left: 0; }
  .collection-header { padding: 16px 0 12px; }
  .cards { grid-template-columns: 1fr; }
  .card-copy { min-height: 0; }
  .page-footer { margin-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .card:hover { --hover-offset: 0px; --cover-scale: 1; }
}
