  @font-face {
  font-family: "SBL";
  src: url("font/SBL_BLit.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

  @font-face {
  font-family: "Inter";
  src: url("font/Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

  @font-face {
  font-family: "Noto";
  src: url("font/NotoSans-Medium.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

  @font-face {
  font-family: "NAU";
  src: url("font/new_athena_unicode.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0370-03FF, U+1F00-1FFF;
}

  @font-face {
  font-family: "NAU";
  src: url("font/newathuBold5_5.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0370-03FF, U+1F00-1FFF;
}

  @font-face {
  font-family: "Anaktoria";
  src: url("font/Anaktoria.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

  @font-face {
  font-family: "EB_Garamond";
  src: url("font/EBGaramond12-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

  @font-face {
  font-family: "EB_Garamond";
  src: url("font/EBGaramond12-Italic.ttf") format("truetype");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

  @font-face {
  font-family: "EB_Garamond";
  src: url("font/EBGaramond-VariableFont_wght.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   RULES TAKEN FROM INDEX.HTML
   ========================================================= */

.big-btn,
.read-btn {
  display: inline-block;
  padding: 8px 24px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
  font-family: "Noto";

  display: block;
  margin: 0 auto;
  background: #eef2f8;
  color: #4b5466;
  border: 1px solid #dde1e7;
}

.read-btn.active {
  background: #ebfdf3;
  color: #2b8d58;
  border: 1px solid #cbdfd3;
}


/* -------- TABS -------- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 30px;
  border-bottom: 2px solid #e0d8d0;
  padding-bottom: 2px;
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 28px;
  font-size: 1.1rem;
  font-family: "Noto" !important;
  color: #6b6b6b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: 0.2s;
  margin-bottom: -2px;
  font-weight: 500;
}

.tab-btn.active {
  color: #2c2c2c;
  border-bottom-color: #d4a373;
  font-weight: 600;
}

.tab-content {
  display: none;
  animation: fadeIn 0.25s ease;
}
.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------- BOOK GRID -------- */
.book-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  max-width: 100%;
  margin: 0 auto;
}

.book-card h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
  font-weight: 500;
}
.book-card .author {
  font-style: italic;
  color: #6b6b6b;
  font-size: 1rem;
  margin-bottom: 12px;
}
.book-card .btn {
  display: inline-block;
  background: #d4a373;
  color: white;
  padding: 8px 24px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.cover-art {
  height: 150px;
  width: 150px;
  object-fit: cover;
  border: 1px solid grey;
}
/* About tab */
.about-text {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  font-size: 1.15rem;
  line-height: 1.7;
  color: #3d3d3d;
}
.about-text p {
  margin-bottom: 16px;
}

footer {
  text-align: center;
  margin-top: 60px;
  color: #9a9a9a;
  font-size: 0.9rem;
}

/* Stop forcing stretch, just center them vertically */
.card-actions {
  display: flex;
  justify-content: center;
  align-items: center; 
  gap: 8px;
}

/* Use exact dimensions to force a perfect circle */
.book-card .btn.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 35.5px;          /* Matches the 35.5px height of the Open button */
  height: 35.5px;         /* Locks it into a square */
  border-radius: 50%;   /* Turns the square into a circle */

  background: #eef2f8;
  color: #4b5466;
  border: 1px solid #dde1e7;
}

/* Keeps the SVG icon centered and sized */
.book-card .info-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* card flip rules */

.book-card-wrapper {
  perspective: 1000px;
  width: 220px;
  height: 100%; 
}

.book-card {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1), box-shadow 0.2s;
  transform-style: preserve-3d;

  box-sizing: border-box;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 30px 20px 25px;
  width: 220px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #e8e2da;
}

.book-card.is-flipped {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* Safari support */
  border-radius: inherit;
  background: #fff; /* Match your card background color */
}

.card-front {
  position: relative;
  z-index: 2;
}

.card-back {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  padding: 30px 20px 25px;
  box-sizing: border-box;
  cursor: pointer;
}

.stats-list {
  list-style: none;
  padding: 0;
  margin: 15px 0 20px 0;
  color: #2c2c2c;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Push the back button to the bottom just like the front layout */
.card-back .card-actions {
  margin-top: auto; 
}

/* =========================================================
   HORIZONTAL SCROLL CONTAINERS
   ========================================================= */

.scroll-wrapper {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-align: center; 
  position: relative; /* Required for the shadow overlay */
}

.scroll-text {
  display: inline-block;
}

/* 1. The White Shadow Overlay */
.scroll-wrapper.needs-scroll::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 40px; 
  height: 100%;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  pointer-events: none;

  transition: opacity 0.1s ease-out;
}

/* 2. Fade out the shadow completely when this class is added */
.scroll-wrapper.is-scrolled::after {
  opacity: 0;
  transition: opacity 1.1s linear;
}

/* Keep your original fonts/margins below... */
.scroll-wrapper h2 { margin-bottom: 0; font-size: 1.5rem; font-weight: 500; }
.scroll-wrapper .author, .scroll-wrapper .reader { margin-bottom: 0; font-style: italic; color: #6b6b6b; font-size: 1rem; }
.title-wrapper { margin-bottom: 6px; }
.reader-wrapper { margin-bottom: 12px; }

/* =========================================================
   NORMAL RULES
   ========================================================= */

html {
  /* Reserves the scrollbar space globally, preventing layout jumping */
  scrollbar-gutter: stable;
}

* {
    -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar-track {
  background: transparent; 
}

/* Loading screen container */
#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #1a1a1e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease;
  font-family: "Noto", sans-serif;
}

/* Hidden state */
#loadingScreen.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Spinner element – you can give it an ID or class */
#loadingSpinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 215, 150, 0.15);
  border-top-color: #d4a373;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* Keyframes – only the rotation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Loading text (if you use an element with this ID) */
#loadingText {
  color: #d4a373;
  margin-top: 24px;
  font-size: 1.1rem;
  font-family: "Noto";
}

#nextBtn,
#prevBtn,
#playBtn,
#langBtn {
  visibility: visible;
}

.tabbed-hanging-indent {
  display: block;      /* Forces block formatting so text-indent works */
  padding-left: 4em;   /* Hanging indent depth */
  text-indent: -2em;   /* Pulls the first line (like "(a)") back to the left */
  margin-bottom: 4px;  /* Optional: Adds a slight gap between list items */
}

.text_title {
  display: block !important;
  text-align: center !important;
  margin-bottom: 12px;
}

.textual_image {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
}

.textual_image.rotated-90 {
  transform: rotate(90deg);
  transform-origin: center;
  
  /* Restrict height so when rotated horizontally, it won't overflow */
  max-height: 80vw; /* or max-height: 100cqw if using container queries */
  width: auto;
  margin: 40px auto; /* Add extra vertical margin since rotated height affects horizontal space */
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

.float_image {
  float: right;           /* or right */
  max-width: 50%;            /* takes half the container width */
  height: auto;           /* maintain aspect ratio */
  margin: 0 20px 20px 20px; /* spacing around the image */
  shape-outside: border-box; /* optional: makes text wrap closer to the image shape */
}

.chapter-body {
  display: none;
}
.chapter-body.active {
  display: block;
}

body {
  font-family: "EB_Garamond";
  padding: 60px 80px 100px;
  color: #111926;
}

#progressBar {
  flex: 1;
  accent-color:#e06e04; /* Changes the thumb and progress fill automatically */
  cursor: pointer;
  visibility: visible;
}
	
p {
  line-height: 1.7; 
}

ital-small {
  font-size: 15px;
  font-family: "Inter", serif;
  font-style: italic;
  color: #11192680;
}

/*currently used with ital-small, hence the transparency*/
.link {
  color: #007bff80;
  text-decoration: none;
}

.punctuation {
  cursor: default !important;
}

.text {
  font-family: SBL;
  font-size: 70px;
  line-height: 1.6;
  text-align: justify;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  text-wrap: pretty;
  display: block;
  pointer-events: auto;
}

.text_en {
  font-family: SBL;
  font-size: 70px;
  line-height: 1.6;
  text-align: justify;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  text-wrap: pretty;
  display: none;
}

.text_en :not(.note-marker) {
  pointer-events: none;
}

.text_en .note-marker {
  pointer-events: auto;
  text-align: justify;
}

.tiny_text {
  font-family: "EB_Garamond";
  font-size: 20px;
  line-height: 1;
  text-align: center;
  color: #111926;
}

span {
  padding: 0px;
  cursor: pointer;
}

button {
  font-family: "Inter";
}

select {
  font-family: "Inter";
}

	
/* 1. Base phrase state */
.phrase {
  border-radius: 6px;        /* Softens the highlight edges slightly */
  color: #111926;
  background-color: transparent;
  box-shadow: 0 7px 0 3px transparent, 0 -7px 0 3px transparent;
  transition: background-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
  box-decoration-break: clone;   /*Ensures the shadow wraps nicely on multi-line phrases */
  -webkit-box-decoration-break: clone;
}

/* 2. Active highlighted state */
.phrase.active {
  background-color: #aae4f0;
  box-shadow: 0 7px 0 3px #aae4f0, 0 -7px 0 3px #aae4f0;
}

/* 1. Base phrase state */
.phrase_en {
  border-radius: 6px;        /* Softens the highlight edges slightly */
  color: #111926;
  background-color: transparent;
  box-shadow: 0 7px 0 3px transparent, 0 -7px 0 3px transparent;
  transition: background-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;

  box-decoration-break: clone;   /*Ensures the shadow wraps nicely on multi-line phrases */
  -webkit-box-decoration-break: clone;
}

/* 2. Active highlighted state */
.phrase_en.active {
  background-color: #aae4f080;
  box-shadow: 0 7px 0 3px #aae4f080, 0 -7px 0 3px #aae4f080;
}

/* Standard Desktop Rules */
#playerBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;

  background: #ffffff;
  color: #ffffff;
  z-index: 1000;
  box-sizing: border-box;
  position: fixed;
  bottom: 0;
  left: 0;
  gap: 10px;
}

#timeDisplay {
  color: #111926;
  font-family: monospace !important;
  margin: 0 10px;
  font-size: 16px;
  white-space: nowrap;
  visibility: visible;
}

#playerBar button {
  background: #eef2f8;
  border: none;
  color: #4b5466;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
}

#freqBtn,
#contentsBtn,
#settingsBtn {
  cursor: pointer;
  z-index: 10;
  border: 1px solid #ccc;
}

#topBar {
  top: 0;
  left: 0;
  width: 100%;

  background: #ffffff;
  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 10px;
  box-sizing: border-box;

  z-index: 1000;

  position: fixed;
}

#title {
  cursor: default !important;
  overflow: hidden;
  white-space: normal;
  display: inline-block;
}

.title {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  font-weight: normal;
  font-family: "Noto", serif;
  color: #4b5466;

  left: 50%;
  transform: translateX(-50%);
  position: absolute;
}

.title.hiddenIfOnMobile {
  display: flex !important;
}

#title {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  cursor: default !important;
  font-weight: normal;
}

#title .title-small {
  display: none;
}
#title .title-medium {
  display: none;
}
#title .title-large {
  display: inline-block;
}

#topBarPrevChapBtn,
#topBarNextChap {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: pointer;
  display: flex;
}

