:root {
  --bg: #ffffff;
  --text: #171717;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --code: #f5f5f5;
  --accent: #15803d;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1c1c1c;
  --text: #ececec;
  --muted: #a0a0a0;
  --line: #333333;
  --code: #262626;
  --accent: #4ade80;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1c;
    --text: #ececec;
    --muted: #a0a0a0;
    --line: #333333;
    --code: #262626;
    --accent: #4ade80;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--sans);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100dvh;
}

.side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.25rem 1rem 1.5rem;
  border-right: 1px solid var(--line);
  font-size: 15px;
}

.side-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.brand {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 650;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent);
}

.brand[aria-current="page"] {
  background: transparent !important;
  color: var(--text);
}

.menu {
  display: grid;
  gap: .15rem;
  margin-bottom: 1.5rem;
}

.menu a,
#files a {
  display: block;
  padding: .3rem .6rem;
  margin-inline: 0;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

#files a {
  color: var(--text);
  padding-block: .4rem;
}

.menu a:hover,
#files a:hover {
  color: var(--accent);
}

a[aria-current="page"] {
  background: var(--code);
  color: var(--accent);
  font-weight: 600;
}

#files {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: .5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

#files details {
  margin-bottom: 1rem;
}

#files summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  padding: .25rem 0;
}

#theme {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: -8px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
}

#theme:hover {
  color: var(--accent);
  background: var(--code);
}

.col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

main {
  flex: 1;
  width: 100%;
  max-width: 58rem;
  margin-inline: auto;
  padding: 3.5rem 3rem 4rem;
}

footer {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 58rem;
  margin-inline: auto;
  padding: 1.5rem 3rem;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
}

footer a {
  color: var(--muted);
}

h1,
h2,
h3 {
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.02em;
}

h1 {
  font-size: 1.8rem;
  margin: 0 0 1rem;
}

section {
  margin-bottom: 3.5rem;
}

h2 {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
  margin: 0 0 .75rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
}

.row .t {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.row:hover .t {
  color: var(--accent);
}

.row time,
.meta {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.list p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

article h1 {
  font-size: clamp(2rem, 5vw, 2.6rem);
  margin: 1.5rem 0 .75rem;
}

.back {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.back:hover {
  color: var(--accent);
}

.meta {
  display: flex;
  gap: 1.25rem;
  margin: 0 0 1.5rem;
}

.actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 2.5rem;
}

.actions a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .3rem .9rem;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.actions a:hover {
  border-color: var(--accent);
}

.prose {
  font-size: 18px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.prose h2 {
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 650;
  margin: 2.8rem 0 .8rem;
}

.prose h3 {
  font-size: 1.2rem;
  margin: 2rem 0 .6rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.prose code {
  font: .88em ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code);
  padding: .15em .35em;
  border-radius: 4px;
}

.prose pre {
  background: var(--code);
  padding: 1.1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 14.5px;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  text-align: left;
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 800px) {
  .shell {
    display: block;
  }

  .side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 1.25rem 1.5rem;
  }

  #files {
    max-height: 50vh;
  }

  main {
    padding: 2rem 1.5rem 3rem;
  }

  footer {
    padding: 1.5rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .prose {
    font-size: 17px;
  }

  .row {
    flex-direction: column;
    gap: 0;
  }
}

@media print {

  .side,
  footer,
  .back {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
    max-width: none;
  }
}