/* ==========================================================
   NOMAD ENERGY AMERICA: Diesel savings calculator
   /savings-calculator/ only. Markup from scripts/site/calculator.mjs,
   behavior in js/calculator.js. Tokens from ds.css. Class prefix: calc-
   ========================================================== */

/* ---------- section ---------- */
.calc { background: var(--bg-subtle); padding-top: 64px; }
.calc__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 28px; align-items: start; }
.calc-noscript { margin-bottom: 24px; padding: 18px 22px; background: var(--white); border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-red); font-size: var(--type-body-sm); color: var(--text-body); }
.calc-noscript a { color: var(--accent-red); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- inputs card ---------- */
.calc-in { background: var(--surface-card); border: 1px solid var(--border-subtle); border-top: 4px solid var(--accent-red);
  box-shadow: var(--shadow-sm); padding: 36px 36px 32px; }
.calc-in__head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.calc-in__title { font-size: clamp(30px, 3vw, 40px); line-height: 1; }
.calc-in__intro { font-size: var(--type-body-sm); color: var(--text-muted); }

.calc-group { border: 0; min-width: 0; padding: 0; margin: 0 0 8px; }
.calc-group + .calc-group { margin-top: 18px; }
.calc-group__legend { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; margin-bottom: 4px;
  font-family: var(--font-mono); font-weight: var(--fw-medium); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-muted); }
.calc-group__legend::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }

.calc-field { display: flex; flex-direction: column; gap: 9px; padding: 16px 0; }
.calc-field + .calc-field { border-top: 1px solid var(--border-subtle); }
.calc-field[hidden] { display: none; }
.calc-field--sub { border-top: 0 !important; padding-top: 0; }
.calc-field__label { font-family: var(--font-display); font-weight: var(--fw-medium); font-size: 13px;
  letter-spacing: .15em; text-transform: uppercase; color: var(--text-strong); }
.calc-field__row { display: flex; align-items: center; gap: 22px; }
.calc-field__help { font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.calc-field__help--spec { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-red); }

/* number box with unit adornment */
.calc-num { position: relative; flex: 0 0 168px; }
.calc-num__input { width: 100%; height: 50px; padding: 0 74px 0 14px;
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 22px; letter-spacing: .01em; color: var(--text-strong);
  background: var(--white); border: 1px solid var(--border-strong); border-radius: 0; -moz-appearance: textfield; appearance: textfield;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.calc-num__input::-webkit-outer-spin-button, .calc-num__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-num__input:focus { outline: none; border-color: var(--accent-red); box-shadow: 0 0 0 3px var(--focus-ring); }
.calc-num__unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }

.calc-select { border-radius: 0; height: 50px; padding-top: 0; padding-bottom: 0; font-size: 16px; }
.calc-select:focus { box-shadow: 0 0 0 3px var(--focus-ring); }

/* ---------- range slider (red fill, square thumb) ---------- */
.calc-range { --fill: 50%; flex: 1; min-width: 0; height: 30px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; }
.calc-range::-webkit-slider-runnable-track { height: 4px; border: 0;
  background: linear-gradient(90deg, var(--red-500) 0, var(--red-500) var(--fill), var(--fog) var(--fill), var(--fog) 100%); }
.calc-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -8px;
  background: var(--red-500); border: 3px solid var(--white); border-radius: 0; box-shadow: 0 0 0 1px var(--red-500), 0 2px 6px rgba(6,18,38,.25);
  transition: transform var(--dur-fast) var(--ease); }
.calc-range::-moz-range-track { height: 4px; border: 0; background: var(--fog); }
.calc-range::-moz-range-progress { height: 4px; background: var(--red-500); }
.calc-range::-moz-range-thumb { width: 14px; height: 14px; background: var(--red-500); border: 3px solid var(--white);
  border-radius: 0; box-shadow: 0 0 0 1px var(--red-500), 0 2px 6px rgba(6,18,38,.25); }
