/* The row is the switch; the `Switch` inside is an indicator, not a tab stop. Hover and press take
   `Button`'s wash rungs. The right inset is a rung tighter, since the track ends at its own edge. */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-switch-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--lotics-space-16);
    padding-block: var(--lotics-space-4);
    padding-left: var(--lotics-space-8);
    padding-right: var(--lotics-space-6);
    margin: 0;
    border: 0 solid var(--border);
    border-radius: var(--lotics-radius-control);
    background-color: transparent;
    appearance: none;
    font-family: var(--font-sans);
    font-size: var(--lotics-text-sm);
    line-height: var(--lotics-leading-sm);
    letter-spacing: var(--lotics-tracking-sm);
    font-weight: var(--lotics-weight-regular);
    color: var(--lotics-ink-default);
    /* A switch sets a value; the pointer is for what acts. */
    cursor: default;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  .lotics-switch-row:not([data-disabled]):hover {
    background-color: var(--lotics-wash-selected);
  }

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

  .lotics-switch-row[data-disabled] {
    opacity: var(--lotics-disabled-opacity);
  }

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

  .lotics-switch-row__label {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: var(--lotics-space-8);
  }

  .lotics-switch-row__lead {
    flex-shrink: 0;
  }

  /* Stated for the described title, a `CellStack`, whose root otherwise holds its width. */
  .lotics-switch-row__label > .lotics-switch-row__title {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* A squeezed switch is unhittable, so the label gives way. */
  .lotics-switch-row__indicator {
    flex-shrink: 0;
  }
}
