/* ============================================================
   Reader styles (assets/js/secure-reader.js + assets/js/views/reader.js)
   .rdr-*: the secure full-screen reading overlay and the minimised
   player strip. .post-read-*: the /post page itself (merged from the
   old post-read.css).
   ============================================================ */

.rdr-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: rgba(8, 10, 16, 0.72);
  backdrop-filter: blur(4px);
}

.rdr-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-primary);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

@media (min-width: 900px) {
  .rdr-overlay { padding: 24px; }
  .rdr-shell {
    height: calc(100% - 0px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  }
}

/* ---- Topbar ------------------------------------------------- */
.rdr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}

.rdr-title { display: flex; flex-direction: column; min-width: 0; }

.rdr-type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-primary);
}

.rdr-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rdr-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rdr-close:hover { background: var(--error-light); color: var(--error); }

/* ---- Progress bar ------------------------------------------- */
.rdr-progress {
  flex: 0 0 auto;
  height: 3px;
  width: 100%;
  background: var(--bg-tertiary);
}
.rdr-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-primary, var(--brand-primary));
  transition: width 0.25s ease;
}

/* ---- Scroll area -------------------------------------------- */
.rdr-scroll {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
  /* Deterrence: block selection/highlight across the whole reader. */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Watermark tiles the viewer's name faintly behind the content. */
.rdr-watermark {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 800;
  color: var(--text-primary);
  opacity: 0.04;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 24px;
}

.rdr-body {
  position: relative;
  z-index: 1;
  padding: 20px 18px 60px;
  max-width: 760px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .rdr-body { padding: 32px 32px 80px; }
}

.rdr-loading {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 12px;
  font-size: 14px;
}

/* ---- Rendered content --------------------------------------- */
.rdr-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-md);
}

.rdr-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rdr-pdf-page {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* Inline document holder inside block content (library 'file' blocks and
   hub 'pdf' blocks). The rendered pdf/docx/epub lands inside this element. */
.rdr-inline-file {
  width: 100%;
  margin: 12px 0;
}
.rdr-inline-file .rdr-loading {
  padding: 16px 0;
}

/* mammoth output + block content reuse .lib-article typography. */
.rdr-docx img { max-width: 100%; height: auto; }
.rdr-docx table { width: 100%; border-collapse: collapse; }

.rdr-epub {
  width: 100%;
  min-height: 60vh;
}
.rdr-epub iframe { border: 0; }

/* ---- Read next ---------------------------------------------- */
.rdr-next {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 18px 60px;
}
.rdr-next[hidden] { display: none; }

.rdr-next-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.rdr-next-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
}

.rdr-next-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rdr-next-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.rdr-next-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: var(--bg-tertiary);
}

.rdr-next-cover-fallback {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
  color: var(--text-inverse);
  background: var(--gradient-primary, var(--brand-primary));
}

.rdr-next-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rdr-next-author {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Toast (shared by reader + audiolite completion) -------- */
.rdr-toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 10;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: var(--success);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: rdr-toast-in 0.2s ease;
}
@keyframes rdr-toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- Illustration caption (inline figure in block content) -- */
.read-block-figure {
  margin: 14px 0;
}
.read-block-figure .read-block-media {
  cursor: zoom-in;
}
.read-block-caption {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

/* ---- Tap-to-expand lightbox --------------------------------- */
/* Sits above the reader overlay (z-index 3000) and any read modal.
   The compound selector + !important beats hub.css's themed
   `[data-theme] .modal-overlay { background: … !important }` (equal
   specificity, but reader.css loads later) so the backdrop stays dark in
   both themes and the white caption/close stay legible. */
.modal-overlay.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 8, 12, 0.92) !important;
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: default;
}
.lightbox-img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}
.lightbox-caption {
  max-width: 640px;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.18); }

/* ---- Engagement bar (library reader bottom bar) ----------- */
.rdr-engagement-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.rdr-eng-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rdr-eng-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.rdr-eng-btn.active { color: var(--brand-primary); }

.rdr-eng-icon-img {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

/* ---- Drop-up menu (topbar, extreme right) ----------------- */
.rdr-menu-wrapper {
  position: relative;
  flex: 0 0 auto;
}

.rdr-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.rdr-menu-toggle:hover { background: var(--brand-primary-light); color: var(--brand-primary); }

.rdr-menu-dropup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  overflow: hidden;
}
.rdr-menu-dropup.active { display: block; }

.rdr-menu-dropup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
}
.rdr-menu-dropup-item:hover { background: var(--bg-tertiary); }

