/* ==========================================================================
   Article pages (posts, CV, 404) in the Frost system. Loads after /styles.css.
   A post: back pill, title, dek and byline beside a frosted cover pane that
   clears once as the post opens; sticky contents on the left, the post at a
   reading measure, then the author and more blogs.
   ========================================================================== */


/* Article head */
.article-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: var(--space-2xl); padding-top: var(--space-md); }
.article-head__text { display: grid; justify-items: start; gap: var(--space-lg); }
.article-head h1 { text-wrap: balance; font-size: var(--text-display-s); font-weight: 400; line-height: 1.08; letter-spacing: var(--tracking-display); max-width: 22ch; }
.article-head .lead { max-width: 58ch; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); font-size: var(--text-sm); color: var(--color-ink-2); }
.byline img { width: 40px; height: 40px; border-radius: 50%; background: var(--color-ice-2); }
.byline__name { font-weight: 600; color: var(--color-ink); }
.byline time { font-variant-numeric: tabular-nums; }

/* The cover: a frosted pane beside the title; the frost clears once as the post opens */
.cover__pane { position: relative; isolation: isolate; aspect-ratio: 4 / 5; max-height: calc(100svh - 200px); margin: 0; overflow: hidden; border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-panel); background: linear-gradient(180deg, var(--color-ice), var(--color-paper-3)); box-shadow: var(--glow-inset); }
.cover__pane img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; }
.cover__pane::after { content: ""; position: absolute; inset: 0; background: var(--color-frost); backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2); opacity: 0; pointer-events: none; }
@keyframes cover-thaw { from { opacity: 1; } to { opacity: 0; } }
.cover__pane::after { animation: cover-thaw var(--dur-thaw) var(--ease-out) 250ms both; }
.is-settled .cover__pane::after { animation: none; }

/* Body: the contents on the left, the post at a reading measure */
.article-body { display: grid; grid-template-columns: minmax(17rem, 1fr) minmax(0, 44rem) minmax(0, 1fr); gap: var(--gap-columns); margin-top: var(--space-3xl); }
.toc { position: sticky; top: var(--space-xl); align-self: start; display: grid; gap: var(--space-sm); padding-right: var(--space-lg); }
.toc__title { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.toc ol { display: grid; border-left: var(--space-3xs) solid var(--color-rule); }
.toc li { margin-left: calc(-1 * var(--space-3xs)); padding: var(--space-2xs) 0 var(--space-2xs) var(--space-md); border-left: var(--space-3xs) solid transparent; font-size: var(--text-sm); line-height: 1.4; transition: border-color var(--dur-short) var(--ease-out); }
.toc li:has(> a[aria-current="true"]) { border-left-color: var(--color-signal); }
.toc a { color: var(--color-ink-2); text-decoration: none; transition: color var(--dur-short) var(--ease-out); }
.toc a:hover { color: var(--color-accent-deep); }
.toc a:active, .prose a:active { color: var(--color-accent); }
.toc a[aria-current="true"] { color: var(--color-ink); font-weight: 600; }
.toc a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }

.prose { min-width: 0; font-size: var(--text-lg); line-height: 1.75; color: var(--color-ink); }
.prose > * + * { margin-top: 1.25em; }
.prose p { max-width: none; }
.prose h2, .prose h3 { text-wrap: balance; }
.prose h2 { margin-top: 2.2em; font-size: var(--text-2xl); font-weight: 500; line-height: 1.25; letter-spacing: -0.015em; max-width: none; scroll-margin-top: var(--space-xl); }
.prose h3 { margin-top: 1.8em; font-size: var(--text-xl); font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose strong { font-weight: 600; }
.prose a { color: var(--color-accent-deep); text-decoration-color: var(--color-edge-bottom); transition: text-decoration-color var(--dur-short) var(--ease-out); }
.prose a:hover { text-decoration-color: currentColor; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.55em; }
.prose li::marker { color: var(--color-signal); }
.prose code { padding: 0.1em 0.35em; border-radius: 6px; background: var(--color-tag); color: var(--color-tag-ink); font-family: var(--font-code); font-size: 0.86em; }
.prose pre { overflow-x: auto; padding: var(--space-lg); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-inner); background: var(--grad-glass); box-shadow: var(--glow-inset); font-size: var(--text-sm); line-height: 1.65; }
.prose pre code { padding: 0; background: none; color: var(--color-ink); font-size: inherit; }
.prose figure { margin-inline: 0; }
.prose figure img { width: 100%; padding: var(--space-xs); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-card); background: var(--grad-glass); }
.prose figcaption { margin-top: var(--space-sm); font-size: var(--text-sm); line-height: 1.5; color: var(--color-ink-2); }
.table-wrap { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-md); line-height: 1.5; }
.prose th { padding: var(--space-sm) var(--space-md) var(--space-sm) 0; border-bottom: 1px solid var(--color-edge-mid); font-size: var(--text-sm); font-weight: 600; text-align: left; }
.prose td { padding: var(--space-sm) var(--space-md) var(--space-sm) 0; border-bottom: 1px solid var(--color-rule); vertical-align: top; }

