﻿@font-face {
  font-family: 'Samarkan';
  src: url('../fonts/samarkan.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Common */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Dark Mode Palette (Default): #010B13 (Deep Midnight Black/Navy), #FE9900 (Warm Amber Gold), #FE0000 (Vibrant Accent Red) */
  --bg: #010B13;
  --bg-card: #010B13;
  --bg-elevated: #010B13;
  --bg-hover: rgba(254, 153, 0, 0.12);
  --bg-surface: #010B13;
  --border: rgba(254, 153, 0, 0.22);
  --border-hi: #FE9900;
  --border-card: rgba(254, 153, 0, 0.24);
  --accent: #FE9900;
  --accent-dim: rgba(254, 153, 0, 0.15);
  --accent-glow: rgba(254, 153, 0, 0.35);
  --accent-hover: #FE0000;
  --accent-soft: rgba(254, 153, 0, 0.08);
  --text-1: #FE0000;
  --text-2: #FE9900;
  --text-3: #FE9900;
  --green-text: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --green-border: rgba(34, 197, 94, 0.3);
  --orange-text: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.12);
  --orange-border: rgba(249, 115, 22, 0.35);
  --red: #FE0000;
  --edit-accent: #FE0000;
  --edit-glow: rgba(254, 0, 0, 0.25);
  --btn-text: #010B13;
  --book-title-color: #ffffff;
  --shadow-xs: 0 1px 2px rgba(254, 153, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(254, 153, 0, 0.12);
  --shadow-md: 0 6px 24px rgba(254, 153, 0, 0.16);
  --shadow-lg: 0 14px 44px rgba(254, 0, 0, 0.14);
  --shadow-card: 0 2px 14px rgba(254, 153, 0, 0.12), 0 0 0 1px var(--border-card);
  --free-badge-bg: #00ff00;
}

[data-theme="dark"] {
  --bg: #010B13;
  --bg-card: #010B13;
  --bg-elevated: #010B13;
  --bg-hover: rgba(254, 153, 0, 0.12);
  --bg-surface: #010B13;
  --border: rgba(254, 153, 0, 0.22);
  --border-hi: #FE9900;
  --border-card: rgba(254, 153, 0, 0.24);
  --accent: #FE9900;
  --accent-dim: rgba(254, 153, 0, 0.15);
  --accent-glow: rgba(254, 153, 0, 0.35);
  --accent-hover: #FE0000;
  --accent-soft: rgba(254, 153, 0, 0.08);
  --text-1: #FE0000;
  --text-2: #FE9900;
  --text-3: #FE9900;
  --green-text: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --green-border: rgba(34, 197, 94, 0.3);
  --orange-text: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.12);
  --orange-border: rgba(249, 115, 22, 0.35);
  --red: #FE0000;
  --edit-accent: #FE0000;
  --edit-glow: rgba(254, 0, 0, 0.25);
  --btn-text: #010B13;
  --book-title-color: #ffffff;
  --shadow-xs: 0 1px 2px rgba(254, 153, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(254, 153, 0, 0.12);
  --shadow-md: 0 6px 24px rgba(254, 153, 0, 0.16);
  --shadow-lg: 0 14px 44px rgba(254, 0, 0, 0.14);
  --shadow-card: 0 2px 14px rgba(254, 153, 0, 0.12), 0 0 0 1px var(--border-card);
}

[data-theme="light"] {
  --bg: #FFFCF5;
  --bg-card: #FFFCF5;
  --bg-elevated: #FFFCF5;
  --bg-hover: rgba(254, 153, 0, 0.12);
  --bg-surface: #FFFCF5;
  --border: rgba(254, 153, 0, 0.22);
  --border-hi: #FE9900;
  --border-card: rgba(254, 153, 0, 0.24);
  --accent: #FE9900;
  --accent-dim: rgba(254, 153, 0, 0.15);
  --accent-glow: rgba(254, 153, 0, 0.35);
  --accent-hover: #FE0000;
  --accent-soft: rgba(254, 153, 0, 0.08);
  --text-1: #FE0000;
  --text-2: #FE9900;
  --text-3: #FE9900;
  --green-text: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.10);
  --green-border: rgba(22, 163, 74, 0.28);
  --orange-text: #ea6c0a;
  --orange-bg: rgba(234, 108, 10, 0.10);
  --orange-border: rgba(234, 108, 10, 0.28);
  --red: #FE0000;
  --edit-accent: #FE0000;
  --edit-glow: rgba(254, 0, 0, 0.25);
  --btn-text: #FFFCF5;
  --book-title-color: #000000;
  --shadow-xs: 0 1px 2px rgba(254, 153, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(254, 153, 0, 0.12);
  --shadow-md: 0 6px 24px rgba(254, 153, 0, 0.16);
  --shadow-lg: 0 14px 44px rgba(254, 0, 0, 0.14);
  --shadow-card: 0 2px 14px rgba(254, 153, 0, 0.12), 0 0 0 1px var(--border-card);
}


*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Prevent scrolling while loader is visible */
body.loading {
  overflow: hidden;
}

/* Main content fades in after loader disappears */
body.page-ready header,
body.page-ready main,
body.page-ready footer {
  animation: contentReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes contentReveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  background-image: url('../img/books-bg-pattern.jpg');
  background-size: 420px 420px;
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(254, 153, 0, 0.04) 0%, transparent 70%),
    rgba(1, 11, 19, 0.72);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body,
body[data-theme="light"] {
  background-image: url('../img/books-bg-pattern.jpg');
}

[data-theme="light"] body::before,
body[data-theme="light"]::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(254, 153, 0, 0.06) 0%, transparent 70%),
    rgba(255, 252, 245, 0.82);
}


::selection {
  background: rgba(254, 153, 0, 0.25);
  color: var(--btn-text);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


header {
  background: linear-gradient(180deg, rgba(254, 153, 0, 0.18) 0%, var(--bg) 100%);
  padding: 28px 28px 30px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 10;
}

.header-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}


.header-center pre.ascii-banner {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.15;
  color: #FE0000;
  background: transparent;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  display: inline-block;
  letter-spacing: 0.02em;
  user-select: none;
  text-shadow: 0 0 40px rgba(254, 153, 0, 0.15);
}

