#dividends {
  position: relative;
  overflow: hidden;
}

#dividends .calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
#dividends .calc-steps {
  display: flex; flex-direction: column;
  gap: 8px;
  position: relative;
}
#dividends .calc-steps-1 {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  border: 1px solid var(--card-border);
}
#dividends .calc-steps-2 {
  background: var(--card-bg);
  padding: 24px;
  border: 1px solid var(--card-border);
}
#dividends .step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
#dividends .step-badge {
  display: inline-flex; align-items: center;
  background: var(--purple); color: var(--dark-purple);
  border-radius: 50px; padding: 2px 8px;
  font-size: .625rem; font-weight: 800; letter-spacing: .2em;
}
#dividends .formula-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
#dividends .formula-box {
  background: var(--surface-muted);
  border-radius: 12px; padding: 12px 16px;
  text-align: center; min-width: 85px;
  border: 1px solid var(--card-border);
}
#dividends .formula-box label { display: block; font-size: .625rem; color: var(--text-sub); margin-bottom: 3px; font-weight: 500 }
#dividends .formula-box .val  { font-size: 1.25rem; font-family: ui-monospace, 'SF Mono', 'Monaco', monospace; font-weight: 800; color: var(--text); }
#dividends .formula-box.highlight { border: 1px solid var(--highlight-border); background: var(--highlight-bg); }
#dividends .formula-box.highlight .val { color: var(--text); }
#dividends .formula-op { font-size: 1.5rem; color: var(--gray); }
#dividends .step-arrow {
  width: 38px;
  height: 38px;
  background: var(--surface-elevated);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -19px auto;
  z-index: 3;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
#dividends .result-banner {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-radius: 0 0 var(--radius) var(--radius); padding: 24px 24px 10px 24px; text-align: center;
  color: #fff;
}
#dividends .result-label  { font-size: .875rem; opacity: .85; margin-bottom: 4px; }
#dividends .result-amount { font-size: 3.75rem; font-weight: 600; letter-spacing: -.025em; font-family: "Playfair Display", serif;}

#dividends .calc-widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--card-border);
}
#dividends .widget-header { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
#dividends .widget-icon {
  width: 45px; height: 45px;
  background: var(--purple); color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#dividends .widget-header h3 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
#dividends .widget-header p  { font-size: 0.875rem; color: var(--text-sub);  }

#dividends .slider-group { margin-bottom: 32px; }
#dividends .slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#dividends .slider-label span:first-child { font-size: 1rem; font-weight: 500; color: var(--text); }
#dividends .val-badge {
  background: var(--surface-muted);
  border-radius: 8px; padding: 3px 10px;
  font-size: 1.125rem; font-family: ui-monospace, 'SF Mono', 'Monaco', monospace; font-weight: 800; color: var(--text);
}
#dividends input[type="range"] {
  width: 100%; height: 8px; border-radius: 4px;
  appearance: none; -webkit-appearance: none;
  background: linear-gradient(to right, var(--blue) var(--pct, 10%), var(--card-border) var(--pct, 10%));
  outline: none; cursor: pointer;
  transition: background 0.2s ease;
}
#dividends input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 2px 6px rgba(42, 23, 212, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#dividends input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 2px 10px rgba(42, 23, 212, 0.55);
}
#dividends input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue);
  border: none;
  box-shadow: 0 2px 6px rgba(42, 23, 212, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#dividends input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.15);
}

#dividends .calc-results {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}
#dividends .calc-result-box {
  background: var(--surface-muted);
  border-radius: 12px; padding: 16px;
  text-align: center;
}
#dividends .calc-result-box.highlight {
  border: 1px solid var(--highlight-border); background: var(--highlight-bg);
}
#dividends .r-label { font-size: .75rem; color: var(--text-sub); font-weight: 500 }
#dividends .r-val   { font-size: 1.25rem; font-family: ui-monospace, 'SF Mono', 'Monaco', monospace; font-weight: 800; color: var(--text);}
#dividends .calc-result-box.highlight .r-val { color: var(--blue); }
#dividends .calc-result-box.highlight .r-label {
  color: var(--blue);
}
#dividends .calc-note {
  font-size: .875rem; color: var(--gray);
  text-align: center; margin-top: 24px; line-height: 1.5;
}

/* ── DARK MODE ──────────────────────────────────────── */
[data-theme="dark"] #dividends::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 75%;
  height: 70%;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  background: radial-gradient(circle, rgba(26, 82, 219, 0.06) 0%, transparent 72%);
}

