/* ---------------------------------------------------------------
   Adeia — the Audit page

   Layout for audit.html only. Every selector is scoped under
   .page-audit, which sits on the page's <body>, so nothing here can
   reach another page's markup. Colour, type, spacing and easing come
   from tokens.css; .display, .h2, .h3, .lead, .body, .label, .mono,
   .quiet, .plus-link and .visually-hidden come from base.css and are
   not restated.

   The masthead and the footer are the exceptions. Their rules live in
   styles/hero.css and styles/closing.css, which this page does not
   load, so the parts of them this page needs are restated here under
   the page scope rather than pulled in wholesale.

   Contrast, measured against the ground each element sits on:
     hero          --orchid on --ink        6.40:1   display heading
                   --mist on --ink         11.90:1   lead copy
                   --on-ink-quiet on --ink  5.77:1   10px eyebrow
     vocabulary    --on-bone on --bone     11.79:1   table text
                   --on-bone-quiet          6.04:1   secondary copy
     guarantee     --on-paper on --paper   15.35:1   headings and copy
                   --on-paper-quiet         6.69:1   body copy
     trail         --on-paper on --paper   15.35:1   prose around it
     terminal      --mist on --ink         11.90:1   default output
                   --clay on --ink          7.86:1   strings
                   --orchid on --ink        6.40:1   refusals
                   --on-ink-quiet on --ink  5.77:1   timestamps
     closing       --orchid on --forest     5.61:1   display heading
                   --on-forest             11.96:1   body copy
   Every one clears WCAG AA at the size it is used.

   The terminal never relies on hue alone. A refusal is the accent
   colour *and* the only saturated thing in the block *and* the word
   "denied" spelled out in the row. Printed greyscale, the four inks
   still separate by lightness: quiet 55%, clay 70%, orchid 62%,
   mist 92%.
   --------------------------------------------------------------- */

/* =====================================================================
   Masthead — restated, scoped. See the note at the top of this file.
   ===================================================================== */

.page-audit .masthead {
  --rule: var(--rule-on-ink);

  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 1.375rem var(--pad-x);
  color: var(--mist);
}

/* An ink scrim under the bar. Invisible over the hero; over the pale
   grounds further down it is what keeps the wordmark above 4.5:1. */
.page-audit .masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to bottom,
    rgba(34, 34, 34, 0.92),
    rgba(34, 34, 34, 0.62) 55%,
    rgba(34, 34, 34, 0)
  );
  pointer-events: none;
}

.page-audit .masthead__mark {
  font-size: var(--t-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  color: var(--mist);
}

/* A <button> needs its own reset before .plus-link's flexbox applies. */
.page-audit .masthead__menu {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--sans);
  color: var(--mist);
  cursor: pointer;
}

.page-audit .masthead__menu-label {
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

/* =====================================================================
   Shared marks — the inline code chip and the terminal palette
   ===================================================================== */

/* An identifier quoted inside a sentence. Sized down against the body
   serif-free stack so a monospace run does not tower over its line. */
.page-audit .audit-code {
  font-family: var(--mono);
  font-size: 0.875em;
  letter-spacing: -0.01em;
  word-break: break-word;
  padding: 0.1em 0.32em;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: rgba(34, 34, 34, 0.04);
}

/* On the dark grounds the tint has to go the other way. */
.page-audit .ground--ink .audit-code,
.page-audit .ground--forest .audit-code {
  background: rgba(237, 223, 238, 0.08);
}

/* "terminal" beside an event name in the vocabulary table: this event
   is the last one an action can carry. */
.page-audit .audit-tag {
  display: inline-block;
  margin-left: 0.5em;
  font-family: var(--mono);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0.4em 0.6em;
  border: 1px solid currentColor;
  color: var(--on-bone-quiet);
}

/* ---------- terminal inks ----------
   Class names came from the CLI's own colour vocabulary, so they read
   green/yellow/red. The values are this palette's, not a terminal's:
   clay for strings, mist for figures, orchid for anything refused. */
.page-audit .t-dim {
  color: var(--on-ink-quiet);
}

.page-audit .t-green {
  color: var(--clay);
}

.page-audit .t-yellow {
  color: var(--mist);
}

/* The only saturated ink in the block, and it appears on exactly one
   kind of row. */
.page-audit .t-red {
  color: var(--orchid);
  font-weight: 600;
}

.page-audit .t-bold {
  color: var(--mist);
  font-weight: 600;
}

/* =====================================================================
   Hero — ink
   ===================================================================== */

.page-audit .audit-hero {
  display: flex;
  align-items: flex-end;
  min-height: min(78svh, 44rem);
  padding-block: clamp(8rem, 18vh, 12rem) clamp(3rem, 7vw, 5.5rem);
}

.page-audit .audit-hero__inner {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.page-audit .audit-hero__eyebrow {
  margin: 0;
}

.page-audit .audit-hero__title {
  margin: 0;
  max-width: 16ch;
  color: var(--orchid);
}

.page-audit .audit-hero__body {
  margin: 0;
  max-width: 58ch;
}

/* =====================================================================
   Vocabulary — bone
   ===================================================================== */

.page-audit .audit-vocab__head {
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.page-audit .audit-vocab__head > * {
  margin: 0;
}

.page-audit .audit-vocab__title {
  max-width: 20ch;
}

.page-audit .audit-vocab__intro {
  max-width: 68ch;
}

/* The table is wider than a phone. It scrolls inside its own box and
   is focusable, so a keyboard can reach the overflow. */
.page-audit .audit-vocab__scroll {
  overflow-x: auto;
  border-top: 1px solid var(--rule);
}

.page-audit .audit-vocab__scroll:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.page-audit .audit-vocab__table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  text-align: left;
}

.page-audit .audit-vocab__table th,
.page-audit .audit-vocab__table td {
  vertical-align: top;
  padding: clamp(0.875rem, 1.6vw, 1.25rem) 1.25rem
    clamp(0.875rem, 1.6vw, 1.25rem) 0;
  border-bottom: 1px solid var(--rule);
}

.page-audit .audit-vocab__table thead th {
  font-family: var(--mono);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--quiet);
  padding-top: 0;
}

.page-audit .audit-vocab__table tbody th {
  font-weight: 400;
  white-space: nowrap;
}

.page-audit .audit-vocab__table tbody td {
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--quiet);
}

