/* =============================================================================
   style.css — the whole look of the site, hand-written, no framework.
   Colours are CSS variables so dark mode is just a second set of values.
   ========================================================================== */

/* ---- colours: light (default) --------------------------------------------- */
:root {
  --bg: #ffffff;
  --text: #333333;
  --heading: #000000;
  --muted: #828282;
  --link: #b509ac;
  --link-hover: #7a0774;
  --border: #e6e6e6;
  --code-bg: #f6f8fa;
  --tag-bg: #f2f2f2;
  --max-width: 930px;
}

/* ---- colours: dark, when the OS prefers it and the user has not chosen light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1d;
    --text: #e0e0e0;
    --heading: #ffffff;
    --muted: #9a9a9a;
    --link: #2698ba;
    --link-hover: #5fb8d4;
    --border: #333333;
    --code-bg: #2b2b2b;
    --tag-bg: #2b2b2b;
  }
}
/* ---- colours: dark, when the user clicked the toggle -------------------- */
:root[data-theme="dark"] {
  --bg: #1c1c1d;
  --text: #e0e0e0;
  --heading: #ffffff;
  --muted: #9a9a9a;
  --link: #2698ba;
  --link-hover: #5fb8d4;
  --border: #333333;
  --code-bg: #2b2b2b;
  --tag-bg: #2b2b2b;
}

/* ---- base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding-top: 60px;              /* room for the fixed navbar */
  padding-bottom: 60px;           /* room for the fixed footer */
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  line-height: 1.6;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
h1, h2, h3, h4 { color: var(--heading); font-weight: 400; line-height: 1.25; margin: 1.5em 0 0.5em; }
h1 { font-size: 2.4rem; font-weight: 300; margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
strong, b { font-weight: 700; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
blockquote { margin: 1rem 0; padding: 0 1rem; border-left: 4px solid var(--border); color: var(--muted); }
table { border-collapse: collapse; }
th, td { text-align: left; padding: 0.3rem 0.6rem; vertical-align: top; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 2rem 16px; }

/* ---- navigation bar ------------------------------------------------------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-nav {
  max-width: var(--max-width); margin: 0 auto; padding: 0 16px;
  height: 60px; display: flex; align-items: center;
}
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 1.2rem; width: 100%; }
.nav-links li:last-child { margin-left: auto; }   /* pushes the dark-mode toggle to the right edge */
.nav-links a { color: var(--heading); font-size: 1.05rem; }
.nav-links a.active { font-weight: 700; }
#theme-toggle {
  background: none; border: 0; cursor: pointer; font-size: 1.2rem;
  color: var(--heading); padding: 0 0.2rem; line-height: 1;
}

/* ---- page header ---------------------------------------------------------- */
.page-header { margin-bottom: 1.5rem; }
.page-title { margin-bottom: 0.2rem; }
.desc { color: var(--muted); font-size: 1.05rem; margin: 0 0 0.5rem; }
.post-meta { color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0; }
.tag { display: inline-block; background: var(--tag-bg); border-radius: 3px; padding: 0 0.4rem; font-size: 0.85rem; }

/* ---- home page ------------------------------------------------------------ */
.profile { float: right; width: 30%; margin: 0 0 1rem 1.5rem; text-align: center; }
.profile img { border-radius: 6px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16); }
.profile-caption { color: var(--muted); font-size: 0.9rem; margin-top: 0.5rem; }
.bio::after { content: ""; display: block; clear: both; }
.post-table { width: 100%; }
.post-table th { width: 22%; font-weight: 700; white-space: nowrap; }
.social { margin-top: 2.5rem; text-align: center; font-size: 1.05rem; }
.social .sep { color: var(--muted); }

