/* OAIT Design System 2.1.0 · reference/css/list.css
   Lists, list rows, key–value rows, and dividers (unit c-containers).

   Components
   - List (.oa-list): a bare list of rows with hairlines between them, or drawn as an outlined card
     (--card).
   - List row (.oa-list-row): one, two, or three lines; leading icon, avatar, or disc; headline and
     supporting text; trailing meta, chip, chevron, switch, or icon button. Pressable as a whole (an
     <a> or <button>) or holding controls, never both.
   - Key–value rows (.oa-kv): a <dl> of label and value, stacked in narrow columns and on one row
     from a 640px-wide container.
   - Divider (.oa-divider, --inset) and the "or" divider (.oa-divider-or).

   Implements canonical §10.12, §4.5, §6.2, §6.3, §2.7, §8.3 and D-CSN-02, D-CSN-07, D-CSN-18,
   D-ARC-20, D-ARC-24, D-ARC-25, D-COL-05, D-SEM-10, D-SEM-11, D-LAY-02, D-BCP-15, D-BCP-33.

   Tokens read: --color-outline-variant, --color-card-outlined-container, --color-on-surface,
   --color-on-surface-variant; --size-list-row, --size-list-row-two-line, --size-list-row-three-line,
   --size-avatar-sm, --size-focus-inset; --space-row-inset, --space-row-inset-medium, --space-1,
   --space-2, --space-3, --space-4, --space-stack-tight; --z-behind; --radius-card; --font-weight-semibold;
   --opacity-state-hover, --opacity-state-pressed, --opacity-state-disabled-content;
   --duration-short-3; --ease-standard; --text-title-sm, --text-body-md with their --line-height,
   --letter-spacing and --font-weight companions.
   Context property read: --oa-state (the state-layer opacity; documentation pages force it inline).

   Classes: .oa-list (+ --card), .oa-list-row (+ --two-line, --three-line; __leading, __content,
   __headline, __supporting, __trailing, __meta), .oa-kv (+ __row, __key, __value), .oa-divider
   (+ --inset), .oa-divider-or.

   Relies on base.css for .oa-icon (and --mirror on the trailing chevron_right) and the focus ring.
   Breakpoint is literal: sm 40rem (640px). */


/* ---------------------------------------------------------------------------------------------
   1. List. A <ul> (or <ol>) without bullets; a 1px outline-variant hairline between rows, never
   before the first (D-CSN-02, D-CSN-07). --card draws the list as an outlined card: the rows bring
   their own inline padding, so the card has none, and 8px above and below the rows (canonical
   §10.10: a card holding a list has no inline padding). The card clips the rows' state layers to
   its corners.
   --------------------------------------------------------------------------------------------- */

.oa-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.oa-list > li + li {
  border-block-start: 1px solid var(--color-outline-variant);
}

.oa-list--card {
  overflow: hidden;
  padding-block: var(--space-2);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-card);
  background-color: var(--color-card-outlined-container);
  color: var(--color-on-surface);
}


/* ---------------------------------------------------------------------------------------------
   2. List row. At least 56px (one line), 72px (two lines), or 88px (three lines); 16px inline
   padding, the start 24px from 640px so row text lines up with card padding; 8px block padding,
   12px for three lines; 16px between slots (canonical §4.5, §10.12; D-CSN-07, D-ARC-24, D-ARC-25).
   The class goes on the <li> of a row that holds controls, or on the one <a> or <button> inside the
   <li> of a row pressed as a whole.
   --------------------------------------------------------------------------------------------- */

.oa-list-row {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap; /* the trailing slot moves under the text when the text would get less than 96px */
  align-items: center;
  gap: var(--space-2) var(--space-4);
  box-sizing: border-box;
  inline-size: 100%;
  min-block-size: var(--size-list-row);
  margin: 0;
  padding-block: var(--space-2);
  padding-inline: var(--space-row-inset);
  border: 1px solid transparent; /* forced colors draw a pressable row's edge; static rows keep it so all rows line up */
  color: var(--color-on-surface);
  text-align: start;
}

@media (min-width: 40rem) {
  .oa-list-row {
    padding-inline-start: var(--space-row-inset-medium);
  }
}

.oa-list-row--two-line {
  min-block-size: var(--size-list-row-two-line);
}

/* Three lines: leading and trailing slots align to the top; 12px block padding. */
.oa-list-row--three-line {
  align-items: flex-start;
  min-block-size: var(--size-list-row-three-line);
  padding-block: var(--space-3);
}


/* Pressable row: the whole row is one link or button, with the state layer of on-surface (8% on
   hover, 12% pressed) over its border box, a transparent 1px border for forced colors, and the
   ring drawn inset (-4px), because the list clips it (canonical §2.7, §6.3; D-COL-05, D-SEM-11). */

