/* Posts — Editorial refresh */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&family=Inter:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --paper: #FBFAF6;
  --paper-2: #F5F2EA;
  --ink: #0B1F33;
  --ink-2: #1F2937;
  --ink-3: #2E3D52;
  --muted: #6B7280;
  --line: #E2DDD0;
  --line-strong: #C9C2B0;
  --accent: #2FB8C6;
  --accent-deep: #1F8E99;
  --warn: #B45309;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}

html { scroll-behavior: smooth; }
body { font-family: var(--serif); line-height: 1.7; color: var(--ink-2); background: var(--paper); min-height: 100vh; font-feature-settings: "kern", "liga"; }

#reading-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0%; background: var(--accent); z-index: 100; transition: width 0.08s linear; }
#section-indicator { position: fixed; top: 14px; right: 24px; z-index: 99; font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: rgba(251,250,246,0.85); backdrop-filter: blur(8px); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); opacity: 0; transform: translateY(-4px); transition: opacity .25s ease, transform .25s ease; pointer-events: none; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#section-indicator.visible { opacity: 1; transform: translateY(0); }

.top-nav { padding: 18px 40px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-family: var(--sans); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(10px); background: rgba(251,250,246,0.92); }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 6px; transition: all .2s ease; background-image: none; }
.back-link:hover { color: var(--accent-deep); transform: translateX(-3px); }
.back-link::before { content: "←"; font-size: 1.1em; line-height: 1; }
.blog-logo { font-family: var(--serif); font-weight: 700; color: var(--ink); font-size: 17px; letter-spacing: -0.01em; }

.container { max-width: 1200px; margin: 0 auto; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }

header { background: var(--paper-2); color: var(--ink); padding: 80px 40px 56px; text-align: left; border-bottom: 1px solid var(--line); position: relative; overflow: visible; }
header > * { position: relative; z-index: 1; }
header::before { content: none; }

header .meta-info { display: flex; flex-wrap: wrap; gap: 16px 18px; font-family: var(--sans); font-size: 13px; color: var(--muted); margin-bottom: 26px; align-items: center; justify-content: flex-start; }
header .meta-item { display: inline-flex; align-items: center; gap: 7px; }
header .meta-item svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 1.8; flex-shrink: 0; }
header .meta-item.cat-pill { color: var(--accent-deep); font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; padding: 4px 10px; border: 1px solid var(--accent); border-radius: 4px; background: rgba(47,184,198,0.06); }
header .meta-item.cat-pill svg { stroke: var(--accent-deep); }

h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 54px); font-weight: 700; line-height: 1.08; letter-spacing: -0.02em; color: var(--ink); margin: 0 0 16px; text-wrap: balance; max-width: 22ch; }
h3.subtitle { font-family: var(--serif); font-size: clamp(18px, 2vw, 22px); font-weight: 400; font-style: italic; color: var(--ink-3); margin: 0 0 28px; line-height: 1.45; max-width: 60ch; text-wrap: pretty; }
.author { font-family: var(--sans); font-style: normal; color: var(--ink-2); font-size: 14px; font-weight: 500; margin: 0; padding-top: 20px; border-top: 1px solid var(--line); display: inline-block; }

.article-shell { display: grid; grid-template-columns: 240px minmax(0,1fr) 240px; gap: 48px; max-width: 1200px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 1080px) { .article-shell { grid-template-columns: minmax(0,1fr); padding: 0 24px; gap: 0; } .toc-rail, .article-side-right { display: none !important; } }

.toc-rail { position: sticky; top: 80px; align-self: start; padding: 56px 0 40px; font-family: var(--sans); max-height: calc(100vh - 100px); overflow-y: auto; }
.toc-rail .toc-label { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.toc-rail .toc-label::before { content: ''; width: 18px; height: 2px; background: var(--accent); }
.toc-rail ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-rail li { margin: 0; }
.toc-rail a { display: block; font-size: 13px; line-height: 1.45; color: var(--muted); text-decoration: none; padding: 8px 0 8px 16px; margin-left: -1px; border-left: 2px solid transparent; transition: color .18s ease, border-color .18s ease; font-weight: 500; background-image: none; }
.toc-rail a:hover { color: var(--ink); }
.toc-rail a.is-active { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }

article { padding: 48px 0 56px; font-size: 18px; line-height: 1.75; color: var(--ink-2); max-width: 100%; }
article p { font-family: var(--serif); margin-bottom: 22px; font-size: 18px; line-height: 1.75; color: var(--ink-2); text-wrap: pretty; }
article > p:first-of-type::first-letter { font-family: var(--serif); font-size: 4.4em; font-weight: 700; float: left; line-height: 0.88; margin: 0.06em 0.10em 0 -0.04em; color: var(--ink); }

article h2 { font-family: var(--serif); font-size: clamp(24px, 3vw, 30px); font-weight: 700; color: var(--ink); letter-spacing: -0.015em; margin: 56px 0 18px; padding: 0; border-bottom: none; text-wrap: balance; position: relative; line-height: 1.2; }
article h2::before { content: ''; position: absolute; top: 0.6em; left: -28px; width: 16px; height: 2px; background: var(--accent); }
@media (max-width: 720px) { article h2::before { display: none; } }
article h3 { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--ink); margin: 36px 0 14px; letter-spacing: -0.01em; }
article h4 { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--accent-deep); text-transform: uppercase; letter-spacing: 0.14em; margin: 36px 0 14px; }