.header-center pre.ascii-banner .credit-line {
  display: block;
  width: 100%;
  text-align: center;
  margin: 10px auto 0;
  color: var(--text-3);
  font-size: 0.7em;
  letter-spacing: 0.35em;
  text-indent: 0.35em; /* counters letter-spacing to make it dead center */
  text-shadow: none;
}

.header-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0;
  padding: 4px 0 0;
  gap: 6px;
}

.brand-title {
  font-family: 'Rozha One', 'Yatra One', serif;
  font-size: clamp(2.4rem, 6vw, 7rem);
  font-weight: normal;
  letter-spacing: 0.05em;
  color: #FE0000;
  line-height: 1.1;
  text-shadow: 0 0 35px rgba(254, 153, 0, 0.25);
  user-select: none;
}

.header-brand .credit-line {
  color: var(--text-3);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-weight: 600;
}


#searchBox {
  width: 100%;
  padding: 12px 20px 12px 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-elevated);
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background 0.25s;
  caret-color: var(--accent);
}

.search-container {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

/* Search icon inside every search box (left-aligned, non-interactive).
   It hides automatically while the user has typed something. */
.search-container::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
  background-color: var(--text-3);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='16.5' y1='16.5' x2='21' y2='21'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='16.5' y1='16.5' x2='21' y2='21'/></svg>") no-repeat center / contain;
  transition: opacity 0.2s ease;
}

.search-container:has(input:not(:placeholder-shown))::after {
  opacity: 0;
}

/* One shared control height everywhere: search input = group-by select */

:root {
  --control-height: 46px;
}

#searchBox {
  min-height: var(--control-height);
  box-sizing: border-box;
}

.group-by-wrapper select {
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hi);
  background: var(--bg-elevated);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.85rem;
  min-height: var(--control-height);
  height: var(--control-height);
  width: 168px;
  min-width: 168px;
  max-width: 168px;
  box-sizing: border-box;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

/* Class pages: search box + group-by on the same row */
.header-tools-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 700px;
  margin: 12px auto 24px;
}

.header-tools-row .search-container {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
}

.header-tools-row .group-by-controls {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  justify-content: flex-end;
}

@media (max-width: 680px) {
  .header-tools-row {
    flex-direction: column;
    align-items: stretch;
  }

  .header-tools-row .group-by-controls {
    justify-content: flex-start;
  }
}

.group-by-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 18px;
  width: 100%;
}

.group-by-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-2);
}

.group-by-wrapper label {
  font-weight: 500;
  white-space: nowrap;
}

.group-by-wrapper select {
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hi);
  background: var(--bg-elevated);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.group-by-wrapper select:focus,
.group-by-wrapper select:hover {
  border-color: var(--accent);
}

.book-group {
  width: 100%;
  margin-bottom: 40px;
}

/* Reusable inner grid: every grouped view reuses the same .book-list layout.
   minmax(0, ...) keeps every card the same width even when its content varies */
.book-group .book-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0;
  justify-content: start;
  justify-items: stretch;
  align-items: start;
}

.book-group .book {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  justify-self: stretch;
  height: 100%;
}

@media (max-width: 1280px) {
  .book-group .book-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .book-group .book-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .book-group .book-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Grouped containers stack blocks; flat "None" views keep the plain grid */
#classGrid.book-list.is-grouped {
  display: block;
}

#bookList .book-group {
  width: 100%;
}

/* Grouped view on class pages: gap so headings never touch the cards */
#classGrid h3.group-title {
  margin-top: 28px;
}

#classGrid h3.group-title:first-of-type {
  margin-top: 0;
}

.group-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-hi);
  width: 100%;
}

.programming-group {
  width: 100%;
  margin-top: 50px;
  border-top: 1px solid var(--border-hi);
  padding-top: 36px;
}

.programming-group .group-title,
.group-title.programming-heading {
  font-size: 2.25rem;
  line-height: 1.25;
  text-align: center;
  border-bottom: none;
  margin: 0 auto 30px auto;
  color: var(--text-1);
  font-weight: 800;
  letter-spacing: -0.01em;
  display: block;
  width: 100%;
}

#searchBox:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 2px 16px rgba(254, 153, 0, 0.16);
  background: var(--bg-hover);
}

/* Book Banner Slider */
.book-banner {
  width: 100%;
  max-width: 520px;
  height: 180px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-hi);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  box-shadow: var(--shadow-md);
}

.banner-track {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 0.6s var(--ease-out);
}

.banner-item {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  gap: 20px;
}

.banner-img {
  height: 140px;
  width: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.banner-info {
  text-align: left;
  flex: 1;
}

.banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.banner-author {
  font-size: 0.85rem;
  color: var(--text-2);
}

.banner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--bg-card) 0%, transparent 15%, transparent 85%, var(--bg-card) 100%);
  opacity: 0.3;
}

@media screen and (max-width: 600px) {
  .group-by-controls {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .group-by-wrapper {
    justify-content: center;
    width: auto;
  }

  .group-by-wrapper select {
    flex: 0 0 auto;
    width: 168px;
    min-width: 168px;
    max-width: 168px;
  }

  .programming-group .group-title,
  .group-title.programming-heading {
    font-size: 1.65rem;
    margin-bottom: 20px;
  }

  .book-banner {
    height: 140px;
    max-width: 100%;
  }

  .banner-img {
    height: 110px;
    width: 80px;
  }

  .banner-title {
    font-size: 0.95rem;
  }

  .banner-author {
    font-size: 0.75rem;
  }
}

#searchBox::placeholder {
  color: var(--text-3);
  font-weight: 400;
}


.menu-button {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  transition: all 0.25s var(--ease-out);
  z-index: 1001;
  padding: 0;
}

.menu-button:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.menu-button span {
  display: block;
  width: 17px;
  height: 1.5px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all 0.3s var(--ease-out);
}

.menu-button.active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
  background: var(--accent);
}

.menu-button.active span:nth-child(2) {
  opacity: 0;
}

.menu-button.active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
  background: var(--accent);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: absolute;
  top: 24px;
  right: 80px;
  /* To the left of the menu button */
  width: 42px;
  height: 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease-out);
  z-index: 1001;
  padding: 0;
  color: var(--text-2);
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s var(--ease-spring);
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

