/* =========================================================
   HBH Performance · gains.css  (remap figures finder)
   Uses the tokens from style.css (--carbon, --graphite, --ice…)
   ========================================================= */
.gains {
  --g-s0: var(--steel, #8A93A6);
  --g-s1: var(--blue, #0066FF);
  --g-s1-text: #4D8DFF;            /* brand blue, lifted so numbers read on dark */
  --g-s2: var(--ice, #00D4FF);
  --g-line: var(--line, rgba(238,241,246,.10));
  --g-muted: var(--steel, #8A93A6);
  --g-num: var(--display, 'Barlow Condensed', sans-serif);
}

.gains-lead {
  margin-top: 14px;
  font-size: clamp(17px, 1.4vw, 19px);
  color: var(--g-muted);
  max-width: 48ch;
}
#gainsCount { color: var(--chalk); font-weight: 600; }

/* ---------- Number plate lookup ---------- */
.g-plate-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  margin-bottom: 14px;
}
.g-plate-form { display: flex; gap: 10px; align-items: stretch; }
.g-plate {
  position: relative; display: flex; width: 300px; height: 62px;
  background: #FFD307;                          /* UK rear plate yellow */
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.85), inset 0 0 0 4px #FFD307, inset 0 0 0 5px rgba(0,0,0,.25), 0 6px 20px rgba(0,0,0,.35);
  overflow: hidden; cursor: text;
  transition: box-shadow .2s ease;
}
.g-plate:focus-within {
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.85), inset 0 0 0 4px #FFD307, inset 0 0 0 5px rgba(0,0,0,.25), 0 0 0 3px var(--ice), 0 6px 20px rgba(0,0,0,.35);
}
.g-plate-band {
  flex: none; width: 40px; margin: 5px 0 5px 5px; border-radius: 3px 0 0 3px;
  background: #0A3C9B; color: #fff;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7px;
}
.g-plate-band b { font: 700 14px/1 var(--body); letter-spacing: .04em; }
.g-plate input {
  flex: 1; min-width: 0; height: 100%; padding: 0 12px 0 6px;
  background: transparent; border: 0; outline: none;
  color: #111; text-align: center; text-transform: uppercase;
  font: normal 800 38px/1 var(--display); letter-spacing: .06em;
}
.g-plate input::placeholder { color: rgba(0,0,0,.32); letter-spacing: .04em; font-size: 30px; }
.g-plate-form .btn { height: 62px; white-space: nowrap; }
.g-plate-form.is-busy .btn i { animation: gSpin .8s linear infinite; }
@keyframes gSpin { to { transform: rotate(360deg); } }
.g-plate-form .btn:disabled { opacity: .75; cursor: progress; transform: none; }
.g-or { color: var(--g-muted); font-size: 15px; }

.g-plate-result {
  --c: 12px;
  position: relative; margin-bottom: 16px; padding: 14px 18px 16px 20px;
  background: var(--graphite);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  animation: gDrop .25s ease-out;
}
@keyframes gDrop { from { opacity: 0; transform: translateY(-6px); } }
.g-plate-result::before { content: ""; position: absolute; left: 0; top: var(--c); bottom: 0; width: 3px; background: var(--blue); }
.g-plate-result.is-hit::before { background: #25D366; }
.g-plate-result.is-miss::before, .g-plate-result.is-err::before { background: var(--redline); }
.g-plate-result p { margin: 0; font-size: 15px; color: rgba(238,241,246,.85); }
.g-plate-result p + p, .g-plate-result p + .btn, .g-plate-result p + .g-pr-choices { margin-top: 8px; }
.g-plate-result .fa-circle-check { color: #25D366; margin-right: 4px; }
.g-pr-car { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.g-pr-car b {
  font: normal 800 18px/1 var(--display); letter-spacing: .05em; color: #111;
  background: #FFD307; padding: 5px 8px 4px; border-radius: 3px;
}
.g-pr-hint { display: block; font-size: 13px; color: var(--g-muted); margin-top: 2px; }
.g-pr-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.g-pr-choice {
  --c: 8px;
  display: grid; grid-template-columns: 1fr auto; column-gap: 10px; text-align: left;
  padding: 10px 12px; background: var(--graphite-2);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  transition: background .2s;
}
.g-pr-choice b { font-size: 15px; font-weight: 600; }
.g-pr-choice span { grid-column: 1; font-size: 13px; color: var(--g-muted); }
.g-pr-choice em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: italic 800 20px var(--g-num); color: var(--g-s2); }
.g-pr-choice:hover { background: rgba(0,102,255,.18); }
.g-pr-choice.is-on { background: var(--blue); }
.g-pr-choice.is-on span, .g-pr-choice.is-on em { color: #fff; }

/* ---------- Pickers ---------- */
.gains-pick {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin: 0 0 20px;
}
.g-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.g-field label { font-size: 14px; font-weight: 500; color: var(--g-muted); }
.g-field select {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 56px; padding: 0 44px 0 16px;
  font: 600 16px/1 var(--body); color: var(--chalk);   /* 16px stops iPhone zooming in */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2300D4FF' stroke-width='2'/%3E%3C/svg%3E") right 18px center / 12px 8px no-repeat,
    var(--graphite);
  border: 1px solid var(--g-line); border-radius: 2px;
  text-overflow: ellipsis; cursor: pointer;
  transition: border-color .2s, background-color .2s, opacity .2s;
}
.g-field select:hover:not(:disabled) { border-color: rgba(0,212,255,.45); }
.g-field select:focus-visible { outline: none; border-color: var(--blue); background-color: var(--graphite-2); }
.g-field select:disabled { opacity: .4; cursor: not-allowed; }
.g-field select option { background: var(--graphite); color: var(--chalk); }

/* ---------- Result panel ---------- */
.gains-panel {
  --c: 22px;
  position: relative;
  background: linear-gradient(160deg, rgba(0,102,255,.10), var(--graphite) 55%);
  border: 1px solid var(--g-line);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
}
.gains-panel::before { /* blue edge, like the service cards */
  content: ""; position: absolute; left: 0; top: var(--c); bottom: 0; width: 3px; background: var(--blue); z-index: 1;
}
.gains-body {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  transition: opacity .4s ease, filter .4s ease;
}
.gains-panel[data-state="empty"] .gains-body { opacity: .28; filter: saturate(.4); pointer-events: none; }
.gains-panel[data-state="empty"] .gains-actions { visibility: hidden; }

.gains-empty {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center;
  gap: 14px; padding: 24px; text-align: center; font-size: 18px; font-weight: 600;
  transition: opacity .35s ease, visibility .35s;
}
.gains-empty i { font-size: 30px; color: var(--g-s2); }
.gains-empty p { max-width: 30ch; }
.gains-panel[data-state="ready"] .gains-empty { opacity: 0; visibility: hidden; }

.gains-info {
  padding: 28px; display: flex; flex-direction: column; gap: 22px;
  border-right: 1px solid var(--g-line);
}
.gains-car { font-size: clamp(34px, 3.6vw, 48px); margin: 0; }
.gains-sub { margin-top: 10px; color: var(--g-muted); font-size: 15px; }

.g-metric-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.g-metric-top h4 { margin: 0; font-size: 15px; font-weight: 600; }
.g-metric-top span { font-size: 13px; color: var(--g-muted); }

.g-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.g-col {
  --c: 10px;
  position: relative; padding: 12px 12px 16px;
  background: rgba(238,241,246,.03);
  display: flex; flex-direction: column; min-width: 0;
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  transition: background-color .3s ease;
}
.g-lbl { font-size: 12px; font-weight: 600; color: var(--g-muted); }
.g-num {
  font: italic 800 clamp(30px, 3.6vw, 44px)/1.05 var(--g-num);
  font-variant-numeric: tabular-nums; margin-top: 2px; color: var(--chalk);
}
.g-col[data-stage="0"] .g-num { color: #C9CFDB; }
.g-col[data-stage="1"] .g-num { color: var(--g-s1-text); }
.g-col[data-stage="1"] { background: rgba(0,102,255,.12); }

.g-col-gain { background: rgba(0,212,255,.10); justify-content: flex-start; }
.g-col-gain .g-lbl { color: var(--g-s2); }
.g-col-gain .g-num { color: var(--g-s2); text-shadow: 0 0 18px rgba(0,212,255,.35); }
.g-pct { font-style: normal; font-weight: 700; font-size: 14px; color: var(--g-s2); min-height: 20px; }
.g-metric.is-none .g-num, .g-metric.is-none .g-pct { color: var(--g-muted); text-shadow: none; }
.g-toggle button:disabled { opacity: .35; cursor: not-allowed; }
.g-gain {
  font-style: normal; font-weight: 700; font-size: 14px; min-height: 20px;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.g-gain small { font-size: 12px; font-weight: 600; opacity: .7; }
.g-col[data-stage="1"] .g-gain { color: var(--g-s1-text); }
.g-col.is-none .g-num, .g-col.is-none .g-gain { color: var(--g-muted); }
.g-col.is-none .g-gain { font-weight: 600; font-size: 13px; }

.g-bar {
  position: absolute; left: 12px; right: 12px; bottom: 8px; height: 3px;
  background: rgba(238,241,246,.06); overflow: hidden;
}
.g-bar i {
  display: block; height: 100%; transform: scaleX(0); transform-origin: left;
  transition: transform .8s var(--ease, cubic-bezier(.2,.7,.1,1));
  background: var(--g-s0);
}
.g-col[data-stage="1"] .g-bar i { background: var(--g-s1); }

.gains-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.gains-actions .btn { font-size: 16px; padding: .85em 1.2em; }
.g-share.is-done { background: rgba(0,212,255,.16); color: var(--g-s2); }

/* ---------- Chart ---------- */
.gains-chart { margin: 0; padding: 24px 24px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.g-chart-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.g-toggle {
  --c: 8px;
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr;
  padding: 4px; background: var(--carbon); clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
}
.g-toggle::before { /* sliding highlight */
  --c: 6px;
  content: ''; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: var(--blue); clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  transition: transform .35s var(--ease, cubic-bezier(.2,.7,.1,1));
}
.g-toggle[data-on="torque"]::before { transform: translateX(100%); }
.g-toggle button {
  position: relative; z-index: 1; min-width: 88px; padding: 9px 14px;
  font: italic 700 16px/1 var(--display); text-transform: uppercase; letter-spacing: .02em;
  color: var(--g-muted); transition: color .25s ease;
}
.g-toggle button[aria-pressed="true"] { color: #fff; }

.g-legend { display: flex; gap: 14px; font-size: 13px; color: var(--g-muted); }
.g-legend span { display: inline-flex; align-items: center; gap: 6px; }
.g-legend i { width: 18px; height: 3px; background: var(--g-s1); }
.g-legend .s0 i { background: repeating-linear-gradient(90deg, var(--g-s0) 0 4px, transparent 4px 7px); }

#gainsSvg { width: 100%; height: auto; display: block; overflow: visible; }
#gainsSvg .g-grid line { stroke: rgba(238,241,246,.07); stroke-width: 1; }
#gainsSvg .g-grid text, #gainsSvg .g-axis { fill: var(--g-muted); font: 500 14px var(--body); }
#gainsSvg .g-base { stroke: rgba(238,241,246,.2); }
#gainsSvg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#gainsSvg .g-area1 { fill: url(#gFill1); }
#gainsSvg .g-line0 { stroke: var(--g-s0); stroke-width: 2.5; stroke-dasharray: 7 6; }
#gainsSvg .g-line1 { stroke: var(--g-s1); stroke-width: 4; filter: drop-shadow(0 0 8px rgba(0,102,255,.7)); }
#gainsSvg .g-peak line { stroke: rgba(0,212,255,.5); stroke-dasharray: 3 4; }
#gainsSvg .g-peak circle { fill: var(--carbon); stroke: var(--g-s1); stroke-width: 3; }
#gainsSvg .g-peak rect { fill: var(--g-s1); }
#gainsSvg .g-peak text { fill: #fff; font: italic 800 20px var(--g-num); }
.gains-panel[data-state="empty"] .g-peak { opacity: 0; }

.gains-chart figcaption { font-size: 13px; color: var(--g-muted); }
.gains-note { margin-top: 16px; font-size: 14px; color: var(--g-muted); max-width: 70ch; }

/* ---------- Tablet / phone ---------- */
@media (max-width: 960px) {
  .gains-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gains-body { grid-template-columns: 1fr; }
  .gains-info { border-right: 0; border-bottom: 1px solid var(--g-line); }
}
@media (max-width: 560px) {
  .gains-pick { grid-template-columns: 1fr; gap: 10px; }
  .g-plate-row { gap: 10px; }
  .g-plate-form { flex-direction: column; width: 100%; }
  .g-plate { width: 100%; height: 64px; }
  .g-plate-form .btn { height: 52px; width: 100%; }
  .g-or { width: 100%; text-align: center; font-size: 14px; }
  .g-plate-result { padding: 12px 14px 14px 16px; }
  .g-pr-choices { grid-template-columns: 1fr; }
  .g-field select { height: 52px; padding-left: 14px; }
  .gains-panel { --c: 16px; }
  .gains-info { padding: 20px 16px; gap: 18px; }
  .gains-chart { padding: 18px 12px 14px; }
  .g-cols { gap: 6px; }
  .g-col { padding: 10px 9px 14px; }
  .g-bar { left: 9px; right: 9px; }
  .g-num { font-size: clamp(26px, 8.4vw, 34px); }
  .g-gain, .g-pct { font-size: 13px; gap: 4px; }
  .g-gain small { font-size: 11px; }
  .gains-actions .btn { flex: 1 1 100%; }
  .gains-actions .btn.btn-wa { flex: 1 1 0; }
  .gains-actions .btn.g-share { flex: 0 0 auto; }
  .g-long { display: none; }
  .g-legend { gap: 10px; font-size: 12px; }
  .g-toggle button { min-width: 74px; }
  .gains-empty { align-content: start; padding-top: 70px; }
}

/* ---------- Desktop: tighter section ---------- */
@media (min-width: 961px) {
  .gains.block { padding-block: clamp(64px, 6.5vw, 104px); }
  .gains .section-head { margin-bottom: 24px; }
  .gains .h2 { font-size: clamp(56px, 5.4vw, 88px); }
  .gains-pick { margin-bottom: 14px; gap: 10px; }
  .g-field select { height: 50px; }
  .gains-info { padding: 22px 26px; gap: 16px; }
  .gains-car { font-size: clamp(32px, 2.8vw, 42px); }
  .gains-sub { margin-top: 6px; font-size: 14px; }
  .g-metric-top { margin-bottom: 8px; }
  .g-col { padding: 10px 12px 14px; }
  .g-num { font-size: clamp(30px, 2.8vw, 40px); }
  .gains-chart { padding: 18px 22px 12px; gap: 8px; }
  .gains-note { margin-top: 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .g-bar i, .g-toggle::before, .gains-body { transition: none; }
}

/* =========================================================
   Site-wide polish (kept here so style.css stays untouched)
   ========================================================= */

/* Blue scrollbar: Chrome, Edge, Safari */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--carbon); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--blue), #00a8ff);
  border-radius: 10px;
  border: 2px solid var(--carbon);
}
::-webkit-scrollbar-thumb:hover { background: var(--ice); }
::-webkit-scrollbar-corner { background: var(--carbon); }
/* Firefox */
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--blue) var(--carbon); }
}
::selection { background: var(--blue); color: #fff; }

/* Menu link for the section you're in */
.nav-links a.is-active { color: var(--chalk); }
.nav-links a.is-active::after { transform: scaleX(1); }
.menu a.is-active { color: var(--ice); }

/* If the browser jumps to a section by itself (e.g. back button), stop it hiding under the header */
main [id] { scroll-margin-top: 84px; }
@media (max-width: 767px) { main [id] { scroll-margin-top: 72px; } }
