/* The Modules page (packs/administration; D-51): the little Administration::ModulesListComponent and Administration::ModuleSwitchComponent add to the shared components they are
   arranged from (PageSectionComponent, CardComponent, BadgeComponent, IconComponent, ButtonComponent, CalloutComponent, EmptyStateComponent and the form system, Forms::*, which bring
   their own look). These rules only lay out what is between them.

   * The list: one card per module in a grid, as many columns as fit and one at 320 CSS px (cards at every width, never a wide table). A card's heading is the module's name with On
     or Off beside it, a word and an icon in a badge, so the badge's tone is never the only signal (WCAG 1.4.1); under it what the module is for and why it is as it is, one line
     each; its footer the one Switch link, which wraps a long name onto more lines instead of widening the card. A module's features are a list in its card, each under a hairline.
   * The confirmation: one reading column, as every form is; what the module is now sits together above what switching it will change.

   Tokens only and logical properties only, both enforced (test/styles/tokens_test.rb, test/styles/components_test.rb), so it reads on the light shell and the console, in light and
   in dark, and mirrors in a right-to-left language. Nothing pinned to an edge or sticky (WCAG 2.4.11), no height in vh, and everything that holds words may shrink and wrap, so a
   language 40% longer never widens the page (WCAG 1.4.10). */

/* ── The list ────────────────────────────────────────────────────────────── */
.modules-list__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-3);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.modules-list__card {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/* The footer sits at the foot of the card whatever is above it, so the links of a row line up. */
.modules-list__card > .card-body {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: var(--space-1);
}

.modules-list__card .card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-inline-size: 0;
}

/* A module that is off has the muted edge as well as the word. */
.modules-list__card[data-enabled="false"] {
  border-inline-start-width: 4px;
}

.modules-list__description,
.modules-list__why,
.module-switch__state,
.module-switch__description,
.module-switch__why,
.module-switch__what {
  margin-block: 0;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.modules-list__why,
.module-switch__why {
  color: var(--fg2);
  font-size: var(--text-sm);
}

/* The badge holds an icon and a word; the icon is the size of the word. */
.modules-list__state-icon {
  inline-size: 1em;
  block-size: 1em;
  flex: none;
  vertical-align: -0.125em;
}

.modules-list__key {
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* A name, a description or a reason is a span with dir="auto": an isolate in its own direction, said here as well as by the browser's own rule for [dir]. */
.modules-list__name,
.modules-list__reason,
.modules-list__description-text {
  unicode-bidi: isolate;
}

/* A module's features: a list inside its card, each under a hairline, said as the module is, with its own Switch link. */
.modules-list__features {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.modules-list__feature {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
  padding-block-start: var(--space-2);
  border-block-start: 1px solid var(--rule);
  overflow-wrap: anywhere;
}

.modules-list__feature-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-inline-size: 0;
  margin: 0;
  font-size: var(--text-base);
}

.modules-list__waits {
  margin-block: 0;
  min-inline-size: 0;
  font-size: var(--text-sm);
}

.modules-list__feature-switch {
  margin-block-start: var(--space-1);
}

.modules-list__switch {
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

/* ── The confirmation ────────────────────────────────────────────────────── */
.module-switch__now {
  display: grid;
  gap: var(--space-1);
  min-inline-size: 0;
  max-inline-size: 72ch;
}

.module-switch__state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.module-switch__what {
  max-inline-size: 72ch;
  margin-block: var(--space-3);
}

.module-switch__back {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-block-start: var(--space-3);
}

.module-switch .form-actions .btn {
  max-inline-size: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
