:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface-soft: #eef2f7;
  --surface-code: #f2f5f9;
  --line: #dde2e8;
  --line-strong: #d9dee5;
  --ink: #0f172a;
  --muted: #475569;
  --strong: #111827;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Helvetica Neue",
    Arial,
    sans-serif;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--ink) 50%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--ink);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
}

.header-link:hover {
  background: var(--surface-soft);
}

.header-link__icon {
  width: 0.92rem;
  height: 0.92rem;
  flex: 0 0 auto;
}

.content {
  max-width: 850px;
  margin: 0 auto;
  padding: 2.4rem 1.25rem 3.6rem;
}

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

.prose h1,
.prose h2,
.prose h3 {
  color: var(--strong);
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.prose h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(2.15rem, 8.4vw, 3.6rem);
  line-height: 1.06;
}

.prose h2 {
  margin: 2.2rem 0 0.7rem;
  font-size: clamp(1.45rem, 4vw, 1.9rem);
}

.prose h3 {
  margin: 1.6rem 0 0.55rem;
  font-size: clamp(1.08rem, 3vw, 1.32rem);
}

.prose p,
.prose ul {
  margin: 0.85rem 0;
  max-width: 74ch;
  color: var(--muted);
}

.prose ul {
  padding-left: 1.25rem;
}

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

.prose strong {
  color: var(--strong);
}

.prose :where(p, li, h1, h2, h3) code {
  padding: 0.14rem 0.28rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.32rem;
  background: var(--surface-code);
  font-size: 0.9em;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
}

.hero {
  margin-bottom: 1.45rem;
}

.hero h1 {
  margin-bottom: 0.72rem;
  font-size: clamp(1.9rem, 6.2vw, 2.9rem);
  color: var(--strong);
}

.hero__eyebrow {
  margin: 0 0 0.75rem;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--muted) 85%, #000 15%);
}

.hero__lead {
  margin: 0;
  max-width: 62ch;
  font-size: clamp(1rem, 2.4vw, 1.16rem);
  font-weight: 500;
  color: color-mix(in srgb, var(--ink) 94%, var(--muted) 6%);
}

.hero__theses {
  margin: 0.8rem 0 0;
  max-width: 72ch;
  padding-left: 1.2rem;
  color: var(--muted);
}

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

.hero__note {
  margin: 1.15rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  max-width: 66ch;
  font-size: clamp(var(--text-sm), 1.7vw, 0.95rem);
  line-height: 1.56;
  color: color-mix(in srgb, var(--muted) 88%, #000 12%);
}

.hero__note strong {
  color: color-mix(in srgb, var(--ink) 88%, var(--muted) 12%);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.hero__meta {
  margin: 0.6rem 0 0;
  font-size: var(--text-sm);
  line-height: 1.35;
  color: color-mix(in srgb, var(--muted) 92%, #000 8%);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  padding: 0.52rem 0.8rem;
  text-decoration: none;
  font-size: 0.94rem;
}

.button:hover {
  background: var(--surface-soft);
}

.button--primary {
  border-color: color-mix(in srgb, var(--line) 75%, var(--muted) 25%);
  color: var(--muted);
  background: #eef2f7;
}

.button--primary:hover {
  background: #e4eaf2;
}

.panel {
  margin-top: 1.7rem;
  padding-top: 1.2rem;
  border-top: 0;
}

.panel h2 {
  margin-top: 0;
  font-size: clamp(1.16rem, 2.75vw, 1.35rem);
  color: rgb(17 24 39 / 0.84);
}

.prose pre,
.code-block {
  margin: 0.85rem 0 0;
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid #d9dee5;
  border-radius: 0.55rem;
  background: #f2f5f9;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  text-decoration: none;
}

.prose pre code,
.code-block code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-decoration: none;
  font-size: inherit;
}

.page-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.35rem 1.25rem 3.7rem;
}

.content--with-toc {
  max-width: none;
  margin: 0;
  padding: 0;
  line-height: 1.7;
}

.content--with-toc.prose h2 {
  margin-top: 2.6rem;
  margin-bottom: 0.8rem;
}

.content--with-toc.prose h3 {
  margin-top: 1.9rem;
  margin-bottom: 0.6rem;
}

.content--with-toc.prose p,
.content--with-toc.prose ul {
  margin-top: 0.95rem;
  margin-bottom: 0.95rem;
}

.content--with-toc.prose li + li {
  margin-top: 0.4rem;
}

.content--with-toc.prose pre {
  margin-top: 1rem;
  margin-bottom: 1.25rem;
}

.content--with-toc.prose :is(h2, h3) {
  scroll-margin-top: 1.1rem;
}

.toc-sidebar {
  display: none;
}

.toc-title {
  margin: 0 0 0.7rem;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.24rem;
}

.toc-link {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-sm);
  line-height: 1.38;
  padding-left: 0;
}

.toc-link:hover {
  color: var(--ink);
}

.toc-link--h3 {
  padding-left: 0.85rem;
  font-size: var(--text-sm);
}

.toc-link--active {
  color: var(--ink);
  font-weight: 600;
}

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (min-width: 1100px) {
  .page-layout {
    display: grid;
    grid-template-columns: minmax(0, 760px) minmax(220px, 280px);
    gap: 2.5rem;
    align-items: start;
  }

  .toc-sidebar {
    display: block;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
    border-left: 1px solid var(--line);
    padding-left: 1.15rem;
  }
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
