/* Story Series Styles - Self-contained CSS for story functionality */

/* ============================================================================
   RSS ICON STYLES
   ============================================================================ */
/* RSS Icon Component */
.rss-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* RSS Icon in view toggle (main story index) */
.view-rss {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  color: var(--text-color, #333);
}

.view-rss:hover {
  background-color: var(--hover-bg, rgba(0, 0, 0, 0.1));
  transform: scale(1.05);
}

/* RSS Icon in story header (individual story pages) */
.story-header {
  position: relative;
}

.story-header-rss {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
}

.story-rss-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  text-decoration: none;
}

.story-rss-link:hover {
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

.story-rss-link .rss-icon {
  width: 20px;
  height: 20px;
  color: #f26522; /* Standard RSS orange color */
}

/* Dark mode support for RSS icon in header */
@media (prefers-color-scheme: dark) {
  .story-rss-link {
    background-color: rgba(0, 0, 0, 0.8);
  }
  
  .story-rss-link:hover {
    background-color: rgba(0, 0, 0, 0.9);
  }
  
  .story-rss-link .rss-icon {
    color: #ff6b35; /* Brighter orange for dark mode */
  }
}

/* ============================================================================
   STORY MODE LAYOUT - Full width content with hidden sidebar
   ============================================================================ */

/* Completely disable and remove sidebar and related elements for story mode */
.story-mode #_drawer,
.story-mode hy-drawer,
.story-mode .sidebar,
.story-mode .sidebar-bg,
.story-mode .sidebar-sticky {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -9999px !important;
  z-index: -1 !important;
}

/* Ensure no phantom sidebar elements are blocking clicks */
.story-mode {
  position: relative !important;
}

.story-mode .story-content {
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: none !important;
  width: 100% !important;
  padding: 2rem 3rem !important;
  padding-bottom: 8rem !important; /* Ensure content doesn't get cut off and footer doesn't overlap */
  min-height: calc(100vh - 100px); /* Push footer down */
  position: relative !important;
  z-index: 1 !important;
}

/* Ensure all story content is clickable */
.story-mode .story-content * {
  pointer-events: auto !important;
}

/* Reset any fixed positioning that might interfere */
.story-mode hy-push-state {
  position: static !important;
}

/* Make sure main content takes full width and is clickable */
.story-mode #_main {
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: none !important;
  width: 100% !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Remove any drawer overlay or scrim elements */
.story-mode .hy-drawer-scrim,
.story-mode .drawer-scrim,
.story-mode [class*="scrim"],
.story-mode [class*="overlay"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -9999px !important;
}

/* Ensure body and html don't have conflicting styles in story mode */
.story-mode body,
.story-mode html {
  overflow-x: visible !important;
  margin-left: 0 !important;
}

/* Remove any transforms or transitions that might interfere */
.story-mode * {
  transform: none !important;
}

/* Debug mode - uncomment the following to see click-blocking elements */
/*
.story-mode * {
  outline: 1px solid red !important;
  background: rgba(255, 0, 0, 0.1) !important;
}
.story-mode *:hover {
  background: rgba(0, 255, 0, 0.3) !important;
}
*/

/* 
JAVASCRIPT DEBUG SNIPPET - Add this to browser console to identify click blockers:
document.addEventListener('click', function(e) {
  e.preventDefault();
  console.log('Clicked element:', e.target);
  console.log('Element classes:', e.target.className);
  console.log('Element styles:', window.getComputedStyle(e.target));
  console.log('All elements at click point:', document.elementsFromPoint(e.clientX, e.clientY));
});
*/

/* Force remove any potential click-blocking pseudo-elements */
.story-mode *::before,
.story-mode *::after {
  display: none !important;
  content: none !important;
}

/* Ensure no fixed or absolute positioned elements interfere */
.story-mode [style*="position: fixed"],
.story-mode [style*="position: absolute"],
.story-mode .fixed,
.story-mode .absolute {
  position: static !important;
}

/* Remove any z-index stacking that might block clicks */
.story-mode > *:not(.story-content):not(#_main) {
  z-index: -1 !important;
}

/* Responsive padding adjustments */
@media (max-width: 768px) {
  .story-mode .story-content {
    padding: 1.5rem 1.5rem !important;
  }
}

@media (max-width: 480px) {
  .story-mode .story-content {
    padding: 1rem 1rem !important;
  }
}

/* ============================================================================
   HOME NAVIGATION BUTTON
   ============================================================================ */

/* Old home button styles - now in view-toggle panel
.story-home-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  padding: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

.story-home-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  transform: scale(1.05);
  text-decoration: none;
}

.story-home-btn svg {
  width: 24px;
  height: 24px;
}
*/

/* ============================================================================
   BLOG-INSPIRED TYPOGRAPHY AND CONTENT STYLES
   ============================================================================ */

/* Typography matching blog styles */
.story-content {
  font-family: 'Noto Sans', Helvetica, Arial, sans-serif;
  line-height: 1.75;
  color: var(--body-color, #333);
  background: var(--body-bg, #fff);
}

.story-content h1,
.story-content h2,
.story-content h3,
.story-content h4,
.story-content h5,
.story-content h6 {
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--heading-color, #333);
  margin: 2rem 0 1rem 0;
}

.story-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.story-content h2 {
  font-size: 2rem;
  margin-top: 3rem;
}

.story-content h3 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
}

.story-content p {
  margin: 0 0 1.5rem 0;
  font-size: 1.1rem;
}

.story-content blockquote {
  margin: 2rem 0;
  padding: 1rem 2rem;
  border-left: 4px solid var(--accent-color, #4fb1ba);
  background: var(--gray-bg, rgba(0,0,0,.025));
  font-style: italic;
}

/* ============================================================================
   STORY INDEX PAGE STYLES
   ============================================================================ */

.story-index {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header with controls layout */
.story-header-with-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 2rem;
}

.story-title-section {
  flex: 1;
}

/* View toggle buttons - darker design */
.view-toggle {
  display: flex;
  gap: 0.25rem;
  background: #2a2a2a;
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
  border: 1px solid #444;
}

.view-btn {
  padding: 0.75rem;
  border: none;
  background: transparent;
  color: #999;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  text-decoration: none;
}

.view-btn:hover {
  background: #3a3a3a;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  text-decoration: none;
}

.view-btn.active {
  background: #3c9199; /* Darker shade of blog button blue */
  color: white;
  box-shadow: 0 2px 8px rgba(60, 145, 153, 0.4);
}

/* Divider between view toggle and home button */
.view-toggle-divider {
  width: 1px;
  height: 32px;
  background: #444;
  margin: 6px 8px;
}

/* Home button specific styling */
.view-btn.view-home {
  border-left: 1px solid #444;
  margin-left: 8px;
  padding-left: 1rem;
}

/* Remove any arrow icons from home button - just show home icon */
.view-btn.view-home .nav-arrow {
  display: none;
}

/* Override external link styling for home button */
.view-btn.view-home::after {
  content: none !important;
  display: none !important;
}

/* Ensure home button SVG is visible */
.view-btn.view-home svg {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Story Navigation Buttons - remove external link icons */
.story-nav-btn::after {
  content: none !important;
  display: none !important;
}

.story-nav-btn .nav-arrow {
  display: none !important;
}

.chapter-link.no-push-state::after {
  content: none !important;
  display: none !important;
}

.story-post-nav a.no-push-state::after {
  content: none !important;
  display: none !important;
}

.view-btn svg {
  transition: all 0.2s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .story-header-with-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .view-toggle {
    align-self: flex-end;
    margin-top: 1rem;
  }
}

.stories-container {
  margin-top: 2rem;
  margin-bottom: 4rem; /* Add bottom margin to separate from footer */
}

/* Grid view */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.story-tile {
  border-radius: 8px;
  overflow: hidden;
  background: var(--background, #fff);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  height: fit-content; /* Allow natural height based on content */
  display: flex;
  flex-direction: column;
}

.story-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.story-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.story-image {
  min-height: 180px;
  max-height: 220px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-bg, rgba(0, 0, 0, 0.025));
  border-radius: 8px 8px 0 0;
}

.story-image img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  object-position: center;
}

.story-content {
  padding: 1rem 1.5rem 0.75rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.story-content > *:last-child {
  margin-top: auto;
}

.story-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
  color: var(--accent-color, #4fb1ba);
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
}

.story-description {
  margin: 0 0 0.3rem 0;
  color: var(--text-muted, #666);
  line-height: 1.4;
}

.story-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted, #666);
  margin-top: 0.15rem;
}

.post-count {
  font-weight: 500;
}

/* List view */
.stories-list {
  max-width: 800px;
  margin: 0 auto;
}

.story-list-item {
  border-bottom: 1px solid var(--border-color, #eee);
  padding: 1.5rem 0;
}

.story-list-item:last-child {
  border-bottom: none;
}

.story-list-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.story-list-link:hover .story-list-title {
  color: var(--accent-color, #4fb1ba);
}

.story-list-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
  transition: color 0.2s;
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
}

.story-list-description {
  margin: 0 0 0.75rem 0;
  color: var(--text-muted, #666);
  line-height: 1.5;
}

.story-list-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted, #666);
}

/* ============================================================================
   STORY TITLE PAGE STYLES
   ============================================================================ */

.story-title {
  max-width: 1000px;
  margin: 0 auto;
}

.story-breadcrumb {
  margin-bottom: 1rem;
}

.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--accent-color, #4fb1ba);
  font-size: 0.9rem;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.story-hero-image {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-bg, rgba(0, 0, 0, 0.025));
}

.story-hero-image img {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.story-title-content {
  text-align: center;
  margin: 2rem 0;
}

.story-title-content .story-title {
  font-size: 2.5rem;
  margin: 0 0 1rem 0;
  color: var(--accent-color, #4fb1ba);
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
}

.story-description {
  font-size: 1.1rem;
  color: var(--text-muted, #666);
  max-width: 600px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.6;
}

.story-metadata {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.story-author,
.story-genre {
  color: var(--text-muted, #666);
}

.story-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-ongoing {
  background: #e3f2fd;
  color: #1976d2;
}

.status-complete {
  background: #e8f5e8;
  color: #388e3c;
}

.status-paused {
  background: #fff3e0;
  color: #f57c00;
}

.story-intro {
  margin: 3rem 0;
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.story-posts {
  margin: 3rem 0;
}

.posts-title {
  font-size: 1.8rem;
  margin: 0 0 2rem 0;
  text-align: center;
  color: var(--accent-color, #4fb1ba);
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.post-tile {
  border-radius: 6px;
  overflow: hidden;
  background: var(--background, #fff);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.post-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-image {
  height: 150px;
  overflow: hidden;
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-date {
  color: var(--text-muted, #aaa9a9);
  text-decoration: none;
  font-size: 0.7rem;
}

.post-content {
  padding: 1.25rem;
}

.post-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--accent-color, #4fb1ba);
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
}

.post-excerpt {
  margin: 0 0 0.75rem 0;
  color: var(--text-muted, #aaa9a9);
  font-size: 0.9rem;
  line-height: 1.4;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted, #666);
}

.chapter-number {
  font-weight: 500;
}

.story-footer {
  margin: 3rem 0 0 0;
  text-align: center;
  padding: 2rem 0;
  margin-top: auto; /* Push footer to bottom */
}

.story-nav-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
  border: 2px solid #3c9199;
}

.btn-outline {
  color: #3c9199; /* Darker shade of blog button blue */
  background: transparent;
}

.btn-outline:hover {
  background: #3c9199; /* Darker shade of blog button blue */
  color: white;
}

.btn-primary {
  background: #3c9199; /* Darker shade of blog button blue */
  color: white;
}

.btn-primary:hover {
  background: #3fa0a9; /* Darker shade of blog blue */
  border-color: #3fa0a9;
}

/* ============================================================================
   STORY POST PAGE STYLES
   ============================================================================ */

.story-post {
  max-width: 800px;
  margin: 0 auto;
}

.story-breadcrumbs {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted, #666);
}

.breadcrumb-separator {
  margin: 0 0.5rem;
}

.chapter-navigation-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0 2rem 0;
  padding: 1rem;
  background: var(--gray-bg, rgba(0,0,0,.025));
  border-radius: 6px;
}

/* Navigation groups to keep arrows and links close together */
.nav-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-prev-group {
  justify-content: flex-start;
}

.nav-next-group {
  justify-content: flex-end;
}

/* Navigation sections with arrows outside links */
.chapter-navigation-top .nav-arrow {
  display: flex;
  align-items: center;
  font-weight: bold;
  color: var(--accent-color, #4fb1ba);
}

/* Ensure arrows outside links are properly styled */
.chapter-navigation-top span.nav-arrow {
  text-decoration: none !important;
  font-weight: bold;
  color: var(--accent-color, #4fb1ba);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--accent-color, #4fb1ba);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.nav-link:hover {
  background: #3c9199;
  color: white;
}

.nav-arrow {
  font-weight: bold;
  text-decoration: none !important;
}

/* Ensure header navigation arrows are not underlined */
.chapter-navigation-top .nav-arrow {
  text-decoration: none !important;
}

.chapter-navigation-top .nav-link .nav-arrow {
  text-decoration: none !important;
}

.chapter-info {
  text-align: center;
  color: var(--text-muted, #666);
  font-size: 0.85rem;
}

.chapter-number {
  font-weight: 500;
  color: var(--accent-color, #4fb1ba);
}

.chapter-progress {
  display: block;
  margin-top: 0.25rem;
}

.story-post-title-section {
  text-align: center;
  margin: 2rem 0;
}

.story-post-title {
  font-size: 2.2rem;
  margin: 0 0 0.5rem 0;
  color: var(--accent-color, #4fb1ba);
  font-family: 'Roboto Slab', Helvetica, Arial, sans-serif;
}

.story-post-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted, #d5d5d5);
  font-style: italic;
  margin: 0 0 1.5rem 0;
}

.story-post-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-muted, #666);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: orange;
}

.chapter-meta {
  font-weight: 500;
  color: var(--accent-color, #4fb1ba);
}

.story-post-image {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-bg, rgba(0, 0, 0, 0.025));
}

.story-post-image img {
  width: 100%;
  height: 100%;
  min-height: 500px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.story-post-content {
  margin: 3rem 0;
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Horizontal rules in story content */
.story-post-content hr {
  width: 100% !important;
  max-width: 100% !important;
  margin: 2rem 0 !important;
  border: 0 !important;
  border-top: 1px solid #ccc !important;
  background: transparent !important;
  height: 0 !important;
  padding: 0 !important;
  text-align: left !important;
  box-sizing: border-box !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Remove any pseudo-elements from main site */
.story-post-content hr::before,
.story-post-content hr::after {
  display: none !important;
  content: none !important;
}

.story-post-content hr.subtle {
  border-top: 0.5px solid #abaaaa !important;
  margin: 1.5rem auto !important;
  width: 80% !important;
  max-width: 80% !important;
}

.story-post-content hr.green {
  border-top: 2px solid #4fb1ba !important;
  margin: 1.5rem 0 !important;
}

/* Ensure story mode overrides any container constraints */
.story-mode .story-post-content hr {
  position: relative !important;
  left: 0 !important;
  right: 0 !important;
  transform: none !important;
}

.story-post-content h2 {
  color: var(--accent-color, #4fb1ba);
  margin: 2rem 0 1rem 0;
}

.story-post-content p {
  margin: 0 0 1.5rem 0;
}

.story-post-footer {
  margin: 4rem 0 2rem 0;
  border-top: 1px solid var(--border-color, #eee);
  padding-top: 2rem;
  padding-bottom: 6rem; /* Add extra space to prevent overlap */
  text-align: center; /* Center the footer content */
}

.story-nav-buttons {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.nav-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-group.chapter-nav .btn-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  min-width: 200px;
  border: 1px solid;
}

.nav-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.nav-label {
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.8;
}

.nav-title {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.btn-secondary {
  background: var(--gray-bg, rgba(0,0,0,.025));
  color: var(--text-color, #333);
  border-color: var(--border-color, #eee);
}

.btn-secondary:hover {
  background: #3c9199; /* Darker shade of blog button blue */
  color: white;
}

.btn-primary {
  background: #3c9199; /* Darker shade of blog button blue */
  color: white;
  border-color: #3c9199;
}

.btn-primary:hover {
  background: #3fa0a9; /* Darker shade of blog blue */
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.chapter-list-details {
  margin-top: 2rem;
  border: 1px solid var(--border-color, #eee);
  border-radius: 6px;
}

.chapter-list-toggle {
  padding: 1rem;
  background: var(--gray-bg, rgba(0,0,0,.025));
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  border: none;
  width: 100%;
  text-align: left;
}

.chapter-list-toggle:hover {
  background: #3c9199;
  color: white;
}

.chapter-list {
  padding: 1rem;
}

.chapter-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color, #eee);
}

.chapter-item:last-child {
  border-bottom: none;
}

.chapter-item.current {
  background: var(--gray-bg, rgba(0,0,0,.025));
  padding: 0.5rem;
  border-radius: 4px;
}

.chapter-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.chapter-link:not(.current):hover {
  color: var(--accent-color, #4fb1ba);
}

.chapter-link.current {
  color: var(--accent-color, #4fb1ba);
  font-weight: 500;
}

.chapter-number {
  font-size: 0.8rem;
  opacity: 0.7;
  min-width: 3rem;
}

.chapter-title {
  flex: 1;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
  .story-home-btn {
    top: 15px;
    left: 15px;
    width: 44px;
    height: 44px;
    padding: 10px;
  }
  
  .story-home-btn svg {
    width: 20px;
    height: 20px;
  }

  .story-index .stories-grid {
    grid-template-columns: 1fr;
  }

  .story-title .story-title-content .story-title {
    font-size: 2rem;
  }

  .story-title .posts-grid {
    grid-template-columns: 1fr;
  }

  .story-title .story-footer .story-nav-buttons {
    flex-direction: column;
    align-items: center;
  }

  .story-post .chapter-navigation-top {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .story-post .story-post-title-section .story-post-title {
    font-size: 1.8rem;
  }

  .story-nav-buttons .nav-group {
    flex-direction: column;
    align-items: center;
  }

  .nav-group.chapter-nav .btn-nav {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .story-home-btn {
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    padding: 8px;
  }
  
  .story-home-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* ============================================================================
   DARK MODE SUPPORT
   ============================================================================ */

@media (prefers-color-scheme: dark) {
  .story-content {
    color: #e2e8f0;
    background: #1a202c;
  }

  .story-content h1,
  .story-content h2,
  .story-content h3,
  .story-content h4,
  .story-content h5,
  .story-content h6 {
    color: #f7fafc;
  }

  .story-tile,
  .post-tile {
    background: #2d3748;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  }

  .story-tile:hover,
  .post-tile:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
  }

  .chapter-navigation-top,
  .chapter-list-toggle {
    background: #2d3748;
  }

  .chapter-list-details {
    border-color: #4a5568;
  }

  .btn-secondary {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
  }
}

/* ============================================================================
   STORY DIRECTION STYLES
   ============================================================================ */

/* Direction entry - only visible on mobile devices */
.story-direction {
  display: none; /* Hidden by default */
  margin: 1rem 0;
  text-align: center;
}

.direction-text {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #ff6b35, #f7931e); /* Day-glo orange gradient */
  border: 2px solid #ff8c42; /* Bright orange border */
  border-radius: 12px; /* More rounded corners */
  font-size: 0.85rem;
  color: #000; /* Black text for maximum contrast on bright background */
  font-weight: 700; /* Extra bold for visibility */
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4), 0 0 20px rgba(255, 107, 53, 0.3); /* Glowing shadow effect */
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8); /* White text shadow for pop */
  line-height: 1.4; /* Better line spacing for multiple lines */
  white-space: normal; /* Allow text wrapping */
  animation: pulse-glow 2s ease-in-out infinite alternate; /* Subtle pulsing animation */
}

/* Day-glo pulsing animation */
@keyframes pulse-glow {
  0% {
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4), 0 0 20px rgba(255, 107, 53, 0.3);
  }
  100% {
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.6), 0 0 25px rgba(255, 107, 53, 0.5);
  }
}

/* Show direction only on mobile devices (phones) */
@media (max-width: 768px) {
  .story-direction {
    display: block;
  }
}

/* Dark mode support for direction - keep day-glo effect */
@media (prefers-color-scheme: dark) {
  .direction-text {
    background: linear-gradient(135deg, #ff6b35, #f7931e); /* Keep the same day-glo gradient */
    border: 2px solid #ff8c42; /* Keep bright orange border */
    color: #000; /* Keep black text for contrast */
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.5), 0 0 25px rgba(255, 107, 53, 0.4); /* Enhanced glow in dark mode */
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9); /* Stronger white text shadow */
  }
}

/* ============================================================================
   STORY CONTENT LINK STYLES - Bright and Distinctive
   ============================================================================ */

/* General links in story content - bright and visible */
.story-content a {
  color: #2563eb !important; /* Bright blue for high visibility */
  text-decoration: underline;
  text-decoration-color: #60a5fa; /* Light blue underline */
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.story-content a:hover {
  color: #1e40af !important; /* Darker blue on hover */
  text-decoration-color: #3b82f6;
  text-decoration-thickness: 2.5px;
}

/* Navigation button text - white and easy to read */
.story-mode .nav-label a.btn,
.story-content .nav-label a.btn,
.nav-label a.btn {
  color: #ffffff !important; /* White text */
  text-decoration: none !important; /* No underline */
}

.story-mode .nav-label a.btn:hover,
.story-content .nav-label a.btn:hover,
.nav-label a.btn:hover {
  color: #ffffff !important;
  text-decoration: none !important;
}

/* Dark mode support for content links - even brighter */
@media (prefers-color-scheme: dark) {
  .story-content a {
    color: #60a5fa !important; /* Bright light blue for dark backgrounds */
    text-decoration-color: #93c5fd; /* Even lighter blue underline */
  }
  
  .story-content a:hover {
    color: #93c5fd !important; /* Very bright blue on hover */
    text-decoration-color: #bfdbfe;
  }
  
  /* Navigation button text remains white in dark mode */
  .story-mode .nav-label a.btn,
  .story-content .nav-label a.btn,
  .nav-label a.btn {
    color: #ffffff !important;
    text-decoration: none !important;
  }
  
  .story-mode .nav-label a.btn:hover,
  .story-content .nav-label a.btn:hover,
  .nav-label a.btn:hover {
    color: #ffffff !important;
    text-decoration: none !important;
  }

  /* In the footer, we want the labels to show white on nav buttons */
  .story-post-footer a.btn {
    color: white !important;
  }

  .story-post-footer a.btn:hover {
    color: orange !important;
  }

}

/* ============================================================================
   STORY FIGCAPTION LINK STYLES
   ============================================================================ */

/* Style links inside figcaptions within story content */
.story-content figure figcaption a {
  color: #2563eb !important; /* Bright blue matching content links */
  text-decoration: underline;
  text-decoration-color: #60a5fa;
  transition: color 0.2s ease;
}

.story-content figure figcaption a:hover {
  color: #1e40af !important; /* Darker blue on hover */
  text-decoration-color: #3b82f6;
}

/* Dark mode support for figcaption links */
@media (prefers-color-scheme: dark) {
  .story-content figure figcaption a {
    color: #60a5fa !important; /* Bright light blue for dark mode */
    text-decoration-color: #93c5fd;
  }
  
  .story-content figure figcaption a:hover {
    color: #93c5fd !important; /* Very bright blue on hover */
    text-decoration-color: #bfdbfe;
  }
}

/* ============================================================================
   RECAP COMPONENT STYLES
   ============================================================================ */

/* Base recap component styling */
blockquote.custom-recap {
  all: unset !important;
  display: block !important;
  margin: 2.5rem 1.5rem !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  position: relative !important;
  font-family: 'Georgia', 'Times New Roman', serif !important; /* Different font for distinction */
  font-size: 1rem !important;
  line-height: 1.7 !important;
  color: var(--body-color, #333) !important;
}

.recap-badge {
  position: absolute !important;
  top: -0.75rem !important;
  left: 1rem !important;
  background: #6b7280 !important; /* Simple gray background instead of gradient */
  color: white !important;
  padding: 0.25rem 0.4rem !important; /* Reduced vertical padding by 1/3 */
  border-radius: 0.5rem !important;
  font-size: 0.65rem !important; /* Smaller font */
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3) !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important; /* Slightly smaller gap */
}

.recap-icon {
  font-size: 0.9rem !important; /* Smaller icon to match smaller badge */
  opacity: 1 !important;
  filter: none !important; /* Remove any blur filters */
  text-shadow: none !important;
}

.recap-title {
  font-weight: 600 !important;
  letter-spacing: 0.025em !important;
}

.recap-body {
  background: #f9fafb !important; /* Simple light gray background */
  border: 1px solid #d1d5db !important; /* Subtle border */
  border-radius: 0.75rem !important;
  padding: 1.5rem 1.5rem 1.5rem 1.5rem !important;
  margin-top: 0.5rem !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  position: relative !important;
}

/* Remove the colored sidebar */
.recap-body::before {
  display: none !important;
}

.recap-body p {
  margin: 0 0 1rem 0 !important;
  color: var(--text-color, #374151) !important;
  font-style: italic !important; /* Italic text for distinction */
}

.recap-body p:last-child {
  margin-bottom: 0 !important;
}

/* Error state for recap */
.custom-recap-error .recap-badge {
  background: #ef4444 !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
}

.custom-recap-error .recap-body {
  border-color: #fecaca !important;
  background: #fef2f2 !important;
}

/* ============================================================================
   SUMMARY COMPONENT STYLES
   ============================================================================ */

/* Base summary component styling */
blockquote.custom-summary {
  all: unset !important;
  display: block !important;
  margin: 2.5rem 1.5rem !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  position: relative !important;
  font-family: 'Georgia', 'Times New Roman', serif !important; /* Match recap font */
  font-size: 1rem !important;
  line-height: 1.7 !important;
  color: var(--body-color, #333) !important;
}

.summary-badge {
  position: absolute !important;
  top: -0.75rem !important;
  left: 1rem !important;
  background: #059669 !important; /* Default green theme */
  color: white !important;
  padding: 0.25rem 0.4rem !important; /* Match recap sizing */
  border-radius: 0.5rem !important;
  font-size: 0.65rem !important; /* Match recap font size */
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3) !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important; /* Match recap gap */
}

.summary-icon {
  font-size: 0.9rem !important; /* Match recap icon size */
  opacity: 1 !important;
  filter: none !important;
  text-shadow: none !important;
}

.summary-title {
  font-weight: 600 !important;
  letter-spacing: 0.025em !important;
}

.summary-body {
  background: #f9fafb !important; /* Default light background */
  border: 1px solid #d1d5db !important; /* Default border */
  border-radius: 0.75rem !important;
  padding: 1.5rem 1.5rem 1.5rem 1.5rem !important;
  margin-top: 0.5rem !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  position: relative !important;
}

/* Remove the colored sidebar */
.summary-body::before {
  display: none !important;
}

.summary-body p {
  margin: 0 0 1rem 0 !important;
  color: var(--text-color, #374151) !important;
  font-style: italic !important; /* Match recap italic styling */
}

.summary-body p:last-child {
  margin-bottom: 0 !important;
}

/* Theme variations */
.custom-summary-green .summary-body {
  background: #dcfce7 !important; /* Darker green tint */
  border: 1px solid #86efac !important; /* Darker green border */
}

.custom-summary-green .summary-badge {
  background: #059669 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3) !important;
}

.custom-summary-blue .summary-badge {
  background: #2563eb !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
}

.custom-summary-blue .summary-body {
  background: #dbeafe !important; /* Darker blue tint */
  border: 1px solid #93c5fd !important; /* Darker blue border */
}

.custom-summary-purple .summary-badge {
  background: #6b46c1 !important; /* Eggplant purple */
  box-shadow: 0 2px 8px rgba(107, 70, 193, 0.3) !important;
}

.custom-summary-purple .summary-body {
  background: #f3e8ff !important; /* Darker eggplant tint */
  border: 1px solid #c4b5fd !important; /* Darker eggplant border */
}

.custom-summary-orange .summary-badge {
  background: #ea580c !important;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3) !important;
}

.custom-summary-orange .summary-body {
  background: #fed7aa !important; /* Darker orange tint */
  border: 1px solid #fdba74 !important; /* Darker orange border */
}

.custom-summary-red .summary-badge {
  background: #dc2626 !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
}

.custom-summary-red .summary-body {
  background: #fecaca !important; /* Darker red tint */
  border: 1px solid #fca5a5 !important; /* Darker red border */
}

/* Error state for summary */
.custom-summary-error .summary-badge {
  background: #ef4444 !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
}

.custom-summary-error .summary-body {
  border: 1px solid #fecaca !important;
  background: #fef2f2 !important;
}

/* ============================================================================
   DARK MODE SUPPORT FOR RECAP AND SUMMARY COMPONENTS
   ============================================================================ */

@media (prefers-color-scheme: dark) {
  /* Recap dark mode */
  .recap-body {
    background: #374151 !important; /* Simple dark gray background */
    border-color: #4b5563 !important;
    color: #e2e8f0 !important;
  }

  .recap-body p {
    color: #d1d5db !important;
  }

  /* Summary dark mode - theme variations */
  .custom-summary-green .summary-body {
    background: #064e3b !important; /* Dark green tint */
    border-color: #047857 !important;
    color: #e2e8f0 !important;
  }

  .custom-summary-blue .summary-body {
    background: #1e3a8a !important; /* Dark blue tint */
    border-color: #2563eb !important;
    color: #e2e8f0 !important;
  }

  .custom-summary-purple .summary-body {
    background: #581c87 !important; /* Dark eggplant tint */
    border-color: #6b46c1 !important;
    color: #e2e8f0 !important;
  }

  .custom-summary-orange .summary-body {
    background: #9a3412 !important; /* Dark orange tint */
    border-color: #ea580c !important;
    color: #e2e8f0 !important;
  }

  .custom-summary-red .summary-body {
    background: #991b1b !important; /* Dark red tint */
    border-color: #dc2626 !important;
    color: #e2e8f0 !important;
  }

  .summary-body p {
    color: #d1d5db !important; /* Match recap dark text color */
  }

  /* Error states in dark mode */
  .custom-recap-error .recap-body {
    background: #7f1d1d !important;
    border-color: #dc2626 !important;
  }

  .custom-summary-error .summary-body {
    background: #7f1d1d !important;
    border-color: #dc2626 !important;
  }
}

/* ============================================================================
   NAVIGATION LINKS FOR RECAP AND SUMMARY COMPONENTS
   ============================================================================ */

/* Recap navigation link styling */
.recap-nav-link {
  color: inherit !important;
  text-decoration: underline !important;
  text-decoration-color: rgba(255, 255, 255, 0.6) !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
  transition: all 0.2s ease !important;
  font-weight: inherit !important;
  letter-spacing: inherit !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.recap-nav-link:hover {
  color: inherit !important;
  text-decoration-color: rgba(255, 255, 255, 0.9) !important;
  text-decoration-thickness: 1.5px !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.recap-nav-link:visited {
  color: inherit !important;
  text-decoration-color: rgba(255, 255, 255, 0.6) !important;
}

/* Summary navigation link styling */
.summary-nav-link {
  color: inherit !important;
  text-decoration: underline !important;
  text-decoration-color: rgba(255, 255, 255, 0.6) !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
  transition: all 0.2s ease !important;
  font-weight: inherit !important;
  letter-spacing: inherit !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.summary-nav-link:hover {
  color: inherit !important;
  text-decoration-color: rgba(255, 255, 255, 0.9) !important;
  text-decoration-thickness: 1.5px !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.summary-nav-link:visited {
  color: inherit !important;
  text-decoration-color: rgba(255, 255, 255, 0.6) !important;
}

/* Dark mode support for navigation links */
@media (prefers-color-scheme: dark) {
  .recap-nav-link,
  .summary-nav-link {
    text-decoration-color: rgba(255, 255, 255, 0.4) !important;
  }
  
  .recap-nav-link:hover,
  .summary-nav-link:hover {
    text-decoration-color: rgba(255, 255, 255, 0.7) !important;
  }
}

/* ============================================================================
   CUSTOM DIVIDER CLASSES FOR RECAP AND SUMMARY COMPONENTS
   ============================================================================ */

/* Recap divider with diamond center */
.recap-divider {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 35%, 
    #d1d5db 40%, 
    #9ca3af 50%, 
    #d1d5db 60%, 
    transparent 65%, 
    transparent 100%) !important;
  margin: 2.5rem 0 !important;
  opacity: 0.7 !important;
  position: relative !important;
}

/* Diamond shape in center */
.recap-divider::before {
  content: '◆' !important;
  position: absolute !important;
  top: -10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  color: #6b7280 !important;
  font-size: 14px !important;
  background: var(--body-bg, #fff) !important;
  padding: 0 10px !important;
  opacity: 1 !important;
  font-weight: bold !important;
  z-index: 10 !important;
}

/* Summary divider with diamond center */
.summary-divider {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 35%, 
    #d1d5db 40%, 
    #9ca3af 50%, 
    #d1d5db 60%, 
    transparent 65%, 
    transparent 100%) !important;
  margin: 2.5rem 0 !important;
  opacity: 0.7 !important;
  position: relative !important;
}

/* Diamond shape in center */
.summary-divider::before {
  content: '◆' !important;
  position: absolute !important;
  top: -10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  color: #6b7280 !important;
  font-size: 14px !important;
  background: var(--body-bg, #fff) !important;
  padding: 0 10px !important;
  opacity: 1 !important;
  font-weight: bold !important;
  z-index: 10 !important;
}

/* Dark mode support for custom dividers */
@media (prefers-color-scheme: dark) {
  .recap-divider,
  .summary-divider {
    background: linear-gradient(90deg, 
      transparent 0%, 
      transparent 35%, 
      #6b7280 40%, 
      #9ca3af 50%, 
      #6b7280 60%, 
      transparent 65%, 
      transparent 100%) !important;
    opacity: 0.6 !important;
  }
  
  .recap-divider::before,
  .summary-divider::before {
    color: #9ca3af !important;
    background: var(--body-bg, #1a202c) !important;
    opacity: 1 !important;
  }
}

/* ============================================================================
   HORIZONTAL RULES FOR RECAP AND SUMMARY COMPONENTS
   ============================================================================ */

/* Old-timey dramatic hr styling for recap and summary components */
.custom-recap hr,
.custom-summary hr {
  border: none !important;
  height: 2px !important;
  width: 80% !important;
  max-width: 600px !important;
  margin: 2.5rem auto !important;
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 20%, 
    #d1d5db 30%, 
    #9ca3af 50%, 
    #d1d5db 70%, 
    transparent 80%, 
    transparent 100%) !important;
  opacity: 0.8 !important;
  position: relative !important;
}

/* Add subtle shadow for depth */
.custom-recap hr::before,
.custom-summary hr::before {
  content: '' !important;
  position: absolute !important;
  top: 1px !important;
  left: 0 !important;
  right: 0 !important;
  height: 1px !important;
  background: linear-gradient(90deg, 
    transparent 0%, 
    transparent 20%, 
    rgba(255, 255, 255, 0.3) 30%, 
    rgba(255, 255, 255, 0.5) 50%, 
    rgba(255, 255, 255, 0.3) 70%, 
    transparent 80%, 
    transparent 100%) !important;
  opacity: 0.6 !important;
}

/* Dark mode support for hr elements */
@media (prefers-color-scheme: dark) {
  .custom-recap hr,
  .custom-summary hr {
    background: linear-gradient(90deg, 
      transparent 0%, 
      transparent 20%, 
      #6b7280 30%, 
      #9ca3af 50%, 
      #6b7280 70%, 
      transparent 80%, 
      transparent 100%) !important;
    opacity: 0.6 !important;
  }
  
  .custom-recap hr::before,
  .custom-summary hr::before {
    background: linear-gradient(90deg, 
      transparent 0%, 
      transparent 20%, 
      rgba(0, 0, 0, 0.2) 30%, 
      rgba(0, 0, 0, 0.3) 50%, 
      rgba(0, 0, 0, 0.2) 70%, 
      transparent 80%, 
      transparent 100%) !important;
  }
}

/* ============================================================================
   RESPONSIVE DESIGN FOR RECAP AND SUMMARY COMPONENTS
   ============================================================================ */

@media (max-width: 768px) {
  blockquote.custom-recap,
  blockquote.custom-summary {
    margin: 2rem 0.8rem !important;
    font-size: 0.9rem !important;
  }
  
  .recap-badge,
  .summary-badge {
    top: -0.5rem !important;
    left: 0.8rem !important;
    padding: 0.3rem 0.6rem !important;
    font-size: 0.8rem !important;
  }
  
  .recap-body,
  .summary-body {
    padding: 1.25rem 1.25rem 1.25rem 1.25rem !important;
  }
}

@media (max-width: 480px) {
  blockquote.custom-recap,
  blockquote.custom-summary {
    margin: 1.5rem 0.5rem !important;
  }
  
  .recap-badge,
  .summary-badge {
    left: 0.5rem !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
  }
  
  .recap-body,
  .summary-body {
    padding: 1rem 1rem 1rem 1rem !important;
  }
}