[data-theme="light"] .sun-icon {
  display: block;
}

[data-theme="light"] .moon-icon {
  display: none;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
}


.side-panel {
  position: fixed;
  top: 0;
  right: -200px;
  width: 200px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 48px rgba(0, 0, 0, 0.55);
  transition: right 0.35s var(--ease-out);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(16px);
}

.side-panel.open {
  right: 0;
}

.panel-content {
  padding: 20px 14px;
}

.panel-content h2 {
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0 0 18px;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.menu-header h2 {
  margin: 0;
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.menu-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xs);
  color: var(--text-2);
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s var(--ease-out);
}

.menu-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.collapsible-section {
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s;
}

.collapsible-section:hover {
  border-color: var(--border-hi);
}

.section-header {
  background: var(--bg-elevated);
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.2s var(--ease-out);
}

.section-header:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

.arrow {
  font-size: 0.55rem;
  transition: transform 0.3s var(--ease-out);
  color: var(--text-3);
}

.collapsible-section.active .arrow {
  transform: rotate(180deg);
  color: var(--accent);
}

.section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out), padding 0.3s;
  padding: 0 16px;
  background: var(--bg-card);
}

.collapsible-section.active .section-content {
  max-height: 220px;
  padding: 14px 16px;
}

.section-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.section-content li {
  padding: 4px 0;
  color: var(--text-2);
  font-size: 0.82rem;
}

.section-content p {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.7;
  margin: 0 0 8px;
}

.section-content p:last-child {
  margin-bottom: 0;
}

.section-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.section-content a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}


main {
  flex: 1;
  padding: 32px 28px;
  position: relative;
  z-index: 1;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin: 0 0 20px;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
  justify-content: start;
  justify-items: stretch;
  align-items: start;
}

.book-list>.book {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  justify-self: stretch;
  height: 100%;
}

@media (max-width: 1280px) {
  .book-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .book-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .book-list {
    grid-template-columns: repeat(2, 1fr);
  }
}


.book {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 20px 16px 18px;
  text-align: center;
  transition: all 0.35s var(--ease-out);
  box-shadow: var(--shadow-card);
  content-visibility: auto;
  contain-intrinsic-size: auto 340px;
}

.book::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(254, 153, 0, 0.03) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  pointer-events: none;
}

.book:hover {
  border-color: rgba(254, 153, 0, 0.2);
  box-shadow: 0 0 0 1px rgba(254, 153, 0, 0.15), 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 60px rgba(254, 153, 0, 0.06);
  transform: translateY(-6px);
}

.book:hover::before {
  opacity: 1;
}

/* Book names: white in dark mode, black in light mode (all breakpoints) */
.book p,
.book .desktop-book-title,
.book .mobile-book-title {
  color: var(--book-title-color);
}

/* Skeleton Card Loader */
.book.skeleton {
  pointer-events: none;
  user-select: none;
}

.book.skeleton .skeleton-img {
  width: 140px;
  height: 192px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  margin-bottom: 14px;
  order: 1;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.book.skeleton .skeleton-title {
  width: 78%;
  height: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  order: 2;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.book.skeleton .skeleton-btn {
  width: 88%;
  height: 38px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  order: 4;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.book.skeleton .skeleton-meta {
  display: flex;
  gap: 6px;
  order: 3;
  margin-bottom: 14px;
}

.book.skeleton .skeleton-badge {
  width: 48px;
  height: 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {

  0%,
  100% {
    opacity: 0.45;
  }

  50% {
    opacity: 0.85;
  }
}

.book-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius);
}

.book-empty-state h3 {
  color: var(--text-1);
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.book-empty-state p {
  color: var(--text-2);
  font-size: 0.88rem;
}


.book img {
  width: 140px;
  height: 192px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
  order: 1;
  margin-bottom: 14px;
  display: block;
}

.book:hover img {
  transform: scale(1.04);
  box-shadow: 0 8px 32px rgba(254, 153, 0, 0.25), 0 0 20px rgba(254, 153, 0, 0.2);
}


@media (min-width: 681px) {
  .book {
    position: relative;
    display: grid;
    grid-template-rows: minmax(160px, 170px) calc(30px + 0.9rem * 1.4 * 2) 24px auto;
    grid-template-areas: "thumb" "title" "badges" "action";
    justify-items: center;
    align-items: start;
  }

  .book img {
    grid-area: thumb;
    align-self: center;
    margin: 0;
    width: 135px;
    height: 180px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    transform: scale(1.08);
  }

  .book:hover img {
    transform: scale(1.12);
  }

  .book p {
    grid-area: title;
    align-self: start;
    width: 100%;
    max-width: 100%;
    font-size: 0.9rem;
    color: var(--book-title-color);
    margin-top: 14px;
    margin-bottom: 16px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
  }

  .book-meta {
    grid-area: badges;
    align-self: start;
    min-height: 22px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .book-meta .book-badge.orange {
    order: 1;
  }

  .book-meta .book-badge.green {
    order: 2;
  }

  .book a {
    grid-area: action;
    align-self: end;
  }
}

.book-meta {
  display: flex;
  order: 3;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  min-height: 22px;
  align-self: center;
}


.book-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.orange {
  color: var(--orange-text);
  background: var(--orange-bg);
  border: 1px solid var(--orange-border);
}

.green {
  color: var(--green-text);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}


.book a {
  display: block;
  order: 4;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--btn-text);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  text-decoration: none;
  text-align: center;
  letter-spacing: 0.03em;
  transition: all 0.25s var(--ease-out);
  margin: 0;
  position: relative;
  overflow: hidden;
}

.book a::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.book a:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.book a:hover::after {
  opacity: 1;
}

.book a:active {
  transform: translateY(0);
}


.book-description,
.book-platform {
  display: none;
}

.mobile-book-title {
  display: none;
}


footer {
  text-align: center;
  padding: 24px 18px;
  font-size: 0.76rem;
  background: var(--bg);
  color: var(--text-3);
  border-top: 1px solid var(--border);
  margin-top: auto;
  letter-spacing: 0.02em;
  line-height: 1.9;
}

footer a {
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

footer a:hover {
  color: var(--accent);
}


.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: var(--btn-text);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease-out);
  z-index: 1000;
  box-shadow: 0 4px 20px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
}

/* Keep the button above the footer so it never sits inside it */
.scroll-to-top.show.footer-visible {
  bottom: 92px;
}

/* Hide the scroll-to-top button in edit mode */
.edit-mode-active #scrollToTop {
  display: none !important;
}

/* PDF Reader Toolbar Styles */
:root {
  color-scheme: dark;
  --bg: #010B13;
  --panel: #010B13;
  --line: #FE9900;
  --text: #FE0000;
  --muted: #FE9900;
  --accent: #FE9900;
  --toolbar-icon: #FE9900;
  --toolbar-icon-hover: #ffffff;
  --toolbar-sep: rgba(254, 153, 0, .25)
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFCF5;
  --panel: #FFFCF5
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #010B13;
  --panel: #010B13
}

.toolbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap
}

