/* v3 section: calculator. Figma desktop 10476:78849 (+ courier tab 12137:15776), mobile 11305:10871 (+ courier 12192:30109). */

.v3-calc {
  --calc-color: var(--v3-primary);
  --calc-noise: url("../../../images/v3/hero/noise.webp");
  background: var(--v3-bg-gray);
  isolation: isolate;
}
.v3-calc [hidden] { display: none !important; }
.v3-calc::before {                      /* paper noise, 4%; vertical guide lines on wide screens */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--calc-noise) 0 0 / 256px;
  opacity: 0.04;
  pointer-events: none;
}
.v3-calc::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("../../../images/v3/calculator/decorative-lines.svg") center top / 1340.8px auto no-repeat;
  pointer-events: none;
}
.v3-calc__vlines { display: none; }

/* ---- header ---- */
.v3-calc__header {
  display: grid;
  grid-template-columns: 320px minmax(0, 652px);
  column-gap: 12px;
  row-gap: 42px;
  align-items: start;
}
.v3-calc__label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: var(--v3-fs-caption);
  font-weight: 700;
  line-height: var(--v3-lh-tight);
}
.v3-calc__label::before { content: ""; flex: none; width: 8px; height: 8px; background: var(--v3-primary); }
.v3-calc__title { color: var(--v3-dark); }
.v3-calc__muted { color: var(--v3-gray-200); }
.v3-calc__intro {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  max-width: 282px;
  color: var(--v3-gray-200);
  font-weight: 500;
  line-height: var(--v3-lh-body-m);
}
.v3-calc__tabs {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  display: flex;
  padding: 3px;
  border: 1px solid var(--v3-white);
  border-radius: var(--v3-radius-md);
  background: var(--v3-white);
}
.v3-calc__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 7px;
  color: var(--v3-gray-200);
  font-size: 16px;
  font-weight: 600;
  line-height: var(--v3-lh-body-m);
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.v3-calc__tab:hover { color: var(--v3-dark); }
.v3-calc__tab[aria-selected="true"] {
  border-radius: var(--v3-radius-sm);
  background: var(--v3-dark);
  color: var(--v3-white);
}
.v3-calc__tab-icon { flex: none; width: 18px; height: 18px; object-fit: none; }
.v3-calc__tab[aria-selected="true"] .v3-calc__tab-icon--off,
.v3-calc__tab:not([aria-selected="true"]) .v3-calc__tab-icon--on { display: none; }

/* ---- layout ---- */
.v3-calc__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  margin-top: 56px;
}
/* single work type: no tabs row, Figma 12137:15776 keeps 80px between the title and the panels */
@media (min-width: 1025px) {
  .v3-calc--single .v3-calc__grid { margin-top: 80px; }
}

/* ---- left panel: inputs ---- */
.v3-calc__left {
  position: relative;
  padding: 40px;
  border-radius: var(--v3-radius-md);
  background: var(--v3-white-80);
  isolation: isolate;
}
.v3-calc__left::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--calc-noise) 0 0 / 256px;
  opacity: 0.03;
  pointer-events: none;
}
.v3-calc__scrollbar {                   /* decorative scroll position indicator (Figma "slider") */
  position: absolute;
  top: 40px;
  bottom: 40px;
  right: 8px;
  width: 4px;
  border-radius: 100px;
  background: var(--v3-bg-gray);
}
.v3-calc__scrollbar span {
  position: absolute;
  left: 0;
  top: calc((100% - 133px) * var(--calc-p, 0));
  width: 4px;
  height: 133px;
  border-radius: 100px;
  background: var(--v3-gray-50);
}
.v3-calc__panel { display: flex; flex-direction: column; gap: 56px; }
.v3-calc__group { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.v3-calc__q { font-size: 16px; font-weight: 700; line-height: var(--v3-lh-body-m); color: var(--v3-dark); }

/* segmented control: own / rent */
.v3-calc__seg {
  display: flex;
  align-self: flex-start;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--v3-gray-50);
  border-radius: var(--v3-radius-md);
}
.v3-calc__seg-opt { display: block; position: relative; min-width: 0; }
.v3-calc__seg-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--v3-gray-200);
  font-weight: 600;
  line-height: var(--v3-lh-body-m);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.v3-calc__seg-opt:hover span { color: var(--v3-dark); }