.page-audit .audit-vocab__table tbody td:last-child {
  padding-right: 0;
  min-width: 22rem;
}

.page-audit .audit-vocab__note {
  margin: clamp(1.25rem, 2.5vw, 1.75rem) 0 0;
  max-width: 68ch;
}

/* =====================================================================
   Guarantee — paper
   ===================================================================== */

.page-audit .audit-guarantee__head {
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.page-audit .audit-guarantee__head > * {
  margin: 0;
}

.page-audit .audit-guarantee__title {
  max-width: 22ch;
}

/* Four claims. They are a list, not a sequence — the ordinals number
   them for reference, they do not order them in time. */
.page-audit .audit-guarantee__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

@media (min-width: 56rem) {
  .page-audit .audit-guarantee__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 4vw, 4rem);
  }
}

.page-audit .audit-guarantee__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: clamp(0.875rem, 1.8vw, 1.5rem);
  row-gap: 0.5rem;
  padding-top: clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--rule);
}

.page-audit .audit-guarantee__ordinal {
  grid-row: 1 / span 2;
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.6;
  color: var(--orchid);
}

.page-audit .audit-guarantee__item-title {
  margin: 0;
  max-width: 24ch;
}

.page-audit .audit-guarantee__copy {
  margin: 0;
  max-width: 56ch;
}

.page-audit .audit-guarantee__payoff {
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  max-width: 62ch;
  border-left: 1px solid var(--orchid);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* =====================================================================
   Trail — paper. The centrepiece.
   ===================================================================== */

.page-audit .audit-trail__head {
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.page-audit .audit-trail__head > * {
  margin: 0;
}

.page-audit .audit-trail__title {
  max-width: 18ch;
}

.page-audit .audit-trail__intro {
  max-width: 68ch;
  color: var(--quiet);
}

/* The tab strip only exists once the script has run. Without it the
   page is four labelled trails stacked in order, which is complete —
   just longer. */
.page-audit .audit-trail__tablist {
  display: none;
}

.page-audit [data-trail][data-enhanced] .audit-trail__tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  border-bottom: 1px solid var(--rule);
}

.page-audit .audit-trail__tab {
  appearance: none;
  -webkit-appearance: none;
  margin: 0 0 -1px;
  padding: 0.875rem 1.125rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--quiet);
  transition:
    color var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out);
}

.page-audit .audit-trail__tab:hover {
  color: var(--on-paper);
}

.page-audit .audit-trail__tab:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

/* The selected tab is marked by weight and a rule, not by hue alone. */
.page-audit .audit-trail__tab[aria-selected="true"] {
  color: var(--on-paper);
  border-bottom-color: var(--orchid);
}

.page-audit .audit-trail__panel[hidden] {
  display: none;
}

