:root {
  color-scheme: light;
  --background: #f7f7f4;
  --surface: #ffffff;
  --text: #252825;
  --muted: #686e68;
  --line: #d9ddd8;
  --accent: #3f8fca;
  --accent-soft: #e8f3fb;
  --accent-hover: #d9ebf8;
  --sidebar-heading: #f5f5f5;
  --code: #f0f2ef;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

a:focus-visible {
  border-radius: 0.2rem;
  outline: 0.2rem solid var(--accent);
  outline-offset: 0.2rem;
}

.shell {
  width: min(100% - 2rem, 70rem);
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid #dddddd;
  background: #f5f5f5;
}

.site-name {
  display: inline-block;
  padding-block: 1.1rem;
  color: #333333;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding-block: clamp(2rem, 6vw, 5rem);
}

article {
  max-width: 47rem;
}

h1,
h2 {
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 {
  margin: 0 0 2.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(2rem, 6vw, 3.5rem);
}

h2 {
  margin: 2.5rem 0 1rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
}

p,
ol {
  margin-block: 0 1.25rem;
}

code {
  border-radius: 0.25rem;
  background: var(--code);
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

.equation {
  overflow-x: auto;
  padding-block: 0.5rem;
}

.article-image {
  display: block;
  width: min(100%, 26rem);
  height: auto;
  margin: 1.75rem auto;
  border-radius: 0.75rem;
  box-shadow: 0 0.75rem 2.5rem rgb(30 45 39 / 12%);
}

.sidebar nav {
  position: sticky;
  top: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
}

.sidebar h2 {
  margin: 0;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #dddddd;
  background: var(--sidebar-heading);
  color: #333333;
  font-size: 0.85rem;
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar a,
.sidebar span {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.sidebar a {
  text-decoration: none;
}

.sidebar a:hover,
.sidebar a:focus-visible {
  background: var(--accent-hover);
}

.sidebar a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.sidebar a[aria-current="page"]:hover,
.sidebar a[aria-current="page"]:focus-visible {
  background: var(--accent-hover);
  color: #317eb7;
}

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

.sidebar :last-child {
  border-bottom: 0;
}

@media (max-width: 48rem) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar nav {
    position: static;
  }
}