[data-theme="dark"] #dividends > .container {
  position: relative;
  z-index: 1;
}

[data-theme="dark"] #dividends .section-heading h2 {
  color: #ffffff;
}

[data-theme="dark"] #dividends .section-heading h2 .blue {
  color: var(--blue);
}

[data-theme="dark"] #dividends .section-heading p {
  color: var(--text-sub);
}

[data-theme="dark"] #dividends .calc-steps-1,
[data-theme="dark"] #dividends .calc-steps-2,
[data-theme="dark"] #dividends .calc-widget {
  background: rgba(24, 24, 28, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

[data-theme="dark"] #dividends .step-badge {
  background: rgba(26, 82, 219, 0.15);
  color: #8eb4f7;
}

[data-theme="dark"] #dividends .formula-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] #dividends .formula-box.highlight {
  background: rgba(26, 82, 219, 0.12);
  border: 1px solid var(--blue);
}

[data-theme="dark"] #dividends .formula-box.highlight .val {
  color: #7aa8f5;
}

[data-theme="dark"] #dividends .step-arrow {
  background: rgba(24, 24, 28, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] #dividends .result-banner {
  background: linear-gradient(180deg, #2a61e6 0%, var(--blue) 50%, var(--blue-dark) 100%);
  box-shadow: inset 0 1px 0 rgba(120, 175, 255, 0.15);
}

[data-theme="dark"] #dividends .widget-icon {
  background: rgba(26, 82, 219, 0.14);
  color: var(--blue);
  border: 1px solid rgba(26, 82, 219, 0.22);
}

[data-theme="dark"] #dividends .widget-header h3 {
  color: #f1f5f9;
}

[data-theme="dark"] #dividends .val-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] #dividends input[type="range"]::-webkit-slider-thumb {
  box-shadow: 0 2px 8px rgba(26, 82, 219, 0.45);
}

[data-theme="dark"] #dividends input[type="range"]:active::-webkit-slider-thumb {
  box-shadow: 0 2px 12px rgba(26, 82, 219, 0.6);
}

[data-theme="dark"] #dividends input[type="range"]::-moz-range-thumb {
  box-shadow: 0 2px 8px rgba(26, 82, 219, 0.45);
}

[data-theme="dark"] #dividends .calc-result-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] #dividends .calc-result-box.highlight {
  background: rgba(26, 82, 219, 0.14);
  border: 1px solid var(--blue);
  box-shadow: 0 2px 14px rgba(0, 51, 160, 0.15);
}

[data-theme="dark"] #dividends .calc-result-box.highlight .r-val,
[data-theme="dark"] #dividends .calc-result-box.highlight .r-label {
  color: #7aa8f5;
}

[data-theme="dark"] #dividends .calc-note {
  color: #6b7280;
}

[data-theme="dark"] #dividends .calc-result-box.box-updated {
  animation: div-box-glow-dark 0.42s ease;
}

@keyframes div-box-glow-dark {
  0%   { box-shadow: 0 0 0 0 rgba(26, 82, 219, 0); }
  50%  { box-shadow: 0 0 0 5px rgba(26, 82, 219, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(26, 82, 219, 0); }
}

/* ── Scroll entrance ─────────────────────────────────── */
#dividends .section-heading,
#dividends .calc-steps-1,
#dividends .step-arrow,
#dividends .calc-steps-2,
#dividends .result-banner,
#dividends .calc-widget,
#dividends .calc-steps .formula-box,
#dividends .calc-result-box {
  opacity: 0;
}

#dividends.div-visible .section-heading {
  animation: div-fade-down 0.6s ease forwards;
}
#dividends.div-visible .calc-steps-1 {
  animation: div-slide-left 0.65s ease 0.12s forwards;
}
#dividends.div-visible .step-arrow {
  animation: div-scale-in 0.5s ease 0.38s forwards;
}
#dividends.div-visible .step-arrow svg {
  animation: div-arrow-bounce 2.2s ease-in-out 1.1s infinite;
}
#dividends.div-visible .calc-steps-2 {
  animation: div-fade-up 0.6s ease 0.48s forwards;
}
#dividends.div-visible .result-banner {
  animation: div-fade-up 0.6s ease 0.62s forwards;
}
#dividends.div-visible .result-amount {
  animation: div-result-pop 0.55s ease 0.85s forwards;
}
#dividends.div-visible .calc-widget {
  animation: div-slide-right 0.65s ease 0.2s forwards;
}

