/*
 * N FIXED CELLS, EACH INDEPENDENTLY ON OR OFF, sized to ride inside a register
 * row. The gap is tight on purpose: the cells are one object — a week, a band,
 * a set — and a chip-row gap would read them as separate controls.
 *
 * The ON cell is an EDGE, not a ground, and the same edge a chip wears: a ground
 * is the row's language and these are controls, so painting a selection as a
 * fill makes two altitudes say the same thing in the same paint. The second
 * pixel is an INSET shadow, because a border would grow the box and shuffle the
 * whole strip the moment a day was picked.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-toggle-strip {
    display: flex;
    flex-direction: row;
    align-items: center;
    /* The register's glyph-grid gutter: a run of adjacent cells, one object,
       not a row of chips. */
    gap: var(--lotics-register-cell-gap);
    /* The component writes the cell width here for both variants; the cells
       read it. */
    --lotics-toggle-strip-cell: var(--lotics-register-row);
  }

  .lotics-toggle-strip__cell {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--lotics-toggle-strip-cell);
    height: var(--lotics-control-content-height);
    padding: 0;
    margin: 0;
    border-width: 1px;
    border-style: solid;
    border-color: var(--border);
    border-radius: var(--lotics-radius-control);
    background: var(--card);
    appearance: none;
    /* Setting a VALUE is not acting on its own. */
    cursor: default;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  .lotics-toggle-strip__cell:hover {
    background: var(--lotics-wash-selected);
  }

  .lotics-toggle-strip__cell:active {
    background: var(--lotics-wash-press);
  }

  .lotics-toggle-strip__cell[data-checked] {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
  }

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

  .lotics-toggle-strip__cell[data-disabled] {
    opacity: var(--lotics-disabled-opacity);
  }

  .lotics-toggle-strip__content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: var(--lotics-text-xs);
    line-height: var(--lotics-leading-xs);
    letter-spacing: var(--lotics-tracking-xs);
    font-weight: var(--lotics-weight-medium);
    font-feature-settings: var(--lotics-font-features);
    color: var(--lotics-ink-muted);
    user-select: none;
  }

  /* ON steps up in INK, and only in ink — the edge above already answers
     "which one", and a heavier weight would be a filter value at heading
     weight. `ChoiceStrip` reversed exactly that decision. */
  .lotics-toggle-strip__cell[data-checked] .lotics-toggle-strip__content {
    color: var(--lotics-ink-default);
  }

  /*
   * THE MARK VARIANT — a column of strips under ONE header that names the
   * positions, so the cell has no chrome of its own and the square IS the
   * state. The same seven letters on every row were twenty-eight labels for
   * four facts.
   */
  /* A REGISTER'S CELL, so its whole box is the press target: the band square,
     not the 30 × 28 chip the label variant rides a row in. */
  .lotics-toggle-strip__cell[data-variant="mark"] {
    height: var(--lotics-register-row);
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  /* Today's column rests on a tint, and the pointer deepens whatever the cell
     rests on, so the wash never vanishes on the tinted column. */
  .lotics-toggle-strip__cell[data-variant="mark"][data-current] {
    background: var(--lotics-wash-hover);
  }

  .lotics-toggle-strip__cell[data-variant="mark"]:hover {
    background: var(--lotics-wash-selected);
  }

  .lotics-toggle-strip__cell[data-variant="mark"]:active {
    background: var(--lotics-wash-press);
  }

  /* HALF THE CELL, which is 20 — §9's lone-affordance rung, reached as a
     fraction of the box the component owns. */
  .lotics-toggle-strip__cell[data-variant="mark"] .lotics-toggle-strip__content {
    width: calc(var(--lotics-register-row) / 2);
    height: calc(var(--lotics-register-row) / 2);
    border-width: 1.5px;
    border-style: solid;
    border-color: var(--border);
    border-radius: var(--lotics-radius-control);
    background: transparent;
  }

  .lotics-toggle-strip__cell[data-variant="mark"][data-checked] .lotics-toggle-strip__content {
    border-color: transparent;
    background: var(--primary);
  }
}
