nav .nav-inner {
  height: auto;
  min-height: 64px;
  padding-block: 8px;
  flex-wrap: nowrap;
}

.nav-inner a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
}

.nav-links {
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a,
.nav-logo {
  flex-shrink: 0;
}

.language-select {
  min-width: 64px;
  height: 44px;
  flex-shrink: 0;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

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

.sidebar {
  max-height: calc(100vh - 96px);
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.content,
footer {
  overflow-wrap: anywhere;
}

.content [id] {
  scroll-margin-top: 96px !important;
}

.hero p,
.hero strong {
  color: inherit;
}

/* Inline emphasis must wrap as prose, not as separate flex items. */
.step {
  display: block;
}

table {
  table-layout: fixed;
}

th,
td {
  overflow-wrap: anywhere;
}

a:focus-visible,
.language-select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  nav {
    position: static;
  }

  .nav-inner {
    gap: 8px;
  }

  .nav-logo span {
    display: none;
  }

  .nav-logo img {
    margin-right: 0 !important;
  }

  .nav-links {
    gap: 4px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-block: 20px;
  }

  .sidebar {
    display: block;
    position: static;
    max-height: none;
    overflow: visible;
  }

  .toc {
    max-height: 240px;
    overflow-y: auto;
  }

  .content [id] {
    scroll-margin-top: 16px !important;
  }
}

@media (max-width: 600px) {
  .layout {
    padding-inline: 16px;
  }

  .nav-inner {
    padding-inline: 8px;
    gap: 4px;
  }

  .nav-inner .nav-logo {
    display: none;
  }

  .nav-links {
    gap: 0;
    justify-content: space-between;
  }

  .nav-links a {
    padding-inline: 4px;
    font-size: .8125rem;
  }

  .hero {
    padding: 24px 20px;
    margin-bottom: 20px;
  }

  .hero h1 {
    font-size: 1.65rem;
    line-height: 1.3;
  }

  section,
  .toc {
    padding: 16px;
  }

  h2 {
    font-size: 1.25rem;
  }

  th,
  td {
    padding: 8px 6px;
  }
}
