/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
 * A radiogroup styled to hide the radio buttons
 * and present tab-like labels as buttons
 */

.toggle-group {
  display: inline-flex;
  min-height: var(--button-min-height-small);
}

.toggle-group-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 6px 10px;
  background-color: var(--in-content-button-background);
}

.toggle-group-input {
  position: absolute;
  inset-inline-start: -100px;
}

.toggle-group-label-iconic::before {
  width: var(--size-item-small);
  height: var(--size-item-small);
  margin-inline-end: 5px;
  -moz-context-properties: fill;
  fill: currentColor;
}

.toggle-group-label:first-of-type {
  border-start-start-radius: var(--border-radius-small);
  border-end-start-radius: var(--border-radius-small);
}

.toggle-group-label:last-of-type {
  border-start-end-radius: var(--border-radius-small);
  border-end-end-radius: var(--border-radius-small);
}

.toggle-group-input:disabled + .toggle-group-label {
  opacity: 0.4;
}

.toggle-group-input:enabled + .toggle-group-label:hover {
  background-color: var(--in-content-button-background-hover);
  color: var(--in-content-button-text-color-hover);
}

.toggle-group-input:enabled + .toggle-group-label:hover:active {
  background-color: var(--in-content-button-background-active);
  color: var(--in-content-button-text-color-active);
}

.toggle-group-input:focus-visible + .toggle-group-label {
  outline: var(--in-content-focus-outline);
  outline-offset: var(--in-content-focus-outline-offset);
  z-index: 1;
}

.toggle-group-input:checked + .toggle-group-label {
  background-color: var(--in-content-primary-button-background);
  color: var(--in-content-primary-button-text-color);
}

.toggle-group-input:enabled:checked + .toggle-group-label:hover {
  background-color: var(--in-content-primary-button-background-hover);
  color: var(--in-content-primary-button-text-color-hover);
}

.toggle-group-input:enabled:checked + .toggle-group-label:hover:active {
  background-color: var(--in-content-primary-button-background-active);
  color: var(--in-content-primary-button-text-color-active);
}
