/* ATC Article styles — extended for proper long-form structuring v2 */
:root {
  --paper: #faf8f3;
  --paper-2: #f3efe6;
  --paper-3: #ece7dc;
  --ink-0: #15151a;
  --ink-1: #2a2a32;
  --ink-2: #6a6a72;
  --ink-3: #9a9aa3;
  --line: rgba(21, 21, 26, 0.10);
  --line-strong: rgba(21, 21, 26, 0.18);
  --red: #d63b3b;
  --red-tint: rgba(214, 59, 59, 0.08);
  --green: #2d6a4f;
  --green-tint: rgba(45, 106, 79, 0.08);
  --font-sans: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-serif: 'Instrument Serif', Georgia, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--paper); color: var(--ink-0); -webkit-font-smoothing: antialiased; line-height: 1.65; }
a { color: var(--red); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.7; }
::selection { background: var(--red); color: var(--paper); }
.fab { position: fixed; bottom: 20px; right: 20px; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; background: #25D366; color: white; font-size: 14px; font-weight: 500; z-index: 100; box-shadow: 0 8px 24px rgba(37,211,102,0.4); }
.fab:hover { opacity: 0.95; }

/* === Article Layout === */
.blog-wrap { max-width: 760px; margin: 0 auto; padding: 80px 24px 120px; }
.blog-head { margin-bottom: 60px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.blog-back { display: inline-block; font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); margin-bottom: 24px; letter-spacing: 0.08em; text-transform: uppercase; }
.blog-back:hover { color: var(--red); opacity: 1; }
.blog-title { font-family: var(--font-serif); font-size: clamp(36px, 6vw, 56px); font-weight: 400; line-height: 1.05; color: var(--ink-0); margin-bottom: 16px; font-style: italic; letter-spacing: -0.02em; }
.blog-sub { font-size: 19px; color: var(--ink-1); line-height: 1.5; margin-bottom: 16px; font-weight: 400; }
.blog-dek { font-size: 16px; color: var(--ink-2); margin-bottom: 16px; }
.blog-meta { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 20px; }
.blog-meta span { padding: 4px 10px; background: var(--paper-2); border-radius: 999px; }
.blog-meta span:first-child { background: var(--red-tint); color: var(--red); font-weight: 600; }

/* === Article Body === */
.blog-body { font-size: 18px; line-height: 1.8; color: var(--ink-1); }
.blog-body > p { margin-bottom: 28px; }
.blog-body > p:first-of-type::first-line { font-weight: 600; }
.blog-body h2 { font-family: var(--font-serif); font-size: 32px; font-weight: 400; color: var(--ink-0); margin: 56px 0 20px; font-style: italic; line-height: 1.2; letter-spacing: -0.01em; padding-top: 8px; }
.blog-body h2::before { content: ''; display: block; width: 32px; height: 3px; background: var(--red); margin-bottom: 14px; }
.blog-body h3 { font-size: 21px; font-weight: 600; color: var(--ink-0); margin: 40px 0 14px; letter-spacing: -0.005em; }
.blog-body strong { color: var(--ink-0); font-weight: 600; background: linear-gradient(180deg, transparent 60%, var(--red-tint) 60%); padding: 0 2px; }
.blog-body code { font-family: var(--font-mono); font-size: 0.85em; background: var(--paper-2); padding: 3px 8px; border-radius: 4px; color: var(--ink-0); }
.blog-body a { border-bottom: 1px solid var(--red-tint); padding-bottom: 1px; }
.blog-body a:hover { border-color: var(--red); opacity: 1; }
.blog-body em { color: var(--ink-1); font-style: italic; }

/* === Lead / Dropcap === */
.lead { font-size: 22px; line-height: 1.6; color: var(--ink-0); margin: 0 0 40px 0; padding: 0 0 0 0; font-family: var(--font-serif); font-style: italic; border-left: 3px solid var(--red); padding-left: 24px; }

/* === Hero Illustration === */
.hero-illust { width: 100%; max-width: 720px; height: auto; margin: 0 auto 40px; display: block; }
.illust { width: 100%; max-width: 680px; height: auto; margin: 40px auto; display: block; border-radius: 8px; border: 1px solid var(--line); }
.illust-narrow { width: 100%; max-width: 520px; height: auto; margin: 32px auto; display: block; border-radius: 8px; border: 1px solid var(--line); }
.illust-caption { font-family: var(--font-mono); font-size: 11px; text-align: center; color: var(--ink-3); margin: -24px auto 40px; letter-spacing: 0.06em; text-transform: uppercase; }
.illust-caption-narrow { font-family: var(--font-mono); font-size: 11px; text-align: center; color: var(--ink-3); margin: -24px auto 32px; letter-spacing: 0.06em; text-transform: uppercase; }

/* === Stat Block === */
.stat-block { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin: 40px 0; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.stat-block .stat { padding: 20px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat-block .stat:last-child { border-right: 0; border-bottom: 0; }
.stat-block .stat:nth-child(2n) { border-right: 0; }
.stat-block .stat:nth-last-child(2) { border-bottom: 0; }
.stat-num { font-family: var(--font-serif); font-size: 32px; font-style: italic; font-weight: 400; color: var(--red); line-height: 1; margin-bottom: 6px; letter-spacing: -0.02em; }
.stat-label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.08em; line-height: 1.4; }

/* === Callout Box === */
.callout { background: var(--red-tint); border-left: 4px solid var(--red); padding: 24px 28px; margin: 40px 0; border-radius: 0 8px 8px 0; font-family: var(--font-serif); font-style: italic; font-size: 19px; line-height: 1.55; color: var(--ink-0); }
.callout .callout-label { display: block; font-family: var(--font-mono); font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--red); margin-bottom: 8px; font-weight: 700; }
.callout p { margin: 0; }
.callout strong { background: none; padding: 0; }

.callout-green { background: var(--green-tint); border-left-color: var(--green); }
.callout-green .callout-label { color: var(--green); }

.callout-paper { background: var(--paper-2); border-left-color: var(--ink-1); }
.callout-paper .callout-label { color: var(--ink-1); }

/* === Pull Quote === */
.pull-quote { font-family: var(--font-serif); font-style: italic; font-size: 28px; line-height: 1.4; color: var(--ink-0); margin: 56px 0; padding: 32px 32px 32px 36px; border-left: 3px solid var(--red); position: relative; }
.pull-quote::before { content: '\u201C'; position: absolute; top: -10px; left: 16px; font-family: var(--font-serif); font-size: 80px; color: var(--red); opacity: 0.18; line-height: 1; }
.pull-quote-attribution { display: block; font-family: var(--font-mono); font-style: normal; font-size: 12px; text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.08em; margin-top: 16px; }

/* === Step List === */
.steps { list-style: none; padding: 0; margin: 32px 0; counter-reset: step; }
.steps > li { counter-increment: step; padding: 20px 0 20px 60px; border-bottom: 1px solid var(--line); position: relative; }
.steps > li:last-child { border-bottom: 0; }
.steps > li::before { content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 20px; font-family: var(--font-mono); font-size: 14px; color: var(--red); font-weight: 700; letter-spacing: 0.04em; }
.steps > li .step-title { font-weight: 600; color: var(--ink-0); display: block; margin-bottom: 6px; font-size: 17px; }
.steps > li .step-body { color: var(--ink-1); font-size: 16px; line-height: 1.7; }

/* === Bullet List (proper) === */
.blog-body ul.list { list-style: none; padding: 0; margin: 28px 0; }
.blog-body ul.list > li { padding: 12px 0 12px 32px; position: relative; border-bottom: 1px solid var(--line); }
.blog-body ul.list > li:last-child { border-bottom: 0; }
.blog-body ul.list > li::before { content: '\u2192'; position: absolute; left: 0; top: 12px; color: var(--red); font-weight: 600; font-size: 18px; }
.blog-body ul.list > li strong:first-child { background: none; padding: 0; display: inline-block; margin-right: 4px; color: var(--ink-0); }
.blog-body ul.list > li code { font-size: 14px; padding: 2px 6px; }

/* === Numbered Bullet (with order) === */
.blog-body ol { margin: 28px 0; padding-left: 0; counter-reset: item; list-style: none; }
.blog-body ol > li { counter-increment: item; padding: 14px 0 14px 36px; border-bottom: 1px solid var(--line); position: relative; }
.blog-body ol > li:last-child { border-bottom: 0; }
.blog-body ol > li::before { content: counter(item); position: absolute; left: 0; top: 14px; font-family: var(--font-mono); font-size: 13px; color: var(--red); font-weight: 700; }

/* === Definition List === */
.dlist { margin: 32px 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dlist .row { display: grid; grid-template-columns: 200px 1fr; border-bottom: 1px solid var(--line); }
.dlist .row:last-child { border-bottom: 0; }
.dlist .row .key { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); padding: 16px 18px; background: var(--paper-2); text-transform: uppercase; letter-spacing: 0.06em; }
.dlist .row .val { padding: 16px 18px; font-size: 16px; color: var(--ink-1); }

/* === Code Block === */
.blog-body pre { margin: 32px 0; padding: 20px 24px; background: var(--ink-0); color: #f0ede4; border-radius: 8px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; }
.blog-body pre code { background: none; padding: 0; color: inherit; }

/* === Comparison Table === */
.cmp { margin: 40px 0; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.cmp table { width: 100%; border-collapse: collapse; }
.cmp th { text-align: left; padding: 14px 18px; background: var(--ink-0); color: var(--paper); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.cmp td { padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: top; }
.cmp tr:last-child td { border-bottom: 0; }
.cmp td.winner { background: var(--green-tint); color: var(--green); font-weight: 600; }
.cmp td.loser { color: var(--ink-2); }
.cmp td .check { color: var(--green); margin-right: 6px; }
.cmp td .cross { color: var(--red); margin-right: 6px; }

/* === TOC === */
.toc { background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px; padding: 28px 32px; margin: 0 0 56px 0; }
.toc-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--red); margin-bottom: 14px; font-weight: 700; }
.toc ol { list-style: decimal; padding-left: 22px; margin: 0; counter-reset: none; }
.toc ol li { padding: 4px 0; border: 0; font-size: 15px; line-height: 1.5; }
.toc ol li::before { content: none; }
.toc ol li a { color: var(--ink-1); border-bottom: none; }
.toc ol li a:hover { color: var(--red); }

/* === Series Nav (at the end of each post) === */
.series-nav { margin: 64px 0 0 0; padding: 32px 28px; background: var(--ink-0); border-radius: 8px; color: var(--paper); }
.series-nav .series-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--red); margin-bottom: 16px; font-weight: 700; }
.series-nav h3 { font-family: var(--font-serif); font-style: italic; font-size: 22px; font-weight: 400; margin-bottom: 20px; color: var(--paper); }
.series-nav ol { list-style: none; padding: 0; counter-reset: none; margin: 0; }
.series-nav ol li { padding: 14px 0; border-bottom: 1px solid rgba(250, 248, 243, 0.15); position: relative; padding-left: 40px; font-size: 14px; }
.series-nav ol li:last-child { border-bottom: 0; }
.series-nav ol li::before { content: counter(series-item); counter-increment: series-item; position: absolute; left: 0; font-family: var(--font-mono); font-size: 11px; color: var(--red); font-weight: 700; }
.series-nav ol li a { color: var(--paper); border-bottom: 1px solid rgba(250, 248, 243, 0.2); }
.series-nav ol li a:hover { color: var(--red); opacity: 1; }
.series-nav ol li.series-current::before { color: var(--red); }
.series-nav ol li.series-current { color: var(--paper); font-weight: 600; }
.series-nav ol li.series-upcoming { color: rgba(250, 248, 243, 0.5); }
.series-nav ol li.series-upcoming::before { color: rgba(250, 248, 243, 0.4); }
.series-nav ol li.series-upcoming a { color: rgba(250, 248, 243, 0.5); border-bottom: 1px dashed rgba(250, 248, 243, 0.3); }

