/* ==================== LAYOUT ==================== */
body {
  padding-top: 4.5rem;
  padding-bottom: 1rem;
}

/* ==================== NAVBAR ==================== */
nav.navbar {
  background: rgb(45,40,54);
  background: linear-gradient(180deg, rgba(45,40,54,1) 0%, rgba(17,4,24,1) 28%, rgba(62,51,65,1) 95%, rgba(48,41,54,1) 100%);
  font-family: 'Raleway', sans-serif;
  color: #ccc;
}
#story-title {
  font-weight: 900;
}
#chapter-title {
  font-weight: 400;
  font-size: 1.5em;
  padding-left: 1em;
  border-left: 1px solid #888;
}
#chapter-title .arrow {
  height: 1.5rem;
}
#author-name {
  font-weight: 200;
}
.nav-header > li {
  margin-right: 2rem;
}

/* ==================== CHAPTER CONTENT ==================== */
.chapter-heading {
  margin-top: 1em;
  margin-bottom: 1em;
  margin-left: 2em;
  font-size: 2rem;
  font-weight: 900;
  font-family: 'Raleway', sans-serif;
}

.chapter-wrapper {
  margin: 0;
  padding: 0;
}

#content .para-box > p {
  margin-left: 2.5rem;
  margin-right: 2.5rem;
  text-indent: 2rem;
  margin-bottom: 0;
  line-height: 1.8rem;
  font-size: 1rem;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 400;
}

@media (min-width: 1000px) {
  #content .para-box {
    margin-left: 6rem;
    margin-right: 6rem;
  }
}
@media (max-width: 999px) {
  #content .para-box {
    margin-left: 2.5rem;
    margin-right: 2.5rem;
  }
}

.break {
  display: flex;
  flex-flow: row;
  justify-content: center;
}
.break hr {
  width: 50%;
}

/* ==================== IMAGES ==================== */
.inline-image {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-content: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
}
.inline-image > div {
  width: 80vw;
}
.inline-image > div > img {
  width: 100%;
}
.inline-image-img {
  opacity: 0;
  transition: opacity .35s linear;
  min-height: 50px;
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
}
.inline-image-img[data-scroll="in"] {
  opacity: 1;
  transition-duration: 0.5s;
}
.inline-image div.image-caption {
  text-align: center;
  font-size: small;
  font-family: 'Raleway', sans-serif;
  width: 80%;
}

/* ==================== AUDIO ==================== */
.inline-audio {
  display: flex;
  flex-flow: column wrap;
  justify-content: center;
  align-content: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
}
.inline-audio-inner {
  text-align: center;
  font-family: 'Raleway', sans-serif;
}
.audio-cue {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: background-color 0.2s;
}
.audio-cue:hover {
  background-color: rgba(128, 128, 128, 0.2);
}
.audio-cue .audio-play-icon {
  flex-shrink: 0;
}
.audio-cue .audio-title {
  font-size: 1.1rem;
}
.inline-audio a {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #888;
}

/* ==================== CAROUSEL ==================== */
.inline-carousel {
  min-height: 1rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}
.inline-carousel .carousel-inner {
  overflow: visible;
}
.inline-carousel .carousel-item {
  /* Floated slides break layout when overflow is visible; reset */
  float: none;
  display: block;
  margin-right: 0;
}
.inline-carousel .carousel-item:not(.active) {
  display: none;
}
.inline-carousel img {
  max-width: 95vw;
  max-height: 75vh;
  object-fit: contain;
  margin: 0 auto;
}
.carousel-outline {
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  color: white !important;
  filter: none !important;
  text-shadow: -1px -1px 1px black, 1px -1px 1px black, -1px 1px 1px black, 1px 1px 1px black;
}
.carousel-outline h5 {
  font-weight: 900;
}
.carousel-caption {
  position: relative;
  left: 0;
  top: 1rem;
  right: 0;
  bottom: auto;
  padding: 0;
}
.carousel-caption-inner {
  width: 65%;
  margin: 0 auto;
}
@media screen and (max-width: 574px) {
  .carousel-caption-inner {
    width: 90%;
  }
}
.carousel-control {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
}
.carousel-indicators {
  bottom: auto;
  top: 10px;
}

