/* ==========================================================
   TAX CALCULATOR — scoped so nothing here can ever leak onto
   or collide with elements elsewhere on the site (e.g. the
   .dot indicators used in .chip / .aff-chip).
   All slider-specific classes use a tc- prefix.
========================================================== */

.tax-calc{ color: var(--navy-900); }

.tax-calc .wrap{ max-width: 760px; margin: 0 auto; }

.tax-calc .section-head{ margin-bottom: 28px; }

.tax-calc .section-head .tag{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-600);
  display: inline-block;
  margin-bottom: 12px;
}

.tax-calc .section-head h2{
  font-family: var(--font-display);
  font-size: clamp(22px, 3.4vw, 32px);
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--navy-900);
}

.tax-calc .section-head p{
  font-size: 14px;
  line-height: 1.6;
  color: color-mix(in srgb, var(--navy-900) 65%, transparent);
  max-width: 56ch;
  margin: 0;
}

.tax-calc .calc-panel{
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 36px clamp(20px, 4vw, 44px) 32px;
  position: relative;   /* containing block — keeps absolutely positioned
                            children scoped to this panel only */
  isolation: isolate;   /* own stacking context */
}

/* Hide the real radio inputs but keep them operable via labels */
.tax-calc .calc-radio{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ---------- SLIDER ---------- */

.tax-calc .tc-slider{
  position: relative;
  height: 44px;
  margin: 10px 6px 6px;
}

.tax-calc .tc-slider .tc-track{
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  transform: translateY(-50%);
}

.tax-calc .tc-slider .tc-progress{
  position: absolute;
  top: 50%;
  left: 0;
  height: 3px;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue-600), var(--gold-500));
  transform: translateY(-50%);
  transition: width 0.55s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 1;
}

.tax-calc .tc-dot{
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line-strong);
  transform: translateY(-50%) scale(1);
  cursor: pointer;
  z-index: 2;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              background-color 0.35s ease,
              border-color 0.35s ease,
              box-shadow 0.35s ease;
}

.tax-calc .tc-dot:hover{ border-color: var(--blue-600); }

.tax-calc .tc-dot:focus-visible{
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
}

.tax-calc .tc-dot1{ left: 0%; }
.tax-calc .tc-dot2{ left: 20%; }
.tax-calc .tc-dot3{ left: 40%; }
.tax-calc .tc-dot4{ left: 60%; }
.tax-calc .tc-dot5{ left: 80%; }
.tax-calc .tc-dot6{ left: 100%; margin-left: -18px; }

@keyframes tc-dot-pop{
  0%{ transform: translateY(-50%) scale(1); }
  45%{ transform: translateY(-50%) scale(1.35); }
  100%{ transform: translateY(-50%) scale(1.18); }
}

/* Progress fill widths per selection (6 fixed steps) */
#inc-6:checked  ~ .tc-slider .tc-progress{ width: 0%; }
#inc-10:checked ~ .tc-slider .tc-progress{ width: 20%; }
#inc-12:checked ~ .tc-slider .tc-progress{ width: 40%; }
#inc-15:checked ~ .tc-slider .tc-progress{ width: 60%; }
#inc-20:checked ~ .tc-slider .tc-progress{ width: 80%; }
#inc-30:checked ~ .tc-slider .tc-progress{ width: 100%; }

/* Selected-dot highlight */
#inc-6:checked  ~ .tc-slider .tc-dot1,
#inc-10:checked ~ .tc-slider .tc-dot2,
#inc-12:checked ~ .tc-slider .tc-dot3,
#inc-15:checked ~ .tc-slider .tc-dot4,
#inc-20:checked ~ .tc-slider .tc-dot5,
#inc-30:checked ~ .tc-slider .tc-dot6{
  background: var(--gold-500);
  border-color: var(--gold-500);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold-500) 20%, transparent);
  animation: tc-dot-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- INCOME LABELS ---------- */

.tax-calc .income-labels{
  display: flex;
  justify-content: space-between;
  margin: 4px 0 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: color-mix(in srgb, var(--navy-900) 55%, transparent);
}

.tax-calc .income-labels span{
  transition: color 0.35s ease, font-weight 0.2s ease;
}

#inc-6:checked  ~ .income-labels span:nth-child(1),
#inc-10:checked ~ .income-labels span:nth-child(2),
#inc-12:checked ~ .income-labels span:nth-child(3),
#inc-15:checked ~ .income-labels span:nth-child(4),
#inc-20:checked ~ .income-labels span:nth-child(5),
#inc-30:checked ~ .income-labels span:nth-child(6){
  color: var(--navy-900);
  font-weight: 700;
}

/* ---------- RESULTS ---------- */

.tax-calc .calc-results{
  position: relative;
  min-height: 74px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 4px;
  margin-bottom: 28px;
}

.tax-calc .result{
  display: none;
  flex-direction: column;
  gap: 4px;
  animation: tc-fade-in 0.4s ease;
}

@keyframes tc-fade-in{
  from{ opacity: 0; transform: translateY(4px); }
  to{ opacity: 1; transform: translateY(0); }
}

.tax-calc .result .r-label{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--navy-900) 55%, transparent);
}

.tax-calc .result .r-value{
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  color: var(--navy-900);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tax-calc .result .r-value small{
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--blue-600);
}

#inc-6:checked  ~ .calc-results .result-6,
#inc-10:checked ~ .calc-results .result-10,
#inc-12:checked ~ .calc-results .result-12,
#inc-15:checked ~ .calc-results .result-15,
#inc-20:checked ~ .calc-results .result-20,
#inc-30:checked ~ .calc-results .result-30{
  display: flex;
}

/* ---------- CHART ---------- */

.tax-calc .chart-wrap{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 140px;
  padding-top: 10px;
}

.tax-calc .bar{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.tax-calc .bar-fill{
  display: block;
  width: 100%;
  max-width: 34px;
  background: var(--line-strong);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}

.tax-calc .bar-label{
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: color-mix(in srgb, var(--navy-900) 55%, transparent);
}

#inc-6:checked  ~ .chart-wrap .bar-6  .bar-fill,
#inc-10:checked ~ .chart-wrap .bar-10 .bar-fill,
#inc-12:checked ~ .chart-wrap .bar-12 .bar-fill,
#inc-15:checked ~ .chart-wrap .bar-15 .bar-fill,
#inc-20:checked ~ .chart-wrap .bar-20 .bar-fill,
#inc-30:checked ~ .chart-wrap .bar-30 .bar-fill{
  background: linear-gradient(180deg, var(--gold-500), var(--blue-600));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-500) 18%, transparent);
}

.tax-calc .calc-note{
  margin: 22px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: color-mix(in srgb, var(--navy-900) 45%, transparent);
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 640px){
  .tax-calc .calc-panel{ padding: 28px 18px 26px; }

  .tax-calc .tc-dot{ width: 16px; height: 16px; margin-left: -8px; }
  .tax-calc .tc-dot6{ margin-left: -16px; }

  .tax-calc .income-labels{ font-size: 10px; }

  .tax-calc .result .r-value{ font-size: 24px; }

  .tax-calc .chart-wrap{ height: 110px; gap: 6px; }
  .tax-calc .bar-fill{ max-width: 22px; }
  .tax-calc .bar-label{ font-size: 9px; }
}

@media (max-width: 420px){
  .tax-calc .income-labels span:nth-child(2),
  .tax-calc .income-labels span:nth-child(4){
    opacity: 0.55;
  }
}