:root {
  --color-bg: #fdfdfd;
  --color-surface: #fff;
  --color-text: #000;
  --color-text-muted: #666;
  --color-link: #1d4e89;
  --color-link-visited: #4b5a86;
  --color-border: #ccc;
  --color-border-strong: #666;
  --color-brand: #1f3a5f;
  --color-brand-accent: #2a4d7a;
  --color-brand-light: #e3eaf3;
  --color-brand-hover: #c9d7ea;
  --color-code-bg: #f1f4f8;
  --color-highlight: #fff1a8;
  --content-width: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #161b22;
    --color-surface: #1c232d;
    --color-text: #e8e8e8;
    --color-text-muted: #a0a0a0;
    --color-link: #7eb8ff;
    --color-link-visited: #a9b8d8;
    --color-border: #444;
    --color-border-strong: #888;
    --color-brand: #172842;
    --color-brand-accent: #7aa2d6;
    --color-brand-light: #1e2a3a;
    --color-brand-hover: #2a3a50;
    --color-code-bg: #1e2530;
    --color-highlight: #5a4d18;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--color-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a:link {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

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

a:hover,
a:focus-visible {
  border-bottom-style: dotted;
}

button,
input {
  font: inherit;
}

button,
input[type="submit"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-brand-accent);
  outline-offset: 3px;
}

.site-header {
  color: #fff;
  background: var(--color-brand);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--content-width), 100%);
  min-height: 3rem;
  margin: 0 auto;
  padding: 0.3rem 1.25rem;
}

.site-brand,
.site-brand:link,
.site-brand:visited,
.site-brand:hover,
.site-brand:focus {
  color: #fff;
  border: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: normal;
  line-height: 1.2;
}

.header-blog,
.header-blog:link,
.header-blog:visited,
.header-blog:hover,
.header-blog:focus {
  color: #fff;
  border: 0;
  font-size: 1.05rem;
  text-decoration: none;
}

.header-blog:hover,
.header-blog:focus-visible {
  border-bottom: 0;
}

.site-main {
  width: min(var(--content-width), 100%);
  margin: 0 auto;
  padding: 2.4rem 1.25rem 4rem;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  column-gap: 2.5rem;
  row-gap: 2rem;
  align-items: start;
}

.home-intro {
  grid-column: 1 / -1;
}

.home-content {
  min-width: 0;
}

.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 1.25rem;
}

