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

/* A short page head: the configurator 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; }
.konfig > .wrap { padding-bottom: var(--section); }
/* Elements shown and hidden by the script carry the hidden attribute; classes that set display must not undo it. */
.konfig [hidden] { display: none; }

/* ---------- Layout: view beside the controls on a wide screen, above them on a narrow one ---------- */
.konfig__panel { display: flex; flex-direction: column; gap: 30px; min-width: 0; }
/* Narrow screen: the view stays at the top of the window while the controls scroll under it, so the effect of a
   slider is always in sight. The block layout (not grid) is what lets it stay for the whole length of the controls. */
.konfig { --view: clamp(250px, 48vh, 480px); --clear: calc(var(--view) + 31px); }
@supports (height: 1svh) { .konfig { --view: clamp(250px, 48svh, 480px); } }
.konfig__stage { position: sticky; top: 0; z-index: 3; margin: 0 calc(var(--gutter) * -1) 22px; padding: 8px var(--gutter) 10px; border-bottom: 1px solid var(--line); background: var(--paper); }
.viewer { height: var(--view); }
/* What the browser scrolls into reach (a control reached with the keyboard, the target of a script) is brought to
   the top edge of the window, and here that edge is under the view, which stays there. The scroll margin keeps
   everything in the panel clear of it (--clear): the height of the view, its frame (19 px) and a little air.
   It is taken back wherever the view does not stay above the controls: the two cases below. */
.konfig__panel, .konfig__panel * { scroll-margin-top: var(--clear); }
/* A phone held sideways has no room for both: there the view scrolls away with the page. */
@media (max-height: 520px) and (max-width: 999px) {
  .konfig { --clear: 0px; }
  .konfig__stage { position: static; }
  .viewer { height: 78vh; height: 78svh; }
}
@media (min-width: 1000px) {
  .konfig { --clear: 0px; }
  .konfig__grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(380px, 1fr); gap: 0 clamp(28px, 3.2vw, 52px); align-items: start; }
  .konfig__stage { top: 16px; margin: 0; padding: 0; border: 0; background: none; }
  /* 270 px: the header and the page head above the view, so the whole view is on the first screen. */
  .viewer { height: clamp(440px, calc(100vh - 270px), 760px); }
}

