/* /demos/access-audit-lab — the access-audit page's own chrome.
 *
 * Colors come from the site variables in css.css so the page follows the theme
 * toggle. Nothing here restates a value the shell already owns, and nothing
 * here keys on a Go constant — the tier and severity class names are the only
 * shared vocabulary and they arrive from the template. */

.aal-provenance {
  border-left: 3px solid var(--border, #ccc);
  padding: 0.5rem 0 0.5rem 1rem;
  margin: 1.5rem 0;
}

.aal-provenance p {
  margin-bottom: 0.6rem;
}

.aal-provenance code {
  font-size: 0.85em;
  word-break: break-all;
}

/* The headline figures. A grid rather than a flex row so the four boxes stay
 * the same width as their numbers change under a slider — a layout that
 * reflowed on every keystroke would read as the page glitching. */
.aal-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0.75rem;
}

.aal-figure {
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  text-align: center;
}

.aal-figure-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.aal-figure-label {
  display: block;
  font-size: 0.85rem;
  opacity: 0.8;
}

.aal-note {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-bottom: 1.25rem;
}

.aal-denominator {
  opacity: 0.7;
  font-size: 0.9em;
}

.aal-clean-row {
  font-weight: 600;
}

/* Tier and severity badges. The tier scale is deliberately NOT a red-amber-green
 * ramp: tier is what a rule compares, not how bad it is, and coloring it like a
 * severity would tell a reader that a peer comparison is the safe kind of
 * finding. Severity gets the ramp, because that is what it means. */
