:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #182026;
  --muted: #60707c;
  --line: #c7d2dd;
  --table-line: #aebdca;
  --accent: #1b6f6a;
  --accent-strong: #0e4e4a;
  --accent-soft: #dcefeb;
  --warn-soft: #f8eecb;
  --shadow: 0 18px 40px rgba(15, 36, 48, 0.08);
  --content-width: 860px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191816;
  --surface: #22211f;
  --surface-strong: #2a2926;
  --ink: #f4efe6;
  --muted: #b9afa0;
  --line: #3d3932;
  --table-line: #574f44;
  --accent: #7ccbc1;
  --accent-strong: #a8e5dc;
  --accent-soft: #183d3a;
  --warn-soft: #443721;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.68;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}

.brand {
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
}

.site-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.search input {
  width: min(30vw, 320px);
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.top-link,
.pdf-link,
.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
}

.top-link,
.pdf-link,
.button {
  padding: 0 14px;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.icon-button {
  width: 38px;
  cursor: pointer;
}

.menu-button {
  display: none;
}

.site-frame {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 16px;
}

.chapter-nav {
  display: grid;
  gap: 4px;
}

.chapter-nav a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.94rem;
  line-height: 1.3;
}

.chapter-nav a span {
  color: var(--muted);
  font-size: 0.8rem;
}

.chapter-nav a:hover,
.chapter-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.course-nav-divider {
  height: 1px;
  margin: 12px 4px 8px;
  background: var(--line);
}

.site-main {
  min-width: 0;
  padding: 42px clamp(22px, 5vw, 72px) 72px;
}

.note-page {
  max-width: var(--content-width);
  margin: 0 auto;
}

.note-page__header,
.home-hero {
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  line-height: 1.18;
  margin: 1.45em 0 0.45em;
  letter-spacing: 0;
}

h1 {
  margin-top: 0;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
}