/* ---------- 3D view ---------- */
.viewer { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: radial-gradient(85% 75% at 50% 58%, #fff 0%, #faf9f7 55%, #f1eeea 100%); }
.viewer__canvas, .viewer__gl, .viewer__dims { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewer__gl { display: block; opacity: 0; transition: opacity .4s ease; }
[data-state="ready"] .viewer__gl { opacity: 1; }
.viewer__gl:focus-visible { outline-offset: -5px; border-radius: 22px; }
.viewer__dims { pointer-events: none; opacity: 0; transition: opacity .4s ease; }
[data-state="ready"] .viewer__dims { opacity: 1; }
.dim__halo { fill: none; stroke: #fff; stroke-width: 4; stroke-opacity: .85; stroke-linecap: round; }
.dim__line { fill: none; stroke: var(--ink); stroke-width: 1; stroke-linecap: round; }
.dim__text { font: 500 .75rem var(--mono); fill: var(--ink); text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: #fff; stroke-width: 7px; stroke-linejoin: round; }

.viewer__status { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); padding-inline: 24px; text-align: center; font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); pointer-events: none; }
.viewer__status:empty { display: none; }
[data-state="no-3d"] .viewer__status { max-width: 34em; margin-inline: auto; font-family: var(--body); font-size: .9375rem; letter-spacing: 0; text-transform: none; line-height: 1.55; color: var(--ink-2); }
/* The moving line plays whatever the system says about reduced motion (Windows reports it whenever its animation
   effects are off, see main.js): a still line would read as a page that hangs. */
[data-state="loading"] .viewer__status::after { content: ""; display: block; width: 132px; height: 2px; margin: 16px auto 0; background: linear-gradient(to right, transparent, var(--bronze), transparent) no-repeat rgba(21, 19, 15, .1); background-size: 45% 100%; animation: konfig-loading 1.3s linear infinite; }
@keyframes konfig-loading { from { background-position: -90% 0; } to { background-position: 190% 0; } }

.viewer__note { position: absolute; left: 14px; top: 14px; max-width: min(380px, calc(100% - 82px)); padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .92); font-size: .8125rem; line-height: 1.45; color: var(--ink-2); }
.viewer__hint { position: absolute; left: 18px; bottom: 16px; max-width: calc(100% - 36px); font-family: var(--mono); font-size: .6875rem; letter-spacing: .04em; color: var(--ink-3); opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.viewer__hint.is-visible { opacity: 1; }
/* The buttons stand in the upper right corner: the model's near corner and the dimension lines are at the bottom. */
.viewer__tools { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 6px; }
.viewer__tool { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--ink); cursor: pointer; }
@media (hover: hover) { .viewer__tool:hover { border-color: var(--ink); } }
.viewer__tool svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.viewer__tool[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--snow); }

@media (max-width: 999px) {
  .viewer__note { left: 10px; top: 10px; max-width: calc(100% - 66px); padding: 7px 11px; font-size: .75rem; }
  .viewer__hint { left: 14px; bottom: 12px; max-width: calc(100% - 28px); }
  .viewer__tools { right: 10px; top: 10px; gap: 5px; }
  .viewer__tool { width: 36px; height: 36px; }
}

/* Dark stage (data-stage="night" on the section): the look of the product stage on the home page. */
[data-stage="night"] .viewer { border-color: var(--night); background: radial-gradient(70% 75% at 50% 60%, var(--night-2) 0%, var(--night) 78%); }
[data-stage="night"] .viewer__gl:focus-visible { outline-color: var(--yellow); }
[data-stage="night"] .dim__halo, [data-stage="night"] .dim__text { stroke: var(--night); }
[data-stage="night"] .dim__line { stroke: var(--snow); }
[data-stage="night"] .dim__text { fill: var(--snow); }
[data-stage="night"] .viewer__status, [data-stage="night"] .viewer__hint { color: var(--snow-3); }
[data-stage="night"] .viewer__note { border-color: var(--rule-night); background: rgba(16, 15, 13, .82); color: var(--snow-2); }
[data-stage="night"] .viewer__tool { border-color: var(--rule-night); background: rgba(16, 15, 13, .7); color: var(--snow); }
@media (hover: hover) { [data-stage="night"] .viewer__tool:hover { border-color: var(--snow); } }
[data-stage="night"] .viewer__tool[aria-pressed="true"] { border-color: var(--yellow); background: var(--yellow); color: var(--ink); }
[data-stage="night"] .viewer__tool:focus-visible { outline-color: var(--yellow); }

/* ---------- 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; align-items: baseline; gap: 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 { font-size: .875rem; line-height: 1.55; color: var(--ink-2); }

/* ---------- Choice cards (radio buttons) ---------- */
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); gap: 10px; }
/* Modules and pallets: one under the other, each card a short text. */
.options--list, .options--pallets { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.options--pallets + .step__note { margin-top: 12px; }
.option { display: block; cursor: pointer; }
.option__body { position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); transition: border-color .15s ease, box-shadow .15s ease; }
@media (hover: hover) { .option:hover .option__body { border-color: var(--ink-3); } }
.option__body::before { content: ""; position: absolute; right: 12px; top: 12px; width: 18px; height: 18px; border: 1.5px solid var(--ink-3); border-radius: 50%; background: var(--card); }
.option input:checked + .option__body { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.option input:checked + .option__body::before { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 0 3.5px, var(--yellow) 4.5px); }
.option input:focus-visible + .option__body { outline: 2px solid var(--ink); outline-offset: 3px; }
/* Switched off (does not fit the chosen robot): faded, no radio mark, and a line that says why at full strength. */
.option input:disabled + .option__body { border-style: dashed; background: none; cursor: not-allowed; }
.option input:disabled + .option__body::before { display: none; }
.option input:disabled + .option__body .option__img, .option input:disabled + .option__body .option__name, .option input:disabled + .option__body .option__spec, .option input:disabled + .option__body .option__desc { opacity: .45; }
.option__reason { margin-top: 4px; font-family: var(--mono); font-size: .6875rem; letter-spacing: .02em; color: var(--ink-2); }
.option__text { display: flex; flex-direction: column; gap: 3px; padding-right: 22px; }
/* Robots: two groups; each card is a picture of the robot on the stage of the 3D view, and its name under it. */
.group + .group { margin-top: 16px; }
.group__title { margin-bottom: 8px; font-family: var(--mono); font-size: .6875rem; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.option--robot .option__body { gap: 0; padding: 0; overflow: hidden; }
.option--robot .option__img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.option--robot .option__text { padding: 10px 14px 13px; }
/* Modules: a row each, a picture of the module on its robot on the left. */
.option--module .option__body { flex-direction: row; align-items: center; gap: 14px; padding: 8px 14px 8px 8px; }
.option--module .option__img { flex: none; width: 112px; height: auto; border-radius: 8px; }
/* Pallets: a row each, the top view on the left. All drawings share one scale, so a half pallet looks half the size. */
.option--pallet .option__body { flex-direction: row; align-items: center; gap: 14px; padding-block: 8px; }
.option--pallet .option__name { font-family: var(--body); font-weight: 700; font-size: .9375rem; }
.pallet { flex: none; display: block; width: 78px; height: auto; }
.pallet__below { fill: #b3936b; }
.pallet__deck { fill: #e6cfa9; stroke: #8a6a45; stroke-width: .75; vector-effect: non-scaling-stroke; }
.pallet__own { fill: none; stroke: var(--ink-3); stroke-width: 1.25; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.option__name { font-family: var(--display); font-weight: 500; font-size: .875rem; line-height: 1.35; }
.option__spec { font-family: var(--mono); font-size: .6875rem; color: var(--ink-3); }
.option__desc { margin-top: 3px; font-size: .875rem; line-height: 1.5; color: var(--ink-2); }

/* ---------- Parameters ---------- */
.params { display: flex; flex-direction: column; gap: 22px; }
.params + .params { margin-top: 22px; }
.params + .step__note, .step__note + .step__note { margin-top: 12px; }
.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%; }
legend.param__label + * { clear: both; }
.param__count { margin-left: 6px; font-family: var(--mono); font-weight: 400; font-size: .75rem; color: var(--ink-3); }
.param__row { display: flex; align-items: center; gap: 14px; }
/* The parameter's own hint: what the number means, or when the option is needed. */
.param__note { max-width: 44em; margin-top: 2px; font-size: .8125rem; line-height: 1.5; color: var(--ink-2); }
.segments + .param__note { margin-top: 8px; }
.param__hint { display: inline-block; padding: 1px 4px; margin-left: -4px; border-radius: 3px; font-family: var(--mono); font-size: .6875rem; color: var(--ink-3); }
.param__hint.is-changed { animation: konfig-changed 2.6s ease-out; }
@keyframes konfig-changed { 0%, 55% { background: var(--yellow); color: var(--ink); } 100% { background: transparent; color: var(--ink-3); } }
.param__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; }

.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; -moz-appearance: textfield; appearance: textfield; }
.param__field::-webkit-inner-spin-button, .param__field::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.param__field:focus-visible { outline: none; } /* the frame around the field and its unit shows the focus */
.param__unit { color: var(--ink-3); }

.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); }
.slider:disabled { opacity: .4; cursor: not-allowed; }

