/* ==========================================================================
   Component: Switch Row (locked Pattern 11 — Option B Hero variant + base)
   Used inside detail surfaces (modals, accordions, inline form sections) for
   any boolean setting that warrants its own row with a label and helper hint.

   NOT for toolbars — use Pattern 5 .toggle-pill chips there.

   Anatomy:
     .switch-row                      (base flex row)
       .switch-row__label-wrap        (left column: label + hint)
         .switch-row__label           (text-sm, medium)
         .switch-row__hint            (11px tertiary helper)
       .switch-row__input             (hidden checkbox — drives state via :has)
       .switch                        (32×18 iOS track + thumb)

   Modifiers:
     .switch-row--hero                (semibold label + hairline divider beneath)
     .switch--sm                      (compact 26×14 track for dense surfaces)
   ========================================================================== */

/* No intrinsic vertical padding — the row is sized by its label/hint content
   and adopts whatever spacing the parent provides (e.g. .modal__fields gap).
   This guarantees that any sibling section divider lands visually centered
   between rows regardless of which row sits above or below. */
.switch-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.switch-row__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-row__label-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.switch-row__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  /* line-height: 1 removes the line-box leading so the label's visible
     cap-height sits flush with the row's box-top. Keeps section dividers
     symmetric — without this the row appears to start ~5px below its box. */
  line-height: 1;
}

.switch-row__hint {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.35;
  /* Small top-margin restores breathing between label and hint that the
     label's line-height: 1 collapses. */
  margin-top: 4px;
}

/* Hero variant — sits at the top of a Pattern 7 modal as the .enabled flag.
   Semibold label only — no built-in divider, no intrinsic padding. Sections
   inside a modal are separated by an explicit <hr class="modal__divider">,
   never by a hero switch's own border-bottom. */
.switch-row--hero .switch-row__label {
  font-weight: var(--weight-semibold);
}

/* Switch (track + thumb) — 32×18 default. */
.switch {
  width: 32px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--border-subtle);
  position: relative;
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease-out);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-out);
}

/* Compact variant — 26×14 track. */
.switch--sm {
  width: 26px;
  height: 14px;
}
.switch--sm::after {
  width: 10px;
  height: 10px;
}

/* ON state driven by the hidden checkbox via :has(). */
.switch-row:has(.switch-row__input:checked) .switch {
  background: var(--accent-primary);
}
.switch-row:has(.switch-row__input:checked) .switch::after {
  transform: translateX(14px);
}
.switch-row:has(.switch-row__input:checked) .switch--sm::after {
  transform: translateX(12px);
}

/* Focus ring for keyboard a11y. */
.switch-row__input:focus-visible ~ .switch {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
