/*
 * Minimal theme, Onenord palette (github.com/rmehri01/onenord.nvim).
 * Light is the default; dark follows the OS setting and can be forced
 * with the header toggle (data-theme). All text/background pairs meet
 * WCAG 2.1 AA contrast (>= 4.5:1 body text, >= 3:1 UI/focus).
 */

:root {
  --max-width: 42rem;
  --bg: #f7f8fa;
  --surface: #eaebed;
  --fg: #2e3440;
  --fg-strong: #2e3440;
  --muted: #646a76;
  --link: #3068ae;
  --border: #dcdee1;
  --focus: #1b40a6;
  --syn-comment: #636975;
  --syn-keyword: #983cc6;
  --syn-string: #34762c;
  --syn-number: #bb3f0f;
  --syn-func: #3068ae;
  --syn-type: #2c727a;
  --syn-meta: #905e30;
  --syn-error: #be383d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2e3440;
    --surface: #3b4252;
    --fg: #c8d0e0;
    --fg-strong: #e5e9f0;
    --muted: #98a2b3;
    --link: #81a1c1;
    --border: #434c5e;
    --focus: #88c0d0;
    --syn-comment: #a8b1bf;
    --syn-keyword: #c5a8c0;
    --syn-string: #a3be8c;
    --syn-number: #d9a48b;
    --syn-func: #99b3cd;
    --syn-type: #88c0d0;
    --syn-meta: #ebcb8b;
    --syn-error: #e19ea4;
  }
}

:root[data-theme="dark"] {
  --bg: #2e3440;
  --surface: #3b4252;
  --fg: #c8d0e0;
  --fg-strong: #e5e9f0;
  --muted: #98a2b3;
  --link: #81a1c1;
  --border: #434c5e;
  --focus: #88c0d0;
  --syn-comment: #a8b1bf;
  --syn-keyword: #c5a8c0;
  --syn-string: #a3be8c;
  --syn-number: #d9a48b;
  --syn-func: #99b3cd;
  --syn-type: #88c0d0;
  --syn-meta: #ebcb8b;
  --syn-error: #e19ea4;
}

* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

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

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* In prose, color alone is not enough (WCAG 1.4.1): underline links. */
main a { text-decoration: underline; text-underline-offset: 2px; }

/* Visible keyboard focus everywhere. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
/* The skip link moves focus here programmatically; no ring needed. */
#main:focus { outline: none; }

/* Skip link: hidden until focused. */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg); color: var(--link);
  padding: .5rem .75rem; border: 1px solid var(--border); z-index: 100;
}
.skip-link:focus { left: .5rem; top: .5rem; }

.site-header { border-bottom: 1px solid var(--border); margin-bottom: 2.5rem; }
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1rem; padding-top: 1.25rem; padding-bottom: 1.25rem;
}
.site-title { font-weight: 700; font-size: 1.1rem; color: var(--fg-strong); }
.site-nav { display: flex; align-items: center; gap: 1rem; }
.site-nav a { color: var(--muted); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: .3rem;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--border); margin-top: 3rem; padding: 1.5rem 0;
  color: var(--muted); font-size: .9rem;
}
.site-footer a { color: var(--muted); }

main { min-height: 60vh; }
h1 { line-height: 1.2; font-size: 1.9rem; margin: 0 0 .3rem; color: var(--fg-strong); }
h2, h3 { color: var(--fg-strong); }
h2 { margin-top: 2.2rem; }
article > time, .post-list time { color: var(--muted); font-size: .9rem; }

article .tags {
  list-style: none; padding: 0; margin: .6rem 0 1.75rem;
  display: flex; flex-wrap: wrap; gap: .4rem;
}
article .tags li {
  font-size: .8rem; color: var(--fg); background: var(--surface);
  padding: .1rem .5rem; border-radius: .25rem;
}

.post-list { list-style: none; padding: 0; }
.post-list li { display: flex; gap: .75rem; align-items: baseline; padding: .35rem 0; }
.post-list time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

.resume-header {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1rem;
}
.resume-download { white-space: nowrap; }
.resume-download-note { color: var(--muted); font-size: .85em; }

.tag-list { list-style: none; padding: 0; }
.tag-list li { padding: .25rem 0; }
.tag-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.tag-count::before { content: "("; }
.tag-count::after { content: ")"; }

p, ul, ol, blockquote, pre, table { margin: 0 0 1.1rem; }
img { max-width: 100%; height: auto; }
blockquote {
  margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--border);
  color: var(--muted); font-style: italic;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .875em; background: var(--surface); padding: .1em .35em; border-radius: .25rem;
}
pre {
  background: var(--surface); padding: 1rem; border-radius: .4rem;
  overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
pre code { background: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/*
 * Syntax highlighting (Chroma, class-based). Token colors are theme
 * variables tuned to meet WCAG AA (>= 4.5:1) on the code surface.
 */
.highlight { margin: 0 0 1.1rem; }
.highlight pre.chroma { margin: 0; }
.chroma { color: var(--fg); }
.chroma .c, .chroma .ch, .chroma .cm, .chroma .c1, .chroma .cs { color: var(--syn-comment); font-style: italic; }
.chroma .cp, .chroma .cpf { color: var(--syn-meta); }
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr { color: var(--syn-keyword); }
.chroma .kt, .chroma .nc, .chroma .nn { color: var(--syn-type); }
.chroma .s, .chroma .sb, .chroma .sc, .chroma .sd, .chroma .s2, .chroma .se,
.chroma .sh, .chroma .si, .chroma .sx, .chroma .sr, .chroma .s1, .chroma .ss,
.chroma .dl { color: var(--syn-string); }
.chroma .m, .chroma .mb, .chroma .mf, .chroma .mh, .chroma .mi, .chroma .mo, .chroma .il { color: var(--syn-number); }
.chroma .nf, .chroma .fm, .chroma .na, .chroma .nb, .chroma .bp { color: var(--syn-func); }
.chroma .no { color: var(--syn-number); }
.chroma .nt { color: var(--syn-keyword); }
.chroma .nv, .chroma .vc, .chroma .vg, .chroma .vi,
.chroma .o, .chroma .ow, .chroma .p { color: var(--fg); }
.chroma .err, .chroma .gd { color: var(--syn-error); }
.chroma .gi { color: var(--syn-string); }
.chroma .gu { color: var(--syn-meta); }
.chroma .ge { font-style: italic; }
.chroma .gs { font-weight: 600; }