/* ==================== WMPlayer NAVBAR PLAYER ==================== */
#wmplayer-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  font-family: 'Raleway', sans-serif;
  font-size: 0.85rem;
  color: #ccc;
}
#wmplayer-nav.hidden {
  display: none;
}
#wmplayer-nav .wmp-button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  border-radius: 3px;
  transition: background 0.15s;
  color: inherit;
}
#wmplayer-nav .wmp-button:hover {
  background: rgba(255, 255, 255, 0.1);
}
#wmplayer-nav .wmp-button svg {
  fill: currentColor;
}
#wmplayer-nav .wmp-track-title {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ccc;
}
#wmplayer-nav .wmp-track-title.empty {
  color: #666;
  font-style: italic;
}
#wmplayer-nav .wmp-progress-bar-container {
  width: 6rem;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
#wmplayer-nav .wmp-progress-bar {
  height: 100%;
  background: #D87C01;
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s linear;
}
[data-bs-theme="light"] #wmplayer-nav {
  color: #555;
}
[data-bs-theme="light"] #wmplayer-nav .wmp-track-title {
  color: #444;
}
[data-bs-theme="light"] #wmplayer-nav .wmp-track-title.empty {
  color: #999;
}
[data-bs-theme="light"] #wmplayer-nav .wmp-progress-bar-container {
  background: rgba(0, 0, 0, 0.1);
}

/* --- Playlist dropdown --- */
#wmplayer-nav .wmp-playlist-btn {
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 3px;
  font-size: 1rem;
  transition: background 0.15s;
}
#wmplayer-nav .wmp-playlist-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.wmp-playlist-drop {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1050;
  min-width: 220px;
  max-height: 50vh;
  overflow-y: auto;
  background: rgba(30, 26, 36, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: #ccc;
}
.wmp-playlist-drop .wmp-playlist-item {
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: background 0.1s;
}
.wmp-playlist-drop .wmp-playlist-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.wmp-playlist-drop .wmp-playlist-item.wmp-current {
  color: #D87C01;
  font-weight: 600;
}

/* ==================== NAVIGATION ARROWS ==================== */
.nav-arrows {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: 1rem 2rem;
  font-family: 'Raleway', sans-serif;
  font-size: 1rem;
}
.nav-arrows a {
  color: #ccc;
  text-decoration: none;
}
.nav-arrows a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ==================== BI ICONS ==================== */
.bi {
  vertical-align: -.125em;
  fill: currentColor;
}

/* ==================== THEME SWITCHER ==================== */
.btn-bd-primary {
  --bd-violet-bg: #473861;
  --bd-violet-rgb: 112.520718, 44.062154, 249.437846;
  --bs-btn-font-weight: 600;
  --bs-btn-color: var(--bs-white);
  --bs-btn-bg: var(--bd-violet-bg);
  --bs-btn-border-color: var(--bd-violet-bg);
  --bs-btn-hover-color: var(--bs-white);
  --bs-btn-hover-bg: #6528e0;
  --bs-btn-hover-border-color: #6528e0;
  --bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
  --bs-btn-active-color: var(--bs-btn-hover-color);
  --bs-btn-active-bg: #5a23c8;
  --bs-btn-active-border-color: #5a23c8;
}

/* ==================== DARK/LIGHT IMAGE FIXES ==================== */
[data-bs-theme="light"] .carousel-control-prev-icon,
[data-bs-theme="light"] .carousel-control-next-icon {
  filter: invert(1) grayscale(100);
}

/* ==================== READ TRACKER (dropdown checkmarks) ==================== */
.dropdown-item .fa-check {
  font-size: 0.75rem;
  margin-left: 0.4rem;
  color: #4CAF50;
  opacity: 0;
  transition: opacity 0.15s;
}
.dropdown-item.read .fa-check {
  opacity: 1;
}

