/* ==========================================================================
   Blog Redesign — Stitch Premium Dark Theme
   Based on designs/stitch_premium_blog_redesign_ux_ui/technical_precision/DESIGN.md
   ========================================================================== */

:root {
  --surface-deep: #0B1120;
  --surface-main: #0F172A;
  --surface-elevated: #1E293B;
  --surface-container-low: #0d1c2d;
  --surface-container: #122131;
  --surface-container-high: #1c2b3c;
  --surface-container-highest: #273647;
  --surface-bright: #2c3a4c;
  --primary: #8ed5ff;
  --primary-container: #38bdf8;
  --on-primary: #00354a;
  --on-surface: #d4e4fa;
  --on-surface-variant: #bdc8d1;
  --outline: #87929a;
  --outline-variant: #3e484f;
  --success-emerald: #10B981;
  --warning-amber: #F59E0B;
  --error: #ffb4ab;
  --code-bg: #0B1120;
  --border-subtle: rgba(148, 163, 184, 0.1);
}

/* ==========================================================================
   Page Layout — 3-Column Grid
   ========================================================================== */

.blog-main {
  padding-top: 6rem;
  padding-bottom: 4rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  min-width: 0;
}

.blog-layout {
  min-width: 0;
}

.article-main {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

/* ==========================================================================
   Reading Progress
   ========================================================================== */

.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 60;
  background: transparent;
}

.reading-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--primary-container);
  transition: width 0.1s ease-out;
}

/* ==========================================================================
   Article Hero
   ========================================================================== */

.article-hero {
  margin-bottom: 4rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.article-category {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  background-color: rgba(56, 189, 248, 0.1);
  color: var(--primary-container);
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
}

.article-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--primary-container);
  padding: 0.25rem 0.5rem;
  background-color: rgba(56, 189, 248, 0.1);
  border-radius: 0.25rem;
}

.article-read-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--primary-container);
  padding: 0.25rem 0.5rem;
  background-color: rgba(56, 189, 248, 0.1);
  border-radius: 0.25rem;
}

.article-title {
  font-family: 'Inter', sans-serif;
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .article-title {
    font-size: 32px;
  }
}

.article-audio {
  margin-bottom: 2rem;
}

.article-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: var(--on-surface-variant);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.article-audio-btn:hover {
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--primary);
  background-color: rgba(56, 189, 248, 0.05);
}

.article-audio-btn-icon {
  font-size: 20px !important;
  color: var(--primary);
}

.article-audio-btn-text {
  font-weight: 500;
}

.article-audio-chevron {
  font-size: 18px !important;
  transition: transform 0.2s;
}

.article-audio-btn.is-open .article-audio-chevron {
  transform: rotate(180deg);
}

.article-audio-player {
  margin-top: 0.75rem;
}

.article-audio-element {
  width: 100%;
  max-width: 400px;
  height: 40px;
  border-radius: 0.5rem;
}

.article-excerpt {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--on-surface-variant);
  margin-bottom: 0;
}

/* ==========================================================================
   Featured Image
   ========================================================================== */

.article-featured-image {
  margin-bottom: 4rem;
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  aspect-ratio: 16 / 9;
}

.article-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Article Content (rendered markdown — prose typography)
   ========================================================================== */

.article-content {
  font-size: 18px;
  line-height: 1.75;
  color: var(--on-surface-variant);
}

.article-content h2 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--on-surface);
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.article-content h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--on-surface);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.article-content h4 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--on-surface);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: var(--primary-container);
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 2.5rem 0;
}

/* ==========================================================================
   Code Blocks
   ========================================================================== */

.code-block-wrapper {
  position: relative;
  background-color: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  margin-bottom: 2rem;
  max-width: 100%;
  min-width: 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--surface-container-high);
  border-bottom: 1px solid var(--border-subtle);
}

.code-lang-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--on-surface-variant);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.code-copy-btn:hover {
  color: var(--on-surface);
}

.code-body {
  overflow-x: auto;
}

.code-body pre {
  padding: 1.25rem;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
  word-wrap: normal;
}

