/* -------------------------------------------------------------
 * FIRST DIALOGUE - CORE DESIGN SYSTEM & STYLESHEET
 * ------------------------------------------------------------- */

/* Root Variables - Design Tokens */
:root {
  /* Color Presets (Defaults match original site) */
  --color-accent: #c61947;
  --color-accent-hover: #a31238;
  --color-sepia-bg: #f7e0c5;
  --color-sepia-text: #110c08;
  --color-sepia-meta: #705232;
  --color-sepia-border: #e9bb8a;
  
  /* Full Sepia Card/Widget background (slightly lighter than sepia bg) */
  --color-sepia-card: rgba(255, 255, 255, 0.42);
  --color-sepia-card-hover: rgba(255, 255, 255, 0.75);

  /* Reader Defaults (Controlled dynamically by JS) */
  --reader-bg: var(--color-sepia-bg);
  --reader-text: var(--color-sepia-text);
  
  /* Font Stacks */
  --font-serif-georgia: 'Georgia', serif;
  --font-serif-merriweather: 'Merriweather', serif;
  --font-serif-playfair: 'Playfair Display', serif;
  --font-serif-garamond: 'EB Garamond', 'Garamond', serif;
  --font-serif-lora: 'Lora', serif;
  --font-serif-bitter: 'Bitter', serif;
  --font-sans-inter: 'Inter', system-ui, -apple-system, sans-serif;
  --font-sans-roboto: 'Roboto', sans-serif;
  
  /* General Layout Variables */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --box-shadow-light: 0 4px 6px -1px rgba(112, 82, 50, 0.05), 0 2px 4px -1px rgba(112, 82, 50, 0.03);
  --box-shadow-medium: 0 10px 15px -3px rgba(112, 82, 50, 0.08), 0 4px 6px -2px rgba(112, 82, 50, 0.04);
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 24px;
}

/* Reset and Global Elements */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 18px; /* Increased from 16px for larger desktop text */
}

body {
  font-family: var(--font-sans-inter);
  background-color: var(--color-sepia-bg);
  color: var(--color-sepia-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.4s ease, color 0.4s ease;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition-smooth);
}

a:hover {
  color: var(--color-accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-sm);
}

/* Scroll Progress Bar */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background-color: var(--color-accent);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease;
}

/* -------------------------------------------------------------
 * COMPONENT: HEADER NAVIGATION (DESKTOP)
 * ------------------------------------------------------------- */
.site-header {
  background-color: rgba(247, 224, 197, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-sepia-border);
  position: sticky;
  top: 0;
  z-index: 500;
  padding: 1rem 2rem;
  transition: var(--transition-smooth);
}

/* Adapt header in dark reader themes */
body[style*="--reader-bg: #0f1419"] .site-header,
body[style*="--reader-bg:#0f1419"] .site-header,
body[style*="--reader-bg: #2a2f35"] .site-header,
body[style*="--reader-bg:#2a2f35"] .site-header {
  background-color: rgba(21, 27, 34, 0.95);
  border-bottom-color: #38444d;
}
body[style*="--reader-bg: #0f1419"] .site-logo,
body[style*="--reader-bg: #2a2f35"] .site-logo {
  color: #ffffff;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--color-sepia-text);
}

.logo-circle {
  width: 38px;
  height: 38px;
  background-color: #000000;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: var(--box-shadow-light);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav a {
  color: var(--color-sepia-text);
  font-weight: 600;
  font-size: 0.95rem;
}

body[style*="--reader-bg: #0f1419"] .site-nav a,
body[style*="--reader-bg: #2a2f35"] .site-nav a {
  color: #e2e8f0;
}

.site-nav a:hover, .site-nav a.active {
  color: var(--color-accent);
}

.nav-btn {
  padding: 0.4rem 0.9rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
}

.admin-btn {
  background-color: var(--color-accent);
  color: #ffffff !important;
}

.admin-btn:hover {
  background-color: var(--color-accent-hover);
}

.logout-btn {
  border: 1px solid var(--color-sepia-border);
}

.nav-link-admin {
  opacity: 0.5;
  font-size: 0.85rem;
}

/* -------------------------------------------------------------
 * COMPONENT: MOBILE BOTTOM NAVIGATION STICKY TAB-BAR
 * ------------------------------------------------------------- */
.mobile-bottom-nav {
  display: none; /* Hidden on desktop */
}

/* -------------------------------------------------------------
 * PAGE: HOMEPAGE (DIRECTORY)
 * ------------------------------------------------------------- */
.home-hero {
  max-width: 1200px;
  margin: 0.5rem auto 1rem;
  padding: 0 1.5rem;
  text-align: center;
}

