/* ── Antialiased root ────────────────────────────────────────────── */
html {
  font-family:
    "Geist", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Design tokens (light) ───────────────────────────────────────── */
:root {
  --shadow-border:
    0px 0px 0px 1px rgba(0, 0, 0, 0.06), 0px 1px 2px -1px rgba(0, 0, 0, 0.06),
    0px 2px 4px 0px rgba(0, 0, 0, 0.04);
  --shadow-border-hover:
    0px 0px 0px 1px rgba(0, 0, 0, 0.08), 0px 1px 2px -1px rgba(0, 0, 0, 0.08),
    0px 2px 4px 0px rgba(0, 0, 0, 0.06);
  --bar-cached: #1d9e75;
  --bar-standard: #378add;
  --bar-output: #d85a30;
  --text-muted: #73726c;
  --text-muted-dim: #9c9a92;
  --accent: #1a1a1a;
  --range-track: rgba(0, 0, 0, 0.15);
  --range-thumb-bg: #ffffff;
  --range-thumb-border: rgba(0, 0, 0, 0.2);
  --range-thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --border-subtle: rgba(0, 0, 0, 0.15);
  --pill-on-bg: #1a1a1a;
  --pill-on-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --shadow-border: 0 0 0 1px rgba(255, 255, 255, 0.08);
    --shadow-border-hover: 0 0 0 1px rgba(255, 255, 255, 0.13);
    --bar-cached: #5dcaa5;
    --bar-standard: #85b7eb;
    --bar-output: #f0997b;
    --text-muted: #9c9a92;
    --text-muted-dim: #73726c;
    --accent: #eceae4;
    --range-track: rgba(255, 255, 255, 0.15);
    --range-thumb-bg: #1a1a1a;
    --range-thumb-border: rgba(255, 255, 255, 0.2);
    --border-subtle: rgba(255, 255, 255, 0.15);
    --pill-on-bg: #eceae4;
    --pill-on-text: #1a1a1a;
  }
}

/* ── Reusable: muted text ────────────────────────────────────────── */
.text-muted {
  color: var(--text-muted);
}
.text-muted-dim {
  color: var(--text-muted-dim);
}

/* ── Hide number input spinners ─────────────────────────────────── */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ── Reusable: price number input ─────────────────────────────────── */
.price-input {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 1.5rem; /* text-2xl */
  font-weight: 500;
  color: inherit;
  min-width: 4rem;
  font-variant-numeric: tabular-nums;
  outline: none;
  box-shadow: none;
}
.price-input:focus {
  outline: none;
  box-shadow: none;
}

/* ── Range slider (design system + feel-better) ─────────────────────── */
/* Shared global rule replaces the per-input utility cluster. */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--range-track);
  border-radius: 9999px;
  outline: none;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--range-thumb-bg);
  border: 0.5px solid var(--range-thumb-border);
  cursor: pointer;
  box-shadow: var(--range-thumb-shadow);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--range-thumb-bg);
  border: 0.5px solid var(--range-thumb-border);
  cursor: pointer;
  box-shadow: var(--range-thumb-shadow);
}

/* ── Staggered enter animations (feel-better: split + stagger + blur) ── */
.section-stagger {
  animation: fadeInUp 350ms ease-out backwards;
}
.section-stagger:nth-child(3) {
  animation-delay: 0ms;
}
.section-stagger:nth-child(4) {
  animation-delay: 80ms;
}
.section-stagger:nth-child(5) {
  animation-delay: 160ms;
}
.section-stagger:nth-child(6) {
  animation-delay: 240ms;
}
.section-stagger:nth-child(7) {
  animation-delay: 320ms;
}
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(4px);
  }
}

