/* arshsingh.com blog post reading layout (Nov 2026), same system as apsteq.com /assets/css/blog-post.css.
   Every post shares one shell: breadcrumb div, header div (h1), then
   <article class="px-4 pb-20"><div class="container-site mx-auto blog-body-dark max-w-3xl">.
   Rules key off that shell with :has(), so no post needs its markup changed.
   blog-post.js adds the table of contents, progress bar and table wrappers. */

body:has(.blog-body-dark) {
  --bp-ink: #0f172a;
  --bp-body: #2b3445;
  --bp-mute: #64748b;
  --bp-line: #e5e8ef;
  --bp-soft: #f6f7fb;
  --bp-brand: #c93c00;
  --bp-brand-soft: #fdf1e9;
  --bp-amber: #f59e0b;
  --bp-col: 720px;
  background: #ffffff;
}

/* One reading column for the header, the body and everything under it */
body:has(.blog-body-dark) .container-site.max-w-3xl,
body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) > .container-site,
body:has(.blog-body-dark) div.px-4:has(+ div.px-4 h1) > .container-site { max-width: var(--bp-col) !important; margin-left: auto; margin-right: auto; }

/* Header */
body:has(.blog-body-dark) h1 {
  font-weight: 600 !important;
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.4vw, 3rem) !important;
  line-height: 1.12 !important;
  letter-spacing: -0.025em;
  color: var(--bp-ink);
  text-wrap: balance;
}
body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) > .container-site { border-bottom: 1px solid var(--bp-line); padding-bottom: 1.75rem; margin-bottom: 2.5rem; }
body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) .mb-8 { margin-bottom: 0; }

/* Body type: ~68 characters a line, generous leading */
.blog-body-dark { font-size: 1.1875rem; line-height: 1.75; color: var(--bp-body); font-feature-settings: "kern", "liga"; }
.blog-body-dark > * + * { margin-top: 0; }
.blog-body-dark p { margin: 0 0 1.35em; }
.blog-body-dark > p:first-child { font-size: 1.3125rem; line-height: 1.6; color: var(--bp-ink); }
.blog-body-dark > p:first-child strong { font-weight: 600; }
.blog-body-dark strong { color: var(--bp-ink); font-weight: 650; }
.blog-body-dark a { color: var(--bp-brand); text-decoration: underline; text-decoration-color: rgba(201, 60, 0, .3); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.blog-body-dark a:hover { text-decoration-color: var(--bp-brand); }

.blog-body-dark h2 {
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.6vw, 1.95rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--bp-ink);
  margin: 2.6em 0 .7em;
  scroll-margin-top: 96px;
  text-wrap: balance;
}
.blog-body-dark h3 {
  font-size: 1.3rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--bp-ink);
  margin: 2em 0 .5em;
  scroll-margin-top: 96px;
}
.blog-body-dark h4 { font-size: 1.1rem; font-weight: 700; color: var(--bp-ink); margin: 1.6em 0 .4em; }

/* Lists */
.blog-body-dark ul, .blog-body-dark ol { margin: 0 0 1.5em; padding-left: 1.4em; }
.blog-body-dark ul { list-style: none; padding-left: 1.5em; }
.blog-body-dark ul > li { position: relative; }
.blog-body-dark ul > li::before { content: ""; position: absolute; left: -1.1em; top: .72em; width: 7px; height: 7px; border-radius: 2px; background: var(--bp-brand); }
.blog-body-dark ol { list-style: decimal; }
.blog-body-dark ol > li::marker { color: var(--bp-brand); font-weight: 700; }
.blog-body-dark li { margin: 0 0 .6em; padding-left: .2em; }
.blog-body-dark li > p { margin-bottom: .4em; }

/* Callouts: blockquote is a soft card; "Key takeaways" gets the brand treatment */
.blog-body-dark blockquote {
  margin: 2em 0;
  padding: 1.4em 1.6em;
  background: var(--bp-soft);
  border: 1px solid var(--bp-line);
  border-left: 4px solid var(--bp-brand);
  border-radius: 14px;
  color: var(--bp-body);
  font-size: 1.0625rem;
}
.blog-body-dark blockquote > :last-child { margin-bottom: 0; }
.blog-body-dark blockquote.bp-takeaways {
  background: var(--bp-brand-soft);
  border: 1px solid #f6d9c6;
  border-left: 1px solid #f6d9c6;
  padding: 1.6em 1.7em 1.2em;
}
.blog-body-dark blockquote.bp-takeaways > p:first-child {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: .75rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--bp-brand); margin-bottom: .9em;
}
.blog-body-dark blockquote.bp-takeaways > p:first-child strong { color: var(--bp-brand); font-weight: 600; }
.blog-body-dark blockquote.bp-takeaways li { margin-bottom: .55em; }

