/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #f2f4f1;
  --surface: #ffffff;
  --ink: #17242a;
  --muted: #56666c;
  --line: #d5dcd8;
  --accent: #1c6e86;
  --accent-soft: #dcebef;
  --earned: #2f7a4f;
  --code-bg: #e8ece9;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12181b; --surface: #192125; --ink: #dde5e7; --muted: #93a3a8;
    --line: #2a363b; --accent: #6dbbd3; --accent-soft: #1d3139; --earned: #6cc496;
    --code-bg: #0e1416; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12181b; --surface: #192125; --ink: #dde5e7; --muted: #93a3a8;
  --line: #2a363b; --accent: #6dbbd3; --accent-soft: #1d3139; --earned: #6cc496;
  --code-bg: #0e1416; color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.6 var(--sans);
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; }

/* ── Header ─────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .9rem; padding-bottom: .9rem; flex-wrap: wrap; }
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: baseline; gap: .6rem; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; letter-spacing: -.01em; }
.brand-tag { color: var(--muted); font-size: .9rem; }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a { color: var(--ink); text-decoration: none; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.theme-toggle {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Home ───────────────────────────────────────────────── */
.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 3.5rem; padding-top: 3rem; padding-bottom: 4rem; }
.hero { margin-bottom: 2.5rem; }
.hero h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.08; letter-spacing: -.02em; margin: 0 0 .75rem; max-width: 15ch;
}
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 52ch; margin: 0; }

.post-card { padding: 1.75rem 0; border-top: 1px solid var(--line); }
.post-card h2 { font-family: var(--serif); font-size: 1.6rem; line-height: 1.2; margin: .25rem 0 .6rem; }
.post-card h2 a { color: var(--ink); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }
.excerpt { margin: 0 0 1rem; max-width: 65ch; }
.card-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; }
.read { font-weight: 700; }

.post-meta { color: var(--muted); font-size: .9rem; margin: 0; }
.post-meta .sep { margin: 0 .4rem; opacity: .6; }

.share { display: flex; align-items: center; gap: .75rem; font-size: .85rem; color: var(--muted); }
.share a { color: var(--muted); text-decoration: none; }
.share a:hover { color: var(--accent); text-decoration: underline; }

.section-title { font-family: var(--serif); font-size: 1.4rem; margin: 2.5rem 0 .5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.year { font-size: 1rem; color: var(--muted); margin: 1.5rem 0 .5rem; font-weight: 700; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.archive-list time { color: var(--muted); font-size: .9rem; min-width: 4.5rem; font-variant-numeric: tabular-nums; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.side-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.side-block h2 { font-size: 1rem; margin: 0 0 .6rem; }
.side-block p { margin: 0 0 .75rem; font-size: .95rem; }
.intro h2 { font-family: var(--serif); font-size: 1.3rem; }
.more { font-weight: 700; font-size: .95rem; }
.currently { border-left: 4px solid var(--accent); }
.currently ul, .recent ol { margin: 0; padding-left: 1.1rem; font-size: .93rem; }
.currently li, .recent li { margin-bottom: .35rem; }
.social { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 1rem 0 0; padding: 0; font-size: .9rem; }

/* ── Post & page ────────────────────────────────────────── */
.post, .page { max-width: 720px; margin: 0 auto; padding: 3rem 0 4rem; }
.post-header { margin-bottom: 2rem; }
.post-header h1 { font-family: var(--serif); font-size: clamp(2rem, 4.5vw, 2.8rem); line-height: 1.12; letter-spacing: -.015em; margin: .35rem 0 .6rem; }
.lede { color: var(--muted); font-size: 1.15rem; margin: 0 0 1rem; }

.prose { font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; }
.prose > * { max-width: 68ch; }
.prose h2 { font-family: var(--sans); font-size: 1.4rem; margin: 2.5rem 0 .75rem; line-height: 1.3; }
.prose h3 { font-family: var(--sans); font-size: 1.15rem; margin: 2rem 0 .5rem; }
.prose li { margin-bottom: .35rem; }
.prose blockquote { margin: 1.5rem 0; padding: .25rem 1.25rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.prose th { background: var(--accent-soft); }
.prose code { font-family: var(--mono); font-size: .85em; background: var(--code-bg); padding: .1em .35em; border-radius: 4px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; overflow-x: auto; font-size: .9rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose .mermaid { max-width: 100%; margin: 1.5rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; text-align: center; }

.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.post-nav a { display: block; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.post-nav a:hover { border-color: var(--accent); }
.post-nav span { display: block; color: var(--muted); font-size: .85rem; }
.post-nav .next { grid-column: 2; text-align: right; }

/* Certifications */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; font-family: var(--sans); margin-bottom: 2rem; max-width: none !important; }
.cert { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.cert h2 { margin: .25rem 0; font-size: 1.2rem; }
.cert p { margin: 0; color: var(--muted); font-size: .95rem; }
.cert .cert-status { font-weight: 700; font-size: .85rem; }
.cert.earned { border-top: 4px solid var(--earned); }
.cert.earned .cert-status { color: var(--earned); }
.cert.progress { border-top: 4px dashed var(--accent); }
.cert.progress .cert-status { color: var(--accent); }

/* Skills & tools */
.skill-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 2rem; font-family: var(--sans); }
.skill {
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line);
  border-radius: 999px; padding: .35rem .9rem; font-size: .9rem; font-weight: 600;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 2rem 0 1.5rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.footer-name { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; margin: 0; }
.footer-desc { color: var(--muted); font-size: .9rem; max-width: 46ch; margin: .25rem 0 0; }
.footer-copy { color: var(--muted); font-size: .8rem; margin-top: 1.5rem; }

/* ── Syntax highlighting (Rouge) ────────────────────────── */
.highlight .c, .highlight .c1, .highlight .cm { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn { color: #8a4baf; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #2f7a4f; }
.highlight .m, .highlight .mi { color: #b0562b; }
.highlight .nf, .highlight .nb { color: var(--accent); }
:root[data-theme="dark"] .highlight .k { color: #c79ae6; }
:root[data-theme="dark"] .highlight .s, :root[data-theme="dark"] .highlight .s1, :root[data-theme="dark"] .highlight .s2 { color: #7fcf9f; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .layout-2col { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 2rem; }
  .brand-tag { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .nav { gap: .9rem; }
  .prose { font-size: 1.05rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
