/* ====================================================================
 * clixad blog / shared shell
 *
 * The landing page keeps its CSS inline because it is one document and a
 * render-blocking request would cost more than the bytes save. The blog is
 * many documents that share one shell, so here the trade flips: one cached
 * file, linked by every post.
 *
 * The token block below is a **copy** of the one in `index.html`. Two copies
 * of a palette is the price of a static site with no build step, the same
 * deal duck.svg has with apps/cli/src/banner.ts. If you change a colour, a
 * font step or a width in index.html, change it here too.
 *
 * House style, same as the rest of the site: sentence case, no em dashes,
 * dark only (the subject is a terminal).
 * ==================================================================== */

:root {
  color-scheme: dark;

  --surface: #24406f;
  --bg: #0a1430;
  --bg-deep: #050c1e;
  --floor: #040916;
  --panel: #0d1a3c;
  --panel-2: #112147;
  --text: #e8eefb;
  --muted: #93a4c8;
  --faint: #64749d;

  --mango: #f5b841;
  --mango-bright: #ffcf6b;
  --mango-deep: #a9761f;
  --beak: #e27e2a;
  --mint: #5fe3b3;
  --mint-deep: #2ba884;
  --coral: #ff7a7a;
  --sky: #6cb4ff;

  --line: rgba(255, 255, 255, 0.11);
  --line-2: rgba(255, 255, 255, 0.2);
  --line-soft: rgba(255, 255, 255, 0.06);
  --top-light: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  --accent: var(--mango);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --fs-display: clamp(1.7rem, 3.7vw, 2.6rem);
  --fs-h2: clamp(1.3rem, 3.2vw, 1.85rem);
  --fs-h3: 1.02rem;
  --fs-lead: 1rem;
  --fs-body: 0.94rem;
  --fs-sm: 0.85rem;
  --fs-xs: 0.74rem;

  --w-page: 1080px;
  --w-read: 660px;
  --shadow: 5px 5px 0 rgba(0, 0, 0, 0.4);
  --shadow-lift: 9px 9px 0 rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--surface);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  position: relative;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* the same three inert background layers as the landing page: depth that
   spans the document, pools of light, then grain as the only texture. The
   sea life, the sunbeams and the depth gauge stay on the landing page —
   they are furniture for a page you scroll through, not one you read. */
body::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background: linear-gradient(180deg,
    #24406f 0%, #2a4a7d 3%, #1d3a66 5%, #16305c 8%, #12274c 13%,
    #0f2143 20%, #0d1c3a 30%, #0b1832 42%, #0a1430 54%, #08112a 66%,
    #060e23 78%, #050b1c 88%, var(--floor) 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(3, 7, 20, 0.6) 100%),
    radial-gradient(58rem 40rem at 6% -10%, rgba(245, 184, 65, 0.16), transparent 62%),
    radial-gradient(54rem 42rem at 100% 20%, rgba(108, 180, 255, 0.14), transparent 62%),
    radial-gradient(48rem 38rem at -6% 64%, rgba(95, 227, 179, 0.09), transparent 60%),
    radial-gradient(42rem 32rem at 92% 96%, rgba(226, 126, 42, 0.09), transparent 62%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.62;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.24'/%3E%3C/svg%3E");
}

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--mango); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--w-page); margin: 0 auto; padding: 0 22px; }
/* The landing page left-aligns its reading measure inside the full-width
   column, because there is always a card or a table beside it holding the
   right edge. A blog has nothing on that side, so the same rule reads as a
   layout bug rather than as a choice. Here the measure centres. */
.read { max-width: var(--w-read); margin-inline: auto; }
.num { font-variant-numeric: tabular-nums; }

.a-mango { --accent: var(--mango); }
.a-mint { --accent: var(--mint); }
.a-sky { --accent: var(--sky); }
.a-coral { --accent: var(--coral); }

/* ---------------- header ---------------- */
header {
  position: sticky; top: 0; z-index: 30;
  padding: 16px 0;
  border-bottom: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}
header.stuck {
  background: rgba(9, 17, 42, 0.74);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.brand:hover img { transform: translateY(-3px) rotate(-6deg); }
.bar nav { display: flex; align-items: center; gap: 16px; font-size: var(--fs-sm); }
.bar nav a { color: var(--muted); }
.bar nav a[aria-current="page"] { color: var(--mango); }
@media (max-width: 400px) { .bar nav { gap: 12px; font-size: var(--fs-xs); } }

main { flex: 1; }

/* ---------------- section furniture, borrowed from the landing page ------ */
.rule { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.rule-label {
  flex: none; color: var(--accent);
  font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 5px; padding: 2px 9px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.rule-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--line-soft) 45%, transparent);
}

