:root {
  color-scheme: light dark;
  --fg: #222;
  --muted: #6b6b6b;
  --bg: #fdfdfd;
  --rule: #e4e4e4;
  --code-bg: #f4f4f4;
  --accent: #e25440;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ddd;
    --muted: #999;
    --bg: #16181c;
    --rule: #2e3138;
    --code-bg: #0d1117;
    --accent: #f07a69;
  }
}

* { box-sizing: border-box; }

body {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 0 0 .5rem; }

/* Header / footer */
.site-header {
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.site-title { font-size: 1.5rem; font-weight: 700; color: var(--fg); }
.site-description { margin: .1rem 0 .75rem; color: var(--muted); }
.site-nav a, .social a { margin-right: 1rem; }

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

/* Post lists */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { margin-bottom: 2rem; }
.post-list h2 { margin: 0; font-size: 1.4rem; }
.post-list h2 a { color: var(--fg); }
.summary { margin: .25rem 0 0; }

.post-meta { margin: .25rem 0 1.5rem; color: var(--muted); font-size: .9rem; }
.post-list .post-meta { margin-bottom: 0; }

.tag {
  display: inline-block;
  margin: 0 .2rem .3rem 0;
  padding: 0 .6rem;
  border: 1px solid var(--accent);
  border-radius: 1rem;
  font-size: .8rem;
  white-space: nowrap;
}
.term-list { list-style: none; padding: 0; }
.term-list .count { color: var(--muted); font-size: .85rem; }

.pagination { display: flex; gap: 1rem; justify-content: space-between; color: var(--muted); }

/* Content */
article ul, article ol { padding-left: 1.4rem; }
article li > p { margin: .4rem 0; }

code { font: .9em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:not(pre) > code { padding: .1em .3em; border-radius: 3px; background: var(--code-bg); }
pre {
  padding: .8rem 1rem;
  overflow-x: auto;
  border-radius: 4px;
  background: var(--code-bg) !important;
}
pre code { white-space: pre-wrap; }

/* Required by Zola's highlighter (giallo) */
.giallo-l { display: inline-block; min-height: 1lh; width: 100%; }
.giallo-ln {
  display: inline-block;
  user-select: none;
  margin-right: .4em;
  padding: .4em;
  min-width: 3ch;
  text-align: right;
  opacity: .8;
}

table { border-collapse: collapse; margin-bottom: 1.3em; }
th { text-align: left; border-bottom: 3px solid var(--muted); }
th, td { padding: .5rem .75rem; }
tr:nth-child(even) td { background: var(--code-bg); }

img { max-width: 100%; }

/* External links get a small arrow (target set by Zola's markdown config) */
article a[rel~="external"]::after { content: "\2009\2197"; font-size: .8em; }

.print-only { display: none; }

@media print {
  * { background: transparent !important; color: #000 !important; }
  body { max-width: none; padding: 0; font-size: 11pt; }
  .site-nav, .social { display: none; }
  .print-only { display: block; }
  a { text-decoration: underline; }
  article a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  pre, blockquote, tr, img { page-break-inside: avoid; }
  h2, h3 { page-break-after: avoid; }
  @page { margin: 1.2cm; }
}
