/* asq.fi — one stylesheet, no web fonts, no JavaScript.
   Light and dark follow the system setting (prefers-color-scheme). */

:root {
  --bg: #faf9f6;
  --fg: #1d1c1a;
  --muted: #66625b;
  --rule: #e4e1d9;
  --accent: #1f5f7a;
  --accent-strong: #123e52;
  --code-bg: #f1efe9;
  --note: #1f5f7a;
  --tip: #3f6b35;
  --warn: #8a5a12;
  --danger: #9b2c2c;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  --measure: 40rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --fg: #e9e6df;
    --muted: #a39e94;
    --rule: #2e2d2a;
    --accent: #8ec5dc;
    --accent-strong: #c2e2ef;
    --code-bg: #1e1d1b;
    --note: #8ec5dc;
    --tip: #9cc78f;
    --warn: #e0b46a;
    --danger: #ef9a9a;
  }
}

/* Base */

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

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

body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 2rem);
  padding: 0 1rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.125rem/1.7 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

@media (min-width: 40rem) {
  body { padding: 0 1.5rem; max-width: calc(var(--measure) + 3rem); }
}

a { color: var(--accent); text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 0.12em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--bg); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.muted { color: var(--muted); }

/* Site header and footer */

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 2.25rem 0 1.25rem;
}

.brand {
  font: 600 1.0625rem/1 var(--mono);
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

header.site nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font: 0.9375rem/1.4 var(--sans); }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover { color: var(--fg); text-decoration: underline; }
header.site nav a[aria-current="page"] { color: var(--fg); }

main { padding: 1.5rem 0 3.5rem; }

footer.site {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 3rem;
  font: 0.875rem/1.5 var(--sans);
  color: var(--muted);
}
footer.site p { margin: 0 0 0.25rem; }
footer.site a { color: inherit; }

/* Front page and lists */

.lead { font-size: 1.3125rem; line-height: 1.55; margin-bottom: 2.5rem; }
.lead p { margin: 0 0 0.75rem; }

.label {
  font: 600 0.8125rem/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

section.year + section.year { margin-top: 2rem; }

ol.posts { list-style: none; margin: 0; padding: 0; }

ol.posts li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  column-gap: 1rem;
  padding: 0.5rem 0;
}

section.year ol.posts li { grid-template-columns: 3.5rem 1fr; }

