/* 畫間 — stylesheet. Paper-and-ink palette, dark mode follows the system. */
:root {
  --paper: #f5f2ea;
  --paper-2: #ebe8df;
  --ink: #22312b;
  --ink-2: #4e5c55;
  --muted: #7c837a;
  --line: #d9d7cc;
  --accent: #365a49;
  --accent-2: #b8713f;
  --card: #fbfaf6;
  --shadow: 0 12px 36px rgba(34, 49, 43, .10);
  --serif: "Songti TC", "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono-caps: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1d1b;
    --paper-2: #232623;
    --ink: #ece8dd;
    --ink-2: #bdb9ad;
    --muted: #8f9389;
    --line: #353935;
    --accent: #9fc3ad;
    --accent-2: #d99a6a;
    --card: #222522;
    --shadow: 0 12px 36px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; border-radius: 2px; }
h1, h2, h3, p, dl, figure { margin: 0; }
.wrap { width: min(100% - 48px, 1400px); margin-inline: auto; }

.skip { position: fixed; top: -100px; left: 16px; background: var(--card); color: var(--ink); padding: 12px 16px; z-index: 50; box-shadow: var(--shadow); }
.skip:focus { top: 12px; }

.eyebrow { font-size: var(--mono-caps); letter-spacing: .26em; font-weight: 600; color: var(--ink-2); text-transform: uppercase; }
.dot { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-right: 10px; vertical-align: middle; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .3s, padding .3s;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 84px; transition: height .3s; }
.site-header.is-compact { border-bottom-color: var(--line); }
.site-header.is-compact .header-inner { height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-size: 24px; letter-spacing: .18em; }
.brand-mark { border: 1px solid currentColor; width: 36px; height: 42px; display: grid; place-items: center; font-size: 20px; letter-spacing: 0; border-radius: 18px 18px 2px 2px; }
.brand-text small { display: block; font: 600 8px var(--sans); letter-spacing: .18em; color: var(--muted); margin-top: 2px; }
.ghost-button { font-size: 12px; letter-spacing: .06em; border: 1px solid var(--line); padding: 9px 14px; border-radius: 999px; transition: background .2s, border-color .2s; white-space: nowrap; }
.ghost-button:hover { background: var(--paper-2); border-color: var(--ink-2); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; align-items: center; padding: 56px 0 72px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 3.6vw, 54px); line-height: 1.45; letter-spacing: .08em; margin: 20px 0 22px; }
h1 em { font-style: italic; position: relative; }
h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; border-bottom: 2px solid var(--accent-2); transform: rotate(-6deg); }
.lede { color: var(--ink-2); font-size: 14px; line-height: 2; letter-spacing: .04em; }
.hero-stats { display: flex; gap: 36px; margin: 30px 0 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.hero-stats dt { font-size: var(--mono-caps); letter-spacing: .2em; color: var(--muted); }
.hero-stats dd { margin: 2px 0 0; font-family: var(--serif); font-size: 26px; letter-spacing: .04em; }
.text-link { display: inline-flex; gap: 40px; justify-content: space-between; font-size: 12px; letter-spacing: .1em; border-bottom: 1px solid var(--ink); padding-bottom: 8px; }
.hero-art { margin: 0; }
.art-open { display: block; width: 100%; position: relative; overflow: hidden; border-radius: 4px; background: var(--paper-2); box-shadow: var(--shadow); }
.art-open img { width: 100%; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.art-open:hover img { transform: scale(1.02); }
.art-open::after { content: "↗"; position: absolute; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; font-size: 18px; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
.art-open:hover::after, .art-open:focus-visible::after { opacity: 1; transform: none; }
.hero-art figcaption, .about-art figcaption { display: flex; justify-content: space-between; font-size: var(--mono-caps); letter-spacing: .16em; color: var(--muted); padding: 14px 2px 0; text-transform: uppercase; }

/* ---------- sections ---------- */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 32px; }
.section-head .eyebrow { margin-bottom: 14px; }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 36px); line-height: 1.4; letter-spacing: .06em; }
h2 > span { font: italic 15px Georgia, serif; letter-spacing: 0; color: var(--muted); margin-left: 18px; }
.section-note { font-size: 13px; color: var(--muted); line-height: 1.9; letter-spacing: .04em; text-align: right; }

.series { padding: 24px 0 72px; }
.series-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.series-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; transition: transform .3s, box-shadow .3s, border-color .3s; }
.series-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.series-card.is-active { border-color: var(--accent); }
.series-cover { display: block; aspect-ratio: 3 / 2; background: var(--tint, var(--paper-2)); overflow: hidden; }
.series-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s; }
.series-card:hover .series-cover img { transform: scale(1.04); }
.series-body { padding: 14px 16px 16px; display: grid; gap: 2px; }
.series-body strong { font: 400 16px/1.3 Georgia, serif; }
.series-body em { font-style: normal; font-size: 13px; color: var(--ink-2); }
.series-body small { font-size: var(--mono-caps); letter-spacing: .14em; color: var(--muted); margin-top: 6px; }