/* Unenhanced, the four panels stack and need separating. */
.page-audit .audit-trail__panel + .audit-trail__panel {
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.page-audit [data-trail][data-enhanced] .audit-trail__panel + .audit-trail__panel {
  margin-top: 0;
}

.page-audit .audit-trail__path {
  margin: 0 0 clamp(0.75rem, 1.5vw, 1rem);
  color: var(--quiet);
}

/* ---------- the terminal block ---------- */

.page-audit .audit-trail__terminal {
  padding: clamp(1rem, 2vw, 1.5rem) 0;
}

.page-audit .audit-trail__prompt {
  margin: 0 clamp(1rem, 2vw, 1.5rem) clamp(0.75rem, 1.5vw, 1rem);
  font-family: var(--mono);
  font-size: var(--t-small);
  line-height: 1.5;
  color: var(--on-ink-quiet);
  word-break: break-all;
}

.page-audit .audit-trail__sigil {
  color: var(--orchid);
  margin-right: 0.5em;
}

/* Wide output. It scrolls in its own box rather than the page, and it
   is focusable so a keyboard can reach the far end of a line. */
.page-audit .audit-trail__scroll {
  overflow-x: auto;
  padding-inline: clamp(1rem, 2vw, 1.5rem);
}

.page-audit .audit-trail__scroll:focus-visible {
  outline: 2px solid var(--orchid);
  outline-offset: -2px;
}

.page-audit .audit-trail__pre {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.6875rem, 0.6rem + 0.28vw, 0.8125rem);
  line-height: 1.7;
  white-space: pre;
  color: var(--mist);
  tab-size: 2;
}

.page-audit .audit-trail__gloss {
  margin: clamp(1.25rem, 2.5vw, 1.75rem) 0 0;
  max-width: 68ch;
}

.page-audit .audit-trail__coda {
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  max-width: 68ch;
  border-left: 1px solid var(--rule);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* =====================================================================
   Redaction — paper
   ===================================================================== */

.page-audit .audit-redaction__head {
  display: grid;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.page-audit .audit-redaction__head > * {
  margin: 0;
}

.page-audit .audit-redaction__title {
  max-width: 20ch;
}

.page-audit .audit-redaction__grid {
  display: grid;
  gap: clamp(2rem, 4vw, 3.5rem);
}

@media (min-width: 62rem) {
  .page-audit .audit-redaction__grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.page-audit .audit-redaction__prose {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.page-audit .audit-redaction__copy {
  margin: 0;
  max-width: 60ch;
}

/* The paragraph that says the backstop is not the plan. It gets the
   accent rule so it cannot be skimmed past as more description. */
.page-audit .audit-redaction__copy--mark {
  border-left: 1px solid var(--orchid);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
}

.page-audit .audit-redaction__figure {
  margin: 0;
  display: grid;
  gap: 0.625rem;
}

.page-audit .audit-redaction__figcaption {
  color: var(--quiet);
}

.page-audit .audit-redaction__figcaption:not(:first-child) {
  margin-top: clamp(0.75rem, 1.5vw, 1.25rem);
}

.page-audit .audit-redaction__code {
  overflow-x: auto;
  padding: clamp(0.875rem, 1.8vw, 1.25rem);
}

.page-audit .audit-redaction__code:focus-visible {
  outline: 2px solid var(--orchid);
  outline-offset: -2px;
}

.page-audit .audit-redaction__pre {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.6875rem, 0.6rem + 0.28vw, 0.8125rem);
  line-height: 1.7;
  white-space: pre;
  color: var(--mist);
}

.page-audit .audit-redaction__figurenote {
  margin: 0.25rem 0 0;
  max-width: 48ch;
}

/* =====================================================================
   Closing — forest
   ===================================================================== */

.page-audit .audit-closing {
  padding-block: clamp(4rem, 9vw, 7.5rem);
}

.page-audit .audit-closing__inner {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.page-audit .audit-closing__eyebrow {
  margin: 0;
}

.page-audit .audit-closing__title {
  margin: 0;
  max-width: 16ch;
  color: var(--orchid);
}

.page-audit .audit-closing__body {
  margin: 0;
  max-width: 56ch;
}

.page-audit .audit-closing__cta {
  margin: clamp(0.5rem, 1.5vw, 1rem) 0 0;
}

/* =====================================================================
   Footer — restated, scoped
   ===================================================================== */

.page-audit .site-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  padding-block: clamp(2rem, 4vw, 3.5rem);
  border-top: 1px solid var(--rule);
}

.page-audit .site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.page-audit .site-footer__link {
  text-decoration: none;
  font-size: var(--t-body);
  line-height: 1.4;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
  transition:
    color var(--d-hover) var(--ease-out),
    border-color var(--d-hover) var(--ease-out);
}

.page-audit .site-footer__link:hover,
.page-audit .site-footer__link:focus-visible {
  color: var(--orchid);
  border-bottom-color: var(--orchid);
}

.page-audit .site-footer__meta {
  margin: 0;
  color: var(--quiet);
}

/* A disclosure rather than a description. Accent rule and full-contrast
   ink, so it cannot be read as fine print. */
.page-audit .site-footer__note {
  margin: 0;
  max-width: 62ch;
  font-size: var(--t-body);
  line-height: var(--lh-body);
  border-left: 1px solid var(--orchid);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem);
}

/* =====================================================================
   Motion off
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .page-audit .audit-trail__tab,
  .page-audit .site-footer__link {
    transition: none;
  }
}
