/* === Single Post View ===
   Refined reading view per design_handoff_sanctum_ui/README.md §2: sticky blurred
   top bar, 640px article column, Newsreader body, media cards, reaction pills and
   the older/newer cards. */

/* Sticky bar: --overlay + blur(8px) over the scrolling article, ruled underneath. */
.post-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.post-topbar .container {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.post-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.post-topbar .icon-btn { font-size: 1.05rem; }

/* "← sanctum": the arrow is UI text, the wordmark is Newsreader. */
.post-back {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.post-back:hover { color: var(--ink); }
.post-back-word {
  font-family: "Newsreader", serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}

/* Article column: 640px wide (from .container) with the spec's vertical padding. */
.post-article { padding-top: 56px; padding-bottom: 40px; }
/* Draft / scheduled notice — only rendered when an admin opens an unpublished post. */
.preview-banner {
  font-size: 0.85rem;
  color: var(--ink-dim);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5em 0.8em;
  margin-bottom: 24px;
}

/* category · date · read time · views · edited */
.post-full-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}
.post-meta-cat { color: var(--ink); font-weight: 600; }

.post-full-title {
  margin: 0 0 40px;
  font-family: "Newsreader", serif;
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
/* Body copy: Newsreader 1.2rem/1.7 with 1em between blocks (renderMarkdown emits
   one element per block, so a flex column with a gap does the spacing). */
.post-full-content {
  font-family: "Newsreader", serif;
  font-size: 1.2rem;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 1em;
  word-wrap: break-word;
}
.post-full-content p { margin: 0; text-wrap: pretty; }
.post-full-content h1, .post-full-content h2, .post-full-content h3,
.post-full-content h4, .post-full-content h5, .post-full-content h6 {
  font-family: "Newsreader", serif;
  font-weight: 600;
  line-height: 1.3;
  margin: 0.6em 0 0;
}
.post-full-content h1 { font-size: 1.6rem; }
.post-full-content h2 { font-size: 1.45rem; }
.post-full-content h3 { font-size: 1.25rem; }
.post-full-content h4, .post-full-content h5, .post-full-content h6 { font-size: 1.1rem; }
.post-full-content ul, .post-full-content ol { margin: 0; padding-left: 1.2em; }
.post-full-content li { margin-top: 0.3em; }
.post-full-content li::marker { color: var(--ink-dim); }
.post-full-content a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.post-full-content a:hover { color: var(--ink-dim); }
.post-full-content blockquote {
  margin: 0.2em 0;
  padding-left: 1.2em;
  border-left: 2px solid var(--ink);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.5;
}
.post-full-content code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--accent-soft);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}
.post-full-content pre {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9em 1em;
  overflow-x: auto;
}
.post-full-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.85em;
  line-height: 1.5;
  white-space: pre;
}
/* Media: images crop to 3:2, video keeps its own ratio, audio becomes a card. */
.post-media { margin-top: 36px; display: flex; flex-direction: column; gap: 16px; }
.post-figure { margin: 0; }
.post-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-surface);
}
.post-figure video {
  display: block;
  width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  background: var(--bg-surface);
}

/* Audio card: 36px round play button (--ink on --bg), title, 3px bar, mono time.
   The <audio> element is hidden; post.js drives it and writes --pct on the bar. */
.audio-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.audio-el { display: none; }
.audio-play {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity var(--motion-fast);
}
.audio-play:hover:not(:disabled) { opacity: .82; }
.audio-play:active:not(:disabled) { opacity: .65; }
.audio-play:disabled { opacity: 0.4; cursor: default; }
.audio-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audio-title {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audio-track {
  --pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--ink) 0 var(--pct),
    var(--border) var(--pct) 100%
  );
  cursor: pointer;
}
.audio-track::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px;
  height: 9px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  transition: background-color var(--motion-fast);
}
.audio-track:hover:not(:disabled)::-webkit-slider-thumb { background: var(--ink-dim); }
.audio-track::-moz-range-track { height: 3px; border-radius: 2px; background: transparent; }
.audio-track::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--ink); }
.audio-track::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
}
.audio-track:disabled { opacity: 0.5; cursor: default; }
.audio-time {
  flex-shrink: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* Footer row: reactions on the left, tags on the right, ruled from the body. */
.post-footer-row {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.react-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 7px 13px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-dim);
  border-radius: 100px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.react-btn:hover:not(:disabled) {
  border-color: var(--ink-dim);
  color: var(--ink);
}
/* Reacted: filled pill, no longer clickable. */
.react-btn.reacted,
.react-btn:disabled {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  cursor: default;
}
.react-btn .react-icon { font-size: 1.05em; line-height: 1; }
.react-btn .react-count { font-variant-numeric: tabular-nums; }

/* Tags sit on the right and filter the board when clicked. */
.post-tags { display: flex; flex-wrap: wrap; gap: 12px; }
.post-tag {
  font-size: 0.8rem;
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}
.post-tag:hover { color: var(--ink); }

/* Older / newer: auto-fit grid, the newer card right-aligned in the last column. */
.post-nav {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.post-nav-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.post-nav-card:hover {
  background: var(--bg-surface);
  border-color: var(--ink-dim);
}
.post-nav-label {
  display: block;
  font-size: 0.74rem;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.post-nav-title {
  display: block;
  font-family: "Newsreader", serif;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}
.nav-newer { text-align: right; grid-column: -2; }
/* Only one neighbour (the first or last post): one full-width card, read left to right. */
.post-nav.single { grid-template-columns: 1fr; }
.post-nav.single .nav-newer { text-align: left; grid-column: auto; }

/* Responsive: title drops to 1.9rem, the body eases down a touch, the footer row
   stacks, and the older/newer cards give each entry a full line. */
@media (max-width: 600px) {
  .post-article { padding-top: 40px; padding-bottom: 32px; }
  .post-full-title { font-size: 1.9rem; }
  .post-full-content { font-size: 1.12rem; }
  .post-full-content blockquote { font-size: 1.2rem; }
  .post-footer-row { flex-direction: column; align-items: flex-start; gap: 20px; }
  .post-nav { grid-template-columns: 1fr; }
  .nav-newer { text-align: left; grid-column: auto; }
  .audio-card { gap: 10px; padding: 12px 14px; }
}

.post-retry { text-align: center; margin-top: 16px; }
