/* Offer picker (ui.offer_picker; markup app/templates/_offer_picker.html, docs/ui-switches.md part 19).
   Glow cards with a native checkbox, a CSS counter for "N selected", one form. No url(), no filter; motion only
   inside prefers-reduced-motion: no-preference. Colours from the site's tokens, the house dark values last. */

.op {
  --op-bg: var(--stat-card, var(--card, var(--surface, #0E131B)));
  --op-edge: var(--stat-line, var(--hairline, var(--border, #1C2430)));
  --op-fg: var(--stat-ink, var(--ink, var(--text-1, #E6EAF0)));
  --op-dim: color-mix(in srgb, var(--stat-muted, var(--muted, var(--text-2, #7D8796))) 85%, var(--op-fg));
  --op-mono: var(--stat-mono, var(--font-mono, 'JetBrains Mono', ui-monospace, monospace));
  --op-accent: var(--stat-olive, var(--accent, #9DAE51));
  text-align: center;
}
.op__eyebrow, .op__title, .op__lede { text-align: center; margin-inline: auto; } /* a page rule may cap p at a max-width (amarbaro: 408 px): centre the box, not only the text */
.op__eyebrow { margin: 0 auto; font: 600 12px/1 var(--op-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--op-accent); }
.op__title { margin: 10px 0 8px; font-size: clamp(28px, 3.4vw, 38px); line-height: 1.15; letter-spacing: -.02em; color: var(--op-fg); }
.op__lede { max-width: 640px; margin: 0 auto 28px; color: var(--op-dim); line-height: 1.55; }
.op__status { max-width: 900px; margin: 0 auto 20px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--op-edge); }
.op__status--ok { border-color: color-mix(in oklab, var(--op-accent) 55%, var(--op-edge)); color: var(--op-fg); }
.op__status--err { border-color: color-mix(in oklab, var(--danger, #dc2626) 60%, var(--op-edge)); color: var(--op-fg); }

.op__form { counter-reset: op; text-align: start; }
.op__offers { margin: 0; padding: 0; border: 0; min-width: 0; }
.op__legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.op__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }

.op__card {
  --c: var(--stat-olive, #9DAE51);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 180px;
  padding: 22px 18px 18px;
  overflow: hidden;
  text-align: center;
  cursor: pointer;
  color: var(--op-fg);
  background: linear-gradient(180deg, color-mix(in oklab, var(--c) 9%, var(--op-bg)), var(--op-bg) 60%);
  border: 1px solid var(--op-edge);
  border-radius: 12px;
}
.op__card::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--c), transparent); }
.op__card--olive { --c: var(--stat-olive, #9DAE51); }
.op__card--blue { --c: var(--stat-blue, #4FA3D9); }
.op__card--violet { --c: var(--stat-violet, #A48BE0); }
.op__card--teal { --c: var(--stat-teal, #3FB7A0); }
.op__card--gold { --c: var(--stat-gold, #C9A445); }
.op__card:has(.op__chk:checked) {
  counter-increment: op;
  border-color: color-mix(in oklab, var(--c) 70%, var(--op-edge));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--c) 45%, transparent), 0 8px 24px -18px var(--c); /* the border and the tick carry the state */
}
.op__card:has(.op__chk:focus-visible) { outline: 2px solid var(--c); outline-offset: 2px; }
.op__chk { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; margin: 0; accent-color: var(--c); color-scheme: dark; opacity: .85; cursor: pointer; } /* dark box: an unticked white square outshone the ticked cards */
.op__chk:checked { opacity: 1; }
.op__icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  font: 700 18px/1 var(--op-mono); color: var(--c); background: color-mix(in oklab, var(--c) 16%, transparent);
}
.op__name { font-weight: 650; font-size: 17px; line-height: 1.3; }
.op__text { color: var(--op-dim); font-size: 14px; line-height: 1.45; }
.op__meta { margin-top: auto; font: 500 12px/1.4 var(--op-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--op-dim); }

.op__count { max-width: 900px; margin: 18px auto 0; text-align: start; font: 500 13px/1 var(--op-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--op-dim); }
.op__n::before { content: counter(op); color: var(--op-accent); }

.op__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-width: 900px; margin: 18px auto 0; }
.op__field { display: flex; flex-direction: column; gap: 6px; }
.op__field--wide { grid-column: 1 / -1; }
.op__label { font: 600 12px/1.2 var(--op-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--op-dim); }
.op__field input, .op__field textarea {
  width: 100%; box-sizing: border-box; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--op-fg);
  background: color-mix(in oklab, var(--op-bg) 70%, #000); border: 1px solid var(--op-edge); border-radius: 8px;
}
.op__field textarea { resize: vertical; min-height: 120px; }
.op__field input:focus-visible, .op__field textarea:focus-visible { outline: 2px solid var(--op-accent); outline-offset: 1px; }
.op__hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.op__actions { display: flex; align-items: end; justify-content: flex-end; }
.op__send {
  min-height: 52px; padding: 12px 20px; border: 0; border-radius: 8px; cursor: pointer; /* the height of the inputs beside it (51.6 px), so the row lines up top and bottom */
  font: 600 15px/1 var(--op-mono); color: #0b0f14; background: var(--op-accent);
}
.op__send:focus-visible { outline: 2px solid var(--op-fg); outline-offset: 2px; }
.op__note { max-width: 900px; margin: 14px auto 0; text-align: center; font-size: 13px; color: var(--op-dim); }

@media (max-width: 600px) {
  .op__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .op__lede { margin-bottom: 20px; }
  .op__card { min-height: 0; padding: 16px 10px; gap: 8px; }
  .op__name { font-size: 15px; }
  .op__text { font-size: 13px; }
  .op__fields { grid-template-columns: 1fr; }
  .op__count { text-align: center; }
  .op__actions { justify-content: stretch; }
  .op__send { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .op__card { transition: border-color .15s ease-out, box-shadow .2s ease-out; }
}
@media (forced-colors: active) {
  .op__card:has(.op__chk:checked) { outline: 2px solid Highlight; }
}
