:root {
  color-scheme: light;
  --paper: #fff;
  --logo-light-display: block;
  --logo-dark-display: none;
  --ink: #111;
  --muted: #666;
  --rule: #ddd;
  --link-rule: #999;
  --code-bg: #f7f7f7;
  --code-inline-bg: #f3f3f3;
  --syntax-comment: #6a737d;
  --syntax-keyword: #9c2f48;
  --syntax-string: #286329;
  --syntax-name: #185a9d;
  --syntax-number: #7a4e00;
  --syntax-error: #b31d28;
  --syntax-inserted: #287a3d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #121212;
    --logo-light-display: none;
    --logo-dark-display: block;
    --ink: #e8e8e8;
    --muted: #aaa;
    --rule: #3a3a3a;
    --link-rule: #777;
    --code-bg: #1b1b1b;
    --code-inline-bg: #252525;
    --syntax-comment: #9a9a9a;
    --syntax-keyword: #ff7b9c;
    --syntax-string: #8dcc85;
    --syntax-name: #7db7e8;
    --syntax-number: #e2b86b;
    --syntax-error: #ff8b8b;
    --syntax-inserted: #82c991;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121212;
  --logo-light-display: none;
  --logo-dark-display: block;
  --ink: #e8e8e8;
  --muted: #aaa;
  --rule: #3a3a3a;
  --link-rule: #777;
  --code-bg: #1b1b1b;
  --code-inline-bg: #252525;
  --syntax-comment: #9a9a9a;
  --syntax-keyword: #ff7b9c;
  --syntax-string: #8dcc85;
  --syntax-name: #7db7e8;
  --syntax-number: #e2b86b;
  --syntax-error: #ff8b8b;
  --syntax-inserted: #82c991;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.65;
}

.wrapper {
  width: calc(100% - 2.5rem);
  max-width: 42rem;
  margin-inline: auto;
}

a {
  color: inherit;
  text-decoration-color: var(--link-rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: var(--ink);
}

.site-header {
  padding: 2.5rem 0 1.5rem;
}

.site-header .wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.5rem, 2vw, 1.5rem);
}

.site-title,
.site-nav,
.post-meta,
.site-footer {
  font-family: Arial, Helvetica, sans-serif;
}

.site-title {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  display: block;
  width: 5rem;
  text-decoration: none;
}

.site-title:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.site-logo {
  width: 100%;
  height: auto;
}

.site-logo-light {
  display: var(--logo-light-display);
  mix-blend-mode: multiply;
}

.site-logo-dark {
  display: var(--logo-dark-display);
  mix-blend-mode: lighten;
}

.site-nav {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.8rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.theme-toggle {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-around;
  align-self: center;
  width: 3.25rem;
  height: 1.75rem;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.75rem - 6px);
  height: calc(1.75rem - 6px);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule);
}

:root[data-theme="dark"] .theme-toggle::before {
  left: calc(100% - 1.75rem + 3px);
}

.theme-icon {
  position: relative;
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="light"] .theme-icon:first-child,
:root[data-theme="dark"] .theme-icon:last-child {
  color: var(--ink);
}

.theme-toggle:hover {
  color: var(--ink);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.page-content {
  min-height: calc(100vh - 13rem);
  padding: 3.5rem 0 5rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: 2.5rem;
  font-weight: 600;
}

h2 {
  margin: 2.75rem 0 1rem;
  font-size: 1.45rem;
  font-weight: 600;
}

h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.1rem;
}

p,
ul,
ol,
blockquote,
pre {
  margin: 0 0 1.35rem;
}

ul,
ol {
  padding-left: 1.4rem;
}

blockquote {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

.home > p:first-child {
  max-width: 32rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.home h2 {
  margin-top: 4rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-list h3 {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.post-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-link {
  text-decoration: none;
}

.post-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.post-header,
.page-header {
  margin-bottom: 3rem;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.category {
  margin-left: 0.25rem;
}

.post-content {
  margin-bottom: 4rem;
}

code {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas,
    "Liberation Mono", Menlo, Monaco, monospace;
  font-size: 0.82em;
}

:not(pre) > code {
  padding: 0.12rem 0.3rem;
  background: var(--code-inline-bg);
}

pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  background: var(--code-bg);
  line-height: 1.4;
}

.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs {
  color: var(--syntax-comment);
  font-style: italic;
}

.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt {
  color: var(--syntax-keyword);
  font-weight: 600;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sr,
.highlight .ss,
.highlight .sx {
  color: var(--syntax-string);
}

.highlight .na,
.highlight .nb,
.highlight .nc,
.highlight .nf,
.highlight .nn,
.highlight .nt {
  color: var(--syntax-name);
}

.highlight .bp,
.highlight .il,
.highlight .m,
.highlight .mb,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo {
  color: var(--syntax-number);
}

.highlight .err,
.highlight .gd {
  color: var(--syntax-error);
}

.highlight .gi {
  color: var(--syntax-inserted);
}

.mermaid {
  margin: 2rem 0;
  overflow-x: auto;
  text-align: center;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

.site-footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.72rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 34rem) {
  html {
    font-size: 16px;
  }

  .site-header {
    padding-top: 1.5rem;
  }

  .page-content {
    padding-top: 2.5rem;
  }

  h1 {
    font-size: 2rem;
  }
}
