/* Block 9, cost and alternatives (v5).
   The comparison shows Vanguard X against one alternative at a time, in two wide columns.
   The estimator is its own panel below the table. */

.cmp { padding-block: clamp(80px, 10vw, 140px); }
.cmp-wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--side); }

/* ---------- which alternative ---------- */
.cmp-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 20px; font-size: 15px; color: var(--mute-l); }
.switch-n { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin-top: 0; }
.switch-n .switch-b { padding: 0 20px; }
.switch-n .switch-thumb { width: calc((100% - 8px) / var(--n)); transform: translateX(calc(var(--i, 0) * 100%)); }
.switch-n .sm { display: none; }

/* ---------- the two columns ---------- */
.cmp-t { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 14px 0; margin-inline: -14px; width: calc(100% + 28px); font-size: 16.5px; line-height: 1.4; }
.cmp-t th, .cmp-t td { padding: 19px 26px; text-align: left; vertical-align: middle; }
.cmp-t th:first-child { width: 24%; padding-left: 0; font-weight: 500; font-size: 15.5px; color: var(--mute-l); border-bottom: 1px solid var(--line-l); }
.cmp-t thead th { padding-block: 22px 18px; font-size: 15px; font-weight: 500; }
.cmp-t thead th:first-child { border-bottom: 0; }

