/* Blog styles: same tokens and fonts as the home page (index.html). External file so the blog CSP stays style-src 'self'. */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/assets/fonts/intertight-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/assets/fonts/intertight-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/assets/fonts/jetbrains-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F7F6F2; --paper: #FFFFFF; --ink: #14122B; --muted: #5B5970; --bd: #14122B;
  --accent: #E5501C; --link: #C2410C; --btn-bg: #14122B; --btn-fg: #fff; --code-bg: #F1EFE9;
  --f-display: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 18px; --bw: 1px;
  --line: rgba(20,18,43,.1); --soft: 0 1px 2px rgba(20,18,43,.04), 0 18px 40px -28px rgba(20,18,43,.35);
  --glass: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.38)); --glass-edge: rgba(255,255,255,.75);
}
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #0F0E1A; --paper: #17162A; --ink: #F3F2F8; --muted: #A9A7BD; --bd: #F3F2F8; --link: #FF8A5C; --accent: #FF7A4D; --btn-bg: #F3F2F8; --btn-fg: #14122B; --code-bg: #1E1D33; --line: rgba(243,242,248,.1);
    --glass: linear-gradient(180deg, rgba(30,29,51,.72), rgba(23,22,42,.45)); --glass-edge: rgba(243,242,248,.14); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.7 var(--f-body); -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -4rem; z-index: 100; background: var(--btn-bg); color: var(--btn-fg); border-radius: 999px; padding: .6rem 1rem; font: 600 .875rem/1 var(--f-body); }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: 44rem; margin: 0 auto; padding: 0 var(--gutter); }

/* Header: same liquid glass bar as the home page */
.top { position: sticky; top: 12px; z-index: 50; padding: 12px var(--gutter) 0; }
.pill { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .5rem .45rem .55rem; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-edge); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 rgba(20,18,43,.05), 0 10px 30px -12px rgba(20,18,43,.25); }
.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font: 600 1.02rem/1 var(--f-display); letter-spacing: -.01em; }
.logo i { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 11px; background: #14122B; color: #FF7A4D; font: 700 .9rem/1 var(--f-display); font-style: normal; }
.nav { display: flex; gap: .1rem; }
.nav a { text-decoration: none; font-weight: 500; font-size: .9rem; color: var(--muted); padding: .55rem .85rem; border-radius: 999px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pill .btn { display: none; align-items: center; padding: .6rem 1rem; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); text-decoration: none; font: 500 .9rem/1.1 var(--f-body); }
@media (min-width: 900px) { .pill .btn { display: inline-flex; } }
.pill-end { display: flex; align-items: center; gap: .4rem; }
.lang-switch { flex: none; display: grid; place-items: center; min-width: 2.3rem; height: 2.3rem; padding: 0 .55rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); text-decoration: none; font: 600 .74rem/1 var(--f-body); letter-spacing: .05em; color: var(--muted); }
.lang-switch:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 640px) { .logo span { display: none; } .nav a { padding: .5rem .55rem; font-size: .85rem; } }
@media (max-width: 479px) { .nav { gap: 0; } .nav a { padding: .5rem .42rem; font-size: .8rem; } }
@media (max-width: 380px) { .pill { padding: .35rem .4rem; } .nav { gap: 0; } .nav a { padding: .45rem .38rem; font-size: .78rem; } }

main { padding: 3.5rem 0 4rem; }

