:root {
  color-scheme: dark;
  --background: #242321;
  --foreground: #E8E5DE;
  --selection-background: #45423D;
  font-weight: 400;
  font-synthesis: none;
  background: var(--background);
  color: var(--foreground);
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #faf9f5;
  --foreground: #141413;
  --selection-background: #d3d2cd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  background: var(--background);
  color: var(--foreground);
}

.site-name {
  position: absolute;
  top: 12px;
  left: 18px;
  font-size: clamp(32px, 3.15vw, 48px);
  line-height: 1.4;
  white-space: nowrap;
}

.site-name a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.site-name a:focus-visible {
  outline: 1px solid var(--foreground);
  outline-offset: 4px;
}

.toc {
  width: min(58%, 900px);
  margin-inline: auto;
  padding: 110px 0 80px;
}

.toc-title {
  margin: 0 0 1.4em;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.03em;
  line-break: strict;
  overflow-wrap: anywhere;
}

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.02em;
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding-block: 0.08em;
  color: inherit;
  text-decoration: none;
  line-break: strict;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}

.toc-list a:hover,
.toc-list a:focus-visible {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: none;
}

.toc-list a:focus-visible {
  outline: 1px solid var(--foreground);
  outline-offset: 4px;
}

.theme-switch {
  position: absolute;
  z-index: 1;
  top: clamp(24px, 2.4vw, 36px);
  right: clamp(18px, 1.6vw, 26px);
  display: flex;
  align-items: baseline;
  gap: 0;
  font-size: clamp(14px, 1.1vw, 17px);
  line-height: 1;
  letter-spacing: 0.12em;
}

.theme-switch button {
  margin: 0;
  padding: 0.35em 0.1em;
  border: 0;
  appearance: none;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  opacity: 0.55;
  -webkit-tap-highlight-color: transparent;
}

.theme-switch button[aria-pressed="true"] {
  opacity: 1;
}

.theme-switch button:hover,
.theme-switch button:focus-visible {
  opacity: 1;
}

.theme-switch button:focus-visible {
  outline: 1px solid var(--foreground);
  outline-offset: 3px;
}

.theme-switch .theme-space {
  white-space: pre;
  user-select: none;
}

::selection {
  color: var(--foreground);
  background: var(--selection-background);
}

@media (max-width: 900px) {
  .toc {
    width: calc(100% - 64px);
    max-width: 650px;
  }

  .toc-title {
    font-size: 19px;
  }

  .toc-list {
    font-size: 17px;
  }
}

@media (max-width: 540px) {
  .site-name {
    top: 14px;
    left: 20px;
  }

  .toc {
    width: calc(100% - 40px);
    padding: 90px 0 60px;
  }

  .toc-title {
    font-size: 18px;
  }

  .toc-list {
    font-size: 16px;
  }

  .theme-switch {
    top: 26px;
    right: 20px;
  }
}
