@import url("tokens.css");

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

body {
  margin: 0;
  font-family: var(--av-font-sans);
  font-size: var(--av-text-base);
  line-height: var(--av-leading-body);
  color: var(--av-ink);
  background: var(--av-ivory);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--av-red); }
a:hover { color: var(--av-red-deep); }

h1, h2, h3 {
  margin: 0 0 var(--av-space-4);
  line-height: var(--av-leading-tight);
  letter-spacing: -0.01em;
  font-family: var(--av-font-display);
  font-weight: 600;
}

h1 { font-size: var(--av-text-2xl); }
h2 { font-size: var(--av-text-xl); }
h3 { font-size: var(--av-text-lg); }

/* Small uppercase label. Used for every field caption and metric caption. */
.av-label {
  font-size: var(--av-text-xs);
  letter-spacing: var(--av-tracking-label);
  text-transform: uppercase;
  color: var(--av-grey-600);
}

/* Every figure in the system. Tabular numerals so columns align. */
.av-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.av-rule {
  border: 0;
  border-top: var(--av-border-width) solid var(--av-rule);
  margin: var(--av-space-6) 0;
}

.av-btn {
  display: inline-block;
  font: inherit;
  font-size: var(--av-text-sm);
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  padding: var(--av-space-2) var(--av-space-6);
  font-weight: 700;
  border: var(--av-border-width) solid var(--av-border);
  background: var(--av-white);
  color: var(--av-ink);
  cursor: pointer;
  border-radius: var(--av-radius-md);
}

.av-btn:hover { background: var(--av-blush); border-color: var(--av-red); }

.av-btn--primary {
  background: var(--av-red);
  border-color: var(--av-red);
  color: var(--av-white);
}

.av-btn--primary:hover {
  background: var(--av-red-deep);
  border-color: var(--av-red-deep);
  color: var(--av-white);
}

.av-input {
  font: inherit;
  font-size: var(--av-text-base);
  padding: var(--av-space-2) var(--av-space-3);
  border: var(--av-border-width) solid var(--av-rule);
  background: var(--av-white);
  color: var(--av-ink);
  border-radius: var(--av-radius-sm);
  width: 100%;
}

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

.av-table th {
  text-align: left;
  font-size: var(--av-text-xs);
  letter-spacing: var(--av-tracking-label);
  text-transform: uppercase;
  color: var(--av-grey-600);
  font-weight: 600;
  padding: var(--av-cell-pad);
  border-bottom: var(--av-border-width) solid var(--av-ink);
}

.av-table td {
  padding: var(--av-cell-pad);
  height: var(--av-row-height);
  border-bottom: var(--av-border-width) solid var(--av-rule);
}

.av-table td.av-num { text-align: right; }

.av-status--critical { color: var(--av-critical); }
.av-status--verified { color: var(--av-verified); }

/* ---- Layout ----------------------------------------------------------- */

/*
 * The page container. This was an inline style on the design-system page,
 * which left --av-max-width a token with exactly one consumer that no other
 * surface could reuse.
 */
.av-shell {
  max-width: var(--av-max-width);
  margin: 0 auto;
  padding: var(--av-space-8) var(--av-space-4);
}

@media (min-width: 48rem) {
  .av-shell { padding: var(--av-space-12) var(--av-space-6); }
}

/* Vertical rhythm between sibling blocks. */
.av-stack > * + * { margin-top: var(--av-space-4); }

/* Prose measure. Long lines are hard to read at any viewport width. */
.av-prose {
  max-width: 40rem;
  color: var(--av-grey-600);
}

/*
 * Two columns on anything wider than a phone; one column on a phone. The
 * inline grid-template-columns:1fr 1fr this replaces applied at every width,
 * so two tables sat side by side at 390px with nowhere to go.
 */
.av-cols {
  display: grid;
  gap: var(--av-space-8);
}

@media (min-width: 48rem) {
  .av-cols { grid-template-columns: 1fr 1fr; }
}

/* A row of controls. Wraps rather than overflowing. */
.av-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--av-space-3);
  align-items: center;
}

/* Colour swatches: fluid tiles rather than fixed 110px ones. */
.av-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: var(--av-space-4);
}