.v3-calc__seg-opt input:checked + span {
  border-color: var(--v3-primary);
  border-radius: var(--v3-radius-sm);
  background: var(--v3-primary-10);
  color: var(--v3-dark);
}
.v3-calc__seg-opt input:focus-visible + span,
.v3-calc__car input:focus-visible + .v3-calc__car-box { outline: 2px solid var(--v3-primary); outline-offset: 2px; }

/* vehicle cards */
.v3-calc__cars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.v3-calc__car { display: flex; position: relative; min-width: 0; }
.v3-calc__car-box {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--v3-radius-md);
  background: var(--v3-white);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.v3-calc__car:hover .v3-calc__car-box { border-color: var(--v3-primary-light); }
.v3-calc__car input:checked + .v3-calc__car-box { border-color: var(--v3-primary); }
.v3-calc__car-img {
  position: relative;
  flex: none;                           /* the aspect ratio alone sets the height, so every card is equally tall */
  min-height: 0;
  overflow: hidden;
  aspect-ratio: 28 / 12;
  margin: -1px -1px 0;                  /* the selected border sits on the image too, as in Figma */
  background: var(--v3-white);
  transition: background-color 0.2s ease;
}
.v3-calc__car input:checked + .v3-calc__car-box .v3-calc__car-img { background: var(--v3-bg-light); }
.v3-calc__car-img img { position: absolute; inset: 5% 10%; width: 80%; height: 90%; max-width: none; object-fit: contain; mix-blend-mode: multiply; }
.v3-calc__car-info { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 12px; }
.v3-calc__car-name { font-size: 16px; font-weight: 700; line-height: var(--v3-lh-body-m); }
.v3-calc__car-price { display: flex; align-items: flex-end; gap: 4px; }
.v3-calc__car-price b { font-size: 16px; font-weight: 700; line-height: var(--v3-lh-body-m); }
.v3-calc__car-price small { font-size: 12px; line-height: var(--v3-lh-tight); color: var(--v3-gray-300); }

/* hours */
.v3-calc__hours { gap: 24px; }
.v3-calc__hours > .v3-calc__q { margin-bottom: -4px; }
.v3-calc__tip,
.v3-calc__warn {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--v3-primary-10);
  border-radius: var(--v3-radius-md);
  background: var(--v3-primary-10);
  font-size: 12px;
  line-height: var(--v3-lh-tight);
}
.v3-calc__tip { align-items: center; }
.v3-calc__tip b { font-weight: 700; }
.v3-calc__warn { align-items: flex-start; border-color: var(--v3-warning-20); background: var(--v3-warning-50); }
.v3-calc__tip img,
.v3-calc__warn img { flex: none; width: 18px; height: 18px; }
.v3-calc__warn img { margin-top: 1px; }

.v3-calc__slider {
  --calc-color: var(--v3-primary);
  --fill: 0%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 3px;
}
.v3-calc__slider.is-low { --calc-color: var(--v3-warning); }
.v3-calc__hours-value {
  grid-column: 1 / -1;
  justify-self: end;
  color: var(--v3-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: var(--v3-lh-tight);
}
.v3-calc__range { grid-column: 1 / -1; width: 100%; height: 16px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.v3-calc__range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 100px;
  background: linear-gradient(to right, var(--calc-color) var(--fill), var(--v3-track) var(--fill));
}
.v3-calc__range::-moz-range-track { height: 8px; border-radius: 100px; background: var(--v3-track); }
.v3-calc__range::-moz-range-progress { height: 8px; border-radius: 100px 0 0 100px; background: var(--calc-color); }
.v3-calc__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  margin-top: -4px;
  border: 2px solid var(--calc-color);
  border-radius: 50%;
  background: var(--v3-track);
}
.v3-calc__range::-moz-range-thumb {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 2px solid var(--calc-color);
  border-radius: 50%;
  background: var(--v3-track);
}
.v3-calc__range:focus-visible { outline: 2px solid var(--v3-primary); outline-offset: 6px; border-radius: 100px; }
.v3-calc__range-min,
.v3-calc__range-max { color: var(--v3-gray-100); font-size: 12px; line-height: var(--v3-lh-tight); }
.v3-calc__range-max { justify-self: end; }

