/* Self-hosted fonts (SIL Open Font License), identical on every platform */
@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* Colours: light-dark(<light>, <dark>). Follows the system theme unless the
   reader picks one with the theme button (sets data-theme on <html>). */
:root {
  color-scheme: light dark;
  --text: light-dark(#2d271e, #cdd9e5);
  --muted: light-dark(#6d624f, #909dab);
  --bg: light-dark(#f6f2eb, #22272e);
  --accent: light-dark(#1d58bd, #539bf5);
  --border: light-dark(#e0d6c3, #373e47);
  --code-bg: light-dark(#ede5d4, #2d333b);
  /* Charts (notebook posts): categorical slots, ordinal ramp, chrome.
     Validated against --bg in both modes (CVD / contrast / ordinal checks). */
  --chart-1: light-dark(#2a78d6, #3987e5);
  --chart-2: light-dark(#eb6834, #d95926);
  --chart-3: light-dark(#1baf7a, #199e70);
  --chart-4: light-dark(#eda100, #c98500);
  --chart-5: light-dark(#e87ba4, #d55181);
  --chart-6: light-dark(#008300, #008300);
  --chart-7: light-dark(#4a3aa7, #9085e9);
  --chart-8: light-dark(#e34948, #e66767);
  --chart-ord-1: light-dark(#6da7ec, #9ec5f4);
  --chart-ord-2: light-dark(#2a78d6, #3987e5);
  --chart-ord-3: light-dark(#104281, #1c5cab);
  --chart-grid: light-dark(#e8dfcd, #2d333b);
  --chart-axis: light-dark(#cbbfa8, #444c56);
  --font: "Inter", sans-serif;
  --mono: "JetBrains Mono", monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
  font: 1.0625rem/1.7 var(--font);
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Typography */
h1, h2, h3, h4 { line-height: 1.3; margin: 2.2em 0 0.6em; letter-spacing: -0.015em; }
h1 { font-size: 2.1rem; margin-top: 0; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p, ul, ol, blockquote, pre, table, figure { margin: 0 0 1.25rem; }
time { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* Pills: small outlined buttons in the footer (RSS link, theme toggle) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.1rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.6;
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.pill:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }

/* Page header: title + date + breadcrumb */
.page-header { margin-bottom: 3rem; }
.page-header h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.2rem, 1.6rem + 2.5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}
/* Date · breadcrumb on one line */
.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.page-meta time::after { content: "·"; margin-left: 0.6rem; }
/* Breadcrumbs (partials/breadcrumbs.html): a single pill, like the footer's
   buttons, split into segments by chevron-shaped lines in the border colour */
.crumbs {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1.6;
}
.crumbs a { position: relative; padding: 0.1rem 0.6rem; color: var(--muted); }
.crumbs a:first-child { padding-left: 0.75rem; }
.crumbs a:last-child { padding-right: 0.75rem; }
.crumbs-sep { position: relative; display: block; flex: none; color: var(--border); }
/* A fixed width, not 100%: while sizing the pill, Firefox resolves a percentage
   width as the SVG default (300px), leaving a gap at the end of the pill */
.crumbs-sep svg { display: block; width: 0.45rem; height: 100%; }

/* Hover, like a pill button but per segment: the segment's text darkens and its
   outline turns --muted. The outline is drawn over the pill's border: the
   segment's top/bottom edges (+ the rounded end on the first/last segment), the
   chevrons beside it, and the strip of border under the chevron before it (the
   chevron meets the border at its left end, so that strip belongs to the
   segment on its right). */
.crumbs a::after, .crumbs-sep::after {
  content: "";
  position: absolute;
  inset: -1px 0;
  border-block: 1px solid transparent;
  pointer-events: none;
}
/* Corners as longhands: a single segment is both first and last child and must
   keep the rounding of both ends */
.crumbs a:first-child::after { left: -1px; border-left: 1px solid transparent; border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.crumbs a:last-child::after { right: -1px; border-right: 1px solid transparent; border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs a:hover::after,
.crumbs-sep:has(+ a:hover)::after { border-color: var(--muted); }
.crumbs a:hover + .crumbs-sep,
.crumbs-sep:has(+ a:hover) { color: var(--muted); }

/* End of article: previous/next post */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.post-nav a { color: var(--text); font-weight: 500; line-height: 1.4; }
.post-nav a:hover { color: var(--accent); text-decoration: none; }
.post-nav small { display: block; margin-bottom: 0.2rem; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.post-nav .next { grid-column: 2; text-align: right; }
/* Page selector under the previous/next links of paginated lists (partials/pager.html) */
.page-select { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.35rem; margin-top: 2rem; }
.page-select .pill { min-width: 2.1em; justify-content: center; font-variant-numeric: tabular-nums; }
.page-select [aria-current] { color: var(--text); border-color: var(--muted); font-weight: 600; cursor: default; }
.page-gap { color: var(--muted); font-size: 0.8rem; padding: 0 0.15rem; }


/* "Posts from Jan 05 to Aug 22, 2026": first line of a list page after the first */
.page-range { margin: -1rem 0 2.5rem; color: var(--muted); font-size: 0.9rem; }

/* Home: feed of the latest posts, each one its title, date and summary */
.feed-item + .feed-item { margin-top: 3rem; padding-top: 3rem; border-top: 1px solid var(--border); }
.feed-item h2 { margin: 0 0 0.25rem; font-size: 1.6rem; }
.feed-item h2 a { color: var(--text); }
.feed-item h2 a:hover { color: var(--accent); text-decoration: none; }
.feed-meta { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9rem; }
.continue { font-weight: 500; }

/* Languages: a post listed in a site of another language is marked with the
   code of the language it is written in ("· ES") */
.lang-mark { color: var(--muted); font-weight: 400; }
/* A post shown in a site of another language: "This post is only available in English." */
.lang-notice { margin: -1.5rem 0 2rem; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.lang-mark::before { content: "·"; margin: 0 0.5rem; }
.post-list .lang-mark { font-size: 0.85rem; }

/* All posts: compact list, title and date */
.post-list { list-style: none; padding: 0; margin-bottom: 1.5rem; }
.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list a { color: var(--text); font-weight: 500; }
.post-list time { flex-shrink: 0; }

/* Footer: copyright on the left, RSS + theme pills on the right, one line */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 4.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.footer-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Article */
article img { max-width: 100%; height: auto; border-radius: 6px; }
blockquote {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* Code */
code, pre { font-family: var(--mono); font-size: 0.875em; }
:not(pre) > code { padding: 0.15em 0.35em; background: var(--code-bg); border-radius: 4px; }
pre {
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.5;
  background: var(--code-bg);
  border-radius: 6px;
  /* Outdent into the body's side padding, which the block's own padding then
     fills back: the code text starts flush with the prose while the block
     gains 1.25rem on each side, enough for 75 columns without scrolling. */
  margin-left: -1.25rem;
  margin-right: -1.25rem;
}
/* On narrow screens the outdented block reaches the viewport edges. */
@media (max-width: 42rem) { pre { border-radius: 0; } }

/* Highlighted blocks: keep the theme's token colours, use our neutral background */
pre.giallo { background-color: var(--code-bg) !important; color-scheme: inherit !important; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }

/* Notebook posts (generated from marimo by scripts/marimo2zola.py) */
.page-meta .nb-code-toggle { margin-left: auto; }
.nb-code-toggle[hidden] { display: none; }
.nb-cell { margin: 0 0 1.75rem; }
.nb-input pre { margin: 0; }
/* Collapsible code: an arrow + "Hide code" / "Show code" (the cell's title is in the tooltip) */
.nb-code > summary {
  display: flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 0.5em;
  color: var(--muted);
  font: 0.75rem/1.6rem var(--font);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nb-code > summary::-webkit-details-marker { display: none; }
.nb-code[open] .nb-show, .nb-code:not([open]) .nb-hide { display: none; }
.nb-code > summary::before {
  content: "";
  flex-shrink: 0;
  width: 0.4em;
  height: 0.4em;
  border-right: 1.5px solid;
  border-bottom: 1.5px solid;
  transform: translateX(-0.1em) rotate(-45deg);
  transition: transform 0.15s;
}
.nb-code[open] > summary::before { transform: translateY(-0.1em) rotate(45deg); }
.nb-code > summary:hover { color: var(--text); }
.nb-code[open] > summary { margin-bottom: 0.25rem; }
@media (prefers-reduced-motion: reduce) { .nb-code > summary::before { transition: none; } }
.nb-output {
  margin-top: 0.75rem;
  overflow-x: auto;
}
.nb-output > :last-child { margin-bottom: 0; }
.nb-output pre { background: none; padding: 0.25rem 0; }
.nb-error { color: light-dark(#b42318, #f47067); }
.nb-output table.dataframe { width: auto; margin: 0 auto; border: 0; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.nb-output table.dataframe th, .nb-output table.dataframe td {
  padding: 0.3rem 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
.nb-output table.dataframe thead th { color: var(--muted); font-weight: 500; }
.nb-output table.dataframe tbody th { color: var(--muted); font-weight: 400; }
.nb-chart { padding: 0.25rem 0; }
/* KeyNumbers (notebooks/blogkit.py): stat tiles */
.nb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin: 0.25rem 0; }
.nb-stats > div { padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 6px; }
.nb-stats dt { color: var(--muted); font-size: 0.8rem; }
.nb-stats dd { margin: 0.1rem 0 0; font-size: 1.6rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.nb-stats small { color: var(--muted); font-size: 0.8rem; }
/* Charts and tables sit centred in the output column */
.nb-chart .nb-chart-view { display: block; width: 100%; }
.nb-chart-view svg { display: block; max-width: 100%; margin: 0 auto; }
#vg-tooltip-element.custom-theme {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: 0.8rem/1.5 var(--font);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}
#vg-tooltip-element.custom-theme td.key { color: var(--muted); padding-right: 0.75rem; }
#vg-tooltip-element.custom-theme td.value { font-variant-numeric: tabular-nums; }

@media (max-width: 480px) {
  .post-list li { flex-direction: column; gap: 0; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: auto; }
}
