@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Cherokee&display=swap');
@font-face {
  font-family: 'Futura'; /* The name you'll use to refer to this font in your CSS */
  src: url('font/futura-light-webfont.woff2') format('woff2'), /* Modern browsers */
   url('font/futura-light-webfont.woff') format('woff');  /* Older browsers */
  font-weight: normal; /* Define the weight of this specific font file */
  font-style: normal;  /* Define the style (e.g., normal, italic) */
  font-display: swap;  /* How the font is displayed while loading */
}

@font-face {
  font-family: 'Arimo';
  src: url('font/Arimo-Bold.ttf') format('ttf'); /* Added a semicolon here */
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Structural design token extensions for the multi-book library matrix */
body {
  overflow-y: auto !important;
  font-family: 'Futura', 'Arimo', Noto Sans Cherokee;
  padding-bottom: 100px;
}

/* ── Accessibility: visible keyboard focus indicator (WCAG 2.4.7) ── */
:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- Form & Panel Extracted Styles --- */
.selection-panel {
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.015);
}

.selection-panel.spaced-bottom {
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group.mb-16 { margin-bottom: 16px; }
.input-group.mb-20 { margin-bottom: 20px; }

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: #595550; /* AA-compliant: 5.2:1 on white, replaces --ts #6B6560 */
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-select {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: #fff;
  color: var(--tp);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  -webkit-appearance: none;
}

.btn-primary {
  background: #A71C20;
  width: 100%;
  padding: 14px;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #8b1619;
}

/* Language Switcher Styles */
.language-switcher-container {
  padding: 5px;
  display: flex;
  border-radius: 5px;
  width: fit-content;
  margin: 20px;
}

.language-button {
  padding: 10px 15px;
  font-weight: bold;
  border-radius: 0px;
  margin-top: 0px;
  cursor: pointer;
  border: none;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-color: transparent; /* Start with transparent background */
  color: white; /* Default text color is white */
}

/* Specific border-radius for the end buttons */
.language-button:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.language-button:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

/* Style for the active (selected) button */
.language-button.active {
  background-color: #333;
  color: #ffffff;
  outline: 2px solid #525252;
}

/* Style for the inactive button (when not active) */
.language-button:not(.active) {
  background-color: #ffffff; /* White background for the inactive button */
  color: #5A5A5A; /* Darker grey text for the inactive button */
}

/* Optional: Add hover effects for non-active buttons */
.language-button:not(.active):hover {
  background-color: #f0f0f0; /* Slight grey tint on hover for inactive */
}

.language-button.active:hover {
  background-color: #525252; /* Slightly darker red on hover for active */
}

.fixed-bottom-title img {	
  width: 30px; /* Fixed width */
  height: 24px; /* Fixed height */
  margin-bottom: 0.25rem; /* Space between image icon and text, consistent with Font Awesome icons */
}

.fixed-bottom-title.active-page i {
  color: #AD1D35;
}

.fixed-bottom-title.active-page img {
  color: #AD1D35; /* This attempts to apply the color, but depends on SVG internal structure */
}

/* Styles for the main navigation container */
.fixed-bottom-nav {
  position: fixed; /* Makes the nav bar stick to the viewport */
  bottom: 0;
  z-index: 1000; /* Ensures it's on top of other content */
  background-color: #fff; /* White background */
  padding-top: 1rem; /* Padding all around */
  padding-bottom: 1rem; /* Padding all around */
  display: flex; /* Makes it a flex container */
  flex-direction: row; /* ⭐ CRITICAL: Arranges children in a row */
  justify-content: center; /* ⭐ CHANGE: Centers items horizontally within the nav bar */
  align-items: center; /* Vertically aligns items in the center */
  width: 100%; /* Takes full width */
  border-top-width: 1px; /* Top border */
  border-color: #e5e7eb; /* Light gray border color */
  flex-wrap: nowrap; /* ⭐ CRITICAL: Prevents items from wrapping to the next line */
  box-shadow: 0px 1px 3px;
}

/* Styles for each individual navigation item (the <a> tags) */
.fixed-bottom-title {
  display: flex; /* Makes each link a flex container */
  flex-direction: column; /* ⭐ Keeps the icon and text stacked within each link */
  align-items: center; /* Centers icon and text horizontally within the link */
  justify-content: center; /* Centers icon and text vertically within the link (useful if heights vary) */
  text-align: center; /* Ensures text is centered */
  min-width: 0; /* Allows content within the link to shrink if needed without breaking flexbox */
  margin: 0 0.2rem;
  color: #767676; /* Minimum AA-compliant grey on white (4.54:1) */
  padding: 0.2rem;
  border-radius: 0.375rem; /* Rounded corners */
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; /* Smooth color transition */
  transition-duration: 200ms; /* Transition speed */
  white-space: nowrap; /* Prevents the text (e.g., "Search") from wrapping within the span */
  text-decoration: none; /* ⭐ ADDED: Removes the underline from links */
}

/* Styles for the active/selected navigation item */
.fixed-bottom-title.active-page {
  color: #AD1D35; /* Darker red for the selected page */
}

/* Hover effect for navigation items */
.fixed-bottom-title:hover {
  color: #AD1D35; /* A slightly different red on hover, or keep it the same if preferred */
}

/* Icon styling within each nav item */
.fixed-bottom-title i {
  font-size: 1.5rem; /* Icon size */
  margin-bottom: 0.25rem; /* Space between icon and text */
}

/* Text styling within each nav item */
.fixed-bottom-title span {
  font-size: 0.875rem; /* Text size (text-sm) */
}

.selection-panel {
  border: 1px solid var(--divider);
  background-size: cover;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.015);
  margin-left: 20px;
  margin-right: 20px;
}

