/* ---------- Colors: tweak these to re-theme the whole site ---------- */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #6b6f76;
  --border: #e4e2dc;
  --accent: #5b3cc4;
  --accent-soft: #ece7fb;
  --code-bg: #f1f0ec;
  --radius: 10px;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --surface: #1a1d22; --text: #e8e6e1; --muted: #9a9ea6;
    --border: #2a2e35; --accent: #a58cff; --accent-soft: #2a2442; --code-bg: #20242a;
  }
}
:root[data-theme="dark"] {
  --bg: #111317; --surface: #1a1d22; --text: #e8e6e1; --muted: #9a9ea6;
  --border: #2a2e35; --accent: #a58cff; --accent-soft: #2a2442; --code-bg: #20242a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }
.brand { font-weight: 800; letter-spacing: .12em; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; color: var(--accent); }
.nav { display: flex; align-items: center; gap: 1.25rem; font-weight: 600; font-size: .95rem; }
.nav a { color: var(--text); }
.nav a:hover { color: var(--accent); text-decoration: none; }
.theme-toggle { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; padding-top: 2.5rem; padding-bottom: 3rem; }
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); max-width: 800px; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Post cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem 1.75rem; margin-bottom: 1.5rem; transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.badge { background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding: .15rem .55rem; border-radius: 99px; margin-left: auto; }
.card h2 { font-size: 1.45rem; line-height: 1.3; margin: .6rem 0 .5rem; }
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--accent); text-decoration: none; }
.excerpt { font-family: var(--serif); color: var(--muted); margin: 0 0 1rem; font-size: 1.05rem; }
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; border-top: 1px solid var(--border); padding-top: .9rem; }
.continue { font-weight: 600; font-size: .9rem; }

.share { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); }
.share a { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 .4rem; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-weight: 700; }
.share a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ---------- Archive ---------- */
.archive { margin-top: 3rem; }
.archive > h2 { font-size: 1.3rem; border-bottom: 2px solid var(--text); padding-bottom: .4rem; }
.year { color: var(--accent); font-size: 1rem; margin: 1.5rem 0 .5rem; }
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .9rem; padding: .55rem 0; border-bottom: 1px dashed var(--border); }
.archive-list time { color: var(--muted); font-size: .85rem; min-width: 56px; font-variant-numeric: tabular-nums; }
.archive-list a { color: var(--text); font-weight: 600; }
.archive-list a:hover { color: var(--accent); }
.archive-tags { margin-left: auto; display: flex; gap: .3rem; }

/* ---------- Tags ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: .2rem .7rem; font-size: .82rem; }
.tag:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.tag .count { background: var(--accent); color: var(--surface); border-radius: 99px; font-size: .7rem; padding: 0 .4rem; font-weight: 700; }
.archive-list a.tag.small, .tag.small { font-size: .72rem; padding: .05rem .5rem; font-weight: 500; color: var(--muted); }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem; }
.widget h3 { margin: 0 0 .7rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.bio h3 { font-size: 1.15rem; text-transform: none; letter-spacing: 0; color: var(--text); font-family: var(--serif); font-style: italic; }
.bio p { margin: 0 0 .6rem; font-size: .95rem; }
.more { font-weight: 600; font-size: .9rem; }
.social { display: flex; gap: .8rem; margin-top: .9rem; }
.social a { color: var(--muted); }
.social a:hover { color: var(--accent); }
.recent { margin: 0; padding-left: 1.2rem; font-size: .92rem; }
.recent li { margin-bottom: .35rem; }
.muted { color: var(--muted); list-style: none; margin-left: -1.2rem; }

/* ---------- Single post ---------- */
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.25rem 2.5rem; }
@media (max-width: 600px) { .post { padding: 1.5rem 1.2rem; } .card { padding: 1.3rem; } }
.post-header h1 { font-size: 2.2rem; line-height: 1.2; margin: .6rem 0; }
.lede { font-family: var(--serif); font-size: 1.2rem; color: var(--muted); margin: 0 0 .8rem; }
.post-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1.5rem; }
.prose { font-family: var(--serif); font-size: 1.12rem; line-height: 1.75; }
.prose h2, .prose h3 { font-family: var(--sans); margin-top: 2rem; }
.prose blockquote { margin: 1.5rem 0; padding: .3rem 1.2rem; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.prose code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; font-size: .88em; }
.prose pre { background: var(--code-bg); padding: 1rem 1.2rem; border-radius: 8px; overflow-x: auto; font-size: .9rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .5rem .8rem; text-align: left; }
.prose th { background: var(--code-bg); }
.post-footer { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.2rem; }
.post-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; font-weight: 600; font-size: .92rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2.5rem 0 1.5rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.footer-title { font-weight: 800; color: var(--text); font-size: 1.1rem; }
.footer-inner p { color: var(--muted); margin: .3rem 0 0; max-width: 420px; }
.footer-inner h4 { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.footer-inner .social { margin-top: .6rem; }
.copyright { color: var(--muted); font-size: .82rem; margin-top: 2rem; }

/* ---------- Syntax highlighting (Rouge) ---------- */
.highlight .k, .highlight .kd, .highlight .kn { color: #8959a8; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .si { color: #2e8b57; }
.highlight .c, .highlight .c1, .highlight .cm { color: var(--muted); font-style: italic; }
.highlight .nf, .highlight .nb { color: #3e7bd6; }
.highlight .mi, .highlight .mf { color: #d9731a; }

/* ---------- Certifications ---------- */
.bio-certs { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.bio-certs h4 { margin: 0 0 .6rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.cert-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.cert-badge { background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .8rem; padding: .25rem .7rem; border-radius: 6px; border: 1px solid transparent; }
.cert-badge:hover { border-color: var(--accent); text-decoration: none; }

.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; font-family: var(--sans); }
.cert-card { border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 1.2rem 1.3rem; background: var(--bg); }
.cert-issuer { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.cert-card h3 { margin: .4rem 0 .5rem; font-size: 1.1rem; line-height: 1.35; }
.cert-date { color: var(--muted); font-size: .88rem; margin-bottom: .8rem; }
.cert-verify { font-weight: 600; font-size: .9rem; }