ol.posts time {
  font: 0.8125rem/2.1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

ol.posts a { color: var(--fg); text-decoration: none; font-size: 1.125rem; line-height: 1.45; }
ol.posts a:hover { color: var(--accent); text-decoration: underline; }

ol.posts p {
  grid-column: 2;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

@media (max-width: 30rem) {
  /* Front page (full date): date above the title. Archive (day.month.): keep two columns. */
  ol.posts li { grid-template-columns: 1fr; }
  ol.posts p { grid-column: 1; }
  ol.posts time { line-height: 1.6; }
  section.year ol.posts li { grid-template-columns: 3.25rem 1fr; column-gap: 0.75rem; }
  section.year ol.posts p { grid-column: 2; }
  section.year ol.posts time { line-height: 2.1; }
}

.more { margin: 1.5rem 0 0; font: 0.9375rem/1.5 var(--sans); }
.empty { color: var(--muted); font-style: italic; }

ul.terms { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
ul.terms a { font-size: 1.125rem; }
.count { font: 0.8125rem var(--mono); color: var(--muted); }

/* Page header */

header.page { margin-bottom: 2rem; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

header.page h1 { font-size: 2.125rem; margin: 0.5rem 0 0.5rem; }

@media (max-width: 30rem) {
  header.page h1 { font-size: 1.75rem; }
}

.meta { margin: 0; font: 0.875rem/1.5 var(--sans); color: var(--muted); }
.meta a { color: inherit; }

/* Article text */

.prose { hyphens: auto; -webkit-hyphens: auto; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose dl { margin: 0 0 1.15em; }
.prose h2 { font-size: 1.4375rem; margin: 2.25em 0 0.6em; }
.prose h3 { font-size: 1.1875rem; margin: 1.9em 0 0.5em; }
.prose h4 { font-size: 1.0625rem; margin: 1.6em 0 0.4em; }
.prose li { margin: 0.25em 0; }
.prose li > ul, .prose li > ol { margin: 0.25em 0 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul li::marker { color: var(--muted); }
.prose ol li::marker { color: var(--muted); font: 0.9em var(--sans); }

.anchor {
  margin-left: 0.35em;
  color: var(--rule);
  text-decoration: none;
  font-weight: 400;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus-visible { color: var(--muted); }

blockquote {
  margin: 1.6em 0;
  padding: 0.1em 0 0.1em 1.1em;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}
blockquote > :last-child { margin-bottom: 0; }

/* GitHub alerts (zola.toml: github_alerts = true) */
blockquote[class^="markdown-alert-"] {
  font-style: normal;
  color: var(--fg);
  border-left-color: var(--note);
  background: color-mix(in srgb, var(--note) 6%, transparent);
  padding: 0.75em 1em 0.75em 1.1em;
  border-radius: 0 4px 4px 0;
}
blockquote[class^="markdown-alert-"]::before {
  display: block;
  font: 600 0.75rem/1.6 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--note);
  margin-bottom: 0.25em;
}
blockquote.markdown-alert-note::before { content: "Huom."; }
blockquote.markdown-alert-tip { --note: var(--tip); }
blockquote.markdown-alert-tip::before { content: "Vinkki"; }
blockquote.markdown-alert-important::before { content: "Tärkeää"; }
blockquote.markdown-alert-warning { --note: var(--warn); }
blockquote.markdown-alert-warning::before { content: "Varoitus"; }
blockquote.markdown-alert-caution { --note: var(--danger); }
blockquote.markdown-alert-caution::before { content: "Varo"; }

/* Code */

code, kbd, samp { font-family: var(--mono); font-size: 0.85em; }

:not(pre) > code {
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  hyphens: none;
}

pre {
  margin: 1.6em 0;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font: 0.875rem/1.6 var(--mono);
  hyphens: none;
  tab-size: 4;
}
/* Overrides the theme background from giallo-*.css, so code blocks match the page. */
pre.giallo, pre { background: var(--code-bg); }
pre code { font-size: inherit; background: none; padding: 0; }

/* Required by the giallo highlighter (Zola 0.23 documentation). */
.giallo-l { display: inline-block; min-height: 1lh; width: 100%; }
.giallo-ln {
  display: inline-block;
  user-select: none;
  margin-right: 0.4em;
  padding: 0 0.4em 0 0;
  min-width: 3ch;
  text-align: right;
  opacity: 0.8;
}

/* Tables */

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
th, td { padding: 0.45em 1em 0.45em 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
th { font: 600 0.8125rem/1.5 var(--sans); letter-spacing: 0.04em; color: var(--muted); border-bottom-width: 2px; }

/* Media, rules, notes */

img, svg, video { max-width: 100%; height: auto; }
.prose img { display: block; margin: 1.6em auto; border-radius: 4px; }

hr { border: 0; margin: 2.5em 0; text-align: center; }
hr::after { content: "⁂"; color: var(--muted); font-size: 1.125rem; }

section.footnotes {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--muted);
}
section.footnotes ol { padding-left: 1.4em; }
sup.footnote-reference { line-height: 0; }
sup.footnote-reference a { text-decoration: none; font: 0.75em var(--sans); }

mark { background: color-mix(in srgb, var(--warn) 25%, transparent); color: inherit; }

/* Post footer */

footer.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin-top: 2.5rem;
  font: 0.875rem/1.5 var(--sans);
  color: var(--muted);
}
footer.tags ul { display: contents; list-style: none; }
footer.tags li { display: inline; }
footer.tags a { color: var(--fg); }

nav.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
nav.pager a { color: var(--fg); text-decoration: none; line-height: 1.4; }
nav.pager a:hover { color: var(--accent); }
nav.pager span {
  display: block;
  font: 0.8125rem/1.6 var(--sans);
  color: var(--muted);
}
nav.pager .newer { grid-column: 2; text-align: right; }

@media (max-width: 30rem) {
  nav.pager { grid-template-columns: 1fr; }
  nav.pager .newer { grid-column: 1; text-align: left; }
}

/* Print */

@media print {
  :root { --bg: #fff; --fg: #000; --muted: #444; --rule: #ccc; --accent: #000; --code-bg: #f4f4f4; }
  body { max-width: none; font-size: 11pt; }
  header.site nav, footer.site, nav.pager, .skip, .anchor { display: none; }
  pre { white-space: pre-wrap; }
}