#dividends.div-visible .calc-steps-1 .formula-box:nth-child(1) { animation: div-fade-up 0.45s ease 0.42s forwards; }
#dividends.div-visible .calc-steps-1 .formula-box:nth-child(3) { animation: div-fade-up 0.45s ease 0.52s forwards; }
#dividends.div-visible .calc-steps-1 .formula-box:nth-child(5) { animation: div-fade-up 0.45s ease 0.62s forwards; }

#dividends.div-visible .calc-steps-2 .formula-box:nth-child(1) { animation: div-fade-up 0.45s ease 0.62s forwards; }
#dividends.div-visible .calc-steps-2 .formula-box:nth-child(3) { animation: div-fade-up 0.45s ease 0.72s forwards; }
#dividends.div-visible .calc-steps-2 .formula-box:nth-child(5) { animation: div-fade-up 0.45s ease 0.82s forwards; }
#dividends.div-visible .calc-steps-2 .formula-box:nth-child(7) { animation: div-fade-up 0.45s ease 0.92s forwards; }
#dividends.div-visible .calc-steps-2 .formula-box:nth-child(9) { animation: div-fade-up 0.45s ease 1.02s forwards; }

#dividends.div-visible .calc-result-box:nth-child(1) { animation: div-fade-up 0.45s ease 0.55s forwards; }
#dividends.div-visible .calc-result-box:nth-child(2) { animation: div-fade-up 0.45s ease 0.68s forwards; }
#dividends.div-visible .calc-result-box:nth-child(3) { animation: div-fade-up 0.45s ease 0.81s forwards; }

@keyframes div-fade-down {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes div-slide-left {
  from { opacity: 0; transform: translateX(-36px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes div-slide-right {
  from { opacity: 0; transform: translateX(36px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes div-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes div-scale-in {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes div-result-pop {
  from { transform: scale(0.88); }
  to   { transform: scale(1); }
}
@keyframes div-arrow-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

/* ── Slider value feedback ───────────────────────────── */
#dividends .val-badge.val-updated,
#dividends .r-val.val-updated {
  animation: div-val-pulse 0.38s ease;
}
#dividends .calc-result-box.box-updated {
  animation: div-box-glow 0.42s ease;
}
@keyframes div-val-pulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.07); color: var(--blue); }
  100% { transform: scale(1); }
}
@keyframes div-box-glow {
  0%   { box-shadow: 0 0 0 0 rgba(42, 23, 212, 0); }
  50%  { box-shadow: 0 0 0 5px rgba(42, 23, 212, 0.12); }
  100% { box-shadow: 0 0 0 0 rgba(42, 23, 212, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #dividends .section-heading,
  #dividends .calc-steps-1,
  #dividends .step-arrow,
  #dividends .calc-steps-2,
  #dividends .result-banner,
  #dividends .calc-widget,
  #dividends .calc-steps .formula-box,
  #dividends .calc-result-box,
  #dividends .result-amount {
    opacity: 1;
    animation: none !important;
    transform: none !important;
  }
  #dividends .step-arrow svg {
    animation: none !important;
  }
  #dividends .val-badge.val-updated,
  #dividends .r-val.val-updated,
  #dividends .calc-result-box.box-updated {
    animation: none !important;
  }
}

@media (max-width: 1024px) {
  #dividends .calc-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 768px) {
  #dividends .calc-steps-1,
  #dividends .calc-steps-2 { padding: 18px; }
  #dividends .calc-widget { padding: 20px; }
  #dividends .widget-header { margin-bottom: 24px; }
  #dividends .formula-box {
    min-width: 72px;
    padding: 10px 12px;
  }
  #dividends .formula-box .val { font-size: 1.0625rem; }
  #dividends .formula-op { font-size: 1.25rem; }
  #dividends .result-banner { padding: 20px 18px 10px; }
  #dividends .result-amount { font-size: clamp(2.25rem, 10vw, 3rem); }

  #dividends .calc-results {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
  }

  #dividends .calc-result-box {
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
  }

  #dividends .calc-result-box:not(.highlight) {
    background: var(--surface-muted);
  }

  #dividends .r-label {
    font-size: .6875rem;
    margin-bottom: 4px;
  }

  #dividends .r-val {
    font-size: 1.0625rem;
  }

  #dividends .calc-result-box.highlight {
    padding: 14px 18px;
  }

  #dividends .calc-result-box.highlight .r-val {
    font-size: 1.25rem;
  }
}