.selection-panel-preface {
  border: 1px solid var(--divider);
  background: #A71C20;
  background-image: url(pattern-background-02.svg);
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.015);
  margin-left: 20px;
  margin-right: 20px;
  
  /* New Tap-to-Expand Styles */
  max-height: 140px; /* Adjust this to show more/less initial text */
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: max-height 0.4s ease-out;
}

/* Gradient fade and prompt at the bottom of the collapsed box */
.selection-panel-preface::after {
  content: "- Tap to read more -";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding-top: 50px; /* Creates the fade area */
  padding-bottom: 15px;
  /* Fades from transparent to your red background color */
  background: linear-gradient(to bottom, rgba(167, 28, 32, 0), rgba(167, 28, 32, 1) 80%);
  color: var(--gold-light, #f4d03f);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* The expanded state */
.selection-panel-preface.expanded {
  max-height: 2500px; /* Must be larger than the total height of the content */
  transition: max-height 0.5s ease-in;
}

/* Hide the gradient fade when expanded */
.selection-panel-preface.expanded::after {
  opacity: 0;
}

.index-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px 16px 120px 16px;
}

.library-section-title {
  font-size: 14px;
  color: var(--cr-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 4px 12px 4px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--divider);
  font-weight: 600;
}

.book-card {
  background: var(--panel-bg);
  border: 1px solid var(--divider);
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.015);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.book-header {
  background: var(--cr-dark);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.book-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.book-title-group .chr-txt {
  font-size: 17px;
  font-weight: normal;
}

.book-title-group .en-sub {
  font-size: 12px;
  color: var(--gold-light);
  font-family: 'Futura', 'Arimo', sans-serif;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 10px;
  padding: 14px;
  background: #fff;
}

.chapter-link {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: var(--panel-bg);
  border: 1px solid var(--divider);
  border-radius: 6px;
  color: var(--tp);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.chapter-link:hover {
  border-color: var(--gold);
  background: #fff;
  color: var(--cr);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(200,148,26,0.15);
}

.top-controls {
  display: flex;
  justify-content: flex-end;
  padding: 8px 4px;
}

.lang-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
  color: var(--ts);
  padding: 4px 10px;
  font-weight: 600;
  transition: all 0.2s;
}

.lang-toggle-btn.active {
  color: var(--cr);
  border-color: var(--gold);
  background: #fff;
}

.app-header-index {
  background: #A71C20;
  background-size: cover;
  background-image: url(pattern-background-02.svg);
  padding: 55px 20px;
  padding-top: 80px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* Original CSS*/
.logo img {
  height: 50px;
  margin-left:15px;
  margin-top:10px;
  margin-bottom: 5px;
}

nav {
  display: flex;
  align-items: center;
  flex-grow: 1; /* Allow nav to grow and take available space */
  justify-content: center; /* Center the nav links */
}

.menu-icon {
  display: none;
  cursor: pointer;
}

.menu-icon svg {
  fill: #fff;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center; /* Center the links horizontally */
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.nav-links li {
  margin: 0 15px; /* Adjust spacing between links */
}

.nav-links a {
  color: #333;
  text-decoration: none;
  font-size: 16px;
}

.nav-links a:hover {
  text-decoration: underline;
}

.top-container {
  padding: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-bottom-left-radius: 10% 50px;
  background-color: #A71C20;
  background-image: url(pattern-background-02.svg);
  place-items: center;
}

.container {
  margin: 20px auto;
  margin-left: 20px;
  margin-right: 20px;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

/* Slide menu */
.header {
  background-color: #0073e6;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main {
  margin: 0 auto;
  display: block;
  height: 100%;
  margin-top: 60px;
}

.mainInner{
  display: table;
  height: 100%;
  width: 100%;
  text-align: center;
}

.mainInner div{
  display:table-cell;
  vertical-align: middle;
  font-size: 3em;
  font-weight: bold;
  letter-spacing: 1.25px;
}

#sidebarMenu {
  padding-top: 80px;
  height: 100%;
  top: 0px;
  position: fixed;
  left: 0;
  width: 250px;
  transform: translateX(-250px);
  transition: transform 250ms ease-in-out;
  background: linear-gradient(180deg, #a71c20 0%, #0C0203 100%);
  z-index: 1001;
}

.sidebarMenuInner{
  margin:0;
  padding:0;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebarMenuInner li{
  list-style: none;
  color: #fff;
  text-transform: uppercase;
  font-weight: bold;
  padding: 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebarMenuInner li span{
  display: block;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.50);
}

.sidebarMenuInner li a{
  color: #fff;
  text-transform: uppercase;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
}

input[type="checkbox"]:checked ~ #sidebarMenu {
  transform: translateX(0);
}

input[type=checkbox] {
  transition: all 0.3s;
  box-sizing: border-box;
  display: none;
}

.sidebarIconToggle {
  transition: all 0.3s;
  box-sizing: border-box;
  cursor: pointer;
  position: fixed;
  z-index: 1002;
  height: 100%;
  width: 100%;
  top: 40px;
  left: 15px;
  height: 22px;
  width: 22px;
  padding-top: 30px;
}

.spinner {
  transition: all 0.3s;
  box-sizing: border-box;
  position: absolute;
  height: 3px;
  width: 100%;
  background-color: #fff;
}

.horizontal {
  transition: all 0.3s;
  box-sizing: border-box;
  position: relative;
  float: left;
  margin-top: 3px;
  box-shadow: 0.5px 0.5px;
  border-radius: 6px;
}

.diagonal.part-1 {
  position: relative;
  transition: all 0.3s;
  box-sizing: border-box;
  float: left;
  box-shadow: 0.5px 0.5px;
  border-radius: 6px;
  height: 3px;   /* Customize overall thickness */
  width: 15px;   /* Customize overall width/length */
}

.diagonal.part-2 {
  transition: all 0.3s;
  box-sizing: border-box;
  position: relative;
  float: left;
  margin-top: 3px;
  box-shadow: 0.5px 0.5px;
  border-radius: 6px;
  height: 3px;   /* Customize overall thickness */
  width: 15px;   /* Customize overall width/length */
}

input[type=checkbox]:checked ~ .sidebarIconToggle > .horizontal {
  transition: all 0.3s;
  box-sizing: border-box;
  opacity: 0;
}

input[type=checkbox]:checked ~ .sidebarIconToggle > .diagonal.part-1 {
  transition: all 0.3s;
  box-sizing: border-box;
  transform: rotate(135deg);
  margin-top: 8px;
}

input[type=checkbox]:checked ~ .sidebarIconToggle > .diagonal.part-2 {
  transition: all 0.3s;
  box-sizing: border-box;
  transform: rotate(-135deg);
  margin-top: -9px;
}

#paginationControls {
  margin-top: 20px;
  text-align: center;
}

#paginationControls button {
  padding: 5px 10px;
  margin: 0 5px;
  cursor: pointer;
}

#paginationControls button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
/* Favorites Sidebar */

.Favorites-sidebar {
position: fixed;
top: 0px;
right: -300px;
height: 100%;
background-color: #fff;
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
transition: right 0.3s ease;
padding: 20px;
padding-top: 40px;
z-index: 1200;
}

.Favorites-sidebar h2 {
margin-top: 10;
color: #333;
}

#FavoritesList {
list-style: none;
padding: 0;
}

#FavoritesList li {
margin-bottom: 10px;
}

#FavoritesList li a {
color: #333;
text-decoration: none;
font-size: 16px;
}