/* The end: who wrote it, then the other posts */
.article-end { margin-top: var(--section-gap-s); }
.author { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-lg); padding: var(--space-xl); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-panel); background: var(--grad-glass); box-shadow: var(--glow-inset); }
.author img { width: 64px; height: 64px; border-radius: 50%; background: var(--color-ice-2); }
.author__name { font-size: var(--text-xl); font-weight: 500; color: var(--color-ink); }
.author__line { color: var(--color-ink-2); }
.author__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.more { margin-top: var(--section-gap-s); }

@media (prefers-reduced-motion: reduce) {
  .cover__pane::after { animation: none; }
  .toc li, .toc a, .prose a { transition: none; }
}

@media (max-width: 85rem) {
  .article-body { grid-template-columns: minmax(0, 44rem); }
  .toc { display: none; }
}
@media (max-width: 60rem) {
  .article-head { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
  .article-body { grid-template-columns: minmax(0, 1fr); margin-top: var(--space-2xl); }
  .cover__pane { aspect-ratio: 16 / 10; border-radius: var(--radius-card); }
  .author { grid-template-columns: auto minmax(0, 1fr); }
  .author__actions { grid-column: 1 / -1; }
}
@media (max-width: 40rem) {
  .prose { font-size: var(--text-md); }
  .cover__pane img { inset: 6%; width: 88%; height: 88%; }
  .author { grid-template-columns: minmax(0, 1fr); padding: var(--space-lg); }
}

/* ---------- Copy button on code blocks (article.js) ---------- */
.prose pre.has-copy { position: relative; padding-right: 92px; }
.code-copy { position: absolute; top: var(--space-xs); right: var(--space-xs); min-height: 32px; padding: 0 var(--space-sm); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-accent-deep); font: 600 var(--text-xs)/1 var(--font-body); cursor: pointer; }
.code-copy:hover { background: var(--color-ice); }
.code-copy:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ---------- Agent prompt card: a prompt to paste into a coding agent ----------
   The tools it works with, three steps, a copy button (article.js wires any
   [data-copy-from]), then the prompt itself in a scroll box. */
.agent { display: grid; gap: var(--space-lg); padding: var(--space-xl); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-card); background: var(--grad-glass); box-shadow: var(--glow-inset); }
.prose .agent > * { margin: 0; }
.prose .agent__tools { display: flex; flex-wrap: wrap; gap: var(--space-sm); padding: 0; list-style: none; }
.prose .agent__tools li + li { margin-top: 0; }
.agent__tool { display: inline-flex; align-items: center; gap: var(--space-sm); min-height: 52px; padding: var(--space-xs) var(--space-md) var(--space-xs) var(--space-sm); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-ink); line-height: 1.2; }
.agent__logo { flex: none; width: 22px; height: 22px; }
.agent__tool > span { display: grid; gap: 2px; }
.agent__tool strong { font-size: var(--text-sm); font-weight: 600; }
.agent__tool span span, .prose .agent__tool code { padding: 0; background: none; color: var(--color-ink-2); font-size: var(--text-xs); }
.prose .agent__steps { display: grid; gap: var(--space-2xs); font-size: var(--text-md); }
.prose .agent__steps li + li { margin-top: 0; }
.agent__actions[hidden], .agent__actions:not(:has(button:not([hidden]))) { display: none; }
.prose .agent__prompt { max-height: 26rem; overflow: auto; background: var(--color-paper); font-size: var(--text-xs); }
@media (max-width: 40rem) {
  .agent { padding: var(--space-lg); }
  .agent__tool { flex: 1 1 auto; }
}