.av-swatch { height: 4rem; }

.av-swatch { border-radius: var(--av-radius-md); border: var(--av-border-width) solid var(--av-border); }

.av-swatch--ink { background: var(--av-ink); }
.av-swatch--red { background: var(--av-red); }
.av-swatch--red-deep { background: var(--av-red-deep); }
.av-swatch--ivory { background: var(--av-ivory); }
.av-swatch--blush { background: var(--av-blush); }
.av-swatch--border { background: var(--av-border); }
.av-swatch--muted { background: var(--av-muted); }
.av-swatch--navy-900 { background: var(--av-navy-900); }
.av-swatch--navy-700 { background: var(--av-navy-700); }
.av-swatch--grey-600 { background: var(--av-grey-600); }
.av-swatch--grey-200 { background: var(--av-grey-200); }
.av-swatch--critical { background: var(--av-critical); }
.av-swatch--verified { background: var(--av-verified); }

/* Type-scale specimens. Only the design-system page uses these. */
.av-specimen-3xl { font-size: var(--av-text-3xl); line-height: var(--av-leading-tight); margin: 0 0 var(--av-space-2); }
.av-specimen-2xl { font-size: var(--av-text-2xl); margin: 0 0 var(--av-space-2); }
.av-specimen-xl  { font-size: var(--av-text-xl);  margin: 0 0 var(--av-space-2); }
.av-specimen-base { font-size: var(--av-text-base); margin: 0 0 var(--av-space-2); }
.av-specimen-sm  { font-size: var(--av-text-sm);  margin: 0 0 var(--av-space-2); }

.av-table--narrow { max-width: 30rem; }
.av-input--narrow { max-width: 22rem; }
.av-num-head { text-align: right; }

/*
 * A dense table scrolls inside its own box; the document never scrolls
 * sideways. The ledger, case-queue and control-room tables of sub-projects 3
 * to 6 will not fit a phone, and this wrapper is what stops that from
 * becoming the whole page's problem.
 */
.av-table-scroll { overflow-x: auto; }

/* ---- Control states --------------------------------------------------- */

/*
 * :focus-visible, not :focus, so a mouse click leaves no ring behind while
 * keyboard and assistive-technology users still get one. Browsers treat text
 * inputs as always focus-visible, so a clicked field is still marked. A
 * security system that cannot be driven from the keyboard is a poor argument
 * for itself.
 */
.av-btn:focus-visible,
.av-input:focus-visible,
.av-nav a:focus-visible,
.av-skip-link:focus-visible {
  outline: 3px solid var(--av-red);
  outline-offset: 2px;
}

.av-btn:disabled,
.av-btn[aria-disabled="true"] {
  color: var(--av-muted);
  border-color: var(--av-rule);
  background: var(--av-divider);
  opacity: 0.7;
  cursor: not-allowed;
}

/* For an action that destroys or reverses. Uses the one critical colour. */
.av-btn--destructive {
  border-color: var(--av-critical);
  color: var(--av-critical);
}

.av-btn--destructive:hover {
  background: var(--av-critical);
  border-color: var(--av-critical);
  color: var(--av-white);
}

.av-input--error {
  border-color: var(--av-critical);
  border-width: 2px;
}

/*
 * A field caption and its hint. This replaces the placeholder-as-example-value
 * pattern: a placeholder vanishes the moment anyone types, leaving no record
 * of what the field wanted, and screen readers treat it inconsistently.
 */
.av-field { display: block; }

.av-hint {
  font-size: var(--av-text-xs);
  color: var(--av-grey-600);
}

/* The customer number shown once on the registration confirmation page.
 * Tabular numerals so the digits sit in fixed-width columns, per parent
 * spec section 5: this is a figure, not a label. */
.av-figure--display {
  font-family: var(--av-font-display);
  font-weight: 600;
  font-size: var(--av-text-3xl);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

/* ---- Page chrome ------------------------------------------------------ */

.av-header {
  background: var(--av-white);
  border-bottom: var(--av-border-width) solid var(--av-border);
}

/*
 * .av-header__inner carries .av-shell for width alignment, and this rule
 * overrides only its vertical padding. Both selectors are single-class, so
 * this wins on specificity purely because it is declared after .av-shell in
 * this file — move this block above the layout section and the shell's
 * padding wins instead.
 */
.av-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--av-space-4);
  align-items: center;
  justify-content: space-between;
  padding-top: var(--av-space-4);
  padding-bottom: var(--av-space-4);
}