.aal-tier,
.aal-sev {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.aal-tier {
  border: 1px solid var(--border, #ccc);
}

.aal-tier-1 { border-style: solid; }
.aal-tier-2 { border-style: dashed; }
.aal-tier-3 { border-style: dotted; }

.aal-sev-high {
  background: #b3261e;
  color: #fff;
}

.aal-sev-medium {
  background: #8a5a00;
  color: #fff;
}

.aal-sev-low {
  background: transparent;
  border: 1px solid var(--border, #ccc);
}

/* The controls. */
.aal-stage {
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0 2rem;
}

.aal-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
}

.aal-control label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.aal-control input[type="range"],
.aal-control select {
  width: 100%;
}

.aal-control-note {
  font-size: 0.82rem;
  opacity: 0.8;
  margin: 0.35rem 0 0;
}

.aal-control-toggle label {
  font-weight: 600;
}

.aal-status {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.aal-live-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.aal-decisions {
  opacity: 0.85;
}

/* The queue. */
.aal-queue {
  list-style: none;
  padding-left: 0;
}

.aal-finding {
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.aal-finding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.aal-rule-title {
  font-weight: 600;
}

.aal-who {
  margin-bottom: 0.25rem;
}

.aal-detail,
.aal-grants {
  margin-bottom: 0.5rem;
}

.aal-grants code {
  font-size: 0.85em;
}

/* The assessment panel is visually distinct from the engine's own output,
 * because they have different authors and different standing: one is a
 * deterministic rule and the other is a model's prose. A reader who cannot tell
 * them apart has been given a worse page. */
.aal-assessment {
  border-left: 3px solid var(--border, #ccc);
  background: rgba(127, 127, 127, 0.06);
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0;
  border-radius: 0 6px 6px 0;
}

.aal-assessment-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
  margin: 0 0 0.4rem;
}

.aal-narrative {
  margin-bottom: 0.5rem;
}

.aal-action {
  margin-bottom: 0;
  font-size: 0.92rem;
}

/* The no-assessment case is ITALIC AND MUTED rather than hidden or blank. A
 * blank panel reads as "nothing to say about this finding", which is the
 * opposite of "nobody has been asked about this finding". */
.aal-no-assessment {
  font-style: italic;
  opacity: 0.8;
  margin-bottom: 0;
}

.aal-decide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.aal-certify,
.aal-revoke {
  border: 1px solid var(--border, #ccc);
  background: transparent;
  color: inherit;
}

.aal-certify:hover,
.aal-revoke:hover {
  border-color: currentColor;
}

/* A decided finding is dimmed but STAYS IN THE LIST. Removing it would make the
 * queue shorter as a reader works, which looks like progress and loses the
 * record of what they decided — and the end summary is a count of exactly
 * that. */
.aal-finding[data-decision] {
  opacity: 0.6;
}

.aal-finding[data-decision] .aal-decide button {
  visibility: hidden;
}

.aal-decided {
  font-weight: 600;
  font-size: 0.85rem;
}

.aal-summary {
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 600;
}

.aal-limits li {
  margin-bottom: 0.4rem;
}

.aal-source {
  font-size: 0.9rem;
  opacity: 0.9;
}

@media (max-width: 576px) {
  .aal-figure-value {
    font-size: 1.5rem;
  }

  .aal-finding-head {
    gap: 0.35rem;
  }
}

/* The honesty box. It is the page's POSITIONING, not a disclaimer, and it is
 * styled as a panel near the top rather than as small print at the bottom for
 * exactly that reason: the version of this page that shipped in PF-S272 put its
 * claims in a bulleted "what this is not" list below the fold, and what a reader
 * took from the page was the list of findings with no idea what they were for. */
.aal-honesty {
  border: 1px solid var(--border, #ccc);
  border-left-width: 4px;
  border-radius: 0 8px 8px 0;
  padding: 0.9rem 1.1rem;
  margin: 1.5rem 0 2rem;
}

.aal-honesty-head {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}

.aal-honesty ul {
  margin: 0;
  padding-left: 1.1rem;
}

.aal-honesty li {
  margin-bottom: 0.55rem;
}

.aal-honesty li:last-child {
  margin-bottom: 0;
}

/* The coverage matrix. One block per framework rather than one wide table with
 * a framework column: the three frameworks say different things about what a
 * "control" IS — two publish numbered criteria and one publishes none — and a
 * single table would put a family-level row next to a numbered one under one
 * heading, which is the visual claim that they are the same kind of thing. */
.aal-framework {
  margin-bottom: 1.75rem;
}

.aal-framework h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.aal-framework-count {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.aal-control-id {
  font-weight: 700;
}

/* A family-level citation is LABELED rather than left to look like a missing
 * identifier. An empty cell where every sibling row has a code reads as data
 * that failed to load. */
.aal-control-family {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1px dashed var(--border, #ccc);
  border-radius: 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

.aal-controls-cited {
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.aal-cite {
  display: inline-block;
  opacity: 0.9;
}

.aal-rule-controls {
  font-size: 0.85em;
}

/* The evidence report. */
.aal-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.aal-report-actions .btn {
  border: 1px solid var(--border, #ccc);
  background: transparent;
  color: inherit;
}

.aal-report {
  border: 1px solid var(--border, #ccc);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.aal-report h3 {
  margin-top: 0;
}

.aal-report-meta {
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.aal-report-meta dt {
  font-weight: 700;
}

.aal-report-meta dd {
  margin: 0 0 0.4rem;
  word-break: break-word;
}

.aal-report-item {
  border-top: 1px solid var(--border, #ccc);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.aal-report-decision {
  font-weight: 700;
}

.aal-report-undecided {
  font-style: italic;
  opacity: 0.8;
}

/* The attestation block. The signature rule is a real empty box rather than a
 * row of underscores, because underscores do not survive a PDF export at every
 * zoom level and a signature line that vanishes is the one element of this
 * report that has to be there. */
.aal-attestation {
  border: 1px solid var(--border, #ccc);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin-top: 1.5rem;
}

.aal-signature-rule {
  border-bottom: 1px solid currentColor;
  height: 2.5rem;
  margin: 1rem 0 0.35rem;
  max-width: 26rem;
}

.aal-signature-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* PRINT. The report is the only thing on the page worth putting on paper: the
 * sliders do nothing on a page nobody can move, the queue's buttons are dead
 * ink, and the shell's navigation is a list of links that cannot be followed.
 * So printing hides everything and shows the report alone.
 *
 * IT KEYS ON A CLASS THE SCRIPT ADDS, not on the report existing. A visitor who
 * prints before generating the report should get the ordinary page rather than
 * a blank sheet. */
@media print {
  body.aal-printing > *:not(.container),
  body.aal-printing .container > .row > .col-12 > *:not(#aal-report) {
    display: none !important;
  }

  body.aal-printing #aal-report {
    display: block !important;
    border: none;
    padding: 0;
  }

  body.aal-printing .aal-report-item {
    break-inside: avoid;
  }

  body.aal-printing .aal-attestation {
    break-inside: avoid;
  }
}

@media (max-width: 576px) {
  .aal-report-actions .btn {
    width: 100%;
  }
}

/* HIDDEN MUST WIN, and this block is here because it did not.
 *
 * The `hidden` attribute is styled by the UA stylesheet as `display: none`, and
 * a UA rule loses to ANY author rule that sets display — so `.btn`'s
 * `display: inline-block` and `.aal-live-figures`' `display: flex` each silently
 * defeated it. The evidence report's Print and Download buttons were therefore
 * on screen from first paint, before any report existed, and the live-figures
 * strip showed a row of em-dashes under headings claiming to be counts.
 *
 * PF-S274 shipped that in 21c2fd7 and the E2E caught it against dev. It is
 * written as two SPECIFIC selectors rather than a blanket `[hidden] { display:
 * none !important }` because a page-wide important rule in a per-demo stylesheet
 * reaches the shell too, and the fix for a specificity accident should not be a
 * bigger specificity accident. */
.aal-report-actions [hidden] {
  display: none;
}

.aal-live-figures[hidden] {
  display: none;
}