.sidebar-box {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.sidebar-box h2 {
  margin: 0;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.facet-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.facet-chip,
.facet-chip:link,
.facet-chip:visited {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-brand-light);
  font-size: 0.875rem;
  text-decoration: none;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.facet-chip:hover,
.facet-chip:focus-visible {
  color: var(--color-text);
  border-color: var(--color-brand-accent);
  background: var(--color-brand-hover);
}

.facet-count {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78em;
}

.page-title,
.entry-detail h1,
.archive-page h1,
.topic-page h1,
.search-page h1 {
  margin: 0 0 0.55rem;
  color: var(--color-text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 2.7rem);
  font-weight: normal;
  line-height: 1.12;
}

h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: normal;
  line-height: 1.25;
}

h2 {
  margin: 2rem 0 0.7rem;
  font-size: 1.45rem;
}

h3 {
  margin: 0;
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

.lede {
  max-width: 62ch;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.feed-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.feed-title {
  margin: 0;
  color: var(--color-text);
  font-family: inherit;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
}

.feed-header .feed-link {
  align-self: center;
  margin-top: 0;
}

.feed-header .lede {
  flex-basis: 100%;
  max-width: none;
  margin: 0;
}

.page-toolbar,
.section-heading-row,
.entry-heading,
.entry-meta,
.topic-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.page-toolbar {
  align-items: center;
  margin: 1.4rem 0 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

.feed-link,
.feed-link:link,
.feed-link:visited,
.feed-link:hover,
.feed-link:focus-visible {
  font-size: 0.95rem;
  color: var(--color-link);
  border: 0;
  text-decoration: none;
}

.feed-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.feed-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.search-form {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  max-width: 38rem;
  margin: 1rem 0 2.2rem;
}

.home-intro .search-form {
  flex-basis: 100%;
  width: 100%;
  max-width: 36rem;
  margin: 0.45rem 0 0;
}

.search-input {
  min-width: 0;
  flex: 1;
  padding: 4px;
  color: var(--color-text);
  border: 1px solid var(--color-brand);
  border-radius: 0;
  background: var(--color-bg);
  font-size: 16px;
}

.search-submit {
  padding: 4px;
  color: #fff;
  border: 1px solid var(--color-brand);
  border-radius: 0;
  background: var(--color-brand);
  font-size: 16px;
}

.home-intro .search-input:focus,
.home-intro .search-input:focus-visible {
  padding: 3px;
  border: 2px solid #0b57d0;
  border-radius: 4px;
  outline: 0;
}

.home-intro .search-submit:focus-visible {
  outline: auto;
  outline-offset: 0;
}

.section-heading-row {
  align-items: center;
  margin-top: 2.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
}

.section-heading-row h2 {
  margin: 0;
}

.home-content .section-heading-row {
  justify-content: flex-start;
  margin-top: 0;
  padding: 0 0 0.35rem;
  border-bottom: 0;
}

.home-content .section-heading-row h2 {
  margin: 0;
  color: var(--color-text);
  font-family: inherit;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
}

.home-content .section-count {
  color: var(--color-text);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
}

.section-count,
.meta-date,
.entry-meta,
.topic-count,
.search-empty {
  color: var(--color-text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.76rem;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.9rem 0 2.2rem;
}

.topic-index .topic-list {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0;
}

.topic-chip,
.topic-chip:link,
.topic-chip:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-brand-light);
  text-decoration: none;
}

.topic-chip:hover,
.topic-chip:focus-visible {
  background: var(--color-brand-hover);
}

.topic-count {
  color: var(--color-text-muted);
  font-size: 0.7rem;
}

.entry-list,
.archive-list,
.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-card {
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--color-border);
}

.home-content .entry-card {
  padding: 1.1rem 0 1.35rem;
}

.home-content .entry-heading {
  display: block;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.home-content .entry-topic,
.home-content .entry-topic:link,
.home-content .entry-topic:visited {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.06rem 0.28rem;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: 0;
  background: var(--color-border);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  vertical-align: baseline;
}

.home-content .entry-topic:hover,
.home-content .entry-topic:focus-visible {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-brand-hover);
}

.home-content .entry-title {
  display: inline;
  margin: 0;
  color: var(--color-text);
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.home-content .entry-title a,
.home-content .entry-title a:link {
  color: var(--color-link);
  border-bottom: 1px solid currentColor;
}

.home-content .entry-title a:visited {
  color: var(--color-link-visited);
}

.home-content .entry-date {
  color: var(--color-text);
  font-size: 1.35rem;
  font-weight: 700;
}

.home-content .entry-date .meta-date {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

.home-content .entry-summary {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.5;
}

.home-content > p:last-child {
  font-size: 1.1rem;
}

.entry-card:first-child {
  border-top: 0;
}

.entry-heading {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.entry-heading h3 {
  flex: 1 1 18rem;
}

.entry-heading h3 a {
  border-bottom: 0;
}

.entry-heading h3 a:hover,
.entry-heading h3 a:focus-visible {
  border-bottom: 1px dotted currentColor;
}

.entry-summary {
  max-width: 70ch;
  margin: 0;
  color: var(--color-text-muted);
}

.entry-summary p:last-child {
  margin-bottom: 0;
}

.entry-detail {
  max-width: 760px;
  margin: 0 auto;
}

.entry-detail-header {
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.entry-detail h1 {
  margin-top: 0.6rem;
}

.prose {
  font-size: 1.02rem;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin-top: 0;
  margin-bottom: 1.2rem;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose ul {
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose img,
.prose video,
.prose iframe {
  max-width: 100%;
}

.prose blockquote {
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--color-brand-accent);
  background: var(--color-brand-light);
}

.prose pre,
.search-snippet {
  overflow: auto;
  padding: 0.75rem 0.9rem;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prose code {
  padding: 0.08em 0.3em;
  border-radius: 3px;
  background: var(--color-code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.prose pre code {
  padding: 0;
  background: transparent;
}

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

.prose th,
.prose td {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--color-code-bg);
  font-weight: bold;
}

.entry-meta {
  display: block;
  margin-top: 2rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--color-border);
  line-height: 1.7;
}

.entry-meta a {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
}

.related-heading {
  margin-top: 2.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.related-list li,
.archive-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--color-border);
}

.archive-list a {
  margin-right: 0.5rem;
}

.topic-feed-header {
  position: relative;
  display: block;
  margin-bottom: 1.1rem;
}

.topic-page .topic-title {
  margin: 0;
  padding-right: 2rem;
  color: var(--color-text);
  font-family: inherit;
  font-size: clamp(2rem, 4vw, 2.7rem);
  font-weight: 700;
  line-height: 1.1;
}

.topic-feed-header .feed-link {
  position: absolute;
  top: 0.25rem;
  right: 0;
}

.topic-page .entry-card {
  padding: 1.1rem 0 1.35rem;
}

.topic-page .entry-heading {
  display: block;
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.topic-page .entry-topic,
.topic-page .entry-topic:link,
.topic-page .entry-topic:visited {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.06rem 0.28rem;
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: 0;
  background: var(--color-border);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  vertical-align: baseline;
}

.topic-page .entry-topic:hover,
.topic-page .entry-topic:focus-visible {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-brand-hover);
}

.topic-page .entry-title {
  display: inline;
  margin: 0;
  color: var(--color-text);
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
}

.topic-page .entry-title a,
.topic-page .entry-title a:link {
  color: var(--color-link);
  border-bottom: 1px solid currentColor;
}

.topic-page .entry-title a:visited {
  color: var(--color-link-visited);
}

.topic-page .entry-date {
  color: var(--color-text);
  font-size: 1.35rem;
  font-weight: 700;
}

.topic-page .entry-date .meta-date {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
}

.topic-page .entry-summary {
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.5;
}

.topic-section + .topic-section {
  margin-top: 2.1rem;
}

.topic-section-title {
  margin: 0 0 0.7rem;
  padding: 0;
  border: 0;
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.topic-section-title a {
  color: var(--color-text);
  border-bottom: 0;
}

.archive-page .archive-list {
  margin: 0;
  padding-left: 1.5rem;
  list-style: disc;
}

.archive-page .archive-list li {
  padding: 0.18rem 0;
  border: 0;
  line-height: 1.45;
}

.archive-page .archive-list a {
  margin-right: 0;
  font-size: 1.1rem;
}

.archive-page .archive-list .meta-date {
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

.search-page .search-form {
  margin-bottom: 1.5rem;
}

.search-result .search-snippet {
  margin: 0.5rem 0 0;
}

.search-snippet strong {
  padding: 0 0.15em;
  background: var(--color-highlight);
}

.search-empty {
  margin: 1rem 0;
}

@media (prefers-color-scheme: dark) {
  :root .pl-smi,
  :root .pl-s .pl-s1,
  :root .pl-mi,
  :root .pl-mb {
    color: #c9d1d9;
  }

  :root .pl-c,
  :root .pl-ba,
  :root .pl-sg {
    color: #8b949e;
  }

  :root .pl-c1,
  :root .pl-mh,
  :root .pl-ms {
    color: #79c0ff;
  }

  :root .pl-e,
  :root .pl-en,
  :root .pl-mdr {
    color: #d2a8ff;
  }

  :root .pl-ent,
  :root .pl-sr .pl-cce,
  :root .pl-mi1 {
    color: #7ee787;
  }

  :root .pl-k,
  :root .pl-bu,
  :root .pl-mc,
  :root .pl-err {
    color: #ff7b72;
  }

  :root .pl-s,
  :root .pl-sr,
  :root .pl-corl {
    color: #a5d6ff;
  }

  :root .pl-v,
  :root .pl-ml {
    color: #ffa657;
  }
}

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

@media (max-width: 760px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .home-sidebar {
    position: static;
    gap: 1.2rem;
  }
}

@media (max-width: 640px) {
  .site-header__inner {
    padding: 0.75rem 1rem;
  }

  .site-main {
    padding: 1.8rem 1rem 3rem;
  }

  .page-toolbar,
  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .entry-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .entry-heading h3 {
    flex-basis: auto;
  }

  .search-form {
    width: 100%;
  }
}
