/* ==========================================================================
   RobertJMcCarter.com - Static Site Stylesheet
   rjm-static.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   DESIGN TOKENS & CSS VARIABLES
   -------------------------------------------------------------------------- */
:root {
  /* Brand & Neutral Colors */
  --color-primary: #2240b3;
  --color-primary-light: rgb(68, 146, 201);
  --color-primary-dark: #162a75;
  --color-accent: #3b5998;
  --color-accent-hover: #0056b3;
  --color-text: #555;
  --color-text-dark: #0c1115;
  --color-text-muted: #718096;
  --color-bg: #ffffff;

  /* Navigation Theme Colors */
  --color-nav-bg: #eff0fb;
  --color-nav-hover-bg: #1d4ed8;
  --color-nav-hover-text: #bfdbfe;
  --color-nav-dropdown-bg: #d6d9fa;
  --color-nav-dropdown-hover: #ffffff;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;

  /* Layout */
  --container-max-width: 1080px;
}

/* --------------------------------------------------------------------------
     GLOBAL STYLES & TYPOGRAPHY
     -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.7;
}

p {
  margin-bottom: 24px;
}

/* Headings */
h1,
h2,
h3 {
  font-family: var(--font-sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1.2;
  color: var(--color-primary);
}

h1 {
  font-size: 35px;
  border-bottom: 1px solid var(--color-primary);
  padding-bottom: 12px;
  margin-bottom: 25px;
}

.book-title {
  border-bottom: 1px solid var(--color-primary);
  padding-bottom: 12px;
  margin-bottom: 25px;
}

.book-title h1 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
  line-height: 1;
}

.book-title h2 {
  font-style: italic;
  margin-top: 0.5rem;
}

h2 {
  font-size: 27px;
  margin-top: 15px;
  margin-bottom: 5px;
}

h3 {
  font-size: 22px;
  margin-top: 15px;
  margin-bottom: 3px;
}

/* Paragraph Links */
p a {
  color: var(--color-primary);
  text-decoration: underline;
  transition: color var(--transition-normal);
}

p a:hover {
  color: var(--color-primary-dark);
}

/* --------------------------------------------------------------------------
     LAYOUT STRUCTURE
     -------------------------------------------------------------------------- */
#wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  min-height: 100vh;
}

#content {
  margin: 0 15px;
  position: relative;
  flex: 1 0 auto;
}

.main-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
}

/* Grid Layout / Rows and Columns */
.responsive-row {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}

.responsive-col-300 {
  flex: 0 0 300px;
  /* Grow to fill space, shrink if needed, but aim for 300px base */
}

.responsive-col {
  flex: 1 1;
  /* Grow to fill space, shrink if needed, but aim for 300px base */
}

/* --------------------------------------------------------------------------
     NAVIGATION MENU
     -------------------------------------------------------------------------- */
.gen-nav,
#gen-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-nav-bg);
  min-height: 52px;
  border-radius: 8px;
  border: 0 solid #1e3a8a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  padding: 0 16px;
  margin-bottom: 0;
  position: relative;
  flex-wrap: nowrap;
  font-family: var(--font-sans);
}

.gen-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: auto;
  height: 36px;
}


/* Author Branding inside Nav */
.gen-author-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-right: auto;
  margin-left: 15px;
  font-family: var(--font-sans);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gen-author-name a,
.gen-author-name a:visited {
  color: #0101fb !important;
  text-decoration: none;
}

.gen-author-name a:hover {
  text-decoration: underline;
}

/* Hamburger Icon (Mobile Trigger) */
.gen-hamburger,
#gen-ham {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
}

.gen-hamburger span,
#gen-ham span {
  display: block;
  background: var(--color-text-dark);
  transition: all var(--transition-slow);
  width: 22px;
  height: 3px;
  border-radius: 2px;
  margin: 2.5px 0;
}

/* Menu List Layout */
.gen-nav>ul,
#gen-menu {
  display: flex;
  justify-content: center;
  flex: 1;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gen-nav>li,
#gen-menu li {
  position: relative;
  padding: 0;
  padding-inline-start: 0 !important;
  margin-left: 0 !important;
}

.gen-nav>ul>li,
#gen-menu>li {
  position: relative;
}

/* Navigation Links */
.gen-nav>ul>li>a,
#gen-menu>li>a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
  height: 52px;
  color: var(--color-text-dark);
  font-size: 16px;
  font-weight: 500;
  text-transform: none;
  text-decoration: none;
  transition: background var(--transition-normal),
    color var(--transition-normal);
  white-space: nowrap;
}

.gen-nav>ul>li>a:hover,
.gen-nav>ul>li:hover>a,
#gen-menu>li>a:hover,
#gen-menu>li:hover>a {
  background: var(--color-nav-hover-bg);
  color: var(--color-nav-hover-text) !important;
  border-radius: 4px;
  transition: background-color var(--transition-normal);
}

.gen-arrow {
  font-size: 0.7em;
  opacity: 0.8;
  vertical-align: middle;
}

/* Navigation Dropdown List */
.gen-nav>ul>li>ul,
#gen-menu li>ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-nav-dropdown-bg);
  min-width: 170px;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 1000;
  overflow: hidden;

  /* Drop list item dots and remove default browser left indent */
  list-style: none !important;
  list-style-type: none !important;
  padding-left: 0 !important;
  margin: 0 !important;
}

.gen-nav>ul>li:hover>ul,
#gen-menu li:hover>ul {
  display: block;
}

