:root {
  color-scheme: light dark;
  --page: light-dark(#fafafa, #141414);
  --panel: light-dark(#fff, #1c1c1c);
  --surface: light-dark(#f3f3f3, #242424);
  --line: light-dark(#d9d9d9, #414141);
  --ink: light-dark(#171717, #ededed);
  --muted: light-dark(#5d5d5d, #b5b5b5);
  font-family: 'Geist', 'Inter', system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
}

main {
  flex: 1 0 auto;
}

.shell {
  width: min(calc(100% - 2.5rem), 68rem);
  margin-inline: auto;
}

.reading {
  max-width: 49rem;
}

.topbar,
footer {
  background: var(--panel);
}

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

footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
}

.bar,
.nav,
.brand,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.bar {
  min-height: 4.25rem;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 0.65rem;
}

.nav,
.actions {
  gap: 0.5rem 0.85rem;
}

.nav > a {
  color: var(--muted);
}

.nav > a[aria-current] {
  color: var(--ink);
  font-weight: 650;
}

.brand {
  gap: 0.55rem;
  font:
    650 0.94rem ui-monospace,
    monospace;
  text-decoration: none;
}

.brand img {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.locales {
  position: relative;
}

.locales summary {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  cursor: pointer;
}

.locales ul {
  position: absolute;
  z-index: 1;
  inset-inline-end: 0;
  width: max-content;
  max-width: 13rem;
  max-height: 19rem;
  overflow: auto;
  margin: 0.35rem 0 0;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background-color: var(--panel);
  list-style: none;
}

.locales a {
  display: block;
  padding: 0.45rem 0.65rem;
}

.locales a:hover {
  background: var(--surface);
}

footer,
.nav {
  font-size: 0.875rem;
}

footer p {
  margin: 0;
  color: var(--muted);
}

.intro {
  padding-block: clamp(2.25rem, 6vw, 4.75rem) 1.9rem;
}

.intro > a:first-child {
  color: var(--muted);
  font-size: 0.875rem;
}

h1,
h2,
h3,
p {
  margin: 0;
  overflow-wrap: anywhere;
}

h1 {
  max-width: 54rem;
  font-size: clamp(2.15rem, 5.2vw, 3.85rem);
  font-weight: 690;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.intro h1:not(:first-child) {
  margin-top: 0.55rem;
}

.intro p {
  max-width: 47rem;
  margin-block: 0.85rem 1.15rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

p {
  line-height: 1.65;
}

h2 {
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  line-height: 1.25;
}

h3 {
  font-size: 0.95rem;
}

.button {
  display: inline-block;
  padding: 0.52rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--panel);
  font-size: 0.875rem;
  font-weight: 650;
  text-decoration: none;
}

.button:hover {
  text-decoration: underline;
}

.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--page);
}

.topics,
.answers,
.steps {
  margin: 0;
  padding: 0;
}

.topics {
  list-style: none;
}

.topics li,
.answers section,
.steps li {
  padding-block: 1.05rem;
  border-top: 1px solid var(--line);
}

.topics a {
  font-weight: 700;
}

.topics p,
.answers p,
.steps p {
  margin-top: 0.45rem;
  color: var(--muted);
}

.steps {
  padding-inline-start: 1.55rem;
}

.steps li {
  padding-inline-start: 0.25rem;
}

.related {
  margin-top: 2rem;
}

.related h2 {
  margin-bottom: 0.65rem;
}

.artwork {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
  padding: clamp(0.9rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel);
}

.credit {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.875rem;
}

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

.comparison figure {
  min-width: 0;
  margin: 0;
}

.comparison .image {
  display: flex;
  aspect-ratio: var(--ratio);
  max-height: 24rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--surface);
}

.comparison img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comparison figcaption {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.parameters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 0.5rem;
  margin: 0;
}

.parameters div {
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font-size: 0.875rem;
}

.parameters dt {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.parameters dd {
  margin: 0.2rem 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .shell {
    width: calc(100% - 1.5rem);
  }

  .locales ul {
    inset-inline: auto -0.15rem;
  }

  .comparison {
    grid-template-columns: minmax(0, 1fr);
  }
}
