/* Hallmark · macrostructure: Long Document · genre: modern-minimal
 * theme: custom (violet 288° from the Wekoya mark) · tone: utilitarian
 * nav: sticky section index rail · footer: inline single line · enrichment: none
 * pre-emit critique: P5 H5 E4 S5 R5 V4
 *
 * Shares tokens.css with the dashboard deliberately. Documentation that looks
 * like a different product than the thing it documents makes the reader check
 * whether they are on the right site — which is the opposite of what docs are
 * for.
 *
 * Long Document rather than the dashboard's Workbench: this is read top to
 * bottom on first use and searched thereafter, so it wants one measured column
 * and a persistent index, not panels.
 */

@import url("./tokens.css?v=20260816b");

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

html,
body {
  margin: 0;
  padding: 0;
  /* clip, never hidden: hidden on the root kills position:sticky in the rail. */
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
  /* Anchors land under the sticky header otherwise. */
  scroll-padding-top: 5.5rem;
}

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

body {
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Every heading and long token can overflow a 320px screen without this. */
h1,
h2,
h3,
h4,
p,
li,
td,
th {
  overflow-wrap: anywhere;
  min-width: 0;
}

a {
  color: var(--color-accent-deep);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--color-accent-press);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- skip link ------------------------------------------------------------ */

.skip {
  position: absolute;
  left: var(--space-md);
  top: var(--space-md);
  z-index: var(--z-toast);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-accent-deep);
  color: var(--color-on-accent);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: translateY(0);
}

/* --- header --------------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: color-mix(in oklch, var(--color-paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}

.masthead__inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4ch;
  font-family: var(--font-display);
  font-weight: 620;
  font-size: var(--text-lg);
  letter-spacing: -0.022em;
  color: var(--color-ink);
  text-decoration: none;
}

.wordmark span {
  color: var(--color-accent-deep);
}

.masthead__spacer {
  flex: 1;
}

.masthead__link {
  font-size: var(--text-sm);
  color: var(--color-ink-2);
  text-decoration: none;
  white-space: nowrap;
}

.masthead__link:hover {
  color: var(--color-accent-deep);
}

/* --- shell ---------------------------------------------------------------- */

.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-3xl);
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: start;
}

@media (max-width: 60rem) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-lg);
  }
}

/* --- index rail ----------------------------------------------------------- */

.rail {
  position: sticky;
  top: 4.5rem;
  padding-top: var(--space-2xl);
  font-size: var(--text-sm);
}

/* The toggle is mobile-only; on desktop the rail is always open. */
.rail__toggle {
  display: none;
}

@media (max-width: 60rem) {
  /*
   * Sticks under the header so the section index stays one tap away however
   * far down the page you are — on a phone the alternative is scrolling all
   * the way back up to find it.
   */
  .rail {
    position: sticky;
    top: 3.25rem;
    z-index: var(--z-sticky);
    padding-top: 0;
    background: var(--color-paper);
    border-bottom: var(--rule-hair) solid var(--color-rule);
    margin-inline: calc(var(--space-lg) * -1);
    padding-inline: var(--space-lg);
  }

  .rail__title {
    display: none;
  }

  .rail__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
    width: 100%;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 560;
    color: var(--color-ink-2);
    background: none;
    border: 0;
    /* A comfortable touch target rather than the height of the text. */
    padding: var(--space-sm) 0;
    cursor: pointer;
  }

  .rail__chevron {
    flex: none;
    transition: transform var(--dur-short) var(--ease-out);
  }

  .rail__toggle[aria-expanded="false"] .rail__chevron {
    transform: rotate(-90deg);
  }

  .rail__list {
    display: grid;
    gap: var(--space-2xs);
    /* Capped and scrollable: ten sections on a small screen would otherwise
       cover the content the index is meant to help you reach. */
    max-height: min(50vh, 20rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: var(--space-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--color-rule) transparent;
  }

  .rail__list[hidden] {
    display: none;
  }

  .rail__list a {
    /* Full-width rows are easier to hit than inline text links. */
    padding-block: var(--space-2xs);
  }
}

@media (max-width: 30rem) {
  .shell {
    padding-inline: var(--space-md);
  }

  .rail {
    margin-inline: calc(var(--space-md) * -1);
    padding-inline: var(--space-md);
  }
}

/*
 * Visible scrollbars wherever content scrolls sideways.
 *
 * Mobile browsers hide the scrollbar until a scroll is already under way, so a
 * wide table or command reads as cut off rather than scrollable. A thin
 * permanent track is the only thing saying "there is more this way".
 */
.table-wrap,
pre,
.rail__list {
  scrollbar-width: thin;
  scrollbar-color: var(--color-rule) transparent;
}

.table-wrap::-webkit-scrollbar,
pre::-webkit-scrollbar,
.rail__list::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.table-wrap::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track,
.rail__list::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
.rail__list::-webkit-scrollbar-thumb {
  background: var(--color-rule);
  border-radius: var(--radius-pill);
}

