/* Essential Stories of the Week Carousel Styling */

/* Essential stories title */
.essential-stories-title {
  font-size: 1.25rem;
  font-weight: var(--font-weight-bold);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.essential-stories-title a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.essential-stories-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.essential-stories-title .title-arrow {
  font-size: 1.1em;
  font-style: normal;
}

/* Essential stories wrapper */
.essential-stories-content {
  width: 100%;
  padding: 0;
  padding-top: 10px;
  padding-bottom: 24px;
}

/* Essential stories header with title and controls */
.essential-stories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Essential stories carousel - CSS only implementation */
.essential-stories-grid {
  display: flex;
  overflow-x: scroll;
  overflow-y: hidden;
  gap: 15px;
  margin-top: 10px;
  padding-right: 20px;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.essential-stories-grid:active {
  cursor: grabbing;
}

.essential-stories-grid::-webkit-scrollbar {
  display: none;
}

/* Override article grid styles for carousel items - Instagram story portrait style */
.essential-stories-grid .article-card {
  flex: 0 0 240px;
  min-width: 240px;
  max-width: 240px;
  height: 360px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.3s ease;
  cursor: pointer;
  background: #111;
}

/* Mark read cards as semi-transparent */
.essential-stories-grid .article-card.read {
  opacity: 0.5;
}

.essential-stories-grid .article-card.read:hover {
  opacity: 0.7;
}

/* All cards share identical dimensions */
.essential-stories-grid .article-card:first-child,
.essential-stories-grid .article-card:nth-child(4) {
  flex: 0 0 240px;
  min-width: 240px;
  max-width: 240px;
  height: 360px;
}

/* Hover effect removed for cleaner experience */
/* .essential-stories-grid .article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow);
} */

/* Link fills the entire card */
.essential-stories-grid .article-card-link {
  display: block;
  position: absolute;
  inset: 0;
  text-decoration: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Prevent drag on images */
.essential-stories-grid .article-card-image,
.essential-stories-grid .author-profile-image {
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Image container fills entire card */
.essential-stories-grid .article-card-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 0;
  margin: 0;
  background: transparent; /* override base article-card-content background */
  flex-grow: 0;
}

/* First and fourth cards: override article-cards.css absolute positioning too */
.essential-stories-grid .article-card:first-child .article-card-content,
.essential-stories-grid .article-card:first-of-type .article-card-content,
.essential-stories-grid .article-card:nth-child(4) .article-card-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  padding: 0;
}

/* Image stretches to fill full card */
.essential-stories-grid .article-card-content img,
.essential-stories-grid .article-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0;
  padding: 0;
  min-height: unset;
  max-height: unset;
  aspect-ratio: unset;
}

/* Beat the (0,3,0) specificity rules in article-cards.css that reset
   height/aspect-ratio for first-of-type and nth-child(4) inside .article-grid */
.essential-stories-grid .article-card:first-of-type .article-card-image,
.essential-stories-grid .article-card:nth-child(4) .article-card-image {
  height: 100%;
  aspect-ratio: unset;
  min-height: unset;
  max-height: unset;
  width: 100%;
  object-fit: cover;
  object-position: center;
}

/* Meta overlaid at bottom of card with gradient */
.essential-stories-grid .article-card-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 12px 14px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.4) 60%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 2;
}

