:root {
  --bg-gradient-from: #111111;
  --bg-gradient-to: #1b1b1b;
  --card-bg: #222222;
  --card-border: rgba(255, 255, 255, 0.06);
  --accent: #ffc300;
  --accent-soft: rgba(255, 195, 0, 0.18);
  --accent-strong: #ffc300;
  --text-main: #f0f0f0;
  --text-muted: #c0c0c0;
  --text-soft: #a0a0a0;
  --accent-pink: #ffe680;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.75);
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 999px;
  --transition-fast: 0.18s ease-out;
  --transition-med: 0.24s ease-out;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at top, #2a2a2a 0, transparent 55%),
    radial-gradient(circle at bottom, #111111 0, transparent 55%),
    linear-gradient(135deg, var(--bg-gradient-from), var(--bg-gradient-to));
}

body.no-scroll {
  overflow: hidden;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(34, 34, 34, 0.98), rgba(27, 27, 27, 0.96));
  backdrop-filter: blur(18px);
  transition: opacity var(--transition-med), visibility var(--transition-med);
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader-inner {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-full);
  background: rgba(20, 20, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

.loader-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(255, 195, 0, 0.4);
  animation: loader-bounce 0.9s infinite alternate;
}

.loader-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.loader-dot:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes loader-bounce {
  0% {
    transform: translateY(0);
    opacity: 0.6;
  }
  100% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(20, 20, 20, 0.98), rgba(20, 20, 20, 0.9), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 0.85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.profile-image {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-strong);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-image:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-text {
  margin-left: 0.5rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.theme-label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
}

.theme-name {
  font-weight: 600;
  color: var(--accent-strong);
}

.theme-toggle-button {
  position: relative;
  width: 46px;
  height: 22px;
  border-radius: var(--radius-full);
  padding: 0;
  border-width: 1px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 0;
}

.theme-toggle-button::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffc300;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  transform: translateX(2px);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

body.theme-light .theme-toggle-button {
  justify-content: flex-end;
}

body.theme-light .theme-toggle-button::before {
  transform: translateX(-2px);
  background: #222222;
}

.main-content {
  flex: 1;
}

.intro {
  padding-top: 1.5rem;
  padding-bottom: 0.25rem;
}

.intro h2 {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
}

.intro p {
  margin: 0;
  color: var(--text-muted);
  max-width: 540px;
}

.books-section {
  margin-top: 1.75rem;
}

.section-header h3 {
  margin: 0;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-soft);
}

.section-header p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  max-width: 620px;
}

.books-grid {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem;
}

.book-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  max-height: 400px;
  min-width: 0;
}

.book-card.landscape {
  max-height: 300px;
  grid-column: span 2;
}


.book-cover {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--bg-secondary);
  padding: 0.5rem;
  box-sizing: border-box;
  max-height: 90%;
}

.book-cover img {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  object-position: top;
}

.book-overlay {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

.book-info {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--card-border);
  background: var(--card-bg);
  flex-shrink: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.book-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  max-height: 2.4em;
  width: 100%;
  white-space: normal;
  word-break: break-word;
}

/* Hover effects */
.book-card:hover .book-cover img {
  transform: scale(1.03);
}


/* Responsive adjustments */
@media (max-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }
  
  .book-card {
    max-height: 300px;
  }
  
  .book-card.landscape {
    grid-column: span 1;
    max-height: 200px;
  }
  
  .book-title {
    font-size: 0.85rem;
    line-height: 1.1;
  }
}

.book-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(255, 195, 0, 0.9);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.book-card:hover::before {
  opacity: 1;
}

.book-thumb {
  position: relative;
  padding-top: 135%;
  overflow: hidden;
}

.book-card--landscape .book-thumb {
  padding-top: 135%;
}

.book-card--portrait .book-thumb {
  padding-top: 135%;
}

