/* Letter page specific layout adjustments */
.section.blog-wrap.bg-gray {
  padding-top: 20px !important;
}

/* ===========================
   Letter Page-Specific Layout
   Design tokens and components now in tokens.css and components.css
   =========================== */

/* Enhanced Bottom Navigation (Previous/Next + Back to Hub)
   Applies to both letter pages and blog posts */
.letter-bottom-nav {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e6e9ef;
}

.letter-bottom-nav .nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.letter-bottom-nav .nav-buttons .btn {
  min-width: 140px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 10px;
  transition: all 0.25s ease;
  text-decoration: none;
}

/* Previous button - subtle outline style */
.letter-bottom-nav .nav-buttons .btn-outline-secondary {
  border: 2px solid var(--brand-blue, #4a90e2) !important;
  color: var(--brand-blue, #4a90e2) !important;
  background: transparent !important;
}

.letter-bottom-nav .nav-buttons .btn-outline-secondary:hover {
  background: var(--brand-blue, #4a90e2) !important;
  color: #fff !important;
  border-color: var(--brand-blue, #4a90e2) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* Next button - solid style */
.letter-bottom-nav .btn-primary {
  background: var(--brand-blue, #4a90e2);
  border: 2px solid var(--brand-blue, #4a90e2);
  color: #fff;
}

.letter-bottom-nav .btn-primary:hover {
  background: var(--brand-blue-dark, #357abd);
  border-color: var(--brand-blue-dark, #357abd);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* Back to Hub link - Professional Design */
.letter-bottom-nav .back-to-hub {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8ecf0;
  position: relative;
}

.letter-bottom-nav .back-to-hub::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 1px;
  background: var(--brand-blue, #4a90e2);
}

.letter-bottom-nav .back-to-hub a {
  color: #6b7280;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  padding: 0.5rem 0;
  transition: all 0.2s ease;
  display: inline-block;
  position: relative;
  border-bottom: 1px solid transparent;
}

.letter-bottom-nav .back-to-hub a:hover {
  color: var(--brand-blue, #4a90e2);
  text-decoration: none;
  border-bottom-color: var(--brand-blue, #4a90e2);
}

.letter-bottom-nav .back-to-hub a:focus {
  outline: none;
  color: var(--brand-blue, #4a90e2);
  border-bottom-color: var(--brand-blue, #4a90e2);
}

/* Subtle underline animation */
.letter-bottom-nav .back-to-hub a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--brand-blue, #4a90e2);
  transition: width 0.3s ease;
}

.letter-bottom-nav .back-to-hub a:hover::after {
  width: 100%;
}

/* Mobile responsive */
@media (max-width: 576px) {
  .letter-bottom-nav .nav-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .letter-bottom-nav .nav-buttons .btn {
    width: 100%;
    min-width: auto;
  }
}

/* Respect reduced motion (prevents janky feel) */
@media (prefers-reduced-motion: reduce) {
  .btn-letter {
    transition: none;
    transform: none !important;
  }

  .btn-letter:hover {
    transform: none;
  }

  .letter-bottom-nav .nav-buttons .btn,
  .letter-bottom-nav .back-to-hub a {
    transition: none;
    transform: none !important;
  }

  .letter-bottom-nav .btn-outline-secondary:hover,
  .letter-bottom-nav .btn-primary:hover,
  .letter-bottom-nav .back-to-hub a:hover {
    transform: none;
  }

  .letter-bottom-nav .back-to-hub a::after {
    transition: none;
  }
}

/* ===========================
   Tables - Shared styles for all language versions
   =========================== */

/* Tables - responsive wrapper for mobile scrolling */
.table-wrapper,
.table-wrap {
  overflow-x: auto;
  margin: 2rem 0;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  position: relative;
  /* Hide scrollbar on most browsers but keep functionality */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f7fafc;
}

.table-wrapper::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: #f7fafc;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Scroll indicator shadows - show at edges when scrollable */
.table-wrapper {
  position: relative;
}

.table-wrapper::before,
.table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.table-wrapper::before {
  left: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

.table-wrapper::after {
  right: 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

/* Show left shadow when scrolled right */
.table-wrapper.scrolled-right::before {
  opacity: 1;
}

/* Show right shadow when not scrolled to end */
.table-wrapper.scrolled-left::after,
.table-wrapper:not(.scrolled-end)::after {
  opacity: 1;
}

/* Scroll navigation buttons - better design, always visible when needed */
.table-scroll-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  gap: 0.75rem;
  background: linear-gradient(to bottom, rgba(248, 249, 250, 0.98), rgba(255, 255, 255, 0.95));
  border-bottom: 2px solid #e8ecf0;
  border-radius: 8px 8px 0 0;
  position: sticky;
  top: 80px;
  z-index: 50;
  opacity: 1;
  transition: background 0.2s ease;
}

.table-wrapper.has-scroll .table-scroll-controls {
  display: flex;
}

.table-wrapper:not(.has-scroll) .table-scroll-controls {
  display: none;
}

.table-scroll-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-scroll-btn:hover:not(:disabled) {
  background: #2a64b8;
  color: #fff;
  border-color: #2a64b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(42, 100, 184, 0.3);
}

.table-scroll-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(42, 100, 184, 0.2);
}

.table-scroll-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #9ca3af;
}

.table-scroll-indicator {
  flex: 0 1 auto;
  min-width: 60px;
  max-width: 150px;
  height: 3px;
  background: #e5e7eb;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.table-scroll-indicator::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--indicator-width, 0%);
  background: #3b82f6;
  border-radius: 2px;
  transition: width 0.1s ease;
}

/* Mobile: Hide scroll controls on very small screens, show native scrollbar */
@media (max-width: 640px) {
  .table-scroll-controls {
    display: none !important;
  }
  
  .table-wrapper::-webkit-scrollbar {
    height: 12px;
  }
}

.letter-table,
.jw-part table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.letter-table thead,
.jw-part table thead {
  background: #f8f9fa;
}

.letter-table th,
.jw-part table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #2d3748;
  border-bottom: 2px solid #e8ecf0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Prevent short header words from wrapping unnecessarily */
.letter-table th:first-child,
.jw-part table th:first-child,
.letter-table th:nth-child(2),
.jw-part table th:nth-child(2) {
  white-space: nowrap; /* Year and Ref # should stay on one line */
  min-width: 80px;
}

.letter-table td,
.jw-part table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f2f5;
  color: #4a5568;
  vertical-align: top;
}

.letter-table tbody tr:hover,
.jw-part table tbody tr:hover {
  background: #f8f9fa;
}

.letter-table tbody tr:last-child td,
.jw-part table tbody tr:last-child td {
  border-bottom: none;
}

/* Consistent column widths for A1 and A2 tables */
/* Year column */
.letter-table colgroup col:nth-child(1),
.jw-part table colgroup col:nth-child(1) {
  width: 10%;
  min-width: 80px;
}

/* Ref # column */
.letter-table colgroup col:nth-child(2),
.jw-part table colgroup col:nth-child(2) {
  width: 10%;
  min-width: 80px;
}

/* http Link column */
.letter-table colgroup col:nth-child(3),
.jw-part table colgroup col:nth-child(3) {
  width: 30%;
  min-width: 200px;
}

/* Content Summary column */
.letter-table colgroup col:nth-child(4),
.jw-part table colgroup col:nth-child(4) {
  width: 40%;
  min-width: 250px;
}

/* Key Change column (A1 only) */
.letter-table colgroup col:nth-child(5),
.jw-part table colgroup col:nth-child(5) {
  width: 14%;
  min-width: 150px;
}

/* General rule: Respect colgroup width styles when present */
.letter-table colgroup col[style*="width"],
.jw-part table colgroup col[style*="width"] {
  /* Preserve inline width styles from colgroup */
}

/* Ensure table respects colgroup widths */
.letter-table,
.jw-part table {
  table-layout: fixed; /* Use fixed layout for better column width control */
}

/* For very wide tables (like D1 with 8 columns), allow auto layout on mobile */
@media (max-width: 768px) {
  .letter-table,
  .jw-part table {
    table-layout: auto; /* Auto layout on mobile for better responsiveness */
  }
}

/* ===========================
   D1 Table - Chronology of Jerusalem's Fall
   Better structure for 8-column table
   =========================== */

/* Target D1 table specifically (8 columns with colgroup) */
.letter-content section[id*="d1-chronology"] table,
.jw-part section[id*="d1-chronology"] table {
  table-layout: fixed !important;
  font-size: 0.9rem;
}

/* D1 table column widths - optimized for readability */
.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(1),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(1) {
  width: 10% !important; /* Date (BCE) */
  min-width: 80px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(2),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(2) {
  width: 5% !important; /* Event column 1 */
  min-width: 40px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(3),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(3) {
  width: 20% !important; /* Event column 2 */
  min-width: 150px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(4),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(4) {
  width: 2% !important; /* Description spacer - increased from 0% */
  min-width: 10px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(5),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(5) {
  width: 28% !important; /* Description - increased from 27% */
  min-width: 200px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(6),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(6) {
  width: 18% !important; /* Biblical / Other Reference(s) - increased from 17% */
  min-width: 140px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(7),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(7) {
  width: 18% !important; /* Historical / Archaeological Notes - increased from 17% */
  min-width: 140px;
}

.letter-content section[id*="d1-chronology"] table colgroup col:nth-child(8),
.jw-part section[id*="d1-chronology"] table colgroup col:nth-child(8) {
  width: 1% !important; /* Last column - reduced from 7% */
  min-width: 10px;
}

/* D1 table headers - prevent wrapping */
.letter-content section[id*="d1-chronology"] table thead th,
.jw-part section[id*="d1-chronology"] table thead th {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
  font-weight: 600;
  text-align: left;
  vertical-align: top;
}

/* D1 table cells - better spacing and wrapping */
.letter-content section[id*="d1-chronology"] table tbody td,
.jw-part section[id*="d1-chronology"] table tbody td {
  padding: 0.75rem 0.5rem;
  vertical-align: top;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
}

/* First column (Date) - center align */
.letter-content section[id*="d1-chronology"] table tbody td:first-child,
.jw-part section[id*="d1-chronology"] table tbody td:first-child {
  text-align: center;
  font-weight: 500;
}

/* Links in D1 table - wrap properly */
.letter-content section[id*="d1-chronology"] table td a,
.jw-part section[id*="d1-chronology"] table td a {
  word-break: break-all;
  overflow-wrap: break-word;
  display: inline-block;
  max-width: 100%;
}

/* Mobile adjustments for D1 table */
@media (max-width: 768px) {
  .letter-content section[id*="d1-chronology"] table,
  .jw-part section[id*="d1-chronology"] table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .letter-content section[id*="d1-chronology"] table thead th,
  .jw-part section[id*="d1-chronology"] table thead th {
    font-size: 0.75rem;
    padding: 0.6rem 0.4rem;
  }
  
  .letter-content section[id*="d1-chronology"] table tbody td,
  .jw-part section[id*="d1-chronology"] table tbody td {
    padding: 0.6rem 0.4rem;
  }
}

/* ===========================
   C2 Table - Memorial Partakers from 1993 to 2023
   Better structure for 6-column side-by-side comparison table
   =========================== */

/* Target C2 table specifically (6 columns with colgroup) */
.letter-content section[id*="c2-memorial-partakers"] table,
.jw-part section[id*="c2-memorial-partakers"] table {
  table-layout: fixed !important;
  font-size: 0.95rem;
}

/* C2 table column widths - optimized for side-by-side comparison */
.letter-content section[id*="c2-memorial-partakers"] table colgroup col:nth-child(1),
.jw-part section[id*="c2-memorial-partakers"] table colgroup col:nth-child(1) {
  width: 10% !important; /* Year (left) */
  min-width: 70px;
}

.letter-content section[id*="c2-memorial-partakers"] table colgroup col:nth-child(2),
.jw-part section[id*="c2-memorial-partakers"] table colgroup col:nth-child(2) {
  width: 25% !important; /* Memorial Partakers (left) */
  min-width: 150px;
}

.letter-content section[id*="c2-memorial-partakers"] table colgroup col:nth-child(3),
.jw-part section[id*="c2-memorial-partakers"] table colgroup col:nth-child(3) {
  width: 10% !important; /* Shift (left) - reduced from 24% */
  min-width: 60px;
}

.letter-content section[id*="c2-memorial-partakers"] table colgroup col:nth-child(4),
.jw-part section[id*="c2-memorial-partakers"] table colgroup col:nth-child(4) {
  width: 10% !important; /* Year (right) */
  min-width: 70px;
}

.letter-content section[id*="c2-memorial-partakers"] table colgroup col:nth-child(5),
.jw-part section[id*="c2-memorial-partakers"] table colgroup col:nth-child(5) {
  width: 25% !important; /* Memorial Partakers (right) */
  min-width: 150px;
}

.letter-content section[id*="c2-memorial-partakers"] table colgroup col:nth-child(6),
.jw-part section[id*="c2-memorial-partakers"] table colgroup col:nth-child(6) {
  width: 10% !important; /* Shift (right) - reduced from 8% */
  min-width: 60px;
}

/* C2 table headers - center align for better readability */
.letter-content section[id*="c2-memorial-partakers"] table thead th,
.jw-part section[id*="c2-memorial-partakers"] table thead th {
  white-space: normal;
  word-wrap: break-word;
  padding: 0.85rem 0.6rem;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

/* C2 table cells - center align numbers, better spacing */
.letter-content section[id*="c2-memorial-partakers"] table tbody td,
.jw-part section[id*="c2-memorial-partakers"] table tbody td {
  padding: 0.85rem 0.6rem;
  vertical-align: middle;
  line-height: 1.6;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
}

/* Year columns - emphasize with font weight */
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(1),
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(4),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(1),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(4) {
  font-weight: 600;
  font-size: 1em;
}

/* Memorial Partakers columns - larger numbers */
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(2),
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(5),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(2),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(5) {
  font-weight: 500;
  font-size: 1.05em;
}

/* Shift columns - smaller, subtle */
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(3),
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(6),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(3),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(6) {
  font-size: 0.9em;
  color: #6b7391;
}

/* Visual separator between left and right halves */
.letter-content section[id*="c2-memorial-partakers"] table tbody td:nth-child(3),
.jw-part section[id*="c2-memorial-partakers"] table tbody td:nth-child(3) {
  border-right: 2px solid #e8ecf0;
}

/* Mobile adjustments for C2 table */
@media (max-width: 768px) {
  .letter-content section[id*="c2-memorial-partakers"] table,
  .jw-part section[id*="c2-memorial-partakers"] table {
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .letter-content section[id*="c2-memorial-partakers"] table thead th,
  .jw-part section[id*="c2-memorial-partakers"] table thead th {
    font-size: 0.8rem;
    padding: 0.7rem 0.5rem;
  }
  
  .letter-content section[id*="c2-memorial-partakers"] table tbody td,
  .jw-part section[id*="c2-memorial-partakers"] table tbody td {
    padding: 0.7rem 0.5rem;
  }
}

/* ===========================
   Hebrew Names Table - Latinizing with Adonai Vowels
   Better structure for 4-column table
   =========================== */

/* Target Hebrew names table specifically (4 columns with colgroup) */
.letter-content section[id*="latinizing-hebrew-names"] table,
.jw-part section[id*="latinizing-hebrew-names"] table {
  table-layout: fixed !important;
  font-size: 0.95rem;
}

/* Hebrew names table column widths - optimized for readability */
.letter-content section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(1),
.jw-part section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(1) {
  width: 30% !important; /* Original */
  min-width: 180px;
}

.letter-content section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(2),
.jw-part section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(2) {
  width: 38% !important; /* With Adonai Vowels - prevent header wrapping */
  min-width: 220px;
}

.letter-content section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(3),
.jw-part section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(3) {
  width: 16% !important; /* Latinized */
  min-width: 100px;
}

.letter-content section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(4),
.jw-part section[id*="latinizing-hebrew-names"] table colgroup col:nth-child(4) {
  width: 16% !important; /* Original Sound */
  min-width: 140px;
}

/* Hebrew names table headers - prevent wrapping, center align */
.letter-content section[id*="latinizing-hebrew-names"] table thead th,
.jw-part section[id*="latinizing-hebrew-names"] table thead th {
  white-space: nowrap !important;
  word-wrap: normal !important;
  padding: 0.85rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

/* Hebrew names table cells - center align all content */
.letter-content section[id*="latinizing-hebrew-names"] table tbody td,
.jw-part section[id*="latinizing-hebrew-names"] table tbody td {
  padding: 1rem 0.75rem;
  vertical-align: middle;
  line-height: 1.7;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
}

/* Original column - stack Hebrew above English, both centered */
.letter-content section[id*="latinizing-hebrew-names"] table tbody td:first-child,
.jw-part section[id*="latinizing-hebrew-names"] table tbody td:first-child {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.2rem 0.75rem;
}

/* Hebrew text in Original column - centered, larger, no wrapping */
.letter-content section[id*="latinizing-hebrew-names"] table tbody td:first-child span[dir="rtl"],
.jw-part section[id*="latinizing-hebrew-names"] table tbody td:first-child span[dir="rtl"] {
  display: block;
  text-align: center;
  direction: rtl;
  font-size: 1.4em;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

/* English transliteration in Original column - centered, smaller, no awkward breaks */
.letter-content section[id*="latinizing-hebrew-names"] table tbody td:first-child,
.jw-part section[id*="latinizing-hebrew-names"] table tbody td:first-child {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
}

/* With Adonai Vowels column - center Hebrew text */
.letter-content section[id*="latinizing-hebrew-names"] table tbody td:nth-child(2) span[dir="rtl"],
.jw-part section[id*="latinizing-hebrew-names"] table tbody td:nth-child(2) span[dir="rtl"] {
  display: block;
  text-align: center;
  direction: rtl;
  font-size: 1.3em;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

/* Mobile adjustments for Hebrew names table */
@media (max-width: 768px) {
  .letter-content section[id*="latinizing-hebrew-names"] table,
  .jw-part section[id*="latinizing-hebrew-names"] table {
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .letter-content section[id*="latinizing-hebrew-names"] table thead th,
  .jw-part section[id*="latinizing-hebrew-names"] table thead th {
    font-size: 0.8rem;
    padding: 0.7rem 0.5rem;
    white-space: normal; /* Allow wrapping on mobile */
  }
  
  .letter-content section[id*="latinizing-hebrew-names"] table tbody td,
  .jw-part section[id*="latinizing-hebrew-names"] table tbody td {
    padding: 0.8rem 0.5rem;
  }
}

/* ===========================
   D2.1.1 Table - Astronomical Software and Ephemeris Tools
   Better structure for 3-column table
   =========================== */

/* Target D2.1.1 table specifically (3 columns with colgroup) */
.letter-content section[id*="d2.1.1-astronomical-software"] table,
.jw-part section[id*="d2.1.1-astronomical-software"] table {
  table-layout: fixed !important;
  font-size: 0.95rem;
}

/* D2.1.1 table column widths - optimized for readability */
.letter-content section[id*="d2.1.1-astronomical-software"] table colgroup col:nth-child(1),
.jw-part section[id*="d2.1.1-astronomical-software"] table colgroup col:nth-child(1) {
  width: 22% !important; /* Tool Name - increased from 18% */
  min-width: 140px;
}

.letter-content section[id*="d2.1.1-astronomical-software"] table colgroup col:nth-child(2),
.jw-part section[id*="d2.1.1-astronomical-software"] table colgroup col:nth-child(2) {
  width: 48% !important; /* Description - reduced from 53% to balance */
  min-width: 250px;
}

.letter-content section[id*="d2.1.1-astronomical-software"] table colgroup col:nth-child(3),
.jw-part section[id*="d2.1.1-astronomical-software"] table colgroup col:nth-child(3) {
  width: 30% !important; /* Website - increased from 28% */
  min-width: 180px;
}

/* D2.1.1 table headers - prevent wrapping */
.letter-content section[id*="d2.1.1-astronomical-software"] table thead th,
.jw-part section[id*="d2.1.1-astronomical-software"] table thead th {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0.85rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 600;
  text-align: left;
  vertical-align: middle;
}

/* D2.1.1 table cells - better spacing and wrapping */
.letter-content section[id*="d2.1.1-astronomical-software"] table tbody td,
.jw-part section[id*="d2.1.1-astronomical-software"] table tbody td {
  padding: 0.85rem 0.75rem;
  vertical-align: top;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
}

/* Tool Name column - emphasize with font weight */
.letter-content section[id*="d2.1.1-astronomical-software"] table tbody td:first-child,
.jw-part section[id*="d2.1.1-astronomical-software"] table tbody td:first-child {
  font-weight: 600;
  font-size: 1em;
  vertical-align: middle;
}

/* Description column - readable text */
.letter-content section[id*="d2.1.1-astronomical-software"] table tbody td:nth-child(2),
.jw-part section[id*="d2.1.1-astronomical-software"] table tbody td:nth-child(2) {
  font-size: 0.95em;
  line-height: 1.7;
}

/* Website column - links wrap properly */
.letter-content section[id*="d2.1.1-astronomical-software"] table tbody td:nth-child(3),
.jw-part section[id*="d2.1.1-astronomical-software"] table tbody td:nth-child(3) {
  font-size: 0.95em;
}

.letter-content section[id*="d2.1.1-astronomical-software"] table td a,
.jw-part section[id*="d2.1.1-astronomical-software"] table td a {
  word-break: break-all;
  overflow-wrap: break-word;
  display: inline-block;
  max-width: 100%;
}

/* Mobile adjustments for D2.1.1 table */
@media (max-width: 768px) {
  .letter-content section[id*="d2.1.1-astronomical-software"] table,
  .jw-part section[id*="d2.1.1-astronomical-software"] table {
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .letter-content section[id*="d2.1.1-astronomical-software"] table thead th,
  .jw-part section[id*="d2.1.1-astronomical-software"] table thead th {
    font-size: 0.8rem;
    padding: 0.7rem 0.5rem;
  }
  
  .letter-content section[id*="d2.1.1-astronomical-software"] table tbody td,
  .jw-part section[id*="d2.1.1-astronomical-software"] table tbody td {
    padding: 0.7rem 0.5rem;
  }
}

/* ===========================
   E1 Table - Jehovah's Witnesses Membership
   Better structure for 4-column membership table
   =========================== */

/* Target E1 table specifically (4 columns with colgroup) */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table,
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table {
  table-layout: fixed !important;
  font-size: 0.95rem;
}

/* E1 table column widths - optimized for readability */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(1),
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(1) {
  width: 8% !important; /* Year - increased from 7% */
  min-width: 70px;
}

.letter-content section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(2),
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(2) {
  width: 28% !important; /* Estimated Membership - increased from 25% to prevent header wrapping */
  min-width: 180px;
}

.letter-content section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(3),
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(3) {
  width: 15% !important; /* Estimated Memorial Partakers - increased from 12% */
  min-width: 120px;
}

.letter-content section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(4),
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table colgroup col:nth-child(4) {
  width: 49% !important; /* http Link / Notes - reduced from 53% to balance */
  min-width: 250px;
}

/* E1 table headers - prevent wrapping */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table thead th,
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table thead th {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 0.85rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 600;
  text-align: left;
  vertical-align: middle;
}

/* E1 table cells - better spacing and wrapping */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table tbody td,
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table tbody td {
  padding: 0.85rem 0.75rem;
  vertical-align: top;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
}

/* Year column - center align */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table tbody td:first-child,
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table tbody td:first-child {
  text-align: center;
  font-weight: 600;
  vertical-align: middle;
}

/* Membership and Memorial Partakers columns - right align numbers */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table tbody td:nth-child(2),
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table tbody td:nth-child(3),
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table tbody td:nth-child(2),
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table tbody td:nth-child(3) {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-size: 0.95em;
}

/* Links in E1 table - wrap properly */
.letter-content section[id*="e1-jehovahs-witnesses-membership"] table td a,
.jw-part section[id*="e1-jehovahs-witnesses-membership"] table td a {
  word-break: break-all;
  overflow-wrap: break-word;
  display: inline-block;
  max-width: 100%;
}

/* Mobile adjustments for E1 table */
@media (max-width: 768px) {
  .letter-content section[id*="e1-jehovahs-witnesses-membership"] table,
  .jw-part section[id*="e1-jehovahs-witnesses-membership"] table {
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .letter-content section[id*="e1-jehovahs-witnesses-membership"] table thead th,
  .jw-part section[id*="e1-jehovahs-witnesses-membership"] table thead th {
    font-size: 0.8rem;
    padding: 0.7rem 0.5rem;
  }
  
  .letter-content section[id*="e1-jehovahs-witnesses-membership"] table tbody td,
  .jw-part section[id*="e1-jehovahs-witnesses-membership"] table tbody td {
    padding: 0.7rem 0.5rem;
  }
}

/* Links in table cells */
.letter-table a,
.jw-part table a {
  color: #2a64b8;
  text-decoration: none;
  word-break: break-all;
}

.letter-table a:hover,
.jw-part table a:hover {
  text-decoration: underline;
}

/* ===========================
   Scroll Margin for Accurate Navigation
   Ensures headings align correctly when scrolling to sections
   Applies to all JW letter pages (all languages)
   =========================== */

/* Headings with IDs need scroll-margin-top to account for fixed header */
.letter-content h2[id],
.letter-content h3[id],
.jw-part h2[id],
.jw-part h3[id] {
  scroll-margin-top: 140px; /* Account for header + padding */
}

/* Sections with IDs also need scroll offset */
.letter-content section[id],
.jw-part section[id] {
  scroll-margin-top: 140px; /* Account for header + padding */
}

/* Ensure all headings in letter content have proper scroll offset */
.letter-content h2,
.jw-part h2 {
  scroll-margin-top: 140px;
}

.letter-content h3,
.jw-part h3 {
  scroll-margin-top: 140px;
}

/* ===========================
   Reference Links and HTTP Links - Blue Styling
   Applies to all JW letter pages (all languages)
   =========================== */

/* All HTTP/HTTPS links - make them blue */
.letter-content a[href^="http"],
.letter-content a[href^="https"],
.jw-part a[href^="http"],
.jw-part a[href^="https"] {
  color: #2a64b8 !important;
  text-decoration: none;
}

.letter-content a[href^="http"]:hover,
.letter-content a[href^="https"]:hover,
.jw-part a[href^="http"]:hover,
.jw-part a[href^="https"]:hover {
  color: #357abd !important;
  text-decoration: underline;
}

/* Reference section anchor links (A1-A3, B1-B4, C1-C5, D1-D4, E1-E2, F1-F2, etc.) - make them blue */
/* Match all reference section links from A1-A3, B1-B4, C1-C5, D1-D4, E1-E2, F1-F2, and appendix- links */
.letter-content a[href^="#a1-"],
.letter-content a[href^="#a2-"],
.letter-content a[href^="#a3-"],
.letter-content a[href^="#b1-"],
.letter-content a[href^="#b2-"],
.letter-content a[href^="#b3-"],
.letter-content a[href^="#b4-"],
.letter-content a[href^="#c1-"],
.letter-content a[href^="#c2-"],
.letter-content a[href^="#c3-"],
.letter-content a[href^="#c4-"],
.letter-content a[href^="#c5-"],
.letter-content a[href^="#d1-"],
.letter-content a[href^="#d2-"],
.letter-content a[href^="#d3-"],
.letter-content a[href^="#d4-"],
.letter-content a[href^="#e1-"],
.letter-content a[href^="#e2-"],
.letter-content a[href^="#f1-"],
.letter-content a[href^="#f2-"],
.letter-content a[href^="#appendix-"],
.jw-part a[href^="#a1-"],
.jw-part a[href^="#a2-"],
.jw-part a[href^="#a3-"],
.jw-part a[href^="#b1-"],
.jw-part a[href^="#b2-"],
.jw-part a[href^="#b3-"],
.jw-part a[href^="#b4-"],
.jw-part a[href^="#c1-"],
.jw-part a[href^="#c2-"],
.jw-part a[href^="#c3-"],
.jw-part a[href^="#c4-"],
.jw-part a[href^="#c5-"],
.jw-part a[href^="#d1-"],
.jw-part a[href^="#d2-"],
.jw-part a[href^="#d3-"],
.jw-part a[href^="#d4-"],
.jw-part a[href^="#e1-"],
.jw-part a[href^="#e2-"],
.jw-part a[href^="#f1-"],
.jw-part a[href^="#f2-"],
.jw-part a[href^="#appendix-"] {
  color: #2a64b8 !important;
  text-decoration: none;
}

.letter-content a[href^="#a1-"]:hover,
.letter-content a[href^="#a2-"]:hover,
.letter-content a[href^="#a3-"]:hover,
.letter-content a[href^="#b1-"]:hover,
.letter-content a[href^="#b2-"]:hover,
.letter-content a[href^="#b3-"]:hover,
.letter-content a[href^="#b4-"]:hover,
.letter-content a[href^="#c1-"]:hover,
.letter-content a[href^="#c2-"]:hover,
.letter-content a[href^="#c3-"]:hover,
.letter-content a[href^="#c4-"]:hover,
.letter-content a[href^="#c5-"]:hover,
.letter-content a[href^="#d1-"]:hover,
.letter-content a[href^="#d2-"]:hover,
.letter-content a[href^="#d3-"]:hover,
.letter-content a[href^="#d4-"]:hover,
.letter-content a[href^="#e1-"]:hover,
.letter-content a[href^="#e2-"]:hover,
.letter-content a[href^="#f1-"]:hover,
.letter-content a[href^="#f2-"]:hover,
.letter-content a[href^="#appendix-"]:hover,
.jw-part a[href^="#a1-"]:hover,
.jw-part a[href^="#a2-"]:hover,
.jw-part a[href^="#a3-"]:hover,
.jw-part a[href^="#b1-"]:hover,
.jw-part a[href^="#b2-"]:hover,
.jw-part a[href^="#b3-"]:hover,
.jw-part a[href^="#b4-"]:hover,
.jw-part a[href^="#c1-"]:hover,
.jw-part a[href^="#c2-"]:hover,
.jw-part a[href^="#c3-"]:hover,
.jw-part a[href^="#c4-"]:hover,
.jw-part a[href^="#c5-"]:hover,
.jw-part a[href^="#d1-"]:hover,
.jw-part a[href^="#d2-"]:hover,
.jw-part a[href^="#d3-"]:hover,
.jw-part a[href^="#d4-"]:hover,
.jw-part a[href^="#e1-"]:hover,
.jw-part a[href^="#e2-"]:hover,
.jw-part a[href^="#f1-"]:hover,
.jw-part a[href^="#f2-"]:hover,
.jw-part a[href^="#appendix-"]:hover {
  color: #357abd !important;
  text-decoration: underline;
}

/* ===========================
   Reading Width + Overflow Scroll
   Ensure nested tables and images can overflow-scroll horizontally
   on small screens without shrinking the ~72ch reading width
   =========================== */

/* Ensure letter content maintains reading width (70ch for optimal reading) */
/* Only apply if not already set by parent styles */
.letter-content:not([style*="max-width"]),
.jw-part:not([style*="max-width"]) {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

/* Prevent content container from shrinking when tables/images overflow */
.letter-content,
.jw-part {
  min-width: 0; /* Allow flex shrinking only when needed */
  overflow-x: visible; /* Allow children to overflow */
}

/* Nested tables - ensure they can scroll horizontally */
/* Tables inside table cells need special handling */
.letter-table td table,
.jw-part table td table,
.letter-content table td table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  margin: 0.5rem 0;
}

/* Wrap nested tables in scrollable container if they have wrapper */
.letter-table td .table-wrapper,
.jw-part table td .table-wrapper,
.letter-content table td .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0;
  width: 100%;
}

/* Images - allow horizontal scroll on small screens without shrinking text */
.letter-content img,
.jw-part img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Wide images with explicit width should scroll, not shrink container */
.letter-content img[width],
.jw-part img[width] {
  /* Allow image to be wider than container, but don't force container wider */
  max-width: max-content;
}

/* On mobile: ensure wide images can overflow horizontally */
@media (max-width: 768px) {
  /* Normal images respect container width */
  .letter-content img:not([width]),
  .jw-part img:not([width]) {
    max-width: 100%;
  }
  
  /* Wide images can overflow container */
  .letter-content img[width],
  .jw-part img[width] {
    max-width: none;
    width: auto;
  }
  
  /* Ensure container doesn't shrink when content overflows */
  .letter-content,
  .jw-part {
    overflow-x: visible;
    width: 100%;
    max-width: 70ch;
  }
}

/* Mobile table adjustments */
@media (max-width: 768px) {
  .table-wrapper {
    margin: 1rem -1rem;
    padding: 0 1rem;
  }
  
  .letter-table,
  .jw-part table {
    font-size: 0.85rem;
  }
  
  .letter-table th,
  .letter-table td,
  .jw-part table th,
  .jw-part table td {
    padding: 8px 10px;
  }
  
  /* Make links wrap better on mobile */
  .letter-table a,
  .jw-part table a {
    word-break: break-word;
    hyphens: auto;
  }
  
  /* Nested tables in cells - ensure they scroll */
  .letter-table td table,
  .jw-part table td table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    min-width: 100%;
  }
}

/* ===========================
   Footnote Popover
   Shows footnotes in a popover near the click target
   =========================== */

.footnote-popover {
  position: absolute;
  display: none;
  width: 400px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #2c3e50;
  animation: popoverFadeIn 0.2s ease;
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.footnote-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e8ecf0;
  background: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.footnote-popover-number {
  font-weight: 600;
  color: #2a64b8;
  font-size: 0.85rem;
}

.footnote-popover-close {
  background: none;
  border: none;
  color: #6b7391;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 24px;
  height: 24px;
}

.footnote-popover-close:hover {
  background: #e8ecf0;
  color: #2c3e50;
}

.footnote-popover-content {
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
}

.footnote-popover-content p {
  margin: 0 0 0.75rem 0;
}

.footnote-popover-content p:last-child {
  margin-bottom: 0;
}

.footnote-active {
  background: #eaf0ff !important;
  border-radius: 3px;
  padding: 1px 2px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .footnote-popover {
    width: calc(100vw - 32px);
    max-width: 400px;
  }
  
  .footnote-popover-content {
    max-height: 250px;
    font-size: 0.85rem;
  }
}

/* ===========================
   Language Switcher for Letter Pages
   Letter pages have both header pills and hero switcher - both are available
   =========================== */

.jw-language-switcher {
  position: relative;
  display: inline-block;
  z-index: 100;
}

.jw-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  position: relative;
  font-size: 0.9rem !important;
  padding: 0.65rem 1.25rem !important;
  min-height: 44px; /* Touch target size */
}

.jw-lang-btn-text {
  font-weight: 600;
  letter-spacing: 0.3px;
  font-size: 0.9rem;
}

.jw-lang-btn-icon {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  margin-left: 0.2rem;
}

.jw-lang-btn.open .jw-lang-btn-icon {
  transform: rotate(180deg);
}

.jw-lang-btn.open {
  background: #4a90e2 !important;
  border-color: #4a90e2 !important;
  color: #fff !important;
}

.jw-lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.jw-lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.jw-lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #2d3748;
  transition: all 0.15s ease;
  border-bottom: 1px solid #f1f5f9;
}

.jw-lang-option:last-child {
  border-bottom: none;
  border-radius: 0 0 6px 6px;
}

.jw-lang-option:first-child {
  border-radius: 6px 6px 0 0;
}

.jw-lang-option:hover {
  background: #f8fafc;
  color: #1a202c;
  padding-left: 1.25rem;
}

.jw-lang-option:focus {
  outline: none;
  background: #f1f5f9;
  box-shadow: inset 0 0 0 2px #4a90e2;
}

.jw-lang-option.active {
  background: #eff6ff;
  color: #1e40af;
  font-weight: 600;
}

.jw-lang-option-native {
  flex: 1;
  font-size: 0.95rem;
}

.jw-lang-option-code {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.jw-lang-option.active .jw-lang-option-code {
  color: #3b82f6;
}

.jw-lang-option-check {
  color: #4a90e2;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .jw-lang-dropdown {
    min-width: 180px;
    right: 0;
    left: auto;
  }

  .jw-lang-dropdown.open {
    transform: translateY(0);
  }
}

/* RTL support */
[dir="rtl"] .jw-lang-btn,
[dir="rtl"] .jw-lang-option {
  direction: ltr; /* Keep language switcher LTR for readability */
}

/* ===========================
   Compact Share Bar (Inline between sections)
   =========================== */

.compact-share-bar {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  padding: 0.75rem 0;
  /* Removed border-top to eliminate double lines */
  border-bottom: 1px solid #e8ecf0;
}

.compact-share-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Unified share button styling - ALL buttons (buttons and links) must look identical */
/* Use high specificity to override Bootstrap and all other styles */
.compact-share-bar .compact-share-btn,
.compact-share-bar a.compact-share-btn,
.compact-share-bar button.compact-share-btn,
.compact-share-inner .compact-share-btn,
.compact-share-inner a.compact-share-btn,
.compact-share-inner button.compact-share-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0.5rem 0.9rem !important;
  background: #fff !important;
  border: 1px solid #d0d7de !important;
  border-radius: 6px !important;
  color: #57606a !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  /* Reset any inherited styles */
  margin: 0 !important;
  font-family: inherit !important;
  line-height: 1.5 !important;
  /* Override Bootstrap or other framework styles */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  /* Remove Bootstrap button overrides */
  vertical-align: baseline !important;
  user-select: none !important;
  /* Ensure text and icons are properly aligned */
  text-align: center !important;
}

/* Remove any default link styles that might override - use higher specificity */
.compact-share-bar a.compact-share-btn:link,
.compact-share-bar a.compact-share-btn:visited,
.compact-share-bar a.compact-share-btn:active,
.compact-share-bar a.compact-share-btn:focus,
.compact-share-inner a.compact-share-btn:link,
.compact-share-inner a.compact-share-btn:visited,
.compact-share-inner a.compact-share-btn:active,
.compact-share-inner a.compact-share-btn:focus,
.letter-end-share-component a.compact-share-btn:link,
.letter-end-share-component a.compact-share-btn:visited,
.letter-end-share-component a.compact-share-btn:active,
.letter-end-share-component a.compact-share-btn:focus,
.post-body a.compact-share-btn:link,
.post-body a.compact-share-btn:visited,
.post-body a.compact-share-btn:active,
.post-body a.compact-share-btn:focus {
  color: #57606a !important;
  text-decoration: none !important;
  background: #fff !important;
  border: 1px solid #d0d7de !important;
}

/* Default hover state - override with higher specificity */
.compact-share-bar .compact-share-btn:hover,
.compact-share-bar a.compact-share-btn:hover,
.compact-share-bar button.compact-share-btn:hover,
.compact-share-inner .compact-share-btn:hover,
.compact-share-inner a.compact-share-btn:hover,
.compact-share-inner button.compact-share-btn:hover,
.letter-end-share-component .compact-share-btn:hover,
.letter-end-share-component a.compact-share-btn:hover,
.letter-end-share-component button.compact-share-btn:hover,
.post-body .compact-share-btn:hover,
.post-body a.compact-share-btn:hover,
.post-body button.compact-share-btn:hover {
  background: #f6f8fa !important;
  border-color: #8c959f !important;
  color: #24292f !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.compact-share-bar .compact-share-btn i,
.compact-share-bar a.compact-share-btn i,
.compact-share-bar button.compact-share-btn i,
.compact-share-inner .compact-share-btn i,
.compact-share-inner a.compact-share-btn i,
.compact-share-inner button.compact-share-btn i,
.letter-end-share-component .compact-share-btn i,
.letter-end-share-component a.compact-share-btn i,
.letter-end-share-component button.compact-share-btn i,
.post-body .compact-share-btn i,
.post-body a.compact-share-btn i,
.post-body button.compact-share-btn i {
  font-size: 0.9rem !important;
  display: inline-block !important;
  line-height: 1 !important;
}

.compact-share-bar .compact-share-btn span,
.compact-share-bar a.compact-share-btn span,
.compact-share-bar button.compact-share-btn span,
.compact-share-inner .compact-share-btn span,
.compact-share-inner a.compact-share-btn span,
.compact-share-inner button.compact-share-btn span,
.letter-end-share-component .compact-share-btn span,
.letter-end-share-component a.compact-share-btn span,
.letter-end-share-component button.compact-share-btn span,
.post-body .compact-share-btn span,
.post-body a.compact-share-btn span,
.post-body button.compact-share-btn span {
  font-size: 0.85rem !important;
  display: inline-block !important;
  line-height: 1 !important;
}

/* Special hover colors for each button type - use highest specificity */
.compact-share-bar .compact-share-copy:hover,
.compact-share-bar a.compact-share-copy:hover,
.compact-share-bar button.compact-share-copy:hover,
.compact-share-inner .compact-share-copy:hover,
.compact-share-inner a.compact-share-copy:hover,
.compact-share-inner button.compact-share-copy:hover,
.letter-end-share-component .compact-share-copy:hover,
.letter-end-share-component a.compact-share-copy:hover,
.letter-end-share-component button.compact-share-copy:hover,
.post-body .compact-share-copy:hover,
.post-body a.compact-share-copy:hover,
.post-body button.compact-share-copy:hover {
  background: #4a90e2 !important;
  border-color: #4a90e2 !important;
  color: #fff !important;
}

.compact-share-bar .compact-share-facebook:hover,
.compact-share-bar a.compact-share-facebook:hover,
.compact-share-inner .compact-share-facebook:hover,
.compact-share-inner a.compact-share-facebook:hover,
.letter-end-share-component .compact-share-facebook:hover,
.letter-end-share-component a.compact-share-facebook:hover,
.post-body .compact-share-facebook:hover,
.post-body a.compact-share-facebook:hover {
  background: #1877f2 !important;
  border-color: #1877f2 !important;
  color: #fff !important;
}

.compact-share-bar .compact-share-twitter:hover,
.compact-share-bar a.compact-share-twitter:hover,
.compact-share-inner .compact-share-twitter:hover,
.compact-share-inner a.compact-share-twitter:hover,
.letter-end-share-component .compact-share-twitter:hover,
.letter-end-share-component a.compact-share-twitter:hover,
.post-body .compact-share-twitter:hover,
.post-body a.compact-share-twitter:hover {
  background: #1da1f2 !important;
  border-color: #1da1f2 !important;
  color: #fff !important;
}

.compact-share-bar .compact-share-linkedin:hover,
.compact-share-bar a.compact-share-linkedin:hover,
.compact-share-inner .compact-share-linkedin:hover,
.compact-share-inner a.compact-share-linkedin:hover,
.letter-end-share-component .compact-share-linkedin:hover,
.letter-end-share-component a.compact-share-linkedin:hover,
.post-body .compact-share-linkedin:hover,
.post-body a.compact-share-linkedin:hover {
  background: #0a66c2 !important;
  border-color: #0a66c2 !important;
  color: #fff !important;
}

.compact-share-bar .compact-share-print:hover,
.compact-share-bar button.compact-share-print:hover,
.compact-share-inner .compact-share-print:hover,
.compact-share-inner button.compact-share-print:hover,
.letter-end-share-component .compact-share-print:hover,
.letter-end-share-component button.compact-share-print:hover,
.post-body .compact-share-print:hover,
.post-body button.compact-share-print:hover {
  background: #6b7280 !important;
  border-color: #6b7280 !important;
  color: #fff !important;
}

.compact-share-bar .compact-share-citation:hover,
.compact-share-bar button.compact-share-citation:hover,
.compact-share-inner .compact-share-citation:hover,
.compact-share-inner button.compact-share-citation:hover,
.letter-end-share-component .compact-share-citation:hover,
.letter-end-share-component button.compact-share-citation:hover,
.post-body .compact-share-citation:hover,
.post-body button.compact-share-citation:hover {
  background: #6c757d !important;
  border-color: #6c757d !important;
  color: #fff !important;
}

.compact-share-btn.success {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}

@media (max-width: 768px) {
  .compact-share-bar {
    margin: 1rem 0;
    padding: 0.5rem 0;
  }
  
  .compact-share-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .compact-share-btn span {
    display: none; /* Hide text labels on mobile, show only icons */
  }
}

/* ===========================
   Legacy Share & Citation Component (kept for backward compatibility)
   =========================== */

.share-citation-component {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 3rem auto;
  max-width: 800px;
  box-shadow: 0 2px 12px rgba(15, 17, 26, 0.08);
}

.share-citation-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e8ecf0;
}

.share-citation-header h4 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a202c;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.share-citation-header i {
  color: #4a90e2;
}

.share-citation-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Share Section */
.share-section {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e8ecf0;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: 2px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  color: #57606a;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-share:active {
  transform: translateY(0);
}

.btn-share i {
  font-size: 1rem;
}

/* Copy Link Button */
.btn-copy-link {
  border-color: #4a90e2;
  color: #4a90e2;
}

.btn-copy-link:hover {
  background: #4a90e2;
  color: #fff;
  border-color: #4a90e2;
}

.btn-copy-link.success {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}

/* Social Share Buttons */
.btn-social {
  color: #57606a;
  border-color: #d0d7de;
}

.btn-facebook:hover {
  background: #1877f2;
  border-color: #1877f2;
  color: #fff;
}

.btn-twitter:hover {
  background: #1da1f2;
  border-color: #1da1f2;
  color: #fff;
}

.btn-linkedin:hover {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #fff;
}

.btn-email:hover {
  background: #6c757d;
  border-color: #6c757d;
  color: #fff;
}

/* Citation Section */
.citation-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.25rem;
}

.citation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.citation-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1a202c;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.citation-header i {
  color: #4a90e2;
}

.btn-citation-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #4a90e2;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-citation-copy:hover {
  background: #357abd;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.btn-citation-copy:active {
  transform: translateY(0);
}

.btn-citation-copy.success {
  background: #28a745;
}

.citation-text {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #2c3e50;
  padding: 1rem;
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 6px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .share-citation-component {
    margin: 2rem 1rem;
    padding: 1.25rem;
  }

  .share-buttons {
    flex-direction: column;
  }

  .btn-share {
    width: 100%;
    justify-content: center;
  }

  .citation-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .btn-citation-copy {
    width: 100%;
    justify-content: center;
  }
}

/* ===========================
   Dark Mode Support
   @media (prefers-color-scheme: dark) overrides for TOC and content panels
   =========================== */

@media (prefers-color-scheme: dark) {
  /* TOC dark mode */
  .toc {
    background: #1a1d2e;
    border-color: #2d3246;
    color: #e2e8f0;
  }
  
  .toc h3,
  .toc .text-nav-title {
    color: #94a3b8;
  }
  
  .toc a,
  .toc .toc-link {
    color: #cbd5e1;
  }
  
  .toc a:hover,
  .toc .toc-link:hover {
    background: rgba(42, 100, 184, 0.15);
    color: #60a5fa;
  }
  
  .toc a.active,
  .toc .toc-link.active {
    background: rgba(42, 100, 184, 0.25);
    color: #60a5fa;
    border-left-color: #60a5fa;
  }
  
  .toc .toc-link-nested {
    color: #94a3b8;
  }
  
  .toc .toc-link-nested:hover {
    background: rgba(42, 100, 184, 0.15);
    color: #60a5fa;
  }
  
  .toc .toc-link-nested.active {
    background: rgba(42, 100, 184, 0.25);
    color: #60a5fa;
    border-left-color: #60a5fa;
  }
  
  .toc hr {
    background: #2d3246;
  }
  
  .toc .muted {
    color: #64748b;
  }
  
  /* Letter content dark mode */
  .letter-content,
  .jw-part {
    background: #1a1d2e;
    border-color: #2d3246;
    color: #e2e8f0;
  }
  
  .letter-content h1,
  .letter-content h2,
  .jw-part h1,
  .jw-part h2 {
    color: #f1f5f9;
  }
  
  .letter-content h3,
  .jw-part h3 {
    color: #e2e8f0;
  }
  
  .letter-content p,
  .letter-content li,
  .jw-part p,
  .jw-part li {
    color: #cbd5e1;
  }
  
  .letter-content a,
  .jw-part a {
    color: #60a5fa;
  }
  
  .letter-content a:hover,
  .jw-part a:hover {
    color: #93c5fd;
  }
  
  /* Search wrap dark mode */
  .search-wrap {
    background: #1a1d2e;
    border-color: #2d3246;
  }
  
  .search-wrap input {
    background: #0f172a;
    border-color: #1e293b;
    color: #e2e8f0;
  }
  
  .search-wrap input::placeholder {
    color: #64748b;
  }
  
  .search-wrap i {
    color: #94a3b8;
  }
  
  /* Table dark mode */
  .letter-table,
  .jw-part table {
    background: #0f172a;
    border-color: #1e293b;
  }
  
  .letter-table thead,
  .jw-part table thead {
    background: #1e293b;
  }
  
  .letter-table th,
  .jw-part table th {
    color: #f1f5f9;
    border-color: #334155;
  }
  
  .letter-table td,
  .jw-part table td {
    color: #cbd5e1;
    border-color: #1e293b;
  }
  
  .letter-table tbody tr:hover,
  .jw-part table tbody tr:hover {
    background: #1e293b;
  }
  
  /* Footnote popover dark mode */
  .footnote-popover {
    background: #1a1d2e;
    border-color: #2d3246;
    color: #e2e8f0;
  }
  
  .footnote-popover-header {
    background: #0f172a;
    border-color: #2d3246;
  }
  
  .footnote-popover-number {
    color: #60a5fa;
  }
  
  .footnote-popover-close {
    color: #94a3b8;
  }
  
  .footnote-popover-close:hover {
    background: #2d3246;
    color: #e2e8f0;
  }
  
  .footnote-popover-content {
    color: #cbd5e1;
  }
  
  .footnote-active {
    background: rgba(42, 100, 184, 0.25) !important;
  }
}

/* ===========================
   Letter Page Design System
   Common styles for all letter pages (except jw.html)
   Includes: article container, spacing, scripture blocks, action items
   =========================== */

/* CSS Variables for letter pages */
:root {
  --brand-blue: #4a90e2;
  --ink: #2c3e50;
}

/* Letter Hero Section */
.letter-hero {
  padding: 84px 0 40px;
  background: linear-gradient(
    135deg,
    rgba(74, 144, 226, 0.06),
    rgba(53, 122, 189, 0.08)
  );
}

.letter-hero h1 {
  font-weight: 800;
  letter-spacing: -0.3px;
}

.sub {
  color: #3e4a57;
  max-width: 860px;
  margin: 10px auto 0;
}

.section {
  padding: 48px 0;
}

/* Article container with better visual design */
article {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding: 1.25rem 1.25rem;
}

@media (max-width: 991.98px) {
  article {
    padding: 1rem 0.875rem;
  }
}

/* Table of Contents (TOC) / Outline */
.outline {
  position: sticky;
  top: 96px;
}

.outline .card {
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.outline a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #445;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.outline a.active,
.outline a:hover {
  background: rgba(74, 144, 226, 0.09);
  color: #2a64b8;
}

/* Scripture blocks */
.scripture {
  border-left: 4px solid var(--brand-blue);
  background: #f8fafc;
  margin-bottom: 0.85rem !important;
  margin-top: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 0.875rem 1rem !important; /* Reduced from p-4 (1.5rem) */
}

.scripture blockquote {
  margin-bottom: 0.5rem;
}

.scripture footer {
  margin-top: 0.5rem;
}

/* Action items (e.g., "Action:" paragraphs) */
.action-item {
  margin-top: 0.85rem;
  margin-bottom: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e9edf3;
}

.action-item strong {
  color: var(--brand-blue);
  font-weight: 700;
}

/* Footer CTA */
.foot-cta {
  background: #1f2431;
  color: #eaf0f7;
  border-radius: 18px;
  padding: 24px;
}

/* Paragraph spacing */
.section p {
  margin-bottom: 0.55rem;
  margin-top: 0;
  line-height: 1.65;
}

/* More spacing for paragraphs after scripture */
.scripture + p {
  margin-top: 0.7rem;
  margin-bottom: 0.55rem;
}

/* Section headings */
.section h3 {
  margin-bottom: 0.85rem;
  margin-top: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  font-size: 1.55rem;
  letter-spacing: -0.2px;
  padding-bottom: 0.45rem;
  /* Removed border-bottom to avoid double lines with section borders */
}

/* First section heading doesn't need top margin */
article > section:first-child h3 {
  margin-top: 0;
}

/* Better visual breaks between sections */
article > section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

/* Removed section border-bottom to eliminate double lines */

article > hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid #e9edf3;
}

/* Improve readability with better max-width for text */
article section {
  max-width: 100%;
}

article p {
  max-width: 72ch;
}

/* Footer stack: Share bar → Back button → CTA band */
.compact-share-bar,
.letter-end-share-component {      /* your share row */
  margin-top: 8px !important;
  margin-bottom: 10px !important;
  display: block !important; /* Ensure share bar is block-level */
  width: 100% !important;
}

.letter-bottom-nav {               /* the back button wrapper */
  margin-top: 6px !important;
  margin-bottom: 0.5rem !important; /* ~8px - tighten space to CTA band */
  display: block !important; /* Ensure nav is block-level */
  width: 100% !important;
}

.letter-bottom-nav .nav-buttons .btn {          /* tidy, compact button */
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-weight: 600;
  min-width: 220px;
}

/* If your article has <hr> near the footer, shrink them */
.single-blog-item .blog-item-content hr {
  margin: 10px 0 !important;
}

/* Some themes inject extra paragraph/br space; neutralize it here */
.letter-end-share-component + p,
.letter-end-share-component + br,
.letter-bottom-nav + br {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* --- Footer vertical rhythm tuning --- */

.letter-bottom-nav + .section .cta-band {
  margin-top: 0.75rem !important; /* ~12px */
}

/* Mobile: even tighter grouping for a cohesive flow */
@media (max-width: 768px) {
  .letter-bottom-nav {
    margin-bottom: 0.25rem !important; /* ~4px */
    text-align: center;
  }

  .letter-bottom-nav + .section .cta-band {
    margin-top: 0.5rem !important; /* ~8px */
  }

  /* Center alignment for smaller viewports */
  .letter-bottom-nav .nav-buttons .btn {
    width: 100%;
    max-width: 280px;
  }

  .cta-band {
    border-radius: 14px;
    padding: 18px 20px;
  }

  .cta-band h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
  }

  .cta-band p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
}

/* ===== Print polish for letters and blog posts ===== */
@media print {
  /* Hide chrome */
  header, .navigation, .outline, .enhanced-navigation,
  .compact-share-bar, .letter-bottom-nav,
  .site-footer, .cta-band, .language-selector-top,
  .breadcrumb, .post-footer, .toc, #toc, #toc-groups { 
    display: none !important; 
  }

  /* Make the article full width and readable */
  .blog-wrap, .single-blog-item, .single-blog-item .blog-item-content,
  main, article { 
    padding: 0 !important; 
    margin: 0 !important; 
    border: 0 !important; 
    box-shadow: none !important; 
  }

  article { 
    max-width: none !important; 
    font-size: 11pt; 
    line-height: 1.45; 
    color: #000; 
  }

  /* Links: append URL after text (helpful in print) */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt; 
    color: #555;
  }
  /* But don't duplicate for internal anchors */
  a[href^="#"]:after { 
    content: ""; 
  }

  /* Images and tables */
  img, svg, video { 
    max-width: 100% !important; 
  }
  table { 
    width: 100% !important; 
    page-break-inside: auto; 
    border-collapse: collapse; 
  }
  thead { 
    display: table-header-group; 
  } /* repeat headers on each page */
  tr, img { 
    page-break-inside: avoid; 
  }

  /* Page breaks (use these classes in HTML where needed) */
  .print-break-before { 
    page-break-before: always !important; 
  }
  .print-break-after { 
    page-break-after: always !important; 
  }

  /* Kill dark backgrounds for ink savings */
  * { 
    background: transparent !important; 
    box-shadow: none !important; 
  }
}