.gen-nav>ul>li>ul>li>a,
#gen-menu li>ul>li>a {
  display: block;
  padding: 10px 18px;
  color: var(--color-text-dark);
  font-size: 14px;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.gen-nav>ul>li>ul>li>a:hover,
#gen-menu li>ul>li>a:hover {
  background: var(--color-nav-hover-bg);
  color: var(--color-nav-dropdown-hover) !important;
}

.gen-nav>ul>li>ul>li:last-child,
.gen-nav>ul>li>ul>li:last-child>a,
#gen-menu li>ul>li:last-child,
#gen-menu li>ul>li:last-child>a {
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
     FOOTER
     -------------------------------------------------------------------------- */
.rjm-footer {
  background-color: var(--color-nav-bg);
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.18);
  margin: 0 !important;
  margin-top: auto !important;
  padding: 15px 16px !important;
  flex-shrink: 0;
  width: 100%;
  text-align: center;
}

.rjm-footer-newsletter {
  text-align: center;
  font-size: 16px;
  margin: 0;
  margin-bottom: 0.75em;
}

.rjm-footer-newsletter a {
  text-decoration: underline;
}

.rjm-footer-social {
  text-align: center;
  font-size: 16px;
  margin: 0;
  margin-bottom: 1em;
}

.rjm-footer-social a {
  text-decoration: underline;
}

.rjm-footer-social .separator {
  margin: 0 0.35em;
  display: inline-block;
}

.rjm-footer p {
  padding-top: 5px;
  padding-bottom: 0;
  font-size: 16px;
  margin: 0;
  text-align: center;
}

/* --------------------------------------------------------------------------
     CONTENT LIST STYLING
     -------------------------------------------------------------------------- */
.main-container ul,
.main-container ol {
  margin: 0 0 1rem 0 !important;
  padding-left: 1.75rem !important;
  list-style-position: outside !important;
  display: block !important;
}

.main-container li {
  margin-top: 0 !important;
  margin-bottom: 0.35rem !important;
  padding: 0 !important;
  line-height: 1.4 !important;
  height: auto !important;
}

.main-container ul {
  list-style-type: disc !important;
}

.main-container ol {
  list-style-type: decimal !important;
}

.main-container li a,
.main-container li a:link,
.main-container li a:visited {
  font-size: 1rem !important;
  display: inline !important;
  color: var(--color-accent) !important;
  text-decoration: underline !important;
}

.main-container li a:hover {
  color: var(--color-accent-hover) !important;
}

/* --------------------------------------------------------------------------
     CONTACT FORM COMPONENT
     -------------------------------------------------------------------------- */
.contact-form {
  max-width: 550px;
  margin: 2rem 0;
  font-family: var(--font-sans);
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.form-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: var(--color-bg);
  box-sizing: border-box;
  transition: border-color var(--transition-normal),
    box-shadow var(--transition-normal);
}

.form-textarea {
  resize: vertical;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.form-submit {
  display: inline-block;
  background-color: #0201ff;
  color: var(--color-bg);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color var(--transition-normal);
}

.form-submit:hover {
  background-color: #111;
}

.form-submit:active {
  transform: translateY(1px);
}

/* --------------------------------------------------------------------------
     BOOK PROMO & STORIES PORTAL COMPONENTS
     -------------------------------------------------------------------------- */
.story-header {
  border-bottom: 1px solid var(--color-primary);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.story-header h1 {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.promo-cover-art {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  max-width: 100%;
  /* Ensures it doesn't overflow the column */
}

.promo-cover-art--missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 2 / 3;
  min-height: 180px;
  background: #1f242d;
  border: 2px dashed #f59e0b;
  color: #f59e0b;
  padding: 1rem;
  text-align: center;
  box-sizing: border-box;
}

.promo-cover-art--missing .missing-icon {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.promo-cover-art--missing .missing-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fbbf24;
}

.promo-cover-art--missing .missing-slug {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.25rem;
  word-break: break-word;
  line-height: 1.2;
}

.book-blurb,
.book-review {
  margin: 0;
  line-height: 1.5;
  color: #4a4a4a;
}

.book-review {
  margin-top: 1.5rem;
  border-bottom: 1px solid var(--color-primary);
}

.book-blurb>h2 {
  margin-top: 0;
}

.story-by {
  padding-top: 4px;
  font-size: 18px;
}

.story-chapter {
  padding-top: 4px;
  font-size: 26px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-primary);
}

.publish-date,
.publish-in {
  margin-top: 0px;
  font-size: 13px;
  color: #4e7fb4;
  padding-top: 2px;
  padding-bottom: 2px;
}

.story-by,
.publish-date,
.publish-in,
.story-chapter {
  margin: 0;
  border-left: 20px solid var(--color-nav-bg);
  padding-left: 5px;
}

/* Scrollable Stories Portal List */
.stories-portal-component {
  margin: 2rem 0;
  width: 100%;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background-color: var(--color-bg);
  box-sizing: border-box;
  overflow: hidden;
}

.portal-header {
  display: flex;
  align-items: center;
  background-color: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1rem;
  font-weight: 600;
  color: #4a5568;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  box-sizing: border-box;
  height: 38px;
}

.portal-scroll-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  max-height: 380px;
  overflow-y: auto !important;
  overflow-x: hidden;
}

.portal-item-row {
  display: flex !important;
  align-items: center !important;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 !important;
  margin: 0 !important;
  list-style-type: none !important;
  box-sizing: border-box;
  background-color: var(--color-bg);
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
}

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

.hdr-title,
.cell-title {
  flex: 0 0 55%;
  width: 55%;
  padding-left: 1rem;
}