/* Title: white over image */
.essential-stories-grid .article-card-title {
  font-size: 1rem;
  line-height: 1.35;
  color: #fff;
  font-weight: var(--font-weight-bold);
  margin-bottom: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

body.dark-mode .essential-stories-grid .article-card-title {
  color: #fff;
}

.essential-stories-grid .article-card-description {
  display: none;
}

/* Comments profile image adjustment for story cards */
.essential-stories-grid .author-profile-container {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 3;
}

.essential-stories-grid .author-profile-image {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Quiz Card Styles */
.essential-stories-grid .quiz-card-content {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #640008 !important;
  width: 100%;
  height: 100%;
}

.quiz-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-card-icon svg {
  width: 60px;
  height: 60px;
  color: white;
  stroke-width: 2;
}

.quiz-card .article-card-description {
  display: block !important;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  margin-top: 4px;
  line-height: 1.3;
}

.essential-stories-grid .quotes-card-content {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff9225 !important;
  width: 100%;
  height: 100%;
}

.quotes-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.quotes-card-icon svg {
  width: 60px;
  height: 60px;
  color: white;
  stroke-width: 2;
}

.quotes-card .article-card-description {
  display: block !important;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  margin-top: 4px;
  line-height: 1.3;
}

/* Quiz / Quotes: no image behind, so use a subtle bottom-fade from card color */
.quiz-card .article-card-meta,
.quotes-card .article-card-meta {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 60%,
    transparent 100%
  );
}

/* Ensure quiz title is white */
.quiz-card .article-card-title,
.quotes-card .article-card-title {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.quotes-compilation-content {
  display: grid;
  gap: 40px;
  margin-top: 16px;
}

.story-quote-item {
  margin: 0;
  padding: 16px 0;
  border: none;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

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

.story-quote-sentence {
  margin: 0 0 12px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.5;
}

.story-quote-mark {
  color: var(--color-comments, var(--color-primary));
  font-size: 1.1rem;
  line-height: 1;
  font-weight: var(--font-weight-bold);
  margin-top: 0;
  flex-shrink: 0;
  opacity: 0.7;
}

.story-quote-text {
  font-size: clamp(0.95rem, 2.2vw, 1.3rem);
  font-weight: var(--font-weight-regular);
  letter-spacing: -0.01em;
  line-height: 1.6;
}

.story-quote-attribution {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  margin-bottom: 0;
}

.story-quote-line {
  width: 24px;
  height: 2px;
  background: var(--color-comments, var(--color-primary));
  border-radius: 999px;
  flex-shrink: 0;
}

.story-quote-attribute {
  display: block;
  font-style: normal;
  font-weight: var(--font-weight-semibold);
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  color: var(--color-text-light);
  margin-bottom: 0;
  letter-spacing: 0.5px;
}

body.dark-mode .story-quote-item {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .story-quote-mark,
body.dark-mode .story-quote-line {
  color: var(--dark-color-comments, var(--dark-color-text));
}

body.dark-mode .story-quote-attribute {
  color: var(--dark-color-text-light);
}

body.dark-mode .story-quote-text {
  color: var(--dark-color-text);
}

body.dark-mode .quotes-compilation-content {
  color: var(--dark-color-text);
}

@media (max-width: 748px) {
  .quotes-compilation-content {
    gap: 32px;
  }

  .story-quote-item {
    padding: 12px 0;
  }

  .story-quote-mark {
    font-size: 1rem;
  }

  .story-quote-attribution {
    margin-left: 0;
  }

  .story-quote-line {
    width: 20px;
    height: 2px;
  }
}

/* Responsive adjustments */
@media (max-width: 1150px) {
  .essential-stories-grid .article-card {
    flex: 0 0 210px;
    min-width: 210px;
    max-width: 210px;
    height: 350px;
  }

  /* Ensure first and fourth cards maintain consistency */
  .essential-stories-grid .article-card:first-child,
  .essential-stories-grid .article-card:nth-child(4) {
    flex: 0 0 210px;
    min-width: 210px;
    max-width: 210px;
    height: 350px;
  }
}

@media (max-width: 748px) {
  .essential-stories-grid .article-card {
    flex: 0 0 180px;
    min-width: 180px;
    max-width: 180px;
    height: 310px;
  }

  /* Ensure first and fourth cards maintain consistency */
  .essential-stories-grid .article-card:first-child,
  .essential-stories-grid .article-card:nth-child(4) {
    flex: 0 0 180px;
    min-width: 180px;
    max-width: 180px;
    height: 310px;
  }

  .essential-stories-grid .article-card-meta {
    padding: 30px 8px 10px;
  }

  .essential-stories-grid .article-card-title {
    font-size: 1rem;
  }
}

@media (max-width: 600px) {
  .essential-stories-grid .article-card {
    flex: 0 0 170px;
    min-width: 170px;
    max-width: 170px;
    height: 290px;
  }

  /* Ensure first and fourth cards maintain consistency */
  .essential-stories-grid .article-card:first-child,
  .essential-stories-grid .article-card:nth-child(4) {
    flex: 0 0 170px;
    min-width: 170px;
    max-width: 170px;
    height: 290px;
  }

  .essential-stories-title {
    font-size: 1.25rem;
  }

  .essential-stories-grid .article-card-meta {
    padding: 30px 8px 10px;
  }
}

/* =====================================
   ESSENTIAL STORY VIEW (Instagram-style)
   ===================================== */

/* Story container - fullscreen overlay feel */
.essential-story-view {
  min-height: 100vh;
  background-color: var(--color-background);
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  padding: 0;
  font-family: var(--font-family-primary);
  overflow: hidden;
  /* Performance optimizations for smooth swipe */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  touch-action: pan-y pinch-zoom;
  /* Ensure proper positioning */
  transform-origin: center center;
}

/* On mobile, reset the transform so that position:fixed descendants
   (e.g. .story-progress-bar) are anchored to the viewport, not this element.
   The GPU-compositing hint (translateZ) is only needed for desktop swipe. */
@media (max-width: 748px) {
  .essential-story-view {
    transform: none;
    -webkit-transform: none;
    will-change: auto;
  }
}

.essential-story-view.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* Top Control Bar - inline above content */
.story-controls {
  border-bottom: var(--border-thin-light);
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  box-sizing: border-box;
  gap: 12px;
}

/* Jump-to dropdown trigger — grey boxy button */
.story-controls .story-nav-menu {
  position: relative;
}

.story-controls .story-nav-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  padding: 5px 10px;
  user-select: none;
  white-space: nowrap;
}

body.dark-mode .story-controls .story-nav-summary {
  background: var(--dark-bg);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--dark-color-text);
}

.story-controls .story-nav-summary::-webkit-details-marker {
  display: none;
}

.story-controls .story-nav-summary:hover {
  background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .story-controls .story-nav-summary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.story-nav-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, 80vw);
  background: var(--color-background);
  border: var(--border-thin-light);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  z-index: 2000;
  display: grid;
  gap: 8px;
  max-height: 60vh;
  overflow: auto;
}

.story-nav-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.story-nav-link {
  display: block;
  color: var(--color-text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 8px;
}

.story-nav-link:hover {
  background: rgba(0, 0, 0, 0.06);
}

.story-nav-link.is-current {
  font-weight: var(--font-weight-bold);
  background: rgba(0, 0, 0, 0.08);
}

.story-nav-link-terminal {
  font-weight: var(--font-weight-semibold);
}

body.dark-mode .story-nav-panel {
  background: var(--dark-color-background);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

body.dark-mode .story-nav-link {
  color: var(--dark-color-text);
}

body.dark-mode .story-nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .story-nav-link.is-current {
  background: rgba(255, 255, 255, 0.12);
}

/* Next Story Preview */
.next-story-preview,
.current-story-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  overflow: hidden;
  width: 100%;
}

.next-story-label {
  font-size: 14px;
  color: var(--color-text);
  letter-spacing: 0.3px;
  font-weight: var(--font-weight-semibold);
  text-transform: none;
}

.next-story-title-wrapper {
  width: 100%;
  position: relative;
  line-height: 1.3;
}

.next-story-title {
  display: block;
  font-size: 12px;
  font-weight: var(--font-weight-normal);
  font-family: var(--font-family-primary);
  color: var(--color-text);
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Remove old animation styles */
.next-story-title::after {
  display: none;
}

.story-control-btn {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--color-text);
  cursor: pointer;
  padding: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 4px;
  font-size: var(--font-size-md);
  text-decoration: none;
  flex-shrink: 0;
}

.story-control-btn:hover:not([disabled]) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-background);
}

