/* ==========================================================================
 * gyro-views-bar.css - the views bar and the list row density.
 * Sprint 73, lane w4 (board P0-W040 A1/A5, P0-027 A4, P7-R070 A2).
 *
 * Every value is a token from tokens.css except 1px hairlines. Registered on
 * the panel head beside gyro-theme.css (AdminPanelProvider, the integrator's
 * line), so the density rules reach every list, not only the ones with a bar.
 * ========================================================================== */

/* --------------------------------------------------------------------------
 * 1. THE BAR - one segmented control. The current mode carries the accent
 *    (rule 6's "active nav"), the others are quiet; every segment keeps the
 *    spec 28.5 control height so the bar sits level with the header buttons.
 * -------------------------------------------------------------------------- */
.gyro-views {
  display: inline-flex;
  align-items: center;
}

.gyro-views-bar {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-control);
  background-color: var(--color-bg-surface);
  overflow: hidden;
}

.gyro-views-bar__mode {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--size-control-button);
  padding-inline: var(--space-3);
  font-size: var(--type-size-base);
  font-weight: var(--type-weight-medium);
  line-height: var(--type-line-base);
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--motion-duration) var(--motion-easing),
    color var(--motion-duration) var(--motion-easing);
}

.gyro-views-bar__mode + .gyro-views-bar__mode {
  border-inline-start: 1px solid var(--color-border-hairline);
}

.gyro-views-bar__mode:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

/* Spec 28.5: an always-visible 2px accent ring, never outline: none. Inset, so
 * the bar's own rounded clip does not cut it off. */
.gyro-views-bar__mode:focus-visible {
  outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
  outline-offset: -2px;
}

.gyro-views-bar__mode--current {
  background-color: var(--color-accent-subtle);
  /* The link colour, not accent-active: accent-active on accent-subtle is 3.78:1 in dark (sprint 73, lane p8's
     review, measured as computed style); the link colour is 4.64:1 there and about 5.4:1 in light. */
  color: var(--color-text-link);
  font-weight: var(--type-weight-semibold);
}

.gyro-views-bar__icon {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Visually hidden, still read: the polite live region that names the view
 * once it has loaded. */
.gyro-views-bar__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A phone: the labels go, the icons stay, and each keeps its accessible name
 * from the text that is only visually hidden. */
@media (max-width: 480px) {
  .gyro-views-bar__mode {
    padding-inline: var(--space-2);
  }

  .gyro-views-bar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .gyro-views-bar__mode {
    position: relative;
  }
}

/* --------------------------------------------------------------------------
 * 2. ROW DENSITY. Compact is the default and is spec 28.5's table row (34px,
 *    --size-row-table, already the panel's rhythm - gyro-theme.css section 1).
 *    "Detail" is the roomier choice a person makes per list: taller rows, and
 *    long text allowed to wrap onto a second line instead of being cut off -
 *    the Bitrix24 "compact view" toggle the spec names in 1.15, the other way
 *    round. Stamped on the table's own root as data-gyro-rows by HasSavedViews.
 * -------------------------------------------------------------------------- */
.fi-ta[data-gyro-rows='detail'] .fi-ta-row .fi-ta-cell {
  height: calc(var(--size-row-table) + var(--space-4));
  padding-block: var(--space-3);
}

.fi-ta[data-gyro-rows='detail'] .fi-ta-row .fi-ta-cell .fi-ta-text {
  white-space: normal;
}

.fi-ta[data-gyro-rows='compact'] .fi-ta-row .fi-ta-cell {
  height: var(--size-row-table);
}
