:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-alt: #eef1ee;
  --ink: #1d211f;
  --muted: #5e6662;
  --line: #dde1de;
  --accent: #b94f38;
  --sage: #60725f;
  --blue: #526f80;
  --ochre: #8c7025;
  --focus: #d45e42;
  --shell: 1240px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0;
}
button, input { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }
a { color: inherit; text-underline-offset: .2em; }
[hidden] { display: none !important; }

.shell { width: min(calc(100% - 48px), var(--shell)); margin-inline: auto; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px;
}
.skip-link:focus-visible { transform: translateY(0); }

.site-header {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(360px, 1.2fr);
  gap: 72px;
  align-items: end;
  padding-block: 56px 44px;
  border-bottom: 1px solid var(--line);
}
.edition {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  font-size: 3.5rem;
  line-height: 1.08;
  font-weight: 760;
}
.intro-copy > p:first-child { max-width: 46rem; margin-bottom: 12px; font-size: 1.125rem; }
.catalog-meta { margin-bottom: 10px; color: var(--ink); font-weight: 650; }
.credit { margin-bottom: 0; color: var(--muted); font-size: .875rem; }
.credit a { color: var(--accent); }

.catalog-tools {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.tools-inner {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
}
.back-button,
.category-tabs button,
.copy-button,
.language-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 9px 13px;
  cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.back-button:hover,
.category-tabs button:hover,
.language-tab:hover { border-color: var(--ink); }
.search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding-inline: 13px;
}
.search-field span { color: var(--muted); font-size: .875rem; font-weight: 650; }
.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}
.search-field:focus-within { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 24%, transparent); }
.category-tabs { display: flex; gap: 4px; }
.category-tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.result-count { margin: 0; color: var(--muted); font-size: .875rem; white-space: nowrap; }

