/* Minimal editorial style: warm grey page, one column, floating dock. */

/* Inter, self-hosted (SIL Open Font License, see fonts/Inter-LICENSE.txt).  The Latin subset
   covers English, Icelandic and Swedish; Japanese uses the system font. */
@font-face {
  font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter Variable"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #eeede9;
  --fg: #111110;
  --body: #4b4a47;
  --muted: #6f6d68;
  --line: #d9d7d1;
  --hover: rgba(0, 0, 0, .045);
  --pill-line: #d3d1ca;
  --pill-on-bg: #111110;
  --pill-on-fg: #f6f5f2;
  --code-bg: rgba(0, 0, 0, .05);
  --dock-bg: rgba(248, 247, 244, .78);
  --dock-bg-open: rgba(251, 250, 248, .97);
  --dock-line: rgba(0, 0, 0, .09);
  --accent: #1d5fa6;
  --syn-keyword: #7a3e9d;  --syn-function: #1d5fa6;  --syn-variable: #8a4b08;
  --syn-string: #2a6e3f;   --syn-type: #0e6b73;      --syn-builtin: #b03a2e;
  --syn-constant: #8a5a00; --syn-comment: #77756f;
  --sans: "Inter Variable", "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141414;
  --fg: #f3f2ef;
  --body: #bcbab5;
  --muted: #8e8c87;
  --line: #2c2c2a;
  --hover: rgba(255, 255, 255, .055);
  --pill-line: #3b3b38;
  --pill-on-bg: #f3f2ef;
  --pill-on-fg: #141414;
  --code-bg: rgba(255, 255, 255, .06);
  --dock-bg: rgba(30, 30, 29, .78);
  --dock-bg-open: rgba(32, 32, 31, .97);
  --dock-line: rgba(255, 255, 255, .1);
  --accent: #7db4ee;
  --syn-keyword: #c9a0f0;  --syn-function: #7db4ee;  --syn-variable: #e5b17a;
  --syn-string: #8fd19e;   --syn-type: #6fd0d8;      --syn-builtin: #f0928a;
  --syn-constant: #e3b86a; --syn-comment: #8e8c87;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --fg: #f3f2ef;
    --body: #bcbab5;
    --muted: #8e8c87;
    --line: #2c2c2a;
    --hover: rgba(255, 255, 255, .055);
    --pill-line: #3b3b38;
    --pill-on-bg: #f3f2ef;
    --pill-on-fg: #141414;
    --code-bg: rgba(255, 255, 255, .06);
    --dock-bg: rgba(30, 30, 29, .78);
    --dock-bg-open: rgba(32, 32, 31, .97);
    --dock-line: rgba(255, 255, 255, .1);
    --accent: #7db4ee;
    --syn-keyword: #c9a0f0;  --syn-function: #7db4ee;  --syn-variable: #e5b17a;
    --syn-string: #8fd19e;   --syn-type: #6fd0d8;      --syn-builtin: #f0928a;
    --syn-constant: #e3b86a; --syn-comment: #8e8c87;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0 auto;
  padding: 6rem 1.25rem 9rem;
  max-width: 50rem;
  background: var(--bg);
  color: var(--body);
  font: 1.0625rem/1.72 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
@view-transition { navigation: auto; }

a { color: var(--fg); text-decoration-color: var(--line); text-underline-offset: .2em; transition: text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }
::selection { background: var(--fg); color: var(--bg); }

/* ---- headings ---- */
h1.title { margin: 0 0 .5rem; color: var(--fg); font-size: 1.65rem; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
h2, h3, h4 { color: var(--fg); font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; line-height: 1.35; margin: 2.8rem 0 .7rem; scroll-margin-top: 2rem; }
h3 { font-size: 1.1rem; margin: 2.1rem 0 .5rem; }
strong, b { color: var(--fg); font-weight: 600; }

/* ---- post header ---- */
.hero { margin: 0 0 2rem; }
.hero img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 14px; }
.post-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin: 0 0 2.2rem; font-size: .9rem; color: var(--muted);
}
.post-meta .when { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .1rem .55rem; }
.post-meta .sep-dot { opacity: .6; }
.author { display: inline-flex; align-items: center; gap: .55rem; }
.avatar {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--fg); color: var(--bg); font-size: .62rem; font-weight: 600; letter-spacing: .02em;
}

