/*
 * TWO READINGS ON ONE AXIS. Each arm is a head line — the label and its figure
 * at either end — over a full-width track, so both tracks start and end on the
 * same two x's whatever the labels measure.
 *
 * The SUBJECT's fill is the screen's accent and the reference's is neutral: one
 * hue, and the grey says what is being measured against.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-comparison-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--lotics-space-12);
    min-width: 0;
    /* The bar's own thickness, and `Progress`'s default: a comparison sitting
       under a meter on one record must not draw a second weight of bar. */
    --lotics-comparison-bar-thickness: var(--lotics-space-10);
  }

  .lotics-comparison-bar__arm {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* The head and its own track are ONE object; the rung between two arms is
       the root's. */
    gap: var(--lotics-space-4);
    min-width: 0;
  }

  .lotics-comparison-bar__head {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--lotics-space-8);
    min-width: 0;
  }

  /* FLEX, so the box is the run's line box and nothing else — a block wrapper
     around an inline run carries a strut at the page's own size. */
  .lotics-comparison-bar__label {
    display: flex;
    /* It is the one part that may give way: a figure cut in half is a wrong
       number. */
    min-width: 0;
    flex-shrink: 1;
  }

  .lotics-comparison-bar__figure {
    display: flex;
    flex-shrink: 0;
  }

  .lotics-comparison-bar__track {
    position: relative;
    height: var(--lotics-comparison-bar-thickness);
    border-radius: var(--lotics-radius-full);
    background: var(--muted);
    overflow: hidden;
    /* Hairline inner edge, as `progress.css` draws it — the track reads as a
       groove rather than a grey strip. */
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lotics-shadow-color) 4%, transparent);
  }

  .lotics-comparison-bar__indicator {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--lotics-comparison-bar-share);
    border-radius: var(--lotics-radius-full);
    background: var(--lotics-accent);
  }

  /* NEUTRAL, and a SOLID rather than a wash: it has to separate from the track
     under it, which is the palest neutral the theme owns. */
  .lotics-comparison-bar__arm[data-arm="reference"] .lotics-comparison-bar__indicator {
    background: var(--lotics-tone-zinc-solid);
  }
}