main { min-height: 52vh; }
.overview { padding-block: 44px 80px; }
.section-heading { display: flex; align-items: baseline; gap: 18px; margin-bottom: 24px; }
.section-heading p { margin: 0; color: var(--accent); font-size: .75rem; font-weight: 750; }
.section-heading h2 { margin: 0; font-size: 1.75rem; line-height: 1.25; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.overview-card {
  min-width: 0;
  display: grid;
  grid-template-rows: 260px 1fr;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}
.overview-card:hover,
.overview-card:focus-visible { transform: translateY(-3px); border-color: #bcc3be; box-shadow: 0 8px 20px rgba(29,33,31,.12); }
.overview-image { width: 100%; height: 100%; object-fit: contain; background: var(--surface-alt); }
.overview-copy { min-width: 0; display: grid; gap: 6px; padding: 15px 16px 16px; }
.overview-index { color: var(--muted); font-size: .75rem; font-weight: 700; }
.overview-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.overview-title { font-size: 1.075rem; font-weight: 750; }
.overview-vol { flex: 0 0 auto; color: var(--accent); font-size: .75rem; font-weight: 700; }
.overview-en { color: var(--muted); font-size: .8125rem; }
.overview-fit { margin-top: 4px; color: var(--ink); font-size: .875rem; }
.empty-state { margin: 48px 0; padding: 24px; border: 1px solid var(--line); background: var(--surface); }

.style-detail { padding-block: 44px 88px; }
.detail-layout {
  display: grid;
  grid-template-columns: minmax(230px, 320px) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.detail-copy { position: static; }
.detail-index { margin-bottom: 10px; color: var(--accent); font-size: .8125rem; font-weight: 750; }
.detail-copy h2 { margin-bottom: 3px; font-size: 2rem; line-height: 1.25; }
.detail-en { margin-bottom: 20px; color: var(--muted); font-size: .925rem; }
.detail-description { color: #3f4642; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0 0; padding: 0; list-style: none; }
.tags li { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 5px 9px; color: var(--muted); font-size: .8125rem; }
.art-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.art-card {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  text-align: left;
  cursor: zoom-in;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}
.art-card:hover,
.art-card:focus-visible { transform: translateY(-3px); border-color: #bcc3be; box-shadow: 0 8px 20px rgba(29,33,31,.12); }
.art-canvas { display: grid; place-items: center; aspect-ratio: 3 / 4; background: var(--surface-alt); overflow: hidden; }
.art-canvas img { width: 100%; height: 100%; object-fit: contain; }
.art-caption { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px 13px; }
.art-caption span:first-child { line-height: 1.45; }
.source-label { color: var(--muted); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.source-label.ours { color: var(--accent); }

.prompt-box { grid-column: 1 / -1; margin-top: 12px; border-top: 1px solid var(--line); }
.prompt-box summary { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-weight: 720; list-style: none; }
.prompt-box summary::-webkit-details-marker { display: none; }
.prompt-box summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; font-weight: 400; }
.prompt-box[open] summary::after { content: "−"; }
.prompt-content { padding: 2px 0 24px; }
.prompt-intro { max-width: 72ch; color: var(--muted); }
.language-tabs { display: flex; gap: 6px; margin: 0; }
.prompt-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.language-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.prompt-text {
  max-height: 430px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  color: #313733;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: .9rem;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-button { margin-top: 0; white-space: nowrap; background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.copy-button:hover { background: var(--accent); border-color: var(--accent); }
.copy-button[data-state="done"] { background: var(--sage); border-color: var(--sage); }

.art-dialog {
  width: min(1080px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  margin: auto;
  border: 0;
  border-radius: 8px;
  background: #171a18;
  color: #fff;
  padding: 20px 64px 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.art-dialog::backdrop { background: rgba(10,12,11,.88); }
.art-dialog figure { margin: 0; display: grid; place-items: center; gap: 12px; }
.art-dialog img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.art-dialog figcaption { color: #e6e9e7; text-align: center; }
.dialog-close,
.dialog-nav {
  position: absolute;
  z-index: 2;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.dialog-close { top: 8px; right: 8px; font-size: 1.8rem; }
.dialog-nav { top: 50%; transform: translateY(-50%); font-size: 2.4rem; }
.dialog-prev { left: 8px; }
.dialog-next { right: 8px; }
.dialog-close:hover, .dialog-nav:hover { color: #ffc4b6; }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding-block: 30px 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.site-footer p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr; gap: 20px; align-items: start; }
  h1 { font-size: 2.75rem; }
  .tools-inner { grid-template-columns: minmax(0, 1fr) auto; padding-block: 10px; }
  .back-button { grid-column: 1 / -1; justify-self: start; }
  .search-field { grid-column: 1; }
  .category-tabs { grid-column: 1 / -1; overflow-x: auto; padding-bottom: 2px; }
  .category-tabs button { flex: 0 0 auto; }
  .result-count { grid-column: 2; grid-row: 1; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; gap: 28px; }
  .detail-copy { position: static; }
  .prompt-box { grid-column: auto; }
}

@media (max-width: 600px) {
  .shell { width: min(calc(100% - 28px), var(--shell)); }
  .site-header { padding-block: 34px 28px; }
  .edition { margin-bottom: 9px; }
  h1 { font-size: 2.25rem; }
  .intro-copy > p:first-child { font-size: 1rem; }
  .catalog-tools { position: relative; }
  .tools-inner { grid-template-columns: 1fr auto; gap: 9px; }
  .search-field { grid-column: 1 / -1; }
  .result-count { grid-column: 2; grid-row: 2; }
  .category-tabs { grid-column: 1 / -1; grid-row: 3; }
  .back-button { grid-column: 1 / -1; }
  .overview { padding-block: 30px 58px; }
  .section-heading { display: block; }
  .section-heading p { margin-bottom: 5px; }
  .section-heading h2 { font-size: 1.45rem; }
  .overview-grid { grid-template-columns: 1fr; gap: 10px; }
  .overview-card { grid-template-columns: 116px minmax(0, 1fr); grid-template-rows: 154px; }
  .overview-copy { align-content: center; padding: 12px; }
  .overview-title-row { display: block; }
  .overview-title { display: block; }
  .overview-vol { display: inline-block; margin-top: 3px; }
  .overview-en { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .overview-fit { font-size: .8125rem; }
  .style-detail { padding-block: 30px 64px; }
  .detail-copy h2 { font-size: 1.7rem; }
  .art-grid { grid-template-columns: 1fr; }
  .prompt-text { max-height: 55vh; padding: 14px; }
  .art-dialog { padding: 54px 12px 14px; }
  .art-dialog img { max-height: calc(100vh - 150px); }
  .dialog-nav { top: auto; bottom: 10px; transform: none; background: rgba(0,0,0,.45); border-radius: 4px; }
  .dialog-prev { left: 10px; }
  .dialog-next { right: 10px; }
  .site-footer { display: block; }
  .site-footer p + p { margin-top: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
