:root {
  --bg: #f6f3ec;
  --ink: #1b1916;
  --muted: #5c564e;
  --line: #cfc6b8;
  --link: #0e4d78;
  --mark: #b8431f;
  --max: 40rem;
  --sans: "Segoe UI", system-ui, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
}

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
}

a {
  color: var(--link);
}

a:hover {
  color: var(--mark);
}

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

.wrap {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header,
.site-footer,
.nav,
button,
.demo,
.hops,
.lang-switch {
  font-family: var(--sans);
}

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

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.9rem 0;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.9rem;
}

.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--ink);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
}

.lang-switch button + button {
  border-left: 1px solid var(--ink);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

main {
  padding: 2rem 0 3rem;
}

h1,
h2 {
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  margin: 0 0 1rem;
  font-size: 2rem;
}

h2 {
  margin: 2rem 0 0.6rem;
  font-size: 1.35rem;
}

p,
li {
  margin: 0.7rem 0;
}

.lede {
  font-size: 1.25rem;
  line-height: 1.55;
}

.note,
.site-footer,
.demo-status {
  color: var(--muted);
}

.note {
  font-family: var(--sans);
  font-size: 0.95rem;
}

ul,
ol.prose {
  padding-left: 1.2rem;
}

.fallback-label {
  display: none;
  margin: 0 0 0.4rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

html:not([data-lang]) .fallback-label {
  display: block;
}

html[data-lang="ru"] .lang-en,
html[data-lang="en"] .lang-ru {
  display: none;
}

.demo {
  margin: 1.25rem 0 0.5rem;
  padding: 1rem 0 0.25rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hops {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

.hops li {
  margin: 0;
  padding-top: 0.55rem;
  border-top: 3px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.hops li.is-done,
.hops li.is-current {
  border-top-color: var(--mark);
  color: var(--ink);
}

.hops li.is-current {
  font-weight: 650;
}

.demo-status {
  min-height: 2.8em;
  font-size: 0.95rem;
}

button.demo-run {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.95rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

button.demo-run:disabled {
  cursor: default;
  opacity: 0.55;
}

.site-footer {
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  justify-content: space-between;
  padding: 1rem 0 1.4rem;
}

.site-footer a {
  color: inherit;
}

.actions {
  margin-top: 1.5rem;
}

.actions a {
  font-family: var(--sans);
  color: var(--bg);
  background: var(--ink);
  text-decoration: none;
  padding: 0.55rem 0.85rem;
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.7rem;
  }

  .hops {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
