/**
 * Multi-operation calculator switcher (e.g. Percentage Calculator's five
 * operations) and its per-operation panels.
 */

.calcoryn-calculator {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.calcoryn-calc-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  border: 0;
  padding: 0;
  margin: 0;
}

.calcoryn-calc-switch__option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch-target-min);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  background-color: var(--color-card);
}

/* The native radio stays visible (not visually hidden) so the checked
   state, focus ring and label text all work identically with or without
   :has() support — the pill highlight below is a progressive enhancement
   on top of that, not a replacement for it. */
.calcoryn-calc-switch__option input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary-blue);
  flex-shrink: 0;
}

.calcoryn-calc-switch__option:has(input:checked) {
  border-color: var(--color-primary-blue);
  color: var(--color-primary-blue);
  background-color: #eff6ff;
}

.calcoryn-calc-switch__option:has(input:focus-visible) {
  box-shadow: var(--color-focus-ring);
}

.calcoryn-calc-op-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* An author `display` rule beats the UA stylesheet's `[hidden] {
   display: none }`, so the JS-toggled `hidden` attribute needs this
   explicit override to actually hide an inactive operation panel. */
.calcoryn-calc-op-panel[hidden] {
  display: none;
}

.calcoryn-calc-op-panel__description {
  margin: 0;
  font-size: var(--text-sm);
}