.story-control-btn:active:not([disabled]) {
  transform: scale(0.98);
}

.story-control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.story-control-btn svg {
  width: 16px;
  height: 16px;
}

/* Navigation button text and icons */
.story-nav-btn .nav-btn-text {
  display: none;
}

.story-nav-btn .nav-btn-icon {
  display: block;
  width: 16px;
  height: 16px;
}

/* Make next button stand out on mobile too */
#story-next:not([disabled]) {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-background);
}

#story-next:not([disabled]):hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* Show text on larger screens */
@media (min-width: 749px) {
  .story-nav-btn {
    width: auto;
    min-width: 90px;
    padding: 10px 20px;
    gap: 8px;
    height: auto;
    border-radius: 6px;
    font-family: var(--font-family-primary);
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
  }

  .story-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .story-nav-btn .nav-btn-text {
    display: inline;
    font-size: 14px;
    font-weight: var(--font-weight-medium);
    text-transform: capitalize;
  }

  .story-nav-btn .nav-btn-icon {
    display: none;
  }

  .story-nav-btn:hover:not([disabled]) {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .story-nav-btn:active:not([disabled]) {
    transform: translateY(0);
    box-shadow: none;
  }

  /* Make next button stand out with black background */
  #story-next:not([disabled]) {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-background);
  }

  #story-next:not([disabled]):hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-background);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
}

