/* ------------------------------------------------------------------
   The Pioneer Legacy Celebration — digital program
   Palette drawn from the booklet cover: deep navy night sky + cream.
------------------------------------------------------------------- */

:root {
  --navy-900: #0e1c30;
  --navy-800: #152741;
  --navy-700: #1d3557;
  --navy-600: #2b4a70;
  --cream: #f5f1e6;
  --cream-dim: #cfc9b8;
  --line: rgba(245, 241, 230, 0.18);
  --page-aspect: 396 / 612; /* booklet trim: 5.5 x 8.5 in */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { min-height: 100%; background: var(--navy-800); }

body {
  min-height: 100dvh;
  background-color: var(--navy-800);
  background-image: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 40%, var(--navy-700) 100%);
  background-attachment: fixed;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- header ---------- */

.site-header {
  text-align: center;
  padding: 20px 16px 12px;
  max-width: 640px;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.event-title {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.35rem, 5.5vw, 2rem);
  line-height: 1.2;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.hint {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--cream-dim);
}

/* ---------- viewer ---------- */

main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.viewer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.book {
  position: relative;
  width: min(100vw - 24px, calc((100dvh - 230px) * var(--page-aspect)), 560px);
  min-width: 260px;
}

.book-viewport {
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
  background: var(--navy-600);
  aspect-ratio: var(--page-aspect);
  touch-action: pan-y pinch-zoom;
}

.book-track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.book-track.animate {
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.page-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-600);
}

.page-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

/* shimmer placeholder while a page loads */
.page-slide.loading {
  background: linear-gradient(110deg, var(--navy-600) 40%, var(--navy-700) 50%, var(--navy-600) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 130% 0; }
  to   { background-position: -90% 0; }
}

/* ---------- prev / next buttons ---------- */

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: rgba(14, 28, 48, 0.55);
  color: var(--cream);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, opacity 0.2s ease;
}

.nav-btn svg { width: 26px; height: 26px; }

.nav-btn:hover { background: rgba(14, 28, 48, 0.8); }

.nav-btn:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}

.nav-prev { left: -8px; }
.nav-next { right: -8px; }

.nav-btn[disabled] {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

/* ---------- page indicator ---------- */

.viewer-bar {
  padding: 12px 0 4px;
}

.page-indicator {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
}

/* ---------- PDF fallback ---------- */

.fallback {
  text-align: center;
  padding: 14px 16px 8px;
}

.pdf-btn {
  display: inline-block;
  padding: 13px 26px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cream);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pdf-btn:hover,
.pdf-btn:focus-visible {
  background: rgba(245, 241, 230, 0.1);
  border-color: var(--cream-dim);
  outline: none;
}

.noscript-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--cream-dim);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: auto;
  padding: 22px 16px 26px;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: rgba(245, 241, 230, 0.45);
}

/* ---------- larger screens ---------- */

@media (max-width: 699px) {
  html,
  body {
    height: 100svh;
    overflow: hidden;
  }

  body {
    justify-content: flex-start;
  }

  .site-header {
    padding: 8px 10px 6px;
  }

  .eyebrow {
    font-size: 0.58rem;
    letter-spacing: 0.18em;
  }

  .event-title {
    font-size: clamp(1.02rem, 4.8vw, 1.28rem);
    margin-top: 2px;
    line-height: 1.08;
  }

  .hint {
    margin-top: 3px;
    font-size: 0.74rem;
  }

  main {
    flex: 1;
    min-height: 0;
    justify-content: flex-start;
  }

  .viewer {
    flex: 1;
    min-height: 0;
  }

  .book {
    width: min(100vw, calc((100svh - 128px) * var(--page-aspect)));
    min-width: 0;
  }

  .book-viewport {
    border-radius: 0;
  }

  .nav-btn {
    width: 42px;
    height: 58px;
    background: rgba(14, 28, 48, 0.42);
  }

  .nav-prev { left: 0; }
  .nav-next { right: 0; }

  .viewer-bar {
    padding: 6px 0 2px;
  }

  .fallback {
    padding: 6px 12px 8px;
  }

  .pdf-btn {
    min-height: 38px;
    padding: 8px 18px;
    font-size: 0.82rem;
  }

  .site-footer {
    display: none;
  }
}

@media (min-width: 700px) {
  .site-header { padding-top: 34px; }
  .nav-prev { left: -60px; }
  .nav-next { right: -60px; }
}

@media (prefers-reduced-motion: reduce) {
  .book-track.animate { transition: none; }
  .page-slide.loading { animation: none; }
}