.hero-title {
  font-family: var(--font-serif-playfair);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.hero-subtitle {
  color: var(--color-sepia-meta);
  font-size: 1.25rem;
  margin-bottom: 2rem;
}

/* Search and Filter Bar */
.search-filter-bar {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  background: rgba(112, 82, 50, 0.05);
  padding: 0.5rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-sepia-border);
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-sepia-border);
  background-color: var(--color-sepia-bg);
  color: var(--color-sepia-text);
  border-radius: var(--border-radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.search-input:focus {
  border-color: var(--color-accent);
  background-color: rgba(255, 255, 255, 0.3);
}

.category-select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-sepia-border);
  background-color: var(--color-sepia-bg);
  color: var(--color-sepia-text);
  border-radius: var(--border-radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* Featured Section Grid (Top Section) */
.featured-sections-grid {
  max-width: 1200px;
  margin: 2rem auto 2.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.featured-card {
  background-color: var(--color-sepia-card);
  border: 1px solid var(--color-sepia-border);
  border-radius: var(--border-radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  transition: var(--transition-smooth);
}

.featured-card:hover {
  background-color: var(--color-sepia-card-hover);
  transform: translateY(-2px);
}

.featured-badge-label {
  display: inline-block;
  align-self: flex-start;
  background-color: var(--color-accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.featured-title {
  font-family: var(--font-serif-playfair);
  font-size: 1.85rem;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.featured-title a {
  color: var(--color-sepia-text);
}

.featured-title a:hover {
  color: var(--color-accent);
}

.featured-excerpt {
  color: var(--color-sepia-meta);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border-top: 1px solid rgba(112, 82, 50, 0.1);
  padding-top: 1rem;
}

.featured-date {
  color: var(--color-sepia-meta);
  font-weight: 600;
}

.featured-read-link {
  font-weight: 700;
}

/* Category Highlights Section */
.category-highlights-section {
  max-width: 1200px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
}

.highlights-heading {
  font-family: var(--font-serif-playfair);
  font-size: 1.5rem;
  border-bottom: 1px solid var(--color-sepia-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.category-highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.cat-highlight-card {
  background-color: var(--color-sepia-card);
  border: 1px solid var(--color-sepia-border);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-smooth);
}

.cat-highlight-card:hover {
  background-color: var(--color-sepia-card-hover);
  transform: translateY(-1px);
}

.cat-highlight-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.cat-highlight-title {
  font-family: var(--font-serif-playfair);
  font-size: 1.15rem;
  line-height: 1.3;
  margin-bottom: 1rem;
}

.cat-highlight-title a {
  color: var(--color-sepia-text);
}

.cat-highlight-title a:hover {
  color: var(--color-accent);
}

.cat-highlight-date {
  font-size: 0.8rem;
  color: var(--color-sepia-meta);
}

/* Main Split for All Essays */
.home-content-layout {
  max-width: 1200px;
  margin: 0 auto 5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 3rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-sepia-border);
  padding-bottom: 0.5rem;
}

.section-header h2 {
  font-family: var(--font-serif-playfair);
  font-size: 1.75rem;
}

.posts-count {
  color: var(--color-sepia-meta);
  font-size: 0.9rem;
}

.posts-grid {
  display: flex;
  flex-direction: column;
}

/* Clean text link row styling for general list (NO white cards) */
.essay-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0.5rem;
  border-bottom: 1px solid rgba(112, 82, 50, 0.15);
  transition: var(--transition-smooth);
}

.essay-list-row:hover {
  background-color: rgba(112, 82, 50, 0.03);
  padding-left: 0.75rem;
}

.essay-row-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.essay-row-date {
  font-size: 0.85rem;
  color: var(--color-sepia-meta);
  font-family: monospace;
  white-space: nowrap;
}

.essay-row-title {
  font-family: var(--font-serif-playfair);
  font-size: 1.35rem;
  line-height: 1.3;
}

.essay-row-title a {
  color: var(--color-sepia-text);
}

.essay-row-title a:hover {
  color: var(--color-accent);
}

.essay-row-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.essay-row-category {
  background-color: rgba(112, 82, 50, 0.08);
  color: var(--color-sepia-meta);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.read-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.unread-label {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--color-sepia-meta);
}

.completed-label {
  background-color: rgba(4, 120, 87, 0.1);
  color: #047857;
}

/* Sidebar Widgets (Full Sepia background, no white) */
.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-widget {
  background-color: var(--color-sepia-card);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-sepia-border);
}

.sidebar-widget h3 {
  font-family: var(--font-serif-playfair);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-sepia-border);
  padding-bottom: 0.5rem;
}

.progress-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.progress-bar-container {
  height: 8px;
  background-color: rgba(112, 82, 50, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--color-accent);
  transition: width 0.5s ease-out;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--color-sepia-meta);
}

/* Playlists Styles */
.playlist-section {
  margin-bottom: 1.5rem;
}

.playlist-section:last-child {
  margin-bottom: 0;
}

.playlist-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-sepia-meta);
}

.playlist-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-card {
  padding: 0.75rem;
  border-radius: var(--border-radius-sm);
  background-color: rgba(112, 82, 50, 0.02);
  border: 1px solid rgba(112, 82, 50, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-smooth);
}

.playlist-card:hover {
  background-color: rgba(112, 82, 50, 0.06);
  border-color: var(--color-sepia-border);
}