/* city */
.v3-calc__select {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 16px;
  border: 1px solid var(--v3-gray-50);
  border-radius: var(--v3-radius-sm);
  background: var(--v3-bg-light) url("../../../images/v3/calculator/chevron-down.svg") right 16px center / 20px 20px no-repeat;
  color: var(--v3-gray-200);
  font-weight: 500;
  line-height: var(--v3-lh-body-m);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease;
}
.v3-calc__select:hover { border-color: var(--v3-gray-100); }
.v3-calc__select:focus-visible { outline: 2px solid var(--v3-primary); outline-offset: 2px; }
.v3-calc__select:has(option:checked:not([value=""])) { color: var(--v3-dark); }

/* ---- right panel: result + contact ---- */
.v3-calc__right {
  position: sticky;
  top: calc(var(--v3-header-h, 62px) + 24px);
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 40px;
  border-radius: var(--v3-radius-lg);
  background: var(--v3-dark);
  color: var(--v3-white);
  isolation: isolate;
}
.v3-calc__right::before,
.v3-calc__income::before,
.v3-calc__side::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--calc-noise) 0 0 / 256px;
  opacity: 0.04;
  pointer-events: none;
}
.v3-calc__income::before,
.v3-calc__side::before { display: none; }
.v3-calc__income { display: flex; flex-direction: column; gap: 4px; }
.v3-calc__amount {
  font-size: var(--v3-fs-price-lg);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: var(--v3-ls-display);
  overflow-wrap: anywhere;
}
.v3-calc__caption { font-size: 12px; line-height: var(--v3-lh-tight); }
.v3-calc__side { display: flex; flex-direction: column; gap: 40px; }

.v3-calc__summary {
  --sum-gap: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sum-gap);
  min-height: 62px;
  margin: 0;
  padding: 20px;
  list-style: none;
  border: 1px solid var(--v3-gray-300);
  border-radius: var(--v3-radius-md);
  background: var(--v3-gray-500);
}
.v3-calc__sum-item { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; line-height: var(--v3-lh-body-m); }
.v3-calc__sum-item img { flex: none; width: 18px; height: 18px; object-fit: none; }
.v3-calc__sum-item:not([hidden]) ~ .v3-calc__sum-item:not([hidden])::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(var(--sum-gap) / -2 - 0.5px);
  width: 1px;
  height: 22px;
  transform: translateY(-50%);
  background: var(--v3-gray-300);
}

.v3-calc__contact { display: flex; flex-direction: column; gap: 40px; }
.v3-calc__contact-text { color: var(--v3-gray-50); font-size: var(--v3-fs-h3-md); font-weight: 500; line-height: var(--v3-lh-tight); }
.v3-calc__contact-title { display: block; margin-bottom: 7px; color: var(--v3-primary); }
.v3-calc__cta { display: none; width: 100%; }
.v3-calc__form { min-width: 0; }


/* ---- 1281+: decorative lines are the svg; below that they are two guides 16px from the edges ---- */
@media (max-width: 1280px) {
  .v3-calc::after { display: none; }
  .v3-calc__vlines { display: block; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
  .v3-calc__vlines span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: repeating-linear-gradient(to bottom, var(--v3-gray-50) 0 3px, transparent 3px 5px);
  }
  .v3-calc__vlines span:first-child { left: 16px; }
  .v3-calc__vlines span:last-child { right: 16px; }
  .v3-calc__header { grid-template-columns: 240px minmax(0, 1fr); }
  .v3-calc__car-img { aspect-ratio: 189 / 100; }
  .v3-calc__car-info { gap: 0; min-height: 96px; justify-content: space-between; }
  .v3-calc__car-price small { font-size: 14px; line-height: var(--v3-lh-body-s); }
}