/* match your bottom bar style */
#topBar button {
  background: transparent;
  border: none;
  color: #4b5466;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
}
	
.note-marker {
  color: #a52a2a;      /* A nice deep classical red/burgundy color */
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;      /* Makes it slightly easier to tap on mobile screens */
  user-select: none;   /* Prevents accidentally selecting the text when clicking */
}

.phrase.active .note-marker {
  color: #111926;
}

/* all the stuff that was in the div id's section of the code */

#popupOverlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9998; }

/* settings pop up */

#settingsPopup,
#advancedFontPopup,
#popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid #ccc;
  padding: 20px;
  z-index: 9999;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  font-family: "NAU", "Inter", serif;

  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-sizing: border-box;
}

#closeSettings,
#closeAdvancedFont,
#closePopup {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

.btn-icon {
  width: 32px;
  height: 32px;
  filter: invert(32%) sepia(16%) saturate(692%) hue-rotate(182deg) brightness(91%) contrast(85%);
}

/*#bottomBarPrevChapBtn {
  background: #e06e04;
  border: none;
  color: #ffffff;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 15px;
  font-family: "Noto", sans-serif;
  display: block;
  margin: 0 auto;
  cursor: pointer;
}*/

/* =========================================================
   HOVERS
   ========================================================= */