.hdr-date,
.cell-date {
  flex: 0 0 25%;
  width: 25%;
  padding-left: 1rem;
}

.hdr-status,
.cell-status {
  flex: 0 0 20%;
  width: 20%;
  padding-left: 1rem;
}

.item-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  height: 100%;
}

.cell-date {
  color: var(--color-text-muted);
}

.story-portal-link {
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  color: #2b6cb0;
}

.story-portal-link:hover {
  text-decoration: underline;
}

/* Portal Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  line-height: 1;
  font-family: inherit;
}

.badge.status-full {
  background-color: #c6f6d5 !important;
  color: #22543d !important;
}

.badge.status-excerpt {
  background-color: #feebc8 !important;
  color: #744210 !important;
}

.no-stories {
  display: block;
  text-align: center;
  color: #a0aec0;
  padding: 2rem !important;
  height: auto !important;
}

/* --------------------------------------------------------------------------
     PRAISE & TESTIMONIAL WIDGET
     -------------------------------------------------------------------------- */
.praise-section {
  max-width: 1100px !important;
  margin: 1rem auto !important;
  padding: 1rem 1rem !important;
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
  font-family: var(--font-sans) !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.02),
    0 4px 6px -4px rgba(0, 0, 0, 0.02) !important;

  container-type: inline-size;
  container-name: testimonial-container;
}

.praise-heading {
  text-align: center !important;
  margin: 0 0 1.5rem 0 !important;
  letter-spacing: -0.025em !important;
  text-transform: uppercase !important;
}

/* Individual Cards */
html body .praise-section blockquote.testimonial-card {
  position: relative !important;
  display: block !important;
  background: var(--color-bg) !important;
  border-top: none !important;
  border-right: none !important;
  border-bottom: none !important;
  border-left: 4px solid #2563eb !important;
  padding: 1rem !important;
  margin: 0 !important;
  border-radius: 0 8px 8px 0 !important;
  box-sizing: border-box !important;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.02) !important;
}