.head.toolbar-center {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  padding-left: 64px;
  padding-right: 64px
}

.head.toolbar-center>.toolbar-section:first-child {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%)
}

.head.toolbar-center::-webkit-scrollbar {
  display: none
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: var(--toolbar-sep);
  flex: 0 0 1px
}

.t-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--toolbar-icon);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s
}

.t-btn:hover {
  background: rgba(254, 153, 0, .12);
  color: var(--toolbar-icon-hover);
  border-color: rgba(254, 153, 0, .2)
}

.t-btn:disabled {
  opacity: .3;
  cursor: not-allowed
}

.t-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0
}

/* Improve visibility of text-glyph controls such as previous, next, and rotate. */
#prevPage,
#nextPage,
#rotateBtn {
  font-size: 27px;
  line-height: 1;
  font-weight: 500
}

#prevPage,
#nextPage {
  font-family: Arial, sans-serif
}

#rotateBtn {
  font-size: 22px
}

#backBtn {
  width: auto !important;
  padding: 0 10px !important;
  gap: 7px;
  font-size: 16px !important;
  font-weight: 600
}

#backBtn .back-word {
  font-size: 13px;
  letter-spacing: .04em
}

@media(max-width:650px) {

  #zoomIn,
  #zoomOut {
    display: none !important
  }

  #backBtn {
    width: 32px !important;
    padding: 0 !important
  }

  #backBtn .back-word {
    display: none
  }
}

.zoom-pct {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  min-width: 42px;
  text-align: center
}

@media(max-width:650px) {

  #zoomIn,
  #zoomOut {
    display: none !important
  }

  #backBtn {
    width: 32px !important;
    padding: 0 !important
  }

  #backBtn .back-word {
    display: none
  }
}

.scroll-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 28px var(--accent-glow);
}

.scroll-to-top:active {
  transform: translateY(-1px);
}

body.menu-open {
  overflow: hidden;
}

/* When the menu is open only the panel scrolls; the page behind stays fixed */
body.menu-open .side-panel {
  overscroll-behavior: contain;
  touch-action: pan-y;
}


/* Hamburger menu is mobile-only */
@media (min-width: 681px) {

  .menu-button,
  .side-panel {
    display: none;
  }
}