/* Blog index */
.blog-head h1 { font: 700 clamp(2.4rem, 1.6rem + 4vw, 3.6rem)/1 var(--f-display); letter-spacing: -.04em; }
.blog-head p { margin-top: 1rem; color: var(--muted); max-width: 36rem; }
.post-list { margin-top: 2.5rem; display: grid; gap: 1rem; list-style: none; padding: 0; }
.post-card { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--soft); border-radius: 22px; padding: 1.3rem 1.4rem; }
.post-card a { text-decoration: none; }
.post-card h2 { font: 700 1.5rem/1.15 var(--f-display); letter-spacing: -.03em; }
.post-card h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.post-card p { margin-top: .5rem; color: var(--muted); }
.post-card h3 { font: 700 1.25rem/1.2 var(--f-display); letter-spacing: -.02em; }
.post-card h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.related { margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.related h2 { font: 700 1.6rem/1.1 var(--f-display); letter-spacing: -.03em; }
.related .post-list { margin-top: 1.5rem; }
.post-card p.meta { margin: 0 0 .5rem; }
.meta { font: 400 .76rem/1.5 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.meta a { text-decoration: underline; text-underline-offset: 3px; }
.empty { margin-top: 2.5rem; color: var(--muted); }

/* Article */
.article-head .meta { margin-bottom: 1rem; }
.article-head h1 { font: 700 clamp(2rem, 1.4rem + 3.4vw, 3.1rem)/1.05 var(--f-display); letter-spacing: -.035em; }
.article-head .lede { margin-top: 1.1rem; font-size: 1.2rem; color: var(--muted); }
.prose { margin-top: 2.4rem; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { margin-top: 2.2em; font: 700 1.6rem/1.15 var(--f-display); letter-spacing: -.03em; }
.prose h3 { margin-top: 1.8em; font: 700 1.2rem/1.2 var(--f-display); letter-spacing: -.02em; }
.prose a { color: var(--link); text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .45em; }
.prose blockquote { border-left: 3px solid var(--accent); padding: .1rem 0 .1rem 1.1rem; color: var(--muted); }
.prose code { font: 400 .9em var(--f-mono); background: var(--code-bg); padding: .1em .35em; border-radius: 6px; }
.prose pre { background: var(--code-bg); border: var(--bw) solid var(--line); padding: 1rem 1.2rem; border-radius: 10px; overflow-x: auto; }
.prose pre code { display: block; background: none; padding: 0; border-radius: 0; font-size: .82em; line-height: 1.6; color: var(--ink); tab-size: 2; }
/* Prism tokens (class-based, CSP-safe). */
:root { --tk-keyword: #B4361A; --tk-string: #2F7A4F; --tk-fn: #3B4FB8; --tk-var: #8A3FA0; --tk-const: #A0620F; --tk-muted: #7A7890; }
@media (prefers-color-scheme: dark) {
  :root { --tk-keyword: #FF8A5C; --tk-string: #8BD5A4; --tk-fn: #9DB0FF; --tk-var: #D9A6F0; --tk-const: #F2C27A; --tk-muted: #8F8DA6; }
}
.prose .token.keyword, .prose .token.operator.word { color: var(--tk-keyword); }
.prose .token.string, .prose .token.char { color: var(--tk-string); }
.prose .token.function, .prose .token.method-definition, .prose .token.function-name { color: var(--tk-fn); }
.prose .token.variable, .prose .token.instance-variable, .prose .token.symbol { color: var(--tk-var); }
.prose .token.constant, .prose .token.class-name, .prose .token.number, .prose .token.boolean { color: var(--tk-const); }
.prose .token.comment, .prose .token.punctuation, .prose .token.operator { color: var(--tk-muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

footer { border-top: 1px solid var(--line); padding: 1.6rem 0 2.2rem; color: var(--muted); font-size: .92rem; }
footer .wrap { max-width: 1200px; }
footer a { text-decoration: underline; text-underline-offset: 3px; }

/* HAL page */
.hal-section { margin-top: 3.5rem; }
.hal-section > h2 { font: 700 1.6rem/1.15 var(--f-display); letter-spacing: -.03em; }
.hal-agent { margin-top: 1.5rem; padding: 1.1rem 1.4rem; border-radius: 22px; background: var(--btn-bg); color: var(--btn-fg); }
.hal-agent .meta { color: inherit; opacity: .7; }
.hal-agent p + p { margin-top: .3rem; }
.hal-grid { margin-top: 1rem; display: grid; gap: 1rem; list-style: none; padding: 0; }
@media (min-width: 640px) { .hal-grid { grid-template-columns: 1fr 1fr; } }
.hal-grid h3 { font: 700 1.15rem/1.2 var(--f-display); letter-spacing: -.02em; }
.hal-grid p { font-size: .98rem; }
.hal-steps { margin-top: 1.5rem; list-style: none; padding: 0; counter-reset: step; display: grid; gap: 1.4rem; }
.hal-steps li { counter-increment: step; position: relative; padding-left: 3rem; }
.hal-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); font: 600 .9rem/1 var(--f-mono); }
.hal-steps h3 { font: 700 1.15rem/1.3 var(--f-display); letter-spacing: -.02em; }
.hal-steps p { margin-top: .25rem; color: var(--muted); }
.hal-tree { margin: 1.5rem 0 0; padding: 1rem 1.2rem; background: var(--code-bg); border: var(--bw) solid var(--line); border-radius: 10px; display: grid; gap: .6rem; }
.hal-tree div { display: grid; gap: .1rem; }
@media (min-width: 640px) { .hal-tree div { grid-template-columns: 9.5rem 1fr; gap: 1rem; } }
.hal-tree dt { font: 400 .88rem/1.6 var(--f-mono); color: var(--accent); }
.hal-tree dd { margin: 0; font-size: .95rem; color: var(--muted); }
.hal-section.prose { margin-top: 3.5rem; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url(/assets/fonts/bricolage-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
.article-head .hal-title { font: 800 clamp(4.5rem, 3rem + 9vw, 7.5rem)/.9 "Bricolage Grotesque", var(--f-display); letter-spacing: -.05em; }
.hal-acronym { margin-top: .6rem; font: 600 clamp(1.35rem, 1rem + 2vw, 2rem)/1.15 "Bricolage Grotesque", var(--f-display); letter-spacing: -.02em; color: var(--muted); }
.hal-acronym b { font-weight: 800; color: var(--accent); }
/* HAL diagram: the agent in the middle, HAL's parts around it, then the loop that feeds HAL. */
.hal-diagram { margin: 2.6rem 0 0; }
.hd-frame { position: relative; padding: 2.2rem 1rem 1rem; border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 26px; }
.hd-name { position: absolute; top: -.85rem; left: 1.2rem; padding: 0 .5rem; background: var(--bg); color: var(--accent); font: 800 1.35rem/1.2 "Bricolage Grotesque", var(--f-display); letter-spacing: -.02em; }
.hd-parts { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.hd-parts li { display: grid; place-items: center; text-align: center; min-height: 3.4rem; padding: .6rem .5rem; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); font: 600 .95rem/1.25 var(--f-display); }
.hd-parts .hd-core { grid-column: 1 / -1; order: -1; gap: .15rem; padding: 1rem; background: var(--btn-bg); color: var(--btn-fg); border: 0; }
.hd-core strong { font: 700 1.2rem/1.2 var(--f-display); }
.hd-core span { font: 400 .9rem/1.3 var(--f-body); opacity: .75; }
.hd-core .hd-kicker { font: 400 .72rem/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
@media (min-width: 640px) {
  .hd-parts { grid-template-columns: repeat(3, 1fr); }
  .hd-parts .hd-core { grid-column: auto; order: 0; }
}
.hd-loop { list-style: none; padding: 0; margin-top: 1rem; display: grid; gap: .5rem; counter-reset: loop; }
.hd-loop li { position: relative; padding: .55rem .8rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink); font: 500 .92rem/1.3 var(--f-body); text-align: center; }
.hd-loop li + li::before { content: "↓"; position: absolute; top: -.85rem; left: 50%; transform: translateX(-50%); color: var(--accent); font-size: .8rem; }
.hd-loop li:last-child::after { content: " ↺"; color: var(--accent); font-weight: 700; }
@media (min-width: 640px) {
  .hd-loop { grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
  .hd-loop li { display: grid; place-items: center; }
  .hd-loop li + li::before { content: "→"; top: 50%; left: -.85rem; transform: translateY(-50%); }
}
.hal-diagram figcaption { margin-top: .9rem; color: var(--muted); font-size: .92rem; }

.pill { position: relative; }
.menu { display: none; }
.menu summary { list-style: none; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); color: var(--ink); cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.menu .x, .menu[open] .bars { display: none; }
.menu[open] .x { display: block; }
.menu-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; display: flex; flex-direction: column; gap: .15rem; padding: .5rem; border-radius: 22px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 24px 48px -24px rgba(20, 18, 43, .5); }
.menu-panel a { padding: .85rem 1rem; border-radius: 14px; font: 500 1rem/1.2 var(--f-body); color: var(--ink); text-decoration: none; }
.menu-panel a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.menu-panel .menu-cta { margin-top: .25rem; background: var(--btn-bg); color: var(--btn-fg); text-align: center; }
/* Phones: the links move into the hamburger menu (a <details>, works without JavaScript). */
@media (max-width: 639px) { .nav { display: none; } .menu { display: block; } .logo span { display: inline; } }

/* Blog index archive: one line per post, grouped by month. */
.archive { margin-top: 3.5rem; }
.archive > h2 { font: 700 1.6rem/1.1 var(--f-display); letter-spacing: -.03em; }
.archive-month { margin-top: 1.8rem; }
.archive-month h3 { font: 400 .76rem/1.5 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li { display: grid; grid-template-columns: 4.2rem 1fr; gap: .75rem; align-items: baseline; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.archive-list time { font: 400 .78rem/1.4 var(--f-mono); color: var(--muted); white-space: nowrap; }
.archive-list a { font: 600 1.02rem/1.35 var(--f-display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.archive-list a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Tags: filter on the blog indexes and tag pages, links under an article title. */
.tag-nav { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.8rem; }
.tag-nav a, .article-tags a { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); font: 500 .85rem/1 var(--f-body); color: var(--muted); text-decoration: none; }
.tag-nav a:hover, .article-tags a:hover { color: var(--ink); border-color: var(--ink); }
.tag-nav a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tag-nav .count { font: 400 .72rem/1 var(--f-mono); opacity: .7; }
.article-tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 1.2rem 0 0; padding: 0; }
.article-tags a { padding: .4rem .7rem; font-size: .8rem; }
.blog-head + .tag-nav + .archive { margin-top: 2rem; }
