/* ---------------------------------------------------------------------------
   Load gauge.

   Every animated property here is transform or opacity, so the whole thing
   composites on the GPU and never triggers layout. That is what keeps it
   steady on a phone while the basket is being edited.

   Sizes are in cqi/clamp rather than breakpoints: the gauge sits in a narrow
   sidebar on desktop and full width on a phone, and should look deliberate in
   both without a media query for each host.
--------------------------------------------------------------------------- */

.tk {
  --tk-ink: #241d14;
  --tk-bay: #efe9de;
  --tk-edge: #cfc4b1;
  --tk-timber: #c68a45;
  --tk-timber-alt: #b8792f;
  --tk-ready: #2f7d4f;
  display: grid;
  gap: 10px;
  padding: 16px 16px 14px;
  background: #fffdf9;
  border: 1px solid #e8e0d2;
  border-radius: 14px;
}

.tk-stage {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.tk-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* --- trailer ------------------------------------------------------------ */

.tk-bay { fill: var(--tk-bay); }
.tk-bay-edge { fill: none; stroke: var(--tk-edge); stroke-width: 2; }
.tk-ribs line { stroke: #ffffff; stroke-width: 1.4; opacity: .55; }

/* --- the load ----------------------------------------------------------- */

.tk-load {
  transform: translateY(94px);            /* starts empty, at the floor */
  transition: transform 620ms cubic-bezier(.22, .8, .28, 1);
  will-change: transform;
}

.tk-plank { fill: var(--tk-timber); }
.tk-plank:nth-child(2n) { fill: var(--tk-timber-alt); }
/* End grain: a hairline at the left edge stops the stack reading as a bar. */
.tk-plank { stroke: rgba(90, 52, 16, .25); stroke-width: .6; }

/* --- cab and running gear ----------------------------------------------- */

.tk-glass { fill: #f4ede2; opacity: .92; }
.tk-lamp { fill: #ffd98a; }
.tk-chassis { fill: #3a3129; }
.tk-wheels circle { fill: #2b2621; }
.tk-hubs circle { fill: #8d8377; }

/* --- linear meter under the truck --------------------------------------- */

.tk-meter {
  height: 8px;
  border-radius: 99px;
  background: #efe9de;
  overflow: hidden;
}

.tk-meter-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--tk-timber-alt), var(--tk-timber));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 620ms cubic-bezier(.22, .8, .28, 1), background 300ms linear;
  will-change: transform;
}

/* --- readout ------------------------------------------------------------ */

.tk-read {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;      /* digits stop jittering as it fills */
}

.tk-figure { font-size: clamp(1.15rem, 5cqi, 1.45rem); font-weight: 700; color: var(--tk-ink); }
.tk-of { font-size: .875rem; color: #7d7264; }

.tk-hint {
  margin: 0;
  font-size: .8125rem;
  line-height: 1.45;
  color: #6d6255;
}

/* --- full ---------------------------------------------------------------- */

.tk.is-full { border-color: #bfe0cb; background: #f6fbf7; }
.tk.is-full .tk-meter-fill { background: linear-gradient(90deg, #3f9463, var(--tk-ready)); }
.tk.is-full .tk-hint { color: var(--tk-ready); font-weight: 600; }
.tk.is-full .tk-lamp { fill: #fff3cf; }

/* The suspension dip when the last pack lands, then a settle back. */
@keyframes tk-settle {
  0%   { transform: translateY(0) }
  28%  { transform: translateY(3px) }
  55%  { transform: translateY(-1.5px) }
  100% { transform: translateY(0) }
}
.tk-settle { animation: tk-settle 620ms cubic-bezier(.3, .7, .3, 1); }

/* --- reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .tk-load,
  .tk-meter-fill { transition-duration: 1ms; }
  .tk-settle { animation: none; }
}

/* --- gate ---------------------------------------------------------------- */

/* The action stays visible while it is unavailable. Hiding it would leave the
   customer with no explanation of what the basket is for. */
.tk-gate[aria-disabled="true"] {
  opacity: .5;
  pointer-events: none;
  cursor: not-allowed;
}

.tk-gate-note {
  margin: 8px 0 0;
  font-size: .8125rem;
  color: #8a4a10;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.tk-gate-note svg { flex: none; width: 15px; height: 15px; margin-top: 1px; }

/* --- "why a full truck?" -------------------------------------------------- */

.tk-why { margin: 10px 0 2px; font-size: .8125rem; }
.tk-why summary { cursor: pointer; color: #8a4a10; font-weight: 600; }
.tk-why p { margin: 6px 0 0; color: #6d6255; line-height: 1.5; }

/* --- compact readout in the sticky mobile bar ---------------------------- */

.cfg-bar-load {
  font-size: .8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #8a4a10;
  white-space: nowrap;
}
.cfg-bar-load.is-full { color: var(--tk-ready, #2f7d4f); }

/* ---------------------------------------------------------------------------
   Compact gauge, for the sticky bar.

   On a phone the request panel sits below the entire catalogue, so a customer
   browsing products would never see how full the truck is — which is the one
   number that decides whether they can order. This copy rides along at the
   bottom of the viewport instead.
--------------------------------------------------------------------------- */

.tk--compact {
  display: grid;
  grid-template-columns: 62px 1fr;
  grid-template-areas: "stage body" "hint hint";
  align-items: center;
  gap: 4px 10px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  min-width: 0;
}

.tk--compact .tk-stage { grid-area: stage; max-width: 62px; margin: 0; }
.tk--compact .tk-mini-body { grid-area: body; min-width: 0; display: grid; gap: 5px; }
.tk--compact .tk-hint { grid-area: hint; }

.tk-mini-svg { display: block; width: 100%; height: auto; }

.tk--compact .tk-figure { font-size: 1rem; color: #f6f1e8; }
.tk--compact .tk-of { font-size: .75rem; color: #b3a795; }
.tk--compact .tk-meter { height: 6px; background: rgba(255, 255, 255, .16); }
.tk--compact .tk-hint {
  font-size: .75rem;
  color: #c7bba7;
  /* One line only: the bar must not grow and shove the page around. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The bar is dark, so the "full" colours have to be the light-on-dark pair. */
.tk--compact.is-full .tk-hint { color: #86d6a4; }
.tk--compact.is-full .tk-figure { color: #ffffff; }
.tk--compact .tk-bay { fill: #4a4036; }
.tk--compact .tk-bay-edge { stroke: #6b5f51; }
.tk--compact .tk-chassis { fill: #1a1610; }
.tk--compact .tk-wheels circle { fill: #14100c; }

/* --- the bar itself ------------------------------------------------------ */

.cfg-bar-truck { flex: 1 1 auto; min-width: 0; }
.cfg-bar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

@media (max-width: 640px) {
  .cfg-bar { flex-wrap: wrap; row-gap: 10px; }
  .cfg-bar-truck { flex: 1 0 100%; }
  .cfg-bar-actions {
    flex: 1 0 100%;
    justify-content: space-between;
    /* Clear the floating WhatsApp button, which otherwise sits on top of the
       call to action and clips it mid-word. */
    padding-right: 62px;
  }
  .cfg-bar-actions .btn { text-align: center; margin-left: auto; }
}

/* Lift the floating contact button above the bar while the bar is showing. */
.cfg-bar:not([hidden]) ~ .wa-float,
.cfg-bar:not([hidden]) ~ * .wa-float { bottom: 104px; }
