:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --surface: #f6f8fa;
  --accent: #306998;
  --accent-fg: #ffffff;
  --link: #0a58ca;
  --code-bg: #f6f8fa;
  --inline-code-bg: #eff1f3;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #e6e9ec;
    --muted: #9aa5b1;
    --border: #2e353c;
    --surface: #1c2126;
    --accent: #1f3f5c;
    --link: #7db7f0;
    --code-bg: #272822;
    --inline-code-bg: #2a3036;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
}

a { color: var(--link); }
img { max-width: 100%; height: auto; }

.wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link {
  position: absolute;
  left: -999px;
}
.skip-link:focus { left: 0; top: 0; background: var(--bg); padding: .5rem; z-index: 10; }

/* Header */
.site-header {
  background: var(--accent);
  color: var(--accent-fg);
  padding: .75rem 0;
}
.site-header .wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
}
.site-header a { color: var(--accent-fg); text-decoration: none; }
.site-title { font-weight: 700; font-size: 1.15rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .95rem; }
.site-nav a { padding: .15rem 0; border-bottom: 2px solid transparent; opacity: .9; }
.site-nav a:hover, .site-nav a.active { border-bottom-color: currentColor; opacity: 1; }

main { padding: 2rem 0 3rem; min-height: 60vh; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
  padding: 1.25rem 0;
}
.site-footer .wrapper { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }

/* Headings & intro */
.page-title, .post-title { font-size: 2.1rem; line-height: 1.2; margin: 0 0 .5rem; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 .75rem; }
.page-intro { margin-bottom: 1.5rem; }

.post-meta { color: var(--muted); font-size: .85rem; margin: 0 0 1rem; }
.breadcrumb { font-size: .85rem; margin: 0 0 .5rem; }

.hero {
  height: 240px;
  margin: 0 -1.25rem 1.5rem;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
}

/* Tags */
.tag {
  display: inline-block;
  margin-left: .35rem;
  padding: 0 .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .75rem;
  text-decoration: none;
}
a.tag:hover { border-color: var(--link); color: var(--link); }
.tag-index .tag { margin: 0 .35rem .5rem 0; font-size: .85rem; }

/* Cards (post lists) */
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list li + li { margin-top: 1rem; }
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  background: var(--surface);
}
.card-title { font-size: 1.3rem; line-height: 1.3; margin: 0 0 .25rem; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card .post-meta { margin-bottom: .5rem; }
.card-text { margin: 0; font-size: .95rem; }

.pagination, .post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}
.pagination { align-items: center; color: var(--muted); font-size: .9rem; }
.post-nav { border-top: 1px solid var(--border); padding-top: 1.25rem; font-size: .95rem; }
.post-nav .next { margin-left: auto; text-align: right; }
.post-nav small { color: var(--muted); }

.archive { padding-left: 1.25rem; }
.archive time { color: var(--muted); font-size: .85rem; margin-right: .5rem; }

/* Post content */
.post-content h2 { font-size: 1.6rem; line-height: 1.25; margin: 2.25rem 0 .75rem; }
.post-content h3 { font-size: 1.3rem; margin: 1.75rem 0 .5rem; }
.post-content p, .post-content ul, .post-content ol { margin: 0 0 1.1rem; }
.post-content li { margin-bottom: .3rem; }
.post-content blockquote {
  margin: 1.25rem 0;
  padding: .1rem 1.25rem;
  border-left: 4px solid var(--border);
  color: var(--muted);
}
.post-content table { border-collapse: collapse; margin: 0 0 1.1rem; display: block; overflow-x: auto; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: .4rem .75rem; }
.post-content::after { content: ""; display: block; clear: both; }

/* Code */
code, pre { font-family: var(--font-mono); }
:not(pre) > code {
  background: var(--inline-code-bg);
  border-radius: 4px;
  padding: .1em .35em;
  font-size: .88em;
  overflow-wrap: anywhere;
}
div.highlighter-rouge {
  position: relative;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
}
.highlight { background: var(--code-bg); border-radius: 6px; }
.highlight pre, pre.highlight {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.5;
  tab-size: 4;
  background: transparent;
}
.highlight code { background: none; padding: 0; font-size: inherit; }

.copy-button {
  position: absolute;
  top: .4rem;
  right: .4rem;
  padding: .15rem .55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
div.highlighter-rouge:hover .copy-button, .copy-button:focus { opacity: 1; }

/* Video embeds (include youtube.html / vimeo.html, or any raw <iframe>) */
.video {
  position: relative;
  width: 100%;
  margin: 0 0 1.25rem;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.post-content > iframe { max-width: 100%; }

/* Figures (include figure.html) */
.figure { margin: 0 0 1.25rem; }
.figure img { display: block; margin: 0 auto; border: 1px solid var(--border); border-radius: 4px; }
.figure figcaption { margin-top: .4rem; text-align: center; color: var(--muted); font-size: .85rem; line-height: 1.4; }
.figure figcaption.credit { font-style: italic; margin-top: 0; }
.figure-left, .figure-right { width: min(var(--figure-width, 420px), 100%); }
@media (min-width: 700px) {
  .figure-left { float: left; margin: .25rem 1.5rem 1rem 0; }
  .figure-right { float: right; margin: .25rem 0 1rem 1.5rem; }
}

@media (max-width: 600px) {
  body { font-size: 17px; }
  .page-title, .post-title { font-size: 1.7rem; }
}