@media screen and (max-width: 600px),
screen and (max-device-width: 600px) {

  html,
  body {
    background: var(--bg);
    color: var(--text-1);
    overflow-x: hidden;
  }

  header {
    padding: 16px 14px 20px;
    background: linear-gradient(180deg, rgba(254, 153, 0, 0.18) 0%, var(--bg) 100%);
  }

  .header-center {
    gap: 14px;
    padding: 0 2px;
    width: 100%;
  }

  .header-center pre.ascii-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    color: #FE0000;
    font-size: clamp(4px, 1.5vw, 7.5px);
    line-height: 1.08;
    white-space: pre;
    text-align: center;
  }

  .header-center pre.ascii-banner .credit-line {
    display: block;
    width: 100%;
    color: var(--text-3);
    text-align: center;
    margin: 8px auto 0;
    white-space: nowrap;
    letter-spacing: 0.15em;
    text-indent: 0.15em;
    font-size: 1em;
  }

  #searchBox {
    width: min(100%, 420px);
    max-width: 420px;
    min-height: 44px;
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-1);
    border: 1px solid var(--border-hi);
  }

  .menu-button {
    display: flex !important;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
  }

  .theme-toggle-btn {
    top: 64px;
    /* Directly under the menu button */
    right: 14px;
    width: 40px;
    height: 40px;
  }

  main {
    padding: 14px 10px 28px;
  }

  .section-title {
    display: none;
  }

  .book-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 0;
    margin: 0 !important;
  }

  .book {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    min-height: 88px;
    display: grid !important;
    grid-template-columns: 54px minmax(0, 1fr) 88px;
    grid-template-rows: auto 1fr;
    grid-template-areas: "thumb title action" "thumb badge action";
    column-gap: 12px;
    row-gap: 2px;
    align-content: center;
    padding: 12px 12px 12px 14px;
    border-radius: var(--radius-sm);
    text-align: left;
    transform: none !important;
    box-shadow: var(--shadow-xs);
  }

  .book::before {
    display: none;
  }

  .book:hover {
    transform: none !important;
    box-shadow: 0 0 0 1px rgba(254, 153, 0, 0.3), var(--shadow-sm);
  }

  .book img {
    grid-area: thumb;
    width: 60px;
    height: 82px;
    margin: 0;
    padding: 0;
    order: unset !important;
    border-radius: var(--radius-xs);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .book:hover img {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  body main .book-list .book,
  body .book,
  .book {
    flex: 0 0 auto !important;
    height: 108px !important;
    min-height: 108px !important;
    max-height: 108px !important;
    overflow: hidden !important;
    margin: 0 !important;
    align-items: start;
    row-gap: 6px !important;
  }

  .book p {
    grid-area: title;
    align-self: start;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    color: var(--book-title-color);
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
  }

  .book p .desktop-book-title {
    display: inline;
  }

  .book p .mobile-book-title {
    display: none;
  }

  .book-meta {
    grid-area: badge;
    justify-content: flex-start;
    align-items: center;
    margin: 0;
    gap: 4px;
    order: unset !important;
    align-self: center;
    min-height: 0;
    display: flex !important;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .book-badge {
    padding: 2px 6px;
    font-size: 0.55rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .book a {
    grid-area: action;
    width: 84px;
    min-width: 0;
    font-size: 0;
    padding: 9px 5px;
    order: unset !important;
    align-self: center;
    justify-self: end;
    margin: 0;
    border-radius: var(--radius-xs);
    transform: none !important;
  }

  .book a:hover {
    transform: none !important;
  }

  .book a::after {
    display: none;
  }

  .book a::before {
    content: "Open";
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
  }

  .side-panel {
    display: block !important;
    width: min(200px, 56vw);
    right: calc(-1 * min(200px, 56vw));
  }

  .side-panel.open {
    right: 0 !important;
  }

  footer {
    padding: 18px 12px;
    font-size: 0.7rem;
  }

  .scroll-to-top {
    bottom: 14px;
    right: 12px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}



@media screen and (max-width: 600px),
screen and (max-device-width: 600px) {

  header .menu-button {
    display: flex;
  }

  body main .book-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  body main .book-list .book {
    flex: 0 0 auto !important;
    height: 108px !important;
    min-height: 108px !important;
    max-height: 108px !important;
    overflow: hidden !important;
    margin: 0 !important;
    align-items: start;
    row-gap: 6px !important;
  }

  body .book .book-meta {
    grid-area: badge;
    justify-content: flex-start;
    align-items: center;
    align-self: center;
    min-height: 0;
    display: flex !important;
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  body .book .book-badge.orange {
    order: 1;
  }

  body .book .book-badge.green {
    order: 2;
  }

  body .book p {
    grid-area: title;
    align-self: start;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    color: var(--book-title-color);
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
  }

  body .book p .desktop-book-title {
    display: inline;
  }

  body .book p .mobile-book-title {
    display: none;
  }

  body .book-badge.green {
    color: var(--green-text);
    background: var(--green-bg);
    border: 1px solid var(--green-border);
  }

  body .book-badge.orange {
    color: var(--orange-text);
    background: var(--orange-bg);
    border: 1px solid var(--orange-border);
  }

  body .book a {
    grid-area: action;
    width: 84px;
    min-width: 0;
    padding: 9px 5px;
    font-size: 0;
  }

  body .book a::before {
    content: "Open";
    margin: 0;
    font-size: 0.6rem;
    display: block;
  }

  body .book a::after {
    display: none;
  }
}




.edit-mode-active {
  --admin-accent: var(--edit-accent);
}

/* In edit mode hide the class nav buttons, search box and banner
   so only cards + the edit bar are visible */
.edit-mode-active .class-nav,
.edit-mode-active .search-container {
  display: none !important;
}

#editModeBar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: var(--bg);
  border-top: 1px solid var(--border-hi);
  color: var(--text-1);
  padding: 14px 22px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px rgba(254, 153, 0, 0.15);
  font-family: inherit;
}

.edit-mode-active {
  padding-bottom: 85px;
}

.edit-mode-active #editModeBar {
  display: block;
  animation: slideUpBar 0.35s var(--ease-out);
}

@keyframes slideUpBar {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.edit-bar-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.edit-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.edit-badge-pill {
  background: var(--edit-accent);
  color: var(--btn-text);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-xs);
}

.edit-bar-info>span {
  font-size: 0.88rem;
  color: var(--text-2);
}


.edit-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.edit-btn-primary {
  background: var(--edit-accent);
  color: var(--btn-text);
}

.edit-btn-primary:hover {
  background: #FE9900;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(254, 153, 0, 0.3);
}

.edit-btn-secondary {
  background: var(--bg-hover);
  color: var(--text-1);
  border: 1px solid var(--border-hi);
}

.edit-btn-secondary:hover {
  background: rgba(254, 153, 0, 0.2);
  border-color: var(--accent);
}

.edit-btn-success {
  background: #FE9900;
  color: var(--btn-text);
  font-weight: 700;
}

.edit-btn-success:hover {
  background: #FE0000;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(254, 153, 0, 0.3);
}

.edit-btn-danger {
  background: var(--red);
  color: var(--btn-text);
}

.edit-btn-danger:hover {
  background: #FE9900;
}

.edit-btn-cancel {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.edit-btn-cancel:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}


.edit-mode-active .book {
  border: 1px dashed rgba(254, 153, 0, 0.6) !important;
  box-shadow: 0 0 0 1px rgba(254, 153, 0, 0.25), var(--shadow-sm) !important;
  position: relative;
}

.edit-mode-active .book:hover {
  border-color: var(--accent) !important;
}

.card-edit-overlay {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 5px;
  z-index: 10;
}

.edit-mode-active .card-edit-overlay {
  display: flex;
}

.card-action-btn {
  background: var(--bg);
  color: var(--text-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.2s var(--ease-out);
}

.card-action-btn:hover {
  background: var(--edit-accent);
  color: var(--btn-text);
  border-color: var(--edit-accent);
}

.card-action-btn.delete:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--btn-text);
}



.edit-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow: hidden;
}

.edit-modal-backdrop.active {
  display: flex;
}

.edit-modal-box {
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 24px 64px rgba(254, 153, 0, 0.2), 0 0 0 1px var(--border-card);
  color: var(--text-1);
  padding: 24px 28px;
  animation: modalPop 0.3s var(--ease-spring);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.edit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 22px;
}

.edit-modal-header h3 {
  margin: 0;
  color: var(--edit-accent);
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 700;
}

.edit-modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all 0.2s;
}

.edit-modal-close:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.edit-form-group {
  margin-bottom: 18px;
  text-align: left;
}