#FavoritesList li a:hover {
text-decoration: underline;
}

#closeFavoritesButton {
position: absolute;
top: 15px;
right: 10px;
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #333;
}

#closeFavoritesButton:hover {
color: #005bb5;
}

.opensearch	{
    margin-top: unset;
	padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 999px; /* For pill-shaped buttons */
    background-color: #f1f1f1;
    color: #000;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
    
}

.clear-favorites-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 999px; /* For pill-shaped buttons */
    background-color: #f1f1f1;
    color: #000;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
}

.clear-history-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 999px; /* For pill-shaped buttons */
    background-color: #f1f1f1;
    color: #000;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
}

#clearFavoritesButton:hover {
    background: #FFEEF0;
    border-color: #FFD5DA;
    color: var(--brand);;
}

.pagination-button {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 999px; /* For pill-shaped buttons */
    background-color: #f1f1f1;
    color: #000;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
}

.history-sidebar {
position: fixed;
top: 0;
right: -400px;
height: 100%;
background-color: #fff;
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
transition: right 0.3s ease;
padding: 20px;
padding-top: 40px;
z-index: 1200;
}

.history-sidebar h2 {
margin-top: 10;
color: #333;
}

#historyList {
list-style: none;
padding: 0;
}

#historyList li {
margin-bottom: 10px;
}

