/* Light palette on :root; dark redefined only under the media query and
   an explicit [data-theme]. Every colour has a definition on bare :root. */
:root {
  --bg: #ffffff;
  --fg: #16181d;
  --muted: #5b6472;
  --rule: #e3e6ea;
  --link: #2f4fd8;
  --accent: #1f7a5c;
  --code-bg: #f5f6f8;
  --tag-bg: #eef1f5;
  --note-bg: #f7f9fc;
  --maxw: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --fg: #e6e8ec;
    --muted: #9aa3b2;
    --rule: #262b34;
    --link: #8fa6ff;
    --accent: #58c79c;
    --code-bg: #171a21;
    --tag-bg: #1c212a;
    --note-bg: #141821;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --fg: #e6e8ec;
  --muted: #9aa3b2;
  --rule: #262b34;
  --link: #8fa6ff;
  --accent: #58c79c;
  --code-bg: #171a21;
  --tag-bg: #1c212a;
  --note-bg: #141821;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute; left: -9999px;
}
.skip:focus {
  left: 1rem; top: 1rem; padding: .5rem .75rem;
  background: var(--bg); border: 2px solid var(--link); z-index: 10;
}

header.site, footer.site, main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

header.site {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: baseline; justify-content: space-between;
  padding-top: 2.5rem; padding-bottom: 1.25rem;
}
.brand { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--fg); }
header.site nav { display: flex; gap: 1.1rem; }
header.site nav a { color: var(--muted); text-decoration: none; font-size: .93rem; }
header.site nav a:hover { color: var(--link); }

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

main { padding-bottom: 3rem; }

.intro { border-bottom: 1px solid var(--rule); padding-bottom: 1.5rem; margin-bottom: 2rem; }
.intro h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 .6rem; }
.intro p { color: var(--muted); margin: 0; }

ul.postlist { list-style: none; margin: 0; padding: 0; }
ul.postlist li { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
ul.postlist time { display: block; color: var(--muted); font-size: .82rem;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
ul.postlist a { font-size: 1.12rem; font-weight: 600; text-decoration: none; }
ul.postlist a:hover { text-decoration: underline; }
ul.postlist p { color: var(--muted); margin: .35rem 0 0; font-size: .96rem; }
.empty { color: var(--muted); }

article.post header { margin-bottom: 2rem; }
article.post h1 { font-size: 1.85rem; line-height: 1.25; margin: 0 0 .5rem; }
.meta { color: var(--muted); font-size: .9rem; margin: 0; display: flex;
  flex-wrap: wrap; gap: .75rem; align-items: center; }
.tag { background: var(--tag-bg); color: var(--muted); border-radius: 3px;
  padding: .1rem .45rem; font-size: .78rem; margin-right: .3rem; }
.summary { color: var(--muted); font-size: 1.02rem; margin-top: .9rem; }

article.post h2 { font-size: 1.3rem; margin: 2.4rem 0 .7rem; line-height: 1.3; }
article.post h3 { font-size: 1.08rem; margin: 1.8rem 0 .5rem; }
article.post p, article.post li { overflow-wrap: break-word; }
article.post blockquote {
  margin: 1.5rem 0; padding: .1rem 1.1rem; border-left: 3px solid var(--accent);
  color: var(--muted);
}

img, video { max-width: 100%; height: auto; border-radius: 5px; }
figure { margin: 1.8rem 0; }
figcaption { color: var(--muted); font-size: .88rem; margin-top: .5rem; }

code {
  background: var(--code-bg); padding: .12em .35em; border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .89em;
}
pre {
  background: var(--code-bg); padding: 1rem; border-radius: 6px;
  overflow-x: auto; border: 1px solid var(--rule);
}
pre code { background: none; padding: 0; font-size: .86rem; }

/* Wide content scrolls inside its own box; the page never scrolls sideways. */
.table-wrap, article.post table { display: block; overflow-x: auto; max-width: 100%; }
article.post table { border-collapse: collapse; font-size: .93rem; margin: 1.5rem 0; }
article.post th, article.post td {
  border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; vertical-align: top;
}
article.post th { background: var(--tag-bg); font-weight: 600; }

aside.note {
  background: var(--note-bg); border: 1px solid var(--rule);
  border-radius: 6px; padding: .9rem 1.1rem; margin: 2rem 0;
  color: var(--muted); font-size: .94rem;
}
aside.note p { margin: 0; }

.postnav { display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  font-size: .94rem; }
.postnav .next { margin-left: auto; text-align: right; }

footer.site { border-top: 1px solid var(--rule); padding-top: 1.25rem;
  padding-bottom: 3rem; color: var(--muted); font-size: .88rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
footer.site p { margin: 0; }