/* === CTA / Footer === */
.blog-footer { margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--line); display: flex; gap: 14px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px; font-size: 15px; font-weight: 500; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink-0); transition: all 0.2s; font-family: inherit; cursor: pointer; }
.btn--primary { background: var(--red); border-color: var(--red); color: var(--paper); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(214,59,59,0.3); opacity: 1; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--paper-2); opacity: 1; }

/* === Author Box === */
.author-box { margin: 64px 0; padding: 32px; border: 1px solid var(--line-strong); border-radius: 8px; display: grid; grid-template-columns: 64px 1fr; gap: 24px; align-items: center; background: var(--paper-2); }
.author-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--ink-0); color: var(--paper); display: flex; align-items: center; justify-content: center; font-family: var(--font-serif); font-size: 28px; font-style: italic; }
.author-name { font-weight: 600; color: var(--ink-0); font-size: 17px; }
.author-bio { font-size: 14px; color: var(--ink-2); margin-top: 4px; line-height: 1.55; }
.author-links { font-family: var(--font-mono); font-size: 11px; margin-top: 10px; }
.author-links a { color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 14px; }

/* === Related list (legacy support — replaced by series-nav) === */
.related { list-style: none; padding: 0; margin: 32px 0; }
.related li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.related li:last-child { border-bottom: 0; }
.related li a { color: var(--ink-1); border-bottom: none; }
.related li a:hover { color: var(--red); }

