/* André Sabino's blog: the visual language of the IADE app family (iade-kit), adapted for
   reading. From the kit: black, white and neutral greys; blue only for interaction (links, focus, selection);
   a black header; square corners and 1px hairlines; no shadows or decoration; Lato; small uppercase captions
   with letter spacing; tabular figures. Changed for reading: larger text, looser lines, a narrow column; and a
   dark mode, which the kit does not have. The accent is the blog's own blue, not IADE's. */

/* Lato, served by the site (SIL Open Font License, vendor/fonts/lato/OFL.txt) */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/lato/lato-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/lato/lato-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/lato/lato-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/lato/lato-latin-ext-400-italic.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/lato/lato-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 700; font-display: swap; src: url("/fonts/lato/lato-latin-700-italic.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/lato/lato-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 700; font-display: swap; src: url("/fonts/lato/lato-latin-ext-700-italic.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 900; font-display: swap; src: url("/fonts/lato/lato-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 900; font-display: swap; src: url("/fonts/lato/lato-latin-900-italic.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 900; font-display: swap; src: url("/fonts/lato/lato-latin-ext-900-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lato"; font-style: italic; font-weight: 900; font-display: swap; src: url("/fonts/lato/lato-latin-ext-900-italic.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #ffffff;
  --text: #000000;
  --ink-2: #1e1e1e;
  --muted: #555555;
  --line: #d6d6d6;
  --surface-2: #f4f5f7;
  --link: #1a63c9;
  --link-visited: #1756a9;
  --accent-soft: #ecf3fd;
  --focus: #1a63c9;
  --header-bg: #000000;
  --header-text: #ffffff;
  --header-focus: #7db3f5;
  --code-bg: #f4f5f7;
  --sans: "Lato", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #ececec;
    --ink-2: #d6d6d6;
    --muted: #a3a3a3;
    --line: #333333;
    --surface-2: #1c1d20;
    --link: #7db3f5;
    --link-visited: #b49cf0;
    --accent-soft: #1a2a40;
    --focus: #7db3f5;
    --header-bg: #000000;
    --code-bg: #1c1d20;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font: 400 18px/1.65 var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
.wrapper { max-width: 760px; margin: 0 auto; padding: 0 28px; }

/* Header: black, 56px, the name in white; the only place with weight */
.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid var(--line); }
.site-header .wrapper { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; min-height: 56px; gap: 0 24px; }
.site-title, .site-title:visited { font-size: 20px; font-weight: 900; letter-spacing: 0.01em; color: var(--header-text); text-decoration: none; }
.site-nav { display: flex; gap: 22px; }
.site-nav a, .site-nav a:visited { color: var(--header-text); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; }
.site-nav a:hover, .site-title:hover { text-decoration: underline; text-underline-offset: 4px; }
.site-header :focus-visible { outline-color: var(--header-focus); }

/* Content */
.page-content { flex: 1; padding: 44px 0 40px; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 2px; }
a.footnote-ref, a.footnote-back { text-decoration: none; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; color: var(--text); }
p, ul, ol, pre, blockquote, table, dl { margin: 0 0 1.1em; }
img { max-width: 100%; height: auto; }
blockquote { margin-left: 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--text); color: var(--ink-2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
strong { font-weight: 700; }

/* Small uppercase captions (dates, labels) */
.post-meta, .toc-title, .series p, figcaption, .page-kicker {
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.post-meta { margin: 0; }
.post-meta a { text-transform: none; letter-spacing: 0; }

/* Tags: chips with a hairline border */
.tag, .tag:visited {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 2px;
  font-size: 12px; font-weight: 700; color: var(--ink-2); text-decoration: none; line-height: 1.5;
}
.tag:hover { background: var(--accent-soft); border-color: var(--link); color: var(--text); }

/* Post list: hairline rows */
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.post-list li { padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.post-list h3 { margin: 6px 0 0; }
.post-link { display: block; font-size: 24px; font-weight: 700; line-height: 1.25; text-decoration: none; }
.post-link:hover { text-decoration: underline; }

/* Search and pagination (the kit's field and tiny tabs) */
.search { margin: 0 0 28px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search input {
  width: 100%; max-width: 440px; height: 42px; padding: 0 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 0; background: var(--bg); color: var(--text);
}
.search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.pager { display: inline-flex; flex-wrap: wrap; margin-top: 24px; border: 1px solid var(--line); }
.pager:empty { display: none; }
.pager button {
  font: inherit; font-size: 13px; font-weight: 700; min-width: 36px; padding: 6px 10px; border: 0;
  background: var(--bg); color: var(--muted); cursor: pointer;
}
.pager button + button { border-left: 1px solid var(--line); }
.pager button:hover { background: var(--accent-soft); color: var(--text); }
.pager button[aria-current="page"] { background: var(--text); color: var(--bg); }

/* Listing pages */
.page-heading { font-size: 34px; font-weight: 900; letter-spacing: -0.01em; margin: 0 0 24px; }
.tag-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); text-decoration: none; font-weight: 700; color: var(--ink-2); }
.tag-list a:hover { background: var(--accent-soft); border-color: var(--link); }
.series-list li { margin-bottom: 8px; }

/* Post */
.post-header { margin-bottom: 32px; }
.post-title { font-size: 44px; font-weight: 900; letter-spacing: -0.015em; line-height: 1.1; margin: 0 0 12px; }
.post-content h1 { font-size: 30px; font-weight: 900; margin: 1.6em 0 0.5em; }
.post-content h2 { font-size: 26px; margin: 1.6em 0 0.5em; }
.post-content h3 { font-size: 20px; margin: 1.4em 0 0.4em; }
.post-content h4 { font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; margin: 1.4em 0 0.4em; }

/* Series and table of contents: flat panels */
.series, .toc { background: var(--surface-2); border: 1px solid var(--line); padding: 14px 18px; margin: 0 0 28px; font-size: 16px; }
.series p, .toc-title { margin: 0 0 8px; }
.series p a { text-transform: none; letter-spacing: 0; font-size: 14px; }
.series ol { margin: 0; padding-left: 22px; }
.series [aria-current] { font-weight: 700; }
.toc ul { margin: 0; padding-left: 20px; }
.toc ul ul { padding-left: 18px; }

/* Figures and diagrams */
figure { margin: 1.6em 0; text-align: center; }
figure.diagram svg { max-width: 100%; height: auto; }
.diagram-dark { display: none; }
figcaption { margin-top: 8px; font-weight: 700; }

/* Code */
code, pre { font-family: var(--mono); font-size: 0.82em; }
code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 2px; padding: 1px 5px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 0; padding: 12px 16px; overflow-x: auto; line-height: 1.5; }
pre code { border: 0; padding: 0; background: none; font-size: inherit; }
div.sourceCode { margin: 0 0 1.1em; background: none; }

/* Tables: hairlines, uppercase header captions */
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); border-top: 1px solid var(--line); }

/* Footnotes and references */
.footnotes { font-size: 15px; border-top: 1px solid var(--line); margin-top: 40px; padding-top: 8px; }
.footnotes hr { display: none; }
#refs { font-size: 16px; }
.csl-entry { margin-bottom: 8px; padding-left: 2em; text-indent: -2em; }

/* Navigation between posts */
.post-nav { display: flex; justify-content: space-between; gap: 20px; margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 16px; font-weight: 700; }
.post-nav a { text-decoration: none; }
.post-nav a:hover { text-decoration: underline; }
.post-nav .next { margin-left: auto; text-align: right; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; font-size: 14px; }
.social { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.social a { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; }
.social a:hover { text-decoration: underline; }
.license { color: var(--muted); margin: 12px 0 0; }
.license img { vertical-align: middle; margin-right: 2px; }

/* Focus, skip link, reduced motion */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; padding: 8px 12px; background: var(--bg); color: var(--text); z-index: 10; }
.skip:focus { left: 10px; top: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Small (iPhone) and medium (iPad) screens */
@media (max-width: 800px) {
  .post-content { overflow-wrap: break-word; }
  .post-content table { display: block; overflow-x: auto; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .wrapper { padding: 0 16px; }
  .site-header .wrapper { min-height: 52px; }
  .site-title { font-size: 18px; }
  .site-nav { gap: 16px; }
  .page-content { padding: 28px 0; }
  .post-title { font-size: 32px; }
  .post-link { font-size: 20px; }
  .page-heading { font-size: 28px; }
  .post-nav { flex-direction: column; }
  .post-nav .next { margin-left: 0; text-align: left; }
  .pager button { min-width: 44px; min-height: 44px; }
}

/* Dark mode: diagrams in their dark version; images with a white background (class light) on a light card;
   code colours for a dark background (.post-content outranks pandoc's highlighting styles) */
@media (prefers-color-scheme: dark) {
  .diagram-light { display: none; }
  .diagram-dark { display: block; }
  .post-content img.light { background: #fff; padding: 10px; }
  .license img { filter: invert(1); }
  .post-content code span.kw, .post-content code span.cf { color: #ff8f8f; }
  .post-content code span.dt, .post-content code span.bu { color: #8fd6ff; }
  .post-content code span.dv, .post-content code span.bn, .post-content code span.fl, .post-content code span.cn { color: #9fe0a8; }
  .post-content code span.st, .post-content code span.ch, .post-content code span.ss, .post-content code span.vs { color: #a8c8ff; }
  .post-content code span.co, .post-content code span.do, .post-content code span.an, .post-content code span.cv { color: #a3a3a3; }
  .post-content code span.fu { color: #e3b8ff; }
  .post-content code span.op, .post-content code span.va, .post-content code span.ot { color: #ececec; }
  .post-content code span.im, .post-content code span.pp, .post-content code span.at { color: #ffcf8f; }
  .post-content code span.al, .post-content code span.er { color: #ff8f8f; }
}

/* Print: only the post, in black on white */
@media print {
  .site-header, .site-footer, .post-nav, .search, .pager, .skip, .series ol { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .post-content a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
  pre, figure, img, table { break-inside: avoid; }
  .diagram-light { display: block !important; }
  .diagram-dark { display: none !important; }
  .wrapper { max-width: none; padding: 0; }
}
