/* K·Gallery 样式：首页（瀑布流画廊）和作品页（舞台 + 信息栏）共用 */
@font-face { font-family: Urbanist; src: url(fonts/urbanist-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215; }
@font-face { font-family: "Noto Sans SC"; src: url(fonts/noto-sc-gallery-044b3f23.woff2) format("woff2"); font-weight: 500 900; font-display: swap; }

:root {
  --paper: #F4F2EC;
  --panel: #FBFAF7;
  --ink: #1C202B;
  --sec: #626773;
  --ter: #686C76;
  --line: #E2DFD7;
  --well: #EEEBE4;
  --accent: #C4502C;
  --tint: #DCE1EC;
  --r: 14px;
  --r-sm: 9px;
  --gut: clamp(16px, 2.6vw, 36px);
  --gap: clamp(14px, 1.6vw, 22px);
  --f: Urbanist, "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f); font-weight: 500; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
::view-transition-group(*) { animation-duration: .42s; animation-timing-function: cubic-bezier(.3, .7, .15, 1); }
::view-transition-old(*), ::view-transition-new(*) { height: 100%; object-fit: cover; object-position: top; }

/* 字标：K·Gallery，中间的点是全站唯一的强调色 */
.logo { display: inline-flex; align-items: baseline; font-weight: 800; font-size: 21px; letter-spacing: -0.01em; text-decoration: none; line-height: 1; }
.logo i { font-style: normal; color: var(--accent); margin: 0 1px; }

/* ───────── 首页 ───────── */
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 var(--gut); }
.home { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.home > main { flex: 1 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; height: 64px; border-bottom: 1px solid var(--line); }

.filters { display: flex; align-items: center; gap: 16px; padding: 12px 0 18px; }
.chips { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; margin-left: -12px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--sec); position: relative; white-space: nowrap; transition: background-color .15s, color .15s; }
.chip:hover { background: var(--well); color: var(--ink); }
.chip b { font-weight: 600; }
.chip small { font-size: 11px; color: var(--ter); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { color: var(--ink); }
.chip[aria-pressed="true"] b { font-weight: 800; }
.chip[aria-pressed="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--ink); }

.select { position: relative; flex: none; }
.select { margin-right: -12px; }
.select select { appearance: none; -webkit-appearance: none; height: 40px; padding: 0 30px 0 12px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--sec); cursor: pointer; transition: background-color .15s, color .15s; }
.select select:hover { background: var(--well); color: var(--ink); }
.select svg { position: absolute; right: 12px; top: 50%; width: 12px; height: 12px; margin-top: -6px; pointer-events: none; color: var(--sec); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--gap); align-items: start; padding-bottom: 56px; }
.grid.masonry { display: flex; align-items: flex-start; }
.grid.masonry .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.grid.masonry .col + .col { margin-left: var(--gap); }

.card { display: block; position: relative; background: var(--tint); border-radius: var(--r); padding: clamp(14px, 6%, 26px) clamp(14px, 6%, 26px) 0; text-decoration: none; overflow: hidden; isolation: isolate; }
.card .cover { position: relative; aspect-ratio: var(--ar); border-radius: 8px; overflow: hidden; background: var(--paper); box-shadow: 0 1px 2px rgba(22, 28, 48, .08), 0 14px 34px -14px rgba(22, 28, 48, .34); transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.card .cover img, .card .cover video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card .cover video { opacity: 0; transition: opacity .4s; }
.card .cover video.on { opacity: 1; }
.card:hover .cover, .card:focus-visible .cover { transform: translateY(-3px) scale(1.012); box-shadow: 0 2px 4px rgba(22, 28, 48, .08), 0 22px 44px -16px rgba(22, 28, 48, .4); }
.card:focus-visible { outline-offset: 3px; }
.card.hl .cover { transform: translateY(-3px) scale(1.012); box-shadow: 0 2px 4px rgba(22, 28, 48, .08), 0 22px 44px -16px rgba(22, 28, 48, .4); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink); white-space: nowrap; }
.cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 54px; }
.cap .pill { background: rgba(251, 250, 247, .66); box-shadow: 0 0 0 1px rgba(22, 28, 48, .06); }
.cap .ttl { font-size: 13px; font-weight: 800; letter-spacing: .1em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 作品不满一排时，最后一列放文字索引：编号、名称、类型与模型、日期 */
.index { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.index li { border-bottom: 1px solid var(--line); }
.index a { display: grid; grid-template-columns: 2.4em 1fr auto; align-items: baseline; gap: 4px 10px; padding: 18px 10px 18px 0; text-decoration: none; border-radius: 0; transition: background-color .15s; }
.index a:hover, .index a.hl { background: linear-gradient(90deg, var(--well), rgba(238, 235, 228, 0)); }
.index .no { font-size: 13px; color: var(--ter); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.index .t { font-size: 22px; font-weight: 800; letter-spacing: .05em; line-height: 1.1; }
.index .d { font-size: 13px; color: var(--ter); font-variant-numeric: tabular-nums; }
.index .m { grid-column: 2 / 4; font-size: 13px; color: var(--sec); }

.empty { padding: 72px 0 120px; text-align: center; color: var(--sec); font-size: 15px; }
.empty button { margin-top: 14px; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); cursor: pointer; }
.foot { display: flex; justify-content: space-between; gap: 16px; padding: 20px 0 32px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ter); }

/* ───────── 作品页 ───────── */
body.viewer { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 360px; transition: grid-template-columns .32s var(--ease); }
body.viewer.collapsed { grid-template-columns: minmax(0, 1fr) 0px; }
.stage { position: relative; background: var(--tint); overflow: hidden; min-width: 0; }
.canvas { position: absolute; inset: 0; overflow: auto; display: flex; padding: 72px 72px 76px; scrollbar-width: thin; }
.sizer { margin: auto; flex: none; position: relative; }
.frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: var(--panel); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 6px rgba(22, 28, 48, .08), 0 30px 70px -24px rgba(22, 28, 48, .45); }
.frame.phone { border-radius: 40px; box-shadow: 0 0 0 7px #1C202B, 0 2px 6px rgba(22, 28, 48, .08), 0 30px 70px -24px rgba(22, 28, 48, .5); }
.frame .ph { position: absolute; left: 0; top: 0; width: 100%; height: auto; display: block; }
.frame.phone .ph { display: none; }
.frame iframe { position: relative; display: block; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .18s; }
.frame.ready iframe { opacity: 1; }
.spin { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2px solid rgba(22, 28, 48, .14); border-top-color: rgba(22, 28, 48, .55); animation: spin .8s linear infinite; }
.frame.ready .spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { position: absolute; z-index: 2; display: flex; align-items: center; height: 36px; padding: 0 2px; border-radius: 10px; background: rgba(251, 250, 247, .86); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); box-shadow: 0 0 0 1px rgba(22, 28, 48, .07), 0 6px 18px -8px rgba(22, 28, 48, .25); }
.bar.tl { left: 16px; top: 16px; }
.bar.tr { right: 16px; top: 16px; }
.bar.br { right: 16px; bottom: 16px; }
.bar.bl { left: 16px; bottom: 16px; display: none; }
.bar.bl .ib { font-weight: 700; padding: 0 12px; }
.ib { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--ink); font-size: 13px; text-decoration: none; }
.ib:hover { background: rgba(22, 28, 48, .07); }
.ib:disabled { color: var(--ter); cursor: default; background: none; }
.ib svg { width: 16px; height: 16px; flex: none; }
.bar .num { padding: 0 8px; font-size: 13px; color: var(--sec); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.bar .sep { width: 1px; height: 18px; background: rgba(22, 28, 48, .1); margin: 0 2px; }
.bar .zoom { min-width: 52px; font-variant-numeric: tabular-nums; color: var(--sec); }
.side { position: absolute; top: 50%; z-index: 2; width: 40px; height: 40px; margin-top: -20px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink); background: rgba(251, 250, 247, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 0 0 1px rgba(22, 28, 48, .07), 0 6px 18px -8px rgba(22, 28, 48, .25); }
.side svg { width: 18px; height: 18px; }
.side.prev { left: 12px; } .side.next { right: 12px; }
.side[hidden] { display: none; }

.panel { min-width: 0; overflow: hidden; background: var(--panel); border-left: 1px solid var(--line); }
.panel-in { width: 360px; height: 100%; display: flex; flex-direction: column; overflow-y: auto; padding: 28px 26px 0; transition: opacity .2s; }
body.viewer.collapsed .panel-in { opacity: 0; pointer-events: none; }
.panel h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: .04em; line-height: 1.1; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; font-size: 13px; color: var(--sec); }
.meta .pill { height: 26px; background: var(--well); }
.sec { margin-top: 30px; }
.sec h2 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--ter); letter-spacing: .04em; }
.sec p { margin: 0; font-size: 14px; line-height: 1.8; color: var(--ink); text-wrap: pretty; }
.copy { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: var(--well); font-size: 12px; font-weight: 600; color: var(--sec); cursor: pointer; }
.copy:hover { color: var(--ink); background: #E6E2D9; }
.prompt { position: relative; margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--well); font: inherit; font-size: 13.5px; line-height: 1.75; color: var(--ink); white-space: pre-wrap; word-break: break-word; max-height: 13.2em; overflow: hidden; }
.prompt::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3.2em; background: linear-gradient(rgba(238, 235, 228, 0), var(--well)); pointer-events: none; }
.prompt.open { max-height: none; }
.prompt.open::after, .prompt.short::after { display: none; }
.more { margin-top: 8px; height: 32px; padding: 0; border: 0; background: none; font-size: 13px; color: var(--sec); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(98, 103, 115, .35); }
.more:hover { color: var(--ink); }
.go { display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; margin-top: 28px; border-radius: 11px; background: var(--ink); color: var(--panel); font-size: 15px; font-weight: 700; text-decoration: none; transition: background-color .15s; }
.go:hover { background: #2C3242; }
.go svg { width: 14px; height: 14px; }
.panel-foot { margin-top: auto; padding: 28px 0 22px; display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ter); }
.panel-foot .logo { font-size: 15px; color: var(--ink); }

@media (max-width: 899px) {
  body.viewer { display: block; height: auto; overflow: auto; }
  .stage { height: 74vh; height: 74svh; }
  .bar.bl { display: flex; left: 12px; bottom: 12px; }
  .canvas { padding: 64px 16px 64px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-in { width: auto; height: auto; overflow: visible; padding: 26px var(--gut) 0; max-width: 640px; margin: 0 auto; }
  .bar.tr { display: none; }
  .bar.br { right: 12px; bottom: 12px; }
  .bar.tl { left: 12px; top: 12px; }
}
@media (hover: none) and (max-width: 899px) { .frame iframe { pointer-events: none; } }
@media (max-width: 559px) {
  .select select { font-size: 16px; font-weight: 500; }
  .select { margin-left: -12px; }
  .filters { flex-wrap: wrap; gap: 8px; }
  .chips { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
