/* Trickle Up - components */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 12px 20px;
  background: var(--accent-flow);
  color: var(--bg);
  border: 1px solid var(--accent-flow);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  text-decoration: none;
  min-height: 44px;
}

.btn:hover { transform: translateY(-1px); background: #79b8ff; border-color: #79b8ff; }
.btn:focus-visible { outline: 2px solid var(--accent-spark); outline-offset: 2px; }
.btn:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn--ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--text-muted);
}

.btn--small { padding: 8px 14px; font-size: 13px; min-height: 36px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
}

.card--clickable {
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}

.card--clickable:hover {
  border-color: var(--accent-flow);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.card--clickable:focus-visible {
  outline: 2px solid var(--accent-spark);
  outline-offset: 2px;
}

.card.is-active {
  border-color: var(--accent-flow);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--accent-flow), 0 8px 32px rgba(88, 166, 255, 0.15);
}

/* Slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: 100%;
}

.slider-wrap__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}

.slider-wrap__value {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--text);
  min-width: 4em;
  text-align: right;
}

input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border);
  outline: none;
  cursor: pointer;
}

input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: var(--accent-flow);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
  transition: transform var(--t-fast);
}

input[type="range"].slider::-webkit-slider-thumb:hover { transform: scale(1.1); }

input[type="range"].slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--accent-flow);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
}

input[type="range"].slider:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-spark);
}

/* Number input */
input[type="number"].input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  padding: 12px 16px;
  width: 100%;
  max-width: 200px;
  outline: none;
  transition: border-color var(--t-fast);
  min-height: 44px;
}

input[type="number"].input:focus {
  border-color: var(--accent-flow);
}

/* Toggle group (debt chapter) */
.toggle-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  flex-wrap: wrap;
  gap: 2px;
}

.toggle-group__btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  min-height: 36px;
}

.toggle-group__btn:hover { color: var(--text); }
.toggle-group__btn.is-active { background: var(--accent-flow); color: var(--bg); }
.toggle-group__btn:focus-visible { outline: 2px solid var(--accent-spark); outline-offset: 2px; }

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -110%);
  transition: opacity var(--t-fast);
  z-index: 10;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tooltip.is-visible { opacity: 1; }

/* Stat box */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.stat__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat__value {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat__value--grow { color: var(--accent-grow); }
.stat__value--warn { color: var(--accent-warn); }

.stat__delta {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Footnote */
.footnote {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-top: var(--sp-5);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
}

/* Continue arrow */
.continue-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--accent-flow);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: var(--sp-6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-slow), transform var(--t-slow);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-2) 0;
}

.continue-arrow.is-visible { opacity: 1; transform: translateY(0); }

.continue-arrow svg {
  width: 16px;
  height: 16px;
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .continue-arrow svg { animation: none; }
}
