/* VOICE   personal, calm and a little formal: an honours wall
   IDEA    a gallery wall where each certificate hangs in a white mat with a museum label, signed with a personal seal
   PICTURE the certificates themselves at their true proportions, grouped under large hanging years
   COLOUR  white header, warm plaster wall, near-black ink, seal red #c3161c as the single accent
   TYPE    system CJK sans (PingFang / YaHei) heavy for the name, regular for text
   LAYOUT  laptop: name + seal left, figures right; wall below with year column left, frames right. phone: stacked */

:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #141312);
  --wall: light-dark(#eeece8, #1d1c1a);
  --ink: light-dark(#18181a, #ecebe8);
  --muted: light-dark(#5f5d59, #a3a09a);
  --line: light-dark(#d9d6d0, #34322f);
  --mat: light-dark(#ffffff, #262523);
  --seal: light-dark(#c3161c, #e0393f);
  --seal-ink: #ffffff;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }

* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); overflow-x: clip;
  font: 16px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.band {
  padding-block: clamp(28px, 4vw, 56px);
  padding-left: max(5vw, 16px, env(safe-area-inset-left, 0px));
  padding-right: max(5vw, 16px, env(safe-area-inset-right, 0px));
}

/* 顶部：名字 + 印章 */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; max-width: 1340px; margin: 0 auto; }
.who { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 28px); }
.seal { width: clamp(64px, 8vw, 92px); height: auto; flex: none; }
.seal rect { fill: var(--seal); }
.seal text { fill: var(--seal-ink); font-family: "STKaiti", "KaiTi", "Kaiti SC", serif; font-weight: 700; }
h1 { margin: 0; font-size: clamp(36px, 5.5vw, 56px); line-height: 1.05; letter-spacing: .04em; font-weight: 800; }
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 17px; }
.links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.links:empty { display: none; }
.links a { text-decoration: none; border-bottom: 1px solid var(--line); }
.links a:hover { border-color: var(--seal); color: var(--seal); }
.stats { display: flex; gap: clamp(20px, 4vw, 48px); margin: 0; }
.stats dt { font-size: 14px; color: var(--muted); }
.stats dd { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 陈列墙 */
.wall { background: var(--wall); min-height: 60vh; }
.wall > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: clamp(20px, 3vw, 36px); }
.toolbar:has(.chips:empty):has(#search[hidden]) { display: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 15px; cursor: pointer; min-height: 40px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  padding: 6px 16px; border-radius: 999px;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { opacity: .6; margin-left: 6px; font-variant-numeric: tabular-nums; }
#search { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; min-height: 40px; width: min(280px, 100%); }
#search:focus, .chip:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }

.year { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; padding-block: 8px 40px; }
.year + .year { border-top: 1px solid var(--line); padding-top: 32px; }
.year h2 { margin: 0; font-size: 44px; font-weight: 300; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; position: sticky; top: 24px; align-self: start; }
.frames { display: flex; flex-wrap: wrap; gap: clamp(24px, 3vw, 44px); align-items: flex-start; }

.piece { margin: 0; width: calc(clamp(300px, 34vw, 460px) * var(--ar, .72) + 30px); max-width: 100%; }
.frame {
  display: block; width: 100%; padding: 14px; cursor: zoom-in;
  background: var(--mat); border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line), 0 14px 24px -18px rgba(0,0,0,.45);
  transition: transform .2s ease, box-shadow .2s ease;
  font: inherit; color: inherit;
}
.frame:hover, .frame:focus-visible { transform: translateY(-4px); box-shadow: 0 1px 0 var(--line), 0 22px 30px -18px rgba(0,0,0,.5); }
.frame:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
.frame img { width: 100%; height: auto; background: var(--wall); }
.frame .pdf { aspect-ratio: 3 / 4; display: grid; place-items: center; color: var(--muted); font-weight: 700; letter-spacing: .1em; border: 2px dashed var(--line); }
.label { margin-top: 14px; padding-left: 12px; border-left: 2px solid var(--seal); }
.label h3 { margin: 0; font-size: 16px; line-height: 1.45; font-weight: 600; }
.label p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.tag { display: inline-block; font-size: 13px; color: var(--seal); border: 1px solid currentColor; border-radius: 4px; padding: 0 6px; margin-left: 8px; line-height: 1.6; vertical-align: 1px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.foot { color: var(--muted); font-size: 14px; text-align: center; padding-block: 28px; }

/* 查看大图 */
.viewer {
  border: none; padding: 0; border-radius: 6px; background: var(--bg); color: var(--ink);
  width: min(1100px, 94vw); max-height: 92vh; overflow: hidden;
}
.viewer::backdrop { background: rgba(12, 11, 10, .82); }
.viewer-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; max-height: 92vh; }
.viewer-media { background: var(--wall); display: grid; place-items: center; padding: 20px; min-height: 300px; overflow: auto; }
.viewer-media img { max-height: calc(92vh - 40px); width: auto; box-shadow: 0 10px 30px -12px rgba(0,0,0,.4); }
.viewer-media iframe { width: 100%; height: 80vh; border: 0; background: #fff; }
.viewer-info { padding: 36px 28px 28px; overflow: auto; }
.viewer-info .tag { margin-left: 0; }
.viewer-info h2 { margin: 12px 0 18px; font-size: 22px; line-height: 1.4; }
.viewer-info dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0 0 16px; font-size: 15px; }
.viewer-info dt { color: var(--muted); white-space: nowrap; }
.viewer-info dd { margin: 0; overflow-wrap: anywhere; }
.note { color: var(--muted); font-size: 15px; white-space: pre-line; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.btn { display: block; text-align: center; text-decoration: none; padding: 11px 14px; border-radius: 6px; border: 1px solid var(--line); font-size: 15px; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--seal); border-color: var(--seal); color: #fff; }
.close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.55); color: #fff; font-size: 22px; line-height: 1;
}

@media (max-width: 760px) {
  .head { align-items: flex-start; }
  .stats { width: 100%; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; }
  .year { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .year h2 { position: static; font-size: 32px; }
  .piece { width: 100%; }
  .viewer-body { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .viewer-media img { max-height: 62vh; }
  .viewer-media iframe { height: 60vh; }
}
@media (prefers-reduced-motion: reduce) { .frame { transition: none; } .frame:hover { transform: none; } }