@media (max-width: 600px) {
  .blog-wrap { padding: 60px 16px 100px; }
  .blog-body { font-size: 17px; line-height: 1.75; }
  .blog-title { font-size: clamp(28px, 8vw, 40px); }
  .blog-sub { font-size: 17px; }
  .blog-body h2 { font-size: 24px; }
  .blog-body h3 { font-size: 18px; }
  .blog-meta { font-size: 10px; gap: 8px; }
  .blog-meta span { padding: 3px 8px; }
  .stat-block { grid-template-columns: 1fr; }
  .stat-block .stat { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .stat-block .stat:last-child { border-bottom: 0 !important; }
  .pull-quote { font-size: 22px; padding: 24px 20px 24px 24px; }
  .dlist .row { grid-template-columns: 1fr; }
  .dlist .row .key { border-bottom: 1px solid var(--line); }
  .author-box { grid-template-columns: 1fr; text-align: left; }
  .cmp { font-size: 13px; }
  .cmp th, .cmp td { padding: 10px 12px; }
  .lead { font-size: 18px; padding-left: 18px; }
  .callout { font-size: 17px; padding: 18px 22px; }
  .blog-footer { flex-direction: column; align-items: stretch; margin-top: 60px; }
  .blog-footer .btn { justify-content: center; width: 100%; }
  .fab { bottom: 14px; right: 14px; padding: 10px 14px; font-size: 13px; }

  /* === TABLE FIXES (inline tables inside .blog-body) === */
  .blog-body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    font-size: 12px;
  }
  .blog-body table thead { display: table-header-group; }
  .blog-body table tbody { display: table-row-group; }
  .blog-body table tr { display: table-row; }
  .blog-body table th,
  .blog-body table td {
    display: table-cell;
    padding: 8px 8px;
    word-break: break-word;
    vertical-align: top;
    font-size: 12px;
    line-height: 1.4;
  }
  .blog-body table th { font-size: 11px; padding: 8px 6px; }
  /* Wrap the table inside a scrollable container so it doesn't push the page wider */
  .blog-body table::after {
    content: '';
    display: block;
    clear: both;
  }

  /* === TOC padding / alignment === */
  .toc { padding: 20px 18px; margin-bottom: 36px; }
  .toc ol { padding-left: 18px; }
  .toc ol li { font-size: 14px; padding: 5px 0; }
  .toc-label { font-size: 10px; margin-bottom: 10px; }

  /* === Steps / dlist / pull quote === */
  .steps > li { padding: 18px 0 18px 50px; }
  .steps > li::before { font-size: 12px; }
  .steps > li .step-title { font-size: 15px; }
  .steps > li .step-body { font-size: 15px; }

  /* === Inline SVG illustrations — keep them bound to viewport === */
  .hero-illust, .illust, .illust-narrow {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* === Inline table-style elements (case study metrics) === */
  .blog-body > p {
    margin-bottom: 22px;
  }

  /* === Author bio block === */
  .author-box { grid-template-columns: 56px 1fr; gap: 16px; padding: 24px 20px; }
  .author-name { font-size: 16px; }
  .author-bio { font-size: 13px; line-height: 1.5; }
  .author-avatar { width: 56px; height: 56px; font-size: 22px; }
  .author-links a { font-size: 10px; margin-right: 10px; }

  /* === Series nav === */
  .blog-body ol.series-nav-list { padding-left: 0; }
  .blog-body ol.series-nav-list > li { font-size: 14px; padding: 12px 0 12px 36px; }
}

/* === Blog-index: 2-col or 1-col at mobile === */
@media (max-width: 600px) {
  .blog-wrap > section { padding: 32px 22px !important; }
  .blog-wrap > section h2 { font-size: 28px; }
  .blog-wrap > section ol li {
    padding: 14px 16px !important;
    margin-bottom: 8px !important;
  }
  .blog-wrap > section ol li a { font-size: 18px !important; }
  .blog-wrap > section ol li > div { font-size: 12px !important; }
  .blog-wrap .post-list a { padding: 18px 6px; }
  .blog-wrap .post-title { font-size: 18px; }
}

@media (max-width: 380px) {
  /* tiny phones (smaller iPhone SE, etc.) — extra aggressive tightening */
  .blog-wrap { padding: 50px 12px 80px; }
  .blog-body { font-size: 16px; }
  .blog-title { font-size: clamp(24px, 7vw, 32px); }
  .blog-body h2 { font-size: 21px; }
  .blog-body h3 { font-size: 17px; }
  .hero-illust { max-width: 100%; }
  .toc { padding: 16px 14px; }
  .pull-quote { font-size: 18px; padding: 20px 16px; }
  .callout { font-size: 15px; padding: 16px 18px; }
  .blog-body table th, .blog-body table td { padding: 6px; font-size: 11px; }
}