/* Tables: bordered card, scrolls on its own on small screens */
.blog-body-dark .bp-table { margin: 2em 0; border: 1px solid var(--bp-line); border-radius: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.blog-body-dark .bp-table table { margin: 0 !important; display: table !important; min-width: 100%; font-size: .95rem; }
.blog-body-dark table { font-variant-numeric: tabular-nums; }
.blog-body-dark thead { background: var(--bp-soft) !important; }
.blog-body-dark th { font-size: .8125rem; text-transform: none; color: var(--bp-ink) !important; }
.blog-body-dark td, .blog-body-dark th { padding: .8rem 1rem !important; }
.blog-body-dark td:first-child { font-weight: 600; color: var(--bp-ink); }

/* Figures and images */
.blog-body-dark img { max-width: 100%; height: auto; border-radius: 14px; }
.blog-body-dark figure, .blog-body-dark .aq-fig { margin: 2.2em 0; }
.blog-body-dark figure img { display: block; width: 100%; border: 1px solid var(--bp-line); border-radius: 14px; margin: 0; background: #fff; }
.blog-body-dark figcaption { margin-top: .7em; font-size: .9rem; line-height: 1.55; color: var(--bp-mute); }
.blog-body-dark figcaption a { color: inherit; }

/* Code and rules */
.blog-body-dark code { font-family: "Spline Sans Mono", ui-monospace, monospace; font-size: .88em; background: var(--bp-soft); border: 1px solid var(--bp-line); border-radius: 6px; padding: .1em .35em; }
.blog-body-dark hr { border: 0; border-top: 1px solid var(--bp-line); margin: 2.5em 0; }

/* Related reading */
.blog-body-dark .aq-related { background: var(--bp-soft) !important; border: 1px solid var(--bp-line) !important; border-radius: 16px !important; }
.blog-body-dark .aq-related h2 { margin-top: 0; font-size: 1.25rem; }
.blog-body-dark .aq-related ul { margin-bottom: 0; }

/* Table of contents: left rail on wide screens, hidden elsewhere */
.bp-toc { display: none; }
@media (min-width: 1240px) {
  body:has(.blog-body-dark) article.px-4:has(.bp-toc) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--bp-col) minmax(0, 1fr);
    column-gap: 56px;
    align-items: start;
  }
  body:has(.blog-body-dark) article.px-4:has(.bp-toc) > .blog-body-dark { grid-column: 2; grid-row: 1; width: 100%; max-width: none !important; margin: 0; }
  body:has(.blog-body-dark) article.px-4:has(.bp-toc) > :not(.blog-body-dark):not(.bp-toc) { grid-column: 2; }
  .bp-toc {
    display: block; grid-column: 1; grid-row: 1; justify-self: end;
    width: 240px; position: sticky; top: 104px;
    max-height: calc(100vh - 140px); overflow-y: auto;
    font-size: .875rem; line-height: 1.45;
  }
  .bp-toc p { font-family: "Spline Sans Mono", ui-monospace, monospace; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--bp-mute); margin: 0 0 .8em; }
  .bp-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--bp-line); }
  .bp-toc a { display: block; padding: .38em 0 .38em 1em; margin-left: -1px; border-left: 2px solid transparent; color: var(--bp-mute); text-decoration: none; }
  .bp-toc a:hover { color: var(--bp-ink); }
  .bp-toc a[aria-current="true"] { color: var(--bp-brand); border-left-color: var(--bp-brand); font-weight: 600; }
}

/* Reading progress */
.bp-progress { position: fixed; top: 0; left: 0; height: 4px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--bp-brand); z-index: 70; pointer-events: none; }

/* Phones */
@media (max-width: 640px) {
  .blog-body-dark { font-size: 1.0625rem; line-height: 1.72; }
  .blog-body-dark > p:first-child { font-size: 1.15rem; }
  .blog-body-dark blockquote { padding: 1.15em 1.2em; margin: 1.6em 0; }
  .blog-body-dark h2 { margin-top: 2.1em; }
  .blog-body-dark ul { padding-left: 1.3em; }
}

@media (prefers-reduced-motion: reduce) { .bp-toc a { transition: none; } }

/* Solid menu bar so body text never shows through it while reading */
body:has(.blog-body-dark) header.fixed, body:has(.blog-body-dark) nav.fixed { background: #ffffff !important; backdrop-filter: none; box-shadow: 0 1px 0 var(--bp-line); }
body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) .text-sm { flex-wrap: wrap; row-gap: 4px; }
body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) .text-sm > span { white-space: nowrap; }
@media (max-width: 640px) {
  body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) > .container-site { margin-bottom: 1.5rem; padding-bottom: 1.25rem; }
  body:has(.blog-body-dark) div.px-4:has(> .container-site > h1) { padding-bottom: 0 !important; }
}
body:has(.blog-body-dark) header[style*="position:fixed"] { background: #ffffff !important; }

/* Dark theme (theme-init.js sets data-theme on <html> from the visitor's choice or OS) */
[data-theme="dark"] body:has(.blog-body-dark) {
  --bp-ink: #f4f1ea;
  --bp-body: rgba(244, 241, 234, .82);
  --bp-mute: rgba(244, 241, 234, .55);
  --bp-line: rgba(255, 255, 255, .12);
  --bp-soft: rgba(255, 255, 255, .045);
  --bp-brand: #ff7a3d;
  --bp-brand-soft: rgba(255, 106, 38, .12);
  background: var(--color-bg, #0b0b14);
}
[data-theme="dark"] body:has(.blog-body-dark) header[style*="position:fixed"] { background: var(--color-nav-bg) !important; }
[data-theme="dark"] .blog-body-dark a { text-decoration-color: rgba(255, 122, 61, .4); }
[data-theme="dark"] .blog-body-dark blockquote.bp-takeaways { border-color: rgba(255, 122, 61, .3); }
[data-theme="dark"] .blog-body-dark figure img { background: #fff; }
