/* Blog pages (home, track pages, posts): the web app's dark look, full width. Built by scripts/blog/build_blog.js;
   the rest of the site keeps styles.css. Colors mirror the app's Dark theme (components/web/web.css). */

:root {
  color-scheme: dark;
  --bg: #181818; --side: #111111; --elev: #262626; --subtle: #2a2a2a; --edge: rgba(255, 255, 255, 0.07);
  --t1: #ededed; --t2: #d6d6d6; --box: #1f1f1f; --amber: #e8b44a; --amberDark: #3a2800;
  --body: color-mix(in srgb, var(--t1) 78%, var(--bg));
  --code-bg: color-mix(in srgb, var(--bg) 78%, #000); --code-edge: color-mix(in srgb, var(--t1) 12%, transparent); --code-fg: #e6edf3;
  --mono: Menlo, Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg); color: var(--t1); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Track colors: card fill (--tc) and label text (--tl), as the app's track cards. */
.track-learn { --tc: #6a5524; --tl: #e8b44a; }
.track-ml-foundations { --tc: #4a2436; --tl: #e0607a; }
.track-math { --tc: #3f3a5c; --tl: #a99cf0; }
.track-nlp { --tc: #6b2226; --tl: #ec7c6c; }
.track-computer-vision { --tc: #273f22; --tl: #8fd16a; }

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.bl-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 28px; background: color-mix(in srgb, var(--side) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--subtle); }
.bl-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; text-decoration: none; }
.bl-brand img { width: 30px; height: 30px; border-radius: 9px; }
.bl-bar nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bl-bar nav a { padding: 9px 14px; border-radius: 11px; font-weight: 600; font-size: 14.5px; text-decoration: none; transition: background-color .15s ease; }
.bl-bar nav a:hover, .bl-bar nav a.on { background: var(--elev); }
.bl-bar nav a.go { margin-left: 6px; background: var(--amber); color: var(--amberDark); font-weight: 800; }
.bl-bar nav a.go:hover { filter: brightness(1.07); }
.bl-prog { position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; border-radius: 0 3px 3px 0; background: linear-gradient(90deg, #e0607a, var(--amber)); }

/* ─── Shared bits ─────────────────────────────────────────────────────── */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 12px; background: var(--amber); color: var(--amberDark); font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform .14s ease, filter .14s ease, box-shadow .14s ease; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 10px 26px rgba(232, 180, 74, 0.38); }
.btn2 { display: flex; justify-content: center; margin-top: 8px; padding: 11px; border-radius: 12px; border: 1.5px solid color-mix(in srgb, var(--t1) 30%, transparent); font-weight: 700; font-size: 14.5px; text-decoration: none; }
.btn2:hover { border-color: color-mix(in srgb, var(--t1) 65%, transparent); }
.lbl { margin-bottom: 12px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.blog-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--t2); }
.blog-crumbs a { text-decoration: none; }
.blog-crumbs a:hover { color: var(--amber); }

/* ─── Post ────────────────────────────────────────────────────────────── */
.bl-post { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 56px; max-width: 1480px; margin: 0 auto; padding: 40px 40px 80px; }
.bl-toc { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 130px); overflow: auto; scrollbar-width: none; }
.bl-toc a { display: block; padding: 7px 12px; border-left: 2px solid var(--subtle); font-size: 14px; line-height: 1.4; color: var(--t2); text-decoration: none; }
.bl-toc a:hover { color: var(--t1); }
.bl-toc a.on { border-left-color: var(--amber); border-radius: 0 8px 8px 0; color: var(--t1); font-weight: 700; background: color-mix(in srgb, var(--amber) 8%, transparent); }
.bl-art { min-width: 0; }
.bl-art h1 { margin: 16px 0 14px; font-size: clamp(34px, 3.6vw, 52px); line-height: 1.08; letter-spacing: -0.025em; }
.bl-lead { max-width: 860px; margin: 0 0 22px; font-size: 20px; line-height: 1.6; color: var(--t2); }
.bl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 28px; border-bottom: 1px solid var(--subtle); font-size: 14px; color: var(--t2); }
.bl-meta a { text-decoration: none; font-weight: 700; color: var(--t1); }
.bl-chip { display: inline-flex; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; background: var(--tc); color: #fff; }
.bl-av { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--elev); font-weight: 800; color: var(--amber); }

/* Post body: shared with the app's guide reader, which shows the same .bl-body HTML. */
.bl-body { max-width: 860px; font-size: 18px; line-height: 1.75; color: var(--body); }
.bl-body h2 { margin: 52px 0 14px; font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; color: var(--t1); }
.bl-body h3 { margin: 34px 0 10px; font-size: 21px; color: var(--t1); }
.bl-body strong { color: var(--t1); }
.bl-body a { color: var(--amber); }
.bl-body li { margin: 6px 0; }
.bl-body li::marker { color: var(--amber); }
.bl-body img { display: block; width: 100%; max-height: 640px; object-fit: contain; margin: 10px 0; border-radius: 16px; background: var(--box); border: 1px solid var(--edge); }
.bl-body p:has(> img:only-child) { margin: 28px 0; }
.bl-body code { font-family: var(--mono); font-size: 0.88em; font-weight: 700; color: var(--amber); }
.bl-body table { width: 100%; margin: 22px 0; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--edge); border-radius: 14px; background: var(--box); font-size: 16px; }
.bl-body th { padding: 12px 16px; text-align: left; background: var(--elev); color: var(--t1); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.bl-body td { padding: 12px 16px; border-top: 1px solid var(--edge); }
.bl-body td code, .bl-body th code { white-space: nowrap; }
.bl-body blockquote { margin: 22px 0; padding: 4px 22px; border-left: 3px solid var(--amber); border-radius: 0 12px 12px 0; background: var(--box); }
.bl-body .math-nowrap { white-space: nowrap; }
/* Display math as in the app's lessons: a faint tint, no border. */
.bl-body .katex-display { margin: 10px 0 16px; padding: 12px; border-radius: 12px; overflow-x: auto; background: color-mix(in srgb, var(--t1) 4%, transparent); color: var(--t1); }

/* Code: the app's token colors, numbered lines, and the sideways fade + arrow. */
.bl-body pre { display: flex; gap: 16px; margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: 14px; background: var(--code-bg); border: 1px solid var(--code-edge); font-family: var(--mono); font-size: 14.5px; line-height: 1.65; color: var(--code-fg); white-space: pre; scrollbar-width: none; }
.bl-body pre::-webkit-scrollbar { display: none; }
.bl-body pre code { font-weight: 400; font-size: 1em; color: var(--code-fg); }
.cc-n { flex-shrink: 0; text-align: right; user-select: none; color: color-mix(in srgb, var(--t1) 38%, transparent); }
.hl .k { color: #c586c0; } .hl .f { color: #dcdcaa; } .hl .s { color: #ce9178; } .hl .n { color: #b5cea8; } .hl .c { color: #6a9955; font-style: italic; } .hl .b { color: #79b8ff; } .hl .v { color: #9cdcfe; }
.hl .b0 { color: #ffd700; } .hl .b1 { color: #da70d6; } .hl .b2 { color: #179fff; }
.hsc { position: relative; margin: 22px 0; }
.hsc::before, .hsc::after { content: ""; position: absolute; top: 1px; bottom: 1px; width: 64px; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.hsc::before { left: 1px; border-radius: 14px 0 0 14px; background: linear-gradient(90deg, var(--code-bg), transparent); }
.hsc::after { right: 1px; border-radius: 0 14px 14px 0; background: linear-gradient(270deg, var(--code-bg) 20%, transparent); }
.hsc.l::before, .hsc.r::after { opacity: 1; }
.hsc-arrow { position: absolute; right: 10px; top: 50%; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%; pointer-events: none; color: var(--amberDark); background: var(--amber); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); opacity: 0; transition: opacity .18s ease; }
.hsc-arrow svg { width: 15px; height: 15px; }
.hsc.r .hsc-arrow { opacity: 1; animation: hsNudge 1.6s ease-in-out infinite; }
@keyframes hsNudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

/* Previous / next in the unit. */
.blog-series { max-width: 860px; margin-top: 48px; }
.blog-series p { margin: 0 0 10px; font-size: 14px; color: var(--t2); }
.blog-series div { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.blog-series a { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 16px; background: var(--box); border: 1px solid var(--edge); font-weight: 700; line-height: 1.35; text-decoration: none; transition: transform .14s ease, border-color .14s ease; }
.blog-series a:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--amber) 50%, transparent); }
.blog-series a + a, .blog-series span + a { text-align: right; }
.blog-series small { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); }

/* Side rail: app card and related posts. */
.bl-side { position: sticky; top: 100px; align-self: start; display: flex; flex-direction: column; gap: 22px; }
.bl-cta { padding: 22px; border-radius: 18px; background: linear-gradient(160deg, color-mix(in srgb, var(--amber) 16%, var(--box)), var(--box)); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.bl-cta b { display: block; margin-bottom: 8px; font-size: 18px; }
.bl-cta p { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: var(--t2); }
.bl-ios { display: none; }
.is-ios .bl-ios { display: flex; }
.bl-rel { display: flex; flex-direction: column; gap: 6px; }
.bl-rel a { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; font-size: 14px; font-weight: 600; line-height: 1.35; text-decoration: none; }
.bl-rel a:hover { background: var(--elev); }
.bl-rel img, .bl-rel i { width: 72px; height: 54px; border-radius: 9px; object-fit: cover; background: var(--box); }

/* ─── Home and track pages ────────────────────────────────────────────── */
.bl-home { max-width: 1480px; margin: 0 auto; padding: 44px 40px 80px; }
.bl-hero { max-width: 900px; }
.bl-hero h1 { margin: 10px 0 12px; font-size: clamp(40px, 4.4vw, 64px); line-height: 1.02; letter-spacing: -0.03em; }
.bl-hero p { max-width: 620px; margin: 0; font-size: 19px; line-height: 1.55; color: var(--t2); }
.bl-hero .blog-crumbs { margin-bottom: 6px; }
.eyebrow, .bl-hero .eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber); }
.blog-search { margin-bottom: 18px; display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 12px 0 20px; border-radius: 16px; background: var(--box); border: 2px solid color-mix(in srgb, var(--amber) 55%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--amber) 8%, transparent), 0 10px 26px rgba(0, 0, 0, 0.3); transition: border-color .15s ease, box-shadow .15s ease; }
.blog-search:focus-within { border-color: var(--amber); box-shadow: 0 0 0 6px color-mix(in srgb, var(--amber) 18%, transparent), 0 10px 26px rgba(0, 0, 0, 0.3); }
.blog-search svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--amber); }
.blog-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--t1); font: inherit; font-size: 17px; font-weight: 600; }
.blog-search input::placeholder { color: var(--t2); font-weight: 500; }
.blog-search input::-webkit-search-cancel-button { filter: invert(1); }
.blog-search kbd { padding: 6px 11px; border-radius: 9px; background: var(--elev); border: 1px solid var(--edge); font: 700 13px Inter, system-ui, sans-serif; }
.blog-section h2, .bl-sec { display: flex; align-items: baseline; gap: 10px; margin: 44px 0 16px; font-size: 22px; letter-spacing: -0.01em; }
.blog-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.blog-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.blog-chip, .blog-sort-btn { padding: 8px 14px; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--t1) 28%, transparent); background: none; font-size: 14px; font-weight: 700; cursor: pointer; transition: border-color .12s ease, background-color .12s ease; }
.blog-chip:hover, .blog-sort-btn:hover { border-color: color-mix(in srgb, var(--t1) 60%, transparent); }
.blog-chip.is-active, .blog-sort-btn.is-active { background: var(--amber); border-color: var(--amber); color: var(--amberDark); }
.blog-sort { display: flex; gap: 6px; }
.blog-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 20px; }
.blog-list.is-start { grid-template-columns: 1.4fr 1fr 1fr; }
.blog-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.blog-card .im { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 16px; background: var(--box); border: 1px solid var(--edge); }
.blog-card .im::before { content: ""; position: absolute; inset: -20px; background: var(--img) center / cover; filter: blur(18px) brightness(0.5); }
.blog-card .im img { position: relative; width: 100%; height: 100%; object-fit: contain; transition: transform .2s ease; }
.blog-card:hover .im img { transform: scale(1.03); }
.blog-card .mt { display: block; font-size: 13px; line-height: 1.5; color: var(--t2); }
.blog-card .mt em { margin-right: 4px; font-style: normal; font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tl, var(--amber)); }
/* The read time moves to a new line as one piece, never splitting "8" from "min". */
.blog-card .rt { white-space: nowrap; }
.blog-card strong { font-size: 17px; line-height: 1.3; }
.blog-card:hover strong { color: var(--amber); }
.blog-list.is-start .blog-card:first-child strong { font-size: 22px; }
.blog-tracks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.blog-track { display: flex; flex-direction: column; gap: 6px; min-height: 130px; padding: 18px; border-radius: 18px; background: var(--tc); color: #fff; text-decoration: none; transition: transform .14s ease; }
a.blog-track:hover { transform: translateY(-3px); }
.blog-track strong { font-size: 18px; }
.blog-track span { font-size: 13.5px; line-height: 1.4; opacity: 0.9; }
.blog-track small { margin-top: auto; font-size: 12.5px; font-weight: 800; }
.blog-track.is-soon { opacity: 0.5; }
.blog-more { display: block; margin: 26px auto 0; padding: 12px 26px; border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--t1) 30%, transparent); background: var(--box); font-size: 14.5px; font-weight: 700; cursor: pointer; }
.blog-more:hover { border-color: var(--amber); }
.blog-empty { margin: 32px 0 0; color: var(--t2); }