/* stacked summary: narrow right panel (1025-1280) and phones */
@media (min-width: 1025px) and (max-width: 1280px) {
  .v3-calc__right { padding: 32px; }
}
@media (max-width: 768px), (min-width: 1025px) and (max-width: 1280px) {
  .v3-calc__summary { --sum-gap: 16px; flex-direction: column; align-items: stretch; justify-content: center; }
  .v3-calc__sum-item:not([hidden]) ~ .v3-calc__sum-item:not([hidden])::before {
    top: calc(var(--sum-gap) / -2 - 0.5px);
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
    transform: none;
  }
}

/* ---- tablet: one column ---- */
@media (max-width: 1024px) {
  .v3-calc__header { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
  .v3-calc__intro,
  .v3-calc__tabs { grid-column: 1; grid-row: auto; }
  .v3-calc__intro { max-width: none; }
  .v3-calc__grid { grid-template-columns: minmax(0, 1fr); margin-top: 40px; }
  .v3-calc__right { position: static; }
  .v3-calc__scrollbar { display: none; }
}

/* ---- phone: flat fields on the grey background, two dark cards ---- */
@media (max-width: 768px) {
  .v3-calc__header { row-gap: 12px; }
  .v3-calc__label { min-height: 20px; }
  .v3-calc__intro { max-width: 321px; margin-top: 8px; margin-bottom: -4px; }
  .v3-calc__tabs { width: 100%; max-width: 303px; }
  .v3-calc__tab { flex: 1; padding-inline: 8px; }
  .v3-calc__grid { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 36px; }   /* flex, not grid: a sticky grid item is confined to its own cell */

  .v3-calc__left { margin-bottom: 30px; padding: 0; border-radius: 0; background: none; }
  .v3-calc__left::before { display: none; }
  .v3-calc__panel { gap: 32px; }
  .v3-calc__group { gap: 24px; }
  .v3-calc__seg { align-self: stretch; }
  .v3-calc__seg-opt { flex: 1; }
  .v3-calc__car-box { border-radius: var(--v3-radius-md); }
  .v3-calc__car-img img { inset: 9.5% 0; width: 100%; height: 81%; }
  .v3-calc__hours { gap: 16px; }
  .v3-calc__hours > .v3-calc__q { margin-bottom: 8px; }
  .v3-calc__slider { order: 1; }
  .v3-calc__tip { order: 2; align-items: flex-start; padding: 12px; font-size: 14px; }
  .v3-calc__tip b { font-weight: 600; }
  .v3-calc__warn { order: 3; padding: 12px; font-size: 14px; }
  .v3-calc__hours-value { font-size: 16px; }
  .v3-calc__range-min,
  .v3-calc__range-max { font-size: 16px; font-weight: 500; line-height: var(--v3-lh-body-m); }
  .v3-calc__range-min,
  .v3-calc__range-max { margin-top: 8px; }

  .v3-calc__right { display: contents; }   /* income + side become grid items, so the income card can stay stuck while the inputs scroll */
  .v3-calc__right::before { display: none; }
  .v3-calc__income,
  .v3-calc__side { position: relative; isolation: isolate; border-radius: var(--v3-radius-md); background: var(--v3-dark); }
  .v3-calc__income::before,
  .v3-calc__side::before { display: block; }
  /* Figma note: fixed summary panel at the bottom whose value follows the inputs. Sticky keeps it at the bottom of the
     viewport only while the section is on screen, above --v3-bottom-offset, and it never covers the footer. */
  .v3-calc__income { position: sticky; bottom: calc(var(--v3-bottom-offset, 0px) + 12px); z-index: 5; gap: 0; padding: 16px 20px; }
  .v3-calc__amount { font-size: var(--v3-fs-price-sm); font-weight: 600; line-height: var(--v3-lh-tight); letter-spacing: 0; }
  .v3-calc__caption { font-size: 14px; }
  .v3-calc__side { gap: 32px; padding: 20px; }
  .v3-calc__contact { gap: 32px; }
  .v3-calc__form { display: none; }
  .v3-calc__cta { display: inline-flex; }
}

@media (prefers-reduced-motion: reduce) {
  .v3-calc__tab,
  .v3-calc__seg-opt span,
  .v3-calc__car-box,
  .v3-calc__car-img,
  .v3-calc__select { transition: none; }
}