.playlist-card-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  background: rgba(198, 25, 71, 0.08);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.playlist-card-title {
  font-size: 0.85rem;
  color: var(--color-sepia-text);
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-card-badge {
  font-size: 0.7rem;
  color: var(--color-sepia-meta);
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.playlist-card-badge.p-completed {
  background-color: rgba(4, 120, 87, 0.1);
  color: #047857;
}

/* -------------------------------------------------------------
 * PAGE: ESSAY READER VIEW & ACCESSIBLE STYLING
 * ------------------------------------------------------------- */
.essay-reader-container {
  max-width: 1200px; /* Increased to 1200px to match FT.com layout */
  margin: 3rem auto 6rem;
  padding: 0 1.5rem;
  position: relative;
}

.page-essay {
  background-color: var(--reader-bg) !important;
  color: var(--reader-text) !important;
}

.essay-article {
  background: transparent;
  transition: font-size 0.2s ease, font-family 0.2s ease;
  font-size: 24px; /* Increased from 21px for bigger text on desktop */
}

/* Custom class selectors for typography sizes */
.font-serif-garamond { font-family: var(--font-serif-garamond) !important; }
.font-serif-lora { font-family: var(--font-serif-lora) !important; }
.font-serif-bitter { font-family: var(--font-serif-bitter) !important; }

.essay-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--color-sepia-border);
  padding-bottom: 2rem;
}

.essay-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.essay-date {
  font-weight: 600;
}

.essay-cat {
  background-color: rgba(198, 25, 71, 0.1);
  color: var(--color-accent);
  padding: 0.15rem 0.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.essay-playlist {
  background-color: rgba(112, 82, 50, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
}

.essay-title {
  font-family: var(--font-serif-playfair);
  font-size: 2.75rem;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}

.essay-author {
  font-size: 0.95rem;
  font-style: italic;
  opacity: 0.8;
}

.essay-body-content p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.essay-body-content h2 {
  font-family: var(--font-serif-playfair);
  font-size: 1.75em;
  margin: 2.5rem 0 1.25rem;
  line-height: 1.3;
}

.essay-body-content h3 {
  font-family: var(--font-serif-playfair);
  font-size: 1.4em;
  margin: 2rem 0 1rem;
  line-height: 1.3;
}

.essay-body-content blockquote {
  border-left: 4px solid var(--color-accent);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  opacity: 0.9;
}

.essay-body-content ul, .essay-body-content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.essay-body-content li {
  margin-bottom: 0.5rem;
}

/* Thumbs rating widgets */
.essay-article-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--color-sepia-border);
  padding-top: 1.5rem;
}

.rating-widgets-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.rating-widget {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(112, 82, 50, 0.08); /* Darker background */
  border: 1px solid var(--color-sepia-border);
  padding: 0.75rem;
  border-radius: var(--border-radius-md);
}

.rating-widget-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rating-stars {
  display: flex;
  gap: 0.25rem;
}

.star-btn {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.star-btn:hover, .star-btn.selected {
  color: #f59e0b;
}

.thumbs-btn {
  background: transparent;
  border: 1px solid var(--color-sepia-border);
  font-size: 1.2rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-sepia-text);
  transition: var(--transition-smooth);
}

.thumbs-btn:hover, .thumbs-btn.active {
  background-color: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.rating-status-text {
  font-size: 0.8rem;
  opacity: 0.8;
}

.navigation-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.back-link {
  font-weight: 600;
  font-size: 0.95rem;
}

.next-essay-promo {
  background-color: rgba(198, 25, 71, 0.03);
  border: 1px dashed var(--color-accent);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  max-width: 400px;
}

.next-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.next-title {
  font-family: var(--font-serif-playfair);
  font-size: 1.15rem;
  line-height: 1.3;
}

.next-title a {
  color: inherit;
}

/* -------------------------------------------------------------
 * COMPONENT: SETTINGS & INFO SIDE DRAWER CONTAINERS
 * ------------------------------------------------------------- */
.reader-settings-panel, .essay-info-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  height: 100dvh; /* dynamic viewport height to fill top-to-bottom on mobile Safari/Chrome */
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: var(--box-shadow-heavy);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.reader-settings-panel {
  width: 50%;
  max-width: 460px;
  right: -55vw;
  border-left: 1px solid var(--color-sepia-border);
}

.reader-settings-panel.open {
  right: 0;
}

.essay-info-drawer {
  width: 50%;
  max-width: 460px;
  left: -55vw;
  border-right: 1px solid var(--color-sepia-border);
}

.essay-info-drawer.open {
  left: 0;
}

/* Adapt side drawer backgrounds in dark reader themes */
body[style*="--reader-bg: #0f1419"] .reader-settings-panel,
body[style*="--reader-bg:#0f1419"] .reader-settings-panel,
body[style*="--reader-bg: #2a2f35"] .reader-settings-panel,
body[style*="--reader-bg:#2a2f35"] .reader-settings-panel,
body[style*="--reader-bg: #0f1419"] .essay-info-drawer,
body[style*="--reader-bg:#0f1419"] .essay-info-drawer,
body[style*="--reader-bg: #2a2f35"] .essay-info-drawer,
body[style*="--reader-bg:#2a2f35"] .essay-info-drawer {
  background-color: rgba(21, 27, 34, 0.98);
  border-color: #38444d;
  color: #e2e8f0;
}

/* Drawer Internal Structure */
.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-sepia-border);
  background: inherit;
}