/* ---- body ---- */
#content p { margin: 0 0 1.15rem; }
#content > ul:not(.post-list), #content > ol, .outline-2 ul, .outline-2 ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
#content > ul:not(.post-list) li, #content > ol li, .outline-2 li { margin-bottom: .35rem; }
img { max-width: 100%; height: auto; }
figure { margin: 2rem auto; text-align: center; }
figure img { border-radius: 12px; max-width: min(100%, 20rem); }
/* Diagrams (SVG) fill the column; photos and covers keep the narrower cap above. */
figure img[src$=".svg"] { width: 100%; max-width: 100%; height: auto; }
figcaption { margin-top: .6rem; color: var(--muted); font-size: .9rem; }
code, pre, kbd { font-family: var(--mono); font-size: .86em; }
code { background: var(--code-bg); padding: .12em .38em; border-radius: 5px; color: var(--fg); }
pre { background: var(--code-bg); padding: 1rem 1.15rem; border-radius: 12px; overflow-x: auto; margin: 1.4rem 0; line-height: 1.6; }
pre code { background: none; padding: 0; color: inherit; }
pre.example { border-left: 2px solid var(--fg); border-radius: 4px 12px 12px 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* copy button on code blocks: appears on hover/focus, always visible on touch screens */
.org-src-container { position: relative; }
.copy-btn {
  position: absolute; top: .55rem; right: .55rem; padding: .32rem .6rem; border-radius: 8px; cursor: pointer;
  font: 500 .72rem/1 var(--sans); color: var(--muted); background: var(--bg); border: 1px solid var(--line);
  opacity: 0; transition: opacity .15s, color .15s, border-color .15s;
}
.org-src-container:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.is-done { opacity: 1; }
.copy-btn:hover { color: var(--fg); border-color: var(--fg); }
.copy-btn.is-done { color: var(--fg); }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* syntax highlighting: htmlize writes one class per Emacs face, prefixed "org-" */
.org-keyword { color: var(--syn-keyword); }
.org-function-name { color: var(--syn-function); }
.org-variable-name, .org-preprocessor { color: var(--syn-variable); }
.org-string { color: var(--syn-string); }
.org-type { color: var(--syn-type); }
.org-builtin, .org-warning { color: var(--syn-builtin); }
.org-constant { color: var(--syn-constant); }
.org-comment, .org-comment-delimiter, .org-doc { color: var(--syn-comment); font-style: italic; }
.org-org-level-1, .org-org-level-2, .org-org-level-3 { color: var(--accent); font-weight: 600; }
.org-org-meta-line, .org-org-document-info-keyword { color: var(--syn-comment); }

/* ---- more Org output: tables, quotes, footnotes, task lists, TODOs, callouts ---- */
table { border-collapse: collapse; margin: 1.6rem 0; font-size: .95rem; width: 100%; }
@media (max-width: 34rem) { #content table { display: block; overflow-x: auto; } }
th, td { padding: .5rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--fg); font-weight: 600; text-align: left; border-bottom-color: var(--fg); }
td.org-right, th.org-right { text-align: right; }
td.org-center, th.org-center { text-align: center; }
caption, .t-above { caption-side: top; text-align: left; padding: 0 .85rem .6rem; color: var(--muted); font-size: .9rem; }
blockquote { margin: 1.6rem 0; padding: .1rem 0 .1rem 1.1rem; border-left: 2px solid var(--line); color: var(--muted); font-style: italic; }
blockquote p { margin: 0 0 .7rem; }
.verse { margin: 1.4rem 0; padding-left: 1.1rem; border-left: 2px solid var(--line); }
.org-center { text-align: center; margin: 1.4rem 0; }
dl { margin: 0 0 1.2rem; }
dt { color: var(--fg); font-weight: 600; margin-top: .6rem; }
dd { margin: .1rem 0 .4rem 1.3rem; }
details { margin: 1.2rem 0; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 12px; }
summary { cursor: pointer; color: var(--fg); font-weight: 500; }
mark { background: var(--code-bg); color: var(--fg); padding: .05em .25em; border-radius: 4px; }
.underline { text-decoration: underline; text-underline-offset: .2em; }
h4, h5, h6 { color: var(--fg); font-weight: 600; margin: 1.6rem 0 .4rem; }
h4 { font-size: 1rem; } h5, h6 { font-size: .95rem; }
h4, h5, h6 { scroll-margin-top: 2rem; }

/* [ ] and [X] items */
li.on > code:first-child, li.off > code:first-child, li.trans > code:first-child {
  background: none; padding: 0; color: var(--muted); font-size: .8em;
}
ul > li.on, ul > li.off, ul > li.trans { list-style: none; margin-left: -1.1rem; }
li.on { color: var(--muted); }

/* TODO / DONE keywords and heading tags */
.todo, .done { font: 600 .62em/1 var(--mono); padding: .3em .5em; border-radius: 6px; margin-right: .5em; vertical-align: .12em; letter-spacing: .02em; }
.todo { background: var(--fg); color: var(--bg); }
.done { background: var(--code-bg); color: var(--muted); }
.tag { margin-left: .6rem; font-weight: 400; }
.tag span { font: .62em/1 var(--mono); padding: .3em .55em; border: 1px solid var(--pill-line); border-radius: 999px; color: var(--muted); margin-right: .3rem; vertical-align: .1em; }
.timestamp-wrapper, .timestamp { color: var(--muted); font-size: .92em; }

/* footnotes */
#footnotes { margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .93rem; }
#footnotes h2.footnotes { font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 .8rem; }
.footdef { display: flex; gap: .6rem; margin-bottom: .5rem; }
.footdef sup { flex: none; line-height: 1.7; }
.footdef p { margin: 0; }
.footnum, .footref { text-decoration: none; color: var(--accent); }
sup .footref, sup > a { padding: 0 .1em; }
:target { scroll-margin-top: 2rem; }

/* special blocks: #+begin_note / tip / warning / important / caution */
.note, .tip, .warning, .important, .caution {
  margin: 1.5rem 0; padding: .9rem 1.1rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--hover); border-left: 3px solid var(--fg);
}
.note > :last-child, .tip > :last-child, .warning > :last-child, .important > :last-child, .caution > :last-child { margin-bottom: 0; }
.warning, .caution { border-left-color: var(--syn-builtin); }
.tip { border-left-color: var(--syn-string); }
.important { border-left-color: var(--syn-keyword); }
.note { border-left-color: var(--accent); }
.note::before, .tip::before, .warning::before, .important::before, .caution::before {
  display: block; margin-bottom: .3rem; font: 600 .7rem/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.note::before { content: "Note"; } .tip::before { content: "Tip"; } .warning::before { content: "Warning"; }
.important::before { content: "Important"; } .caution::before { content: "Caution"; }

/* ---- heading anchors ---- */
a.anchor {
  margin-left: .45rem; text-decoration: none; color: var(--muted); font-weight: 400;
  opacity: 0; transition: opacity .15s, color .15s;
}
a.anchor::before { content: "#"; }
a.anchor.is-done::before { content: "\2713"; }
h2:hover > a.anchor, h3:hover > a.anchor, h4:hover > a.anchor, h5:hover > a.anchor, h6:hover > a.anchor,
a.anchor:focus-visible, a.anchor.is-done { opacity: 1; }
a.anchor:hover { color: var(--fg); }
@media (hover: none) { a.anchor { opacity: .35; } }

/* ---- archive, tags, and the end of a post ---- */
.subnav { display: flex; gap: 1.2rem; margin: 0 0 1.8rem; font-size: .92rem; }
.subnav a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: .1rem; transition: color .15s, border-color .15s; }
.subnav a:hover { color: var(--fg); border-color: var(--fg); }
.list-head + section h2, .list-head + section + section h2 { margin-top: 2.2rem; }
#content section > h2 { margin: 2.4rem 0 .5rem; }
#content section:first-of-type > h2 { margin-top: 0; }
h2[data-count]::after { content: attr(data-count); margin-left: .6rem; font: .62em/1 var(--mono); padding: .3em .55em; border: 1px solid var(--pill-line); border-radius: 999px; color: var(--muted); vertical-align: .12em; }
.archive-list { list-style: none; margin: 0 0 0 -.75rem; padding: 0; max-width: 32.5rem; }
.archive-list li { margin: 0; }
.archive-list a { display: block; padding: .55rem .75rem; border-radius: 10px; text-decoration: none; color: var(--fg); transition: background-color .18s; }
.archive-list a:hover, .archive-list a:focus-visible { background: var(--hover); outline: none; }
.archive-list .t { display: block; line-height: 1.4; }
.archive-list time { display: block; margin-top: .15rem; font-size: .9rem; color: var(--muted); }