#historyList li a {
color: #333;
text-decoration: none;
font-size: 16px;
}

#historyList li a:hover {
text-decoration: underline;
}

#closeHistoryButton {
position: absolute;
    top: 15px;
right: 10px;
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #333;
}

#closeHistoryButton:hover {
color: #8a8573;
}

#clearHistoryButton {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 999px; /* For pill-shaped buttons */
    background-color: #f1f1f1;
    color: #000;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, color 0.2s;
}

#clearHistoryButton:hover {
    background: #FFEEF0;
    border-color: #FFD5DA;
    color: var(--brand);;
}

/* Responsive Design */

@media (max-width: 768px) {
.menu-icon {
display: block;
   		text-align: right;
}

.nav-links {
position: fixed;
top: 60px;
right: -200%;
height: 100vh;
width: 100%;
background-color: #2F6695;
flex-direction: column;
align-items: center;
transition: right 0.3s ease;
}

.nav-links.active {
right: 0;
}

.nav-links li {
margin: 20px 0;
}

.action-buttons {
margin-top: 10px;
}

.action-buttons button {
margin-right: 10px;
padding: 5px 10px;
background-color: #a6192e;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}

.action-buttons button:hover {
background-color: #a6192e7a;
}
} /* end @media (max-width: 768px) — was left unclosed in master */

/* ── Accessibility fixes ─────────────────────────────────────── */
/* main landmark must not alter the existing block flow */
main#mainContent { display: contents; }
/* Reset h1 browser defaults when used inside .htb header block  */
h1.hbt {
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}