.book-card--landscape .book-thumb img {
  object-fit: contain;
  background: radial-gradient(circle at center, #222222, #1b1b1b 60%, #1b1b1b 100%);
}

.book-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  transition: transform var(--transition-med);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.book-card:hover .book-thumb img {
  transform: scale(1.04);
}

.book-thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent);
  z-index: 0;
}

.book-pages-pill {
  position: absolute;
  bottom: 0.9rem;
  left: 0.95rem;
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #ffc300, #ffffff);
  color: #0b1220;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
  z-index: 1;
}

.book-info {
  padding: 0.6rem 0.8rem;
  border-top: 1px solid var(--card-border);
  background: var(--card-bg);
  flex-shrink: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.book-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  max-height: 2.4em;
  width: 100%;
  white-space: normal;
  word-break: break-word;
}

.site-footer {
  padding-top: 0.5rem;
  padding-bottom: 2rem;
}

.footer-text {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.lightbox.hidden {
  opacity: 0;
  pointer-events: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 195, 0, 0.12), transparent 55%),
    radial-gradient(circle at bottom, rgba(0, 0, 0, 0.75), transparent 60%),
    rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(28px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  max-height: 94vh;
  border-radius: 26px;
  background: radial-gradient(circle at top left, rgba(255, 195, 0, 0.16), transparent 55%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.03), transparent 55%),
    rgba(15, 15, 15, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9);
  padding: 1.25rem 1.35rem 1.1rem;
  display: flex;
  flex-direction: column;
}

.lightbox-close {
  position: absolute;
  top: 0.85rem;
  right: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: radial-gradient(circle at top, rgba(240, 240, 240, 0.85), rgba(34, 34, 34, 0.98));
  color: var(--text-main);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  transition: background var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.lightbox-close:hover {
  transform: translateY(-1px);
  background: radial-gradient(circle at top, #ffc300, #222222);
  color: #111111;
  border-color: rgba(255, 195, 0, 0.9);
}

.lightbox-header {
  padding-right: 2.5rem;
}

.lightbox-title {
  margin: 0;
  font-size: 1.15rem;
}

.lightbox-meta {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

#lightboxPageIndicator {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.65rem;
  border-radius: var(--radius-full);
  background: radial-gradient(circle at top, rgba(34, 34, 34, 0.9), rgba(27, 27, 27, 0.98));
  border: 1px solid rgba(255, 195, 0, 0.9);
  color: #f0f0f0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lightbox-body {
  margin-top: 1rem;
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.6rem;
}

.lightbox-image-wrapper {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: radial-gradient(circle at top, #222222, #1b1b1b);
  border: 1px solid rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: min(60vh, 720px);
  margin-inline: auto;
  padding: 0.75rem;
}

.lightbox-image-wrapper.portrait {
  max-width: 68%;
  max-height: 58vh;
}

.lightbox-image-wrapper.landscape {
  max-width: 92%;
  max-height: min(50vh, 520px);
}

.lightbox-image-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, rgba(255, 195, 0, 0.2), rgba(255, 195, 0, 0), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity var(--transition-med);
}

.lightbox-dialog:hover .lightbox-image-wrapper::before {
  opacity: 1;
}

#lightboxImage {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: radial-gradient(circle at center, #222222 0, #1b1b1b 55%, #1b1b1b 100%);
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

#lightboxImage.visible {
  opacity: 1;
}

.lightbox-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.lightbox-spinner.active {
  opacity: 1;
}

.spinner-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent-strong);
  border-right-color: #ffffff;
  animation: spinner-rotate 0.9s linear infinite;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.9);
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.nav-button {
  align-self: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 20, 20, 0.95);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.65);
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.nav-button:hover {
  transform: translateY(-1px) scale(1.02);
  background: rgba(255, 195, 0, 0.18);
  border-color: rgba(255, 195, 0, 0.8);
}

.lightbox-footer {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  background: linear-gradient(135deg, #ffc300, #ffe680);
  color: #111111;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.primary-button:hover {
  filter: brightness(1.07);
}

.secondary-button {
  background: rgba(25, 25, 25, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text-main);
}

.secondary-button:hover {
  background: rgba(255, 195, 0, 0.18);
}

.lightbox-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.4rem;
}