/* ours: one dark slab */
.cmp-us { background: var(--ink); color: #fff; font-weight: 500; border-bottom: 1px solid rgba(255,255,255,.1); }
.cmp-t thead .cmp-us { border-radius: 20px 20px 0 0; font-size: 17px; letter-spacing: -.01em; border-bottom-color: rgba(255,255,255,.16); }
.cmp-t tbody .cmp-us { position: relative; padding-left: 58px; }
.cmp-t tbody .cmp-us::before {
  content: ""; position: absolute; left: 26px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%;
  background: var(--orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9.4l2.6 2.6L13 6.6'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.cmp-t .cmp-last .cmp-us { border-bottom: 0; border-radius: 0 0 20px 20px; color: #ffb184; }

/* the alternative: a quiet light slab, each line marked against ours */
.cmp-alt { background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line-l); }
.cmp-t thead .cmp-alt { border-radius: 20px 20px 0 0; color: var(--mute-l); }
.cmp-t .cmp-last th { border-bottom: 0; }
.cmp-t .cmp-last .cmp-alt { border-bottom: 0; border-radius: 0 0 20px 20px; }
.cmp-t tbody .cmp-alt { position: relative; padding-left: 58px; }
.cmp-alt[data-s]::before, .cmp-key span::before {
  content: ""; position: absolute; left: 28px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
.cmp-alt[data-s="same"]::before, .cmp-key [data-s="same"]::before { background: var(--ink); }
.cmp-alt[data-s="part"]::before, .cmp-key [data-s="part"]::before { background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.cmp-alt[data-s="short"] { color: var(--mute-l); }
.cmp-alt[data-s="short"]::before, .cmp-key [data-s="short"]::before { box-shadow: inset 0 0 0 1.5px #a3a8b0; }

/* with scripting, one alternative at a time (without it the whole table shows) */
.js .cmp-t[data-alt="0"] .cmp-alt:not(:nth-child(3)),
.js .cmp-t[data-alt="1"] .cmp-alt:not(:nth-child(4)),
.js .cmp-t[data-alt="2"] .cmp-alt:not(:nth-child(5)) { display: none; }
.js .cmp-t .cmp-alt { animation: cmp-in .5s var(--ease-out) both; }
.js .cmp-t tbody tr:nth-child(2) .cmp-alt { animation-delay: 30ms; }
.js .cmp-t tbody tr:nth-child(3) .cmp-alt { animation-delay: 60ms; }
.js .cmp-t tbody tr:nth-child(4) .cmp-alt { animation-delay: 90ms; }
.js .cmp-t tbody tr:nth-child(5) .cmp-alt { animation-delay: 120ms; }
.js .cmp-t tbody tr:nth-child(6) .cmp-alt { animation-delay: 150ms; }
.js .cmp-t tbody tr:nth-child(7) .cmp-alt { animation-delay: 180ms; }
.js .cmp-t tbody tr:nth-child(8) .cmp-alt { animation-delay: 210ms; }
@keyframes cmp-in { from { color: transparent; } }

.cmp-key { display: flex; gap: 20px; margin-left: auto; font-size: 13.5px; }
.cmp-key span { position: relative; padding-left: 20px; }
.cmp-key span::before { left: 0; }

/* ---------- the estimator ---------- */
.cmp .cost { position: relative; overflow: hidden; max-width: calc(var(--max) - 2 * var(--side)); margin: clamp(28px, 3.4vw, 48px) auto 0; border-radius: 24px; }
@media (max-width: 1440px) { .cmp .cost { margin-inline: var(--side); } }
.est { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(32px, 5vw, 88px); align-items: center; padding: clamp(36px, 4.6vw, 68px) clamp(22px, 4vw, 64px); }
.cost-bridge { font-family: var(--f-display); font-weight: 500; font-size: clamp(22px, 2vw, 30px); letter-spacing: -.03em; line-height: 1.2; }
.cost-bridge + .lead { margin-top: 12px; }

.est-set { display: grid; gap: 26px; }
.est-set .lead { margin-bottom: 4px; }
.est-f { display: grid; gap: 12px; min-width: 0; border: 0; padding: 0; margin: 0; }
.est-f legend, .est-lab { padding: 0; font-size: 14px; font-weight: 500; color: rgba(255,255,255,.72); }
.est-f legend { margin-bottom: 12px; }
.est-lab { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.est-lab output { font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; }
.est-row { grid-template-columns: 1fr auto; align-items: center; }
.est-f small { font-size: 13px; color: var(--mute-d); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px; font-size: 15px; font-weight: 500; color: rgba(255,255,255,.86); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); transition: background-color .25s, color .25s, box-shadow .25s; }
.chip:hover span { box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.chip input:checked + span { background: #fff; color: #000; box-shadow: none; }
.chip input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.stepper button { width: 36px; height: 36px; border-radius: 50%; font-size: 18px; color: #fff; transition: background-color .2s; }
.stepper button:hover { background: rgba(255,255,255,.12); }
.stepper output { min-width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* the slider: a thin track that fills in orange up to the thumb (--p is set from the script) */
.est input[type="range"] { --p: 48%; -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.est input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--orange) var(--p), rgba(255,255,255,.18) var(--p)); }
.est input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); }
.est input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--orange); }
.est input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.5); transition: transform .2s var(--ease-out); }
.est input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.est input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.est input[type="range"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 6px; }

/* the result: two bars. The U.S. one is full; ours is about half, and the number waits for the email */
.est-out { display: grid; gap: 26px; padding: clamp(22px, 2.6vw, 34px); border-radius: 20px; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.bar-row { display: grid; gap: 10px; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.bar-top span { font-size: 15px; color: rgba(255,255,255,.78); }
.bar-top b { font-weight: 500; font-size: clamp(26px, 2.5vw, 36px); letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.bar-top .lock { color: #ff9e68; filter: blur(5px); user-select: none; }
.bar { display: flex; height: 14px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar i { height: 100%; transform-origin: 0 50%; transform: scaleX(0); transition: transform 1.1s var(--ease-out); }
.bar-us { width: 76.9%; background: rgba(255,255,255,.86); border-radius: 999px; }
.bar-over { flex: 1; margin-left: 4px; border-radius: 999px; background: rgba(255,255,255,.42); transition-delay: .35s; }
.bar-vx { width: 50%; background: var(--orange); border-radius: 999px; transition-delay: .25s; }
.bar-save { flex: 1; margin-left: 4px; border-radius: 999px; background: repeating-linear-gradient(-45deg, rgba(255,158,104,.38) 0 5px, transparent 5px 10px); transition-delay: .7s; }
.est-out.is-in .bar i { transform: none; }
.bar-row small { font-size: 13px; color: var(--mute-d); }

.est-gate { display: grid; gap: 14px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.12); }
.est-fields { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.est-fields .est-lab, .est-fields .calc-err { grid-column: 1 / -1; }
.est-fields input { height: 48px; min-width: 0; padding: 0 16px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 16px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.est-fields input::placeholder { color: rgba(255,255,255,.4); }
.est-fields input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.est-fields .btn { height: 48px; }
.calc-err { font-size: 13.5px; color: #ff9e68; }
.calc-err:empty { display: none; }
.est-in { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: rgba(255,255,255,.72); }
.est-in li { display: flex; align-items: baseline; gap: 8px; }
.est-in li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); transform: translateY(-1px); }
.calc-fine { font-size: 12.5px; color: var(--mute-d); }
.calc-done { display: grid; gap: 6px; padding: 18px; border-radius: 16px; background: rgba(43,182,115,.12); box-shadow: inset 0 0 0 1px rgba(43,182,115,.4); }
.calc-done b { font-weight: 600; font-size: 17px; }
.calc-done p { font-size: 14.5px; color: rgba(255,255,255,.8); }

/* ---------- narrower screens ---------- */
@media (max-width: 1100px) {
  .est { grid-template-columns: 1fr; }
  .switch-n .switch-b { padding: 0 14px; font-size: 14px; }
}
@media (max-width: 760px) {
  .cmp-pick { flex-direction: column; align-items: stretch; gap: 10px; }
  .switch-n { width: 100%; }
  .switch-n .lg { display: none; }
  .switch-n .sm { display: inline; }
  .switch-n .switch-b { padding: 0 6px; }
  /* each line becomes: what matters, then ours and theirs side by side */
  .cmp-t, .cmp-t thead, .cmp-t tbody { display: block; width: 100%; margin: 0; }
  .cmp-t tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .cmp-t th:first-child { grid-column: 1 / -1; width: auto; padding: 18px 0 8px; border-bottom: 0; font-size: 14px; }
  .cmp-t thead th:first-child { display: none; }
  .cmp-t th, .cmp-t td { padding: 13px 14px; font-size: 15px; }
  .cmp-t thead th { padding-block: 12px; border-radius: 14px; font-size: 14px; }
  .cmp-t thead .cmp-us, .cmp-t thead .cmp-alt { border-radius: 14px; }
  .cmp-t tbody .cmp-us, .cmp-t tbody .cmp-alt { padding: 13px 14px; border: 0; border-radius: 14px; }
  .cmp-t tbody .cmp-us::before, .cmp-t tbody .cmp-alt::before { display: none; }
  .cmp-t .cmp-last .cmp-us, .cmp-t .cmp-last .cmp-alt { border-radius: 14px; }
  .cmp-key { display: none; }
  .cmp-alt[data-s="same"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
  .cmp .cost { margin-top: 22px; }
  .est-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .js .cmp-t .cmp-alt { animation: none; }
  .bar i { transition: none; transform: none; }
}
.est [hidden] { display: none; }
/* the panel is dark inside a light section: its supporting text takes the dark-surface grey */
.cmp .cost .lead { color: var(--mute-d); }
.chip span { height: 38px; padding: 0 13px; font-size: 14.5px; }
.bar-top .lock { filter: blur(4px); }

/* what each part of a bar is */
.bar-key { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 18px; font-size: 13.5px; color: rgba(255,255,255,.78); }
.bar-key span { display: inline-flex; align-items: baseline; gap: 8px; }
.bar-key span::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; transform: translateY(1px); }
.bar-key b { font-weight: 500; color: #fff; font-variant-numeric: tabular-nums; }
.k-sal::before { background: rgba(255,255,255,.86); }
.k-over::before { background: rgba(255,255,255,.42); }
.k-vx::before { background: var(--orange); }
.k-save::before { background: repeating-linear-gradient(-45deg, rgba(255,158,104,.7) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px rgba(255,158,104,.5); }

/* the salary adjustment: closed by default, the value stays in view */
.est-adj { border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; }
.est-adj summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; font-weight: 500; color: rgba(255,255,255,.72); }
.est-adj summary::-webkit-details-marker { display: none; }
.est-adj summary span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .3em; text-decoration-color: rgba(255,255,255,.35); }
.est-adj summary:hover span { color: #fff; }
.est-adj summary output { font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; }
.est-adj summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
.est-adj .est-f { margin-top: 12px; }
/* the numbers never break across lines; on phones the locked one is a little smaller so its label fits beside it */
.bar-top b { white-space: nowrap; }
@media (max-width: 480px) { .bar-top .lock { font-size: 22px; } .bar-top span { white-space: nowrap; } }