.code-body code {
  color: var(--on-surface-variant);
}

/* Monokai Sublime theme for Rouge syntax highlighting */
.highlight table td { padding: 5px; }
.highlight table pre { margin: 0; }
.highlight .gh { color: #999999; }
.highlight .sr { color: #f6aa11; }
.highlight .go { color: #888888; }
.highlight .gp { color: #555555; }
.highlight .ge { font-style: italic; }
.highlight .ges { font-weight: bold; font-style: italic; }
.highlight .gs { font-weight: bold; }
.highlight .gu { color: #aaaaaa; }
.highlight .nb { color: #f6aa11; }
.highlight .cm { color: #75715e; }
.highlight .cp { color: #75715e; }
.highlight .c1 { color: #75715e; }
.highlight .cs { color: #75715e; }
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf { color: #75715e; }
.highlight .err { color: #960050; }
.highlight .gr { color: #960050; }
.highlight .gt { color: #960050; }
.highlight .gd { color: #49483e; }
.highlight .gi { color: #49483e; }
.highlight .kc { color: #66d9ef; }
.highlight .kd { color: #66d9ef; }
.highlight .kr { color: #66d9ef; }
.highlight .no { color: #66d9ef; }
.highlight .kt { color: #66d9ef; }
.highlight .mf { color: #ae81ff; }
.highlight .mh { color: #ae81ff; }
.highlight .il { color: #ae81ff; }
.highlight .mi { color: #ae81ff; }
.highlight .mo { color: #ae81ff; }
.highlight .m, .highlight .mb, .highlight .mx { color: #ae81ff; }
.highlight .sc { color: #ae81ff; }
.highlight .se { color: #ae81ff; }
.highlight .ss { color: #ae81ff; }
.highlight .sd { color: #e6db74; }
.highlight .s2 { color: #e6db74; }
.highlight .sb { color: #e6db74; }
.highlight .sh { color: #e6db74; }
.highlight .si { color: #e6db74; }
.highlight .sx { color: #e6db74; }
.highlight .s1 { color: #e6db74; }
.highlight .s, .highlight .sa, .highlight .dl { color: #e6db74; }
.highlight .na { color: #a6e22e; }
.highlight .nc { color: #a6e22e; }
.highlight .nd { color: #a6e22e; }
.highlight .ne { color: #a6e22e; }
.highlight .nf, .highlight .fm { color: #a6e22e; }
.highlight .vc { color: #ffffff; }
.highlight .nn { color: #ffffff; }
.highlight .nl { color: #ffffff; }
.highlight .ni { color: #ffffff; }
.highlight .bp { color: #ffffff; }
.highlight .vg { color: #ffffff; }
.highlight .vi { color: #ffffff; }
.highlight .nv, .highlight .vm { color: #ffffff; }
.highlight .w { color: #ffffff; }
.highlight { color: #ffffff; }
.highlight .n, .highlight .py, .highlight .nx { color: #ffffff; }
.highlight .ow { color: #f92672; }
.highlight .nt { color: #f92672; }
.highlight .k, .highlight .kv { color: #f92672; }
.highlight .kn { color: #f92672; }
.highlight .kp { color: #f92672; }
.highlight .o { color: #f92672; }

/* ==========================================================================
   Inline Code
   ========================================================================== */

.inline-code {
  background-color: var(--surface-container-high);
  border: 1px solid var(--border-subtle);
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  color: var(--primary-container);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.article-table thead {
  background-color: var(--surface-container-low);
}

.article-table th {
  padding: 1rem 1.5rem;
  font-weight: 600;
  text-align: left;
  color: var(--on-surface);
  border-bottom: 2px solid var(--outline-variant);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
}

.article-table td {
  padding: 1rem 1.5rem;
  color: var(--on-surface-variant);
  border-bottom: 1px solid var(--border-subtle);
}

.article-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.article-table tbody tr:hover {
  background-color: rgba(56, 189, 248, 0.05);
}

/* ==========================================================================
   Figures (Images in markdown)
   ========================================================================== */

.article-figure {
  margin: 2rem 0;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.article-figure img {
  width: 100%;
  display: block;
}

.article-figure figcaption {
  padding: 0.75rem 1rem;
  font-size: 14px;
  color: var(--on-surface-variant);
  background-color: var(--surface-container-low);
  text-align: center;
  font-style: italic;
}

/* ==========================================================================
   Blockquotes
   ========================================================================== */

.article-blockquote {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  border-left: 2px solid var(--primary);
  background-color: rgba(142, 213, 255, 0.05);
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 1.125em;
  color: var(--on-surface);
}

.article-blockquote p {
  margin-bottom: 0;
}

/* ==========================================================================
   Callouts
   ========================================================================== */

.callout {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.callout-icon {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.callout-icon .material-symbols-outlined {
  font-size: 1.5rem;
}

.callout-content {
  flex: 1;
}

.callout-title {
  display: block;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 0.5rem;
}

.callout-content p {
  margin-bottom: 0;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.callout-content ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

.callout-content li {
  font-size: 14px;
  color: var(--on-surface-variant);
  margin-bottom: 0.25rem;
}

.callout-note {
  border-color: rgba(56, 189, 248, 0.3);
  background-color: rgba(56, 189, 248, 0.05);
}

.callout-note .callout-icon .material-symbols-outlined { color: var(--primary-container); }
.callout-note .callout-title { color: var(--primary-container); }

.callout-tip {
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.05);
}

.callout-tip .callout-icon .material-symbols-outlined { color: var(--success-emerald); }
.callout-tip .callout-title { color: var(--success-emerald); }

.callout-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background-color: rgba(245, 158, 11, 0.05);
}

.callout-warning .callout-icon .material-symbols-outlined { color: var(--warning-amber); }
.callout-warning .callout-title { color: var(--warning-amber); }

.callout-success {
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.05);
}

.callout-success .callout-icon .material-symbols-outlined { color: var(--success-emerald); }
.callout-success .callout-title { color: var(--success-emerald); }

.callout-danger {
  border-color: rgba(255, 180, 171, 0.3);
  background-color: rgba(255, 180, 171, 0.05);
}

.callout-danger .callout-icon .material-symbols-outlined { color: var(--error); }
.callout-danger .callout-title { color: var(--error); }

/* ==========================================================================
   Author Card (full, below article)
   ========================================================================== */

.author-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  border-radius: 1rem;
  background-color: var(--surface-container-low);
  border: 1px solid var(--border-subtle);
  margin-top: 4rem;
}

@media (min-width: 768px) {
  .author-card {
    flex-direction: row;
    align-items: flex-start;
  }
}

.author-card-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 9999px;
  background: linear-gradient(to bottom right, var(--primary), var(--primary-container));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--on-primary);
}

.author-card-info {
  flex: 1;
  text-align: center;
}

@media (min-width: 768px) {
  .author-card-info {
    text-align: left;
  }
}

.author-card-name {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--on-surface);
  margin-bottom: 0.5rem;
}

.author-card-bio {
  font-size: 14px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.author-card-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

@media (min-width: 768px) {
  .author-card-links {
    justify-content: flex-start;
  }
}

.author-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--on-surface-variant);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s;
}

.author-card-link:hover {
  color: var(--primary);
}

/* ==========================================================================
   Author Card Mini (sidebar)
   ========================================================================== */

.author-card-mini {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background-color: var(--surface-container-high);
  border: 1px solid var(--border-subtle);
}

.author-card-mini-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background-color: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--primary);
}

.author-card-mini-info {
  min-width: 0;
}

.author-card-mini-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--on-surface);
  text-transform: uppercase;
}

.author-card-mini-role {
  font-size: 12px;
  color: var(--on-surface-variant);
}

/* ==========================================================================
   Share Buttons
   ========================================================================== */

.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.share-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--on-surface-variant);
  text-transform: uppercase;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
  color: var(--on-surface-variant);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
  cursor: pointer;
  background: transparent;
}

.share-btn:hover {
  color: var(--primary);
  border-color: rgba(56, 189, 248, 0.3);
  background-color: rgba(56, 189, 248, 0.05);
}

/* ==========================================================================
   Prev / Next Navigation
   ========================================================================== */

.prev-next-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .prev-next-nav {
    grid-template-columns: 1fr 1fr;
  }
}

.prev-next-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
  background: transparent;
}

.prev-next-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.prev-next-card--next {
  text-align: right;
}

.prev-next-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.prev-next-card--next .prev-next-label {
  justify-content: flex-end;
}

.prev-next-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.3;
}

.prev-next-card:hover .prev-next-title {
  color: var(--primary);
}

/* ==========================================================================
   Discussion Section (Comments Redesign)
   ========================================================================== */

/* -- Transition Divider ------------------------------------------------ */

.discussion-divider {
  display: none;
}

.discussion-divider-line {
  max-width: 6rem;
  margin: 0 auto;
  height: 1px;
  background-color: var(--border-subtle);
  opacity: 0.4;
}

/* -- Discussion Surface ------------------------------------------------ */

.discussion-section {
  background-color: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 3rem 0 0;
  box-shadow: none;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  min-width: 0;
}

@media (max-width: 640px) {
  .discussion-section {
    padding: 2rem 0 0;
  }
}

/* -- Header ----------------------------------------------------------- */

.discussion-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.discussion-heading {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.discussion-subtitle {
  font-size: 14px;
  color: var(--on-surface-variant);
  margin: 0 0 2rem;
}

.discussion-count {
  text-align: right;
}

.discussion-count-number {
  font-size: 18px;
  font-weight: 600;
  color: var(--on-surface-variant);
}

.discussion-count-label {
  font-size: 12px;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* -- Empty State ------------------------------------------------------ */

.discussion-empty {
  text-align: center;
  padding: 3rem 1rem;
}

.discussion-empty-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 0.75rem;
}

.discussion-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0 0 0.25rem;
}

.discussion-empty-text {
  font-size: 14px;
  color: var(--on-surface-variant);
  margin: 0;
}

/* -- Comment List ----------------------------------------------------- */

.discussion-list {
  margin-bottom: 2.5rem;
}

/* ==========================================================================
   Comment Item (Conversation Card)
   ========================================================================== */

.comment-item {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 1.5rem 0;
  margin-bottom: 0;
  transition: none;
}

.comment-item:hover {
  transform: none;
  border-color: var(--border-subtle);
}

.comment-item--reply {
  background: transparent;
  border-left: 2px solid var(--border-subtle);
  border-top: none;
  padding: 1rem 0 1rem 1.25rem;
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .comment-item--reply {
    margin-left: 2rem;
  }
}

/* -- Header ----------------------------------------------------------- */

.comment-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.comment-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.comment-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.comment-item-author {
  font-weight: 600;
  color: var(--on-surface);
  font-size: 14px;
}

.comment-item-date {
  font-size: 12px;
  color: var(--on-surface-variant);
}

/* -- Divider ---------------------------------------------------------- */

.comment-item-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin-bottom: 0.75rem;
}

/* -- Body ------------------------------------------------------------- */

.comment-item-body {
  font-size: 14px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.comment-item-body p {
  margin-bottom: 0.5rem;
}

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

.comment-item-body .code-block-wrapper {
  margin-bottom: 0.75rem;
  font-size: 13px;
}

.comment-item-body .code-block-wrapper .code-header {
  padding: 0.25rem 0.75rem;
}

.comment-item-body .code-block-wrapper .code-body pre {
  padding: 0.75rem;
  font-size: 13px;
}

.comment-item-body .code-block-wrapper .code-copy-btn .material-symbols-outlined {
  font-size: 12px !important;
}

.comment-item-body .inline-code {
  font-size: 0.8em;
}

.comment-item-body .article-blockquote {
  margin: 0.75rem 0;
  padding: 0.5rem 1rem;
  font-size: 0.9em;
}

.comment-item-body img {
  max-width: 100%;
  border-radius: 0.5rem;
  margin: 0.75rem 0;
}

.comment-item-body a {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}

/* -- Actions ---------------------------------------------------------- */

.comment-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 13px;
}

.comment-item-action {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  cursor: default;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.comment-item-action--reply {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.comment-item-action--reply:hover {
  background-color: rgba(56, 189, 248, 0.1);
}

.comment-item-action--placeholder {
  color: var(--outline);
  opacity: 0.5;
}

.comment-item-action-spacer {
  flex: 1;
}

/* -- Replies ---------------------------------------------------------- */

.comment-item-replies {
  margin-top: 1rem;
  padding-top: 0;
}

.comment-item-replies .comment-item {
  margin-bottom: 0.75rem;
}

.comment-item-replies .comment-item:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Comment Form Card
   ========================================================================== */

.comment-form-card {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 2rem 0 0;
}

.comment-form-heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0 0 1.25rem;
}

.comment-form-honeypot {
  display: none;
}

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

.comment-form-recaptcha > * {
  margin: 0 auto;
  max-width: 304px;
}

.comment-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .comment-form-row {
    flex-direction: row;
  }
}

.comment-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  border: 1px solid var(--outline-variant);
  background-color: transparent;
  color: var(--on-surface);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-input:focus {
  background-color: rgba(255,255,255,0.02);
}

.comment-input::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.5;
}

.comment-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  border: 1px solid var(--outline-variant);
  background-color: transparent;
  color: var(--on-surface);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
  min-height: 120px;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

.comment-textarea:focus {
  background-color: rgba(255,255,255,0.02);
}

.comment-textarea::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.5;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-end;
}

.comment-submit-btn {
  background-color: transparent;
  color: var(--primary);
  border: 1px solid rgba(142, 213, 255, 0.3);
  letter-spacing: 0.03em;
  font-size: 12px;
  padding: 0.625rem 1.25rem;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  font-family: 'Inter', sans-serif;
}

.comment-submit-btn:hover {
  opacity: 1;
  background-color: rgba(142, 213, 255, 0.07);
  border-color: var(--primary);
}

/* -- Form within discussion surface spacing --------------------------- */

.discussion-form-wrapper {
  margin-top: 2.5rem;
}

/* ==========================================================================
   Related Posts (if used in Phase 4)
   ========================================================================== */

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.related-card {
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  background-color: var(--surface-main);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.related-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-2px);
}

.related-card-category {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-container);
}

.related-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.3;
}

.related-card-excerpt {
  font-size: 13px;
  color: var(--on-surface-variant);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-meta {
  font-size: 12px;
  color: var(--outline);
  margin-top: auto;
}

/* ==========================================================================
   Mobile Responsive — Blog-specific overrides
   Philosophy: mobile should feel like a premium reading app,
   not a shrunk desktop layout.
   ========================================================================== */

/* -----------------------------------------------------------------------
   Base: prevent horizontal overflow + word-break safety
   ----------------------------------------------------------------------- */

@media only screen and (max-width: 992px) {
  .blog-post-page h1, .blog-post-page h2, .blog-post-page h3,
  .blog-post-page h4, .blog-post-page h5, .blog-post-page h6,
  .blog-post-page p, .blog-post-page span, .blog-post-page div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }

  .blog-post-page img,
  .blog-post-page video,
  .blog-post-page pre,
  .blog-post-page table,
  .blog-post-page blockquote {
    max-width: 100% !important;
    height: auto;
  }
}

/* -----------------------------------------------------------------------
   Tablet / large phone (≤ 768px)
   Most layout and spacing changes happen here
   ----------------------------------------------------------------------- */

@media only screen and (max-width: 768px) {
  /* -- Single reading column ----------------------------------------- */
  .blog-main {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 4rem;
    padding-bottom: 2rem;
  }

  .article-main {
    max-width: 100%;
  }

  .article-content {
    max-width: 100%;
  }

  /* -- Compact hero -------------------------------------------------- */
  .article-hero {
    margin-bottom: 1.5rem;
  }

  .article-meta {
    gap: 0.375rem;
    margin-bottom: 0.5rem;
  }

  .article-title {
    font-size: 26px;
    line-height: 1.25;
    margin-bottom: 0.75rem;
  }

  .article-excerpt {
    font-size: 15px;
    line-height: 1.5;
  }

  .article-category,
  .article-date,
  .article-read-time {
    font-size: 11px;
  }

  .article-featured-image {
    margin-bottom: 2rem;
  }

  /* -- Audio button -------------------------------------------------- */
  .article-audio-btn {
    padding: 0.375rem 0.75rem;
    font-size: 13px;
  }

  .article-audio-element {
    max-width: 100%;
  }

  /* -- Code blocks --------------------------------------------------- */
  .code-block-wrapper {
    margin-bottom: 1.25rem;
  }

  .code-header {
    padding: 0.375rem 0.75rem;
  }

  .code-lang-label {
    font-size: 9px;
  }

  .code-body pre {
    padding: 0.75rem;
    font-size: 13px;
    white-space: pre;
    overflow-x: auto;
    word-wrap: normal;
  }

  .code-copy-btn {
    font-size: 11px;
    padding: 0.25rem 0.5rem;
  }

  /* -- Tables -------------------------------------------------------- */
  .table-wrapper {
    margin-bottom: 1.25rem;
  }

  .article-table th,
  .article-table td {
    padding: 0.625rem 0.75rem;
    font-size: 13px;
  }

  /* -- Images -------------------------------------------------------- */
  .article-figure {
    margin: 1.25rem 0;
  }

  .article-figure figcaption {
    font-size: 12px;
    padding: 0.5rem 0.75rem;
  }

  /* -- Blockquotes & callouts ---------------------------------------- */
  .article-blockquote {
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    font-size: 1em;
  }

  .callout {
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .callout-content p {
    font-size: 13px;
  }

  /* -- Author card --------------------------------------------------- */
  .author-card {
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    margin-top: 2rem;
    gap: 1rem;
  }

  .author-card-avatar {
    width: 4rem;
    height: 4rem;
    font-size: 1.25rem;
  }

  .author-card-info {
    text-align: center;
  }

  .author-card-name {
    font-size: 18px;
    margin-bottom: 0.375rem;
  }

  .author-card-bio {
    font-size: 13px;
    margin-bottom: 0.75rem;
  }

  .author-card-links {
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .author-card-link {
    font-size: 13px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
  }

  /* -- Share buttons ------------------------------------------------- */
  .share-buttons {
    display: grid;
    grid-template-columns: auto repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 1.5rem;
    align-items: center;
  }

  .share-label {
    font-size: 11px;
  }

  .share-btn {
    width: 100%;
    height: 44px;
    min-width: 44px;
  }

  /* -- Prev/Next nav ------------------------------------------------- */
  .prev-next-nav {
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  .prev-next-card {
    padding: 0.75rem 1rem;
    min-height: 44px;
  }

  .prev-next-label {
    font-size: 11px;
    gap: 0.25rem;
  }

  .prev-next-title {
    font-size: 14px;
  }

  .prev-next-card .material-symbols-outlined {
    font-size: 16px !important;
  }

  /* -- Comments section ---------------------------------------------- */
  .discussion-section {
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .discussion-header {
    flex-direction: column-reverse;
    gap: 0.25rem;
  }

  .discussion-heading {
    font-size: 20px;
  }

  .discussion-count {
    text-align: left;
  }

  .discussion-count-number {
    font-size: 22px;
    display: inline;
    margin-right: 0.375rem;
  }

  .discussion-count-label {
    font-size: 11px;
  }

  .discussion-subtitle {
    font-size: 13px;
    margin-bottom: 1.25rem;
  }

  .discussion-list {
    margin-bottom: 1.5rem;
  }

  .discussion-empty {
    padding: 2rem 1rem;
  }

  .discussion-empty-icon {
    font-size: 28px;
  }

  .discussion-empty-title {
    font-size: 15px;
  }

  .discussion-empty-text {
    font-size: 13px;
  }

  .comment-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0.75rem;
  }

  .comment-item--reply {
    margin-left: 0.75rem;
    padding: 0.75rem;
  }

  .comment-item-header {
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .comment-item-avatar {
    width: 32px;
    height: 32px;
  }

  .comment-item-author {
    font-size: 13px;
  }

  .comment-item-date {
    font-size: 11px;
  }

  .comment-item-body {
    font-size: 13px;
    margin-bottom: 0.5rem;
  }

  .comment-item-actions {
    font-size: 12px;
  }

  .comment-item-action {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .comment-item-replies {
    margin-top: 0.75rem;
  }

  .comment-item-replies .comment-item {
    margin-bottom: 0.5rem;
  }

  .comment-form-card {
    padding: 1.5rem 0 0;
  }

  .comment-form-heading {
    font-size: 15px;
    margin-bottom: 1rem;
  }

  .comment-form-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .comment-input,
  .comment-textarea {
    font-size: 16px;
    padding: 0.75rem;
    min-height: 44px;
  }

  .comment-textarea {
    min-height: 100px;
  }

  .comment-form-actions {
    justify-content: stretch;
  }

  .comment-submit-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 13px;
    min-height: 44px;
  }

  .discussion-form-wrapper {
    margin-top: 1.5rem;
  }

  .discussion-divider {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
  }

  /* -- Reading progress ---------------------------------------------- */
  .reading-progress-bar {
    height: 2px;
  }

  /* -- Section spacing rhythm ---------------------------------------- */
  .blog-layout {
    gap: 0;
  }
}

/* -----------------------------------------------------------------------
   Small phones (≤ 480px) — typography refinements
   ----------------------------------------------------------------------- */

@media only screen and (max-width: 480px) {
  .article-title {
    font-size: 22px;
  }

  .article-content {
    font-size: 16px;
    line-height: 1.6;
  }

  .article-content h2 {
    font-size: 22px;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
  }

  .article-content h3 {
    font-size: 18px;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .article-content h4 {
    font-size: 16px;
    margin-top: 1.25rem;
  }

  .article-content p {
    margin-bottom: 1rem;
  }

  .article-content ul,
  .article-content ol {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
  }

  .article-content li {
    font-size: 15px;
  }

  .code-body pre {
    font-size: 12px;
    padding: 0.625rem;
  }

  .code-block-wrapper {
    border-radius: 0.5rem;
  }

  .article-blockquote {
    padding: 0.5rem 0.75rem;
    font-size: 0.95em;
  }

  .callout {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .callout-icon .material-symbols-outlined {
    font-size: 1.25rem !important;
  }

  .callout-title {
    font-size: 14px;
  }

  .author-card {
    padding: 1.25rem;
  }

  .share-buttons {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .share-label {
    grid-column: 1 / -1;
    font-size: 11px;
    text-align: center;
  }

  .discussion-section {
    padding: 1.5rem 0 0;
  }

  .comment-item {
    padding: 1rem 0;
  }

  .comment-item--reply {
    margin-left: 0;
    padding: 0.75rem 0 0.75rem 1rem;
  }

  .comment-form-card {
    padding: 1.5rem 0 0;
  }

  .comment-form-recaptcha > * {
    max-width: 100%;
    transform-origin: center;
  }
}

/* -----------------------------------------------------------------------
   Very small phones (≤ 380px) — edge cases
   ----------------------------------------------------------------------- */

@media only screen and (max-width: 380px) {
  .article-title {
    font-size: 20px;
  }

  .article-content {
    font-size: 15px;
  }

  .article-content h2 {
    font-size: 20px;
  }

  .article-content h3 {
    font-size: 17px;
  }

  .comment-item--reply {
    margin-left: 0;
    padding-left: 0.75rem;
  }

  .comment-input,
  .comment-textarea {
    font-size: 15px;
  }
}

/* ==========================================================================
   Left overrides (theme doesn't conflict — blog_redesign is scoped)
   ========================================================================== */

.blog-layout a {
  color: var(--primary);
}

.blog-layout a:hover {
  color: var(--primary-container);
}
