/* Offer wizard (ui.offer_wizard, part 19b; markup _offer_picker.html _wizard(), behaviour offer-wizard.js).
   Rides on offer-picker.css (the --op-* tokens, cards, fields). Without JavaScript the bar, step buttons, chips and
   summary stay [hidden] and the three fieldsets read as the single form. Motion only inside
   prefers-reduced-motion: no-preference, transform and opacity only. No url(), no filter. */

.op--wiz [hidden] { display: none !important; } /* a display rule below must never reveal a part the script has not started */
.opw__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* steps: visible legends (the no-JS form reads 1, 2, 3 top to bottom) */
.opw__step { margin: 0; padding: 0; border: 0; min-width: 0; }
.opw__step + .opw__step { margin-top: 28px; }
.opw__step:focus { outline: none; }
.opw__legend { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 0 0 14px; padding: 0;
  font: 600 13px/1.2 var(--op-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--op-fg); }
.opw__num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font: 700 13px/1 var(--op-mono);
  color: var(--op-accent); border: 1px solid color-mix(in oklab, var(--op-accent) 60%, var(--op-edge)); }
.opw__hint { max-width: none; margin: -6px auto 16px; text-align: center; color: var(--op-dim); font-size: 14px; } /* a page rule may cap p (amarbaro: 408 px) */
.opw--js .opw__legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; } /* the bar names the step; screen readers still hear the group */

/* progress bar */
.opw__bar { max-width: 640px; margin: 0 auto 26px; }
.opw__steps { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.opw__dot { display: flex; align-items: center; gap: 8px; font: 600 12px/1.2 var(--op-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--op-dim); }
.opw__dot[aria-current="step"] { color: var(--op-fg); }
.opw__dot[aria-current="step"] .opw__num, .opw__dot.is-done .opw__num { color: #0b0f14; background: var(--op-accent); border-color: var(--op-accent); }
.opw__track { position: relative; height: 4px; border-radius: 4px; overflow: hidden; background: var(--op-edge); }
.opw__fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(.3333); border-radius: 4px;
  background: linear-gradient(90deg, color-mix(in oklab, var(--op-accent) 60%, transparent), var(--op-accent)); }
[data-step="2"] .opw__fill { transform: scaleX(.6667); }
[data-step="3"] .opw__fill { transform: scaleX(1); }
:dir(rtl) .opw__fill { transform-origin: right center; }

/* card cell: the card, then its example link (outside the label) */
.opw__cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opw__cell .op__card { flex: 1; }
@supports (grid-template-rows: subgrid) { /* card | example | chips share rows across the grid row: a neighbour keeps its height when one card opens its chips */
  .opw__cell { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; }
  .opw__cell > .op__card { grid-row: 1; }
  .opw__cell > .opw__ex { grid-row: 2; }
  .opw__cell > .opw__fu { grid-row: 3; }
}
.opw__ex { align-self: center; justify-self: center; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 4px 8px; border-radius: 6px;
  font: 500 12px/1.3 var(--op-mono); letter-spacing: .02em; color: var(--op-dim); text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--op-dim) 45%, transparent); text-underline-offset: 3px; }
.opw__ex:hover { color: var(--op-fg); }
.opw__ex:focus-visible { outline: 2px solid var(--op-accent); outline-offset: 1px; }