.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; 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; }

.items { display: flex; flex-direction: column; }
.items__row { display: grid; grid-template-columns: 4.8em minmax(0, 1fr) auto 36px; align-items: center; gap: 10px; }
.items__name { font-size: .875rem; color: var(--ink-2); }
@media (max-width: 460px) {
  .items__row { grid-template-columns: minmax(0, 1fr) auto 36px; padding-top: 6px; }
  .items__name { grid-column: 1 / -1; margin-bottom: -12px; }
}
.button-icon { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--ink); font: 400 1.125rem/1 var(--body); cursor: pointer; }
@media (hover: hover) { .button-icon:hover { border-color: var(--ink); } }
.button-quiet { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 999px; background: none; color: var(--ink); font: 700 .875rem var(--body); cursor: pointer; }
/* Hover styles only where there is a pointer that hovers: on a touch screen they would stick after a tap. */
@media (hover: hover) { .button-quiet:hover { background: var(--ink); color: var(--snow); } }
.button-icon:disabled, .button-quiet:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* The six subjects of "Co można skonfigurować" in two rows of three, not five and one. */
.topics--3 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

/* ---------- Summary ---------- */
.summary { padding: 2px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.summary:empty, .summary:empty + .summary__caption { display: none; }
.summary__caption { margin: 8px 0 14px; font-family: var(--mono); font-size: .6875rem; color: var(--ink-3); }
.summary > div:first-child { border-top: 0; }
.summary dt { flex: 0 1 44%; }
.summary dd { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.summary__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.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); } }
