/* Each colour is its light and its dark value; color-scheme picks one. It follows the
   system unless the reader chose a theme (theme.js sets data-theme). */
:root {
  --bg: light-dark(#f5f5f2, #191a1c);
  --ink: light-dark(#252525, #e6e6e6);
  --muted: light-dark(#6b6b68, #8e8f92);
  --line: light-dark(#dededa, #2c2d30);
  --accent: light-dark(#252525, #e6e6e6);
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
}

main {
  max-width: 36rem;
  margin: 0 auto;
  padding: 4rem 1.25rem 6rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--muted);
}
a:hover { text-decoration-color: currentColor; }

h1, h2, h3 { font-weight: 500; line-height: 1.3; }
h1 { font-size: 1.4rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.1rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 2rem 0 0.5rem; }

p { margin: 0 0 1.1rem; }

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

/* Home */
.intro { margin-bottom: 3rem; }

.posts { list-style: none; margin: 0; padding: 0; }
.posts li {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.45rem 0;
}
.posts time {
  flex: 0 0 6.5rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
.tag {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.5rem;
  margin-left: 0.4rem;
  white-space: nowrap;
}

/* Post */
.back { display: inline-block; margin-bottom: 3rem; font-size: 0.9rem; }
article header { margin-bottom: 2rem; }
article img { max-width: 100%; height: auto; border-radius: 6px; }
article ul, article ol { padding-left: 1.2rem; }
blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}
code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.88em;
}
pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

footer {
  margin-top: 4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 30rem) {
  .posts li { flex-direction: column; gap: 0; padding: 0.6rem 0; }
  .posts time { flex: none; }
}

/* Home: the banner starts at the very top. */
.home { padding-top: 0; }
body { overflow-x: clip; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Page frame: the site's own header and footer sit outside <main>, on its column. */
.site {
  max-width: 36rem;
  margin: 0 auto;
  padding-inline: 1.25rem;
}
header.site { padding-top: 4rem; }
header.site .back { margin-bottom: 0; }
main.home { padding-bottom: 0; }
main.post { padding-top: 3rem; padding-bottom: 0; }
/* The same two lines on every page and width: who and which language, with the way to
   /write at the right; the theme below. */
footer.site {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.75rem 1.5rem;
  margin-top: 4rem;
  padding-bottom: 6rem;
}
footer.site p { margin: 0; }
footer.site .theme { grid-column: 1 / -1; }

/* Theme switch: three words in the footer, the chosen one in ink. */
.theme { display: flex; gap: 0.75rem; }
.theme[hidden] { display: none; }
.theme button {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

address { font-style: normal; }
article header .meta { margin: 0; color: var(--muted); font-size: 0.9rem; }
article header .meta .tag { margin-left: 0.6rem; }
article figure { margin: 2rem 0; }
article figure img { display: block; }