/* ==================== GLOSS POPUP ==================== */
#gloss-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s, opacity 0.15s;
}
#gloss-btn:hover {
  color: #fff;
}
#gloss-btn.no-gloss {
  opacity: 0.35;
  cursor: default;
}
#gloss-btn.no-gloss:hover {
  color: #aaa;
}

#gloss-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4.5rem;
}
#gloss-overlay.hidden {
  display: none;
}

#gloss-popup {
  background: rgba(40, 35, 50, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  max-width: 650px;
  width: 90%;
  max-height: 75vh;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #ccc;
}
[data-bs-theme="light"] #gloss-popup {
  background: rgba(255, 245, 245, 0.97);
  color: #222;
}
#gloss-popup h2, #gloss-popup h3 {
  font-family: 'Raleway', sans-serif;
  color: #D87C01;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
[data-bs-theme="light"] #gloss-popup h2, [data-bs-theme="light"] #gloss-popup h3 {
  color: #C86C01;
}
#gloss-popup p {
  margin-bottom: 0.8rem;
}
#gloss-popup em {
  color: #bbb;
}
[data-bs-theme="light"] #gloss-popup em {
  color: #520;
}

#gloss-close {
  float: right;
  background: none;
  border: 1px solid #555;
  color: #aaa;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  transition: all 0.15s;
}
[data-bs-theme="light"] #gloss-close {
  color: #333;
}
#gloss-close:hover {
  background: #555;
  color: #fff;
}
[data-bs-theme="light"] #gloss-close:hover {
  background: #555;
  color: #ccc;
}

#chapter-sentinel {
  height: 1px;
  width: 100%;
}

/* ==================== PAGE CURL ==================== */
.page-curl {
  position: fixed;
  width: 48px;
  height: 48px;
  cursor: pointer;
  z-index: 940;
  transition: opacity 0.3s, transform 0.2s;
  opacity: 0.7;
}
.page-curl:hover {
  opacity: 1;
  transform: scale(1.08);
}
.page-curl.hidden {
  display: none;
}

/* Bottom-right curl — rendered view */
#page-curl-render {
  bottom: 0;
  right: 0;
  background: linear-gradient(135deg,
    transparent 50%,
    rgba(180, 160, 140, 0.85) 50%,
    rgba(160, 140, 120, 0.9) 62%,
    rgba(200, 185, 165, 0.85) 100%);
  box-shadow: -2px -2px 8px rgba(0, 0, 0, 0.35);
  clip-path: polygon(100% 0%, 100% 100%, 0% 100%);
  border-bottom-right-radius: 2px;
}
#page-curl-render::after {
  content: '\f02d';  /* fa-book-open */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  transform: rotate(-45deg);
  pointer-events: none;
}

/* Top-left curl (below navbar) — source view */
#page-curl-source {
  top: 4.5rem;
  left: 0;
  background: linear-gradient(-45deg,
    transparent 50%,
    rgba(180, 160, 140, 0.85) 50%,
    rgba(160, 140, 120, 0.9) 62%,
    rgba(200, 185, 165, 0.85) 100%);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.35);
  clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
}
#page-curl-source::after {
  content: '\f15c';  /* fa-file-lines */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  transform: rotate(45deg);
  pointer-events: none;
}

/* ==================== SOURCE VIEW ==================== */
#source-view {
  display: none;
  margin: 0;
  padding: 2rem 10rem 2rem 10rem;
  font-family: 'Liberation Mono', 'Courier New', Courier, monospace;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  border-radius: 0;
}

/* Lame hack to match source-view background to the light theme */
[data-bs-theme="light"] #source-view {color:#515151;background:#f1ecf1}

#source-view.visible {
  display: block;
}
#source-view code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
}

#content.hidden {
  display: none;
}