html body .praise-section blockquote.featured-card {
  border-left-color: #10b981 !important;
  margin-bottom: 1.5rem !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Card Typography */
.praise-section .testimonial-text {
  font-family: var(--font-sans) !important;
  font-size: 1.125rem !important;
  line-height: 1.6 !important;
  color: #374151 !important;
  margin: 0 0 1.25rem 0 !important;
  padding: 0 !important;
}

.praise-section .featured-card .testimonial-text {
  font-size: 1.35rem !important;
  font-weight: 500 !important;
  color: #111827 !important;
}

.praise-section .testimonial-attribution {
  display: block !important;
  font-family: var(--font-sans) !important;
  font-style: normal !important;
  font-size: 0.95rem !important;
  color: #6b7280 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* This rule only triggers when the sidebar/container is narrow */
@container testimonial-container (max-width: 500px) {
  .testimonial-grid {
    flex-direction: column !important;
  }

  .testimonial-grid .testimonial-card {
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   HISTORICAL READER COMMENTS SECTION
   -------------------------------------------------------------------------- */
.comment-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 3rem 0 2rem 0;
}

.historical-comments {
  margin-top: 2rem;
  margin-bottom: 3rem;
  font-family: var(--font-sans);
}

.historical-comments h3 {
  font-size: 22px;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* Specificity override chain to lift comments out of global list styling */
html body #wrapper #content .main-container ul.comment-thread-list,
html body #wrapper #content .main-container ol.comment-thread-list {
  list-style: none !important;
  list-style-type: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
}

html body #wrapper #content .main-container ol.comment-thread-list li.comment-node {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 1.25rem 1.5rem !important;
  margin-top: 0 !important;
  margin-bottom: 1.25rem !important;
  list-style-type: none !important;
  display: block !important;
  height: auto !important;
  line-height: inherit !important;
}

.comment-metadata {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: #4a5568;
  border-bottom: 1px solid #edf2f7;
  padding-bottom: 0.5rem;
}

.comment-author {
  font-weight: 600;
  color: #2d3748;
}

.comment-timestamp {
  color: #718096;
  margin-left: 0.25rem;
}

.comment-body {
  font-size: 1rem;
  line-height: 1.6;
  color: #2d3748;
}

.comment-body p {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   UTILITY CLASSES
   -------------------------------------------------------------------------- */
.alignleft {
  float: left;
  margin-right: 15px;
  margin-bottom: 10px;
}

.alignright {
  float: right;
  margin-left: 15px;
  margin-bottom: 10px;
}

.center,
.button-group {
  display: flex;
  justify-content: center;
  /* Centers horizontally */
  align-items: center;
  /* Centers vertically */
}

.button-group {
  margin-top: 10px;
}

/* ==========================================================================
   POST FEEDS, CARDS & UTILITY POST LAYOUTS
   ========================================================================== */
.post-content .alignright,
.post-content figure.alignright {
  float: right;
  margin: 0 0 1.5rem 1.5rem;
}

.post-content .alignleft,
.post-content figure.alignleft {
  float: left;
  margin: 0 1.5rem 1.5rem 0;
}

.post-content .aligncenter,
.post-content figure.aligncenter {
  display: block;
  margin: 1.5rem auto;
  text-align: center;
}

.post-content img {
  max-width: 100% !important;
  height: auto !important;
}

.post-content::after {
  content: "";
  display: table;
  clear: both;
}

.post-meta {
  font-size: 1rem;
  margin-top: 5px;
  color: grey;
}

.post-header-group {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.post-title {
  font-size: 2.5rem;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.post-meta-panel {
  background-color: #f7fafc;
  border-left: 4px solid #cbd5e0;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  font-size: 1rem;
  color: #4a5568;
  line-height: 1.5;
}

.meta-line {
  margin-bottom: 0.35rem;
}

.meta-taxonomies {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.meta-label {
  font-weight: 600;
  color: #718096;
  margin-right: 0.25rem;
}

.meta-separator {
  color: #e2e8f0;
  margin: 0 0.5rem;
  font-weight: 300;
}

.meta-link-item {
  color: #2b6cb0;
  text-decoration: none;
  font-weight: 500;
}

.meta-link-item:hover {
  text-decoration: underline;
  color: #1a4373;
}

/* Post Cards Grid Structure */
.post-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin-top: 1rem;
}

.post-card-item {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  /* Prevents columns from wrapping or squishing */
  gap: 2.5rem !important;
  align-items: center !important;
  padding-bottom: 0rem;
  border-bottom: 1px solid #edf2f7;
  width: 100% !important;
}

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

/* 1. Rigidly lock the cover image frame dimension requirements */
.card-image-wrapper {
  display: block !important;
  flex: 0 0 200px !important;
  /* Strict allocation: Do not grow, do not shrink, stay 280px */
  width: 200px !important;
  min-width: 200px !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 140px !important;
  max-height: 100% !important;
  overflow: hidden !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
}

/* 2. Anchor box sizing compliance link */
.card-image-wrapper>a {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* 3. Direct image node rules targeting inside the card context */
.card-image-wrapper img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  /* Crops and fills the 280x140 boundary box perfectly */
  object-position: center center !important;
  transition: transform 0.25s ease !important;
}

.card-image-wrapper img:hover {
  transform: scale(1.03) !important;
}

/* 4. Allow text column to scale out across the remaining width */
.card-content-wrapper {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  /* Keeps text nodes inside safe boundaries */
}

.card-title {
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.card-title a {
  text-decoration: none;
}

.card-title a:hover {
  color: #2b6cb0;
}

.card-meta {
  font-size: 0.9rem;
  color: #647794;
  margin-bottom: 0.85rem;
  line-height: 1.4;
  background-color: #f7fafc;
  padding: 5px;
}

.card-read-more a {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  font-weight: 700;
  border-top: 1px solid grey;
  border-bottom: 1px solid grey;
  padding-top: 3px;
  padding-bottom: 3px;
}

.card-read-more a:hover {
  text-decoration: none;
  font-weight: 900;
}

/* --- Clean Pagination Navbar Layout Overrides --- */
.pagination-nav {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  width: 100%;
}

/* Enhanced Specificity Chain to absolutely force inline horizontal row tracking */
html body #wrapper #content .main-container ul.pagination-list {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  list-style: none !important;
  list-style-type: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

html body #wrapper #content .main-container ul.pagination-list li.pagination-item {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: inline-block !important;
  height: auto !important;
  line-height: normal !important;
}

.pagination-link {
  display: inline-block !important;
  padding: 0.5rem 1rem;
  background-color: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #2b6cb0 !important;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.9rem !important;
}

.pagination-link:not(.disabled):hover {
  background-color: #edf2f7;
  color: #1a4373 !important;
}

.pagination-link.disabled {
  color: #a0aec0 !important;
  background-color: #edf2f7;
  cursor: not-allowed;
  border-color: #e2e8f0;
}

.page-counter {
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 500;
  display: inline-block;
}

/* --------------------------------------------------------------------------
   TWO-COLUMN SIDEBAR LAYOUT STYLES
   -------------------------------------------------------------------------- */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  width: 100%;
  align-items: flex-start;
}

.sidebar-main-content {
  min-width: 0;
  padding-top: 1rem;
  /* Prevents long text elements or images from blowing out column widths */
}

.sidebar-panel {
  width: 300px;
  margin-top: 1rem;
  box-sizing: border-box;
  /* Optional: You can add padding or border-left properties here if you want an explicit divider line */
}

/* Responsive adjustment for Mobile and Tablets */
@media (max-width: 850px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
    /* Drops into a single stream stack on smaller screens */
    gap: 2rem;
  }

  .sidebar-panel {
    width: 100%;
  }
}

/* ==========================================================================
   NAVIGATION LOGO / IMAGE HEIGHT ALIGNMENT FIX
   ========================================================================== */

/* 1. Target the flex div container inside your navbar */
.gen-nav div,
#gen-menu div {
  display: flex !important;
  align-items: center !important;
}

/* 2. Force the parent anchor link to scale to 100% height of the container */
.gen-nav div>a,
#gen-menu div>a {
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
}

/* 3. Force the image to scale perfectly within that link footprint */
.gen-nav div a img,
#gen-menu div a img {
  height: 100% !important;
  width: auto !important;
  /* Maintain correct natural aspect ratio */
  object-fit: cover !important;
  /* Prevent squishing or distortion */
  display: block !important;
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE BREAKPOINTS)
   ========================================================================== */

/* Tablet & Large Screens (1000px and below) */
@media (max-width: 1000px) {
  #writer-tag {
    display: none !important;
  }
}

/* Medium Screens (900px and below) */
@media (max-width: 900px) {
  .gen-author-name {
    display: none !important;
  }

  .card-image-wrapper {
    flex: 0 0 140px !important;
    width: 140px !important;
    min-width: 140px !important;
    min-height: 90px !important;
  }
}