.calc-range:hover::-webkit-slider-thumb, .calc-range:active::-webkit-slider-thumb { transform: scale(1.12); background: var(--red-400); }
.calc-range:hover::-moz-range-thumb { background: var(--red-400); }
.calc-range:focus { outline: none; }
.calc-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--red-500), 0 0 0 5px var(--focus-ring); }
.calc-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--red-500), 0 0 0 5px var(--focus-ring); }
.calc-range:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 4px; }

/* ---------- assumptions disclosure ---------- */
.calc-assume { margin-top: 18px; border: 1px solid var(--border-subtle); background: var(--bone); }
.calc-assume__sum { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none;
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 15px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-strong); }
.calc-assume__sum::-webkit-details-marker { display: none; }
.calc-assume__sum::marker { content: ""; }
.calc-assume__sum:hover { color: var(--accent-red); }
.calc-assume__hint { margin-left: auto; font-family: var(--font-mono); font-weight: var(--fw-regular); font-size: 11px;
  letter-spacing: .1em; color: var(--text-muted); }
.calc-assume[open] > .calc-assume__sum .nea-faq__icon::after { transform: scaleY(0); }
.calc-assume__body { padding: 0 18px 18px; border-top: 1px solid var(--border-subtle); }
.calc-assume__body .calc-field + .calc-field { border-top-color: var(--fog); }
.calc-assume__body .calc-num__input { background: var(--white); }
.calc-assume__note { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border-subtle);
  font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.calc-reset { margin-top: 14px; padding: 4px 0; font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 12px;
  letter-spacing: .15em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-strong); }
.calc-reset:hover { color: var(--accent-red); border-bottom-color: var(--accent-red); }

/* ---------- results panel (navy, sticky) ---------- */
.calc-out { position: sticky; top: calc(var(--header-h) + 20px); }
.calc-out__inner { position: relative; overflow: hidden; padding: 32px 34px 28px; color: #fff;
  background: var(--navy-700); border-top: 4px solid var(--accent-red); box-shadow: var(--shadow-lg); }
.calc-out__inner::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--grid-overlay); background-size: 48px 48px; opacity: .7; }
.calc-out__inner::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 50% at 85% 0%, rgba(228,0,43,.18), transparent 60%); }
.calc-out__inner > * { position: relative; z-index: 1; }

.calc-out__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; margin-bottom: 22px; }
.calc-out__k { font-family: var(--font-mono); font-weight: var(--fw-medium); font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red-400); }
.calc-out__sys { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-inverse-muted); }

.calc-out__label { display: block; font-family: var(--font-display); font-weight: var(--fw-medium); font-size: 11.5px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-inverse-faint); }
.calc-out__unit { font-size: .42em; margin-left: .22em; color: var(--red-400); font-weight: var(--fw-medium); letter-spacing: .02em; }
.calc-out__hero { padding-bottom: 22px; border-bottom: 1px solid var(--border-inverse); }
.calc-out__big { display: block; margin-top: 10px; font-family: var(--font-display); font-weight: var(--fw-semibold);
  font-size: clamp(54px, 5.6vw, 84px); line-height: .9; letter-spacing: -.02em; color: #fff;
  font-variant-numeric: tabular-nums; white-space: nowrap; }

