:root {
  color-scheme: light;
  --bg:      #ffffff;
  --panel:   #f5f5f5;
  --text:    #0d1a0f;
  --muted:   #5a6b5c;
  --accent:  #1a6b2e;
  --border:  #dde0dd;
  --code-bg: #f0f0f0;
  --max-width: 47.5rem;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:      #0f1711;
  --panel:   #162019;
  --text:    #cadacb;
  --muted:   #7a9880;
  --accent:  #5ec47a;
  --border:  #233228;
  --code-bg: #0d1510;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.72;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--panel);
  color: var(--text);
  border: 0.0625rem solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: 0.4rem;
}

.site-header,
.site-footer {
  border-bottom: 0.0625rem solid var(--border);
}

.site-footer {
  border-top: 0.0625rem solid var(--border);
  border-bottom: 0;
  margin-top: 4rem;
  color: var(--muted);
}

.site-header .container,
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0;
}

.site-title {
  color: var(--text);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.3rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.theme-toggle {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--muted);
  border-radius: 999px;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.theme-icon {
  display: inline-flex;
  line-height: 1;
}

.theme-icon svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle:focus-visible {
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav a[aria-current="page"],
.nav a:hover,
a:hover,
.theme-toggle:hover {
  color: var(--text);
}

main {
  padding-block: 2.25rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
  font-weight: 500;
}

h1 {
  font-size: 2.35rem;
}

h2 {
  margin-top: 2.5rem;
  font-size: 2rem;
}

h3 {
  font-size: 1.25rem;
}

p,
ul,
ol,
pre,
blockquote {
  margin: 0 0 1.25rem;
}

a {
  color: inherit;
  text-decoration-thickness: 0.0625rem;
  text-underline-offset: 0.12em;
}

.intro p {
  color: var(--muted);
  max-width: 38ch;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
}

.post-list li {
  border-bottom: 0.0625rem solid var(--border);
  padding: 1.25rem 0;
}

.post-list li:last-child {
  border-bottom: 0;
}

.post-list li > :last-child {
  margin-bottom: 0;
}

.post-list h3 {
  margin: 0.2rem 0 0;
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 500;
}

.post-list h3 a {
  text-decoration: none;
}

.read-more {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.87rem;
  color: var(--accent);
  text-decoration: none;
}

.read-more:hover {
  text-decoration: underline;
  color: var(--accent);
}

.post-header h1 {
  font-size: 2.35rem;
  font-weight: 500;
}

.post-meta {
  color: var(--muted);
  font-size: 0.9em;
  margin: 0;
}

.post-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.copy-post-md {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75em;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 0.0625rem;
  text-underline-offset: 0.12em;
}

.copy-post-md:hover {
  color: var(--text);
}

.post-summary {
  color: var(--muted);
  margin: 0.45rem 0 0;
}

.post-content {
  margin-top: 1.2rem;
}

.post-content img {
  max-width: 100%;
  border-radius: 0.5rem;
}

.post-content {
  overflow-wrap: break-word;
}

code,
pre,
.highlight {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

code {
  background: var(--code-bg);
  border: 0.0625rem solid var(--border);
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
}

.post-content pre {
  background: var(--code-bg);
  border: 0.0625rem solid var(--border);
  border-radius: 0.6rem;
  padding: 1rem 1.1rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.post-content .highlight {
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.post-content .highlight pre {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 0.0625rem solid var(--border);
  border-radius: 0.6rem;
  background: var(--code-bg);
  white-space: pre-wrap;
  word-break: break-word;
}

pre code,
.highlight code {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.85em;
}

.code-shell {
  margin: 0 0 1.3rem;
}

.code-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.45rem;
}

.code-language {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.copy-code {
  margin: 0;
  background: transparent;
  color: var(--muted);
  border: 0.0625rem solid var(--border);
  border-radius: 0.4rem;
  font: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.copy-code:hover {
  color: var(--text);
}

@media (max-width: 40rem) {
  .container {
    width: min(100% - 1.5rem, var(--max-width));
  }

  .site-header .container,
  .site-footer .container {
    padding: 0.85rem 0;
  }

  .nav {
    gap: 1rem;
  }

  main {
    padding-block: 1.75rem;
  }

  .post-list li {
    padding: 0.85rem 0;
  }

  h1,
  .post-header h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.65rem;
    margin-top: 2rem;
  }

  .post-list h3 {
    font-size: 1.5rem;
  }

  .post-summary {
    margin-top: 0.4rem;
  }
}