/* Mobile Screens (768px and below) */
@media (max-width: 768px) {

  .gen-hamburger,
  #gen-ham {
    display: flex;
    margin-left: 0;
  }

  .gen-nav,
  #gen-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .gen-logo {
    margin-right: auto;
    margin-left: 0;
    justify-self: unset;
    order: -1;
  }

  .gen-nav>ul,
  #gen-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-nav-bg);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    padding: 8px 0;
    overflow: hidden;
    width: 100%;
  }

  .gen-nav>ul.open,
  #gen-menu.open {
    display: flex;
  }

  .gen-nav.mobile-open,
  #gen-nav.mobile-open {
    border-radius: 8px 8px 0 0;
  }

  .gen-nav>ul>li>a,
  #gen-menu a {
    height: auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }

  /* Left-align nav icon links in mobile menu and show text label */
  .gen-nav>ul>li>a.nav-icon-link,
  #gen-menu li>a.nav-icon-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 20px;
    width: 100%;
  }

  .nav-icon-label {
    display: inline;
    font-size: 16px;
    font-weight: 500;
  }

  /* Hide floating tooltip on touch/mobile screens */
  .nav-icon-link[data-tooltip]::before,
  .nav-icon-link[data-tooltip]::after {
    display: none !important;
  }

  .gen-nav>ul>li:last-child,
  #gen-menu li:last-child {
    border-radius: 0;
    overflow: visible;
  }

  .gen-nav>ul>li:last-child>a,
  #gen-menu li:last-child>a {
    border-radius: 0;
  }

  /* Submenu is collapsed by default on mobile */
  .gen-nav>ul>li>ul,
  #gen-menu li>ul {
    display: none;
    position: static;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    background: rgba(0, 0, 0, 0.15);
    min-width: 0;
  }

  /* Submenu opened state on mobile */
  .gen-nav>ul>li.sub-open>ul,
  #gen-menu li.sub-open>ul {
    display: block;
  }

  .gen-nav>ul>li.has-sub>a .gen-arrow,
  #gen-menu li.has-sub>a .gen-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
  }

  .gen-nav>ul>li.has-sub.sub-open>a .gen-arrow,
  #gen-menu li.has-sub.sub-open>a .gen-arrow {
    transform: rotate(180deg);
  }

  .gen-nav>ul>li>ul>li:last-child,
  .gen-nav>ul>li>ul>li:last-child>a,
  #gen-menu li>ul>li:last-child,
  #gen-menu li>ul>li:last-child>a {
    border-radius: 0;
    overflow: visible;
  }

  .gen-nav>ul>li>ul>li>a,
  #gen-menu li>ul>li>a {
    padding: 10px 32px;
  }

  /* Hamburger Animation */
  .gen-nav.mobile-open .gen-hamburger span:nth-child(1),
  #gen-nav.mobile-open #gen-ham span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .gen-nav.mobile-open .gen-hamburger span:nth-child(2),
  #gen-nav.mobile-open #gen-ham span:nth-child(2) {
    opacity: 0;
  }

  .gen-nav.mobile-open .gen-hamburger span:nth-child(3),
  #gen-nav.mobile-open #gen-ham span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Mobile Rows & Columns Stack */
  .responsive-row {
    flex-direction: column;
  }

  .responsive-col {
    width: 100%;
  }

  /* Home Hero / Intro Panel Mobile */
  .home-intro-panel {
    padding: 1.5rem 1.25rem;
    gap: 1.25rem;
  }

  .home-intro-title {
    text-align: center;
    font-size: 1.45rem;
  }

  .home-intro-body {
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
  }

  .home-intro-photo {
    width: 130px;
    height: 130px;
  }

  .home-intro-content {
    text-align: left;
    width: 100%;
  }

  .praise-section {
    padding: 1.75rem 1.25rem !important;
  }

  .card-image-wrapper {
    display: none !important;
  }
}

/* Desktop styles only (Screens wider than 768px) */
@media (min-width: 769px) {

  .gen-nav,
  #gen-nav {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .gen-author-name {
    display: flex !important;
    margin-left: 15px !important;
    margin-right: auto !important;
    font-size: 18px;
    align-items: baseline;
    gap: 8px;
  }


  html body .praise-section .testimonial-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
  }

  html body .praise-section .testimonial-grid .testimonial-card {
    flex: 1 1 50%;
    max-width: calc(50% - 0.75rem);
  }

}

/***********************************
 * COMMENT FORM
 ***********************************/

.comment-form-container {
  margin-bottom: 1rem;
}

.buy-button,
.preview-button,
.read-more-link {
  width: fit-content;
  height: 48px;
  color: white;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 20px;
  transition: all 0.3s ease;
  cursor: pointer;
  display: inline-flex;
  user-select: auto;
  position: relative;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}

.buy-button:hover,
.preview-button:hover,
.read-more-link:hover {
  transform: translateY(-3px);
  background: green;
  color: #ffffff;
}

.buy-button:active,
.preview-button:active,
.read-more-link:active {
  transform: scale(0.96);
}

.buy-button {
  background: var(--color-primary);
}

.read-more-link {
  background: var(--color-accent);
  margin-left: 3rem;
  margin-top: 0.5rem;
}

.preview-button {
  background: var(--color-primary-light);
}

article {
  margin-bottom: 1rem;
}

/* ==========================================================================
   BOOK CARD COMPONENT (FULL + COMPACT MODES)
   ========================================================================== */

.book-card {
  margin: 2rem 0;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e2e8f0;
}

.book-card:last-child {
  border-bottom: none;
}

