/* shared devlog article layout. Anything a single post needs goes in that post's own article.css */

.post {
  --col: 720px;   /* reading column */
  --wide: 1100px; /* breakout width for demos, figures, big jokes */
  max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto;
  padding: 150px var(--gutter) 40px; position: relative; z-index: 2;
}

/* ---------- header ---------- */
.post-head { margin-bottom: 72px; }
.crumb { font-size: 14px; color: var(--orange); }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; text-underline-offset: 4px; }
.crumb .sep { color: var(--muted); margin: 0 .35em; }
.post-head h1 {
  font-size: clamp(44px, 8.4vw, 116px); letter-spacing: -.055em; line-height: .9;
  margin: 22px 0 28px; max-width: 13ch; text-wrap: balance;
}
.post-head h1 .then { color: var(--orange); display: block; }
.dek { font-size: clamp(18px, 2.3vw, 24px); line-height: 1.4; max-width: 34em; letter-spacing: -.01em; }
.meta {
  display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-top: 36px;
  padding-top: 16px; border-top: 2px solid var(--line); font-size: 13px; color: var(--muted); max-width: var(--col);
}
.meta .pill { border: 1.5px solid currentColor; border-radius: 99px; padding: 3px 10px; color: var(--fg); }

/* ---------- prose ---------- */
.prose { max-width: var(--col); font-size: clamp(17px, 1.6vw, 19px); line-height: 1.68; counter-reset: h2; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 {
  font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; line-height: 1.05;
  margin-top: 2.4em; text-wrap: balance;
}
.prose h2::before {
  counter-increment: h2; content: counter(h2, decimal-leading-zero) " /";
  display: block; margin-bottom: 10px; font: 600 13px "JetBrains Mono", ui-monospace, monospace; color: var(--orange); letter-spacing: 0;
}
.prose h3 { font-size: 22px; letter-spacing: -.02em; margin-top: 2em; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose a { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { background: var(--orange); color: #0d0d0d; text-decoration: none; }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .45em; }
.prose ul li::marker { content: "→  "; color: var(--orange); font-weight: 700; }
.prose ol li::marker { font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--orange); font-size: .85em; }
.prose hr { border: 0; text-align: center; margin: 2.6em 0; }
.prose hr::after { content: "✦  ✦  ✦"; color: var(--orange); letter-spacing: .3em; }
.prose blockquote { border-left: 6px solid var(--orange); padding: .2em 0 .2em 1em; font-size: 1.15em; letter-spacing: -.01em; }

/* inline code + code blocks (always dark, in both themes) */
.prose :not(pre) > code {
  font: .84em "JetBrains Mono", ui-monospace, monospace; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 6px; padding: .08em .35em; white-space: nowrap;
}
.prose pre {
  background: #0d0d0d; color: #f3f0ea; border: 2px solid var(--line); border-radius: 14px;
  box-shadow: 6px 6px 0 var(--orange); overflow-x: auto; font: 14px/1.6 "JetBrains Mono", ui-monospace, monospace;
  tab-size: 2; margin-block: 1.6em;
}
.prose pre[data-file]::before {
  content: "// " attr(data-file); display: block; padding: 8px 16px; border-bottom: 1.5px solid #3a3733;
  color: #8a847c; font-size: 12px; position: sticky; left: 0;
}
.prose pre code { display: block; padding: 16px 18px; width: max-content; min-width: 100%; }
.prose pre .c { color: #8a847c; }      /* comment */
.prose pre .k { color: #ff8a3d; }      /* keyword-ish */
.prose pre .n { color: #f6dc8c; }      /* number */

/* figures and wide breakouts */
.prose figure { margin-block: 2em; }
.prose figure img, .prose figure video, .prose figure svg { display: block; max-width: 100%; height: auto; }
.prose figure > img, .prose figure > video { border: 2px solid var(--line); border-radius: 14px; }
.prose figcaption { font: 12px/1.5 "JetBrains Mono", ui-monospace, monospace; color: var(--muted); margin-top: 10px; }
.prose .wide { width: min(var(--wide), calc(100vw - 2 * var(--gutter))); max-width: none; }

/* ---------- notes: jokes, asides, nerd bits ---------- */
.note {
  border: 2px solid var(--line); border-radius: 16px; padding: 18px 22px; margin-block: 2em;
  background: var(--card); box-shadow: 6px 6px 0 var(--line); font-size: .92em; line-height: 1.55;
  transition: background .5s;
}
.note::before {
  content: attr(data-label); display: block; margin-bottom: 6px;
  font: 600 12px "JetBrains Mono", ui-monospace, monospace; color: var(--orange);
}
.note:not([data-label])::before { content: "// note"; }
.note > * + * { margin-top: .7em; }
/* a joke gets the sticky-note treatment */
.note.joke { background: var(--orange); color: #0d0d0d; border-color: #0d0d0d; box-shadow: 6px 6px 0 var(--line); transform: rotate(-.7deg); }
.note.joke::before { color: #0d0d0d; }
.note.joke code { background: #0d0d0d; color: #f3f0ea; border-color: #0d0d0d; }
/* the bit for the nerds: dark terminal card */
.note.tech { background: #0d0d0d; color: #f3f0ea; box-shadow: 6px 6px 0 var(--orange); }
.note.tech code { background: #1d1b19; color: #f6dc8c; border-color: #3a3733; }

/* ---------- interactive bits (generic frame; the insides belong to the post) ---------- */
.demo {
  border: 2px solid var(--line); border-radius: 18px; background: var(--card);
  box-shadow: 6px 6px 0 var(--line); margin-block: 2.2em; overflow: hidden; transition: background .5s;
}
.demo-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 2px solid var(--line); font-size: 12px; color: var(--muted);
}
.demo-bar b { color: var(--orange); font-weight: 600; }
.demo-body { padding: 20px; }
.demo > figcaption { padding: 0 20px 16px; margin-top: 0; }
.btn {
  font: 600 13px "JetBrains Mono", ui-monospace, monospace; color: #0d0d0d; background: var(--orange);
  border: 2px solid #0d0d0d; border-radius: 99px; padding: 9px 16px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--line); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.btn:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
/* filled with the text colour, so its shadow turns orange or it vanishes into it */
.btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); box-shadow: 3px 3px 0 var(--orange); }
.btn[aria-pressed="true"]:hover { box-shadow: 4px 4px 0 var(--orange); }
.btn[aria-pressed="true"]:active { box-shadow: 1px 1px 0 var(--orange); }

/* ---------- end of post ---------- */
.post-end { max-width: var(--col); margin-top: 96px; padding-top: 22px; border-top: 2px solid var(--line); }
.post-end .back {
  display: inline-block; font-size: clamp(34px, 6vw, 64px); font-weight: 700; letter-spacing: -.045em;
  line-height: 1; text-decoration: none; margin-top: 14px;
}
.post-end .back:hover { color: var(--orange); }
.post-end .mono { font-size: 13px; color: var(--muted); }

@media (max-width: 720px) {
  .post { padding-top: 120px; }
  .note.joke { transform: none; }
  .demo-body { padding: 16px; }
}
