/* ==========================================================================
   blog.css - typography and layout for the Blog landing page and posts.
   Loaded only on blog.html and blog/<slug>.html, on top of theme.css.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

.page-wrap {
  max-width: 46em;
  margin: 0 auto;
  padding: 3em 1.5em 6em;
  font-family: 'Asap', roboto, sans-serif;
}

.page-title {
  font-size: 2.2em;
  font-weight: 700;
  line-height: 1.25em;
  margin-bottom: 0.3em;
}

.page-intro {
  color: var(--muted);
  font-size: 1.05em;
  margin-bottom: 2em;
  max-width: 34em;
}

/* ---------------------------------------------------------------------- */
/* Search + tag filters                                                    */
/* ---------------------------------------------------------------------- */

.blog-controls {
  margin-bottom: 2.2em;
}

.search-input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1em;
  padding: 0.65em 0.9em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
  margin-bottom: 1em;
}

.search-input:focus {
  outline: none;
  border-color: var(--link);
}

.tag-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}

.tag-filter-row .tag {
  cursor: pointer;
  font-size: 0.85em;
}

/* ---------------------------------------------------------------------- */
/* Blog list / cards                                                       */
/* ---------------------------------------------------------------------- */

.blog-list {
  display: flex;
  flex-direction: column;
}

.blog-card {
  padding: 1.7em 0;
  border-bottom: 1px solid var(--border);
}

.blog-card:first-child { padding-top: 0; }
.blog-card:last-child { border-bottom: none; }

.blog-card-title {
  font-size: 1.3em;
  font-weight: 600;
  line-height: 1.4em;
}

.blog-card-title a {
  color: var(--text);
  border: none !important;
}

.blog-card-title a:hover { color: var(--link) !important; }

.blog-card-meta {
  color: var(--muted);
  font-size: 0.88em;
  margin: 0.35em 0 0.7em;
}

.blog-card-meta .sep { margin: 0 0.45em; }

.blog-card-summary {
  color: var(--text);
  line-height: 1.65em;
  font-size: 1em;
}

.blog-card-tags { margin-top: 0.8em; }

.badge-featured {
  display: inline-block;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--link);
  border: 1px solid var(--link);
  border-radius: 4px;
  padding: 0.15em 0.5em;
  margin-left: 0.6em;
  vertical-align: middle;
}

.empty-state {
  color: var(--muted);
  padding: 3em 0;
  text-align: center;
}

/* ---------------------------------------------------------------------- */
/* Reading progress bar                                                    */
/* ---------------------------------------------------------------------- */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--link);
  z-index: 200;
}

/* ---------------------------------------------------------------------- */
/* Post page shell                                                         */
/* ---------------------------------------------------------------------- */

.post-shell {
  max-width: 64em;
  margin: 0 auto;
  padding: 3em 1.5em 6em;
  font-family: 'Asap', roboto, sans-serif;
}

.post-header { max-width: 42em; margin: 0 0 2.5em; }

.post-title {
  font-size: 2.6em;
  font-weight: 700;
  line-height: 1.2em;
  margin-bottom: 0.5em;
}

.post-meta {
  color: var(--muted);
  font-size: 0.95em;
}

.post-meta .sep { margin: 0 0.45em; }

.post-meta-tags { margin-top: 1em; }

.post-layout {
  display: flex;
  align-items: flex-start;
  gap: 3.5em;
}

.post-toc {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: 5.5em;
}

.post-toc-label {
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9em;
}

.post-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-toc a {
  display: block;
  font-size: 0.88em;
  line-height: 1.5em;
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding: 0.15em 0 0.15em 0.9em;
  border-bottom: none !important;
}

.post-toc a.is-h3 { padding-left: 1.7em; }

.post-toc a:hover,
.post-toc a.active {
  color: var(--text) !important;
  border-left-color: var(--link);
}

.post-content {
  flex: 1;
  min-width: 0;
  max-width: 42em;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.15em;
  line-height: 1.85em;
  color: var(--text);
}

.post-content > *:first-child { margin-top: 0; }

.post-content h2 {
  font-family: 'Asap', roboto, sans-serif;
  font-weight: 700;
  font-size: 1.55em;
  line-height: 1.4em;
  margin: 1.8em 0 0.7em;
}

.post-content h3 {
  font-family: 'Asap', roboto, sans-serif;
  font-weight: 600;
  font-size: 1.22em;
  line-height: 1.4em;
  margin: 1.6em 0 0.6em;
}

.post-content p { margin: 0 0 1.3em; }

.post-content ul,
.post-content ol {
  margin: 0 0 1.3em;
  padding-left: 1.4em;
}

.post-content li { margin-bottom: 0.4em; }

.post-content a {
  color: var(--link);
  border-bottom: 1px solid var(--border) !important;
}

.post-content a:hover { border-bottom-color: var(--link) !important; }

.post-content code {
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.82em;
}

.post-content pre {
  background: var(--code-bg);
  padding: 1.1em 1.3em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.8em 0;
  font-size: 0.85em;
  line-height: 1.6em;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 1em;
}

.post-content figure { margin: 2.2em 0; }

.post-content figure img,
.post-content figure video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.post-content figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.85em;
  font-style: italic;
  margin-top: 0.7em;
  font-family: 'Asap', roboto, sans-serif;
}

.post-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.1em;
  color: var(--muted);
  margin: 1.8em 0;
  font-style: italic;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8em 0;
  font-size: 0.85em;
  font-family: 'Asap', roboto, sans-serif;
}

.post-content th,
.post-content td {
  border-bottom: 1px solid var(--border);
  padding: 0.55em 0.8em;
  text-align: left;
}

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

.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.3em 0; }

/* ---------------------------------------------------------------------- */
/* Post footer: actions, share, prev/next                                  */
/* ---------------------------------------------------------------------- */

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  margin: 3em 0 0;
  padding-top: 2em;
  border-top: 1px solid var(--border);
  max-width: 42em;
}

.post-action-btn {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5em 0.9em;
  font-size: 0.85em;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  text-decoration: none;
}

.post-action-btn:hover { border-color: var(--muted); }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 2em;
  margin-top: 2.5em;
  padding-top: 2em;
  border-top: 1px solid var(--border);
  max-width: 42em;
}

.post-nav-link {
  max-width: 48%;
  border: none !important;
}

.post-nav-link.next { margin-left: auto; text-align: right; }

.post-nav-label {
  display: block;
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4em;
}

.post-nav-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.98em;
}

@media (max-width: 900px) {
  .post-layout { flex-direction: column; gap: 2em; }
  .post-toc {
    position: static;
    width: 100%;
    order: -1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.1em 1.3em;
  }
  .post-content { max-width: 100%; }
}

@media (max-width: 600px) {
  .post-title { font-size: 2em; }
  .post-content { font-size: 1.05em; }
  .post-nav { flex-direction: column; }
  .post-nav-link { max-width: 100%; }
  .post-nav-link.next { text-align: left; }
}
