/* Shared tokens and components for design mockups (extracted from style-tile.html). */
:root {
  /* Brand constants (from the existing site) */
  --brand-yellow: #F9D448;
  --brand-teal:   #4495A2;
  --brand-green:  #427C2E; /* yellow × teal, multiplied */
  --brand-dark:   #1E1E1E;
  --brand-light:  #D9D9D9;

  /* Theme tokens: light */
  --paper:   #FFFFFF;
  --paper-2: #F3F6F6;
  --ink:     #1E1E1E;
  --ink-2:   #4A5356;
  --rule:    #D9DEDF;
  --link:    #2B6D78;
  --link-hover: #1D4F57;
  --green-ink: #3C6E2A;
  --wash-yellow: #FDF3C4;
  --wash-teal:   #E3F0F2;
  --mark:    #FBE48A;
  --code-bg: #1E1E1E;
  --code-fg: #E9E7E1;
  --code-dim:#8B9497;
  --code-kw: #7FC3CE;
  --code-str:#F9D448;
  --code-ty: #A8D08D;
  --code-num:#F4A97A;
  --diagram-stroke: #1E1E1E;
  --diagram-fill: #FFFFFF;
  /* Decorative motif (hero blocks): brand colours in light, brighter and slightly softened in dark so they glow instead of going muddy. */
  --motif-yellow: var(--brand-yellow);
  --motif-teal:   var(--brand-teal);

  --f-display: "Rubik", "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  --f-body: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Type scale (ratio ≈ 1.25, body 18px) */
  --t-xs: 0.8125rem; --t-sm: 0.9375rem; --t-body: 1.125rem; --t-md: 1.375rem;
  --t-lg: 1.75rem;   --t-xl: 2.5rem;    --t-2xl: clamp(2.5rem, 6vw, 3.75rem);

  --measure: 40rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16191A; --paper-2: #1F2425; --ink: #ECEAE4; --ink-2: #A6AEB0; --rule: #30383A;
    --link: #82C6D1; --link-hover: #B4E0E7; --green-ink: #9CC982;
    --wash-yellow: #39321A; --wash-teal: #1B3236; --mark: #5A4A12;
    --code-bg: #0E1011; --code-fg: #E9E7E1; --code-dim: #7E888B;
    --diagram-stroke: #ECEAE4; --diagram-fill: #16191A;
    --motif-yellow: #E9C74A; --motif-teal: #5AB0BD;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16191A; --paper-2: #1F2425; --ink: #ECEAE4; --ink-2: #A6AEB0; --rule: #30383A;
  --link: #82C6D1; --link-hover: #B4E0E7; --green-ink: #9CC982;
  --wash-yellow: #39321A; --wash-teal: #1B3236; --mark: #5A4A12;
  --code-bg: #0E1011; --code-fg: #E9E7E1; --code-dim: #7E888B;
  --diagram-stroke: #ECEAE4; --diagram-fill: #16191A;
  --motif-yellow: #E9C74A; --motif-teal: #5AB0BD;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: var(--t-body); line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brand-teal); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, .eyebrow, .label { font-family: var(--f-display); text-wrap: balance; }
.eyebrow {
  font-size: var(--t-xs); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2); display: flex; align-items: center; gap: 0.6em;
}
.eyebrow::before {
  content: ""; width: 0.55em; height: 0.55em; background: var(--brand-teal); transform: rotate(45deg); flex: none;
}