.drawer-header h3, .drawer-header .settings-title {
  font-family: var(--font-serif-playfair);
  font-size: 1.4rem;
  margin: 0;
  padding: 0;
  border: none;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.drawer-footer {
  padding: 1rem 1.5rem calc(1rem + 72px) 1.5rem; /* Safe spacing to raise button by 3/4 inch from bottom menu overlap */
  border-top: 1px solid var(--color-sepia-border);
  background: inherit;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-group label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.settings-control {
  padding: 0.6rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-sepia-border);
  font-size: 0.95rem;
  background-color: #ffffff;
  outline: none;
}

.font-size-control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.font-slider {
  flex: 1;
  accent-color: var(--color-accent);
}

.font-number-input {
  width: 55px;
  padding: 0.4rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-sepia-border);
  text-align: center;
  font-size: 0.9rem;
}

.theme-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.theme-btn {
  padding: 0.6rem;
  border: 1px solid var(--color-sepia-border);
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.theme-sepia { background-color: #f7e0c5; color: #110c08; }
.theme-light { background-color: #ffffff; color: #111111; }
.theme-dim { background-color: #2a2f35; color: #e2e8f0; border-color: #38444d; }
.theme-dark { background-color: #0f1419; color: #f7f9fa; border-color: #38444d; }

.theme-btn.active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.color-pickers-row {
  display: flex;
  gap: 1rem;
}

.picker-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
  border-radius: var(--border-radius-sm);
}

.picker-item label {
  font-size: 0.75rem;
  margin: 0;
}

.picker-item input[type="color"] {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.intensity-slider {
  width: 100%;
  accent-color: var(--color-accent);
}

/* Floating Settings Button - Hidden since Settings are now in bottom sticky nav */
.floating-controls-btn {
  display: none !important;
}

/* Fixed Close Button for Drawers at the Bottom */
.drawer-close-bottom-btn {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background-color: #110c08; /* Dark grey/black */
  color: #ffffff; /* White font */
  border: 1px solid var(--color-sepia-border);
  border-radius: var(--border-radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-smooth);
}

.drawer-close-bottom-btn:hover {
  background-color: #2a2f35;
}

/* -------------------------------------------------------------
 * COMPONENT: CLICK-TO-DEFINE DICTIONARY POPUP BUBBLE
 * ------------------------------------------------------------- */
.dict-popup-bubble {
  position: absolute;
  background-color: #fcf1e3; /* Light sepia bubble */
  color: #110c08; /* Black text */
  padding: 0.85rem 1.25rem; /* larger padding */
  border-radius: var(--border-radius-sm);
  border: 1px solid #705232; /* Accent boundary border */
  font-size: 1.05rem; /* Larger font size */
  width: 280px; /* Locked width to prevent long skinny squishing */
  max-width: 280px;
  z-index: 9999;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%); /* Centering relative to mouse coordinate */
  animation: tooltipFadeIn 0.2s ease-out;
}

.dict-popup-bubble::after {
  content: "";
  position: absolute;
  top: -6px; /* Arrow pointing up at top of bubble */
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent #fcf1e3;
}

.dict-word {
  font-weight: 700;
  color: var(--color-accent); /* Crimson accent instead of cyan */
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1.25rem; /* Larger title font size */
}

.dict-definition {
  font-style: italic;
  font-size: 1.05rem; /* Larger definition text */
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translate(-50%, -5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.info-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(112, 82, 50, 0.1);
  font-size: 0.9rem;
}

.info-stat-label {
  font-weight: 700;
}

.ai-summary-block {
  margin-top: 0.75rem;
  background-color: rgba(198, 25, 71, 0.05);
  border: 1px dashed var(--color-accent);
  padding: 1rem;
  border-radius: var(--border-radius-md);
}

.ai-summary-heading {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.ai-summary-text {
  font-size: 1.05rem;
  font-style: normal;
  line-height: 1.5;
}

/* -------------------------------------------------------------
 * COMPONENT: SECURE COMMENTS SECTION
 * ------------------------------------------------------------- */
.comments-section {
  margin-top: 2rem;
  border-top: 1px solid var(--color-sepia-border);
  padding-top: 1.5rem;
}

.comments-section h3 {
  font-family: var(--font-serif-playfair);
  font-size: 1.65rem;
  margin-bottom: 1rem;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  background: rgba(112, 82, 50, 0.03);
  padding: 1rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-sepia-border);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.comment-card {
  padding: 1.25rem;
  background-color: rgba(112, 82, 50, 0.02);
  border: 1px solid rgba(112, 82, 50, 0.1);
  border-radius: var(--border-radius-md);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-sepia-meta);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.comment-author {
  color: var(--color-sepia-text);
  font-weight: 700;
}

/* -------------------------------------------------------------
 * PAGE: ADMIN / EDITOR CONSOLE
 * ------------------------------------------------------------- */
.admin-login-wrapper {
  max-width: 450px;
  margin: 8rem auto;
  padding: 0 1.5rem;
}

.login-card {
  background-color: var(--color-sepia-card);
  padding: 2.5rem;
  border-radius: var(--border-radius-md);
  box-shadow: var(--box-shadow-medium);
  border: 1px solid var(--color-sepia-border);
}

.login-card h2 {
  font-family: var(--font-serif-playfair);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--color-sepia-meta);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-input {
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-sepia-border);
  background-color: var(--color-sepia-bg);
  color: var(--color-sepia-text);
  font-size: 1rem;
  outline: none;
}

.submit-btn {
  background-color: var(--color-accent);
  color: #ffffff;
  border: none;
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.submit-btn:hover {
  background-color: var(--color-accent-hover);
}

.login-error-alert {
  background-color: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

/* Editor Workspace Styles */
.editor-page-wrapper {
  max-width: 1200px;
  margin: 2rem auto 5rem;
  padding: 0 1.5rem;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--color-sepia-border);
  padding-bottom: 1rem;
}

.editor-header h2 {
  font-family: var(--font-serif-playfair);
  font-size: 2.2rem;
}

.editor-grid-form {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 2rem;
}

.editor-main-panel {
  background: var(--color-sepia-card);
  padding: 2rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-sepia-border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.editor-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-block {
  background: var(--color-sepia-card);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-sepia-border);
}

.sidebar-block h3 {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-sepia-border);
  padding-bottom: 0.5rem;
  color: var(--color-sepia-meta);
}

.editor-input {
  padding: 0.65rem 0.85rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-sepia-border);
  background-color: var(--color-sepia-bg);
  color: var(--color-sepia-text);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.editor-input:focus {
  border-color: var(--color-accent);
}

.title-input {
  font-size: 1.5rem;
  font-weight: 700;
}

.textarea-control {
  resize: vertical;
  font-family: var(--font-sans-inter);
}

.paste-helper-banner {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.rich-paste-editor {
  flex: 1;
  min-height: 450px;
  background-color: var(--color-sepia-bg);
  border: 2px dashed var(--color-sepia-border);
  border-radius: var(--border-radius-sm);
  padding: 1.5rem;
  font-family: var(--font-serif-georgia);
  font-size: 1.1rem;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
}

.rich-paste-editor:focus {
  border-color: var(--color-accent);
}

.publish-btn {
  background-color: var(--color-accent);
  color: #ffffff;
  border: none;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.publish-btn:hover {
  background-color: var(--color-accent-hover);
}

.save-status-msg {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.success-alert { color: #059669; }
.error-alert { color: #dc2626; }

/* -------------------------------------------------------------
 * COMPONENT: FOOTER
 * ------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  background-color: var(--color-sepia-bg);
  color: var(--color-sepia-meta);
  padding: 3rem 2rem;
  border-top: 1px solid var(--color-sepia-border);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-sub {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  opacity: 0.6;
}

/* -------------------------------------------------------------
 * RESPONSIVENESS AND MOBILE BOTTOM NAV TRANSITION
 * ------------------------------------------------------------- */
@media (max-width: 968px) {
  .home-content-layout {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .featured-sections-grid {
    grid-template-columns: 1fr;
  }
  .editor-grid-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 16px !important; /* Keep standard size on mobile */
  }
  .essay-article {
    font-size: 20px; /* Keep mobile reading comfortable (overridden by custom size inline style) */
  }
  /* 1. Hide desktop header navigation completely */
  .site-header {
    display: none !important;
  }
  
  /* 2. Show bottom navigation sticky tab-bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 44px; /* Skinnier & narrower */
    background-color: rgba(247, 224, 197, 0.97);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--color-sepia-border);
    justify-content: space-around;
    align-items: center;
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -3px 12px rgba(112, 82, 50, 0.12);
  }
  
  /* Adjust colors of bottom nav drawer inside dark reader themes */
  body[style*="--reader-bg: #0f1419"] .mobile-bottom-nav,
  body[style*="--reader-bg:#0f1419"] .mobile-bottom-nav,
  body[style*="--reader-bg: #2a2f35"] .mobile-bottom-nav,
  body[style*="--reader-bg:#2a2f35"] .mobile-bottom-nav {
    background-color: rgba(21, 27, 34, 0.97);
    border-top-color: #38444d;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.3);
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-sepia-text);
    font-size: 0.65rem; /* Smaller font to fit */
    font-weight: 700;
    gap: 0.1rem; /* Smaller gap */
    flex: 1;
    height: 100%;
    transition: var(--transition-smooth);
  }
  
  body[style*="--reader-bg: #0f1419"] .mobile-nav-item,
  body[style*="--reader-bg: #2a2f35"] .mobile-nav-item {
    color: #94a3b8;
  }
  
  .mobile-nav-item .icon {
    font-size: 1.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
  }
  
  .mobile-nav-item:active, .mobile-nav-item.active {
    color: var(--color-accent);
  }
  
  /* Push content up so it doesn't get covered by bottom nav */
  body {
    padding-bottom: 80px !important;
  }
  
  .home-hero {
    margin: 2rem auto 1rem;
  }
  
  .hero-title {
    font-size: 2.3rem;
  }
  
  .essay-title {
    font-size: 2rem;
  }

  .essay-reader-container {
    margin-top: 1.5rem;
    padding: 0 1.25rem;
  }
  
  .essay-body-content p {
    padding-left: 22px; /* Give room inside the paragraph for the bookmark icon on mobile */
  }
  
  .paragraph-bookmark-btn {
    left: -2px; /* Align bookmark icon inside paragraph padding on mobile */
    opacity: 0.35;
  }
  
  .rating-widgets-container {
    grid-template-columns: 1fr;
  }

  /* Homepage list row stack layout on mobile to prevent horizontal squishing */
  .essay-list-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1.25rem 0.5rem;
  }
  .essay-row-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
  .essay-row-right {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.25rem;
  }
  .essay-row-date {
    font-size: 0.8rem;
  }

  /* Stack all grids on mobile to prevent squishing layout to 50% left */
  .featured-sections-grid,
  .category-highlights-grid,
  .home-content-layout {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    gap: 1.5rem !important;
  }
  
  .featured-card,
  .cat-highlight-card,
  .essays-list-section,
  .home-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Stack homepage search & category filter dropdown */
  .search-filter-bar {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }
  
  .search-input,
  .category-select {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Properly proportioned mobile side drawers */
  /* Settings panel takes 60% of page (leaving 40% on left visible for real-time preview) */
  .reader-settings-panel {
    width: 70% !important; /* Slightly wider on mobile to give more room */
    right: -75vw !important;
  }
  .reader-settings-panel.open {
    right: 0 !important;
  }
  
  /* Info drawer takes 75% of page */
  .essay-info-drawer {
    width: 75% !important;
    left: -80vw !important;
  }
  .essay-info-drawer.open {
    left: 0 !important;
  }

  .drawer-header {
    padding: 0.5rem 0.75rem !important;
  }
  .drawer-header h3, .drawer-header .settings-title {
    font-size: 1.15rem !important;
  }

  .drawer-body {
    padding: 0.5rem 0.75rem !important;
    gap: 0.5rem !important;
  }

  .info-stat-row {
    padding: 0.15rem 0 !important;
    font-size: 0.8rem !important;
  }

  .ai-summary-block {
    margin-top: 0.25rem !important;
    padding: 0.6rem !important;
  }

  .settings-group {
    gap: 0.25rem !important;
    margin-bottom: 0.5rem !important;
  }

  .settings-group label {
    font-size: 0.8rem !important;
  }

  .settings-group input[type="range"],
  .settings-group select {
    padding: 0.2rem !important;
    font-size: 0.8rem !important;
  }

  .font-size-control-row {
    gap: 0.5rem !important;
  }

  .font-number-input {
    width: 44px !important;
    padding: 0.35rem !important;
    font-size: 0.85rem !important;
  }

  /* Move close / default buttons down by 3/4 inch (72px) */
  .drawer-footer {
    display: flex !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0.75rem calc(0.5rem + 72px) 0.75rem !important;
  }
  
  .drawer-close-bottom-btn {
    width: 48% !important;
    min-width: unset !important;
    padding: 0.5rem 0.5rem !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
    text-align: center;
  }

  /* Flat icon size fixes inside mobile navigation footer */
  .mobile-bottom-nav svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Move homepage title up by 0.25 inch and 5 boxes up by 0.75 inch on mobile */
  .home-hero {
    margin: 0.1rem auto 0.25rem !important;
    padding: 0.2rem 1.5rem 0.1rem !important;
  }
  .hero-title {
    font-size: 2.1rem !important;
  }
  .hero-subtitle {
    margin-bottom: 0.4rem !important;
  }
  .home-hero + div {
    margin-top: 1.5rem !important;
  }
}

/* -------------------------------------------------------------
 * DYSLEXIA-FRIENDLY ACCESSIBILITY FONT
 * ------------------------------------------------------------- */
@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://cdn.jsdelivr.net/npm/opendyslexic@1.0.3/OpenDyslexic-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

.homepage-content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  box-sizing: border-box;
  width: 100%;
}

/* Homepage Wide Containers for Desktop */
.home-featured-snippet {
  margin: 0.3rem 0 1.5rem;
  padding: 1.5rem;
  background: var(--color-sepia-card);
  border: 1.5px solid var(--color-sepia-border);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  width: 100%;
  box-sizing: border-box;
}

.home-grid-container {
  margin: 0 0 2.5rem;
  width: 100%;
}

.home-grid-container a,
#surpriseMeCard {
  transition: transform var(--transition-smooth), background-color var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth) !important;
}

.home-grid-container a:hover,
#surpriseMeCard:hover {
  background-color: var(--color-sepia-card-hover) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
  border-color: var(--color-accent) !important;
}

.home-content-section {
  margin: 3rem auto;
  width: 100%;
}

@media (max-width: 768px) {
  .homepage-content-wrapper {
    padding: 0 1rem;
  }
  .home-featured-snippet {
    margin: -0.8rem 0 1.5rem;
    padding: 1.25rem;
  }
  .home-grid-container {
    margin: 0 0 2rem;
  }
  .home-content-section {
    margin: 2.5rem 0;
  }
}

/* Floating Sticky Info Toggle Button */
#floatingInfoToggleBtn {
  display: flex !important;
}
@media (max-width: 768px) {
  #floatingInfoToggleBtn {
    display: none !important; /* Hide on mobile since sticky footer icon does it */
  }
}

/* Floating Sticky Settings Toggle Button */
#floatingSettingsToggleBtn {
  display: flex !important;
}
@media (max-width: 768px) {
  #floatingSettingsToggleBtn {
    display: none !important;
  }
}

