/* ============ GEBHARDT SITE ============ */
:root {
  --deep: #0E0C08;
  --deep-2: #141109;
  --cream: #F7F6F2;
  --cream-2: #F9F8F5;
  --paper: #EEEADD;
  --ink: #28251D;
  --ink-muted: #7A7974;
  --ink-faint: #BAB9B4;
  --gold: #B8860B;
  --gold-soft: #C9A14A;
  --gold-bright: #E8C568;
  --teal: #01696F;
  --border: #D4D1CA;
  --warm: #964219;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--teal); text-decoration: none; }

/* ============ ENTRY / COVER ============ */
.entry {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at center, #1a160c 0%, var(--deep) 70%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}
.entry::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 15%, rgba(184,134,11,0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(184,134,11,0.04) 0%, transparent 40%);
  pointer-events: none;
}

.gold-frame {
  max-width: 560px;
  width: 100%;
  padding: 14px;
  border: 1.2px solid var(--gold);
  border-radius: 2px;
  background: var(--deep);
  position: relative;
  z-index: 1;
}
.gold-frame-inner {
  padding: 36px 32px 30px;
  border: 0.4px solid var(--gold);
  text-align: center;
  color: var(--cream);
}

.eyebrow {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 26px;
  color: var(--gold-bright);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.sub-eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--gold-soft);
  letter-spacing: 0.22em;
  margin-bottom: 20px;
}

.crest {
  width: 170px; height: auto;
  display: block; margin: 0 auto 22px;
  filter: drop-shadow(0 2px 12px rgba(184,134,11,0.15));
}

.title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 54px;
  font-weight: 400;
  color: var(--cream);
  line-height: 1.05;
  letter-spacing: 0.005em;
  margin-bottom: 14px;
}

.subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  color: var(--cream);
  opacity: 0.85;
  line-height: 1.55;
  margin-bottom: 26px;
}

.ornament {
  color: var(--gold-bright);
  font-size: 16px;
  margin: 4px 0 12px;
}

.honoree {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 34px;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.dates {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: var(--cream);
  opacity: 0.75;
  line-height: 1.4;
}

.enter-btn {
  margin: 34px auto 22px;
  padding: 14px 28px 12px;
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 2px;
  color: var(--gold-bright);
  cursor: pointer;
  transition: all 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.enter-btn:hover {
  background: rgba(184,134,11,0.08);
  border-color: var(--gold-bright);
  color: var(--cream);
  transform: translateY(-1px);
}
.enter-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.enter-hint {
  font-family: 'Inter', sans-serif;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.65;
}

.dedication {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
  color: var(--cream);
  opacity: 0.55;
  margin-top: 8px;
}

/* ============ READER ============ */
.reader {
  display: flex;
  flex-direction: column;
  /* iOS Safari: 100vh includes the URL-bar area, causing content to bleed through.
     100svh is the "small viewport height" (excludes browser chrome) — the safe default. */
  min-height: 100vh;
  min-height: 100svh;
  height: 100svh;
  background: var(--deep);
  position: relative;
  z-index: 1;
  animation: reader-fade-in 1.4s ease;
}
@keyframes reader-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--deep);
  color: var(--cream);
  border-bottom: 1px solid var(--gold);
  gap: 20px;
  flex-wrap: wrap;
  min-height: 52px;
}
.topbar-left {
  display: flex; align-items: center; gap: 10px;
}
.topbar-mark {
  color: var(--gold-bright);
  font-size: 14px;
}
.topbar-title {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 19px;
  color: var(--cream);
}
.topbar-right {
  display: flex; align-items: center; gap: 14px;
}

