@font-face {
  font-family: 'Exposure';
  src: url('fonts/ExposureTrial-70.otf') format('opentype');
  font-display: swap;
}

:root {
  --ink: #1d1d1f;
  --muted: #606064;
  --canvas: #EEEBE0;
  --paper: #ffffff;
  --stage: var(--canvas);
  --accent: #ffe600;
  --line: rgba(29, 29, 31, 0.16);
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', var(--sans);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--stage);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

.reader-header {
  min-height: 64px;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}

.reader-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

.reader-back:hover span,
.reader-back:focus-visible span {
  background: var(--accent);
}

.reader-name {
  font-family: 'Exposure', var(--sans);
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  background: rgba(238, 235, 224, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.reader-identity {
  width: min(100%, 1100px);
  margin: 0 auto;
}

.reader-kicker {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reader-toolbar h1 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(0.88rem, 1.4vw, 1.04rem);
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-stage {
  min-height: calc(100vh - 182px);
  padding: 2rem clamp(0.75rem, 4vw, 4rem) 3rem;
}

.pdf-pages {
  width: min(100%, 900px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pdf-page {
  position: relative;
  width: 100%;
  aspect-ratio: 595 / 842;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.13);
}

.pdf-page canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.pdf-page.is-rendered canvas {
  opacity: 1;
}

.page-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #9a9a9e;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.pdf-page.is-rendered .page-placeholder {
  display: none;
}

.reader-message {
  min-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.reader-message.is-error {
  max-width: 32rem;
  margin: 0 auto;
  color: var(--ink);
  line-height: 1.6;
  text-align: center;
}

.reader-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(29, 29, 31, 0.18);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.reader-footer {
  padding: 0 1.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.reader-footer p {
  margin: 0;
}

.reader-notice {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 20;
  max-width: calc(100% - 2rem);
  padding: 0.55rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.76rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.reader-notice.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 700px) {
  .reader-header {
    min-height: 54px;
    padding: 0 1rem;
  }

  .reader-toolbar {
    min-height: 64px;
    padding: 0.65rem 1rem;
  }

  .reader-toolbar h1 {
    font-size: 0.88rem;
  }

  .reader-stage {
    min-height: calc(100vh - 144px);
    padding: 0.75rem 0.5rem 2rem;
  }

  .pdf-pages {
    gap: 0.65rem;
  }

  .pdf-page {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body {
    display: none;
  }
}
