/* Rule badges as the family's pills (design spec 10.2): the tier in its tier colors, the check type as an outline pill,
   the rule id in plain mono. A tier beside a heading uses the same small pill. */
.rule-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--ws-radius-sm);
  font: var(--ws-weight-strong) var(--ws-text-sm)/1.4 var(--ws-font-ui);
  white-space: nowrap;
  vertical-align: .15em;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ws-rule);
  color: var(--ws-faint);
}
.rule-badge.rule-id { padding: 0; box-shadow: none; font-weight: var(--ws-weight-regular); }
.tier-never { box-shadow: none; background: var(--ws-never-bg); color: var(--ws-never-fg); }
.tier-avoid { box-shadow: none; background: var(--ws-avoid-bg); color: var(--ws-avoid-fg); }
.tier-prefer { box-shadow: none; background: var(--ws-prefer-bg); color: var(--ws-prefer-fg); }
h1 .rule-badge, h2 .rule-badge, h3 .rule-badge { margin-left: 10px; vertical-align: .3em; letter-spacing: normal; }

/* A rule a link points to: the family's targeted-rule ring. */
p.rule { border-radius: var(--ws-radius); }
p.rule:target { margin-inline: -12px; padding: 10px 12px; border: 1px solid var(--ws-accent); box-shadow: 0 0 0 3px var(--ws-accent-wash); outline: none; }

table.rule-index tr.rule-index-section td { color: var(--ws-ink); font-weight: var(--ws-weight-strong); }
table.rule-index td .rule-badge { margin-left: 0; }
table.rule-index td code.literal { white-space: nowrap; }

/* Generated tables scroll inside their own focusable region on a narrow screen. */
.table-scroll { overflow-x: auto; margin-bottom: var(--ws-space-5); }
.table-scroll > table { margin-bottom: 0; }
.table-scroll:focus-visible { outline: 2px solid var(--ws-accent); outline-offset: 2px; }
@media (max-width: 30em) {
  table.rule-index th, table.rule-index td { padding-left: 0.5rem; padding-right: 0.5rem; }
}
/* On a phone the ids wrap at their hyphens, so the id column stays narrow and the rule names show beside it;
   the table keeps a readable width and scrolls for the rest. A fade at the right edge says there is more. */
@media (max-width: 40em) {
  table.rule-index { min-width: 32rem; }
  table.rule-index td:first-child { width: 8.5rem; }
  table.rule-index td:first-child code.literal { white-space: normal; overflow-wrap: anywhere; }
  .table-scroll {
    background:
      linear-gradient(to right, var(--ws-sheet) 40%, transparent) left / 24px 100% no-repeat local,
      linear-gradient(to left, var(--ws-sheet) 40%, transparent) right / 24px 100% no-repeat local,
      linear-gradient(to right, color-mix(in srgb, var(--ws-ink) 14%, transparent), transparent) left / 12px 100% no-repeat scroll,
      linear-gradient(to left, color-mix(in srgb, var(--ws-ink) 14%, transparent), transparent) right / 12px 100% no-repeat scroll,
      var(--ws-sheet);
  }
}