.audio-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid rgba(184,134,11,0.2);
  min-width: 260px;
}
.audio-btn {
  background: var(--gold);
  color: var(--deep);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.audio-btn:hover { background: var(--gold-bright); transform: scale(1.05); }

.audio-meta { flex: 1; min-width: 0; }
.audio-chapter {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.audio-progress-wrap {
  margin-top: 4px;
  height: 2px;
  background: rgba(255,255,255,0.12);
  border-radius: 1px;
  overflow: hidden;
}
.audio-progress {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 0.3s linear;
}
.volume {
  width: 60px;
  accent-color: var(--gold);
}

.download-btn {
  padding: 6px 12px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  transition: all 0.2s;
}
.download-btn:hover {
  background: rgba(184,134,11,0.12);
  color: var(--cream);
}

.viewer {
  flex: 1;
  background:
    radial-gradient(ellipse at center, #1a160c 0%, var(--deep) 70%, #000 100%);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  padding: 28px 24px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.viewer::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 15%, rgba(184,134,11,0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(184,134,11,0.04) 0%, transparent 40%);
  pointer-events: none;
}
.pdf-book {
  position: relative;
  width: 100%;
  max-width: 900px;
  border: 1px solid rgba(184,134,11,0.45);
  box-shadow:
    0 0 0 1px rgba(184,134,11,0.12) inset,
    0 24px 70px rgba(0,0,0,0.55),
    0 0 100px rgba(184,134,11,0.06);
  background: var(--ink);
  overflow: hidden;
  border-radius: 2px;
}
#pdf-frame {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  border: none;
  background: var(--ink);
}
.pdf-fallback {
  position: absolute; inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--cream);
  padding: 40px 24px;
}
/* When JS detects a viewer that can't render inline PDFs (iOS Safari, old browsers),
   body gets .no-inline-pdf and the fallback is promoted above the iframe. */
/* Desktop (default): show iframe, hide mobile flipbook */
.pdf-flipbook { display: none; }

/* When reader is open, forcibly hide the entry (iOS workaround for layered bleed-through) */
body.reader-open #entry { display: none !important; }

/* Mobile / no-inline-pdf viewers: show flipbook, hide iframe */
body.no-inline-pdf #pdf-frame { display: none; }
body.no-inline-pdf .pdf-fallback { display: none; }
body.no-inline-pdf .pdf-flipbook { display: block; }

body.no-inline-pdf .reader {
  height: auto;
  min-height: 100svh;
}
body.no-inline-pdf .topbar {
  position: sticky;
  top: 0;
  z-index: 10;
}
body.no-inline-pdf .viewer {
  padding: 8px 8px 20px;
  display: block;
  overflow: visible;
  flex: none;
}
body.no-inline-pdf .footbar {
  position: relative;
}
body.no-inline-pdf .pdf-book {
  border: 1px solid rgba(184,134,11,0.35);
  background: #1a1611;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  height: auto;
  overflow: hidden;
}

.pdf-flipbook {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.pdf-flipbook img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: var(--paper);
}
.pdf-flipbook img + img {
  margin-top: 6px;
  border-top: 1px solid rgba(184,134,11,0.12);
}
.flipbook-end {
  padding: 40px 24px 32px;
  text-align: center;
  background: var(--deep);
  color: var(--gold-bright);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
}
.flipbook-end p:first-child {
  font-size: 22px;
  margin-bottom: 12px;
  opacity: 0.7;
}
.flipbook-end .end-text {
  font-size: 14px;
  color: var(--cream);
  opacity: 0.7;
}
.pdf-fallback-inner {
  max-width: 440px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fallback-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--cream);
  opacity: 0.85;
  margin-bottom: 6px;
}
.fallback-btn {
  padding: 12px 20px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  color: var(--gold-bright);
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
}
.fallback-btn:hover {
  background: rgba(184,134,11,0.12);
  color: var(--cream);
  border-color: var(--gold-bright);
}
.fallback-btn-alt {
  opacity: 0.7;
  font-size: 13px;
}

.footbar {
  padding: 8px 20px;
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  color: var(--ink-muted);
  background: var(--cream-2);
  border-top: 1px solid var(--border);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .viewer { padding: 14px 12px; }
  .pdf-book { box-shadow: 0 12px 36px rgba(0,0,0,0.5); }
}
@media (max-width: 700px) {
  .title { font-size: 40px; }
  .honoree { font-size: 26px; }
  .eyebrow { font-size: 20px; }
  .gold-frame-inner { padding: 26px 20px 22px; }
  .crest { width: 140px; }

  .topbar { padding: 8px 12px; gap: 10px; }
  .topbar-title { font-size: 15px; }
  .audio-widget { min-width: 200px; padding: 4px 8px; }
  .audio-chapter { font-size: 12px; }
  .volume { width: 44px; }
  .download-btn { padding: 5px 10px; font-size: 11px; }
  .viewer { padding: 10px 8px; }
  .pdf-book { border-radius: 1px; }
}
@media (max-width: 560px) {
  .topbar-title,
  .topbar-mark { display: none; }
  .topbar-left { display: none; }
  .audio-widget { min-width: 0; flex: 1; }
  .topbar-right { flex: 1; gap: 10px; }
}