.calc-out__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--border-inverse); }
.calc-out__cell { padding: 20px 0; min-width: 0; }
.calc-out__cell + .calc-out__cell { padding-left: 22px; border-left: 1px solid var(--border-inverse); }
.calc-out__mid { display: block; margin-top: 8px; font-family: var(--font-display); font-weight: var(--fw-semibold);
  font-size: clamp(30px, 2.8vw, 40px); line-height: 1; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-out__mid .calc-out__unit { font-size: .5em; }

.calc-out__share { padding: 20px 0 18px; border-bottom: 1px solid var(--border-inverse); }
.calc-out__share-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.calc-out__pct { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 30px; line-height: 1; color: #fff;
  font-variant-numeric: tabular-nums; }
.calc-bar { height: 10px; background: rgba(255,255,255,.1); border: 1px solid var(--border-inverse); }
.calc-bar__fill { display: block; height: 100%; max-width: 100%;
  background: linear-gradient(90deg, var(--red-500), var(--red-400)); transition: width var(--dur-slow) var(--ease); }

.calc-out__co2 { padding: 16px 0; border-bottom: 1px solid var(--border-inverse);
  font-size: 13px; line-height: 1.55; color: var(--text-inverse-muted); }
.calc-out__co2 span:first-child { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 17px; color: #fff; }

.calc-out__notes { display: flex; flex-direction: column; gap: 8px; padding: 16px 0 4px; }
.calc-note { position: relative; padding-left: 18px; font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  letter-spacing: .03em; color: var(--text-inverse-muted); }
.calc-note::before { content: ""; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; background: var(--blue-400); }
.calc-note--power { color: #fff; }
.calc-note--power::before { background: var(--gold-500); }
.calc-note[hidden] { display: none; }

.calc-out__ctas { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 22px; }
.calc-out__cta { width: 100%; white-space: normal; text-align: center; line-height: 1.25; letter-spacing: .14em; }
.calc-copy { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 18px;
  font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 12.5px; letter-spacing: .15em; text-transform: uppercase;
  color: #fff; border: 1px solid var(--border-inverse-strong); transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.calc-copy svg { flex-shrink: 0; }
.calc-copy:hover { border-color: #fff; }
.calc-copy__status { min-height: 1.4em; text-align: center; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  color: var(--signal-go); overflow-wrap: anywhere; }
.calc-copy__status:empty { min-height: 0; }
.calc-out__disc { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-inverse);
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5; letter-spacing: .1em; text-transform: uppercase; color: var(--text-inverse-faint); }

/* ---------- how we calculate (white) ---------- */
.calc-how { background: var(--bg-base); }
.calc-how__inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px 72px; align-items: start; }
.calc-how__text { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; max-width: 64ch; }
.calc-how__text p { color: var(--text-body); }
.calc-how__h3 { font-size: 22px; letter-spacing: .02em; margin: 40px 0 14px; }
.calc-how__list { list-style: none; border-top: 2px solid var(--accent-navy); max-width: 64ch; }
.calc-how__list li { position: relative; padding: 13px 0 13px 22px; border-bottom: 1px solid var(--border-subtle);
  font-size: var(--type-body-sm); line-height: 1.55; color: var(--text-body); }
.calc-how__list li::before { content: ""; position: absolute; left: 0; top: 1.25em; width: 7px; height: 7px; background: var(--accent-red); }

.calc-math { padding: 32px 30px 28px; background: var(--bone); border: 1px solid var(--border-subtle); border-top: 4px solid var(--accent-navy); }
.calc-math__head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.calc-math__k { font-family: var(--font-mono); font-weight: var(--fw-medium); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-red); }
.calc-math__title { font-size: 26px; }
.calc-math__dl { border-top: 2px solid var(--accent-navy); }
.calc-math__row { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.calc-math__row dt { font-size: 14.5px; color: var(--text-body); }
.calc-math__row dd { flex-shrink: 0; font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 19px; color: var(--text-strong);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-math__row--total dt { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-strong); }
.calc-math__row--total dd { color: var(--accent-red); }
.calc-math__foot { margin-top: 16px; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; letter-spacing: .03em; color: var(--text-muted); }
.calc-math .nea-card__cta { margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .calc__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); }
  .calc-num { flex-basis: 150px; }
}
@media (max-width: 1000px) {
  .calc__grid { grid-template-columns: minmax(0, 1fr); }
  .calc-out { position: static; }
  .calc-how__inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .calc { padding-top: 40px; }
}
@media (max-width: 560px) {
  .calc-in { padding: 26px 18px 22px; }
  .calc-out__inner { padding: 26px 20px 22px; }
  .calc-field__row { gap: 16px; }
  .calc-num { flex-basis: 140px; }
  .calc-num__input { font-size: 20px; padding-right: 68px; }
  .calc-out__cell + .calc-out__cell { padding-left: 14px; }
  .calc-out__mid { font-size: 28px; }
  .calc-math { padding: 26px 18px 22px; }
  .calc-assume__hint { display: none; }
}

/* the FAQ follows the white "How We Calculate" section: separate them with a rule */
.calc-how + .pg-faq { border-top: 1px solid var(--border-subtle); }