/* ─── Newsletter ──────────────────────────────────────────────────────── */
.newsletter { max-width: 860px; margin-top: 44px; padding: 24px 26px; border-radius: 18px; background: var(--box); border: 1.5px solid color-mix(in srgb, var(--amber) 45%, transparent); }
.bl-home .newsletter { max-width: none; }
.newsletter::before { content: "Weekly newsletter"; display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.newsletter strong { display: block; font-size: 18px; }
.newsletter-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.newsletter-row input { flex: 1 1 220px; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid color-mix(in srgb, var(--t1) 25%, transparent); background: var(--bg); color: var(--t1); font: inherit; }
.newsletter-row input:focus { outline: 0; border-color: var(--amber); }
.newsletter-row button { padding: 12px 20px; border: 0; border-radius: 12px; background: var(--amber); color: var(--amberDark); font-weight: 800; cursor: pointer; }
.newsletter-row button:disabled { opacity: 0.6; cursor: default; }
.newsletter-status { min-height: 1em; margin: 10px 0 0; font-size: 14px; color: var(--t2); }
.newsletter-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ─── Footer ──────────────────────────────────────────────────────────── */
.bl-foot { display: flex; flex-wrap: wrap; gap: 18px; max-width: 1480px; margin: 0 auto; padding: 28px 40px; border-top: 1px solid var(--subtle); font-size: 14px; color: var(--t2); }
.bl-foot a { text-decoration: none; }
.bl-foot a:hover { color: var(--t1); }
.bl-foot span { margin-left: auto; }

/* ─── Narrower windows ────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .bl-post { grid-template-columns: 220px minmax(0, 1fr); }
  .bl-side { display: none; }
  .blog-tracks { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .bl-bar { padding: 0 16px; }
  .bl-bar nav a:not(.go) { display: none; }
  .bl-post { grid-template-columns: 1fr; gap: 0; padding: 24px 18px 60px; }
  .bl-toc { display: none; }
  .bl-home { padding: 28px 18px 60px; }
  .blog-list.is-start { grid-template-columns: 1fr; gap: 24px; }
  .blog-tracks { grid-template-columns: 1fr 1fr; }
  .blog-series div { grid-template-columns: 1fr; }
  .bl-body { font-size: 17px; }
  .bl-foot { padding: 24px 18px; }
  .bl-foot span { margin-left: 0; width: 100%; }
}
.bl-gap { margin-top: 36px; }
