:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #5b6661;
  --line: #d9dfdc;
  --paper: #ffffff;
  --wash: #f3f7f5;
  --accent: #bd2c22;
  --accent-dark: #8f211a;
  --code: #17201d;
  --code-ink: #e9f0ed;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 72px,
    var(--paper);
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

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

.site-header,
.site-footer {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header {
  min-height: 72px;
  border-bottom: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.site-name {
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  text-decoration: none;
}

.site-footer {
  min-height: 120px;
  margin-top: 96px;
  border-top: 1px solid var(--ink);
  font-size: 14px;
  color: var(--muted);
}

.home-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.home-intro {
  min-height: 420px;
  padding: 96px 0 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.6fr);
  gap: 72px;
  align-items: end;
}

.home-intro h1 {
  margin: 0;
  max-width: 760px;
  font-family: "Source Serif 4", serif;
  font-size: 64px;
  line-height: 1.02;
  letter-spacing: 0;
}

.home-intro p {
  margin: 0;
  padding-left: 20px;
  border-left: 4px solid var(--accent);
  font-size: 17px;
  line-height: 1.7;
  color: var(--muted);
}

.section-label,
.article-kicker {
  margin: 0 0 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-dark);
  text-transform: uppercase;
}

.article-index {
  padding: 48px 0 80px;
  border-top: 1px solid var(--ink);
}

.article-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 120px;
  gap: 32px;
  align-items: baseline;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.article-row time,
.article-row span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.article-row a {
  color: var(--ink);
  font-family: "Source Serif 4", serif;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.article-row a:hover {
  color: var(--accent-dark);
}

.article-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.article-header {
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--ink);
}

.article-header h1 {
  margin: 0;
  max-width: 900px;
  font-family: "Source Serif 4", serif;
  font-size: 56px;
  line-height: 1.08;
  letter-spacing: 0;
}

.article-summary {
  max-width: 760px;
  margin: 28px 0 0;
  font-size: 19px;
  line-height: 1.7;
  color: var(--muted);
}

.article-meta {
  display: flex;
  gap: 24px;
  margin-top: 32px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.article-content-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  gap: 56px;
  justify-content: start;
}

.article-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  margin-top: 64px;
  padding: 0 24px 16px 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  font-family: "IBM Plex Sans", sans-serif;
}