.edit-form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.edit-form-group input,
.edit-form-group select {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.edit-form-group input:focus,
.edit-form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.edit-form-group input::placeholder {
  color: var(--text-3);
}


.image-drop-zone {
  border: 2px dashed var(--border-hi);
  border-radius: var(--radius);
  background: rgba(254, 153, 0, 0.06);
  padding: 22px;
  text-align: center;
  transition: all 0.25s var(--ease-out);
  cursor: pointer;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-drop-zone:hover {
  border-color: var(--accent);
  background: rgba(254, 153, 0, 0.12);
}

.image-drop-zone.drag-over {
  border-color: var(--edit-accent);
  background: rgba(254, 153, 0, 0.16);
  box-shadow: 0 0 32px rgba(254, 153, 0, 0.2);
  transform: scale(1.01);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.drop-zone-text {
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
}

.drop-zone-subtext {
  color: var(--text-3);
  font-size: 0.76rem;
  margin: 0;
}

.drop-zone-hint {
  color: var(--text-3);
  font-size: 0.68rem;
  margin: 4px 0 0;
}

.drop-zone-hint code {
  background: rgba(254, 153, 0, 0.12);
  color: var(--edit-accent);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.68rem;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--btn-text);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  user-select: none;
}

.file-upload-label:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.drop-zone-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.drop-zone-preview img {
  width: 68px;
  height: 92px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-sm);
}

.drop-zone-preview-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.drop-zone-preview-info span {
  font-size: 0.78rem;
  color: var(--text-2);
  font-weight: 500;
}

.remove-img-btn {
  background: rgba(254, 0, 0, 0.08);
  border: 1px solid rgba(254, 0, 0, 0.25);
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  text-align: left;
  transition: all 0.2s var(--ease-out);
}

.remove-img-btn:hover {
  background: rgba(254, 0, 0, 0.16);
  border-color: var(--red);
}

/* PDF Upload Section in Edit Modal */
.pdf-upload-section {
  margin-top: 10px;
}

.pdf-upload-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 10px 0;
  color: var(--text-3);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pdf-upload-divider::before,
.pdf-upload-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.pdf-upload-divider span {
  padding: 0 10px;
}

.pdf-drop-zone {
  border: 2px dashed var(--border-hi);
  border-radius: var(--radius-sm, 8px);
  background: var(--bg);
  padding: 16px;
  text-align: center;
  transition: all 0.25s var(--ease-out, ease-out);
}

.pdf-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(254, 153, 0, 0.12);
}

.pdf-drop-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pdf-upload-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.pdf-drop-text {
  font-size: 0.82rem;
  color: var(--text-2);
  margin: 0;
}

.pdf-upload-label {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: var(--btn-text);
  padding: 6px 14px;
  border-radius: var(--radius-xs, 4px);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
  user-select: none;
}

.pdf-upload-label:hover {
  background: var(--accent-hover);
  opacity: 0.95;
}

.pdf-drop-hint {
  font-size: 0.68rem;
  color: var(--text-3);
  margin: 0;
}

.pdf-drop-progress {
  padding: 10px 0;
}

.pdf-progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(254, 153, 0, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.pdf-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.pdf-progress-label {
  font-size: 0.75rem;
  color: var(--text-2);
  margin-top: 6px;
}

.pdf-drop-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.pdf-success-icon {
  width: 24px;
  height: 24px;
}

.pdf-success-name {
  font-size: 0.8rem;
  color: #FE9900;
  font-weight: 600;
  word-break: break-all;
  margin: 0;
}

.pdf-remove-btn {
  background: transparent;
  border: 1px solid rgba(254, 0, 0, 0.3);
  color: var(--red);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: var(--radius-xs, 4px);
  cursor: pointer;
  margin-top: 4px;
}

.pdf-remove-btn:hover {
  background: rgba(254, 0, 0, 0.1);
}

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}


#editToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  color: var(--text-1);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  font-weight: 600;
  font-size: 0.84rem;
  font-family: inherit;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 4000;
  opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

#editToast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   PAGE LOADER & STARTING ANIMATION
   ========================================================================== */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, rgba(254, 153, 0, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(254, 153, 0, 0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: center center;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s ease;
  pointer-events: all;
}

[data-theme="light"] .page-loader {
  background-image:
    linear-gradient(to right, rgba(254, 153, 0, 0.14) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(254, 153, 0, 0.14) 1px, transparent 1px);
}

.page-loader::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 35%, var(--bg) 95%);
  pointer-events: none;
}

.page-loader--done {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.loader-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: loaderFadeIn 0.35s ease-out;
  padding: 24px;
  max-width: 320px;
  text-align: center;
}

/* Circular Logo with Animated Progress Ring */
.loader-circle-wrapper {
  position: relative;
  width: 104px;
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.loader-ring-bg {
  fill: none;
  stroke: rgba(254, 153, 0, 0.18);
  stroke-width: 5;
}

.loader-ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  transition: stroke-dashoffset 0.25s ease-out;
}

.loader-logo-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(254, 153, 0, 0.20), 0 0 16px rgba(254, 153, 0, 0.25);
  z-index: 2;
  position: relative;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.loader-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.loader-percent-badge {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-top: 2px;
}

.loader-percent-badge span {
  font-size: 0.95rem;
  color: var(--orange-text);
  margin-left: 2px;
  font-weight: 700;
}

.loader-wordmark {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

.loader-bar-track {
  width: 160px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent, #FE9900);
  border-radius: 99px;
  transition: width 0.25s ease-out;
}

.loader-status {
  font-size: 0.8rem;
  color: var(--text-2);
  letter-spacing: 0.01em;
  min-height: 1.2em;
}

@keyframes loaderFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Page content reveal transition */
body.loading header,
body.loading main,
body.loading footer,
body.loading .theme-toggle-btn,
body.loading .menu-button,
body.loading .scroll-to-top {
  opacity: 0;
}

header,
main,
footer,
.theme-toggle-btn,
.menu-button,
.scroll-to-top {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.page-ready header,
body.page-ready main,
body.page-ready footer,
body.page-ready .theme-toggle-btn,
body.page-ready .menu-button,
body.page-ready .scroll-to-top {
  opacity: 1;
}

.page-heading {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-1);
  text-align: center;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-subheading {
  color: var(--text-2);
  font-size: 0.85rem;
  margin: -12px 0 0;
}

.class-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
}

.class-nav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  background: var(--bg-elevated);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.2s var(--ease-out), color 0.2s var(--ease-out), background 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.class-nav a:hover {
  border-color: var(--accent);
  color: var(--text-1);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.class-nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-text);
}

.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.menu-nav a {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hi);
  background: var(--bg-elevated);
  color: var(--text-1);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.menu-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Menu grouping gaps: All Books | classes/streams | Programming (+theme toggle) */
.menu-nav a:nth-child(1) {
  margin-bottom: 14px;
}

