/* Cloud & Maintenance demo: this site's own Lighthouse scores and page weights, written in at build time
   from build/qa.json (assets/js/demos/qa.js adds the device switch and the page picker). */

.qa {
  display: grid;
  gap: var(--space-m);
  padding: var(--space-s);
  background: var(--paper);
  border: var(--border);
  border-radius: calc(var(--radius) * 2);
  box-shadow: var(--shadow);
  font-family: var(--font-sans);
  font-size: var(--step--1);
}

.qa__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
}

.qa__meta,
.qa__note,
.qa__detail,
.qa__label {
  color: var(--ink-2);
}

.qa__panel {
  display: grid;
  gap: var(--space-m);
}

.qa__panel[hidden] {
  display: none;
}

/* Names the panel without JavaScript; with it, the switch already does. */
.js .qa__device {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.qa__device {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-2);
}

/* The four scores for all pages (the lowest) or for the page picked below. */

.qa__focus {
  display: grid;
  gap: var(--space-s);
  padding-bottom: var(--space-m);
  border-bottom: var(--border);
}

.qa__scope {
  font-weight: 500;
}

.qa__scores {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-m);
}

.qa__score {
  display: block;
  font-size: var(--step-4);
  font-weight: 500;
  line-height: 1;
}

.qa__meter {
  display: block;
  height: 4px;
  margin-block: var(--space-xs) var(--space-2xs);
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.qa__meter span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(var(--s));
  transform-origin: left;
  transition: transform var(--dur-rise) var(--ease-out);
}

/* Every page */

.qa__table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.qa__table :is(th, td) {
  padding: 0.25rem 0.1875rem;
  border-bottom: var(--border);
  text-align: right;
}

.qa__table thead th {
  color: var(--ink-2);
  font-weight: 400;
}

.qa__table :is(th, td):first-child {
  text-align: left;
}

.qa__table abbr {
  text-decoration: none;
}

.qa__pick {
  min-height: 2.75rem;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.25em;
}

.qa__pick:hover:not(:disabled) {
  color: var(--link-hover);
}

.qa__pick:disabled {
  cursor: default;
  text-decoration: none;
}

.qa__pick[aria-pressed="true"] {
  font-weight: 500;
  text-decoration-color: currentColor;
}

.qa__table tr:has([aria-pressed="true"]) {
  background: var(--paper-2);
}

.qa__weight {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
}

.qa__bar {
  display: none;
}

@media (min-width: 600px) {
  .qa {
    padding: var(--space-m);
  }

  .qa__scores {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .qa__table :is(th, td) {
    padding-inline: 0.75rem;
  }

  .qa__bar {
    display: block;
    width: 6rem;
    height: 6px;
    border-radius: 3px;
    background: var(--ink-2);
    transform: scaleX(var(--w));
    transform-origin: left;
  }
}