.av-wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--av-space-2);
  color: var(--av-ink);
  text-decoration: none;
}

.av-wordmark:hover { color: var(--av-ink); }

.av-wordmark__mark {
  flex: none;
  width: 30px;
  height: 30px;
}

.av-wordmark__text {
  font-family: var(--av-font-display);
  font-size: var(--av-text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
}

.av-nav a {
  color: var(--av-ink);
  font-weight: 500;
  text-decoration: none;
  font-size: var(--av-text-sm);
}

.av-nav a:hover { text-decoration: underline; }

.av-nav__link--active { font-weight: 700; color: var(--av-red); }

/*
 * Always visible, wrapping onto a second line on a phone. No toggle: a
 * <details> disclosure was tried and rejected, because a browser does not
 * render a closed <details>'s non-summary children and no CSS can reveal
 * them — hiding the summary above a breakpoint produced a desktop header with
 * no navigation at all. A JavaScript toggle would work and is refused: page
 * chrome that needs scripting breaks with scripting off. Four short links do
 * not need a hamburger.
 */
.av-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--av-space-4);
}

@media (min-width: 48rem) {
  .av-nav__list { gap: var(--av-space-6); }
}

.av-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--av-space-4);
  align-items: center;
}

/* A quiet text link, never a second button: one page, one primary action. */
.av-header__signin {
  color: var(--av-ink);
  font-weight: 600;
  font-size: var(--av-text-sm);
  text-decoration: none;
}

.av-header__signin:hover { text-decoration: underline; }

.av-footer {
  margin-top: var(--av-section-gap);
  border-top: var(--av-border-width) solid var(--av-rule);
}

.av-footer__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--av-space-6);
  padding: 0;
  margin: var(--av-space-6) 0;
}

.av-footer__links a {
  color: var(--av-muted);
  font-size: var(--av-text-sm);
}

/* ---- Three-column variant --------------------------------------------- */

/*
 * The home page's three pillars. Appended at the end of the file on purpose:
 * it shares no selector with the chrome block above, so the source order the
 * chrome block depends on is untouched. The rule lives inside the media query
 * so a phone gets one column and a tablet keeps the two of .av-cols.
 */
@media (min-width: 64rem) {
  .av-cols--three { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Skip link --------------------------------------------------------- */

/*
 * Appended, like every block after the chrome section, so the source order
 * .av-header__inner depends on is untouched.
 *
 * Hidden by clip rather than by a negative offset: a 1px box that stays where
 * it is cannot widen the document, and PageLayoutTest fails the whole suite on
 * a page that scrolls sideways. On focus it becomes an ordinary block at the
 * top of the header, pushing the chrome down rather than floating over it —
 * nothing can then obscure it. The focus ring itself is the shared
 * :focus-visible treatment declared in the control-states block above.
 */
.av-skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.av-skip-link:focus-visible {
  position: static;
  display: inline-block;
  width: auto;
  height: auto;
  /* Margin, not padding, so the shared focus ring is drawn clear of the
     viewport edge instead of being clipped against it. */
  margin: var(--av-space-3) var(--av-space-4);
  padding: var(--av-space-2) var(--av-space-4);
  overflow: visible;
  clip-path: none;
  font-size: var(--av-text-sm);
  color: var(--av-ink);
  background: var(--av-white);
  border-radius: var(--av-radius-sm);
}


/* ---- Brand surfaces ---------------------------------------------------- */

/* Cards and tables sit on white against the Ivory page. */
.av-table { background: var(--av-white); border-radius: var(--av-radius-lg); overflow: hidden; }
.av-table td { border-bottom-color: var(--av-divider); }

.av-hint, .av-label { color: var(--av-muted); }

.av-status--critical { color: var(--av-red-deep); }

.av-logo-specimen { width: 64px; height: 64px; }
