/* Grizzly Beam — website cost calculator (src/components/CostCalculator.astro)

   Built from parts the site already has, so it reads as the same hand:
     inputs   the hairline rows of .wpa__list and the .wpa__input field
     estimate the navy .hcard readout card from the service heroes (rows, tag, foot,
              the full-width amber .hcard__send action)
     sources  a <details> row in the language of .faq__item
   New here: the checkbox, the share band, the big yearly figure, the peek line. */

.cc { position: relative; background: var(--paper); color: var(--ink); padding-block: 9rem; }
/* Service pages: the same gradient as .svc-sec--grad, so the section keeps the page's
   paper / gradient rhythm instead of merging into the paper section above it. */
.cc--grad { background: linear-gradient(0deg, var(--stone2) 0%, var(--paper) 100%); }

/* ---------- head ---------- */
.cc__head { max-width: 46rem; }
.cc__eyebrow { color: var(--tx-g); }
.cc__title { font-size: 3.2rem; line-height: 1.05; letter-spacing: -0.005em; font-weight: var(--w-h2); margin-top: 1.5rem; text-wrap: balance; }   /* brand: H2, same as .wpa__title */
.cc__lede { color: var(--tx-g); margin-top: 1.6rem; max-width: 40rem; }

/* The head sits in the left column, so the estimate card starts level with the title
   instead of leaving an empty corner above it. */
.cc__grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 6rem; align-items: start;
}
.cc__head + .cc__step { margin-top: 4.5rem; }

