﻿:root {
  color-scheme: light;
  --bg: #fdfcf7;
  --text: #111111;
  --muted: #555555;
  --link: #0645ad;
  --link-visited: #0b0080;
  --border: #d8d8d8;
  --max-width: 820px;
  --toc-width: 200px;
}

@import url('https://fonts.googleapis.com/css2?family=Baskervville:ital@0;1&family=Gentium+Plus:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #1a1a1a;
  --text: #e6e6e6;
  --muted: #aaaaaa;
  --link: #8fb1ff;
  --link-visited: #c0a7ff;
  --border: #2d2f33;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Gentium Plus', serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--link);
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration: underline;
}

.page {
  max-width: calc(var(--max-width) + 80px);
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.brand a {
  font-weight: 700;
  font-size: 2rem;
  text-transform: uppercase;
  text-decoration: none;
  font-family: "Gentium Plus", serif;
  letter-spacing: 0.08em;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 14px;
  margin-left: auto;
}

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

.nav-link.active {
  text-decoration: underline;
}

.theme-toggle {
  background: var(--bg);
  /* border: 1px solid var(--border); */
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  font: inherit;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.content {
  max-width: var(--max-width);
}

.hero {
  margin-bottom: 24px;
}

.hero-kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.hero-description {
  margin: 0;
  color: var(--muted);
}

.post-list {
  display: grid;
  /* gap: 2px; */
}

.post-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-card-title {
  margin: 0;
  font-size: 1.15rem;
}

.post-card-title a {
  color: var(--link);
  text-decoration: none;
  font-size: 1rem;
  font-weight: normal;
}

.post-card-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 16px;
}

.post {
  max-width: var(--max-width);
}

.post-header h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.post-meta {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
}

.post-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-width);
  gap: 24px;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 0rem;
  margin-bottom:0.25rem;
}

.post-content blockquote {
  margin: 0px 0;
  padding: 0 12px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.post-content pre {
  padding: 12px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.post-content code {
  font-family: inherit;
  font-size: 0.95em;
}

.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
}

.post-toc {
  border-left: 1px dotted var(--border);
  padding-left: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.post-toc::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.toc-title {
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
}

#toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

#toc a {
  display: block;
}

#toc li[data-level="1"] a {
  font-weight: 700;
  text-decoration: none;
}

#toc li[data-level="2"] a {
  padding-left: 8px;
  font-size: 0.95em;
   text-decoration: none;
}

#toc li[data-level="3"] a {
  padding-left: 16px;
  font-size: 0.9em;
  text-decoration: none;
}

#toc li[data-level="4"] a {
  padding-left: 24px;
  font-size: 0.85em;
  text-decoration: none;
}

#toc li[data-level="5"] a {
  padding-left: 32px;
  font-size: 0.82em;
  text-decoration: none;
}

.about-content {
  max-width: var(--max-width);
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 32px;
  padding-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.site-footer .theme-toggle {
  margin-left: auto;
}

.site-footer a {
  text-decoration: none;
  color: var(--link);
}

.muted {
  color: var(--muted);
}

.footnotes {
  margin-top: 32px;
  font-size: 0.9rem;
  color: var(--muted);
}

.footnotes hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 16px;
}

.footnotes ol {
  padding-left: 18px;
}

.footnote-backref {
  margin-left: 8px;
  font-size: 0.85em;
}

sup a {
  text-decoration: none;
}

@media (min-width: 901px) {
  #toc a.toc-active {
    text-decoration: underline;
  }
}

@media (max-width: 900px) {
  .post-layout {
    display: flex;
    flex-direction: column;
  }

  .post-toc {
    position: static;
    order: -1;
    border-left: none;
    border-top: 1px dotted var(--border);
    padding-left: 0;
    padding-top: 12px;
    margin-bottom: 16px;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 20px 16px 50px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-content img {
    max-width: 100%;
    width: 100%;
  }
}
