/* polybulle.net — sans throughout (mono only in code), one loud colour, light and dark. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

:root {
  color-scheme: light dark;
  --bg: #fbfcfe;
  --ink: #141821;
  --muted: #687088;
  --faint: #e3e9f7;
  --accent: #1a4fd6;      /* resume blue (cv.typ): links, name, marks, quotes */
  --mark: #d4ff3a;        /* acid lime: hover, selection, highlights */
  --mark-ink: #141821;
  --code-bg: #eef2fb;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f121a;
    --ink: #e7eaf3;
    --muted: #8a93aa;
    --faint: #252b3a;
    --accent: #6f97ff;
    --mark: #d4ff3a;
    --mark-ink: #0f121a;
    --code-bg: #181d29;
  }
}

::selection { background: var(--mark); color: var(--mark-ink); }

body {
  margin: 0 auto;
  max-width: 40em;
  padding: 2rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; }
/* Section anchors (templates/anchor-link.html): a "#" hanging in the left gutter, linking to the heading */
.zola-anchor {
  position: absolute; /* stays at its static spot, then shifts left of the title by its own width */
  transform: translateX(calc(-100% - 0.6rem));
  color: var(--accent);
  font-weight: 400;
  text-decoration: none;
}
.zola-anchor:hover { background: var(--mark); color: var(--mark-ink); }
h2, h3, h4 { scroll-margin-top: 1rem; }
@media (max-width: 44em) {
  .zola-anchor { position: static; transform: none; margin-right: 0.6rem; }
}

p, ul, ol, blockquote, pre, figure, table { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.18em;
}
a:hover { background: var(--mark); color: var(--mark-ink); text-decoration: none; }

/* Masthead: ~/polybulle on the left, links on the right. No rule under it. */
#mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3.5rem;
  font-size: 0.95rem;
}
#mast .name { font-family: var(--mono); font-size: 1.6rem; font-weight: 400; color: var(--ink); text-decoration: none; }
#mast .name::before { content: "~/"; color: var(--accent); }
#mast .name:hover { background: none; color: var(--ink); }
#mast nav a { margin-left: 1.4em; color: var(--muted); text-decoration: none; }

/* Post list: ISO date, then the title */
.index { list-style: none; padding: 0; }
.index li { margin: 0 0 1.6rem; }
.index time { display: block; font-size: 0.8rem; color: var(--muted); }
.index a { font-size: 1.2rem; font-weight: 600; text-decoration: none; }
.index p { margin: 0.15rem 0 0; color: var(--muted); }
.index .empty { color: var(--muted); }

/* Post */
.meta { margin: 0 0 2.2rem; font-size: 0.82rem; color: var(--muted); }
blockquote {
  margin-left: 0;
  padding-left: 1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
mark { background: var(--mark); color: var(--mark-ink); padding: 0 0.15em; }
img, video { max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: 6px; }
figure { text-align: center; }
figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.5rem; }
hr { border: 0; text-align: center; margin: 2.5rem 0; }
hr::after { content: "* * *"; color: var(--muted); }
strong { font-weight: 650; }

/* Code: Giallo emits inline light-dark() colours; we set the box */
code { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre {
  padding: 1em 1.1em;
  overflow-x: auto;
  border-radius: 8px;
  line-height: 1.5;
  background: var(--code-bg) !important;
}
pre span { text-decoration: none !important; } /* the GitHub themes underline parameters; noise */
.giallo-l { display: inline-block; min-height: 1lh; width: 100%; }
.giallo-ln { display: inline-block; user-select: none; margin-right: 0.4em; padding: 0.4em; min-width: 3ch; text-align: right; opacity: 0.8; }

/* Footnotes.
   Base (no JS, reader mode, print): Zola's bottom list, [n] down and ↩ back.
   With notes.js (html.sn): each note is cloned into an <aside class="sidenote"> after its
   reference and the bottom list is hidden. Wide screens float the aside into the right
   margin (Tufte); narrow screens make it a popover under the reference.
   notes.js reads `position` to tell the two modes apart, so keep that distinction here. */
.footnote-reference { line-height: 0; }
.footnote-reference a { text-decoration: none; font-size: 0.72em; font-weight: 700; padding: 0 0.15em; border-radius: 3px; }
.footnotes { font-size: 0.9rem; } /* Zola puts an <hr> before this section */
.footnotes ol { padding-left: 1.4em; }
.footnotes li:target { background: var(--code-bg); }

.sn .footnotes, .sn hr:has(+ .footnotes) { display: none; }
article { position: relative; }

.sidenote { font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.sidenote p { margin: 0 0 0.5em; display: inline; }
.sidenote p + p { display: block; margin-top: 0.5em; }
.sn-n { font-size: 0.85em; font-weight: 700; color: var(--accent); margin-right: 0.5em; }

/* Narrow: popover under the reference, as wide as its text (capped), placed by notes.js */
.sidenote {
  display: none;
  position: absolute;
  width: max-content;
  max-width: min(100%, 24rem);
  z-index: 10;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.6em 0.85em;
  background: var(--bg);
  color: var(--ink);
  border: 2px solid var(--accent);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--accent);
}
.sidenote.open { display: block; }

/* Wide: Tufte margin notes. Text column 36em, notes 16rem beside it. */
@media (min-width: 62em) {
  body { max-width: 58em; }
  #mast { max-width: 36em; }
  article > *, .index { max-width: 36em; }
  .sidenote {
    display: block;
    position: relative;
    float: right;
    clear: right;
    width: 16rem;
    margin: 0.3em -18.5rem 0.8em 0; /* -(width + gutter): out of the column into the margin */
    padding: 0;
    max-height: none;
    overflow: visible;
    background: none;
    color: var(--muted);
    border: 0;
    box-shadow: none;
    border-radius: 0;
    z-index: auto;
    top: auto !important;
    left: auto !important;
    max-width: none;
  }
  .sidenote.flash { animation: sn-flash 1.2s ease-out; }
}
@keyframes sn-flash { from { background: var(--mark); color: var(--mark-ink); } to { background: transparent; } }

/* Tables */
table { border-collapse: collapse; font-size: 0.95rem; }
th { font-size: 0.9em; }
th, td { padding: 0.35em 0.8em; border-bottom: 1px solid var(--faint); text-align: left; }

/* Display math may be wide */
.katex-display { overflow-x: auto; overflow-y: hidden; }
article .katex { font-size: 1.09em; } /* KaTeX default 1.21em, 10% smaller; "article" outranks katex.min.css, which loads after us */
