@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@layer cinder.components {
  /* ========================================
 * GROUPED LIST ITEM
 *
 * One row of a grouped list. The row draws no border: its separator is the bottom edge of the
 * content part, which starts at the text, so it is inset past the leading slot. Every part is
 * styled by class, never by element, so nothing a consumer interpolates is restyled.
 * ======================================== */

  .cinder-grouped-list-item {
    /* One line of the title: the line a trailing value sits on. */
    /* @runtime-state */
    --_cinder-grouped-list-item-title-line: calc(
      var(--cinder-text-base) * var(--cinder-leading-snug, 1.35)
    );
    /* The chevron's column: the 16px chevron and the gap before it. */
    /* @runtime-state */
    --_cinder-grouped-list-item-chevron-column: calc(1rem + var(--cinder-space-3));

    position: relative;
    display: flex;
    align-items: stretch;
    min-block-size: 2.75rem;
    padding-inline-start: var(--cinder-space-4);
    /* Beside a ListDetail's Hide handle, which floats over the rows at the divider, the row ends that
       far early (`--_cinder-list-detail-handle-inset`), so a trailing value, action or chevron is
       never under it; unset, there is no inset. */
    padding-inline-end: var(--_cinder-list-detail-handle-inset, 0px);
    margin: 0;
    list-style: none;
    background: transparent;
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-base);
  }

  /* ----------------------------------------
 * Leading slot
 * ---------------------------------------- */

  .cinder-grouped-list-item__leading {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    padding-block: var(--cinder-space-2);
    padding-inline-end: var(--cinder-space-3);
    color: var(--cinder-text-muted);
  }

  /* A glyph sits on the title's first line at every width, never in the middle of a row its text
     makes taller: a box one title line tall, at the content's block-start padding, centres it on
     that line, so the glyph and the trailing value share the title's line on every row. (The
     disclosure chevron centres on the row instead, COR-2688.) */
  .cinder-grouped-list-item__leading[data-cinder-leading='icon'] {
    align-self: flex-start;
    min-inline-size: 1.75rem;
    block-size: calc(var(--_cinder-grouped-list-item-title-line) + 2 * var(--cinder-space-2-5));
    padding-block: var(--cinder-space-2-5);
  }

  .cinder-grouped-list-item__leading[data-cinder-leading='avatar'] {
    min-inline-size: 2.5rem;
  }

  /* A thumbnail is 56px square, inside the 40 to 72px range, and crops its image to fill. */
  .cinder-grouped-list-item__leading[data-cinder-leading='media'] {
    min-inline-size: 3.5rem;
  }

  .cinder-grouped-list-item__leading[data-cinder-leading='media'] > :where(img, picture, svg) {
    inline-size: 3.5rem;
    block-size: 3.5rem;
    object-fit: cover;
    border-radius: var(--cinder-radius-md);
  }

  /* A checkbox or radio aligns to the first line of a wrapping title, not to the middle of the row. */
  .cinder-grouped-list-item__leading[data-cinder-leading='control'] {
    align-items: flex-start;
    padding-block-start: calc(var(--cinder-space-2-5) + (1lh - 1.25rem) / 2);
  }

  /* ----------------------------------------
 * Content: lead column, text, photo, value, chevron, action
 * ---------------------------------------- */

  .cinder-grouped-list-item__content {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    gap: var(--cinder-space-3);
    min-inline-size: 0;
    padding-block: var(--cinder-space-2-5);
    padding-inline-end: var(--cinder-space-2);
    border-block-end: var(--cinder-border-width) solid var(--cinder-border-faint);
  }

  .cinder-grouped-list-item:last-child > .cinder-grouped-list-item__content {
    border-block-end-color: transparent;
  }

  /* A row with a trailing value sets it on the title's first line (below). Its content is one
     wrapping flex line centred in the row's height: a row taller than its text (the 44px minimum,
     or an avatar beside it) centres the text as before, and the value still sits at the top of that
     line, on the title's first line. */
  .cinder-grouped-list-item:is(
      :where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ),
      .cinder-grouped-list-item--linked
    )
    > .cinder-grouped-list-item__content {
    flex-wrap: wrap;
    align-content: center;
  }

  /* A fixed column, so a time or number lines up from one row to the next. */
  .cinder-grouped-list-item__lead {
    flex: none;
    inline-size: 5rem;
    font-size: var(--cinder-text-sm);
    font-variant-numeric: tabular-nums;
    color: var(--cinder-text-muted);
  }

  .cinder-grouped-list-item__text {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: var(--cinder-space-0-5);
    min-inline-size: 0;
  }

  .cinder-grouped-list-item__title {
    min-inline-size: 0;
    overflow-wrap: anywhere;
    line-height: var(--cinder-leading-snug, 1.35);
  }

  /* Suggested (COR-2326): a row that is not saved until confirmed says so in quiet accent words on
   * a line above its title. No tint, border or pill: the colour and the words carry it. */
  .cinder-grouped-list-item__suggested {
    color: var(--cinder-accent-text);
    font-size: var(--cinder-text-sm);
    font-weight: var(--cinder-font-medium);
    line-height: var(--cinder-leading-snug);
  }

  .cinder-grouped-list-item__subtitle {
    min-inline-size: 0;
    /* A readable measure: a subtitle never runs past about 70 characters, even at 1920. */
    max-inline-size: 70ch;
    overflow-wrap: anywhere;
    font-size: var(--cinder-text-sm);
    color: var(--cinder-text-muted);
  }

  /* titleLines and subtitleLines: at most that many lines at every width, then an ellipsis. The
     clamp is visual only, so the whole text stays in the document and the row's accessible text.
     The link's cover is positioned against the row, so the clamp's overflow does not cut it. */
  .cinder-grouped-list-item__title[data-cinder-lines],
  .cinder-grouped-list-item__subtitle[data-cinder-lines] {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .cinder-grouped-list-item__title[data-cinder-lines='1'],
  .cinder-grouped-list-item__subtitle[data-cinder-lines='1'] {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }

  .cinder-grouped-list-item__title[data-cinder-lines='2'],
  .cinder-grouped-list-item__subtitle[data-cinder-lines='2'] {
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  /* chevronColumn: a row with no chevron keeps its column as space at the end of its content, at
     every width, so its trailing value ends where a linked row's does. Never an empty flex item,
     which would wrap in a narrow row the way the chevron once did. */
  .cinder-grouped-list-item--chevron-column > .cinder-grouped-list-item__content {
    padding-inline-end: calc(
      var(--cinder-space-2) + var(--_cinder-grouped-list-item-chevron-column)
    );
  }

  /* A row that has just arrived in a live list fades in; reduced motion shows it at once. */
  .cinder-grouped-list-item--arriving {
    animation: cinder-grouped-list-item-arrive var(--cinder-duration-fast)
      var(--cinder-ease-standard);
  }

  @keyframes cinder-grouped-list-item-arrive {
    from {
      opacity: 0;
    }
  }

  /* A trailing photo is a 56px column that takes no space when the row has none, since the slot is
     not rendered. It crops its image to fill. */
  .cinder-grouped-list-item__photo {
    display: flex;
    flex: none;
    align-items: center;
    inline-size: 3.5rem;
    block-size: 3.5rem;
    overflow: hidden;
    border-radius: var(--cinder-radius-md);
  }

  .cinder-grouped-list-item__photo > :where(img, picture, svg) {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }

  /* ----------------------------------------
 * Time-led row: a time window leads, with a small caption under it, then the name and its content
 * ---------------------------------------- */

  /* The lead is a fixed column, right-aligned, wide enough for "11 pm–2 am" at the comfortable
     density, so the windows of every row line up on their last character: 112px on a wide row,
     where the window is two steps over the name, and 100px on a narrow one (below), where it is one
     step over. It aligns to the first line of a wrapping name. The row's title and subtitle are
     the basic row's own: the lead is the only thing a time-led row adds. */
  .cinder-grouped-list-item__lead.cinder-grouped-list-item__lead--timed {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    align-self: flex-start;
    inline-size: 7rem;
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-base);
    text-align: end;
  }

  /* The lead and the text both start at the top, so the window shares the title's first line even
     when the lead, a window and a caption, is taller than a title with no subtitle. The row wraps,
     so a trailing value moves to a line of its own before the name is squeezed. */
  .cinder-grouped-list-item--timed > .cinder-grouped-list-item__content {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: var(--cinder-space-0-5);
  }

  /* The name keeps 10rem: a trailing value that would leave it less wraps under, at the end. It
     does not shrink: a text column that could give up width did, and the value stayed beside it. */
  .cinder-grouped-list-item--timed .cinder-grouped-list-item__text {
    flex: 1 0 10rem;
  }

  .cinder-grouped-list-item--timed .cinder-grouped-list-item__trailing {
    margin-inline-start: auto;
  }

  /* The window is the row's entry point: bold and over the name's size (two steps on a wide row,
     one on a narrow one), on one line a title line tall, so it sits on the title's first line as
     a trailing value does. */
  .cinder-grouped-list-item__lead-window {
    color: var(--cinder-text-default);
    font-size: var(--cinder-text-xl);
    font-weight: var(--cinder-font-bold);
    line-height: var(--_cinder-grouped-list-item-title-line);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .cinder-grouped-list-item__lead-caption {
    font-size: var(--cinder-text-sm);
    line-height: var(--cinder-leading-snug, 1.35);
    color: var(--cinder-text-muted);
  }

  /* Urgent colours only the caption, the time left, in the warning text colour; the window stays
     the default text colour. Soon mutes the window. */
  .cinder-grouped-list-item__lead[data-cinder-urgency='urgent']
    > .cinder-grouped-list-item__lead-caption {
    color: var(--cinder-status-warning-text);
  }

  .cinder-grouped-list-item__lead[data-cinder-urgency='soon']
    > .cinder-grouped-list-item__lead-window {
    color: var(--cinder-text-muted);
  }

  /* A stale marker is a gray clock and a short age. A fresh row renders none. */
  .cinder-grouped-list-item__stale {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: var(--cinder-space-1);
    font-size: var(--cinder-text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--cinder-text-muted);
  }

  /* A trailing value is one line ("Yesterday, 4:12 PM" never breaks), and it sits on the title's
     first line rather than the middle of the row, at the top of the content in a line one title
     line tall (COR-2329). The chevron centres on the row (COR-2688). */
  .cinder-grouped-list-item__trailing {
    position: relative;
    z-index: 1;
    flex: none;
    align-self: flex-start;
    max-inline-size: 40%;
    line-height: var(--_cinder-grouped-list-item-title-line);
    overflow: hidden;
    font-size: var(--cinder-text-sm);
    font-variant-numeric: tabular-nums;
    color: var(--cinder-text-muted);
    text-align: end;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cinder-grouped-list-item__trailing:empty {
    display: none;
  }

  /* The disclosure chevron says the whole row opens, so it centres on the row (COR-2688, owner: "Look
     at the alignment of the caret on these rows"), at every width and in every row form: it is
     placed against the row, out of the content's wrapping, and its column is reserved as the
     content's end padding (below). It takes no pointer, so a press on it reaches the row's link.
     The box covers the whole row and pushes the glyph to the inline end with `justify-content`,
     which follows the row's direction at run time; a one-sided `inset-inline-end` is lowered by the
     CSS bundler to `right:` with a `:lang()` switch, and lands on the text in a `dir="rtl"` row whose
     language it does not list. */
  .cinder-grouped-list-item__chevron {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* The box covers the whole row, past its end padding, so it keeps the handle's inset itself. */
    padding-inline-end: calc(var(--cinder-space-2) + var(--_cinder-list-detail-handle-inset, 0px));
    color: var(--cinder-text-subtle);
    pointer-events: none;
  }

  .cinder-grouped-list-item--chevron > .cinder-grouped-list-item__content {
    padding-inline-end: calc(
      var(--cinder-space-2) + var(--_cinder-grouped-list-item-chevron-column)
    );
  }

  /* A trailing value sits on the title's first line at every width (COR-2329), so every list on a
     page places its times alike; the disclosure chevron centres on the row at every width instead
     (COR-2688, above). The one exception for the value is a row with text actions: its buttons
     centre on the row, so while they share the row's line (26rem or wider) the value centres with
     them as one cluster, and a status never sits on a different
     centre line from the button beside it (2026-11-28 review; owner decision the same day, after
     centring every wide row put Home's times in two places). A suggested row (COR-2441) and a
     time-led row keep their own layouts. */
  @container cinder-grouped-list-item (width >= 26rem) {
    .cinder-grouped-list-item--actions.cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ):not(.cinder-grouped-list-item--timed, [data-cinder-suggested])
      :is(.cinder-grouped-list-item__trailing, .cinder-grouped-list-item__stale) {
      align-self: center;
    }
  }

  /* The action column is the size of a touch target at least, so a badge or a longer value in the
     row never moves the click target. It is a minimum, not a fixed width, so a text button put in
     this slot widens the column instead of being clipped to its first letter (COR-2917); text
     buttons belong in `actions`. */
  .cinder-grouped-list-item__action {
    position: relative;
    z-index: 1;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    min-inline-size: 2.75rem;
    margin-block: calc(var(--cinder-space-2-5) * -1);
  }

  /* ----------------------------------------
 * Text actions: buttons at the end of the row, under the text on a phone
 * ---------------------------------------- */

  /* Above the row's link, so a row can be a link and still carry its own buttons. */
  .cinder-grouped-list-item__actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex: none;
    align-items: center;
    gap: var(--cinder-space-2);
  }

  /* A row with actions measures its own width: on a phone, or in any pane that narrow, the actions
     are never folded into a menu. They take a line of their own under the text, each button at its
     own width, starting at the text's leading edge (COR-2329: a button the width of the row read
     as a page-wide pill, five of them in one scroll).

     A row with a trailing value measures its own width too: narrower than 26rem, the title and the
     value share the first line and the subtitle takes the full width under them, so neither the
     value nor the title is squeezed into what the other leaves (COR-2329). The title keeps at least
     5rem; a value too long to fit beside that drops to a line of its own under the title. */
  .cinder-grouped-list-item--actions,
  .cinder-grouped-list-item:where(
    :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
  ),
  .cinder-grouped-list-item--timed {
    container: cinder-grouped-list-item / inline-size;
  }

  @container cinder-grouped-list-item (width < 26rem) {
    .cinder-grouped-list-item--actions > .cinder-grouped-list-item__content {
      flex-wrap: wrap;
    }

    .cinder-grouped-list-item--actions .cinder-grouped-list-item__actions {
      flex: 1 0 100%;
      flex-flow: row wrap;
      justify-content: flex-start;
    }

    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      > .cinder-grouped-list-item__content {
      flex-wrap: wrap;
      row-gap: var(--cinder-space-0-5);
    }

    /* The text column gives its lines to the row, so the subtitle can take a line of its own. */
    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      .cinder-grouped-list-item__text {
      display: contents;
    }

    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      .cinder-grouped-list-item__suggested {
      flex: 1 0 100%;
      order: -1;
    }

    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      .cinder-grouped-list-item__title {
      flex: 1 1 5rem;
    }

    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      .cinder-grouped-list-item__trailing {
      max-inline-size: none;
    }

    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      .cinder-grouped-list-item__subtitle {
      flex: 1 0 100%;
      order: 1;
    }

    /* A row that only keeps the chevron's column (no chevron drawn) lets its subtitle run under
       that column to the content's inline end. A row that draws a chevron keeps the column clear,
       since its chevron centres on the row, across the subtitle's line (COR-2688). */
    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ).cinder-grouped-list-item--chevron-column:not(
        .cinder-grouped-list-item--chevron,
        .cinder-grouped-list-item--timed
      )
      .cinder-grouped-list-item__subtitle {
      margin-inline-end: calc(var(--_cinder-grouped-list-item-chevron-column) * -1);
    }

    /* A time-led row with a trailing value is a grid here: the window leads, the name and the
       trailing value share the first line, and the subtitle takes the width under both, starting
       at the name rather than under the window. The columns after the name are one per trailing
       part, so the gap is each part's own margin. */
    .cinder-grouped-list-item.cinder-grouped-list-item--timed > .cinder-grouped-list-item__content {
      display: grid;
      grid-auto-flow: column;
      grid-template-columns: auto minmax(0, 1fr);
      column-gap: 0;
      align-items: start;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed .cinder-grouped-list-item__lead {
      grid-row: 1 / span 2;
      inline-size: 6.25rem;
      margin-inline-end: var(--cinder-space-3);
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      .cinder-grouped-list-item__lead-window {
      font-size: var(--cinder-text-lg);
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      .cinder-grouped-list-item__lead-caption {
      font-size: var(--cinder-text-xs);
    }

    /* A photo is the last thing before the chevron and spans both lines, so the name, the
       trailing value and the subtitle sit where they sit in a row without one: the subtitle ends
       where the photo's column starts (after the name, and after the stale marker and the
       trailing value when the row has them). */
    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      > .cinder-grouped-list-item__content
      > .cinder-grouped-list-item__photo {
      /* The child combinators outrank the shared row-one rule for the trailing parts below. */
      grid-row: 1 / span 2;
    }

    /* The photo is taller than the name's line: the room it needs goes to the subtitle's row, so
       the subtitle still follows the name directly. */
    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      > .cinder-grouped-list-item__content:has(> .cinder-grouped-list-item__photo) {
      grid-template-rows: auto 1fr;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      > .cinder-grouped-list-item__content:has(> .cinder-grouped-list-item__photo)
      .cinder-grouped-list-item__subtitle {
      grid-column: 2 / span 1;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      > .cinder-grouped-list-item__content:has(> .cinder-grouped-list-item__photo):has(
        > :is(
          .cinder-grouped-list-item__stale,
          .cinder-grouped-list-item__trailing:not(:where(:empty))
        )
      )
      .cinder-grouped-list-item__subtitle {
      grid-column: 2 / span 2;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      > .cinder-grouped-list-item__content:has(> .cinder-grouped-list-item__photo):has(
        > .cinder-grouped-list-item__stale
      ):has(> .cinder-grouped-list-item__trailing:not(:where(:empty)))
      .cinder-grouped-list-item__subtitle {
      grid-column: 2 / span 3;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed .cinder-grouped-list-item__title {
      grid-row: 1;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed .cinder-grouped-list-item__subtitle {
      grid-row: 2;
      grid-column: 2 / span 6;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed
      :is(
        .cinder-grouped-list-item__stale,
        .cinder-grouped-list-item__trailing,
        .cinder-grouped-list-item__photo,
        .cinder-grouped-list-item__action
      ) {
      grid-row: 1;
      margin-inline-start: var(--cinder-space-3);
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed .cinder-grouped-list-item__trailing {
      /* 6rem leaves the name at least 7rem beside the lead on a 390px phone. */
      max-inline-size: 6rem;
      overflow: visible;
      white-space: normal;
      overflow-wrap: anywhere;
    }

    .cinder-grouped-list-item.cinder-grouped-list-item--timed .cinder-grouped-list-item__actions {
      grid-row: 3;
      grid-column: 2 / span 6;
    }

    .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      )
      .cinder-grouped-list-item__actions {
      order: 2;
    }
  }

  /* A suggested row with a trailing value or a chevron takes the narrow layout at every width
     (COR-2441): the word "Suggested" on a line of its own above, and the value on the title's first
     line; the chevron centres on the row (COR-2688). Wide, the text column is a block with the word above the title, and
     a vertically centred value would sit between the word and the title and read "Suggested
     Friday". A time-led row keeps its text column. */
  .cinder-grouped-list-item[data-cinder-suggested]:not(.cinder-grouped-list-item--timed):is(
      .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ),
      .cinder-grouped-list-item--linked
    )
    > .cinder-grouped-list-item__content {
    flex-wrap: wrap;
    row-gap: var(--cinder-space-0-5);
  }

  .cinder-grouped-list-item[data-cinder-suggested]:not(.cinder-grouped-list-item--timed):is(
      .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ),
      .cinder-grouped-list-item--linked
    )
    .cinder-grouped-list-item__text {
    display: contents;
  }

  .cinder-grouped-list-item[data-cinder-suggested]:not(.cinder-grouped-list-item--timed):is(
      .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ),
      .cinder-grouped-list-item--linked
    )
    .cinder-grouped-list-item__suggested {
    flex: 1 0 100%;
    order: -1;
  }

  .cinder-grouped-list-item[data-cinder-suggested]:not(.cinder-grouped-list-item--timed):is(
      .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ),
      .cinder-grouped-list-item--linked
    )
    .cinder-grouped-list-item__title {
    flex: 1 1 5rem;
  }

  .cinder-grouped-list-item[data-cinder-suggested]:not(.cinder-grouped-list-item--timed):is(
      .cinder-grouped-list-item:where(
        :has(> .cinder-grouped-list-item__content > .cinder-grouped-list-item__trailing:not(:empty))
      ),
      .cinder-grouped-list-item--linked
    )
    .cinder-grouped-list-item__subtitle {
    flex: 1 0 100%;
    order: 1;
  }

  /* ----------------------------------------
 * The row is the link
 * ---------------------------------------- */

  .cinder-grouped-list-item__link {
    color: inherit;
    text-decoration: none;
  }

  .cinder-grouped-list-item__link::after {
    content: '';
    position: absolute;
    inset: 0;
  }

  .cinder-grouped-list-item__link:focus-visible {
    outline: none;
  }

  /* The ring is drawn inside the row, because the group clips its rows. */
  .cinder-grouped-list-item__link:focus-visible::after {
    outline: var(--cinder-ring-width) solid transparent;
    box-shadow: inset 0 0 0 var(--cinder-ring-width) var(--cinder-ring-color);
  }

  @media (hover: hover) {
    .cinder-grouped-list-item--linked:hover {
      background: var(--cinder-surface-hover);
    }
  }

  .cinder-grouped-list-item.cinder-grouped-list-item--selected {
    background: color-mix(in oklch, var(--cinder-accent-solid), transparent 92%);
  }

  @media (hover: hover) {
    .cinder-grouped-list-item--linked.cinder-grouped-list-item--selected:hover {
      background: color-mix(in oklch, var(--cinder-accent-solid), transparent 88%);
    }
  }

  @media (forced-colors: active) {
    .cinder-grouped-list-item__link:focus-visible::after {
      outline: var(--cinder-ring-width) solid ButtonText;
      outline-offset: calc(var(--cinder-ring-width) * -1);
    }

    .cinder-grouped-list-item--selected {
      outline: 1px solid Highlight;
      outline-offset: -1px;
    }

    .cinder-grouped-list-item__content {
      border-block-end-color: GrayText;
    }
  }
}