a.oa-list-row,
button.oa-list-row {
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a.oa-list-row::before,
button.oa-list-row::before {
  content: "";
  position: absolute;
  inset: -1px; /* over the 1px transparent edge as well */
  z-index: var(--z-behind);
  background-color: currentColor;
  opacity: var(--oa-state, 0);
  pointer-events: none;
  transition: opacity var(--duration-short-3) var(--ease-standard);
}

@media (hover: hover) {
  a.oa-list-row:hover,
  button.oa-list-row:hover {
    --oa-state: var(--opacity-state-hover);
  }
}

a.oa-list-row:active,
button.oa-list-row:active {
  --oa-state: var(--opacity-state-pressed);
}

a.oa-list-row:active::before,
button.oa-list-row:active::before {
  transition-duration: 0ms; /* lint-ok: a press shows at once; only hover and release fade (canonical §2.7, §7.2) */
}

a.oa-list-row:focus-visible,
a.oa-list-row[data-demo-focus],
button.oa-list-row:focus-visible,
button.oa-list-row[data-demo-focus] {
  outline-offset: var(--size-focus-inset);
}

/* Disabled (rare; never to signal invalid input): content at 38%, no layer (D-ARC-33). */
button.oa-list-row:disabled {
  --oa-state: 0;
  color: color-mix(in srgb, var(--color-on-surface) calc(var(--opacity-state-disabled-content) * 100%), transparent);
  cursor: default;
}

button.oa-list-row:disabled :is(.oa-list-row__leading, .oa-list-row__supporting, .oa-list-row__trailing, .oa-list-row__meta) {
  color: inherit;
}


/* Slots. Leading: a 24px icon in on-surface-variant, or a 40px avatar or disc. Headline title-sm;
   supporting body-md in on-surface-variant, two lines at most (written, not cut). Trailing: meta
   text, a chip, a mirrored chevron_right, a switch, or a 48px icon button (canonical §10.12). */

.oa-list-row__leading {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: var(--color-on-surface-variant);
}

/* The text takes the room left and never less than 96px: when a trailing button would leave it less
   (a 320px window, "Disconnect" beside "Connected as Layla Haddad"), the trailing slot wraps onto its
   own line at the inline end instead of breaking the words. */
.oa-list-row__content {
  display: flex;
  flex: 1 1 var(--space-24);
  flex-direction: column;
  min-inline-size: 0;
}

.oa-list-row__headline {
  display: block;
  margin: 0;
  font-size: var(--text-title-sm);
  line-height: var(--text-title-sm--line-height);
  letter-spacing: var(--text-title-sm--letter-spacing);
  font-weight: var(--text-title-sm--font-weight);
  overflow-wrap: anywhere;
}

.oa-list-row__supporting {
  display: block;
  margin: 0;
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
  overflow-wrap: anywhere;
}

.oa-list-row__trailing {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
  color: var(--color-on-surface-variant);
}

.oa-list-row__meta {
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}


/* ---------------------------------------------------------------------------------------------
   3. Key–value rows. A <dl> whose rows (<div class="oa-kv__row">) hold one <dt> and one <dd>:
   the key in body-md on-surface-variant, the value in body-md 600 on-surface. Stacked (8px apart)
   in a narrow column; key and value on one row, the value at the inline end, once the list is
   640px wide. A container query, because key–value lists sit in cards, panes, and dialogs of every
   width (canonical §4.2, §10.12; D-LAY-02). Hairlines between rows, as between list rows.
   --------------------------------------------------------------------------------------------- */

.oa-kv {
  container-type: inline-size;
  margin: 0;
  padding: 0;
}

.oa-kv__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-stack-tight);
  padding-block: var(--space-3);
}

.oa-kv__row + .oa-kv__row {
  border-block-start: 1px solid var(--color-outline-variant);
}

.oa-kv__key {
  margin: 0;
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
}

.oa-kv__value {
  margin: 0;
  color: var(--color-on-surface);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--font-weight-semibold);
  overflow-wrap: anywhere;
}

@container (min-width: 40rem) {
  .oa-kv__row {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
  }

  .oa-kv__value {
    text-align: end;
  }
}


/* ---------------------------------------------------------------------------------------------
   4. Dividers. A 1px outline-variant hairline, decorative (D-CSN-02, D-SEM-10). Inset: it starts
   at the text column of rows with a 40px leading slot: row inset + 40px + 16px (72px, 80px from
   640px). The "or" divider sits between two ways to do the same thing:
   two hairlines around the word, which screen readers read. It is not on the sign-in page (D-BCP-43).
   --------------------------------------------------------------------------------------------- */

.oa-divider {
  box-sizing: content-box;
  block-size: 0;
  margin: 0;
  border: 0;
  border-block-start: 1px solid var(--color-outline-variant);
  color: inherit; /* the <hr> default gray is not a token */
}

.oa-divider--inset {
  margin-inline-start: calc(var(--space-row-inset) + var(--size-avatar-sm) + var(--space-4));
}

@media (min-width: 40rem) {
  .oa-divider--inset {
    margin-inline-start: calc(var(--space-row-inset-medium) + var(--size-avatar-sm) + var(--space-4));
  }
}

.oa-divider-or {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
  text-align: center;
}

.oa-divider-or::before,
.oa-divider-or::after {
  content: "";
  flex: 1 1 0;
  border-block-start: 1px solid var(--color-outline-variant);
}
