/* Themes: Tokyo Night (dark) and Tokyo Night Day (light) — https://github.com/folke/tokyonight.nvim
   Dark is the base below; the light block after it takes over when the reader's system is set to light.
   See README → Styling. */
:root {
  color-scheme: dark;
  --bg: #1a1b26;
  --bg-alt: #16161e;   /* code blocks */
  --line: #292e42;     /* borders */
  --text: #c0caf5;
  --muted: #737aa2;    /* dates, footer */
  --comment: #565f89;  /* code comments */
  --blue: #7aa2f7;     /* links */
  --cyan: #7dcfff;
  --purple: #bb9af7;   /* code keywords */
  --green: #9ece6a;
  --orange: #ff9e64;
  --yellow: #e0af68;
  --red: #f7768e;
  --operator: #89ddff; /* code operators and punctuation */
  --heading: #73daca;  /* title, headings, quote bar (teal) */

  --font-text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* Light: used automatically when the reader's system is set to light. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #e1e2e7;
    --bg-alt: #eceef3;
    --line: #c4c8da;
    --text: #343b58;
    --muted: #545a85;
    --comment: #5c6182;
    --blue: #2856c2;
    --cyan: #00627f;
    --purple: #6c3bb8;
    --green: #3a6324;
    --orange: #954900;
    --yellow: #7d5900;
    --red: #b51c49;
    --operator: #00627f;
    --heading: #08705d;
  }
}

/* ---------- fonts: IBM Plex, self-hosted from src/fonts/ (SIL Open Font License, see OFL.txt) ---------- */
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* ---------- page ---------- */
* { box-sizing: border-box; }

body {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1rem;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--font-text);
}

a { color: var(--blue); text-decoration: none; }

h1, h2, h3 { color: var(--heading); line-height: 1.3; }
h1 { font-size: 1.9rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.35rem; margin-top: 2.5rem; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.25rem; }
h3 a { color: var(--heading); }

/* ---------- header / footer ---------- */
header {
  display: flex;
  justify-content: space-between;  /* title left, nav right */
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
header .logo { color: var(--heading); font-size: 2.6rem; font-weight: 700; line-height: 1.2; }
header nav { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.5; }

/* Phones: nav goes back to one row under the title */
@media (max-width: 600px) {
  header { flex-direction: column; gap: 0.5rem; }
  header nav { flex-direction: row; gap: 1.1rem; }
}

footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

/* ---------- home ---------- */

.topics a {
  display: inline-block;
  margin: 0 0.4rem 0.4rem 0;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
}

/* ---------- post lists ---------- */
.posts { list-style: none; padding: 0; margin: 0.5rem 0; }
.posts li { display: flex; gap: 1rem; padding: 0.15rem 0; }
.posts time {
  flex: 0 0 6.5rem;
  color: var(--muted);
  font-family: var(--font-code);
  font-size: 0.9rem;
  padding-top: 0.15rem;
}
.star { color: var(--yellow); }
.badge {
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--green);
  font-size: 0.75rem;
  vertical-align: middle;
}

/* ---------- post page ---------- */
.meta { color: var(--muted); margin: 0 0 2rem; }
.tag { color: var(--cyan); }
.meta .tag { margin-left: 0.5rem; }

article img { max-width: 100%; }
blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 3px solid var(--heading); color: var(--muted); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* ---------- code ---------- */
code {
  font-family: var(--font-code);
  font-size: 0.88em;
}
:not(pre) > code {
  background: var(--bg-alt);
  color: var(--orange);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
}

/* Syntax colours (Prism token classes added by the syntaxhighlight plugin) */
.token.comment, .token.prolog { color: var(--comment); font-style: italic; }
.token.keyword, .token.directive { color: var(--purple); }
.token.string, .token.char { color: var(--green); }
.token.number, .token.boolean { color: var(--orange); }
.token.function { color: var(--blue); }
.token.class-name, .token.builtin { color: var(--cyan); }
.token.operator, .token.punctuation { color: var(--operator); }
.token.macro, .token.property { color: var(--red); }