.post-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin: 3rem 0 0; }
.post-tags a {
  font: .78rem/1 var(--mono); padding: .5rem .85rem; border-radius: 999px; text-decoration: none;
  color: var(--body); border: 1px solid var(--pill-line); transition: border-color .15s, color .15s;
}
.post-tags a:hover { border-color: var(--fg); color: var(--fg); }
.related { margin-top: 2.4rem; }
.related h2 { font: 600 .72rem/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 .6rem; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.4rem; }
.post-nav a {
  display: flex; flex-direction: column; gap: .3rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--fg); transition: border-color .15s, background-color .15s;
}
.post-nav a:hover { border-color: var(--fg); background: var(--hover); }
.post-nav span { font-size: .8rem; color: var(--muted); }
.post-nav b { font-weight: 500; line-height: 1.35; }
.post-nav .newer { text-align: right; grid-column: 2; }
.post-nav .older { grid-column: 1; }
@media (max-width: 34rem) { .post-nav { grid-template-columns: 1fr; } .post-nav .newer, .post-nav .older { grid-column: 1; text-align: left; } }

/* skip link: hidden until a keyboard user tabs to it */
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 50; padding: .6rem 1rem; border-radius: 10px;
  background: var(--fg); color: var(--bg); text-decoration: none; font-size: .9rem; font-weight: 500;
  transition: top .15s;
}
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.comments { margin-top: 3rem; min-height: 2rem; }
.comments .giscus, .comments .giscus-frame { width: 100%; }