/* the tick box: a drawn box with a clear edge (the native dark box read as disabled, critic 2026-12-01) */
.op--wiz .op__chk { appearance: none; display: grid; place-items: center; width: 22px; height: 22px; opacity: 1; border-radius: 5px;
  border: 2px solid color-mix(in oklab, var(--c) 70%, var(--op-fg)); background: color-mix(in oklab, var(--op-bg) 55%, #000); }
.op--wiz .op__chk:checked { background: var(--c); border-color: var(--c); }
.op--wiz .op__chk:checked::after { content: ""; width: 6px; height: 11px; margin-top: -3px; border: solid #0b0f14; border-width: 0 2.5px 2.5px 0; rotate: 45deg; }

/* ticked: glow (always), lift (motion only) */
.op--wiz .op__card:has(.op__chk:checked) {
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--c) 55%, transparent), 0 14px 34px -16px color-mix(in oklab, var(--c) 75%, transparent);
  background: linear-gradient(180deg, color-mix(in oklab, var(--c) 18%, var(--op-bg)), var(--op-bg) 70%);
}

/* follow-up chips: directly under the ticked card (critic 2026-12-01: below the grid they were out of view) */
.opw__fu { padding: 12px; border: 1px solid color-mix(in oklab, var(--op-accent) 35%, var(--op-edge)); border-radius: 12px; background: var(--op-bg); text-align: center; }
.opw__fu-title { margin: 0 0 10px; font: 600 12px/1.3 var(--op-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--op-dim); }
.opw__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.opw__chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.2;
  color: var(--op-fg); background: color-mix(in oklab, var(--op-bg) 70%, #000); border: 1px solid var(--op-edge); }
.opw__chip[aria-pressed="true"] { color: #0b0f14; background: var(--op-accent); border-color: var(--op-accent); font-weight: 600; }
.opw__chip[aria-pressed="true"]::before { content: "✓ "; }
.opw__chip:focus-visible { outline: 2px solid var(--op-accent); outline-offset: 2px; }

/* step buttons */
.opw__nav { display: flex; justify-content: center; gap: 12px; max-width: 900px; margin: 22px auto 0; }
.op--wiz .op__actions { gap: 12px; }
.opw__next, .opw__back { min-height: 52px; padding: 12px 20px; border-radius: 8px; cursor: pointer; font: 600 15px/1 var(--op-mono); }
.opw__next { border: 0; color: #0b0f14; background: var(--op-accent); }
.opw__back { color: var(--op-fg); background: transparent; border: 1px solid var(--op-edge); }
.opw__next:focus-visible, .opw__back:focus-visible { outline: 2px solid var(--op-fg); outline-offset: 2px; }

/* summary: a top-glow card beside the steps (wide screens), under them on phones */
.opw__sum { position: relative; align-self: start; padding: 20px 18px; border: 1px solid var(--op-edge); border-radius: 12px; text-align: center;
  background: linear-gradient(180deg, color-mix(in oklab, var(--op-accent) 8%, var(--op-bg)), var(--op-bg) 55%); }
.opw__sum::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--op-accent), transparent); }
.opw__sum-title { margin: 0 0 12px; font: 600 12px/1.2 var(--op-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--op-accent); }
.opw__sum-empty { margin: 0; color: var(--op-dim); font-size: 14px; line-height: 1.45; }
.opw__sum-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.opw__sum-list:empty { display: none; }
.opw__sum-item { padding-top: 12px; border-top: 1px solid var(--op-edge); }
.opw__sum-item:first-child { padding-top: 0; border-top: 0; }
.opw__sum-name { display: block; font-weight: 650; font-size: 15px; color: var(--op-fg); }
.opw__sum-chips { display: block; margin-top: 4px; color: var(--op-dim); font-size: 14px; line-height: 1.4; }
.opw__sum-time { display: block; margin-top: 4px; font: 500 12px/1.4 var(--op-mono); color: var(--op-dim); }
.opw__sum-item .opw__ex { margin-top: 2px; }

.opw--js .opw__step + .opw__step { margin-top: 0; }
@media (min-width: 1100px) {
  .opw--js .opw__body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
  .opw--js .opw__sum { position: sticky; top: 88px; } /* under the fixed 64 px header */
}
@media (max-width: 1099px) {
  .opw__sum { max-width: 900px; margin: 22px auto 0; }
}
@media (max-width: 600px) {
  .opw__dot { font-size: 12px; letter-spacing: .02em; flex-direction: column; gap: 4px; text-align: center; }
  .opw__nav, .op--wiz .op__actions { flex-wrap: nowrap; }
  .opw__next, .opw__back, .op--wiz .op__send { flex: 1; width: auto; padding-inline: 12px; }
  .opw__fu { padding: 10px 8px; }
  .opw__chip { padding: 8px 12px; }
  .opw--js:is([data-step="2"], [data-step="3"]) .op__lede { display: none; } /* later steps: the action row fits the first screen */
  .opw__cell > .opw__ex { text-align: center; justify-content: center; }
  .opw__cell > .opw__ex .opw__exp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } /* two cards a row: the label alone; its name keeps the prefix */
}
@media (prefers-reduced-motion: no-preference) {
  .op--wiz .op__card { transition: transform .2s ease-out, border-color .15s ease-out, box-shadow .2s ease-out, background-color .2s ease-out; }
  .op--wiz .op__card:has(.op__chk:checked) { transform: translateY(-4px); }
  .opw__fill { transition: transform .25s ease-out; }
  .opw__chip { transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out; }
}
@media (forced-colors: active) {
  .op--wiz .op__chk { appearance: auto; }
  .opw__chip[aria-pressed="true"] { outline: 2px solid Highlight; }
  .opw__dot[aria-current="step"] { text-decoration: underline; }
}
