:root {
  --bg: #ffffff;
  --fg: #000000;
  --border: #e5e5e5;
  --sidebar-width: 260px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --border: #262626;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Times New Roman', Times, serif;
  font-size: 18px;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  --pad-x: 1.35rem;
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 var(--sidebar-width);
  flex-direction: column;
  gap: 1.25rem;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 2rem var(--pad-x);
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.site-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.theme-toggle {
  align-self: stretch;
  margin: auto calc(var(--pad-x) * -1) 0;
  padding: 1.25rem var(--pad-x) 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.nav {
  margin: 0 calc(var(--pad-x) * -1);
  padding: 1.25rem var(--pad-x) 0;
  border-top: 1px solid var(--border);
}

.nav ul {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: block;
  line-height: 1.35;
  text-decoration: none;
}

.nav a:hover .title,
.nav a.active .title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nav a.active {
  font-weight: 700;
}

.nav .title {
  display: block;
}

.nav .date {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  opacity: 0.55;
}

.empty {
  margin: 0;
  opacity: 0.55;
}

.main {
  display: flex;
  flex: 1;
  justify-content: center;
  min-width: 0;
  padding: 4rem 3rem 6rem;
}

.article {
  width: 100%;
  max-width: 65ch;
}

.article > :first-child {
  margin-top: 0;
}

.article h1,
.article h2,
.article h3,
.article h4 {
  font-weight: 700;
  line-height: 1.25;
}

.article h1 {
  margin: 0 0 1.4rem;
  font-size: 2.5rem;
}

.article h2 {
  margin: 2.5rem 0 0.9rem;
  font-size: 1.6rem;
}

.article h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.3rem;
}

.article h4 {
  margin: 1.75rem 0 0.6rem;
  font-size: 1.1rem;
}

.article p,
.article ul,
.article ol,
.article blockquote,
.article pre,
.article table {
  margin: 0 0 1.4em;
}

.article ul,
.article ol {
  padding-left: 1.4em;
}

.article li {
  margin: 0.25em 0;
}

.article blockquote {
  margin-right: 0;
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
  opacity: 0.85;
}

.article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem 0;
}

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

.article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

.article :not(pre) > code {
  padding: 0.1em 0.3em;
  border: 1px solid var(--border);
}

.article pre {
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  line-height: 1.5;
}

.article pre code {
  padding: 0;
  border: 0;
}

.article table {
  width: 100%;
  border-collapse: collapse;
}

.article th,
.article td {
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  text-align: left;
}

@media (max-width: 760px) {
  .layout {
    display: block;
  }

  .sidebar {
    --pad-x: 1.25rem;
    position: static;
    width: auto;
    height: auto;
    padding: 1.5rem var(--pad-x);
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav ul {
    gap: 0.8rem;
  }

  .main {
    padding: 2.5rem 1.25rem 4rem;
  }

  .article h1 {
    font-size: 2rem;
  }
}