.rdr-menu-dropup-author {
  border-top: 1px solid var(--border);
  font-weight: 600;
}

.rdr-menu-author-img {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}
.rdr-menu-author-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 700;
}

/* ============================================================
   Audiolite minimizer: floating player (desktop) / thumbnail (mobile)
   ============================================================ */

.audiolite-floating-player {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 2000;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.floating-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.floating-player-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.floating-player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.floating-player-btn:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.floating-player-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.floating-player-cover {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.floating-player-cover-fallback {
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-player-cover-fallback::before {
  content: '';
  width: 24px;
  height: 24px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E") center/contain no-repeat;
  color: var(--text-inverse);
}

.floating-player-info {
  flex: 1;
  min-width: 0;
}

.floating-player-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.floating-player-controls {
  display: flex;
  gap: 8px;
}

.floating-player-progress {
  height: 3px;
  background: var(--bg-tertiary);
}

.floating-player-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand-primary);
  transition: width 0.1s linear;
}

/* Mobile thumbnail player. It floats above the pill nav instead of under it,
   because the nav is z-index 9000 and would cover both buttons. */
.audiolite-mini-player {
  position: fixed;
  bottom: calc(var(--bottom-bar-h) + 10px);
  left: 14px;
  right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 2000;
  overflow: hidden;
  animation: slideUpMobile 0.3s ease;
}

@keyframes slideUpMobile {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.mini-player-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.mini-player-cover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.mini-player-cover-fallback {
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-player-cover-fallback::before {
  content: '';
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z'/%3E%3C/svg%3E") center/contain no-repeat;
  color: var(--text-inverse);
}

.mini-player-info {
  flex: 1;
  min-width: 0;
}

.mini-player-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.mini-player-controls {
  display: flex;
  gap: 6px;
}

.mini-player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.mini-player-btn:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

.mini-player-progress {
  height: 2px;
  background: var(--bg-tertiary);
}

.mini-player-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand-primary);
  transition: width 0.1s linear;
}

/* Video stage: the video fills the strip edge to edge above the controls —
   roughly three times the old thumbnail cell. */
.floating-player-video,
.mini-player-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

/* Equalizer dancing over the audio cover. */
.floating-player-cover-wrap,
.mini-player-cover-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.strip-eq {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  padding: 3px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.strip-eq span {
  width: 3px;
  height: 5px;
  border-radius: 1.5px;
  background: #fff;
  opacity: 0.85;
}

.strip-eq.playing span {
  animation: strip-eq-bounce 0.9s ease-in-out infinite;
}

.strip-eq.playing span:nth-child(1) { animation-delay: 0s; }
.strip-eq.playing span:nth-child(2) { animation-delay: 0.15s; }
.strip-eq.playing span:nth-child(3) { animation-delay: 0.3s; }
.strip-eq.playing span:nth-child(4) { animation-delay: 0.45s; }
.strip-eq.playing span:nth-child(5) { animation-delay: 0.6s; }

@keyframes strip-eq-bounce {
  0%, 100% { height: 5px; }
  50% { height: 16px; }
}

/* The desktop card's header drags the whole card around. */
.floating-player-header {
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.floating-player-header:active {
  cursor: grabbing;
}

.floating-player-header button {
  cursor: pointer;
}

/* Tapping the cover or the title returns to the gliim that is playing. */
.floating-player-cover,
.floating-player-title,
.mini-player-cover,
.mini-player-title { cursor: pointer; }

/* The strip's own media node lives here. An audio track sits at zero size, out
   of sight; a video takes the cover cell itself. Neither is interactive - the
   tap belongs to the cell and means "go back to this gliim". */
.audiolite-slot[data-role="hidden"] {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.audiolite-slot:not([data-role="hidden"]) {
  display: block;
  overflow: hidden;
}

.audiolite-slot video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  background: #000000;
}

.audiolite-slot--video video {
  object-fit: contain;
}

@media (max-width: 768px) {
  .audiolite-floating-player {
    display: none;
  }
}
@media (min-width: 769px) {
  .audiolite-mini-player {
    display: none;
  }
}

/* ============================================================
   Post read page — full-page post viewer (#/post?id=...)
   ============================================================ */

.post-read-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Disable text selection and highlighting on the reader page */
.post-read-layout {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Allow selection inside input fields and textareas so comments still work */
.post-read-layout input,
.post-read-layout textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Hide everything when printing */
@media print {
  body > * { display: none !important; }
}

/* Scroll progress bar — starts below the status bar so the phone camera cutout
   never sits on top of it. */
.post-read-progress {
  position: fixed;
  top: var(--safe-top);
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--brand-primary);
  z-index: 1000;
  transition: width 0.1s linear;
}

/* Header — edge-to-edge within .view-container (cancel its padding).
   It is sticky at the very top, so it owns the status-bar inset itself: the
   height grows by --safe-top and the buttons stay padded below it. */
.post-read-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  margin: calc(-1 * var(--pad-top)) calc(-1 * var(--pad-x)) 0;
  padding-top: var(--safe-top);
}

/* Edge-to-edge, all header content grouped in the centre. */
.post-read-header-inner {
  max-width: none;
  margin: 0;
  padding: 7px 16px 7px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.post-read-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}

.post-read-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-read-back {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s;
}
.post-read-back:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.post-read-menu-btn {
  background: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
}
.post-read-menu-btn:hover {
  background: var(--border) !important;
}

/* Main content area — the article sits in a centred reading column. Nothing is
   reserved for the engagement rail: it floats on its own layer above the page,
   so the text slides under it rather than being pushed aside. */
.post-read-main {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.post-read-main .read-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Related posts section (Section 2) — cancel .view-container padding to match XpLoRe grid width exactly */
.post-read-related {
  width: calc(100% + var(--pad-x) * 2);
  margin-left: calc(-1 * var(--pad-x));
  margin-right: calc(-1 * var(--pad-x));
  max-width: none;
  padding: 48px 0 100px;
  border-top: 2px solid var(--border);
  background: transparent;
}

/* The gutter re-applied inside must equal XpLoRe's: 24px on desktop, and on
   mobile the 8px container padding plus the 8px the feed shell adds = 16px.
   Cancelling --space-8 here instead overshoots by 24px per side and the cards
   end up flush against the edge of the screen. */
.post-read-related .related-posts-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px;
}

.post-read-related .related-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 8px;
  column-gap: 24px;
  row-gap: 0;
}

.post-read-related .related-posts-grid .feed-item {
  margin-bottom: 0;
}

.post-read-related .related-posts-grid .blog-card {
  margin-bottom: 0;
}

/* Mobile grid: match XpLoRe exactly — 2 columns for books/audiolites, full-width for bundles */
@media (max-width: 768px) {
  .post-read-related .related-posts-inner { padding: 0 16px; }
  .post-read-related .related-posts-grid {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 12px;
  }
  .post-read-related .related-posts-grid .feed-item--gliim {
    grid-column: 1 / -1;
  }
  .post-read-related .related-posts-grid .feed-item--gliim:has(.book-cover-card),
  .post-read-related .related-posts-grid .feed-item--gliim:has(.audiolite-card:not(.bundle-card)) {
    grid-column: auto;
  }
}

/* Engagement rail — the four actions stand vertically anchored to the bottom
   right. The rail owns no layout space: it is a fixed layer above the article,
   so the text scrolls underneath it. On mobile it lifts itself above the
   app's bottom navigation bar (58px + safe-area inset) so neither overlaps. */
.post-read-bottom {
  position: fixed;
  bottom: 24px;
  right: 16px;
  z-index: 14;
  transition: opacity 0.18s ease;
}

/* Out of sight once the recommendation grid takes over the screen. */
.post-read-bottom.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.post-read-bottom-inner {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.post-read-bottom .action-btn {
  flex-direction: column;
  gap: 2px;
  width: 48px;
  padding: 9px 0 6px;
  border-radius: 14px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 47%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.post-read-bottom .action-btn span {
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-muted);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .post-read-header-inner {
    padding: 5px 12px;
  }
  .post-read-main .read-body {
    padding: 20px 16px;
  }
  /* Bottom-anchored, lifted above the mobile bottom navigation bar so the
     two never overlap. --bottom-bar-h = 58px + safe-area-inset-bottom. */
  .post-read-bottom {
    right: 12px;
    bottom: calc(var(--bottom-bar-h) + 12px);
  }
  .post-read-bottom .action-btn {
    width: 44px;
    padding: 7px 0 5px;
    border-radius: 12px;
  }
}

/* Follow button on author avatar in reader */
.reader-follow-avatar-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  border: 2px solid var(--surface);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, transform 0.15s;
  z-index: 5;
}
.reader-follow-avatar-btn:hover {
  background: var(--brand-primary-hover);
  transform: scale(1.1);
}
.reader-follow-avatar-btn.following {
  background: #10B981;
}
.reader-follow-avatar-btn.following:hover {
  background: #059669;
}