/* ---------------- blog index ---------------- */
.blog-head { padding-block: clamp(30px, 4.5vw, 56px) clamp(20px, 2.6vw, 30px); }
.blog-head h1 {
  font-size: var(--fs-display); line-height: 1.08; font-weight: 700;
  letter-spacing: -0.035em; text-wrap: balance;
}
.blog-head h1 .on { color: var(--mango); }
.blog-head p { color: var(--muted); font-size: var(--fs-lead); margin-top: 16px; max-width: 56ch; }

.posts { display: grid; gap: 16px; padding-bottom: clamp(40px, 5vw, 64px); }
.post-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px 20px 18px;
  box-shadow: var(--shadow), var(--top-light);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.post-card:hover {
  text-decoration: none; transform: translate(-2px, -2px);
  border-color: rgba(245, 184, 65, 0.34); box-shadow: var(--shadow-lift), var(--top-light);
}
.post-card .kicker {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--faint); font-size: var(--fs-xs); letter-spacing: 0.06em; margin-bottom: 10px;
}
.post-card .kicker .topic { color: var(--mint); }
.post-card h2 {
  font-size: 1.16rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3;
  color: var(--text); text-wrap: balance;
}
.post-card p { color: var(--muted); font-size: var(--fs-body); margin-top: 10px; }
.post-card .more { color: var(--mango); font-size: var(--fs-sm); margin-top: 14px; }

/* ---------------- article ---------------- */
.post { padding-block: clamp(26px, 3.4vw, 42px) clamp(40px, 5vw, 64px); }
.crumbs { color: var(--faint); font-size: var(--fs-xs); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line-2); padding: 0 6px; }

.post h1 {
  font-size: var(--fs-display); line-height: 1.1; font-weight: 700;
  letter-spacing: -0.035em; text-wrap: balance; margin-bottom: 16px;
}
.post-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--faint); font-size: var(--fs-xs); letter-spacing: 0.04em;
  padding-bottom: 22px; border-bottom: 1px solid var(--line-soft);
}
.post-meta .sep { color: var(--line-2); }
.post-meta a { color: var(--muted); }

/* the answer box. First thing under the title on purpose: a reader who wants
   the conclusion gets it in one screen, and an answer engine quoting the page
   quotes something complete rather than the first half of an argument. */
.answer {
  position: relative; margin: 26px 0 8px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid rgba(95, 227, 179, 0.3); border-radius: 12px;
  padding: 22px 18px 18px;
  box-shadow: var(--shadow), var(--top-light);
}
.answer > .label {
  position: absolute; top: -0.72em; left: 15px; background: #0b1734;
  padding: 0 8px; color: var(--mint); font-size: var(--fs-xs); letter-spacing: 0.06em;
}
.answer p { color: var(--text); font-size: var(--fs-body); }
.answer p + p { margin-top: 12px; }

.toc {
  margin: 30px 0; padding: 16px 18px;
  border: 1px solid var(--line); border-left: 2px solid var(--sky); border-radius: 10px;
  background: rgba(108, 180, 255, 0.04);
}
/* Specific enough to beat `.post h2` below, which this heading sits inside.
   It is an h2 so the document outline stays honest for a screen reader, not
   because it wants to look like one. */
.post .toc h2 {
  font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); font-weight: 400; margin: 0 0 10px;
}
.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; font-size: var(--fs-sm); padding: 3px 0; }
.toc li::before { content: counter(toc) ". "; color: var(--faint); }

.post h2 {
  font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.22; text-wrap: balance;
  margin: 44px 0 14px; scroll-margin-top: 78px;
}
.post h2 .on { color: var(--accent); }
.post h3 {
  font-size: var(--fs-h3); font-weight: 700; letter-spacing: -0.01em;
  margin: 28px 0 10px; scroll-margin-top: 78px;
}
.post p, .post li { color: var(--muted); font-size: var(--fs-body); }
.post p { margin-bottom: 14px; }
.post strong { color: var(--text); font-weight: 700; }
.post ul, .post ol { margin: 0 0 16px 22px; }
.post li { margin-bottom: 7px; }
.post li::marker { color: var(--faint); }

.post code {
  font-family: inherit; font-size: 0.88em; color: var(--sky);
  background: rgba(108, 180, 255, 0.08); border: 1px solid rgba(108, 180, 255, 0.16);
  border-radius: 5px; padding: 1px 5px;
}
.post a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(108, 180, 255, 0.4); }

.post blockquote {
  margin: 0 0 18px; padding: 2px 0 2px 16px;
  border-left: 2px solid var(--mango); color: var(--text); font-size: var(--fs-body);
}
.post blockquote cite { display: block; margin-top: 8px; color: var(--faint); font-size: var(--fs-xs); font-style: normal; }

/* definition list, for the "what the words mean" block */
.post dl { margin: 0 0 18px; }
.post dt { color: var(--text); font-weight: 700; font-size: var(--fs-body); margin-top: 16px; }
.post dt:first-child { margin-top: 0; }
.post dd { color: var(--muted); font-size: var(--fs-body); margin: 5px 0 0; }

