/*
 * A ROW'S DISCUSSION — a pill rather than `IconButton`'s disc, because it holds
 * two glyphs' worth of content and a circle sized to fit them would balloon
 * beside a 24px copy control on the same line.
 *
 * The wash ladder is `IconButton`'s CONTROL pair, not the row pair: the register
 * row it rides already hovers to the row rung, so the generic wash would paint
 * the same grey on the same grey exactly when the pointer is on this.
 *
 * The touch target is 40 at both rungs, drawn as a pseudo-element for the reason
 * `icon_button.css` states: air inside the box would grow the pill, and air
 * outside it would shift every neighbour on the row.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-comments-button[data-size="sm"] {
    padding-inline: var(--lotics-space-6);
  }

  .lotics-comments-button[data-size="md"] {
    --lotics-comments-button-height: 28px;
    padding-inline: var(--lotics-space-8);
  }

  .lotics-comments-button {
    /* 24 at rest — `sm` is the default and the SAME box `IconButton` reserves
       there, so a row carrying both lands them on one baseline and one height.
       On the root, because a height only the rungs set INHERITS into a nested
       control that matched neither. */
    --lotics-comments-button-height: 24px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    height: var(--lotics-comments-button-height);
    /* Tight: the glyph and its number are ONE word, not two things in a row. */
    gap: var(--lotics-space-2);
    border: 0 solid var(--border);
    border-radius: var(--lotics-radius-full);
    background-color: transparent;
    /* §5 rule 1 — a `<button>` otherwise hands the UA's own face to the count. */
    font-family: var(--font-sans);
    font-size: var(--lotics-text-xs);
    line-height: var(--lotics-leading-xs);
    letter-spacing: var(--lotics-tracking-xs);
    color: var(--lotics-ink-default);
    --lotics-icon-color: currentColor;
    appearance: none;
    /* Opening the thread ACTS. */
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  .lotics-comments-button::after {
    content: "";
    position: absolute;
    inset: calc((var(--lotics-control-height) - var(--lotics-comments-button-height)) / -2);
  }

  .lotics-comments-button:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }

  .lotics-comments-button:not([data-disabled]):hover {
    background-color: var(--lotics-wash-control-hover);
  }

  .lotics-comments-button:not([data-disabled]):active {
    background-color: var(--lotics-wash-control-press);
  }

  .lotics-comments-button[data-disabled] {
    opacity: var(--lotics-disabled-opacity);
    cursor: default;
  }
}
