@import url('fonts/font-faces.css');

:root { color-scheme: light; --ink: #182522; --muted: #69746f; --line: #dce3df; --accent: #28634f; --paper: #f8faf9; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif; font-size: 15px; line-height: 1.7; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .28; cursor: default; }
.frame { width: min(1100px, calc(100% - 80px)); margin-inline: auto; }
.portal { min-height: 100svh; display: grid; place-items: center; padding: 24px 0; }
.portal-main { width: min(620px, calc(100% - 40px)); padding: 0; }
.portal-main h1 { font-family: 'Noto Serif SC', serif; font-size: 30px; font-weight: 500; line-height: 1.5; margin: 0; }
.intro { margin: 6px 0 24px; font-size: 13px; color: var(--muted); }
.destinations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.destination { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 108px; padding: 18px 44px 18px 18px; background: white; border: 1px solid var(--line); border-radius: 6px; transition: border-color .18s ease, background .18s ease; }
.destination:hover { border-color: #a9bcb2; background: #f2f6f4; }
.destination h2 { font-size: 18px; font-weight: 500; line-height: 1.5; margin: 0 0 4px; }
.destination p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.destination-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; }
.icon { width: 20px; height: 20px; display: block; }
.icon-button { display: inline-flex; flex: 0 0 auto; width: 42px; height: 42px; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 4px; background: transparent; }
.icon-button:hover:not(:disabled) { background: #e8eeeb; }
.icon-button[aria-expanded='true'] { background: #e2ebe6; }
.viewer { min-height: 100dvh; }
.viewer-toolbar { position: sticky; top: 0; z-index: 5; background: #f8faf9; border-bottom: 1px solid var(--line); }
.toolbar-inner { width: min(1500px, calc(100% - 48px)); min-height: 72px; margin: auto; display: flex; gap: 18px; align-items: center; justify-content: space-between; }
.viewer-title { font-family: 'Noto Serif SC', serif; font-weight: 500; font-size: 18px; margin: 0 auto 0 12px; }
.tools { display: flex; align-items: center; gap: 4px; }
.page-select { width: 90px; min-height: 40px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); padding: 4px 8px; font-size: 13px; }
.viewer-stage { width: min(1440px, calc(100% - 64px)); margin: 32px auto 20px; scroll-margin-top: 88px; }
.slide-frame { position: relative; background: white; aspect-ratio: 16/9; width: min(100%, calc((100dvh - 200px) * 16 / 9)); margin-inline: auto; border: 1px solid var(--line); }
.slide-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.slide-frame[data-loading='true']::after { content: '加载中'; position: absolute; inset: auto 16px 12px auto; font-size: 12px; color: var(--muted); padding: 2px 8px; background: #fff; }
.slide-caption { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding-top: 14px; }
.slide-caption p { margin: 0; font-size: 13px; color: var(--muted); }
.paging { display: flex; gap: 8px; align-items: center; }
.page-count { min-width: 60px; text-align: center; font: 500 12px 'JetBrains Mono', monospace; }
.thumbnail-grid { width: min(1440px, calc(100% - 64px)); margin: 0 auto 40px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px 16px; }
.thumbnail-grid[hidden] { display: none; }
.thumbnail { padding: 0; background: transparent; border: 0; text-align: left; }
.thumbnail img { width: 100%; height: auto; display: block; aspect-ratio: 16/9; border: 2px solid transparent; object-fit: contain; background: white; }
.thumbnail[aria-current='page'] img { border-color: var(--accent); }
.thumbnail span { font-size: 11px; color: var(--muted); }
.slide-frame:fullscreen { display: flex; width: 100vw; height: 100vh; justify-content: center; align-items: center; border: 0; background: #161b19; }
.slide-frame:fullscreen img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.zoom-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; padding: 0; border: 0; background: #edf1ef; }
.zoom-dialog::backdrop { background: #edf1ef; }
.zoom-dialog .zoom-close { position: fixed; right: 16px; top: 16px; z-index: 2; background: white; border-color: var(--line); }
.zoom-scroll { width: 100%; height: 100%; overflow: auto; padding: 76px 24px 24px; }
.zoom-scroll img { width: max(100%, 1440px); max-width: none; height: auto; display: block; }
.viewer-error { color: #9d3434; }
@media (max-width: 760px) {
  .frame { width: calc(100% - 40px); }
  .portal-main { width: min(440px, calc(100% - 40px)); }
  .portal-main h1 { font-size: 28px; }
  .destinations { grid-template-columns: 1fr; gap: 10px; }
  .destination { min-height: 84px; padding-block: 14px; }
  .toolbar-inner { width: calc(100% - 24px); min-height: 64px; gap: 6px; flex-wrap: wrap; padding-block: 8px; }
  .viewer-title { margin-left: 2px; font-size: 16px; }
  .toolbar-inner > .back-link { font-size: 0; gap: 0; width: 36px; justify-content: center; }
  .tools { gap: 0; }
  .icon-button { width: 36px; height: 40px; }
  .page-select { width: 76px; }
  .fullscreen-control { display: none; }
  .viewer-stage { width: calc(100% - 24px); margin-top: 24px; }
  .slide-caption { align-items: flex-start; gap: 8px; flex-direction: column; }
  .paging { align-self: center; }
  .thumbnail-grid { width: calc(100% - 24px); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (max-height: 420px) and (min-width: 600px) {
  .portal { padding-block: 16px; }
  .portal-main { width: min(620px, calc(100% - 48px)); }
  .intro { margin-bottom: 16px; }
  .destinations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
