/* Estimate builder at /pricing. Uses the tokens in styles.css.
   Layout: green title band, then the tool picker on the left and a green estimate card that stays in view on the right.
   On phones the card drops below the picker and a slim totals bar sits at the bottom of the screen. */
:root {
  --lvl-basic: #CFE3D6;
  --lvl-standard: #8FC3AD;
  --lvl-advanced: #F4A938;
  --lvl-custom: #C9821A;
  --card: #fff;
  --picked: #EEF5F0;
}

[hidden] { display: none !important; }
html:not(.js) .js-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-links a[aria-current="page"] { color: var(--cream); box-shadow: inset 0 -2px 0 var(--gold); }

/* Title band */
.calc-head { background: var(--green); color: var(--cream); padding-block: clamp(48px, 7vw, 88px) clamp(40px, 6vw, 72px); }
.calc-head h1 { font-size: clamp(2.7rem, 7.4vw, 5rem); letter-spacing: -0.035em; line-height: 0.95; }
.calc-head .lede { max-width: 36em; }

/* Picker and card */
.calc { padding-block: 48px 96px; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: start; }
.calc-build { min-width: 0; }
.calc-noscript { background: var(--cream-2); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 32px; }

.calc-group + .calc-group { margin-top: 48px; }
.calc-group > h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
.calc-group > p { color: var(--muted); margin-top: 8px; max-width: 40em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  font: inherit; font-size: 0.95rem; font-weight: 500; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--rule); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: rgba(18, 64, 58, .45); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--cream); }

