/* ==========================================================================
   REGINA MAHARANI RAHMAN — THEME STYLESHEET
   Aesthetics: Modern Literary, Minimalist, Warm Parchment & Rich Typography
   ========================================================================== */

:root {
  --bg-primary: #fbf9f5;
  --bg-secondary: #f4ede2;
  --bg-card: #ffffff;
  --bg-hover: #ede3d3;
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #8c827a;
  --border-color: #e7dfd3;
  --border-light: #f0eae1;
  --accent-terracotta: #b94a30;
  --accent-terracotta-hover: #9e3d26;
  --accent-gold: #b38338;
  --accent-gold-light: #fdf6eb;
  --accent-ink: #292524;
  --shadow-subtle: 0 4px 20px -2px rgba(28, 25, 23, 0.05);
  --shadow-card: 0 10px 30px -4px rgba(28, 25, 23, 0.08);
  --font-serif: 'Lora', 'Merriweather', Georgia, serif;
  --font-display: 'Playfair Display', 'Cinzel', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --reader-font-size: 1.125rem;
  --reader-line-height: 1.9;
  --reader-max-width: 720px;
}

[data-theme="dark"] {
  --bg-primary: #141312;
  --bg-secondary: #1d1b19;
  --bg-card: #242220;
  --bg-hover: #2e2b28;
  --text-primary: #f5f2eb;
  --text-secondary: #c5beba;
  --text-muted: #8c837d;
  --border-color: #33302c;
  --border-light: #282522;
  --accent-terracotta: #e06d53;
  --accent-terracotta-hover: #ea856e;
  --accent-gold: #d4a75e;
  --accent-gold-light: #2a2318;
  --accent-ink: #f5f2eb;
  --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 10px 30px -4px rgba(0, 0, 0, 0.6);
}

[data-theme="sepia"] {
  --bg-primary: #f4ecd8;
  --bg-secondary: #e8dcbf;
  --bg-card: #f9f3e4;
  --bg-hover: #ded1af;
  --text-primary: #433422;
  --text-secondary: #6e583f;
  --text-muted: #957d60;
  --border-color: #d8c8a5;
  --border-light: #e4d7b9;
  --accent-terracotta: #a34827;
  --accent-terracotta-hover: #88391b;
  --accent-gold: #9e7529;
  --accent-gold-light: #ece0c6;
  --accent-ink: #433422;
}

/* Base resets & typography */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-top: 0;
}

p {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

/* Container */
.site-container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Header & Navigation */
.header-glass {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(251, 249, 245, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
[data-theme="dark"] .header-glass {
  background-color: rgba(20, 19, 18, 0.92);
}
[data-theme="sepia"] .header-glass {
  background-color: rgba(244, 236, 216, 0.92);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.brand-subtitle {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-link {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  position: relative;
  transition: color 0.2s ease;
}
.nav-link:hover, .nav-link.active {
  color: var(--accent-terracotta);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0.75rem;
  right: 0.75rem;
  height: 2px;
  background-color: var(--accent-terracotta);
  border-radius: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.35rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary {
  background-color: var(--accent-terracotta);
  color: #ffffff !important;
}
.btn-primary:hover {
  background-color: var(--accent-terracotta-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(185, 74, 48, 0.3);
}
.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-secondary);
}
.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--bg-hover);
}
.btn-gold {
  background-color: var(--accent-gold);
  color: #ffffff !important;
}
.btn-gold:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Reading Typography & Format */
.literary-content {
  font-family: var(--font-serif);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  color: var(--text-primary);
  max-width: var(--reader-max-width);
  margin-left: auto;
  margin-right: auto;
}
.literary-content p {
  margin-bottom: 1.6em;
  text-align: justify;
}
.literary-content p.first-para::first-letter,
.first-letter-drop::first-letter {
  font-family: var(--font-display);
  font-size: 3.6em;
  float: left;
  line-height: 0.8;
  margin-right: 0.15em;
  margin-top: 0.08em;
  color: var(--accent-terracotta);
  font-weight: 700;
}
.literary-content blockquote {
  border-left: 3px solid var(--accent-gold);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--text-secondary);
  background-color: var(--accent-gold-light);
  padding-top: 1rem;
  padding-bottom: 1rem;
  padding-right: 1.25rem;
  border-radius: 0 8px 8px 0;
}
.literary-content hr {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 2.5rem auto;
  width: 40%;
  position: relative;
}
.literary-content hr::before {
  content: '✦  ✦  ✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--bg-primary);
  padding: 0 0.8rem;
  color: var(--accent-gold);
  font-size: 0.75rem;
  letter-spacing: 0.2rem;
}

/* Reading Progress Bar */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  background: linear-gradient(90deg, var(--accent-terracotta), var(--accent-gold));
  z-index: 60;
  width: 0%;
  transition: width 0.1s ease-out;
}

/* Book Card & Glow */
.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card);
  border-color: var(--accent-gold);
}
.book-cover-wrapper {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background-color: var(--bg-secondary);
}
.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.book-card:hover .book-cover-img {
  transform: scale(1.04);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}
.badge-terracotta {
  background-color: rgba(185, 74, 48, 0.12);
  color: var(--accent-terracotta);
}
.badge-gold {
  background-color: rgba(179, 131, 56, 0.15);
  color: var(--accent-gold);
}
.badge-dark {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Sidebar Styling */
.sidebar-sticky {
  position: sticky;
  top: 5.5rem;
}
.sidebar-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-subtle);
}
.sidebar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
  transition: transform 0.2s ease;
}
.sidebar-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.sidebar-item:hover {
  transform: translateX(3px);
}
.sidebar-num {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1;
  min-width: 1.5rem;
}

/* Interactive Floating / Reader Bar */
.reader-controls-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  box-shadow: var(--shadow-subtle);
}

/* Heart Like Button Animation */
.like-btn.liked svg {
  fill: #e11d48;
  stroke: #e11d48;
  animation: pulse-heart 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pulse-heart {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Modal styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}
.modal-backdrop.active .modal-content {
  transform: scale(1);
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--accent-ink);
  color: var(--bg-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  z-index: 110;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