@media (hover: hover) and (pointer: fine) {
	
  .big-btn:hover,
	.read-btn:hover {
	  background: #c0c4cb;
	}
	
	.read-btn.active:hover {
	  background: #cbd9d1;
	}

	.phrase.active .note-marker:hover {
	  color: #111926;
	}

	.note-marker:hover {
	  color: #ff4500;      /* Lights up bright red-orange on mouse hover */
	}

	#topBar button:hover {
	  background: transparent;
	}

	#playerBar button:hover {
	  background: #eef2f8;
	}

	.book-card .btn.info-btn:hover {
	  background: #c0c4cb;
	}

	.book-card .btn:hover {
	  background: #b88a5e;
	}

	.book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  }

  .book-card.is-flipped:hover {
    transform: rotateY(180deg) translateY(-6px);
  }

	.tab-btn:hover {
	  color: #2c2c2c;
	  background: #f0ebe6;
	  border-radius: 8px 8px 0 0;
	}
}

/* =========================================================
   TABLET LAYOUT RULES (TRIGGERS ON SCREEN SIZE OR MANUAL OVERRIDE)
   ========================================================= */
@media (min-width: 768px) and (max-width: 1023px) {
  body { padding: 60px 40px 100px !important; }
  #title .title-small { display: none; }
  #title .title-medium { display: inline-block; }
  #title .title-large { display: none; }
  .title.hiddenIfOnMobile { display: flex !important; }
}

	
/* =========================================================
   MOBILE LAYOUT RULES (TRIGGERS ON SCREEN SIZE OR MANUAL OVERRIDE)
   ========================================================= */