/* Tool cards */
.tools { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tools li { display: flex; min-width: 0; }
.tool {
  flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; gap: 6px 12px;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--rule); border-radius: var(--radius); padding: 18px;
  transition: background-color .15s ease, border-color .15s ease;
}
.tool:hover { border-color: rgba(18, 64, 58, .45); }
.tool[aria-pressed="true"] { background: var(--picked); border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.tool-name { font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; line-height: 1.2; }
.tool-check {
  grid-column: 2; grid-row: 1 / span 2; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--rule); display: grid; place-items: center; color: var(--green-2);
}
.tool-check svg { width: 14px; height: 14px; opacity: 0; }
.tool[aria-pressed="true"] .tool-check { background: var(--gold); border-color: var(--gold); }
.tool[aria-pressed="true"] .tool-check svg { opacity: 1; }
.tool-tags { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tool-helps { font-size: 0.78rem; font-weight: 600; color: var(--green); background: var(--sage); border-radius: 6px; padding: 2px 8px; }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lvl::before, .dot { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lvl-basic::before, .dot-basic { background: var(--lvl-basic); box-shadow: inset 0 0 0 1px rgba(18, 64, 58, .35); }
.lvl-standard::before, .dot-standard { background: var(--lvl-standard); }
.lvl-advanced::before, .dot-advanced { background: var(--lvl-advanced); }
.lvl-custom::before, .dot-custom { background: repeating-linear-gradient(135deg, var(--gold) 0 3px, var(--lvl-custom) 3px 6px); }
.dot-training { background: rgba(250, 245, 234, .55); }
.dot-min { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(250, 245, 234, .55); }
.tool-what { grid-column: 1 / -1; color: var(--muted); font-size: 0.94rem; line-height: 1.5; }
.tool-price { grid-column: 1 / -1; margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--rule); font-size: 0.92rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tool-price b { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }

/* Training */
.row-card { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--card); border: 1.5px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; }
.row-card p { color: var(--muted); min-width: 0; }
.row-card b { color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper button { width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--cream); color: var(--ink); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper output { min-width: 28px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.chip:focus-visible, .tool:focus-visible, .stepper button:focus-visible, .calc-bar-link:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Estimate card */
.est {
  position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--green); color: var(--cream); border-radius: var(--radius); padding: 26px;
}
.est-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.est-top h2 { font-size: 1.5rem; }
.est-pill { font-size: 0.78rem; font-weight: 600; color: var(--gold); border: 1.5px solid var(--gold); border-radius: 999px; padding: 3px 10px; }
.est-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.est-totals > div { display: grid; gap: 2px; min-width: 0; }
.est-k { font-size: 0.74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(250, 245, 234, .7); }
.est-v { font-family: var(--display); font-weight: 800; font-size: 2.5rem; letter-spacing: -0.03em; line-height: 1.05; white-space: nowrap; font-variant-numeric: tabular-nums; }
.est-v small { font-family: var(--body); font-size: 0.95rem; font-weight: 600; letter-spacing: 0; color: rgba(250, 245, 234, .7); }
.est-totals.is-range { grid-template-columns: 1fr; gap: 14px; }
.est-totals.is-range .est-v { font-size: 2rem; }
.est-sub { font-size: 0.85rem; color: rgba(250, 245, 234, .65); font-variant-numeric: tabular-nums; }
.est-year { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed rgba(250, 245, 234, .25); color: rgba(250, 245, 234, .8); font-size: 0.95rem; }
.est-year b { color: var(--cream); font-variant-numeric: tabular-nums; white-space: nowrap; }
.est-empty { margin-top: 18px; color: rgba(250, 245, 234, .78); }

.est-bars { margin-top: 20px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px 12px; }
.est-bar-k { font-size: 0.72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(250, 245, 234, .65); }
.est-bar { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: rgba(250, 245, 234, .12); }
.est-bar span { display: block; height: 100%; min-width: 3px; transition: flex-grow .25s ease; }
.est-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: rgba(250, 245, 234, .75); }
.est-legend li { display: inline-flex; align-items: center; gap: 6px; }

.est-lines { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.est-lines th { font-size: 0.7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(250, 245, 234, .6); text-align: right; padding: 0 0 6px 10px; }
.est-lines th:first-child { text-align: left; padding-left: 0; }
.est-lines td { border-top: 1px solid rgba(250, 245, 234, .14); padding: 8px 0 8px 10px; text-align: right; white-space: nowrap; vertical-align: top; }
.est-lines td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.est-lines .dot { margin-right: 8px; vertical-align: 1px; }
.est-lines .muted { color: rgba(250, 245, 234, .5); }

.est-note { margin-top: 16px; padding: 12px 14px; border: 1.5px solid var(--gold); border-radius: 10px; font-size: 0.92rem; }
.est-ctas { display: grid; gap: 10px; margin-top: 22px; }
.est-ctas .btn { width: 100%; }
.est-foot { margin-top: 12px; font-size: 0.82rem; color: rgba(250, 245, 234, .65); }

/* How pricing works */
.calc-fine { margin: 64px 0 0; padding-top: 32px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px 40px; }
.calc-fine dt { font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.calc-fine dd { margin: 6px 0 0; color: var(--muted); font-size: 0.96rem; }

/* Phone totals bar */
.calc-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--green-2); color: var(--cream); box-shadow: 0 -8px 24px rgba(16, 32, 29, .22);
}
.calc-bar-nums { font-size: 0.92rem; color: rgba(250, 245, 234, .85); min-width: 0; }
.calc-bar-nums b { font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--cream); letter-spacing: -0.01em; }
.calc-bar-link { flex: none; background: var(--gold); color: var(--green-2); font-weight: 600; font-size: 0.92rem; text-decoration: none; border-radius: 999px; padding: 9px 16px; }

@media (min-width: 961px) and (max-width: 1100px) {
  .tools { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .calc-grid { grid-template-columns: 1fr; gap: 40px; }
  .est { position: static; max-height: none; overflow: visible; }
  .calc { padding-bottom: 120px; }
}
@media (min-width: 961px) {
  .calc-bar { display: none !important; }
}
@media (max-width: 640px) {
  .tools { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .tool { padding: 16px; }
  .row-card { align-items: flex-start; flex-direction: column; }
  .est { padding: 22px 20px; }
  .est-v { font-size: 2.2rem; }
  .est-totals.is-range .est-v { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .chip, .tool, .est-bar span { transition: none; }
}

/* Bar segments, colored by how complex the tool is */
.s-basic { background: var(--lvl-basic); }
.s-standard { background: var(--lvl-standard); }
.s-advanced { background: var(--lvl-advanced); }
.s-custom { background: repeating-linear-gradient(135deg, var(--gold) 0 4px, var(--lvl-custom) 4px 8px); }
.s-training { background: rgba(250, 245, 234, .55); }
.s-min { background: rgba(250, 245, 234, .22); }
