/* ============================================================
   Blog stylesheet — coherent with project page aesthetic
   Red accent family: #c0392b
   ============================================================ */

* { box-sizing: border-box; }

html {
  color: #1a1a1a;
  background-color: #fdfdfd;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
  color: #1a1a1a;
}

/* ---------- Site header ---------- */
.site-header {
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 2rem;
  padding: 1rem 0;
}
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.site-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1a1a1a;
  text-decoration: none;
}
.nav-links a {
  margin-left: 1.2rem;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.95rem;
}
.nav-links a:hover { color: #c0392b; }

/* ---------- Post header ---------- */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}
.post-title {
  font-size: 2.35rem;
  line-height: 1.15;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
}
.post-subtitle {
  color: #4b5563;
  font-size: 1.15rem;
  margin: 0 0 1rem 0;
  font-weight: 400;
}
.post-meta {
  color: #6b7280;
  font-size: 0.9rem;
  margin: 0;
}
.post-meta span { margin-right: 1rem; }

/* ---------- Body text ---------- */
.post-content {
  font-size: 1.05rem;
  line-height: 1.7;
}
.post-content h2 {
  margin-top: 2.8rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  font-size: 1.6rem;
}
.post-content h3 {
  margin-top: 1.8rem;
  font-size: 1.25rem;
}
.post-content p { margin: 1rem 0; }