/* ── Reusable: card / panel surface ───────────────────────────────── */
.surface-card {
  background: var(--surface-card-bg, #ffffff);
  border-radius: 0.75rem; /* rounded-xl */
  padding: 1rem; /* p-4 */
  box-shadow: var(--shadow-border);
  transition: box-shadow 150ms ease-out;
}
.surface-card:hover {
  box-shadow: var(--shadow-border-hover);
}
/* Interactive cards (pricing cards) scale on press */
.surface-card--interactive {
  transition:
    box-shadow 150ms ease-out,
    transform 150ms ease-out;
}
.surface-card--interactive:active {
  transform: scale(0.96);
}

@media (prefers-color-scheme: dark) {
  .surface-card {
    background: #2c2c2a;
  }
}

/* ── Pill radios (shared base) ────────────────────────────────────── */
.pill-radio {
  cursor: pointer;
  user-select: none;
}
.pill-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pill-radio.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pill-radio.disabled:active {
  transform: none;
}

/* ── Reusable: mode-toggle pill ───────────────────────────────────── */
.pill-toggle {
  font-size: 0.875rem; /* text-sm */
  padding: 0.5rem 1rem; /* px-4 py-2 */
  border-radius: 0.375rem; /* rounded-md */
  text-align: center;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  transition:
    color 150ms ease-out,
    transform 150ms ease-out;
}
.pill-toggle:active {
  transform: scale(0.96);
}
.pill-toggle:has(input:checked) {
  color: inherit;
}

/* ── Reusable: subscription pill ──────────────────────────────────── */
.pill-sub {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  border-radius: 0.5rem; /* rounded-lg */
  font-size: 0.875rem; /* text-sm */
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition:
    color 150ms ease-out,
    background-color 150ms ease-out,
    border-color 150ms ease-out,
    transform 150ms ease-out;
}
.pill-sub:active {
  transform: scale(0.96);
}
.pill-sub:has(input:checked) {
  background: var(--pill-on-bg);
  color: var(--pill-on-text);
  border-color: transparent;
}

/* ── Scaling switch (on/off affordance for usage multiplier) ─────── */
.scaling-switch {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.15);
  border: 0;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background-color 150ms ease-out,
    transform 150ms ease-out;
}
.scaling-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transition: transform 150ms ease-out;
}
.scaling-switch[aria-checked="true"] {
  background: var(--pill-on-bg);
}
.scaling-switch[aria-checked="true"] .scaling-switch-thumb {
  transform: translateX(16px);
}
.scaling-switch:active {
  transform: scale(0.96);
}
.scaling-switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
@media (prefers-color-scheme: dark) {
  .scaling-switch {
    background: rgba(255, 255, 255, 0.15);
  }
  .scaling-switch-thumb {
    background: #1a1a1a;
  }
}

/* ── Scaling custom input (sits in the pill row, no stepper) ─────── */
.mult-input-wrap {
  position: relative;
  flex: 1 1 0%;
  min-width: 60px;
  display: flex;
  align-items: center;
}
.mult-input {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 1.5rem 0.5rem 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
  transition:
    border-color 150ms ease-out,
    background-color 150ms ease-out,
    color 150ms ease-out;
}
.mult-input:focus {
  border-color: var(--pill-on-bg);
}
/* Custom mode: the input is the source of truth (no preset pill checked),
   so echo the pill's checked fill — but only once it actually bites (>1×),
   so the default 1× state reads as quiet like the muted readout. */
.mult-input.is-active {
  background: var(--pill-on-bg);
  color: var(--pill-on-text);
  border-color: transparent;
}
.mult-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.mult-times {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ── Scaling panel: lift-in enter, quick collapse on exit ─────────── */
/* All children rise in together; toggling closed snaps them back without a
   reverse stagger. */
.scaling-panel .pill-sub,
.scaling-panel .mult-input-wrap {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 200ms ease-out,
    transform 200ms ease-out;
}
.scaling-panel--open .pill-sub,
.scaling-panel--open .mult-input-wrap {
  opacity: 1;
  transform: none;
}


/* ── Select custom chevron ────────────────────────────────────────── */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239c9a92' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Mode toggle slider (animated thumb between Free-form / Plans) ── */
#mode-slider {
  width: calc(50% - 4px);
  transition: left 200ms ease-out;
  z-index: 0;
}
#mode-toggle:has(input[value="plans"]:checked) #mode-slider {
  left: calc(50% + 2px);
}

/* ── Plans section visibility ────────────────────────────────────── */
.section-enter {
  animation: fadeInUp 350ms ease-out forwards;
}
