/* ============================================
   Building Effective Agents — Post Styles
   Dark-mode first (uses :root tokens from tokens.css)
   Light-mode overrides via html.light-mode
   ============================================ */

/* ---- Base Typography ---- */
.post-content {
  font-family: var(--font-body);
  color: var(--fg);
  line-height: 1.7;
  font-size: 1.05rem;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--fg);
  margin-top: 2.2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.post-content h1 {
  font-size: 2.2rem;
  font-weight: 700;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.6rem;
}

.post-content h2 {
  font-size: 1.7rem;
  font-weight: 600;
  margin-top: 2.8rem;
}

.post-content h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #D97757;
  margin-top: 2rem;
}

.post-content h4 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.6rem;
}

.post-content p {
  margin-bottom: 1.2rem;
}

/* ---- Links ---- */
.post-content a {
  color: #D97757;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.post-content a:hover {
  border-bottom-color: #D97757;
}

/* ---- Lists ---- */
.post-content ul,
.post-content ol {
  margin-bottom: 1.4rem;
  padding-left: 1.6rem;
}

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

.post-content ul li::marker {
  color: #D97757;
}

/* ---- Blockquotes ---- */
.post-content blockquote {
  margin: 1.8rem 0;
  padding: 1rem 1.4rem;
  border-left: 3px solid #D97757;
  background: var(--surface-1);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--muted);
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ---- Code Blocks ---- */
.post-content pre {
  background: #141413;
  color: #FAF9F5;
  padding: 1.2rem 1.4rem;
  border-radius: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1.6rem 0;
  border: 1.5px solid var(--border);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  color: var(--fg);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
}

.post-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* ---- Syntax Highlighting (warm theme) ---- */
.post-content .kw { color: #C9B98A; }   /* keyword - oat */
.post-content .fn { color: #A8BC8C; }   /* function - olive light */
.post-content .str { color: #A8BC8C; }  /* string - olive light */
.post-content .cm { color: #6B6A63; }   /* comment - g500 dark */
.post-content .num { color: #D97757; }  /* number - clay */
.post-content .cls { color: #D97757; }  /* class - clay */
.post-content .var { color: #E8E6DC; }  /* variable - ivory light */

/* ---- Diagrams ---- */
.diagram-container {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
}

.diagram {
  max-width: 100%;
  height: auto;
}

/* SVG dark mode overrides — override hardcoded inline colors */
.diagram-container svg rect {
  fill: var(--surface-2);
  stroke: var(--border);
}

.diagram-container svg rect[stroke="#D97757"] {
  stroke: #D97757;
}

.diagram-container svg rect[stroke="#788C5D"] {
  stroke: #788C5D;
}

.diagram-container svg rect[fill="#E3DACC"] {
  fill: var(--surface-accent-glow);
}

.diagram-container svg rect[fill="#FAF9F5"] {
  fill: var(--surface-1);
}

.diagram-container svg text {
  fill: var(--fg);
}

.diagram-container svg text[fill="#788C5D"] {
  fill: #A8BC8C;
}

.diagram-container svg text[fill="#141413"] {
  fill: var(--fg);
}

.diagram-container svg line,
.diagram-container svg path {
  stroke: var(--muted);
}

.diagram-container svg polygon {
  fill: var(--muted);
}

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
  margin: 1.8rem 0;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface-1);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.post-content thead {
  background: var(--surface-2);
}

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

.post-content th {
  font-family: Georgia, serif;
  font-weight: 600;
  color: var(--fg);
}

.post-content td {
  color: var(--fg);
}

.post-content tbody tr:last-child td {
  border-bottom: none;
}

.post-content tbody tr:hover {
  background: var(--surface-2);
}

/* ---- Horizontal Rule ---- */
.post-content hr {
  border: none;
  border-top: 1.5px solid var(--border);
  margin: 2.5rem 0;
}

/* ---- Strong / Bold ---- */
.post-content strong {
  font-weight: 600;
  color: var(--fg);
}

/* ---- Emphasis ---- */
.post-content em {
  font-style: italic;
  color: var(--muted);
}

/* ---- Light Mode Overrides ---- */
html.light-mode .diagram-container svg rect[fill="#E3DACC"] {
  fill: #E3DACC;
}

html.light-mode .diagram-container svg rect[fill="#FAF9F5"] {
  fill: #FAF9F5;
}

html.light-mode .diagram-container svg rect {
  fill: #FAF9F5;
  stroke: #D1CFC5;
}

html.light-mode .diagram-container svg rect[stroke="#D97757"] {
  stroke: #D97757;
}

html.light-mode .diagram-container svg rect[stroke="#788C5D"] {
  stroke: #788C5D;
}

html.light-mode .diagram-container svg text {
  fill: #141413;
}

html.light-mode .diagram-container svg text[fill="#788C5D"] {
  fill: #788C5D;
}

html.light-mode .diagram-container svg line,
html.light-mode .diagram-container svg path {
  stroke: #D1CFC5;
}

html.light-mode .diagram-container svg polygon {
  fill: #D1CFC5;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .post-content {
    font-size: 1rem;
  }

  .post-content h1 {
    font-size: 1.8rem;
  }

  .post-content h2 {
    font-size: 1.45rem;
  }

  .post-content h3 {
    font-size: 1.2rem;
  }

  .post-content pre {
    padding: 1rem;
    font-size: 0.82rem;
  }

  .diagram-container {
    padding: 1rem;
  }

  .post-content th,
  .post-content td {
    padding: 0.65rem 0.8rem;
    font-size: 0.9rem;
  }
}