/* Custom styling for topic buttons and Bitcoin address to fit in one row on mobile */
@media (max-width: 480px) {
  .topic-btn {
    font-size: 0.85rem !important;
    padding: 0.4rem 0.5rem !important;
  }
  .btc-address {
    font-size: 0.72rem !important;
    padding: 0.4rem 0.25rem !important;
    white-space: nowrap !important;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Mobile Footer logo black circle and sepia filter rules */
.mobile-footer-logo-container {
  width: 28px;
  height: 28px;
  background-color: #000000;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.mobile-footer-logo-container img {
  /* Turn FD logo into light sepia/cream color (#fbf0e3 equivalent) inside black circle */
  filter: brightness(0) invert(92%) sepia(35%) saturate(320%) hue-rotate(345deg);
  transition: filter 0.2s ease;
}

body[style*="--reader-bg: #0f1419"] .mobile-footer-logo-container,
body[style*="--reader-bg:#0f1419"] .mobile-footer-logo-container,
body[style*="--reader-bg: #2a2f35"] .mobile-footer-logo-container,
body[style*="--reader-bg:#2a2f35"] .mobile-footer-logo-container {
  background-color: #ffffff; /* Use white circle on dark backgrounds for contrast */
}

body[style*="--reader-bg: #0f1419"] .mobile-footer-logo-container img,
body[style*="--reader-bg:#0f1419"] .mobile-footer-logo-container img,
body[style*="--reader-bg: #2a2f35"] .mobile-footer-logo-container img,
body[style*="--reader-bg:#2a2f35"] .mobile-footer-logo-container img {
  /* Make the logo dark inside the white circle on dark backgrounds */
  filter: brightness(0) opacity(0.85);
}

/* Card variables overrides for dark/dim themes */
body[style*="--reader-bg: #0f1419"],
body[style*="--reader-bg:#0f1419"] {
  --color-sepia-card: rgba(255, 255, 255, 0.05) !important;
  --color-sepia-card-hover: rgba(255, 255, 255, 0.1) !important;
}

body[style*="--reader-bg: #2a2f35"],
body[style*="--reader-bg:#2a2f35"] {
  --color-sepia-card: rgba(255, 255, 255, 0.05) !important;
  --color-sepia-card-hover: rgba(255, 255, 255, 0.1) !important;
}

/* Tab button override: active selection should be black background/border */
.playlist-tab-btn.active {
  background-color: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

/* Toast popup keyframe animation (no movement, no size changes, stays in same space, just dims away) */
@keyframes toast-in-out {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(1.0);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.0);
  }
  50% {
    opacity: 0.85;
    transform: translate(-50%, 0) scale(1.0);
  }
  75% {
    opacity: 0.5;
    transform: translate(-50%, 0) scale(1.0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0) scale(1.0);
  }
}

.toast-animated {
  animation: toast-in-out 3s cubic-bezier(0.1, 0.8, 0.3, 1) forwards !important;
}

#toastNotification {
  padding: 0.75rem 1.5rem !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  text-align: center !important;
  box-shadow: var(--box-shadow-heavy) !important;
  border-radius: 20px !important;
  will-change: transform, opacity !important;
  
  /* Fallback color states to avoid expensive backdrop-filter blur rendering */
  background-color: rgba(26, 22, 18, 0.98) !important;
  border: 1px solid rgba(112, 82, 50, 0.25) !important;
  color: #f7f3eb !important;
}

