/*
 * Layout and Sphinx-content styles for the Nord docs theme. Chrome comes from
 * Nord components; this file covers page layout and docutils output only.
 * Spacing uses rem values on Nord's 0.25rem scale (--n-space-* is deprecated).
 */

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

/* basic.css colors visited links #551A8B, unreadable in dark mode. */
a:visited {
  color: var(--n-color-text-link);
}

/* Sidebar header */
.nd-brand,
.nd-brand:visited {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  color: var(--n-color-text);
  font-weight: var(--n-font-weight-heading);
  font-size: var(--n-font-size-l);
  text-decoration: none;
}
.nd-brand img {
  border-radius: var(--n-border-radius-s);
}

/* Header */
.nd-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--n-font-size-s);
  color: var(--n-color-text-weaker);
}
.nd-breadcrumbs li + li::before {
  content: "/";
  margin-inline-end: 0.25rem;
  color: var(--n-color-text-weakest);
}
.nd-breadcrumbs a,
.nd-breadcrumbs a:visited {
  color: inherit;
  text-decoration: none;
}
.nd-breadcrumbs a:hover {
  color: var(--n-color-text-link);
}
.nd-breadcrumbs [aria-current] {
  color: var(--n-color-text);
  font-weight: var(--n-font-weight-active);
}
.nd-search nord-input {
  --n-input-inline-size: 16rem;
}

/* Content + outline columns */
.nd-page {
  min-inline-size: 0;
  max-inline-size: 100%;
  display: grid;
  grid-template-columns: minmax(0, 44rem) 14rem;
  justify-content: center;
  gap: 3rem;
  padding: 1.5rem 1rem 4rem;
}
.nd-aside {
  position: sticky;
  inset-block-start: 5rem;
  align-self: start;
  max-block-size: calc(100vh - 6rem);
  overflow-y: auto;
}

/* Sphinx body on top of Nord's .n-typeset. Reading scale: 16/1.6 body,
   20 lead and h3, 24 h2, 36 h1; prose capped near 72 characters. */
.nd-body {
  min-inline-size: 0;
  font-size: var(--n-font-size-l);
  line-height: 1.6;
}
.nd-body section {
  margin: 0;
}
.nd-body :is(p, li, dd) {
  max-inline-size: 72ch;
}
.nd-body :is(h1, h2, h3) {
  line-height: var(--n-line-height-heading);
  font-weight: var(--n-font-weight-heading);
}
.nd-body h1 {
  font-size: var(--n-font-size-xxxl);
  letter-spacing: -0.02em;
  margin-block: 0 1rem;
}
.nd-body h2 {
  font-size: var(--n-font-size-xxl);
  letter-spacing: -0.01em;
  margin-block: 3.5rem 1rem;
}
.nd-body h3 {
  font-size: var(--n-font-size-xl);
  margin-block: 2rem 0.75rem;
}
.nd-body section > h1 + p {
  max-inline-size: 60ch;
  font-size: var(--n-font-size-xl);
  line-height: 1.45;
  color: var(--n-color-text-weak);
}
.nd-body a.headerlink {
  margin-inline-start: 0.25rem;
  color: var(--n-color-text-weakest);
  text-decoration: none;
  opacity: 0; /* not visibility: hidden, so keyboard users can still focus it */
}
.nd-body :is(h1, h2, h3, h4):hover a.headerlink,
.nd-body a.headerlink:focus-visible {
  opacity: 1;
}
.nd-body img {
  max-inline-size: 100%;
  block-size: auto;
}

.nd-body code.literal {
  font-family: var(--n-font-family-code);
  font-size: 0.875em;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--n-border-radius-s);
  background: var(--n-color-surface-raised);
  border: 1px solid var(--n-color-border);
}
.nd-body div.highlight {
  margin-block: 1rem;
  border: 1px solid var(--n-color-border);
  border-radius: var(--n-border-radius);
  background: var(--n-color-surface-raised);
  overflow: hidden;
}
.nd-body div.highlight pre {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: transparent;
  font-family: var(--n-font-family-code);
  font-size: var(--n-font-size-s);
  line-height: 1.6;
}
.nd-body .highlight {
  background: transparent;
}

/* <nord-banner> admonitions and <nord-table> tables from _ext/nord_theme.py */
.nd-body nord-banner {
  display: block;
  margin-block: 1.5rem;
}
.nd-body nord-banner p.admonition-title {
  margin: 0 0 0.25rem;
  font-weight: var(--n-font-weight-strong);
}
.nd-body nord-banner > :last-child {
  margin-block-end: 0;
}
/* nord-table's runtime styles lose to basic.css table rules, and its nowrap cells
   don't suit prose columns, so its look is restated here. */
.nd-body nord-table {
  margin-block: 1.5rem;
  border-radius: var(--n-border-radius);
  box-shadow: var(--n-box-shadow-card);
  background: var(--n-color-surface);
  font-size: var(--n-font-size-m);
}
.nd-body nord-table table {
  inline-size: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
}
.nd-body nord-table :is(th, td) {
  padding: 0.75rem 1rem;
  border: 0;
  border-block-end: 1px solid var(--n-color-border);
  text-align: start;
  vertical-align: top;
  white-space: normal;
}
.nd-body nord-table th {
  background: var(--n-color-surface-raised);
  color: var(--n-color-text-weaker);
  font-size: var(--n-font-size-s);
  font-weight: var(--n-font-weight-active);
}
.nd-body nord-table tbody tr:last-child td {
  border-block-end: 0;
}
.nd-body nord-table tbody tr:hover {
  background: var(--n-color-active);
}
.nd-body nord-table :is(th, td) > p {
  margin: 0;
}
.nd-body nord-table caption {
  padding: 0.75rem 1rem 0.25rem;
  text-align: start;
  font-weight: var(--n-font-weight-strong);
}

/* Prev / next */
.nd-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-block-start: 3rem;
}
.nd-pager a {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 1rem 1.25rem;
  border-radius: var(--n-border-radius);
  background: var(--n-color-surface);
  box-shadow: var(--n-box-shadow-card);
  text-decoration: none;
  font-weight: var(--n-font-weight-active);
}
.nd-pager a:hover {
  box-shadow: 0 0 0 2px var(--n-color-accent);
}
.nd-pager small {
  color: var(--n-color-text-weaker);
  font-weight: var(--n-font-weight);
}
.nd-pager-next {
  grid-column: 2;
  text-align: end;
}

.nd-footer {
  margin-block-start: 3rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--n-color-border);
  font-size: var(--n-font-size-s);
  color: var(--n-color-text-weaker);
}

/* Visible keyboard focus on our own links; Nord components handle theirs. */
.nd-body a:focus-visible,
.nd-breadcrumbs a:focus-visible,
.nd-brand:focus-visible,
.nd-pager a:focus-visible {
  outline: 2px solid var(--n-color-accent);
  outline-offset: 2px;
  border-radius: var(--n-border-radius-s);
}

#search-results ul.search {
  list-style: none;
  padding: 0;
}
#search-results ul.search li {
  padding-block: 1rem;
  border-block-end: 1px solid var(--n-color-border);
}

@media (max-width: 1200px) {
  .nd-page {
    grid-template-columns: minmax(0, 44rem);
  }
  .nd-aside {
    display: none;
  }
}
@media (max-width: 720px) {
  .nd-search nord-input {
    --n-input-inline-size: 9rem;
  }
}