/* Wide content scrolls inside its own box. A table that widens the document
   breaks every other block on the page, and on a phone it breaks all of them. */
.tbl-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: var(--fs-sm); }
caption {
  caption-side: bottom; color: var(--faint); font-size: var(--fs-xs);
  text-align: left; padding: 10px 14px; border-top: 1px solid var(--line-soft);
}
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
thead th {
  color: var(--faint); font-weight: 400; font-size: var(--fs-xs);
  letter-spacing: 0.08em; text-transform: uppercase; background: rgba(255, 255, 255, 0.03);
}
tbody th { color: var(--text); font-weight: 700; }
/* a date broken over three lines reads as three dates */
tbody th time { white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
td.yes { color: var(--mint); }
td.no { color: var(--coral); }

.callout {
  margin: 0 0 20px; padding: 14px 16px;
  border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.callout p { margin: 0; font-size: var(--fs-sm); }
.callout p + p { margin-top: 8px; }

/* faq, mirrored into FAQPage json-ld */
.qa { border-top: 1px solid var(--line-soft); }
.qa-item { border-bottom: 1px solid var(--line-soft); }
.qa-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 2px; cursor: pointer; list-style: none;
}
.qa-item summary::-webkit-details-marker { display: none; }
.qa-item summary h3 { margin: 0; font-size: var(--fs-body); }
.qa-sign { flex: none; width: 12px; height: 12px; position: relative; }
.qa-sign::before, .qa-sign::after {
  content: ""; position: absolute; background: var(--mango); transition: transform 0.18s ease;
}
.qa-sign::before { left: 0; right: 0; top: 5px; height: 2px; }
.qa-sign::after { top: 0; bottom: 0; left: 5px; width: 2px; }
.qa-item[open] .qa-sign::after { transform: scaleY(0); }
.qa-item .a { color: var(--muted); font-size: var(--fs-body); padding: 0 2px 16px; margin: 0; }

/* sources. Every dated claim in a post points at one, which is the only way a
   reader (or a crawler deciding whether to repeat us) can check it. */
.sources { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); }
.sources h2 { font-size: var(--fs-h3); margin: 0 0 12px; }
.sources ol { margin-left: 20px; }
.sources li { font-size: var(--fs-sm); margin-bottom: 8px; color: var(--faint); }
.sources li a { color: var(--muted); }

/* ---------------- the ask ---------------- */
.post-cta {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 40px; padding: 20px;
  background: var(--panel); border: 1px solid rgba(245, 184, 65, 0.32); border-radius: 12px;
  box-shadow: var(--shadow), 0 0 60px rgba(245, 184, 65, 0.07), var(--top-light);
}
.post-cta img { width: 48px; height: 48px; flex: none; }
.post-cta .copy { flex: 1 1 240px; }
.post-cta .t { color: var(--text); font-weight: 700; letter-spacing: -0.01em; }
.post-cta .s { color: var(--faint); font-size: var(--fs-sm); margin: 4px 0 0; }
.post-cta .cta-cmd { flex: 1 1 260px; }
.post-cta .s code { color: var(--mango); }

.prompt-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 6px 8px 6px 12px;
}
.caret { color: var(--mango); flex: none; }
/* Selectable on purpose: copying it by hand has to stay possible. The
   `.post code` chrome is undone here — the prompt row is already the frame,
   and a bordered pill inside it reads as a text input. Two classes, because
   `.post code` is a class plus an element and would otherwise outrank a bare
   `.cmd` whatever the order. */
.post-cta .cmd {
  flex: 1; min-width: 0; font: inherit; font-size: var(--fs-sm); color: var(--text);
  background: none; border: none; border-radius: 0;
  overflow-x: auto; white-space: nowrap; padding: 4px 0; user-select: all;
}
.btn {
  font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; flex: none;
  color: #0a1430; background: var(--mango);
  border: none; border-radius: 8px; padding: 9px 18px;
  box-shadow: 0 3px 0 var(--mango-deep);
  transition: background 0.15s, transform 0.09s, box-shadow 0.09s;
}
.btn:hover:not(:disabled) { background: var(--mango-bright); transform: translateY(-1px); box-shadow: 0 4px 0 var(--mango-deep); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--mango-deep); }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: 0 3px 0 var(--mango-deep); }
.btn.copy-btn { font-size: var(--fs-xs); padding: 7px 14px; letter-spacing: 0.04em; }

/* ---------------- footer ---------------- */
footer { border-top: 1px solid var(--line); padding: 22px 0 32px; margin-top: 20px; }
.foot { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; color: var(--faint); font-size: var(--fs-xs); }
.foot nav a { color: var(--muted); }
.foot .sep { color: var(--line-2); padding: 0 6px; }

@media print {
  body::before, body::after, .grain, .post-cta, header { display: none; }
  body { color: #000; }
}