.table-wrap::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover,
.rail__list::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-edge);
}

.rail__title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin: 0 0 var(--space-sm);
}

.rail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2xs);
}

.rail__list a {
  display: block;
  padding: 2px 0 2px var(--space-sm);
  border-left: 2px solid var(--color-rule);
  color: var(--color-ink-2);
  text-decoration: none;
  transition: color var(--dur-instant) var(--ease-out);
}

.rail__list a:hover {
  color: var(--color-ink);
  border-left-color: var(--color-accent-edge);
}

.rail__list a[aria-current="true"] {
  color: var(--color-accent-deep);
  border-left-color: var(--color-accent);
  font-weight: 560;
}

/* --- document ------------------------------------------------------------- */

.doc {
  padding-top: var(--space-2xl);
  max-width: var(--measure);
}

.doc__lede {
  font-size: var(--text-lg);
  color: var(--color-ink-2);
  margin: 0 0 var(--space-xl);
}

h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 640;
  letter-spacing: -0.028em;
  line-height: 1.08;
  margin: 0 0 var(--space-sm);
}

h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 620;
  letter-spacing: -0.022em;
  line-height: 1.2;
  margin: var(--space-3xl) 0 var(--space-sm);
  padding-top: var(--space-md);
  border-top: var(--rule-hair) solid var(--color-rule);
}

h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: var(--space-xl) 0 var(--space-xs);
}

p,
ul,
ol {
  margin: 0 0 var(--space-md);
}

ul,
ol {
  padding-left: 1.15rem;
}

li {
  margin-bottom: var(--space-2xs);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-paper-3);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.34em;
}

/* Wide code must scroll inside its own box, never the page. */
pre {
  margin: 0 0 var(--space-md);
  padding: var(--space-md);
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.55;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

/* --- callouts ------------------------------------------------------------- */

.note {
  margin: 0 0 var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: var(--rule-hair) solid var(--color-rule);
  background: var(--color-paper-2);
  font-size: var(--text-sm);
}

.note--action {
  border-color: var(--color-action-edge);
  background: var(--color-action-soft);
}

.note--good {
  border-color: color-mix(in oklch, var(--color-positive) 30%, transparent);
  background: var(--color-positive-soft);
}

.note__label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  margin-bottom: 2px;
}

.note p:last-child {
  margin-bottom: 0;
}

/* --- tables --------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--space-md);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  text-align: left;
  padding: var(--space-xs) var(--space-md);
  border-bottom: var(--rule-hair) solid var(--color-rule-2);
  vertical-align: top;
}

th {
  font-weight: 600;
  color: var(--color-ink);
  background: var(--color-paper-2);
  white-space: nowrap;
}

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

td code {
  white-space: nowrap;
}

/* --- ask panel ------------------------------------------------------------ */

.ask {
  margin: var(--space-xl) 0 0;
  border: var(--rule-hair) solid var(--color-accent-edge);
  border-radius: var(--radius-lg);
  background: var(--color-accent-soft);
  padding: var(--space-md);
}

.ask__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-accent-deep);
  margin: 0 0 var(--space-xs);
}

.ask__row {
  display: flex;
  gap: var(--space-xs);
  align-items: stretch;
}

@media (max-width: 30rem) {
  .ask__row {
    flex-wrap: wrap;
  }
}

.ask__input {
  flex: 1 1 12rem;
  min-width: 0;
  font: inherit;
  font-size: var(--text-base);
  color: var(--color-ink);
  background: var(--color-paper);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
}

.ask__input::placeholder {
  color: var(--color-muted);
}

.ask__input:focus-visible {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.ask__input:disabled {
  background: var(--color-paper-3);
  color: var(--color-muted);
  cursor: not-allowed;
}

.btn {
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 560;
  border: var(--rule-hair) solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-accent-deep);
  color: var(--color-on-accent);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--dur-instant) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}

.btn:hover:not(:disabled) {
  background: var(--color-accent);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  background: var(--color-accent-press);
}

.btn:disabled {
  background: var(--color-paper-3);
  color: var(--color-muted);
  border-color: var(--color-rule);
  cursor: not-allowed;
}

.ask__answer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: var(--rule-hair) solid var(--color-accent-edge);
  font-size: var(--text-sm);
  white-space: pre-wrap;
}

.ask__answer:empty {
  display: none;
}

.ask__answer[data-state="error"] {
  color: var(--color-critical);
}

.ask__foot {
  margin: var(--space-xs) 0 0;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* --- footer --------------------------------------------------------------- */

.foot {
  border-top: var(--rule-hair) solid var(--color-rule);
  margin-top: var(--space-3xl);
}

.foot__inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  align-items: baseline;
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.foot a {
  color: var(--color-ink-2);
  text-decoration: none;
}

.foot a:hover {
  color: var(--color-accent-deep);
}