/* ---------- CV (/cv.html): the article head, then the record on one glass sheet ---------- */
.cv-head { padding-top: var(--space-md); }
.cv__contact { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
.cv__contact a { color: var(--color-accent-deep); font-weight: 500; text-decoration: none; }
.cv__contact a:hover { text-decoration: underline; }
.cv__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.cv { display: grid; gap: var(--space-2xl); max-width: 56rem; margin-top: var(--space-3xl); }
.cv__section { display: grid; gap: var(--space-lg); }
.cv__h { padding-bottom: var(--space-sm); border-bottom: 1px solid var(--color-rule); font-size: var(--text-2xl); font-weight: 500; letter-spacing: -0.015em; max-width: none; }
.cv__section > p { font-size: var(--text-lg); line-height: 1.7; max-width: none; }
.cv strong { font-weight: 600; }
.cv__skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg) var(--space-xl); margin: 0; }
.cv__skills dt { font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.cv__skills dd { margin: var(--space-2xs) 0 0; color: var(--color-ink-2); line-height: 1.6; }
.cv__entry { padding: var(--space-xl); border: 1px solid; border-color: var(--edge-glass); border-radius: var(--radius-card); background: var(--grad-glass); box-shadow: var(--glow-inset); }
.cv__entry-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2xs) var(--space-lg); align-items: baseline; }
.cv__entry-title { font-size: var(--text-title); font-weight: 500; }
.cv__entry-when { justify-self: end; display: inline-flex; align-items: center; min-height: 30px; padding: 0 var(--space-sm); border: 1px solid var(--color-tag-edge); border-radius: var(--radius-pill); background: var(--color-tag); color: var(--color-tag-ink); font-size: var(--text-sm); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv__entry-org { grid-column: 1 / -1; color: var(--color-ink-2); }
.cv__entry-org a { color: var(--color-accent-deep); text-decoration-color: var(--color-edge-bottom); }
.cv__list { display: grid; gap: var(--space-sm); margin: var(--space-lg) 0 0; padding-left: 1.2em; line-height: 1.65; }
.cv__list li::marker { color: var(--color-signal); }
@media (max-width: 40rem) {
  .cv__skills { grid-template-columns: minmax(0, 1fr); }
  .cv__entry { padding: var(--space-lg); }
  .cv__entry-head { grid-template-columns: minmax(0, 1fr); }
  .cv__entry-when { justify-self: start; }
}

/* Printed from the browser: one plain sheet. No chrome, ink on white, sections kept whole. */
@media print {
  @page { size: A4; margin: 12mm 14mm; }
  .cv-page .skip, .cv-page .nav, .cv-page .footer, .cv-page .cv__actions, .cv-page .article-head .btn { display: none !important; }
  .cv-page { background: #fff; color: #0B1424; font-size: 9.2pt; }
  .cv-page .container { max-width: none; padding: 0; }
  .cv-page .article-head { display: block; padding: 0; }
  .cv-page .article-head h1 { font-size: 24pt; }
  .cv-page .article-head .lead { margin-top: 4pt; font-size: 11pt; }
  .cv-page .cv__contact { margin-top: 8pt; font-size: 9pt; }
  .cv-page .cv__contact a, .cv-page .cv__entry-org a { color: inherit; text-decoration: none; }
  .cv-page .cv { margin-top: 12pt; gap: 12pt; }
  .cv-page .cv__h { padding-bottom: 4pt; font-size: 11.5pt; break-after: avoid; }
  .cv-page .cv__section { gap: 6pt; }
  .cv-page .cv__section > p, .cv-page .cv__skills, .cv-page .cv__entry { font-size: 9.2pt; line-height: 1.38; }
  .cv-page .cv__entry { padding: 0; border: 0; background: none; box-shadow: none; }
  .cv-page .cv__entry + .cv__entry { margin-top: 8pt; }
  .cv-page .cv__entry-head { break-after: avoid; }
  .cv-page .cv__entry-title { font-size: 10.5pt; }
  .cv-page .cv__entry-when { min-height: 0; padding: 0; border: 0; background: none; }
  .cv-page .cv__list { margin-top: 4pt; gap: 1pt; }
  .cv-page .cv__list li { break-inside: avoid; }
}

/* ---------- 404 ---------- */
.lost { display: grid; justify-items: start; gap: var(--space-lg); padding-block: var(--space-2xl) var(--space-3xl); }
.lost h1 { font-size: var(--text-display); line-height: 1.08; letter-spacing: var(--tracking-display); max-width: 16ch; }
.lost .actions { justify-content: flex-start; }
