/* IRPARK calculator: styles of /kalkulator-roi/ only, loaded after main.css and built on its tokens.
   After a change, bump the ?v= value on the <link> in site/kalkulator-roi/index.html (the file is cached for a year).

   The page head, the numbered steps and the controls (slider, number field, segments, outlined button) look like
   the configurator's. Their rules repeat konfigurator.css under the same class names, because only the
   configurator page may load that sheet (check_site.py): a change of the look there is repeated here. */

/* A short page head: the calculator itself should start on the first screen. */
.page-head--tight > .wrap { gap: 18px; padding-block: clamp(14px, 2vw, 22px) clamp(20px, 2.4vw, 28px); }
.page-head--tight .page-title { font-size: clamp(1.625rem, 2.5vw, 2.125rem); }
.page-head--tight .page-title span { margin-top: 8px; font-size: 1.0625rem; }
.page-head--tight .lead { font-size: 1rem; }

/* ---------- Layout: the values on the left, the result beside them; on a narrow screen one under the other ---------- */
.calc > .wrap { padding-bottom: var(--section); }
/* Elements shown and hidden by the script carry the hidden attribute; classes that set display must not undo it. */
.calc [hidden] { display: none; }
.calc__grid { display: grid; gap: 34px; }
.calc__form { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
.calc__result { display: flex; flex-direction: column; gap: 18px; min-width: 0; padding: clamp(18px, 2.6vw, 30px); border: 1px solid var(--line); border-radius: 24px; background: var(--card); }
@media (min-width: 1000px) {
  .calc__grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 0 clamp(28px, 3.2vw, 52px); align-items: start; }
  /* The result stays in sight while the values are changed. */
  .calc__result { position: sticky; top: 16px; }
}

/* ---------- Steps ---------- */
.step { display: block; min-width: 0; margin: 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--ink); }
/* A legend normally sits in its fieldset's border; floated, it lays out like any block. */
.step__legend { float: left; width: 100%; padding: 0; }
.step__legend + * { clear: both; }
.step__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.step__no { font-family: var(--mono); font-size: .75rem; font-weight: 400; letter-spacing: 0; color: var(--bronze); }
.step__note { max-width: 44em; font-size: .875rem; line-height: 1.55; color: var(--ink-2); }
/* The result panel is a card of its own: its heading needs no rule above it. */
.calc__result .step__title { margin-bottom: 0; }

/* ---------- Values ---------- */
.params { display: flex; flex-direction: column; gap: 22px; }
.param { min-width: 0; margin: 0; padding: 0; border: 0; }
.param__label { display: block; padding: 0; margin-bottom: 4px; font-weight: 700; font-size: .9375rem; }
legend.param__label { float: left; width: 100%; margin-bottom: 8px; }
legend.param__label + * { clear: both; }
.param__row { display: flex; align-items: center; gap: 14px; }
.param__note { max-width: 44em; margin-top: 2px; font-size: .8125rem; line-height: 1.5; color: var(--ink-2); }
.param__note a { text-decoration: underline; text-underline-offset: 3px; }
.segments + .param__note, .param__pair + .param__note, .select + .param__note { margin-top: 8px; }
/* A figure the page counts from the value above it (the employer's cost of the take-home pay), set by the script. */
.param__derived { margin-top: 4px; font-family: var(--mono); font-size: .75rem; line-height: 1.5; color: var(--ink); }
/* Two short amounts side by side (trucks: how many, what one costs a month). */
.param__pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px 18px; max-width: 30em; }
.param__pair .param__label { font-weight: 600; font-size: .8125rem; color: var(--ink-2); }

.param__number { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-family: var(--mono); font-size: .8125rem; }
.param__number:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.param__field { width: 4.6em; padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: right; }
.param__field::placeholder { color: var(--ink-3); }
.param__field:focus-visible { outline: none; } /* the frame around the field and its unit shows the focus */
.param__unit { color: var(--ink-3); }
/* An amount with no slider: the field is the whole control. */
.param__number--wide { display: flex; height: 44px; padding: 0 14px; font-size: .875rem; }
.param__number--wide .param__field { flex: 1; min-width: 0; width: auto; }

/* The list of robots. Its arrow is drawn with borders, not with an image in a data: address, which the
   site's content security policy may not allow. */
.select { position: relative; display: block; max-width: 30em; }
.select::after { content: ""; position: absolute; right: 17px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select select { display: block; width: 100%; height: 44px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: 600 .9375rem var(--body); -webkit-appearance: none; appearance: none; cursor: pointer; }
.select select:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.slider { --fill: 50%; flex: 1; min-width: 0; height: 44px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--ink) var(--fill), rgba(21, 19, 15, .16) var(--fill)); }
.slider::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(21, 19, 15, .16); }
.slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border: 2px solid var(--ink); border-radius: 50%; background: var(--card); }
.slider::-moz-range-thumb { box-sizing: border-box; width: 22px; height: 22px; border: 2px solid var(--ink); border-radius: 50%; background: var(--card); }
@media (hover: hover) {
  .slider:hover::-webkit-slider-thumb { background: var(--yellow); }
  .slider:hover::-moz-range-thumb { background: var(--yellow); }
}
.slider:active::-webkit-slider-thumb { background: var(--yellow); }
.slider:active::-moz-range-thumb { background: var(--yellow); }
.slider:focus-visible { outline: none; } /* the thumb shows the focus, not the whole row */
.slider:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--ink); outline-offset: 3px; background: var(--yellow); }
.slider:focus-visible::-moz-range-thumb { outline: 2px solid var(--ink); outline-offset: 3px; background: var(--yellow); }