/* Shared inner layout */
.book-card-inner {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

/* Tighter gap only inside the books grid */
#books-list .book-card-inner {
  gap: 0.85rem;
}

/* Cover column */
.book-card-cover {
  flex: 0 0 120px;
}

.book-card-cover img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Content column */
.book-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ------------------------------
     FULL MODE
     ------------------------------ */

.book-card--full .book-tagline {
  font-size: 22px;
  margin: 0;
  color: var(--color-primary);
}

.book-card--full .book-blurb {
  margin: 0;
  line-height: 1.6;
  color: var(--color-text);
}

/* ------------------------------
     COMPACT MODE
     ------------------------------ */

.book-card--compact {
  padding: 0;
  margin: 0 0 0.75rem 0;
}

/* Inside the books grid, compact cards use the cell's own padding */
#books-list .book-card--compact {
  padding: 0.85rem 1rem;
  margin: 0;
}

/* Book count line — sits inside .books-filter-bar */
.book-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.book-card--compact .tagline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
}

.book-card--compact .snippet {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.book-card--compact .book-title {
  font-size: 17px;
  margin-top: 0;
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
}

.book-card--compact .buy-button,
.book-card--compact .preview-button {
  height: 30px;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
}

/* Cover column variants */
.book-card--compact .book-card-cover {
  flex: 0 0 80px;
}

.series-block .book-card--compact .book-card-cover {
  flex: 0 0 120px;
}

.series-link {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
}

.series-link:hover {
  color: var(--color-primary-dark);
  font-weight: 750;
}

.book-card--full .book-card-cover {
  flex: 0 0 175px;
}

/* Buy + About buttons inline */
.compact-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* ------------------------------
     TAGS (Genres, Features, Series)
     ------------------------------ */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  background-color: #edf2f7;
  color: var(--color-text-dark);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.tag:hover {
  background-color: #dbe2eb;
}

/* Series tags get a distinct purple tint */
.tag[data-filter="series"] {
  background-color: #e9e4f5;
  color: #553c9a;
}

.tag[data-filter="series"]:hover {
  background-color: #d6cdf0;
}

/* ------------------------------
     RESPONSIVE BEHAVIOR
     ------------------------------ */

@media (max-width: 600px) {
  .book-card-inner {
    flex-direction: column;
  }

  .book-card-cover {
    flex: 0 0 auto;
    width: 160px;
  }
}

/* Series pages  */
.series-block {
  padding: 0 .75rem;
  margin: 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background-color: var(--color-bg);
}

.series-block h1 {
  font-size: 25px;
  text-align: center;
  margin-top: 0;
  padding-top: 0.25rem;
  margin-bottom: 0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  background-color: rgb(205, 203, 226);
}

.series-block h2 {
  font-size: 20px;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.series-main .responsive-row {
  gap: 0.75rem;
}

hr.scene-break {
  border: 0;
  height: 2px;
  margin: 1.5em auto;
  width: 40%;
  background: linear-gradient(to right,
      transparent 0%,
      #555 30%,
      #555 70%,
      transparent 100%);
}

.story-wrapper {
  line-height: 1.75;
}

/* Each paragraph gets an indent and a small bottom gap */
.story-wrapper p {
  text-indent: 2em;
  margin-top: 0;
  margin-bottom: 0.25em;
}

.series-toc ul {
  /* Step 1: Turn the list into a horizontal flex container */
  display: flex !important;

  /* Step 2: Remove default browser spacing and bullet points */
  list-style-type: none !important;
  margin-top: 1rem !important;
  margin: 0 !important;
  padding: 0 !important;

  /* Step 3: Space out and align the elements */
  gap: 10px;
  /* Adjust spacing between links */
  justify-content: center;
  /* Options: center, flex-start, flex-end, space-between */
}

/* Optional: Enhancing link appearance and hitboxes */
.series-toc li a {
  display: block;
  text-decoration: none;
  color: #333;
  font-family: sans-serif;
}

/* Optional: Add feedback when hovering over links */
.series-toc li a:hover {
  background-color: #f0f0f0;
  border-radius: 4px;
}

/**** NAV ICONS & TOOLTIPS ********************/
/* Center the icon perfectly inside the navigation flow */
.nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  text-decoration: none;
  position: relative;
}

/* Hide text label on desktop (icon only) */
.nav-icon-label {
  display: none;
}

/* Style icons to match navigation text */
.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: currentColor;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.2s ease;
}

/* Slick Micro-interaction: Subtle scale pop and shift on hover/focus */
.nav-icon-link:hover .nav-icon,
.nav-icon-link:focus .nav-icon {
  transform: scale(1.15);
  opacity: 0.85;
}

.search-nav-link:hover .search-icon,
.search-nav-link:focus .search-icon {
  transform: scale(1.15) rotate(5deg);
}

/* Rollover Tooltip */
.nav-icon-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background-color: #1f2937;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  z-index: 10000;
}

.nav-icon-link[data-tooltip]::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border-width: 4px;
  border-style: solid;
  border-color: transparent transparent #1f2937 transparent;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 10000;
}

.nav-icon-link[data-tooltip]:hover::after,
.nav-icon-link[data-tooltip]:focus-visible::after,
.nav-icon-link[data-tooltip]:hover::before,
.nav-icon-link[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 🌟 The Accessibility Standard */
/* This completely hides the word visually, but keeps it readable by screen readers and SEO crawlers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   BOOKS FILTER BAR
   ========================================================================== */

.books-filter-bar {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
}

.filter-row {
  display: flex;
  flex-wrap: nowrap;
  /* single row on desktop */
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}

/* Search input */
#book-search {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 0.875rem;
  background: #fff;
}