/* Close button styling */
.story-close-btn {
  color: var(--color-text);
  border-color: rgba(0, 0, 0, 0.1);
  font-size: 1.2rem;
  font-weight: normal;
  line-height: 1;
}

.story-close-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-background);
}

/* Story content wrapper */
.story-content-wrapper {
  flex: 1;
  overflow-y: auto;
  margin-top: 0;
  position: relative;
  z-index: 2;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  transform: translateX(0);
  opacity: 1;
}

.story-content-wrapper--no-nav {
  padding-top: var(--spacing-lg, 2rem);
}

.story-content-wrapper.is-dragging {
  cursor: grabbing;
  user-select: none;
}

/* Story category badge - positioned above title */
.story-category-badge {
  background-color: var(--color-primary);
  color: var(--color-background);
  padding: var(--spacing-xs) var(--spacing-sm);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: bold;
  border: var(--border-thin);
  display: inline-block;
  margin-bottom: var(--spacing-md);
}

a.story-category-badge:hover {
  background-color: var(--color-primary);
  color: var(--color-background);
  opacity: 1;
}

/* Story title - matching post-title from single pages */
.story-title {
  font-size: var(--font-size-post-title);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  color: var(--color-heading);
  margin-top: 0;
}

/* Story date - using border instead of hr */
.story-date {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  display: block;
  padding-bottom: 10px;
  border-bottom: var(--border-thin-light);
  font-weight: var(--font-weight-extrabold);
  font-style: italic;
  margin-bottom: 20px;
  margin-top: 10px;
}

/* Story image */
.story-image-container {
  width: 100%;
  margin: 20px 0;
}

.story-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0; /* No border radius as requested */
  border: var(--border-thin);
}

.story-image-credit {
  font-size: var(--font-size-xs);
  color: var(--color-text-credit);
  font-style: italic;
  margin-top: 8px;
  display: block;
}

/* Reading features bar in story view */
/* Override sidebar absolute positioning from layout.css — story view has no left column */
.essential-story-view .story-reading-features.sidebar-item {
  position: static;
  width: 100%;
  left: auto;
  top: auto;
  padding-top: 0;
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  box-sizing: border-box;
}

/* Also reset the reading-features-container flex set by layout.css */
.essential-story-view .story-reading-features.reading-features-container {
  display: block;
}

@media (max-width: 748px) {
  .story-reading-features {
    display: none;
  }
}

/* Story content text - matching post-description and post-content */
.story-content {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-paragraph);
  color: var(--color-text);
  margin-top: 20px;
  font-weight: var(--font-weight-medium);
}

/* Remove drop cap inherited from drop-cap.css */
.story-content.post-content > p:first-of-type::first-letter {
  all: unset;
}

.story-content p {
  margin-bottom: var(--margin-paragraph);
}

/* Drop cap removed for essential stories */
/* .story-content p:first-of-type::first-letter {
  font-size: 3.5em;
  line-height: 0.9;
  float: left;
  margin: 0.1em 0.1em 0 0;
  font-weight: var(--font-weight-bold);
} */

/* Swipe Indicator - shown on all devices */
.story-swipe-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  margin-top: 40px;
  color: var(--color-text-light);
  font-size: var(--font-size-md);
  text-align: center;
  user-select: none;
  transition: opacity 0.3s ease;
}

.swipe-animation {
  display: flex;
  align-items: center;
  animation: swipeHint 2s ease-in-out infinite;
}

@keyframes swipeHint {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.5;
  }
  50% {
    transform: translateX(20px);
    opacity: 1;
  }
}

.story-swipe-indicator svg {
  color: var(--color-primary);
}

/* Story progress indicators at bottom - large circles */
.story-progress-bar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  justify-content: center;
  align-items: center;
  background: var(--color-background);
  border-top: var(--border-thin-light);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  transform: none;
  max-width: none;
  width: 100vw;
  z-index: 2000;
  box-sizing: border-box;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

/* Center progress bar on desktop/tablet and remove sticky behavior */
@media (min-width: 749px) {
  .story-progress-bar {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
  }
}

/* Preview containers for swipe navigation */
.story-preview-left,
.story-preview-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  max-width: 700px;
  background: var(--color-background);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1;
  overflow: hidden;
}

.story-preview-left {
  right: 100%;
}

.story-preview-right {
  left: 100%;
}

.story-preview-left.active,
.story-preview-right.active {
  opacity: 0.3;
}

