/**
 * Pricing page — plan comparison and the calculator.
 */

/* ── Plan cards ────────────────────────────────────────────────────────────── */

.plans {
  display: grid;
  gap: var(--space-m);
  align-items: start;
}

@media (min-width: 58em) {
  .plans {
    grid-template-columns: repeat(3, 1fr);
  }
}

.plan {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  padding: var(--space-m);
  display: grid;
  gap: var(--space-s);
  position: relative;
}

.plan[data-popular='true'] {
  border-color: var(--accent);
}

.plan__flag {
  position: absolute;
  top: -0.7rem;
  left: var(--space-m);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--step--2);
  font-weight: 640;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
}

.plan__name {
  font-size: var(--step-1);
  font-weight: 620;
  letter-spacing: -0.02em;
}

.plan__price {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.plan__amount {
  font-size: var(--step-4);
  font-weight: 660;
  letter-spacing: -0.035em;
  line-height: 1;
}

.plan__period {
  font-size: var(--step--1);
  color: var(--text-muted);
}

.plan__blurb {
  color: var(--text-secondary);
  font-size: var(--step--1);
  min-height: 3em;
}

/* ── Calculator ────────────────────────────────────────────────────────────── */

.calculator {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  overflow: hidden;
}

.calculator__grid {
  display: grid;
  gap: 1px;
  background: var(--border);
}

@media (min-width: 62em) {
  .calculator__grid {
    grid-template-columns: 1fr 1.05fr;
  }
}

.calculator__controls,
.calculator__output {
  background: var(--surface-1);
  padding: var(--space-m);
}

.calculator__output {
  background: var(--surface-2);
}

.control + .control {
  margin-top: var(--space-m);
}

.control__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-s);
  margin-bottom: 0.4rem;
}

.control__label {
  font-size: var(--step--1);
  color: var(--text-secondary);
  font-weight: 520;
}

.control__value {
  font-family: var(--font-mono);
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--text-primary);
}

/* Range inputs: styled explicitly so the track and thumb read on a dark surface
   in both engines, and the thumb stays a comfortable hit target. */
.control input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.5rem;
  background: transparent;
  cursor: pointer;
}

.control input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

.control input[type='range']::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

.control input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: -0.53rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-1);
}

.control input[type='range']::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-1);
}

.control input[type='range']:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
  border-radius: 4px;
}

.control__scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ── Segmented radio group ─────────────────────────────────────────────────── */

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.radio-chip {
  position: relative;
}

.radio-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.radio-chip span {
  display: block;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--step--2);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.radio-chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.radio-chip input:focus-visible + span {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ── Switch ────────────────────────────────────────────────────────────────── */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: var(--step--1);
  color: var(--text-secondary);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__track {
  width: 2.4rem;
  height: 1.35rem;
  border-radius: 100px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  flex: none;
  transition: background 0.15s var(--ease);
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}

.switch input:checked + .switch__track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(1.05rem);
  background: var(--accent-ink);
}

.switch input:focus-visible + .switch__track {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ── Results ───────────────────────────────────────────────────────────────── */

.results {
  display: grid;
  gap: var(--space-2xs);
}

.plan-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem var(--space-s);
  align-items: baseline;
  padding: var(--space-xs) var(--space-s);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}

.plan-result[data-recommended='true'] {
  border-color: var(--accent);
}

.plan-result[data-unavailable='true'] {
  opacity: 0.55;
}

.plan-result__name {
  font-weight: 580;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.plan-result__badge {
  font-size: var(--step--2);
  font-weight: 640;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 100px;
  padding: 0.05rem 0.5rem;
}

.plan-result__value {
  font-size: var(--step-2);
  font-weight: 640;
  letter-spacing: -0.03em;
  text-align: right;
}

.plan-result__note {
  grid-column: 1 / -1;
  font-size: var(--step--2);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.recommendation {
  margin-top: var(--space-m);
  padding-top: var(--space-m);
  border-top: 1px solid var(--border);
  font-size: var(--step--1);
  color: var(--text-secondary);
  line-height: 1.65;
}

.recommendation strong {
  color: var(--text-primary);
  font-weight: 620;
}

/* ── Comparison table ──────────────────────────────────────────────────────── */

.compare-wrap {
  overflow-x: auto;
}

.compare {
  min-width: 40rem;
  font-size: var(--step--1);
}

.compare th,
.compare td {
  text-align: left;
  padding: 0.7rem var(--space-s);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.compare thead th {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom-color: var(--border-strong);
}

.compare tbody th {
  font-weight: 400;
  color: var(--text-muted);
}

.compare td {
  font-family: var(--font-mono);
  font-size: 0.94em;
  color: var(--text-secondary);
}