.menu-nav a[href="class12-arts.html"] {
  margin-bottom: 14px;
}

.menu-nav a:last-of-type {
  margin-bottom: 14px;
}

.menu-theme-toggle {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hi);
  background: var(--bg-elevated);
  color: var(--text-1);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.menu-theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-container {
  max-width: 560px;
  margin: 0 auto 40px;
  padding: 28px;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.detail-container h2 {
  color: var(--text-1);
  font-size: 1.4rem;
  margin: 0 0 16px;
  text-align: center;
}

.detail-image {
  width: 180px;
  height: 252px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  display: block;
  margin: 0 auto 20px;
}

.detail-container p {
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.8;
  margin: 0 0 10px;
}

.detail-container p a {
  color: var(--accent);
  font-weight: 600;
}

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}

.back-link:hover {
  color: var(--accent);
}

/* "Show More" pagination control under the book grid */
.show-more-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 28px 0 8px;
  grid-column: 1 / -1;
}

.show-more-btn {
  border: 1px solid var(--border-hi);
  background: var(--accent);
  color: var(--btn-text);
  border-radius: var(--radius-sm);
  padding: 10px 28px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}

.show-more-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(254, 153, 0, 0.35);
}

.show-more-btn:active {
  transform: translateY(0);
}

/* Mobile header: menu top-right, theme button directly under it */
@media (max-width: 680px) {
  header {
    position: relative;
    padding-top: 16px;
  }

  header .menu-button {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    width: 40px;
    height: 40px;
    margin: 0;
  }

  header .theme-toggle-btn {
    display: none;
  }

  .class-nav {
    display: none;
  }
}

/* ==========================================================================
   BOOK DETAIL PAGE & CONTAINER STYLES (normal.html & classify.js)
   ========================================================================== */
.detail-page-container {
  max-width: 900px;
  margin: 32px auto 60px;
  padding: 0 20px;
}

.detail-container {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.detail-image {
  width: 220px;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  background: var(--bg-surface);
}

.detail-title {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 700;
  color: var(--book-title-color);
  margin-bottom: 16px;
  line-height: 1.3;
}

.detail-meta-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-2);
}

.detail-meta-item strong {
  color: var(--text-1);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 24px;
}

.detail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  border: 1px solid transparent;
}

.detail-btn .btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}

.detail-btn.read-btn {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.detail-btn.read-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.detail-btn.download-btn {
  background: var(--bg-elevated);
  color: var(--text-1);
  border-color: var(--border-hi);
}

.detail-btn.download-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.detail-notice {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange-text);
  color: var(--text-2);
  padding: 14px 20px;
  border-radius: var(--radius-xs);
  font-size: 0.92rem;
  margin: 16px 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  max-width: 550px;
  width: 100%;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 8px 18px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all 0.2s var(--ease-out);
}

.back-link:hover {
  color: var(--text-1);
  border-color: var(--accent);
  background: var(--bg-hover);
}

@media (max-width: 600px) {
  .detail-container {
    padding: 24px 16px;
  }

  .detail-image {
    width: 180px;
    max-height: 260px;
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-btn {
    width: 100%;
  }
}

/* ==========================================================================
   FOCUS PREVIEW OVERLAY (class*.html + programming.html)
   "View Details" rotates the cover into a large focused view, blurs the page
   behind it and then reveals the "Read Online" action.
   ========================================================================== */

body>header,
body>main,
body>footer {
  transition: filter .5s var(--ease-out), transform .5s var(--ease-out);
}

body.bn-focus-open {
  overflow: hidden;
}

body.bn-focus-open>header,
body.bn-focus-open>main,
body.bn-focus-open>footer {
  filter: blur(10px) saturate(115%);
  transform: scale(.992);
}

.bn-focus {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .34s var(--ease-out), visibility 0s linear .34s;
}

.bn-focus.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .34s var(--ease-out), visibility 0s;
}

.bn-focus-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(254, 153, 0, .12), rgba(1, 11, 19, .88) 72%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.bn-focus-close {
  position: absolute;
  top: -54px;
  right: 0;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--accent);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  cursor: pointer;
  transition: transform .25s var(--ease-spring), color .2s, background .2s;
}

.bn-focus-close:hover {
  color: var(--accent-hover);
  transform: rotate(90deg) scale(1.06);
}

.bn-focus-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 38px;
  width: 100%;
  max-width: 900px;
  perspective: 1200px;
}

.bn-focus-cover {
  flex: 0 0 auto;
  height: min(58vh, 500px);
  width: auto;
  aspect-ratio: 140 / 192;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  background: var(--bg-surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), 0 0 0 1px rgba(254, 153, 0, .18);
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
}

.bn-focus-info {
  flex: 1 1 300px;
  min-width: 0;
  text-align: left;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}

.bn-focus.is-revealed .bn-focus-info {
  opacity: 1;
  transform: none;
}

.bn-focus-title {
  color: var(--book-title-color);
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 16px;
}

.bn-focus-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.bn-focus-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: .86rem;
  color: var(--text-2);
}

.bn-focus-meta-item strong {
  color: var(--text-1);
}

.bn-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.bn-focus-notice {
  display: none;
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange-text);
  background: var(--bg-elevated);
  color: var(--text-2);
  font-size: .9rem;
  text-align: left;
}

.bn-focus-notice.is-shown {
  display: block;
}

.bn-focus-read {
  animation: bnFocusPulse 2.4s ease-in-out .2s infinite;
}

@keyframes bnFocusPulse {

  0%,
  100% {
    box-shadow: 0 4px 14px var(--accent-glow);
  }

  50% {
    box-shadow: 0 6px 26px rgba(254, 153, 0, .6);
  }
}

@media (max-width: 760px) {
  .bn-focus {
    padding: 16px;
    overflow-y: auto;
  }

  .bn-focus-stage {
    flex-direction: column;
    gap: 22px;
    text-align: center;
  }

  .bn-focus-cover {
    height: min(42vh, 340px);
  }

  .bn-focus-info {
    text-align: center;
  }

  .bn-focus-meta,
  .bn-focus-actions {
    justify-content: center;
  }
}

/* ==========================================================================
   INDEX PAGE SECTIONS: Why Choose Us, FAQs, Final CTA
   ========================================================================== */