.post-content a { color: #1d4ed8; }
.post-content a:hover { color: #c0392b; }

/* ---------- Quote (Core thesis, etc.) ---------- */
.post-content blockquote {
  border-left: 4px solid #c0392b;
  padding: 0.2rem 1rem;
  margin: 1.5rem 0 1.5rem 0;
  color: #374151;
  background: #fafafa;
  font-style: normal;
}

/* ---------- Tables ---------- */
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.post-content th, .post-content td {
  border: 1px solid #d1d5db;
  padding: 0.6rem 0.7rem;
  vertical-align: top;
  text-align: left;
}
.post-content th { background: #f3f4f6; font-weight: 600; }

/* ---------- Code ---------- */
.post-content code {
  background: #f3f4f6;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: Menlo, Monaco, Consolas, monospace;
}
.post-content pre code { background: transparent; padding: 0; }
.post-content pre {
  background: #f3f4f6;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.88rem;
}

/* ---------- Figures ---------- */
.post-content figure {
  margin: 2rem 0;
  text-align: center;
}
.post-content figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
.post-content figcaption {
  color: #4b5563;
  font-size: 0.92rem;
  margin-top: 0.6rem;
  text-align: left;
  line-height: 1.5;
}

/* ---------- Math callout box (matches project page .math-box) ---------- */
.math-box {
  background: #f5f5f7;
  border-left: 4px solid #4a5568;
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  font-size: 1rem;
  overflow-x: auto;
}

/* ---------- Takeaway / framing callouts (matches project page) ---------- */
.takeaway-box {
  border: 2px solid #c0392b;
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  background: #fff;
}
.takeaway-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #c0392b;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

/* ---------- Citation marker (matches project page) ---------- */
.citation {
  color: #4a6fa5;
  font-style: italic;
  font-size: 0.92em;
}

/* ---------- TODO/placeholder markers (will be removed in final) ---------- */
.todo-marker {
  background: #fff8e1;
  border: 1px dashed #f59e0b;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.88em;
  color: #92400e;
  font-family: Menlo, Monaco, Consolas, monospace;
}

/* ---------- Post footer (citation block) ---------- */
.post-footer {
  margin-top: 3rem;
  padding-top: 1rem;
}
.post-cite { margin-bottom: 0.5rem; font-size: 0.95rem; }
.post-bibtex {
  font-size: 0.82rem;
  background: #f0f0f0;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
}

/* ---------- References section ---------- */
.post-content .references h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  color: #374151;
}
.post-content .references ul {
  font-size: 0.93rem;
  line-height: 1.55;
}

/* ---------- Site footer ---------- */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.88rem;
  text-align: center;
}
.site-footer a { color: #4b5563; }

/* ---------- Posts index page ---------- */
.posts-index h1 { margin-bottom: 1.5rem; }
.posts-list { list-style: none; padding-left: 0; }
.posts-list li { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #f0f0f0; }
.posts-list a { font-size: 1.15rem; font-weight: 600; color: #1a1a1a; text-decoration: none; }
.posts-list a:hover { color: #c0392b; }
.posts-list .post-date { color: #6b7280; font-size: 0.88rem; display: block; margin: 0.2rem 0; }
.posts-list .post-excerpt { color: #4b5563; font-size: 0.95rem; margin: 0.3rem 0 0 0; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  body { font-size: 0.95em; }
  .post-title { font-size: 1.8rem; }
  .post-content { font-size: 1rem; }
  .site-nav { flex-direction: column; align-items: flex-start; }
  .nav-links a { margin-left: 0; margin-right: 1rem; }
}

/* ---------- Wider publication figures ---------- */
.post-content figure.figure-wide {
  width: 100%;
}
.post-content figure.figure-wide img {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
}
.post-content figure.figure-wide figcaption {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 900px) {
}

/* ============================================================
   Publication polish: navigation, callouts, references, tags
   ============================================================ */

.post-tags,
.post-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
.post-tag {
  display: inline-block;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 0.16rem 0.55rem;
  color: #4b5563;
  background: #fafafa;
  font-size: 0.76rem;
  line-height: 1.4;
  white-space: nowrap;
}

.thesis-card,
.resource-box,
.metric-box,
.view-box,
.toc-box {
  border-radius: 8px;
  margin: 1.6rem 0;
}

.thesis-card {
  border: 1px solid #f1c7c0;
  border-left: 5px solid #c0392b;
  background: linear-gradient(180deg, #fff7f5 0%, #ffffff 100%);
  padding: 1.1rem 1.3rem;
}
.thesis-card-label {
  display: block;
  color: #c0392b;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.thesis-card p {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.55;
}

.resource-box {
  border: 1px solid #dbeafe;
  background: #f8fbff;
  padding: 1rem 1.2rem;
}
.resource-box ul,
.metric-box ul {
  margin: 0.55rem 0 0 1.2rem;
  padding: 0;
}
.resource-box li,
.metric-box li {
  margin: 0.22rem 0;
}

.toc-box {
  border: 1px solid #e5e7eb;
  background: #fbfbfc;
  padding: 1rem 1.2rem 1.05rem;
}
.toc-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 0.45rem;
}
.toc-box ol {
  margin: 0;
  padding-left: 1.35rem;
}
.toc-box ol ol {
  margin-top: 0.15rem;
  padding-left: 1.1rem;
}
.toc-box li {
  margin: 0.18rem 0;
  line-height: 1.45;
}
.toc-box a {
  color: #374151;
  text-decoration: none;
}
.toc-box a:hover {
  color: #c0392b;
  text-decoration: underline;
}

.metric-box {
  border: 1px solid #dde6ef;
  border-left: 4px solid #4a6fa5;
  background: #f7fafc;
  padding: 1rem 1.2rem;
}

.view-box {
  border: 1px solid #ead7d3;
  border-left: 4px solid #c0392b;
  background: #fffdfc;
  padding: 1rem 1.2rem;
}
.view-box p { margin-bottom: 0; }

.post-content h3[id^="view-"] {
  border-left: 4px solid #c0392b;
  padding-left: 0.8rem;
  margin-top: 2.2rem;
  color: #1f2937;
}

.takeaway-box {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

/* Make long technical tables usable on narrow screens. */
.post-content table {
  display: block;
  overflow-x: auto;
  white-space: normal;
}
.post-content thead,
.post-content tbody,
.post-content tr {
  width: 100%;
}

/* Slightly more editorial figure treatment. */
.post-content figcaption strong {
  color: #1f2937;
}
.post-content figure.figure-wide {
  margin-top: 2.2rem;
  margin-bottom: 2.2rem;
}
.post-content figure.figure-wide img {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

/* Better reference section readability. */
.post-content .references h3 {
  border-top: 1px solid #edf0f3;
  padding-top: 1rem;
}
.references-list {
  font-size: 0.93rem;
  line-height: 1.55;
  padding-left: 1.6rem;
}
.references-list li {
  margin: 0.55rem 0;
}
.references-list a {
  white-space: nowrap;
}

.posts-index-subtitle {
  color: #4b5563;
  margin-bottom: 2rem;
}

.post-footer p {
  color: #6b7280;
  font-size: 0.9rem;
}
.post-footer a {
  color: #4b5563;
  text-decoration: none;
}
.post-footer a:hover {
  color: #c0392b;
  text-decoration: underline;
}

@media (min-width: 1100px) {
  body {
    max-width: 1020px;
  }
}

@media (max-width: 600px) {
  .thesis-card,
  .resource-box,
  .metric-box,
  .view-box,
  .toc-box,
  .takeaway-box {
    padding: 0.9rem 1rem;
  }
  .thesis-card p { font-size: 1.02rem; }
  .post-tags { gap: 0.25rem; }
}


/* ============================================================
   Presentation cleanup: quieter long-form essay styling
   ============================================================ */

/* Hide tags inside the post header; keep tags available for blog index/cards. */
.post-header .post-tags { display: none; }


.toc-box {
  border: 1px solid #e5e7eb;
  background: transparent;
  padding: 0.85rem 1rem;
  margin: 1.3rem 0 1.8rem;
}
.toc-title {
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  color: #6b7280;
}
.toc-box ol {
  columns: 2;
  column-gap: 2rem;
  padding-left: 1.15rem;
}
.toc-box li {
  break-inside: avoid;
  margin: 0.1rem 0;
}

.metric-box {
  border: 1px solid #e5e7eb;
  border-left: 3px solid #6b7280;
  background: #fbfbfc;
  padding: 0.9rem 1.05rem;
  margin: 1.25rem 0;
}

.takeaway-inline {
  border-left: 3px solid #c0392b;
  padding-left: 0.85rem;
  color: #374151;
  margin: 1.2rem 0 1.6rem;
}
.takeaway-inline strong {
  color: #7f1d1d;
}

.post-content h3[id^="view-"] {
  border-left: 0;
  padding-left: 0;
  color: #1f2937;
  margin-top: 2rem;
}

/* Cleaner tables: readable on desktop, scrollable on mobile. */
.post-content table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  overflow: visible;
  font-size: 0.92rem;
}
.post-content thead,
.post-content tbody,
.post-content tr {
  width: auto;
}
.post-content th,
.post-content td {
  border: 1px solid #e5e7eb;
  padding: 0.55rem 0.65rem;
}
.post-content th {
  background: #f8fafc;
}

@media (max-width: 760px) {
  .toc-box ol {
    columns: 1;
  }
  .post-content table {
    display: block;
    overflow-x: auto;
    white-space: normal;
  }
}

/* ---------- Blog index card cleanup ---------- */
/* Keep separators between multiple blog cards, but avoid an orphan line after the final/only post. */
.posts-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Make the explicit blog-card CTA look intentionally clickable. */
.read-more {
  display: inline-block;
  margin-top: 0.65rem;
  font-weight: 700;
  color: #1f4e79;
  text-decoration: none;
}

.read-more:hover {
  color: #c0392b;
  text-decoration: underline;
}


/* ============================================================
   Reading column — narrow prose, wide figures
   ------------------------------------------------------------
   The page (body) stays ~960–1020px so figures can be wide.
   Prose, header, footer, tables, and callout boxes are capped
   to a comfortable reading measure; only figure.figure-wide
   keeps the full content width.

   KNOBS:
   - text line length  -> --reading-width (try 680px tighter, 760px looser)
   - figure width      -> body { max-width } above
   - if lines feel long -> bump .post-content font-size to 1.1rem
   ============================================================ */
:root { --reading-width: 720px; }

.post-header,
.post-footer,
.post-content > :not(figure.figure-wide) {
  max-width: var(--reading-width);
  margin-left: auto;
  margin-right: auto;
}

/* Wide figures break out to the full content width (set by body max-width). */
.post-content > figure.figure-wide {
  width: 100%;
  max-width: 100%;
}
