/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Page background matching the logo theme */
body {
  background-color: #0d0820;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* Centered logo container (used on index.html) */
.container {
  text-align: center;
  width: 100%;
}

/* Logo image on home page */
.logo {
  width: 350px;
  max-width: 90%;
  height: auto;
  filter: drop-shadow(0 0 20px rgba(100, 70, 255, 0.4));
  animation: fadeIn 1.2s ease-in-out;
}

/* Subtle fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Left Navigation --- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100%;
  background: #140a33;
  padding-top: 30px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(0);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.nav-logo-box {
  width: 100%;
  text-align: center;
  margin-bottom: 20px;
}

.nav-logo {
  width: 120px;
  max-width: 80%;
  height: auto;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.25));
  margin: 0 auto;
  display: block;
}

.nav-link {
  display: block;
  padding: 15px 20px;
  text-decoration: none;
  color: #b9b2d9;
  font-size: 1.1rem;
  transition: 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-link.active {
  background: rgba(123, 89, 255, 0.15);
  color: #b491ff;
}

/* Page content shifts right to make space */
.content {
  margin-left: 220px;
  padding: 40px;
  color: #ffffff;
  width: 100%;
  overflow-y: auto;
}

/* Mobile toggle button */
.nav-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1100;
  font-size: 28px;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
}

/* --- Story "Book Page" Layout --- */

.story-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 36px 30px;
  background: #f6efe3;
  color: #2f2114;
  font-family: "Georgia", "Times New Roman", serif;
  border-radius: 12px;
  border: 1px solid #e0d2be;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.35) inset;
  position: relative;
}

/* subtle page edge */
.story-container::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  right: 12px;
  width: 14px;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.04),
    rgba(255, 255, 255, 0.4)
  );
  opacity: 0.5;
  pointer-events: none;
}

.story-header {
  border-bottom: 1px solid #e0d2be;
  padding-bottom: 10px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.story-title {
  font-size: 1.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #40291a;
}

.story-page-number {
  font-size: 0.9rem;
  color: #8b725a;
  white-space: nowrap;
}

.story-text {
  font-size: 1.02rem;
  line-height: 1.7;
  margin-bottom: 20px;
  min-height: 120px;
}

.story-paragraph {
  margin-bottom: 14px;
  text-indent: 1.5em;
}

/* Media (images / animations) */
.story-media {
  margin-bottom: 18px;
}

.story-image {
  display: block;
  max-width: 100%;
  max-height: 500px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 10px auto;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.story-html {
  margin-top: 12px;
}

/* Footer / page nav */
.story-footer {
  border-top: 1px solid #e0d2be;
  padding-top: 10px;
  margin-top: 8px;
}

.story-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Book-style nav buttons */
.story-btn {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid #d3c3ac;
  background: #f0e4d4;
  color: #3f2b1c;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease,
    box-shadow 0.12s ease, border-color 0.15s ease;
}

.story-btn:hover {
  background: #e6d7c2;
  border-color: #c3af93;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.story-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* differentiate subtly */
.story-btn-prev {
  align-self: flex-start;
}

.story-btn-next {
  align-self: flex-end;
}

/* Fast-load button */
.story-btn-fast {
  min-width: 52px;
  text-align: center;
  font-size: 1.1rem;
  padding-left: 10px;
  padding-right: 10px;
}

/* Hint text */
.story-hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #937a62;
  text-align: center;
}

/* --- Mobile behavior --- */
@media (max-width: 768px) {
  body {
    align-items: stretch;
  }

  .sidebar {
    transform: translateX(-220px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 60px 18px 30px;
  }

  .nav-toggle {
    display: block;
  }

  .story-container {
    padding: 22px 20px 24px;
  }

  .story-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-page-number {
    margin-top: 2px;
  }

  .story-controls {
    justify-content: space-between;
  }
}