@media (max-width: 768px) {
  #popup, #settingsPopup { width: 85% !important; max-width: 400px !important; padding: 25px !important; box-sizing: border-box !important; }
  #progressBar, #timeDisplay { display: none; }
  #playerBar { justify-content: center !important; gap: 0; }
  #playerBar > button:not(#langBtn) { margin: 0 10px; }
  #langBtn { position: absolute; right: 15px; margin: 0; }
  body { padding: 60px 20px 100px !important; }
  /*.btn-icon { width: 50px !important; height: 50px !important;}*/
  #title .title-small { display: inline-block; }
  #title .title-medium { display: none; }
  #title .title-large { display: none; }
  .title.hiddenIfOnMobile { display: none !important; }

}

/* Manual Debug Rules: Forces the rules above even on a giant desktop monitor */
body.layout-small #popup, 
body.layout-small #settingsPopup { width: 85% !important; max-width: 400px !important; padding: 25px !important; box-sizing: border-box !important; }
body.layout-small #progressBar, 
body.layout-small #timeDisplay { display: none !important; }
body.layout-small #playerBar { justify-content: center !important; gap: 0 !important; }
body.layout-small #playerBar > button:not(#langBtn) { margin: 0 10px !important; }
body.layout-small #langBtn { position: absolute !important; right: 15px !important; margin: 0 !important; }
/*body.layout-small .btn-icon { width: 50px !important; height: 50px !important; }*/
body.layout-small { padding: 60px 20px 100px !important; }
body.layout-small #title .title-small { display: inline-block; }
body.layout-small #title .title-medium { display: none; }
body.layout-small #title .title-large { display: none; }
body.layout-small .title.hiddenIfOnMobile { display: none !important; }

/* Manual Debug Rules: Forces desktop parameters even if you are testing on a mobile device */
body.layout-medium #progressBar,
body.layout-medium #timeDisplay { display: inline-block !important; }
body.layout-medium #playerBar { justify-content: space-between !important; gap: 10px !important; }
body.layout-medium #langBtn { position: static !important; margin: 0 !important; }
/*body.layout-large .btn-icon { width: 32px !important; height: 32px !important; }*/
body.layout-medium { padding: 60px 40px 100px !important; }
body.layout-medium #title .title-small { display: none; }
body.layout-medium #title .title-medium { display: inline-block; }
body.layout-medium #title .title-large { display: none; }
body.layout-medium .title.hiddenIfOnMobile { display: flex !important; }

/* Manual Debug Rules: Forces desktop parameters even if you are testing on a mobile device */
body.layout-large #progressBar, 
body.layout-large #timeDisplay { display: inline-block !important; }
body.layout-large #playerBar { justify-content: space-between !important; gap: 10px !important; }
body.layout-large #langBtn { position: static !important; margin: 0 !important; }
/*body.layout-large .btn-icon { width: 32px !important; height: 32px !important; }*/
body.layout-large { padding: 60px 80px 100px !important; }
body.layout-large #title .title-small { display: none; }
body.layout-large #title .title-medium { display: none; }
body.layout-large #title .title-large { display: inline-block; }
body.layout-large .title.hiddenIfOnMobile { display: flex !important; }