body[style*="--reader-bg: #0f1419"] #toastNotification,
body[style*="--reader-bg: #2a2f35"] #toastNotification {
  background-color: rgba(21, 27, 34, 0.98) !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

#toastNotification::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(26, 22, 18, 0.98) transparent transparent;
  display: block;
  width: 0;
}

body[style*="--reader-bg: #0f1419"] #toastNotification::after,
body[style*="--reader-bg: #2a2f35"] #toastNotification::after {
  border-color: rgba(21, 27, 34, 0.98) transparent transparent;
}

/* Comments Form layout updates */
.comment-form .editor-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Footer icons active/inactive states */
#mobileInfoToggleBtn,
#mobileSettingsToggleBtn {
  color: rgba(112, 82, 50, 0.45) !important; /* Muted dark gray/brown by default */
}

body[style*="--reader-bg: #0f1419"] #mobileInfoToggleBtn,
body[style*="--reader-bg: #0f1419"] #mobileSettingsToggleBtn,
body[style*="--reader-bg: #2a2f35"] #mobileInfoToggleBtn,
body[style*="--reader-bg: #2a2f35"] #mobileSettingsToggleBtn {
  color: #475569 !important; /* Muted slate gray on dark/dim */
}

body.page-essay #mobileInfoToggleBtn,
body.page-essay #mobileSettingsToggleBtn {
  color: var(--color-sepia-text) !important; /* Normal active black in sepia */
}