.story-preview-content {
  width: 100%;
  height: 100%;
  padding: 20px;
  overflow: hidden;
}

body.dark-mode .story-preview-left,
body.dark-mode .story-preview-right {
  background: var(--dark-color-background);
}

/* Navigation buttons in bottom bar */
.story-nav-btn {
  width: 44px;
  height: 44px;
  padding: 4px;
  flex-shrink: 0;
}

.story-nav-btn svg {
  width: 22px;
  height: 22px;
}

/* Progress segments container */
.story-progress-segments {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.story-progress-segment {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: transparent;
  border: 2px solid var(--color-text);
  position: relative;
  transition: all 0.3s ease;
}

.dark-mode .story-progress-segment {
  border-color: var(--dark-color-text-light);
}

.story-progress-segment.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.story-progress-segment.past {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.dark-mode .story-progress-segment.active,
.dark-mode .story-progress-segment.past {
  background-color: var(--dark-color-text);
  border-color: var(--dark-color-text);
}

/* Responsive adjustments for story view */
@media (max-width: 1150px) {
  .story-controls {
    padding: 6px 0;
  }

  .story-control-btn {
    width: 34px;
    height: 34px;
    font-size: var(--font-size-sm);
  }

  .story-controls-left,
  .story-controls-right {
    gap: 6px;
  }

  .next-story-preview,
  .current-story-preview {
    min-width: 160px;
  }

  .next-story-title {
    font-size: 12px;
  }

  .next-story-title-wrapper {
    height: 17px;
  }
}

@media (max-width: 748px) {
  .story-controls {
    padding: 6px 0;
  }

  .story-control-btn {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm);
  }

  .story-control-btn svg {
    width: 14px;
    height: 14px;
  }

  .story-nav-btn {
    width: 44px;
    height: 44px;
  }

  .story-nav-btn svg {
    width: 22px;
    height: 22px;
  }

  .next-story-preview,
  .current-story-preview {
    max-width: 100%;
    min-width: 140px;
  }

  .next-story-label {
    font-size: 9px;
  }

  .next-story-title {
    font-size: 11px;
  }

  .next-story-title-wrapper {
    height: 16px;
  }

  .story-controls-left,
  .story-controls-right {
    gap: 6px;
  }

  .story-title {
    font-size: calc(var(--font-size-post-title) * 0.8);
  }

  .story-content {
    font-size: var(--font-size-md);
  }

  .story-progress-segment {
    width: 10px;
    height: 10px;
  }

  .story-content-wrapper {
    padding: 0 0 65px 0;
  }

  .story-progress-bar {
    padding: 8px 16px;
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .story-controls {
    padding: 4px 0;
  }

  .story-control-btn {
    width: 30px;
    height: 30px;
  }

  .story-control-btn svg {
    width: 13px;
    height: 13px;
  }

  .story-nav-btn {
    width: 40px;
    height: 40px;
  }

  .story-nav-btn svg {
    width: 20px;
    height: 20px;
  }

  .next-story-preview,
  .current-story-preview {
    max-width: 100%;
    min-width: 100px;
  }

  .next-story-label {
    font-size: 7px;
  }

  .next-story-title {
    font-size: 9px;
  }

  .next-story-title-wrapper {
    height: 14px;
  }

  .story-controls-left,
  .story-controls-right {
    gap: 3px;
  }

  .story-content-wrapper {
    padding: 0 0 62px 0;
  }

  .story-progress-segment {
    width: 8px;
    height: 8px;
  }

  .story-progress-bar {
    padding: 6px 12px;
    gap: 6px;
  }
}

/* Dark mode support for story view */
.dark-mode .essential-story-view {
  background-color: var(--dark-color-background);
}

.dark-mode .story-control-btn {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--dark-color-text);
  background: rgba(255, 255, 255, 0.05);
}

.dark-mode .story-control-btn:hover:not([disabled]) {
  background: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
  color: var(--dark-color-background);
}

.dark-mode #story-next:not([disabled]) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--dark-color-text);
}

.dark-mode #story-next:not([disabled]):hover {
  background: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
  color: var(--dark-color-background);
}

.dark-mode #story-prev:not([disabled]) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--dark-color-text);
}

.dark-mode #story-prev:not([disabled]):hover {
  background: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
  color: var(--dark-color-background);
}