/* ---------- steps ---------- */
.cc__step { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.cc__step + .cc__step { margin-top: 4.2rem; }
.cc__legend { display: flex; align-items: baseline; gap: 1.6rem; padding: 0; }
.cc__num { color: var(--tx-g); }
.cc__legend-t { font-size: 1.5625rem; line-height: 1.25; font-weight: var(--w-h3); }   /* brand: H3 20/600 */

/* Symptom rows. Two columns from 1200 up; a grid, not columns, so the hairline under
   each pair lines up even when one description runs a line longer. */
.cc__syms {
  list-style: none; margin-top: 1.6rem;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3rem;
  border-top: 1px solid rgba(22, 24, 28, 0.2);
}
.cc__syms li { border-bottom: 1px solid rgba(22, 24, 28, 0.2); }
.cc__sym {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.2rem;
  align-items: start; padding-block: 1.35rem; cursor: pointer;
}
/* The real checkbox stays in the page and in the tab order; it is only drawn by .cc__box. */
.cc__chk { position: absolute; top: 1.35rem; left: 0; width: 1.6rem; height: 1.6rem; margin: 0; opacity: 0; cursor: pointer; }
/* Border in --tx-g: 6.9:1 on Paper. The usual hairline (ink at 0.2-0.28) is about 1.6:1,
   too faint for the only outline that tells a visitor this is something to tick
   (WCAG 1.4.11 asks 3:1 of it). */
.cc__box {
  display: grid; place-items: center; width: 1.6rem; height: 1.6rem; margin-top: 0.1rem;
  border: 1.5px solid var(--tx-g); border-radius: 0.3rem; background: var(--white);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.cc__box svg { width: 1.1rem; height: 1.1rem; stroke: var(--ink); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.6); transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
/* Ticked: Beam Amber as the active state (brand book §04), ink check on it at 6.84:1.
   The edge goes to amber-deep, because amber alone is 2.49:1 against Paper. */
.cc__chk:checked + .cc__box { background: var(--amber); border-color: var(--amber-deep); }
.cc__chk:checked + .cc__box svg { opacity: 1; transform: none; }
.cc__sym:hover .cc__box { border-color: var(--ink); }
.cc__chk:focus-visible + .cc__box { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 6px var(--paper); }
.cc__symt { display: block; font-family: var(--f-body); font-size: 1.3rem; line-height: 1.35; font-weight: var(--w-body-strong); }
.cc__symd { display: block; font-family: var(--f-body); font-size: 1.133rem; line-height: 1.45; color: var(--tx-g); margin-top: 0.3rem; }

/* Number rows: label on the left, field on the right, like a line in a ledger. */
.cc__fields { margin-top: 1.6rem; border-top: 1px solid rgba(22, 24, 28, 0.2); }
.cc__field {
  display: grid; grid-template-columns: minmax(0, 1fr) 13.5rem; column-gap: 2.4rem;
  align-items: center; padding-block: 1.35rem; border-bottom: 1px solid rgba(22, 24, 28, 0.2);
}
.cc__flabel { font-family: var(--f-body); font-size: 1.3rem; line-height: 1.35; font-weight: var(--w-body-strong); }
.cc__fhint { display: block; font-weight: 400; font-size: 1.133rem; color: var(--tx-g); margin-top: 0.3rem; }
.cc__in { position: relative; }
.cc__in .wpa__input { max-width: none; margin-top: 0; background-color: var(--white); text-align: right; font-variant-numeric: tabular-nums; }
.cc__in--pre .wpa__input { padding-left: 2.2rem; }
.cc__in--suf .wpa__input { padding-right: 2.4rem; }
.cc__adorn {
  position: absolute; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-family: var(--f-body); font-size: 1.25rem; color: var(--tx-g);
}
.cc__in--pre .cc__adorn { left: 1.05rem; }
.cc__in--suf .cc__adorn { right: 1.05rem; }
.cc__err {
  grid-column: 1 / -1; margin-top: 0.7rem;
  font-family: var(--f-body); font-size: 1.094rem; line-height: 1.45; color: var(--danger);
}
.cc__note { color: var(--tx-g); margin-top: 1.4rem; max-width: 36rem; }

/* ---------- the estimate ---------- */
/* Sticky under the fixed header (7.97rem) with a little air, so the numbers stay in view
   while the visitor works down the list. */
.cc__out { position: sticky; top: calc(7.97rem + 2rem); min-width: 0; }
.cc__card { padding: 2rem 2rem 1.7rem; }
.cc__msg { font-family: var(--f-body); font-size: 1.055rem; line-height: 1.45; color: rgba(236, 232, 225, 0.72); margin-bottom: 1.3rem; }

.cc__meter { padding-bottom: 1.2rem; }
.cc__meter-h { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.cc__meter-l { font-family: var(--f-body); font-size: 1.055rem; line-height: 1.35; color: rgba(236, 232, 225, 0.72); }
.cc__meter-v { font-size: 1.25rem; font-weight: var(--w-h2); color: var(--tx-l); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The band IS the estimate: it runs from the low share to the high one on a 0-100% track,
   so the uncertainty is drawn, not hidden. It is a full-width bar cut down with clip-path
   rather than a moving left/width, so the change animates without touching layout. The
   right edge never comes closer than 4px to the left one, so a narrow range stays visible. */
.cc__track { position: relative; height: 0.55rem; margin-top: 0.9rem; border-radius: 2px; background: rgba(236, 232, 225, 0.12); overflow: hidden; }
.cc__band {
  --lo: 0; --hi: 0;
  position: absolute; inset: 0;
  background: var(--accent);
  clip-path: inset(0 min(calc((1 - var(--hi)) * 100%), calc(100% - var(--lo) * 100% - 4px)) 0 calc(var(--lo) * 100%) round 2px);
  transition: clip-path 0.48s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.cc:not(.has-ticks) .cc__band { opacity: 0; }
.cc__scale { display: flex; justify-content: space-between; margin-top: 0.45rem; font-family: var(--f-mono); font-size: 0.86rem; color: rgba(236, 232, 225, 0.72); }

.cc__card .hrow__v { font-size: 1.133rem; white-space: nowrap; }
.cc__card .hrow:first-of-type { border-top: 1px solid rgba(236, 232, 225, 0.12); }

.cc__tot { border-top: 1px solid rgba(236, 232, 225, 0.18); padding-top: 1.3rem; margin-top: 0.2rem; }
.cc__tot-l { font-family: var(--f-body); font-size: 1.055rem; line-height: 1.35; color: rgba(236, 232, 225, 0.72); }
.cc__month { display: block; margin-top: 0.5rem; font-size: 1.25rem; font-weight: var(--w-h2); color: var(--tx-l); font-variant-numeric: tabular-nums; }
/* The figure the section exists for. Amber on the card navy is about 5.6:1. */
.cc__year {
  display: block; margin-top: 0.9rem;
  font-size: 2.9rem; line-height: 1.08; letter-spacing: -0.01em; font-weight: var(--w-display);
  color: var(--accent); font-variant-numeric: tabular-nums; text-wrap: balance;
}
.cc__year-l { display: block; margin-top: 0.35rem; font-size: 1.055rem; font-weight: var(--w-h3); color: rgba(236, 232, 225, 0.72); }
.cc:not(.has-result) .cc__year { color: rgba(236, 232, 225, 0.38); }

.cc__leaks { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px dashed rgba(236, 232, 225, 0.18); }
/* Same label style as .hbook__lab on the contact card, but at 0.72: at 0.52 on the card navy
   it measured about 3.8:1 for 12px text, under AA. */
.cc__leaks-h { font-size: 0.94rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: var(--w-h3); color: rgba(236, 232, 225, 0.72); }
/* The "not a promise" line is the honesty clause of the whole section, so it does not get
   the card's faintest grey (0.52, ~3.8:1) either. */
.cc__card .hcard__foot { color: rgba(236, 232, 225, 0.72); }
.cc__leaks ol { list-style: none; margin-top: 0.7rem; display: grid; gap: 0.55rem; }
.cc__leaks li { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--f-body); font-size: 1.055rem; line-height: 1.35; }
.cc__leak-t { color: var(--tx-l); }
.cc__leak-v { flex: none; color: rgba(236, 232, 225, 0.72); font-variant-numeric: tabular-nums; }

.cc__risk { margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px dashed rgba(236, 232, 225, 0.18); }
.cc__risk-t { margin-top: 0.6rem; font-family: var(--f-body); font-size: 1.055rem; line-height: 1.45; color: rgba(236, 232, 225, 0.72); }
.cc__leaks:not([hidden]) + .cc__risk { margin-top: 1.2rem; }

.cc__cta { margin-top: 1.6rem; }

/* ---------- how we got this number ---------- */
.cc__how { margin-top: 5rem; border-top: 1px solid rgba(22, 24, 28, 0.2); border-bottom: 1px solid rgba(22, 24, 28, 0.2); }
.cc__how summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 2rem;
  padding-block: 1.6rem;
  font-family: var(--f-body); font-size: 1.45rem; font-weight: 600;
}
.cc__how summary::-webkit-details-marker { display: none; }
.cc__how-ico { display: grid; place-items: center; opacity: 0.7; transition: transform 0.25s ease; }
.cc__how-ico svg { width: 1.25rem; height: 1.25rem; }
.cc__how[open] .cc__how-ico { transform: rotate(180deg); }
.cc__how-body { padding-bottom: 3rem; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 6rem; }
.cc__how-math p, .cc__how-math li { font-family: var(--f-body); font-size: 1.2rem; line-height: 1.55; color: var(--tx-g); }
.cc__how-math p + p, .cc__how-math ol + p { margin-top: 1rem; }
.cc__how-math ol { margin: 1rem 0 0 1.4rem; display: grid; gap: 0.5rem; }
.cc__how-math strong { color: var(--ink); font-weight: var(--w-body-strong); }
.cc__src { list-style: none; border-top: 1px solid rgba(22, 24, 28, 0.2); }
.cc__src li { padding-block: 1.2rem; border-bottom: 1px solid rgba(22, 24, 28, 0.2); }
.cc__src-h { display: flex; justify-content: space-between; gap: 1.6rem; align-items: baseline; }
.cc__src-t { font-family: var(--f-body); font-size: 1.2rem; font-weight: var(--w-body-strong); }
.cc__src-r { flex: none; font-family: var(--f-mono); font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.cc__src-f { font-family: var(--f-body); font-size: 1.133rem; line-height: 1.5; color: var(--tx-g); margin-top: 0.4rem; }
.cc__src-a { display: inline-block; margin-top: 0.4rem; margin-right: 1.4rem; font-family: var(--f-body); font-size: 1.094rem; color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- small screens: the peek line ---------- */
.cc__peek { display: none; }

/* ---------- responsive ---------- */
/* Wide screens: the inputs stop at 96rem and the card at 46rem, and the two stay together
   on the left instead of being pushed to opposite edges. Stretched, the card was ~1000px
   wide at 2560 and the ledger rows put a label a screen away from its field; spread apart,
   the checklist and the estimate stopped reading as one instrument. */
@media (min-width: 1800px) {
  .cc__grid { grid-template-columns: minmax(0, 96rem) 46rem; justify-content: start; }
  .cc__how { max-width: 148rem; }   /* 96 + 6 + 46: ends where the card ends */
}
@media (max-width: 1199px) {
  .cc__syms { grid-template-columns: 1fr; }
  .cc__grid { gap: 4rem; }
}
@media (max-width: 1023px) {
  .cc { padding-block: 7rem; }
  .cc__grid { grid-template-columns: 1fr; gap: 0; }
  .cc__head + .cc__step { margin-top: 3.6rem; }
  .cc__out { position: static; margin-top: 1.2rem; }
  .cc__how-body { grid-template-columns: 1fr; gap: 2.4rem; }
  /* The peek keeps its space at all times and only fades, so showing or hiding it never
     shifts the card underneath while it is on screen. */
  /* bottom clears the fixed "Manage consent" tab (consent.css: 1.6rem from the edge, about
     2.8rem tall; 0.9rem from the edge below 768), so the two never sit on top of each other. */
  .cc__peek {
    position: sticky; bottom: 5.4rem; z-index: 2;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    width: 100%; margin-top: 2.4rem; min-height: 44px;
    padding: 1rem 1.2rem; border-radius: var(--r-10);
    background: linear-gradient(180deg, #20385A, #1A2D47); color: var(--tx-l);
    border: 1px solid rgba(236, 232, 225, 0.18); box-shadow: var(--el-lg);
    text-align: left; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }
  .cc.has-ticks.syms-in-view:not(.nums-in-view):not(.card-in-view) .cc__peek { opacity: 1; visibility: visible; transition: opacity 0.3s ease, visibility 0s; }
  .cc__peek-l { display: block; font-family: var(--f-body); font-size: 1.055rem; color: rgba(236, 232, 225, 0.72); }
  .cc__peek-v { display: block; font-size: 1.25rem; font-weight: var(--w-h2); font-variant-numeric: tabular-nums; margin-top: 0.15rem; }
  .cc__peek-go { flex: none; display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1.133rem; font-weight: var(--w-h3); }
  .cc__peek-go svg { width: 1.25rem; height: 1.25rem; }
}
@media (max-width: 767px) {
  .cc { padding-block: 6rem; }
  .cc__peek { bottom: 4.6rem; }
  .cc__title { font-size: 2.6rem; }
  .cc__field { grid-template-columns: 1fr; row-gap: 0.9rem; }
  .cc__card { padding: 1.6rem 1.4rem 1.4rem; }
  .cc__year { font-size: 2.5rem; }
  .cc__how summary { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cc__band, .cc__box, .cc__box svg, .cc__peek { transition: none; }
}