.segments { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 24px; background: var(--paper-2); }
.segments__item span { display: flex; align-items: center; justify-content: center; min-width: 52px; min-height: 40px; padding: 0 20px; border-radius: 999px; font-weight: 600; font-size: .875rem; cursor: pointer; }
@media (hover: hover) { .segments__item:hover span { background: rgba(21, 19, 15, .07); } }
.segments__item input:checked + span { background: var(--ink); color: var(--snow); }
.segments__item input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* An on/off switch (the robotisation relief): a checkbox drawn as a track with a knob, the label beside it. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; min-height: 40px; font-weight: 700; font-size: .9375rem; cursor: pointer; }
.switch__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.switch__track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: rgba(21, 19, 15, .16); transition: background-color .2s ease; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(21, 19, 15, .25); transition: transform .2s ease; }
.switch__input:checked + .switch__track { background: var(--ink); }
.switch__input:checked + .switch__track::after { transform: translateX(20px); background: var(--yellow); }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) { .switch:hover .switch__track { background: rgba(21, 19, 15, .26); } .switch:hover .switch__input:checked + .switch__track { background: var(--ink); } }
.switch + .param__note { margin-top: 4px; }

/* ---------- Result ---------- */
/* Two figures, one under the other: what the transport costs a year, and the payback time, on yellow.
   Each is a row: what it is on the left, the figure on the right. */
.tiles { display: flex; flex-direction: column; gap: 10px; }
.tile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding: 16px 20px; border-radius: 16px; background: var(--paper); }
.tile--key { background: var(--yellow); }
.tile__text { flex: 1 1 180px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile__label { font-weight: 700; font-size: .9375rem; line-height: 1.35; }
.tile__note { font-family: var(--mono); font-size: .6875rem; line-height: 1.5; color: var(--ink-2); }
.tile--key .tile__note { color: var(--ink); }
.tile__value { font-family: var(--display); font-weight: 300; font-size: clamp(1.5rem, 2.4vw, 1.9375rem); line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; transition: opacity .2s ease; }
/* While a new answer is on its way the old one stays, dimmed: the panel keeps its size. */
[data-state="loading"] .tile--key .tile__value, [data-state="waiting"] .tile--key .tile__value { opacity: .35; }

/* The scale: the ranges of months the answer can fall into, the one it fell into in ink. A drawing of the figure
   above it, so it is hidden from screen readers. */
.scale { display: flex; flex-direction: column; gap: 8px; }
.scale__bar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.scale__bar li { display: flex; flex-direction: column; gap: 7px; font-family: var(--mono); font-size: .625rem; line-height: 1.2; text-align: center; color: var(--ink-3); white-space: nowrap; }
.scale__bar li::before { content: ""; height: 10px; border-radius: 3px; background: var(--paper-2); transition: background-color .2s ease; }
.scale__bar li:first-child::before { border-radius: 5px 3px 3px 5px; }
.scale__bar li:last-child::before { border-radius: 3px 5px 5px 3px; }
.scale__bar li.is-on { color: var(--ink); font-weight: 500; }
.scale__bar li.is-on::before { background: var(--ink); }
.scale__unit { font-family: var(--mono); font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 420px) { .scale__bar li { font-size: .5625rem; letter-spacing: -.02em; } }

.calc__status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 1.5em; font-size: .875rem; line-height: 1.5; color: var(--ink-2); }
.calc__status:empty { display: none; }
.calc__status a { text-decoration: underline; text-underline-offset: 3px; }
.calc__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn--line { background: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--line:hover { background: none; }
@media (hover: hover) { .btn--line:hover { background: var(--ink); color: var(--snow); } }
.button-quiet { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 999px; background: none; color: var(--ink); font: 700 .8125rem var(--body); cursor: pointer; }
@media (hover: hover) { .button-quiet:hover { background: var(--ink); color: var(--snow); } }
.calc__caption { max-width: 48em; font-size: .8125rem; line-height: 1.55; color: var(--ink-2); }

/* ---------- How it counts: three cards, each a drawing, a name, the rule and a sentence ---------- */
.formulas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; }
.formulas > li { display: flex; flex-direction: column; gap: 10px; padding: 24px 24px 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.formulas .icon { width: 72px; height: 72px; margin-bottom: 8px; padding: 10px; border-radius: 18px; background: var(--paper); stroke-width: 1.6; }
.formulas h3 { font-family: var(--display); font-weight: 500; font-size: 1.125rem; line-height: 1.25; letter-spacing: -.01em; }
.formulas__rule { padding: 10px 12px; border-radius: 10px; background: var(--paper); font-family: var(--mono); font-size: .75rem; line-height: 1.55; color: var(--ink); }
.formulas p:not(.formulas__rule) { font-size: .9375rem; line-height: 1.6; color: var(--ink-2); }