/* ---- blog index ----------------------------------------------------------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list > li { border-bottom: 1px solid var(--border); padding: 1.2rem 0; }
.post-list > li.year-heading { border-bottom: 0; padding: 1rem 0 0; }
.post-list > li.year-heading h2 { margin: 0; color: var(--muted); font-weight: 300; }
.post-list h3 { margin: 0 0 0.3rem; font-size: 1.35rem; }
.post-list p { margin: 0.2rem 0; }

/* ---- single post ---------------------------------------------------------- */
.post-content h2, .post-content h3 { margin-top: 2rem; }
.post-nav { display: flex; justify-content: space-between; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.post-nav .right { margin-left: auto; }

/* ---- code ----------------------------------------------------------------- */
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
code { background: var(--code-bg); border-radius: 3px; padding: 0.1em 0.3em; }
pre { background: var(--code-bg); border-radius: 6px; padding: 1rem; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }
.highlight { background: var(--code-bg); border-radius: 6px; }
.highlight pre { margin: 0; }

/* syntax highlighting (rouge class names), light */
.highlight .c, .highlight .c1, .highlight .cm { color: #6a737d; font-style: italic; } /* comments */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt { color: #d73a49; } /* keywords */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sh { color: #032f62; } /* strings */
.highlight .si, .highlight .se { color: #005cc5; }
.highlight .m, .highlight .mi, .highlight .mf { color: #005cc5; } /* numbers */
.highlight .nf, .highlight .fm { color: #6f42c1; } /* function names */
.highlight .nc, .highlight .nn { color: #e36209; } /* class / namespace */
.highlight .nb, .highlight .bp { color: #005cc5; } /* builtins */
.highlight .o, .highlight .ow { color: #d73a49; } /* operators */
.highlight .nt { color: #22863a; } /* html tags */
.highlight .na { color: #6f42c1; } /* attributes */

/* syntax highlighting, dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .highlight .c, :root:not([data-theme="light"]) .highlight .c1, :root:not([data-theme="light"]) .highlight .cm { color: #8b949e; }
  :root:not([data-theme="light"]) .highlight .k, :root:not([data-theme="light"]) .highlight .kd, :root:not([data-theme="light"]) .highlight .kn, :root:not([data-theme="light"]) .highlight .kr, :root:not([data-theme="light"]) .highlight .kt, :root:not([data-theme="light"]) .highlight .o, :root:not([data-theme="light"]) .highlight .ow { color: #ff7b72; }
  :root:not([data-theme="light"]) .highlight .s, :root:not([data-theme="light"]) .highlight .s1, :root:not([data-theme="light"]) .highlight .s2, :root:not([data-theme="light"]) .highlight .sb, :root:not([data-theme="light"]) .highlight .sh { color: #a5d6ff; }
  :root:not([data-theme="light"]) .highlight .m, :root:not([data-theme="light"]) .highlight .mi, :root:not([data-theme="light"]) .highlight .mf, :root:not([data-theme="light"]) .highlight .nb, :root:not([data-theme="light"]) .highlight .bp, :root:not([data-theme="light"]) .highlight .si, :root:not([data-theme="light"]) .highlight .se { color: #79c0ff; }
  :root:not([data-theme="light"]) .highlight .nf, :root:not([data-theme="light"]) .highlight .fm, :root:not([data-theme="light"]) .highlight .na { color: #d2a8ff; }
  :root:not([data-theme="light"]) .highlight .nc, :root:not([data-theme="light"]) .highlight .nn { color: #ffa657; }
  :root:not([data-theme="light"]) .highlight .nt { color: #7ee787; }
}
:root[data-theme="dark"] .highlight .c, :root[data-theme="dark"] .highlight .c1, :root[data-theme="dark"] .highlight .cm { color: #8b949e; }
:root[data-theme="dark"] .highlight .k, :root[data-theme="dark"] .highlight .kd, :root[data-theme="dark"] .highlight .kn, :root[data-theme="dark"] .highlight .kr, :root[data-theme="dark"] .highlight .kt, :root[data-theme="dark"] .highlight .o, :root[data-theme="dark"] .highlight .ow { color: #ff7b72; }
:root[data-theme="dark"] .highlight .s, :root[data-theme="dark"] .highlight .s1, :root[data-theme="dark"] .highlight .s2, :root[data-theme="dark"] .highlight .sb, :root[data-theme="dark"] .highlight .sh { color: #a5d6ff; }
:root[data-theme="dark"] .highlight .m, :root[data-theme="dark"] .highlight .mi, :root[data-theme="dark"] .highlight .mf, :root[data-theme="dark"] .highlight .nb, :root[data-theme="dark"] .highlight .bp, :root[data-theme="dark"] .highlight .si, :root[data-theme="dark"] .highlight .se { color: #79c0ff; }
:root[data-theme="dark"] .highlight .nf, :root[data-theme="dark"] .highlight .fm, :root[data-theme="dark"] .highlight .na { color: #d2a8ff; }
:root[data-theme="dark"] .highlight .nc, :root[data-theme="dark"] .highlight .nn { color: #ffa657; }
:root[data-theme="dark"] .highlight .nt { color: #7ee787; }

/* ---- footer --------------------------------------------------------------- */
.site-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg); border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.85rem; text-align: center;
  padding: 0.8rem 16px;
}

/* ---- small screens -------------------------------------------------------- */
@media (max-width: 600px) {
  h1 { font-size: 1.9rem; }
  .nav-links { gap: 0.8rem; }
  .profile { float: none; width: 60%; margin: 0 auto 1rem; }
  .post-table th { width: auto; }
  .site-footer { position: static; }
  body { padding-bottom: 0; }
}
