/*
 * A ROW'S DISCUSSION — a pill, since a disc fitting two glyphs would balloon beside a 24px copy
 * control. It takes `IconButton`'s control wash pair, since the row pair matches the row's own
 * hover. The 40px touch target is a pseudo-element, as `icon_button.css` explains.
 */
@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 {
    /*
     * The same 24px box `IconButton` reserves at `sm`, so both share a baseline; on the root so
     * nested controls inherit no stray height.
     */
    --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);
    /* The glyph and its number are one word. */
    gap: var(--lotics-space-2);
    border: 0 solid var(--border);
    border-radius: var(--lotics-radius-full);
    background-color: transparent;
    /* §5 rule 1 — a `<button>` hands the UA's 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;
  }
}