/* Genre / Sort selects — smaller */
#filter-genre,
#sort-books {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4rem 0.3rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 0.875rem;
  background: #fff;
}

/* Series select — wider since it holds longer names */
#filter-series {
  flex: 2 1 0;
  min-width: 0;
  padding: 0.4rem 0.3rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 0.875rem;
  background: #fff;
}

.clear-btn {
  flex: 0 0 auto;
  padding: 0.4rem 0.85rem;
  background: var(--color-primary);
  color: white;
  border-radius: 4px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
}

.clear-btn:hover {
  background: var(--color-primary-dark, #3a3a8c);
}

.active-filters {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.active-filters .chip {
  background: #edf2f7;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Medium screens: allow the series select to wrap onto its own line */
@media (max-width: 800px) {
  .filter-row {
    flex-wrap: wrap;
  }

  #filter-series {
    flex: 1 1 100%;
    width: 100%;
  }
}

/* Mobile: stack everything */
@media (max-width: 500px) {
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  #book-search,
  #filter-genre,
  #filter-series,
  #sort-books,
  .clear-btn {
    width: 100%;
    flex: 1 1 100%;
  }
}

/*-----------------------------------------
  Books page — responsive grid
  ----------------------------------------*/
#books-list {
  display: grid;
  /* 2 equal columns on wide screens */
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

/* Each book card fills its grid cell */
#books-list .book-card {
  margin: 0;
  padding: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  border-top: none;
  border-left: none;
}

/* Remove the right border from the second column */
#books-list .book-card:nth-child(2n) {
  border-right: none;
}

/* Single column on narrow screens */
@media (max-width: 700px) {
  #books-list {
    grid-template-columns: 1fr;
  }

  #books-list .book-card {
    border-right: none;
  }
}


/* ==========================================================================
   Basic table CSS
   ========================================================================== */

/* Base table styling */
table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}

/* Cells */
table td,
table th {
  border: 1px solid #ddd !important;
  padding: 0.5rem 0.75rem !important;
  vertical-align: top;
}

/* Header row — light blue */
table th {
  background: #e6f2ff;
  /* soft light blue */
  font-weight: 600;
}

/* Zebra striping */
table tr:nth-child(even) {
  background: #fafafa;
}


.story-book-cover img {
  width: 170px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  float: right;
  margin-left: 15px;
  margin-bottom: 10px;
}

.book-part-of {
  font-weight: 400;
  font-size: 22px;
}

/* ==========================================================================
   STORIES TAB SWITCHER
   ========================================================================== */
.stories-tabs-container input[type="radio"] {
  display: none;
}

.stories-tab-labels {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 1.25rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.stories-tab-label {
  padding: 0.5rem 1rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}

.stories-tab-label:hover {
  color: var(--color-primary);
  border-bottom-color: #cbd5e0;
}

#tab-month:checked~.stories-tab-labels label[for="tab-month"],
#tab-catalog:checked~.stories-tab-labels label[for="tab-catalog"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.stories-tab-content {
  display: none;
}

#tab-month:checked~#content-month,
#tab-catalog:checked~#content-catalog {
  display: block;
}

/* ==========================================================================
   STORIES FILTER BAR
   ========================================================================== */
.stories-filter-bar {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 8px;
}

#story-search,
#filter-story-genre,
#filter-story-feature,
#filter-story-series,
#sort-stories {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 0.875rem;
  background: #fff;
}

#filter-story-series {
  flex: 2 1 0;
}

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: #4a5568;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #cbd5e0;
  background: #fff;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}

.filter-checkbox:hover {
  background: #edf2f7;
  border-color: #a0aec0;
}

.filter-checkbox input[type="checkbox"] {
  accent-color: var(--color-primary, #5a67d8);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* ==========================================================================
   STORY CARDS & GRID (Matches /books/ grid exactly)
   ========================================================================== */
#stories-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.story-card {
  background: #fff;
  margin: 0;
  padding: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  border-top: none;
  border-left: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

/* Remove right border on the second column of story cards */
#stories-list .story-card:nth-child(2n) {
  border-right: none;
}

.story-card-title {
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-top: 0;
  margin-bottom: 0.5rem;
  text-transform: none;
  border-bottom: none;
  padding-bottom: 0;
  line-height: 1.3;
}

/* Specific styling for tag colors inside story cards */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.tag--genre {
  background: #edf2f7;
  color: #4a5568;
}

.tag--feature {
  background: #ebf8ff;
  color: #2b6cb0;
}

.tag--series {
  background: #e6fffa;
  color: #319795;
}

.tag--word-count {
  background: #f7fafc;
  color: var(--color-text-muted);
  border: 1px solid #e2e8f0;
  cursor: default;
}

.tag--word-count:hover {
  background: #f7fafc;
  color: var(--color-text-muted);
}

.story-appears-in {
  /* margin-top: 1rem; /* Allow dynamic heights without large blank vertical spaces */
  border-top: 1px dashed #e2e8f0;
  padding-top: 0.5rem;
}

.appears-in-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  margin-top: 0;
  margin-bottom: 0.5rem;
  border-bottom: none;
  padding-bottom: 0;
}

/* Vertical stacking for compact appearances inside grid cards */
.story-books-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.story-book-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.6rem;
  width: 100%;
}

.story-card-book-cover {
  flex: 0 0 50px;
  width: 50px;
}

.story-card-book-cover a {
  display: block;
}

