:root {
  --bg: #fff;
  --fg: #1a1a1a;
  --muted: #595959;
  --accent: #1d5a85;
  --border: #d9d9d9;
  --code-bg: #f3f3f3;
  --pre-bg: #fff;              /* matches the github-light-default highlight theme */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --fg: #e4e4e4;
    --muted: #a6a6a6;
    --accent: #84b6dc;
    --border: #3a3a3a;
    --code-bg: #222;
    --pre-bg: #0d1117;         /* matches github-dark-default */
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 44rem;              /* ~700px at 16px root */
  padding: 1.5rem 1rem 3rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.125rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}

/* Links */
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.25rem 0.5rem; }

/* Site header / footer */
header.site {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.25rem 1rem;
  margin-bottom: 2.5rem;
}
header.site a { text-decoration: none; }
header.site a:hover { text-decoration: underline; }
.site-name { color: var(--fg); font-weight: 600; }
header.site nav { display: flex; gap: 1rem; }

footer.site {
  margin-top: 4rem; padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.9rem;
}

/* Typography */
h1, h2, h3, h4 { line-height: 1.25; margin: 2em 0 0.6em; }
h1 { font-size: 1.9rem; margin-top: 0; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p, ul, ol, blockquote, table, pre, figure { margin: 0 0 1.25rem; }
li + li { margin-top: 0.25rem; }
blockquote { margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--border); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
img, svg, video { max-width: 100%; height: auto; }
.meta { color: var(--muted); font-size: 0.95rem; margin-top: -0.25rem; }

/* Code */
code, kbd, pre { font-family: var(--mono); font-size: 0.85em; }
:not(pre) > code, kbd {
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
kbd { border: 1px solid var(--border); }
pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--pre-bg);    /* highlighted blocks set their own inline */
  tab-size: 4;
}
pre code { font-size: inherit; }
pre .giallo-ln { padding-right: 1em; user-select: none; }   /* ```lang,linenos */

/* Tables: scroll inside their own box on narrow screens */
table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { border-bottom-width: 2px; }

/* Figures */
figure { margin: 2rem 0; text-align: center; }
figure img { display: block; margin: 0 auto; }
figcaption { margin-top: 0.5rem; color: var(--muted); font-size: 0.9rem; }

/* Footnotes */
.footnotes { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.9rem; }
.footnotes ol { padding-left: 1.25rem; }
sup { line-height: 0; }

/* Home + post lists */
.project-list, .post-list { list-style: none; padding: 0; }
.post-list li { display: flex; gap: 1rem; }
.post-list time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