.article-toc-label {
  margin: 0 0 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

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

.article-toc li {
  position: relative;
}

.article-toc > nav > ol > li + li {
  margin-top: 3px;
}

.article-toc li > ol {
  margin: 2px 0 6px 7px;
  padding-left: 16px;
  border-left: 1px solid #c1c9c5;
}

.article-toc li > ol > li::before {
  content: "";
  position: absolute;
  top: 13px;
  left: -16px;
  width: 10px;
  border-top: 1px solid #c1c9c5;
}

.article-toc a {
  display: block;
  position: relative;
  padding: 6px 8px 6px 14px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.article-toc a::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 2px;
  width: 5px;
  height: 5px;
  border: 1px solid #8b9691;
  border-radius: 50%;
  background: var(--paper);
}

.article-toc a:hover {
  background: var(--wash);
  color: var(--ink);
}

.article-toc a[aria-current="location"] {
  background: #f8eae8;
  color: var(--ink);
  font-weight: 600;
}

.article-toc a[aria-current="location"]::before {
  border-color: var(--accent);
  background: var(--accent);
}

.article-toc-level-3 > a {
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 12px;
}

.article-body {
  width: 100%;
  margin: 0;
  padding: 64px 0 0;
  font-family: "Source Serif 4", serif;
  font-size: 18px;
  line-height: 1.85;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: 24px;
  color: var(--ink);
  letter-spacing: 0;
}

.article-body h2 {
  margin: 72px 0 24px;
  padding-top: 16px;
  border-top: 3px solid var(--ink);
  font-size: 34px;
  line-height: 1.25;
}

.article-body h3 {
  margin: 48px 0 18px;
  font-size: 25px;
  line-height: 1.35;
}

.article-body h4 {
  margin: 36px 0 14px;
  font-size: 20px;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body table,
.article-body blockquote,
.article-body pre {
  margin-top: 0;
  margin-bottom: 24px;
}

.article-body li + li {
  margin-top: 8px;
}

.article-body blockquote {
  margin-left: 0;
  padding: 16px 24px;
  border-left: 4px solid var(--accent);
  background: var(--wash);
  color: #34413c;
}

.article-body code {
  padding: 2px 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86em;
  background: #edf1ef;
}

.article-body pre {
  overflow-x: auto;
  padding: 22px 24px;
  border-left: 4px solid var(--accent);
  background: var(--code);
  color: var(--code-ink);
  line-height: 1.6;
}

.article-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.article-body .code-block {
  position: relative;
  margin-bottom: 24px;
}

.article-body .code-block pre {
  margin-bottom: 0;
  padding-top: 48px;
}

.code-copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 58px;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #53615c;
  border-radius: 4px;
  background: #25302d;
  color: var(--code-ink);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
}

.code-copy-button:hover,
.code-copy-button:focus-visible {
  border-color: #9cad9f;
  background: #34413c;
}

.code-copy-button.is-copied {
  border-color: #78b88a;
  color: #b8e5c3;
}

.article-body mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.article-body .mermaid {
  max-width: 100%;
  overflow-x: auto;
  padding: 24px 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  text-align: center;
}

.article-body .mermaid svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.article-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.article-body th,
.article-body td {
  min-width: 140px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: var(--wash);
  font-weight: 600;
}

.article-body hr {
  margin: 64px 0;
  border: 0;
  border-top: 1px solid var(--ink);
}

.article-engagement {
  width: min(760px, 100%);
  margin: 72px auto 0;
  font-family: "IBM Plex Sans", sans-serif;
}

.engagement-section {
  padding: 32px 0;
  border-top: 1px solid var(--ink);
}

.engagement-section h2 {
  margin: 0;
  font-family: "Source Serif 4", serif;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

.engagement-section p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.engagement-label {
  margin: 0 0 10px !important;
  color: var(--accent-dark) !important;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px !important;
  font-weight: 500;
  text-transform: uppercase;
}

.feedback-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
}

.engagement-action {
  display: inline-flex;
  min-height: 44px;
  padding: 11px 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-dark);
  border-radius: 4px;
  background: var(--accent-dark);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.engagement-action:hover {
  background: var(--accent);
  color: #ffffff;
}

.engagement-action-secondary {
  margin-top: 20px;
  background: transparent;
  color: var(--accent-dark);
}

.engagement-action-secondary:hover {
  background: var(--wash);
  color: var(--accent);
}

.community-section {
  display: block;
}

.community-image-link {
  display: block;
  width: min(100%, 560px);
  margin-top: 16px;
  line-height: 0;
}

.community-image-link img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

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

  .article-toc {
    position: static;
    width: min(760px, 100%);
    max-height: 360px;
    margin: 40px auto 0;
    padding: 20px;
    border-right: 0;
    border-top: 3px solid var(--ink);
    background: var(--wash);
  }

  .article-toc a::before {
    background: var(--wash);
  }

  .article-body {
    width: min(760px, 100%);
    margin: 0 auto;
    padding-top: 48px;
  }
}

@media (max-width: 760px) {
  .site-header,
  .site-footer,
  .home-shell,
  .article-shell {
    width: min(100% - 32px, 1120px);
  }

  .site-header span {
    display: none;
  }

  .home-intro {
    min-height: 360px;
    padding: 72px 0 48px;
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .home-intro h1 {
    font-size: 42px;
  }

  .article-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .article-row a {
    font-size: 23px;
  }

  .article-header {
    padding: 64px 0 48px;
  }

  .article-header h1 {
    font-size: 38px;
  }

  .article-summary {
    font-size: 17px;
  }

  .article-toc {
    max-height: 320px;
    margin-top: 32px;
    padding: 18px 16px;
  }

  .article-body {
    padding-top: 40px;
    font-size: 17px;
  }

  .article-body h2 {
    margin-top: 56px;
    font-size: 29px;
  }

  .article-body h3 {
    font-size: 23px;
  }

  .article-engagement {
    margin-top: 56px;
  }

  .feedback-section {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .engagement-action {
    width: 100%;
    white-space: normal;
  }

  .site-footer {
    min-height: 140px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}