article a { color: var(--ink); font-weight: 500; text-decoration: none; background-image: linear-gradient(var(--accent), var(--accent)); background-position: 0 100%; background-repeat: no-repeat; background-size: 100% 1px; padding-bottom: 1px; transition: background-size .2s ease, color .2s ease; }
article a:hover { color: var(--accent-deep); background-size: 100% 2px; }
article strong { color: var(--ink); font-weight: 600; }
article ul, article ol { margin: 18px 0 24px 26px; font-family: var(--serif); }
article li { margin-bottom: 10px; color: var(--ink-2); line-height: 1.7; font-size: 18px; padding-left: 6px; }
article ul li::marker { color: var(--accent); }
article hr { border: none; height: 1px; background: var(--line); margin: 48px 0; }

article blockquote { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(22px, 2.4vw, 26px); line-height: 1.45; color: var(--ink); margin: 40px 0; padding: 0 0 0 32px; border-left: 3px solid var(--accent); background: none; border-radius: 0; text-wrap: balance; }

.image-container { margin: 40px 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0; text-align: left; }
.image-container img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 20px rgba(11,31,51,0.10); border: 1px solid var(--line); }
img { max-width: 100%; height: auto; }
.image-caption { margin-top: 12px; font-family: var(--sans); font-size: 13px; color: var(--muted); font-style: normal; text-align: left; padding: 4px 0 4px 12px; border-left: 2px solid var(--line-strong); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; margin: 40px 0; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stat-card { background: var(--paper); color: var(--ink); padding: 28px 24px 26px; text-align: left; box-shadow: none; border-radius: 0; position: relative; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 32px; height: 2px; background: var(--accent); }
.stat-number { font-family: var(--serif); font-size: clamp(36px, 4vw, 46px); font-weight: 700; line-height: 1; letter-spacing: -0.02em; margin-bottom: 12px; color: var(--ink); }
.stat-label { font-family: var(--sans); font-size: 13px; line-height: 1.45; opacity: 1; color: var(--muted); font-weight: 500; }

.code-block { background: var(--ink); color: #E2E8F0; padding: 24px 28px; border-radius: 8px; margin: 32px 0; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; position: relative; }
.code-block::before { content: 'PSEUDO-CODE'; position: absolute; top: 14px; right: 18px; font-size: 10px; font-weight: 700; letter-spacing: 0.18em; color: var(--accent); font-family: var(--sans); }

.info-box, .warning-box, .agent-list { font-family: var(--serif); margin: 32px 0; padding: 22px 26px 24px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.info-box h4, .warning-box h4 { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-deep); margin: 0 0 10px; }
.warning-box { border-left-color: var(--warn); background: #FDF6E8; }
.warning-box h4 { color: var(--warn); }
.info-box p, .warning-box p, .agent-list p { margin-bottom: 10px; }
.info-box p:last-child, .warning-box p:last-child { margin-bottom: 0; }
.agent-list { padding: 22px 26px; }
.agent-list ul, .agent-list ol { margin: 6px 0 0 22px; }
.agent-list li { margin-bottom: 6px; padding-top: 0; padding-bottom: 0; }

.comparison-table { width: 100%; margin: 36px 0; border-collapse: collapse; font-family: var(--sans); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: none; font-size: 14px; }
.comparison-table th { background: var(--ink); color: var(--paper); padding: 14px 16px; text-align: left; font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.comparison-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--paper); color: var(--ink-2); vertical-align: top; }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr:nth-child(even) td { background: var(--paper-2); }

.highlight { background: linear-gradient(120deg, #FEF3C7 0%, #FDE68A 100%); padding: 1px 4px; border-radius: 2px; font-weight: 500; color: var(--ink); }


footer.post-footer { background: var(--ink); color: #A0AEC0; padding: 44px 40px; text-align: center; font-family: var(--sans); font-size: 14px; margin-top: 64px; }
footer.post-footer .back-link { color: var(--accent); margin-bottom: 24px; }
footer.post-footer .back-link:hover { color: var(--paper); }
.share-section { margin-top: 20px; }
.share-section p { color: #CBD5E0; margin-bottom: 18px; font-size: 14px; font-family: var(--sans); }
.share-buttons { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.share-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; background: rgba(255,255,255,0.04); color: #CBD5E0; border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; text-decoration: none; font-weight: 500; font-size: 13px; font-family: var(--sans); transition: all .2s ease; cursor: pointer; background-image: none; }
.share-btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); transform: translateY(-1px); }
.share-btn svg { width: 15px; height: 15px; fill: currentColor; }
.share-btn.copied { background: #10B981; color: white; border-color: #10B981; }

@media (max-width: 720px) {
  header { padding: 56px 24px 44px; }
  .top-nav { padding: 14px 20px; }
  article { padding: 36px 0; font-size: 17px; }
  article p, article li { font-size: 17px; }
  article > p:first-of-type::first-letter { font-size: 3.6em; }
  article blockquote { padding-left: 20px; margin: 28px 0; font-size: 19px; }
  footer.post-footer { padding: 32px 24px; }
  #section-indicator { display: none; }
}
