/* === Book Reader — Shared Styles ===
   Each book links this file + adds a small <style> for its own theme colors.
   Theme overrides: .page-cover background, h1/author colors,
   .page-content odd/even backgrounds, dark-mode variants.
*/

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Body */
body {
  font-family: Georgia, 'Times New Roman', serif;
  color: #3E2723;
  overflow: hidden;
  height: 100vh;
}

/* Pages */
.page {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 2rem;
}
.page.active { display: flex; }

/* Cover defaults */
.page-cover h1 {
  font-size: 3rem;
  text-align: center;
  color: #4E342E;
  margin-bottom: 0.5rem;
}
.page-cover .author {
  font-size: 1.2rem;
  color: #8D6E63;
  font-style: italic;
  margin-bottom: 2rem;
}
.page-cover .start-btn {
  padding: 0.75rem 2rem;
  background: #FF7043;
  color: #fff;
  border: none;
  border-radius: 2rem;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.page-cover .start-btn:hover { background: #F4511E; }
.page-cover .start-btn:focus-visible {
  outline: 3px solid #1E88E5;
  outline-offset: 3px;
}

/* Content pages */
.page-content img {
  max-width: 100%;
  max-height: 55vh;
  height: auto;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.page-content p {
  font-size: 1.8rem;
  line-height: 1.7;
  text-align: center;
  max-width: 700px;
}

/* Side-by-side images */
.img-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex: 1;
  min-height: 0;
}
.img-row img {
  height: 60vh;
  max-height: 60vh;
  max-width: 48%;
  width: auto;
  object-fit: contain;
  margin-bottom: 0;
}

/* Items grid (for counting books) */
.items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.items img {
  border-radius: 0.75rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 0;
}
.items-1 img  { height: 40vh; }
.items-2 img  { height: 32vh; }
.items-3 img  { height: 26vh; }
.items-4 img  { height: 22vh; }
.items-5 img  { height: 18vh; }
.items-6 img  { height: 17vh; }
.items-7 img  { height: 14vh; }
.items-8 img  { height: 13vh; }
.items-9 img  { height: 12vh; }
.items-10 img { height: 11vh; }

/* Navigation arrows */
.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  background: rgba(255,255,255,0.85);
  border: 2px solid #E0D6CC;
  border-radius: 50%;
  font-size: 1.3rem;
  color: #5D4037;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 10;
}
.nav-arrow:hover { background: #FF7043; border-color: #FF7043; color: #fff; }
.nav-arrow.hidden { display: none; }
.nav-prev { left: 1rem; }
.nav-next { right: 1rem; }
.nav-arrow:focus-visible {
  outline: 3px solid #1E88E5;
  outline-offset: 3px;
}

/* Page counter */
.page-counter {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: #BCAAA4;
  background: rgba(255,255,255,0.8);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  z-index: 10;
}

/* Back link */
.back-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  font-size: 0.85rem;
  color: #8D6E63;
  text-decoration: none;
  background: rgba(255,255,255,0.85);
  padding: 0.3rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid #E0D6CC;
  z-index: 10;
  transition: all 0.15s;
}
.back-link:hover { background: #fff; border-color: #BCAAA4; }
.back-link:focus-visible {
  outline: 3px solid #1E88E5;
  outline-offset: 3px;
}

/* PDF download link */
.pdf-link {
  position: fixed;
  top: 1rem;
  left: 6.5rem;
  font-size: 0.85rem;
  color: #8D6E63;
  text-decoration: none;
  background: rgba(255,255,255,0.85);
  padding: 0.3rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid #E0D6CC;
  z-index: 10;
  transition: background 0.15s, border-color 0.15s;
}
.pdf-link:hover { background: #fff; border-color: #BCAAA4; }

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255,255,255,0.85);
  border: 1px solid #E0D6CC;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}
.theme-toggle:hover { background: #fff; border-color: #BCAAA4; }
.theme-toggle:focus-visible {
  outline: 3px solid #1E88E5;
  outline-offset: 3px;
}

/* Fullscreen toggle */
.fullscreen-toggle {
  position: fixed;
  top: 1rem;
  right: 4rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255,255,255,0.85);
  border: 1px solid #E0D6CC;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}
.fullscreen-toggle:hover { background: #fff; border-color: #BCAAA4; }
.fullscreen-toggle:focus-visible {
  outline: 3px solid #1E88E5;
  outline-offset: 3px;
}

/* === Dark Mode (default warm-brown theme) ===
   Books with colored themes (blue, green, purple) override these in their <style>.
*/
body.dark { color: #E8E0D8; }
body.dark .page-cover h1 { color: #E8E0D8; }
body.dark .page-cover .author { color: #A89080; }
body.dark .page-content img { box-shadow: 0 4px 20px rgba(0,0,0,0.3); opacity: 0.9; background: #fff; padding: 0.5rem; }
body.dark .items img { box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
body.dark .nav-arrow { background: rgba(40,35,30,0.85); border-color: #4A4035; color: #D7CFC5; }
body.dark .nav-arrow:hover { background: #FF7043; border-color: #FF7043; color: #fff; }
body.dark .page-counter { background: rgba(40,35,30,0.8); color: #8D7E70; }
body.dark .back-link { background: rgba(40,35,30,0.85); border-color: #4A4035; color: #A89080; }
body.dark .back-link:hover { background: rgba(50,45,40,0.9); border-color: #5A5045; }
body.dark .pdf-link { background: rgba(40,35,30,0.85); border-color: #4A4035; color: #A89080; }
body.dark .pdf-link:hover { background: rgba(50,45,40,0.9); border-color: #5A5045; }
body.dark .theme-toggle { background: rgba(40,35,30,0.85); border-color: #4A4035; }
body.dark .theme-toggle:hover { background: rgba(50,45,40,0.9); border-color: #5A5045; }
body.dark .fullscreen-toggle { background: rgba(40,35,30,0.85); border-color: #4A4035; }
body.dark .fullscreen-toggle:hover { background: rgba(50,45,40,0.9); border-color: #5A5045; }

@media (prefers-reduced-motion: reduce) {
  .page-cover .start-btn,
  .nav-arrow,
  .back-link,
  .theme-toggle,
  .fullscreen-toggle {
    transition: none;
  }
}

/* === Responsive === */
@media (max-width: 600px) {
  .page-cover h1 { font-size: 2rem; }
  .page-content p { font-size: 1.3rem; }
  .nav-arrow {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.1rem;
    top: auto;
    bottom: 2.9rem;
    transform: none;
  }
  .nav-prev { left: calc(50% - 3.2rem); }
  .nav-next { right: calc(50% - 3.2rem); }
  .page-counter { bottom: 0.75rem; }
}

/* === Print === */
@media print {
  .page { display: flex !important; page-break-after: always; height: auto; min-height: 100vh; }
  .nav-arrow, .page-counter, .back-link, .pdf-link, .theme-toggle, .fullscreen-toggle { display: none !important; }
}
