/* The docs area's one sheet. site.css owns the tokens, the masthead and the
   footer; this file adds the reading column, the rendered-markdown prose and
   the index cards. Every page under site/docs/ loads it, no page carries its
   own styles. */

.doc-shell {
  width: 100%;
  max-width: 58rem;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.doc-main {
  padding-top: clamp(2rem, 4vw, 3rem);
  padding-bottom: 3.5rem;
}

/* site.css marks the current nav link with aria-current only; the docs sheet
   paints the underline the Astro front had. */
.masthead .nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--primary);
}

.doc-head,
.prose,
.doc-back {
  max-width: 72ch;
}

.doc-head {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* site.css's eyebrow is the dark band's orange; on paper the darker token
   carries the same meaning at 4.8:1. */
.doc-head .eyebrow {
  color: var(--accent-ink);
}

.doc-head h1 {
  font-size: clamp(2rem, 4.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.032em;
}

.doc-lede {
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.doc-head code {
  font-family: var(--mono);
  font-size: 0.9em;
  font-weight: 600;
  background: var(--band);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xs);
  padding: 1px 5px;
}

/* Prose: the crate's rendered markdown */

.prose {
  padding: 0.5rem 0 1rem;
  font-size: 1rem;
  line-height: 1.72;
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose p {
  margin: 1.1em 0 0;
  color: var(--ink);
}

.prose h2,
.prose h3,
.prose h4 {
  scroll-margin-top: var(--anchor-clear);
}

.prose h2 {
  margin: 2.6em 0 0.65em;
  padding-top: 1.1em;
  border-top: 1px solid var(--line);
  font-size: clamp(1.35rem, 2.2vw, 1.6rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.prose h3 {
  margin: 2.1em 0 0.55em;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.prose h4 {
  margin: 1.7em 0 0.45em;
  font-size: 1rem;
  font-weight: 700;
}

.prose strong {
  font-weight: 700;
}

.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.07em;
}

.prose a:hover {
  color: var(--primary-hi);
  text-decoration-thickness: 0.12em;
}

.prose a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.prose ul,
.prose ol {
  margin: 1.1em 0 0;
  padding-left: 1.35em;
}

.prose ul {
  list-style: disc;
}

.prose ul ul {
  list-style: circle;
}

.prose ul ul ul {
  list-style: square;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  margin: 0.4em 0 0;
  line-height: 1.7;
}

.prose li > p {
  margin: 0.5em 0 0;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.35em;
}

.prose li::marker {
  color: var(--accent-ink);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  font-weight: 500;
  color: var(--code-ink);
  background: var(--band);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xs);
  padding: 1px 4px;
}

.prose pre {
  margin: 1.2em 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--code-bg);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  font-weight: 400;
}

.prose blockquote {
  margin: 1.25em 0 0;
  padding: 0.2em 0 0.2em 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4em 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  height: 0;
}

/* Wide tables scroll in their own frame; site.css's table rules are tuned
   for the landing page's right-aligned numbers, so prose resets them. */
.prose .table-wrap {
  margin: 1.25em 0 0;
  padding: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.prose table {
  width: 100%;
  min-width: 30rem;
  margin: 0;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.prose thead th {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: var(--band);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
}

.prose tbody td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 0.9375rem;
  text-align: left;
  vertical-align: top;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.prose tbody tr:nth-child(even) {
  background: var(--card-warm);
}

.prose [role="doc-endnotes"] {
  margin-top: 2em;
  font-size: 0.9375rem;
}

/* The index */

.group-head {
  margin: 2.75rem 0 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.doc-card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
}

.doc-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.doc-card h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.doc-card p {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* The back link closes the article on its own rule. */
.doc-back {
  margin: 2.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.9375rem;
}

.doc-back a {
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.doc-back a:hover {
  color: var(--primary-hi);
}

.doc-back a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (min-width: 40em) {
  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 56.25em) {
  .doc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* site.css hides the masthead links below 47.5em, expecting the landing
   page's scripted panel; the docs pages carry no script, so the four links
   keep their row and wrap. */
@media (max-width: 47.5em) {
  .masthead-in .nav {
    display: flex;
    margin-left: 0;
    width: 100%;
  }
}

/* site.css stacks every table into blocks below 42.5em and hides its head;
   a prose table keeps its columns and scrolls in the wrapper instead. */
@media (max-width: 42.5em) {
  .prose thead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    display: table-header-group;
  }

  .prose table {
    display: table;
  }

  .prose tbody {
    display: table-row-group;
  }

  .prose tr {
    display: table-row;
  }

  .prose th,
  .prose td {
    display: table-cell;
  }

  /* A command or a tree pastes and copies as written; it scrolls rather than
     wrapping mid-token. */
  .prose pre {
    white-space: pre;
    overflow-wrap: normal;
  }
}