.section-why,
.section-faq,
.section-cta {
  padding: 64px 24px;
}

.section-why {
  background: transparent;
}

.section-faq {
  background: var(--bg);
}

.section-cta {
  background: transparent;
  text-align: center;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--text-1);
  text-align: center;
  margin-bottom: 40px;
  letter-spacing: -0.02em;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}



/* ==========================================================================
   Why Choose, FAQs & CTA Sections
   ========================================================================== */

/* Section header block */
.section-header-block {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 48px;
}

.section-badge-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(254, 153, 0, 0.1);
  border: 1px solid rgba(254, 153, 0, 0.25);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 14px;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0;
  margin-top: -28px;
}

[data-theme="light"] .section-subtitle {
  color: #475569;
}

/* Why grid */
.why-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1024px) {
  .why-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .why-grid {
    grid-template-columns: 1fr;
  }
}

/* Section background layers */
.section-why {
  position: relative;
}

.section-why-bg {
  position: absolute;
  inset: 0;
  background-image: url('../img/books-bg-pattern.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.04;
  z-index: 0;
  pointer-events: none;
}

.section-why .container {
  position: relative;
  z-index: 1;
}

.section-faq {
  position: relative;
}

.section-faq-bg {
  display: none;
}

.section-faq .container {
  position: relative;
  z-index: 1;
}

/* Why Choose Cards (image + icon) */
.why-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out), border-color 0.28s;
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .why-card {
  background: #ffffff;
  border-color: rgba(254, 153, 0, 0.22);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.why-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28), 0 0 16px rgba(254, 153, 0, 0.2);
}

/* Why card icon layout */
.why-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.why-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(254, 153, 0, 0.1);
  border: 1px solid rgba(254, 153, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 14px;
}

.why-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
}

.why-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
  color: var(--text-1);
}

[data-theme="dark"] .why-card h3 {
  color: #ffffff;
}

[data-theme="light"] .why-card h3 {
  color: #0f172a;
}

.why-card p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 16px;
  flex: 1;
}

[data-theme="light"] .why-card p {
  color: #475569;
}

.why-card-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(254, 153, 0, 0.1);
  border: 1px solid rgba(254, 153, 0, 0.2);
  border-radius: 4px;
  padding: 3px 8px;
  margin-top: auto;
}

.why-card-media {
  width: 100%;
  height: 140px;
  position: relative;
  overflow: hidden;
  background: #010B13;
}

.why-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
  display: block;
}

.why-card:hover .why-card-thumb {
  transform: scale(1.06);
}

.why-card-step {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  background: rgba(1, 11, 19, 0.85);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-hi);
  backdrop-filter: blur(4px);
  z-index: 2;
}

.why-card-content {
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.why-card-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--book-title-color);
  margin-bottom: 10px;
  line-height: 1.35;
}

[data-theme="dark"] .why-card-content h3 {
  color: #ffffff;
}

[data-theme="light"] .why-card-content h3 {
  color: #0f172a;
}

.why-card-content p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 18px 0;
  flex: 1;
}

[data-theme="light"] .why-card-content p {
  color: #475569;
}

/* FAQ accordion list */
.faq-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

[data-theme="light"] .faq-item {
  background: #ffffff;
  border-color: rgba(254, 153, 0, 0.18);
}

.faq-item[open] {
  border-color: var(--accent);
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-question-text {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.4;
  flex: 1;
}

[data-theme="light"] .faq-question-text {
  color: #0f172a;
}

.faq-chevron {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 20px 18px;
}

.faq-answer p {
  font-size: 0.91rem;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0;
}

[data-theme="light"] .faq-answer p {
  color: #475569;
}

/* CTA banner */
.cta-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

[data-theme="dark"] .cta-title {
  color: #ffffff;
}

[data-theme="light"] .cta-title {
  color: #0f172a;
}

.cta-description {
  font-size: 1rem;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto 32px;
}

[data-theme="light"] .cta-description {
  color: #475569;
}

.cta-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.cta-btn:hover {
  transform: translateY(-2px);
}

.cta-btn-primary {
  background: var(--accent);
  color: #010B13;
  box-shadow: 0 4px 16px rgba(254, 153, 0, 0.35);
}

.cta-btn-primary:hover {
  background: #ffaa1a;
  box-shadow: 0 8px 24px rgba(254, 153, 0, 0.5);
}

.cta-btn-secondary {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-hi);
}

[data-theme="dark"] .cta-btn-secondary {
  color: #ffffff;
}

[data-theme="light"] .cta-btn-secondary {
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.2);
}

.cta-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cta-features-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.cta-feature-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  color: var(--text-2);
  font-weight: 500;
}

[data-theme="light"] .cta-feature-pill {
  color: #475569;
}

.cta-feature-pill svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  flex-shrink: 0;
}

/* FAQ 2-Column Layout with Visual Banner */
.faq-layout-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

.faq-media-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-md);
  height: 420px;
  background: #010B13;
}

.faq-media-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.faq-media-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(1, 11, 19, 0.2) 0%, rgba(1, 11, 19, 0.92) 80%);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.faq-media-tag {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: #010B13;
  margin-bottom: 12px;
}

.faq-media-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.3;
}

.faq-media-desc {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.55;
  margin: 0;
}

/* CTA Hero Banner with Background Image */
.cta-banner-card {
  position: relative;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 64px 40px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 28px rgba(254, 153, 0, 0.2);
  overflow: hidden;
  background: #010B13;
}

.cta-banner-bg-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.cta-banner-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.22;
  filter: blur(1px);
}

[data-theme="light"] .cta-banner-bg-img {
  opacity: 0.12;
}

.cta-banner-gradient-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(1, 11, 19, 0.6) 0%, rgba(1, 11, 19, 0.95) 100%);
}

[data-theme="light"] .cta-banner-gradient-overlay {
  background: radial-gradient(circle at center, rgba(255, 252, 245, 0.75) 0%, rgba(255, 252, 245, 0.96) 100%);
}

.cta-content-wrapper {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
}

/* Responsive adjustments for layout */
@media (max-width: 900px) {
  .faq-layout-grid {
    grid-template-columns: 1fr;
  }

  .faq-media-card {
    height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .bn-focus-read {
    animation: none;
  }
}