/* ---------- Article components ---------- */
.article { display: grid; gap: 1.25rem; hyphens: auto; -webkit-hyphens: auto; }
.article h1 { font-size: var(--t-xl); font-weight: 700; line-height: 1.08; letter-spacing: -0.015em; }
.article h2 { font-size: var(--t-lg); font-weight: 700; line-height: 1.2; margin-top: 1.25rem; hyphens: manual; }
.article h3 { font-size: var(--t-md); font-weight: 500; line-height: 1.3; margin-top: 0.5rem; }
.article p { text-wrap: pretty; }
.art-head { display: grid; gap: 1rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.art-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: center; font-family: var(--f-display); font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.art-meta .dot { width: 0.35em; height: 0.35em; background: var(--ink-2); transform: rotate(45deg); }
.draft { font-family: var(--f-display); font-size: var(--t-xs); font-weight: 500; display: inline-flex; gap: 0.4rem; align-items: center; padding: 0.15rem 0.55rem; background: var(--wash-yellow); color: var(--ink); border: 1px solid var(--brand-yellow); }
.draft svg { width: 0.85rem; height: 0.85rem; }
.standfirst { font-family: var(--f-body); font-size: var(--t-md); line-height: 1.5; color: var(--ink-2); }

code, kbd { font-family: var(--f-mono); font-size: 0.88em; }
:not(pre) > code { background: var(--paper-2); border: 1px solid var(--rule); padding: 0.05em 0.3em; border-radius: 2px; hyphens: none; }
mark { background: var(--mark); color: inherit; padding: 0 0.1em; }
sup a { text-decoration: none; font-family: var(--f-display); font-size: 0.75em; font-weight: 500; padding: 0 0.1em; }

blockquote {
  margin: 0.5rem 0; padding-left: 1.5rem; position: relative;
  font-family: var(--f-body); font-size: var(--t-body); line-height: 1.65;
}
blockquote::before {
  content: ""; position: absolute; left: 0; top: 0.4rem; bottom: 0.4rem; width: 3px; background: var(--brand-teal);
}
blockquote footer { font-family: var(--f-display); font-size: var(--t-sm); color: var(--ink-2); margin-top: 0.5rem; }

.callout { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; padding: 1rem 1.25rem; background: var(--wash-teal); }
.callout.key { background: var(--wash-yellow); }
.callout .ic { width: 1.1rem; height: 1.1rem; margin-top: 0.35rem; }
.callout .label { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.callout p { grid-column: 2; font-size: var(--t-sm); line-height: 1.6; min-width: 0; }

.codeblock { margin: 0.25rem 0; background: var(--code-bg); color: var(--code-fg); min-width: 0; }
.codeblock .cb-head { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 1rem; border-bottom: 1px solid #ffffff1a; font-family: var(--f-display); font-size: var(--t-xs); color: var(--code-dim); }
.codeblock .cb-head button { font: inherit; color: var(--code-dim); background: none; border: 1px solid #ffffff2a; padding: 0 0.5rem; cursor: pointer; }
.codeblock .cb-head button:hover { color: var(--code-fg); border-color: var(--code-fg); }
.codeblock pre { margin: 0; padding: 1rem; overflow-x: auto; font-family: var(--f-mono); font-size: 0.875rem; line-height: 1.65; tab-size: 2; hyphens: none; }
/* Prism tokens (from the syntax highlighting plugin) */
.codeblock .token.keyword, .codeblock .token.operator, .codeblock .token.important { color: var(--code-kw); }
.codeblock .token.string, .codeblock .token.char, .codeblock .token.regex, .codeblock .token.attr-value, .codeblock .token.parameter { color: var(--code-str); }
.codeblock .token.class-name, .codeblock .token.builtin, .codeblock .token.tag { color: var(--code-ty); }
.codeblock .token.number, .codeblock .token.boolean, .codeblock .token.constant { color: var(--code-num); }
.codeblock .token.comment, .codeblock .token.prolog, .codeblock .token.shebang { color: var(--code-dim); font-style: italic; }
.codeblock .token.function { color: #FFFFFF; font-weight: 500; }
/* Highlighted lines, zero-indexed: ```ts/0 (first line) or ```ts/2-4 */
.codeblock .highlight-line-active { display: inline-block; min-width: 100%; background: #F9D44822; box-shadow: inset 3px 0 0 var(--brand-yellow); margin-left: -1rem; padding-left: 1rem; margin-right: -1rem; padding-right: 1rem; }

figure.diagram { margin: 0.5rem 0; display: grid; gap: 0.6rem; }
figure.diagram .scroll { overflow-x: auto; border: 1px solid var(--rule); padding: 1rem; background: var(--paper); }
figure.diagram svg { display: block; width: 100%; min-width: 34rem; height: auto; }
figure.diagram figcaption, .table-wrap + p.cap { font-family: var(--f-display); font-size: var(--t-xs); color: var(--ink-2); line-height: 1.5; }
figure.diagram figcaption b { color: var(--ink); font-weight: 500; }
.dg-box { fill: var(--diagram-fill); stroke: var(--diagram-stroke); stroke-width: 1.5; }
.dg-focus { fill: var(--brand-yellow); stroke: var(--diagram-stroke); stroke-width: 1.5; }
.dg-ext { fill: var(--wash-teal); stroke: var(--brand-teal); stroke-width: 1.5; stroke-dasharray: 4 3; }
.dg-dec { fill: var(--brand-teal); stroke: var(--diagram-stroke); stroke-width: 1.5; }
.dg-line { stroke: var(--diagram-stroke); stroke-width: 1.5; fill: none; }
.dg-head { fill: var(--diagram-stroke); }
.dg-txt { font-family: var(--f-display); font-size: 13px; fill: var(--ink); }
.dg-txt.on-focus { fill: #1E1E1E; font-weight: 500; }
.dg-txt.on-dec { fill: #FFFFFF; font-weight: 500; }
.dg-small { font-family: var(--f-display); font-size: 11px; fill: var(--ink-2); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-family: var(--f-display); font-size: var(--t-sm); font-variant-numeric: tabular-nums; min-width: 30rem; }
th { text-align: left; font-weight: 500; font-size: var(--t-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); border-bottom: 2px solid var(--ink); padding: 0.5rem 0.75rem 0.5rem 0; }
td { border-bottom: 1px solid var(--rule); padding: 0.6rem 0.75rem 0.6rem 0; vertical-align: top; }
td.num, th.num { text-align: right; }

.footnotes { border-top: 1px solid var(--rule); padding-top: 1rem; font-size: var(--t-sm); color: var(--ink-2); line-height: 1.55; }
.footnotes ol { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.4rem; }
.footnotes li > p { display: inline; }

/* Post list */
.posts { list-style: none; margin-block: 0; padding: 0; display: grid; }
.posts li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.25rem 1.5rem; padding-block: 1.25rem; border-top: 1px solid var(--rule); }
.posts li:last-child { border-bottom: 1px solid var(--rule); }
.posts time { font-family: var(--f-display); font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; padding-top: 0.2rem; }
.posts .body { display: grid; gap: 0.4rem; min-width: 0; }
.posts h3 { font-size: var(--t-md); font-weight: 500; line-height: 1.25; }
.posts h3 a { color: var(--ink); text-decoration: none; }
.posts h3 a:hover { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; }
.posts p { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.55; }
h1, h2, h3, p, figure, blockquote { margin: 0; }

/* ---------- Page chrome shared by all pages ---------- */
.shell {
  max-width: 76rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  --indent: clamp(0rem, 8vw, 6rem);
}

/* Site header */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .shell { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 500; font-size: 1.0625rem; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand svg { width: 1.75rem; height: 1.75rem; flex: none; }
.site-nav { display: flex; align-items: center; gap: 0.25rem; font-family: var(--f-display); font-size: var(--t-sm); }
.site-nav a { color: var(--ink-2); text-decoration: none; padding: 0.4rem 0.7rem; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
.site-nav a[aria-current="page"] { color: var(--ink); }
/* Theme switch: three small icons, no frame. Inactive ones fade back; the current one sits on a light tint. */
.theme-switch { display: inline-flex; gap: 0.1rem; margin-left: 0.75rem; }
.theme-switch button {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: none; border: 0; color: var(--ink-2); opacity: 0.55; cursor: pointer; transition: opacity .15s;
}
.theme-switch button:hover { opacity: 1; }
.theme-switch button[aria-pressed="true"] { opacity: 1; color: var(--ink); background: var(--paper-2); }
.theme-switch svg { width: 0.8rem; height: 0.8rem; }
@media (prefers-reduced-motion: reduce) { .theme-switch button { transition: none; } }

/* Site footer */
.site-foot { border-top: 1px solid var(--rule); font-family: var(--f-display); font-size: var(--t-sm); color: var(--ink-2); }
.site-foot .shell { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; padding-block: 1.75rem 2.5rem; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-foot a { color: var(--ink-2); }
.site-foot a:hover { color: var(--ink); }
@media (max-width: 640px) {
  .brand .name-long { display: none; }
  .site-head .shell { gap: 0.5rem; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 0.4rem 0.45rem; white-space: nowrap; }
  .theme-switch { margin-left: 0.25rem; }
}

/* Article list entries (articles list, home page) */
.entries { list-style: none; margin: 0; padding: 0; display: grid; max-width: var(--measure); }
.entry { display: grid; gap: 0.35rem; padding-block: 1.25rem; border-top: 1px solid var(--rule); }
.entries .entry:last-child { border-bottom: 1px solid var(--rule); }
.entry h3 { font-size: var(--t-md); font-weight: 500; line-height: 1.25; }
.entry h3 a { color: var(--ink); text-decoration: none; }
.entry h3 a:hover { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; }
.entry p { font-size: 1rem; line-height: 1.55; color: var(--ink-2); max-width: 36rem; }
.entry .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; font-family: var(--f-display); font-size: var(--t-xs); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.entry .meta .dot { width: 0.3em; height: 0.3em; background: var(--ink-2); transform: rotate(45deg); }