body.page-essay[style*="--reader-bg: #0f1419"] #mobileInfoToggleBtn,
body.page-essay[style*="--reader-bg: #0f1419"] #mobileSettingsToggleBtn,
body.page-essay[style*="--reader-bg: #2a2f35"] #mobileInfoToggleBtn,
body.page-essay[style*="--reader-bg: #2a2f35"] #mobileSettingsToggleBtn {
  color: #ffffff !important; /* Normal active white on dark/dim */
}

/* Next essay promo card centering */
.next-essay-promo {
  margin: 1.5rem auto 0 !important;
  text-align: center !important;
  width: 100% !important;
}

/* Date tab interactive buttons */
.filter-btn {
  background-color: transparent;
  border: 1px solid var(--color-sepia-border);
  color: var(--color-sepia-text);
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
}
.filter-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.filter-btn.active {
  background-color: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

body[style*="--reader-bg: #0f1419"] .filter-btn,
body[style*="--reader-bg: #2a2f35"] .filter-btn {
  border-color: #334155;
  color: #94a3b8;
}
body[style*="--reader-bg: #0f1419"] .filter-btn.active,
body[style*="--reader-bg: #2a2f35"] .filter-btn.active {
  background-color: #ffffff !important;
  border-color: #ffffff !important;
  color: #0f1419 !important;
}
body[style*="--reader-bg: #0f1419"] .filter-btn:hover,
body[style*="--reader-bg: #2a2f35"] .filter-btn:hover {
  border-color: #ffffff;
  color: #ffffff;
}

/* Symmetrical Homepage Grid Wrapper */
.home-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

/* Bitcoin Support Donation Box */
.btc-support-box {
  text-align: left;
  background: transparent; /* blended into background */
  border: none; /* remove borders */
  padding: 0; /* remove padding card wrapper */
  box-shadow: none; /* remove box shadow */
  max-width: 380px;
  margin: 3rem 0; /* All the way to the left */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
}

.btc-support-box h3 {
  font-family: var(--font-serif-playfair);
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 700;
  text-align: left;
}

.btc-support-box .btc-address {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--color-sepia-text);
  margin: 0 0 0.75rem 0;
  background: transparent; /* remove background container */
  padding: 0; /* remove padding */
  border: none; /* remove dashed border */
  word-break: break-all;
  width: 100%;
  box-sizing: border-box;
}