.works { padding: 36px 0 96px; }
.works-title { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; margin-bottom: 30px; position: sticky; top: 64px; background: var(--paper); z-index: 5; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12px; letter-spacing: .04em; padding: 8px 14px; border-radius: 999px; border: 1px solid transparent; color: var(--ink-2); transition: background .2s, color .2s; }
.chip sup { font-size: 9px; margin-left: 4px; color: var(--muted); }
.chip:hover { background: var(--paper-2); }
.chip.is-active { background: var(--ink); color: var(--paper); }
.chip.is-active sup { color: inherit; opacity: .7; }
.toolbar-right { display: flex; align-items: center; gap: 18px; white-space: nowrap; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.sort select { font: inherit; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 4px 0; letter-spacing: .04em; }
.count { font-size: 11px; letter-spacing: .14em; color: var(--muted); }

.gallery { display: flex; gap: 26px; align-items: flex-start; }
.gallery-col { flex: 1 1 0; min-width: 0; display: grid; gap: 30px; }
.art-card { display: block; width: 100%; text-align: left; }
.art-frame { display: block; background: var(--tint, var(--paper-2)); aspect-ratio: var(--ratio, 4 / 3); border-radius: 3px; overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, .04); }
.art-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2, .7, .2, 1), opacity .4s; }
.art-card:hover .art-frame img { transform: scale(1.03); }
.art-caption { display: block; padding: 11px 2px 0; }
.art-caption strong { display: block; font: 400 14px/1.4 Georgia, serif; }
.art-caption small { display: block; font-size: var(--mono-caps); letter-spacing: .12em; color: var(--muted); margin-top: 4px; }
.gallery-note { text-align: center; font-size: 12px; color: var(--muted); letter-spacing: .06em; padding-top: 28px; line-height: 2; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.footer-brand { font: 18px var(--serif); color: var(--ink); letter-spacing: .14em; }
.footer-contact { color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 3px; transition: border-color .2s; }
.footer-contact:hover { border-bottom-color: var(--ink); }
.footer-brand span { font: 600 8px var(--sans); letter-spacing: .18em; margin-left: 12px; color: var(--muted); }

/* ---------- dialog ---------- */
dialog {
  border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  background: #111412; color: #ece8dd; display: none; grid-template-rows: auto 1fr auto; overscroll-behavior: contain;
}
dialog[open] { display: grid; outline: 0; }
dialog::backdrop { background: rgba(10, 14, 12, .9); }
body.modal-open { overflow: hidden; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; font-size: 11px; letter-spacing: .2em; color: #9ea39b; }
.dialog-actions { display: flex; gap: 6px; }
.icon-button { font-size: 12px; letter-spacing: .06em; padding: 8px 12px; border-radius: 999px; border: 1px solid #3a3f3b; color: #ece8dd; transition: background .2s; }
.icon-button:hover { background: #232724; }
.icon-button.close { border-color: transparent; }
.viewer { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; min-height: 0; }
.viewer-image { position: relative; height: 100%; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; }
.viewer-image img { max-width: calc(100% - 16px); max-height: calc(100% - 16px); width: auto; height: auto; object-fit: contain; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); cursor: zoom-in; transition: opacity .3s; }
.viewer-image img.is-loading { opacity: .35; }
.viewer-image.zoomed { display: block; cursor: grab; }
.viewer-image.zoomed img { max-width: none; max-height: none; width: auto; height: auto; margin: 0 auto; cursor: zoom-out; }
.viewer-arrow { height: 100%; font-size: 22px; color: #9ea39b; transition: color .2s, background .2s; }
.viewer-arrow:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.dialog-info { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; padding: 18px 24px 22px; border-top: 1px solid #232724; }
.dialog-title h2 { font-size: 22px; letter-spacing: .04em; color: #fff; }
.art-sub { font-size: 12px; color: #9ea39b; line-height: 1.8; margin-top: 4px; letter-spacing: .03em; }
.art-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 20px; }
.art-meta dt { font-size: 9px; letter-spacing: .2em; color: #7f857c; text-transform: uppercase; }
.art-meta dd { margin: 2px 0 0; font-size: 13px; color: #ece8dd; }
#copy-status { grid-column: 1 / -1; font-size: 11px; color: #c9cfc3; }
#copy-status:empty { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 36px; }
  .hero-copy { order: 1; }
  .hero-art { order: 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-note { text-align: left; }
  .dialog-info { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  html { scroll-padding-top: 70px; }
  .header-inner, .site-header.is-compact .header-inner { height: 60px; gap: 12px; }
  .brand { font-size: 20px; gap: 8px; }
  .brand-mark { width: 30px; height: 36px; font-size: 17px; }
  .brand-text small { display: none; }
  #surprise { display: none; }
  h1 { font-size: 30px; line-height: 1.6; letter-spacing: .04em; }
  .hero-stats { gap: 22px; }
  .hero-stats dd { font-size: 22px; }
  h2 > span { display: block; margin: 6px 0 0; font-size: 13px; }
  .series-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin-inline: -16px; padding: 4px 16px 12px; scrollbar-width: none; }
  .series-list::-webkit-scrollbar { display: none; }
  .series-card { flex: 0 0 70vw; max-width: 280px; scroll-snap-align: start; }
  .toolbar { position: static; flex-direction: column; align-items: stretch; gap: 10px; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .toolbar-right { justify-content: space-between; }
  .gallery { gap: 14px; }
  .gallery-col { gap: 18px; }
  .art-caption strong { font-size: 13px; }
  .site-footer { flex-wrap: wrap; }
  .site-footer .footer-contact { order: 3; width: 100%; }
  .dialog-top { padding: 10px 12px; }
  .dialog-actions .icon-button { padding: 7px 10px; font-size: 11px; }
  .viewer { grid-template-columns: 36px 1fr 36px; }
  .viewer-image img { max-width: 100%; max-height: 100%; box-shadow: none; }
  .dialog-info { padding: 14px 16px 18px; }
  .dialog-title h2 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
