:root {
  color-scheme: light;
  --navy: #243f6b;
  --navy-deep: #172a49;
  --blue: #31538a;
  --gold: #9b8a4d;
  --paper: #ffffff;
  --canvas: #eef3f9;
  --line: #d5dfec;
  --muted: #6a7687;
}

* { box-sizing: border-box; }

html {
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--navy-deep);
  background:
    linear-gradient(180deg, rgba(36, 63, 107, 0.08), transparent 28rem),
    var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 80px;
  padding: 12px max(20px, calc((100vw - 1020px) / 2));
  color: white;
  background: rgba(36, 63, 107, 0.96);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(23, 42, 73, 0.18);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 13px;
}

.brand img {
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.brand-name {
  margin: 0 0 3px;
  color: #dce7f5;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.38rem);
  line-height: 1.25;
}

.page-count {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: white;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  font-size: 0.88rem;
}

.viewer {
  width: min(100%, 1020px);
  margin: 0 auto;
  padding: 18px 18px 56px;
}

.viewer-note {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.page {
  position: relative;
  margin: 0 0 22px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(23, 42, 73, 0.12);
}

.page img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}

.page figcaption {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 5px 9px;
  color: white;
  background: rgba(23, 42, 73, 0.78);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.document-footer {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 28px 18px 12px;
  text-align: center;
}

.document-footer img { border-radius: 50%; }

.document-footer p {
  margin: 0;
  font-weight: 650;
}

.document-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-top: 8px;
  padding: 0 22px;
  color: white;
  background: var(--navy);
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(36, 63, 107, 0.2);
}

.document-footer a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .topbar {
    min-height: 68px;
    padding: 9px 12px;
  }

  .brand { gap: 10px; }
  .brand img { width: 44px; height: 44px; }
  .brand-name { font-size: 0.74rem; }
  h1 { font-size: 1rem; }
  .page-count { font-size: 0.76rem; padding: 6px 9px; }

  .viewer {
    padding: 12px 0 42px;
  }

  .viewer-note { margin-bottom: 10px; }

  .page {
    margin-bottom: 12px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: 0 7px 18px rgba(23, 42, 73, 0.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
