:root {
  color-scheme: light dark;
  --page: #fffdf8;
  --text: #202321;
  --muted: #535b57;
  --link: #145952;
  --line: #deded4;
  --panel: #f2f5ee;
  --focus: #aa4f16;
  --hero: #172322;
  --hero-text: #f9f7ed;
  --hero-muted: #ced9d2;
  --amber: #ffcb72;
  --gutter: clamp(1.125rem, 5vw, 3.5rem);
  font: 100%/1.65 "Instrument Sans", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #171c1b;
    --text: #f3f1e8;
    --muted: #c0c8c2;
    --link: #9bdfce;
    --line: #383f3b;
    --panel: #212b28;
    --focus: #ffcb72;
    --hero: #111b1a;
  }
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
}

.container {
  width: min(100%, 75rem);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

a {
  color: var(--link);
  text-underline-offset: 0.19em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1;
  padding: 0.5rem 1rem;
  background: var(--page);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand img {
  border-radius: 7px;
}

.site-section {
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.2;
}

.hero {
  color: var(--hero-text);
  background: var(--hero);
  border-bottom: 3px solid var(--amber);
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
  gap: clamp(1.75rem, 5vw, 4.75rem);
  align-items: center;
  padding-block: clamp(2rem, 6vw, 4.5rem);
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 4.65rem);
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 34rem;
  margin: 0.85rem 0 1.35rem;
  color: var(--hero-muted);
  font-size: clamp(1rem, 1.75vw, 1.2rem);
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  color: #231b0e;
  background: var(--amber);
  border-radius: 0.45rem;
  font-weight: 700;
  text-decoration: none;
}

.primary-link:hover {
  background: #ffda9d;
}

.primary-link:focus-visible {
  outline-color: var(--amber);
}

.scope-preview {
  margin: 0;
  padding: 0.6rem;
  background: #263333;
  border: 1px solid #435653;
  border-radius: 0.75rem;
}

.scope-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.35rem;
}

.scope-preview figcaption {
  padding: 0.55rem 0.25rem 0.05rem;
  color: var(--hero-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 13rem) minmax(0, 46rem);
  column-gap: clamp(1.5rem, 6vw, 5rem);
  align-items: start;
  padding-block: clamp(1.5rem, 5vw, 3.25rem);
}

.contents {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  padding-inline-end: 0.7rem;
  overflow-y: auto;
}

.contents h2 {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.contents ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.contents a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0.45rem;
  border-radius: 0.3rem;
  line-height: 1.3;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.contents a:hover,
.contents a:focus-visible {
  background: var(--panel);
  text-decoration: underline;
}

.guide section {
  scroll-margin-top: 1rem;
}

.guide section + section {
  margin-top: 2.4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.guide h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.55rem, 3.7vw, 2.2rem);
  letter-spacing: -0.035em;
}

.guide h3 {
  margin-top: 1.6rem;
  margin-bottom: 0.6rem;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.guide p,
.guide ol,
.guide ul {
  margin: 0 0 1rem;
}

.guide p:last-child,
.guide ol:last-child,
.guide ul:last-child {
  margin-bottom: 0;
}

.guide ol,
.guide ul {
  padding-inline-start: 1.45em;
}

.guide li + li {
  margin-top: 0.5rem;
}

.steps li::marker {
  color: var(--link);
  font-weight: 750;
}

.note,
.example {
  padding: 0.85rem 1rem;
  background: var(--panel);
  border-inline-start: 3px solid var(--link);
  border-radius: 0 0.45rem 0.45rem 0;
}

.guide .example {
  margin-top: 1.2rem;
}

.control-list {
  margin: 0.9rem 0 1.15rem;
}

.control-list > div {
  display: grid;
  grid-template-columns: minmax(7.25rem, 0.29fr) minmax(0, 1fr);
  gap: 0.85rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}

.control-list > div:last-child {
  border-bottom: 1px solid var(--line);
}

.control-list dt {
  color: var(--link);
  font-weight: 700;
}

.control-list dd {
  margin: 0;
}

details {
  border-bottom: 1px solid var(--line);
}

details:first-of-type {
  border-top: 1px solid var(--line);
}

summary {
  padding: 0.7rem 0.2rem;
  font-weight: 650;
  cursor: pointer;
}

summary::marker {
  color: var(--link);
}

summary:hover {
  color: var(--link);
}

.guide details > p {
  margin: 0 0 0.85rem 1.15rem;
}

.guide-footer {
  margin-top: 2rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-size: 0.92rem;
}

@media (max-width: 52rem) {
  .guide-layout {
    display: block;
  }

  .contents {
    position: static;
    max-height: none;
    margin-bottom: 1.8rem;
    padding: 0.9rem 0.95rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    overflow: visible;
  }

  .contents ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 0.4rem;
  }

  .contents a {
    padding-inline: 0;
    min-height: 44px;
    text-decoration: underline;
  }
}

@media (max-width: 40rem) {
  .hero-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .scope-preview {
    width: 100%;
    max-width: 24rem;
  }
}

@media (max-width: 30rem) {
  .control-list > div {
    display: block;
  }

  .control-list dt {
    margin-bottom: 0.1rem;
  }
}

.guide-media {
  width: fit-content;
  max-width: min(100%, 23rem);
  margin: 1.15rem 0 1.45rem;
  padding: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.guide-media img,
.guide-media video {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: 0.35rem;
}

.guide-media video {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--hero);
}

.guide-media figcaption {
  padding: 0.55rem 0.25rem 0.12rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
}

.media-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 0.8rem;
  max-width: 40rem;
  margin: 1.15rem 0 1.45rem;
}

.media-pair .guide-media {
  width: 100%;
  margin: 0;
}

.media-pair img {
  width: 100%;
}

.plot-card {
  padding: 0.65rem 0.75rem 0.35rem;
  color-scheme: dark;
  color: var(--hero-text);
  background: #263333;
  border-color: #435653;
}

.guide-media.plot-card {
  width: min(100%, 38rem);
  max-width: 100%;
}

.plot-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  max-width: none;
  padding: 0.2rem 0.2rem 0.55rem;
  color: var(--hero-text);
  font-size: 0.875rem;
}

.plot-card label,
.trace-key {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  color: var(--hero-muted);
  font-size: 0.8125rem;
}

.plot-card select {
  min-height: 36px;
  max-width: 100%;
  padding: 0.25rem;
  color: var(--hero-text);
  background: var(--hero);
  border: 1px solid #687a77;
  border-radius: 0.3rem;
  font: inherit;
}

.plot-card select:focus-visible {
  outline-color: var(--amber);
}

.plot-card canvas {
  display: block;
  width: 100%;
  height: clamp(11.25rem, 25vw, 15rem);
}

.scope-preview canvas {
  max-height: 12rem;
}

.trace-key > span::before {
  content: "";
  display: inline-block;
  width: 0.75em;
  margin-inline-end: 0.35em;
  vertical-align: 0.23em;
  border-top: 2px solid var(--amber);
}

.trace-key .output-key::before {
  border-top: 2px dashed #89dfce;
}

@media (max-width: 30rem) {
  .media-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .plot-card select {
    min-height: 44px;
  }
}