.story-card-book-cover img {
  width: 50px !important;
  height: auto !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  float: none !important;
  margin: 0 !important;
}

.story-book-info {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  line-height: 1.2;
}

.story-book-title-link {
  color: var(--color-text-dark);
  text-decoration: none;
  font-weight: 600;
}

.story-book-title-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.story-book-subtitle {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: normal;
  display: inline;
}

.story-count {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Mobile & Tablet responsiveness for stories */
@media (max-width: 700px) {
  #stories-list {
    grid-template-columns: 1fr;
  }

  #stories-list .story-card {
    border-right: none;
  }

  .stories-tab-label {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .stories-filter-bar .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  #story-search,
  #filter-story-genre,
  #filter-story-feature,
  #filter-story-series,
  #sort-stories,
  .filter-checkbox,
  .stories-filter-bar .clear-btn {
    width: 100%;
    flex: 1 1 100%;
  }
}


figure.smart-picture-default,
figure.smart-picture-wide,
figure.smart-picture-medium {
  margin: 0;
}

.smart-picture-default {
  float: right;
  max-width: 300px;
  width: 100%;
  height: auto;
  margin-left: 1.5rem;
  /* Equivalent to mr-6/ml-6 spacing */
  margin-bottom: 1rem;
}

.smart-picture-wide {
  max-width: 800px;
  width: 100%;
  height: auto;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.smart-picture-medium {
  max-width: 800px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 70%;
  height: auto;
  margin-top: 1rem;
  margin-bottom: 1rem;
}


.picture-caption {
  font-size: 0.9rem;
  color: var(--color-text-muted, #718096);
  font-style: italic;
  margin-top: 0.75em;
  text-align: center;
  line-height: 1.4;
}

.patreon-section {
  background-color: #bde5ff;
  border: 2px solid #cbd5e0;
  padding: 1rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  color: #4a5568;
  line-height: 1.5;
}

/***********************************
 * STORY BACKSTORIES & SPOILER BADGES
 ***********************************/

.tag--read-story {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tag--read-story:hover {
  background: #bae6fd;
  color: #075985;
  text-decoration: underline;
}

.tag--backstory {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tag--backstory:hover {
  background: #e9d5ff;
  color: #581c87;
  text-decoration: underline;
}

.backstory-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 0;
}

.backstory-header {
  margin-bottom: 1.5rem;
}

.spoiler-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: 6px;
  margin: 1.25rem 0 1.75rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.spoiler-banner-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.spoiler-banner--none {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.spoiler-banner--mild {
  background-color: #fffbe6;
  border: 1px solid #ffe58f;
  color: #78350f;
}

.spoiler-banner--major {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.backstory-story-promo {
  margin-top: 2rem;
}

.backstory-story-promo h3 {
  margin-bottom: 1rem;
}

.story-backstory-callout {
  background: #f3e8ff;
  border: 1px solid #d8b4fe;
  color: #581c87;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.story-backstory-callout a {
  color: #6b21a8;
  font-weight: 600;
  text-decoration: underline;
}

.inline-icon {
  display: inline-block;
  height: 1em;
  /* Scales perfectly with the surrounding font size */
  width: auto;
  /* Maintains the natural aspect ratio of the SVG */
  vertical-align: -0.15em;
  /* Drops the icon slightly to align with the text baseline */
}

/* ==========================================================================
   HERO / HOME INTRO PANEL 
   ========================================================================== */
.home-intro-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.75rem 2rem;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  background-color: var(--color-nav-bg, #eff0fb);
  background-image:
    radial-gradient(circle at 92% 18%, rgba(34, 64, 179, 0.07) 0%, rgba(34, 64, 179, 0.07) 140px, transparent 141px),
    radial-gradient(circle at 97% 85%, rgba(0, 0, 255, 0.05) 0%, rgba(0, 0, 255, 0.05) 85px, transparent 86px);
  border: 1px solid #dbe1f5;
  border-left: 6px solid var(--color-primary, #2240b3);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(34, 64, 179, 0.06);
  overflow: hidden;
}

.home-intro-title {
  margin: 0;
  color: var(--color-primary, #2240b3);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  width: 100%;
}

.home-intro-body {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.home-intro-media {
  flex-shrink: 0;
}

.home-intro-photo {
  width: 150px;
  height: 150px;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  display: block;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.home-intro-panel:hover .home-intro-photo {
  transform: scale(1.02);
  box-shadow: 0 6px 18px rgba(34, 64, 179, 0.2);
}

.home-intro-content {
  flex: 1;
  min-width: 0;
}

.home-intro-items {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.home-intro-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.home-intro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  margin-top: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-intro-icon svg {
  width: 18px;
  height: 18px;
}

.home-intro-icon img {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

/* Color accents for each hero item */
.home-intro-icon--newsletter {
  background-color: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.home-intro-icon--stories {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.home-intro-icon--patreon {
  background-color: #ff424d;
  color: #ffffff;
  border: 1px solid #e02f3a;
  box-shadow: 0 2px 6px rgba(255, 66, 77, 0.25);
}

.home-intro-icon--patreon img {
  filter: brightness(0) invert(1);
}

.home-intro-item:hover .home-intro-icon {
  transform: scale(1.08);
}

.home-intro-text {
  font-size: 1rem;
  line-height: 1.55;
  color: #334155;
}

.home-intro-text a {
  color: var(--color-primary, #2240b3);
  font-weight: 600;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.home-intro-text a:hover {
  color: var(--color-primary-dark, #162a75);
}