/* ---- end of post ---- */
.endnav {
  display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.3rem;
  border-top: 1px solid var(--line); font-size: .92rem;
}
.endnav a { color: var(--body); text-decoration: none; transition: color .15s; }
.endnav a:hover { color: var(--fg); }
.colophon { margin: 2.5rem 0 0; color: var(--muted); font-size: .8rem; }

/* ---- posts index ---- */
.list-head .title { margin-bottom: .45rem; }
#content .lede { margin: 0 0 1.6rem; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.pill {
  font: .78rem/1 var(--mono); padding: .5rem .85rem; border-radius: 999px; cursor: pointer;
  color: var(--body); background: transparent; border: 1px solid var(--pill-line);
  transition: background-color .15s, color .15s, border-color .15s, transform .15s;
}
.pill:hover { border-color: var(--fg); }
.pill:active { transform: scale(.96); }
.pill.is-active { background: var(--pill-on-bg); color: var(--pill-on-fg); border-color: var(--pill-on-bg); }

.post-list { list-style: none; margin: 0 0 0 -.75rem; padding: 0; max-width: 32.5rem; }
.post-list li { position: relative; margin: 0; }
.post-list a {
  display: block; padding: .55rem .75rem; border-radius: 10px; text-decoration: none; color: var(--fg);
  transition: background-color .18s;
}
.post-list a:hover, .post-list a:focus-visible { background: var(--hover); outline: none; }
.post-list .t { display: block; line-height: 1.4; }
.post-list time { display: block; margin-top: .15rem; font-size: .9rem; color: var(--muted); }
.post-list .preview {
  position: absolute; top: 0; left: calc(100% + 1.1rem); width: 17rem; aspect-ratio: 1.8;
  object-fit: cover; border-radius: 14px; pointer-events: none;
  opacity: 0; transform: translateY(4px) scale(.97); transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.post-list li:hover .preview, .post-list li:focus-within .preview { opacity: 1; transform: none; }
.empty { color: var(--muted); }

/* ---- floating dock ---- */
.bottom-fade {
  position: fixed; inset: auto 0 0 0; height: 5.5rem; z-index: 10; pointer-events: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 70%);
  mask-image: linear-gradient(to bottom, transparent, #000 70%);
}
.dock {
  position: fixed; left: 50%; bottom: 1.1rem; z-index: 20; translate: -50% 0;
  display: flex; flex-direction: column; max-width: calc(100vw - 1.5rem); padding: .4rem;
  background: var(--dock-bg); border: 1px solid var(--dock-line); border-radius: 1.5rem;
  transition: width .5s cubic-bezier(.32, .72, 0, 1), background-color .3s;
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .1); font-size: .85rem; color: var(--fg);
  view-transition-name: dock;
  animation: dock-in .6s cubic-bezier(.34, 1.4, .64, 1) .15s both;
}
.dock-row { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.dock.toc-open { width: min(38rem, calc(100vw - 1.5rem)); background: var(--dock-bg-open); }
.dock a, .dock button {
  display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 0; padding: 0;
  background: transparent; color: var(--body); cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s, transform .15s;
}
.dock a:hover, .dock button:hover { background: var(--hover); color: var(--fg); }
.dock a:active, .dock button:active { transform: scale(.9); }
.dock .sep { width: 1px; height: 1.2rem; background: var(--line); margin: 0 .15rem; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline-flex; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline-flex; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.dock-search, #search-open, .dock .dock-section { display: none; }
.dock.searching .dock-search { display: block; width: 17rem; }
.dock.searching .dock-search label {
  display: flex; align-items: center; gap: .55rem; height: 2.2rem; padding: 0 .7rem 0 .8rem;
  background: var(--hover); border-radius: 999px; cursor: text;
}
.dock.reading:not(.searching) .dock-section {
  display: flex; align-items: center; gap: .55rem; width: auto; height: 2.2rem; padding: 0 .7rem 0 .8rem;
  border-radius: 999px; min-width: 0; max-width: 21rem; font: inherit; font-weight: 500; color: var(--fg); text-align: left;
}
.dock.reading.toc-open:not(.searching) .dock-section { flex: 1; max-width: none; }
.dock.reading:not(.searching) #search-open { display: grid; }
.dock-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit;
  -webkit-appearance: none; appearance: none;
}
.dock-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.dock-search input::placeholder { color: var(--muted); }
.dock-search kbd {
  font: .68rem/1 var(--mono); padding: .22rem .38rem; border-radius: 5px; color: var(--muted); background: var(--hover); white-space: nowrap;
}
.dock a.dock-text { width: auto; display: flex; align-items: center; gap: .45rem; padding: 0 .85rem 0 .7rem; border-radius: 999px; font-weight: 500; }
.dock a.dock-text:hover { background: var(--hover); }

/* search results pop up above the dock */
.results {
  position: absolute; bottom: calc(100% + .9rem); left: 50%; translate: -50% 0;
  width: min(30rem, calc(100vw - 1.5rem)); max-height: min(22rem, 55vh); overflow-y: auto;
  list-style: none; margin: 0; padding: .35rem;
  background: var(--dock-bg); border: 1px solid var(--dock-line); border-radius: 18px;
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12); animation: rise .18s ease-out both;
}
.results li { margin: 0; }
.dock .results a, .results .none {
  display: block; width: auto; height: auto; place-items: normal; text-align: left;
  padding: .6rem .8rem; border-radius: 12px; text-decoration: none; color: var(--fg); line-height: 1.4;
}
.results .none { color: var(--muted); }
.dock .results li.is-active a, .dock .results a:hover { background: var(--hover); }
.results .r-title { display: block; font-weight: 500; }
.results .r-snip { display: block; margin-top: .15rem; font-size: .84rem; color: var(--muted); }
.results mark { background: none; color: var(--fg); font-weight: 600; text-decoration: underline; text-underline-offset: .15em; }
.dock-section .dot { width: .4rem; height: .4rem; border-radius: 50%; background: var(--fg); flex: none; }
#dock-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring { flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2.4; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke: var(--fg); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* table of contents: the dock grows upward into a panel */
.toc-panel {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .5s cubic-bezier(.32, .72, 0, 1), opacity .3s ease;
}
.dock.toc-open .toc-panel { grid-template-rows: 1fr; opacity: 1; }
.toc-clip { min-height: 0; overflow: hidden; }
.toc-head {
  margin: 0; padding: .75rem .85rem .4rem; font: 600 .68rem/1 var(--sans);
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.toc-list {
  list-style: none; margin: 0; padding: 0 .2rem .45rem; max-height: min(21rem, 50vh);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.toc-list li { margin: 0; }
.dock .toc-list button {
  display: block; width: 100%; height: auto; place-items: normal; text-align: left;
  padding: .55rem .65rem; border-radius: 10px; font: inherit; font-size: .88rem; line-height: 1.35; color: var(--muted);
}
.dock .toc-list .l3 button { padding-left: 1.6rem; }
.dock .toc-list button:hover { background: var(--hover); color: var(--fg); }
.dock .toc-list li.is-active button { background: var(--hover); color: var(--fg); font-weight: 500; }
h3 { scroll-margin-top: 2rem; }

/* language dropdown */
.lang { position: relative; display: flex; }
.dock .lang > button {
  width: auto; display: flex; align-items: center; gap: .4rem; padding: 0 .75rem 0 .65rem;
  border-radius: 999px; font: inherit; font-size: .78rem; font-weight: 600; letter-spacing: .03em; color: var(--body);
}
.lang-menu {
  position: absolute; bottom: calc(100% + 1rem); right: 0; min-width: 11rem;
  list-style: none; margin: 0; padding: .35rem;
  background: var(--dock-bg-open); border: 1px solid var(--dock-line); border-radius: 18px;
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12); animation: rise .18s ease-out both;
}
.lang-menu li { margin: 0; }
.dock .lang-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: auto; height: auto; place-items: normal; padding: .6rem .8rem; border-radius: 12px;
  text-decoration: none; color: var(--fg); font-size: .92rem; line-height: 1.3;
}
.dock .lang-menu a:hover { background: var(--hover); }
.dock .lang-menu a[aria-current="true"] { font-weight: 600; }
.lang-menu a[aria-current="true"]::after { content: "\2713"; color: var(--muted); }