.dark-mode .story-close-btn {
  color: var(--dark-color-text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.dark-mode .story-close-btn:hover {
  background: var(--dark-color-primary);
  border-color: var(--dark-color-primary);
  color: var(--dark-color-background);
}

.dark-mode .next-story-label {
  color: var(--dark-color-text-light);
}

.dark-mode .next-story-title {
  color: var(--dark-color-text);
}

.dark-mode .story-title {
  color: var(--dark-color-heading);
}

.dark-mode .story-date {
  color: var(--dark-color-text-date);
  border-bottom: var(--dark-border-thin-light);
}

.dark-mode .story-content {
  color: var(--dark-color-text);
}

.dark-mode .story-image {
  border: var(--dark-border-thin-light);
}

.dark-mode .story-image-credit {
  color: var(--dark-color-text-credit);
}

.dark-mode .story-swipe-indicator {
  color: var(--dark-color-text-light);
}

.dark-mode .story-swipe-indicator svg {
  color: var(--dark-color-primary);
}

/* Comprehensive dark mode support for Essential Story View */
body.dark-mode .essential-story-view {
  background-color: #292828;
  color: #e0e0e0;
}

body.dark-mode .story-content-wrapper {
  background-color: #292828;
}

body.dark-mode .story-title {
  color: #ffffff;
}

body.dark-mode .story-date {
  color: #ffffff;
  border-color: #404040;
}

body.dark-mode .story-content,
body.dark-mode .story-content p,
body.dark-mode .story-content div,
body.dark-mode .story-content li,
body.dark-mode .story-content span {
  color: #e0e0e0;
}

body.dark-mode .story-content h1,
body.dark-mode .story-content h2,
body.dark-mode .story-content h3 {
  color: #ffffff;
}

body.dark-mode .story-content h4,
body.dark-mode .story-content h5,
body.dark-mode .story-content h6 {
  color: #e0e0e0;
}

body.dark-mode .story-content a {
  color: #d42b63;
}

body.dark-mode .story-content a:hover {
  color: #88c5ff;
}

body.dark-mode .story-image {
  border-color: #404040;
}

body.dark-mode .story-image-credit {
  color: #b0b0b0;
}

body.dark-mode .story-category-badge {
  background-color: rgb(187, 0, 0);
  color: #ffffff;
  border-color: #404040;
}

body.dark-mode .story-controls {
  background-color: var(--dark-bg);
  border-color: #404040;
}

body.dark-mode .story-control-btn {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .story-control-btn:hover:not(:disabled) {
  background-color: var(--dark-color-primary, #d42b63);
  border-color: var(--dark-color-primary, #d42b63);
  color: #ffffff;
}

body.dark-mode .story-progress-bar {
  background-color: var(--dark-bg);
  border-color: #404040;
}

body.dark-mode .story-swipe-indicator {
  color: #cccccc;
}

/* Dark mode for markdown elements in story content */
body.dark-mode .story-content blockquote {
  background-color: var(--dark-bg);
  border-color: #404040;
  color: #e0e0e0;
}

body.dark-mode .story-content blockquote p {
  color: #e0e0e0;
}

body.dark-mode .story-content pre,
body.dark-mode .story-content code {
  background-color: #242424;
  color: #e0e0e0;
  border-color: #404040;
}

body.dark-mode .story-content table {
  border-color: #404040;
}

body.dark-mode .story-content th,
body.dark-mode .story-content td {
  border-color: #333333;
  color: #e0e0e0;
}

body.dark-mode .story-content th {
  background-color: #242424;
  color: #ffffff;
}

body.dark-mode .story-content hr {
  border-color: #333333;
}

body.dark-mode .story-content strong,
body.dark-mode .story-content b {
  color: #ffffff;
}

body.dark-mode .story-content em,
body.dark-mode .story-content i {
  color: #e0e0e0;
}

/* Ensure markdown-body styling applies */
body.dark-mode .story-content.markdown-body {
  color: #e0e0e0;
}

body.dark-mode .story-content.markdown-body a {
  color: #d42b63;
}

body.dark-mode .story-content.markdown-body a:hover {
  color: #88c5ff;
}

/* Dark mode for quotes view */
body.dark-mode .quotes-view {
  background-color: #292828;
}

body.dark-mode .quotes-view .story-category-badge {
  background-color: rgb(187, 0, 0);
  color: #ffffff;
  border-color: #404040;
}

body.dark-mode .quotes-view .story-title {
  color: #ffffff;
}

body.dark-mode .quotes-view .story-date {
  color: #ffffff;
  border-color: #404040;
}

/* Preload hint for next story */
.preload-next-story {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