.btc-support-box .btc-qr-container {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

.btc-support-box img {
  width: 75px; /* smaller QR */
  height: auto;
  border: 1px solid var(--color-sepia-border);
  border-radius: 6px;
  padding: 4px;
  background: #fff;
}

@media (max-width: 640px) {
  /* Keep home-grid-wrapper in 2 columns on mobile */
  .home-grid-wrapper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .btc-support-box {
    max-width: 100%;
    margin: 1.5rem auto;
    text-align: center;
    align-items: center;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  
  .btc-support-box h3 {
    font-size: 0.85rem; /* Fits in one row on mobile */
    text-align: center;
    white-space: nowrap;
    margin-bottom: 0;
  }
  
  .btc-support-box .btc-address {
    font-size: 0.62rem; /* Fits in one row on mobile */
    white-space: nowrap;
    text-align: center;
    padding: 0;
    margin: 0 0 0.15rem 0;
  }
  
  .btc-support-box .btc-qr-container {
    justify-content: center;
  }
  
  .btc-support-box img {
    width: 65px; /* Smaller QR code on mobile */
  }
  
  .site-footer {
    padding: 1.5rem 1rem;
  }
  
  .site-footer p {
    font-size: 0.62rem; /* reduced size to fit in one row */
    margin: 0;
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
  }
  
  .site-footer p a {
    margin-left: 5px !important;
    display: inline-flex;
    align-items: center;
  }
  
  .site-footer p a span {
    font-size: 1.15em !important;
  }
}



/* -------------------------------------------------------------
 * WORDPRESS TABLE STYLES (ADDED FOR BITCOIN ESSAY)
 * ------------------------------------------------------------- */
.wp-block-table {
  width: 100%;
  margin: 2rem 0;
  overflow-x: auto;
}

.wp-block-table table {
  width: 100%;
  border-collapse: collapse;
}

.wp-block-table th,
.wp-block-table td {
  padding: 1.5rem 1rem;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid var(--color-sepia-border);
}

.wp-block-table tr:first-child td {
  border-bottom: 2px solid var(--color-sepia-border);
  background-color: rgba(112, 82, 50, 0.05);
}

.essay-body-content .wp-block-table p {
  margin-bottom: 0;
}