/* ---- motion ---- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes dock-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
#preamble > *, .list-head, .pills, .post-list li, #content > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.pills { animation-delay: .05s; }
.post-list li:nth-child(1) { animation-delay: .08s; }  .post-list li:nth-child(2) { animation-delay: .12s; }
.post-list li:nth-child(3) { animation-delay: .16s; }  .post-list li:nth-child(4) { animation-delay: .20s; }
.post-list li:nth-child(5) { animation-delay: .24s; }  .post-list li:nth-child(n+6) { animation-delay: .28s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 52rem) { .post-list .preview { display: none; } }
@media (max-width: 34rem) {
  body { padding-top: 3.5rem; font-size: 1rem; }
  h1.title { font-size: 1.45rem; }
  .post-list { margin-left: -.5rem; }
  .dock.searching .dock-search { width: 10.5rem; }
  .dock-search kbd { display: none; }
  .dock.reading:not(.searching) .dock-section { max-width: 9.5rem; }
  .dock.reading.toc-open:not(.searching) #search-open { display: none; }
  .dock a.dock-text span { display: none; }
  .dock a.dock-text { padding: 0; width: 2.2rem; justify-content: center; }
}

/* ---- printing: just the text ---- */
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --fg: #000; --body: #222; --muted: #555; --line: #bbb; --code-bg: #f1f1f1; }
  body { padding: 0; max-width: none; font-size: 11pt; background: #fff; color: #222; }
  .dock, .bottom-fade, .skip-link, .copy-btn, a.anchor, .post-nav, .related, .post-tags, .endnav, .subnav, .comments { display: none !important; }
  #content > *, #preamble > *, .list-head { animation: none !important; }
  .hero img { border-radius: 0; max-height: 9cm; }
  a { color: #000; text-decoration: underline; }
  #content a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; word-break: break-all; }
  pre { border: 1px solid #ccc; white-space: pre-wrap; background: #fff; }
  h2, h3, h4, figure, table, pre { break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; }
}
