:root {
  color-scheme: light dark;
  --font-display: "Avenir Next", "Avenir", "Futura", "Gill Sans", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", "Liberation Mono", "Courier New", monospace;
  --bg: #f2f4f6;
  --panel: #ffffff;
  --panel-strong: #edf0f2;
  --border: #c7ced4;
  --border-strong: #9aa4ad;
  --text: #1f252b;
  --muted: #5e6a73;
  --accent: #c58a2b;
  --accent-soft: rgba(197, 138, 43, 0.12);
  --grid: rgba(0,0,0,0.04);
  --shadow: 0 0.6rem 1.2rem -1rem rgba(0,0,0,0.25);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418;
  --panel: #161b20;
  --panel-strong: #1e242b;
  --border: #2b333b;
  --border-strong: #3a4651;
  --text: #e6eaee;
  --muted: #9aa6b2;
  --accent: #f2b04c;
  --accent-soft: rgba(242, 176, 76, 0.18);
  --grid: rgba(255,255,255,0.05);
  --shadow: 0 0.7rem 1.4rem -1.1rem rgba(0,0,0,0.8);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
}

code, pre { font-family: var(--font-mono); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.app {
  min-height: 100vh;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,0.02), transparent 26%),
    linear-gradient(0deg, var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 2rem 2rem, 2rem 2rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  cursor: pointer;

  & .theme-toggle-switch {
    position: relative;
    width: 2.1rem;
    height: 1.05rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--panel);

    &::after {
      content: "";
      position: absolute;
      top: 50%;
      left: 0.125rem;
      width: 0.8rem;
      height: 0.8rem;
      border-radius: 50%;
      background: var(--muted);
      transform: translateY(-50%);
      transition: transform 0.18s ease, background 0.18s ease;
    }
  }
}

#theme-toggle:checked ~ .app .theme-toggle-switch {
  border-color: var(--accent);
  background: rgba(197, 138, 43, 0.2);
  &::after { transform: translate(1rem, -50%); background: var(--accent); }
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  padding: 0.3rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-strong);
}

.header-left { display: flex; flex-direction: column; gap: 0.15rem; }

.header-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-nav {
  display: flex;
  gap: 0.6rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;

  & a {
    color: var(--muted);
    text-decoration: none;
    &:hover { color: var(--text); }
    &.active { color: var(--accent); }
  }
}

.header-right {
  display: flex;
  flex-direction: column;
  margin-left: auto;
  align-items: flex-end;
  gap: 0.12rem;
  font-size: 0.66rem;
}

.content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 1.8rem 2rem 2rem;
  box-shadow: var(--shadow);
  line-height: 1.6;
}

.content h1 {
  margin: 0 0 1.2rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.6rem;
}

.content h2 {
  margin: 1.8rem 0 0.8rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  &:first-child { margin-top: 0; }
}

.content p {
  margin: 0 0 1rem;
  color: var(--text);
  &:last-child { margin-bottom: 0; }
}

.content ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
  color: var(--text);
  & li { margin-bottom: 0.35rem; }
}

.content a { color: var(--accent); text-decoration: none; }
.content a:hover { text-decoration: underline; }

@media (max-width: 35rem) {
  .header-left { gap: 0.1rem; }
  .content { padding: 1.2rem 1rem 1.4rem; }
  .content h1 { font-size: 1.25rem; }
}

@media (min-width: 90rem) {
  body { font-size: 1.12rem; }
  header { padding: 0.5rem 2.2rem; }
  .header-title { font-size: 0.94rem; }
}