.zoom-button {
  padding: 0.32rem 0.6rem;
  font-size: 0.72rem;
}

.theme-toggle-button {
  position: relative;
  width: 46px;
  height: 22px;
  border-radius: 12px;
  padding: 0;
  border: 1px solid rgba(255, 195, 0, 0.4);
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  transition: background 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  font-size: 0;
}

.theme-toggle-button::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffc300;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  transform: translateX(2px);
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
  will-change: transform, background;
}

body.theme-light .theme-toggle-button {
  background: rgba(34, 34, 34, 0.1);
  border-color: rgba(34, 34, 34, 0.4);
  justify-content: flex-end;
}

body.theme-light .theme-toggle-button::before {
  transform: translateX(-2px);
  background: #222222;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(34, 34, 34, 0.8);
}

/* Light theme overrides */

body.theme-light {
  color: #222222;
  background: radial-gradient(circle at top, #ffffff 0, transparent 55%),
    radial-gradient(circle at bottom, #f3f3f3 0, transparent 55%),
    linear-gradient(135deg, #ffffff, #f5f5f5);
}

.theme-light .site-header {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.9), transparent);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.theme-light .brand-text p {
  color: #555555;
}

.theme-light .books-section .section-header h3,
.theme-light .books-section .section-header p,
.theme-light .intro p,
.theme-light .footer-text {
  color: #555555;
}

.theme-light .book-card {
  background: radial-gradient(circle at top left, rgba(255, 195, 0, 0.14), transparent 55%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.02), transparent 60%),
    #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

.theme-light .book-thumb::after {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.24), transparent);
}

.theme-light .site-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.theme-light .lightbox-backdrop {
  background: radial-gradient(circle at top, rgba(255, 195, 0, 0.08), transparent 55%),
    radial-gradient(circle at bottom, rgba(0, 0, 0, 0.18), transparent 60%),
    rgba(255, 255, 255, 0.96);
}

.theme-light .lightbox-dialog {
  background: radial-gradient(circle at top left, rgba(255, 195, 0, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.02), transparent 55%),
    #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.theme-light .lightbox-close {
  border-color: rgba(0, 0, 0, 0.2);
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(245, 245, 245, 0.95));
  color: #222222;
}

.theme-light .lightbox-close:hover {
  background: radial-gradient(circle at top, #ffc300, #ffffff);
  color: #222222;
  border-color: rgba(255, 195, 0, 0.9);
}

.theme-light .nav-button {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.18);
  color: #222222;
}

.theme-light .nav-button:hover {
  background: rgba(255, 195, 0, 0.16);
  border-color: rgba(255, 195, 0, 0.9);
}

.theme-light .secondary-button {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.18);
  color: #222222;
}

.theme-light .secondary-button:hover {
  background: rgba(255, 195, 0, 0.16);
}

.theme-light .lightbox-hint {
  color: #666666;
}

.theme-light .lightbox-image-wrapper {
  border-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 900px) {
  .lightbox-dialog {
    padding-inline: 1rem;
  }

  .lightbox-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .nav-button {
    width: 34px;
    height: 34px;
  }

  .lightbox-body .nav-button.prev {
    order: 2;
  }

  .lightbox-body .nav-button.next {
    order: 3;
  }

  .lightbox-image-wrapper {
    order: 1;
    max-height: min(70vh, 520px);
    max-width: 100%;
  }

  .lightbox-image-wrapper.landscape {
    max-height: min(60vh, 420px);
  }

  .lightbox-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .container {
    padding-inline: 1rem;
  }

  .books-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.1rem;
  }

  .brand-text h1 {
    font-size: 1.15rem;
  }

  .intro h2 {
    font-size: 1.3rem;
  }

  .lightbox-dialog {
    padding: 1rem 0.9rem 0.9rem;
  }

  .lightbox-title {
    font-size: 1.02rem;
  }

  .lightbox-hint {
    font-size: 0.7rem;
  }
}
