/* "What's wrong?" job picker. Its own file, with picker.js, so it can be lifted out of the site.
   Tap a job: its likely causes and what to do right now appear, then a short booking form.
   Without a script, or in a browser without :has(), every answer and the form simply show. */
.jp { --jp-ink: #13262f; --jp-muted: #4f5d63; --jp-card: #fff; --jp-line: #e3dccd; --jp-hi: #0c3b52; --jp-sun: #ffc53d; --jp-soft: #f3f8f9; --jp-warn: #b3261e;
  padding-block: clamp(3rem, 8vw, 5.5rem); background: linear-gradient(180deg, #dff0f5, #eef7f6 70%, #fbf6ec); scroll-margin-top: 4rem; }
.jp-head { max-width: 40rem; margin-bottom: 1.6rem; }
.jp-head h2 { margin: .2rem 0 .6rem; }
.jp-card { background: var(--jp-card); border: 1px solid var(--jp-line); border-radius: 26px; padding: clamp(1.1rem, 4vw, 2.2rem); box-shadow: 0 1px 0 rgb(19 38 47 / .04), 0 18px 40px -24px rgb(12 59 82 / .35); }
.jp-step { border: 0; margin: 0; padding: 0; min-width: 0; }
.jp-legend { display: flex; align-items: center; gap: .6rem; padding: 0; margin-bottom: 1rem; font: 600 1.25rem/1.2 var(--f-head, Georgia, serif); color: var(--jp-ink); }
.jp-legend:focus { outline: none; }
.jp-num { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--jp-hi); color: #fff; font: 700 .95rem/1 var(--f-body, system-ui, sans-serif); flex: none; }

/* The job tiles */
.jp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 760px) { .jp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; } }
.jp-tile { position: relative; display: grid; grid-template-rows: auto auto 1fr; gap: .2rem; padding: .9rem .85rem .95rem; border: 2px solid var(--jp-line); border-radius: 18px; background: #fff; cursor: pointer; transition: border-color .15s, background-color .15s, transform .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
.jp-tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.jp-ico { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; margin-bottom: .35rem; border-radius: 12px; background: var(--jp-soft); color: var(--jp-hi); transition: background-color .15s, color .15s; }
.jp-ico svg { width: 1.7rem; height: 1.7rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jp-t { font-weight: 700; line-height: 1.25; color: var(--jp-ink); }
.jp-s { font-size: .86rem; line-height: 1.35; color: var(--jp-muted); }
.jp-tile:hover { border-color: #b9cfd6; transform: translateY(-2px); box-shadow: 0 10px 20px -16px rgb(12 59 82 / .6); }
.jp-tile:has(input:focus-visible) { outline: 3px solid var(--jp-hi); outline-offset: 3px; }
.jp-tile:has(input:checked) { border-color: var(--jp-hi); background: #f2f8fa; box-shadow: inset 0 0 0 1px var(--jp-hi); }
.jp-tile:has(input:checked) .jp-ico { background: var(--jp-sun); color: var(--jp-ink); }
.jp-tile:has(input:checked)::after { content: ""; position: absolute; top: .7rem; right: .7rem; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: var(--jp-hi) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }

@media (max-width: 519px) {
  .jp-grid { gap: .5rem; }
  .jp-tile { grid-template-rows: auto 1fr; padding: .7rem .7rem .75rem; border-radius: 15px; }
  .jp-ico { width: 2.2rem; height: 2.2rem; margin-bottom: .25rem; border-radius: 10px; }
  .jp-ico svg { width: 1.45rem; height: 1.45rem; }
  .jp-t { font-size: .95rem; }
  .jp-s { display: none; }
  .jp-tile:has(input:checked)::after { top: .55rem; right: .55rem; }
}

/* The answers: one shows, for the job that is ticked */
.jp-answers { margin-top: 1.2rem; scroll-margin-top: 5rem; }
.jp-a { display: none; padding: clamp(1rem, 3.5vw, 1.6rem); border-radius: 20px; background: var(--jp-soft); border: 1px solid #d5e6eb; }
.jp-a h3 { margin: 0 0 .9rem; font-size: 1.35rem; }
.jp-a h4 { margin: 0 0 .45rem; font: 700 .78rem/1.2 var(--f-body, system-ui, sans-serif); letter-spacing: .12em; text-transform: uppercase; color: var(--jp-muted); }
.jp-cols { display: grid; gap: 1.1rem; }
.jp-cols > div:nth-child(2) { order: -1; } /* what to do right now comes first */
@media (min-width: 760px) { .jp-cols { grid-template-columns: 1fr 1fr; gap: 2rem; } }
.jp-list, .jp-do { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.jp-list li { position: relative; padding-left: 1.2rem; }
.jp-list li::before { content: ""; position: absolute; left: 0; top: .62em; width: .5rem; height: .5rem; border-radius: 50%; background: #c8733f; }
.jp-do { counter-reset: jp; }
.jp-do li { position: relative; padding-left: 2.1rem; counter-increment: jp; }
.jp-do li::before { content: counter(jp); position: absolute; left: 0; top: .05rem; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--jp-sun); color: var(--jp-ink); font-weight: 700; font-size: .85rem; }
.jp-we { margin: 1.1rem 0 0; padding-top: 1rem; border-top: 1px dashed #bcd3da; }
.jp-warn { margin: 0 0 1.1rem; padding: .85rem 1rem; border-radius: 14px; background: #fdecea; border-left: 5px solid var(--jp-warn); color: #5c1410; }
.jp-status { margin: .9rem 0 0; font-weight: 600; color: var(--jp-hi); }
.jp-status span { display: none; }
html[data-open="yes"] .jp-status .jp-yes, html[data-open="no"] .jp-status .jp-no { display: inline; }
html:not([data-open]) .jp-status { display: none; }
.jp-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .8rem; margin: 1.1rem 0 0; }
.jp-more { font-weight: 600; }

/* The booking step */
.jp-book { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--jp-line); scroll-margin-top: 5rem; }
.jp-when { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.1rem; }
.jp-label { width: 100%; font-weight: 600; margin-bottom: .1rem; }
.jp-chip { position: relative; }
.jp-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.jp-chip span { display: inline-block; padding: .6rem 1rem; border: 2px solid var(--jp-line); border-radius: 999px; font-weight: 600; font-size: .95rem; background: #fff; cursor: pointer; transition: background-color .15s, border-color .15s; }
.jp-chip input:checked + span { background: var(--jp-hi); border-color: var(--jp-hi); color: #fff; }
.jp-chip input:focus-visible + span { outline: 3px solid var(--jp-hi); outline-offset: 2px; }
.jp-fields { display: grid; gap: .9rem; }
@media (min-width: 760px) { .jp-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } .jp-fields .field-wide { grid-column: 1 / -1; } }
.jp-send { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.4rem; margin-top: 1.2rem; }
.jp-send .form-note { margin: 0; flex: 1 1 18rem; }

/* With :has(), show only the ticked job's answer, and the form once a job is ticked. */
@supports selector(:has(*)) {
  .jp:has(input[data-key="hot-water"]:checked) .jp-a[data-for="hot-water"],
  .jp:has(input[data-key="leak"]:checked) .jp-a[data-for="leak"],
  .jp:has(input[data-key="blocked"]:checked) .jp-a[data-for="blocked"],
  .jp:has(input[data-key="gas"]:checked) .jp-a[data-for="gas"],
  .jp:has(input[data-key="tap"]:checked) .jp-a[data-for="tap"],
  .jp:has(input[data-key="new-hws"]:checked) .jp-a[data-for="new-hws"],
  .jp:has(input[data-key="storm"]:checked) .jp-a[data-for="storm"],
  .jp:has(input[data-key="other"]:checked) .jp-a[data-for="other"] { display: block; }
  .jp:not(:has(input[name="job"]:checked)) .jp-answers { margin-top: 0; }
  .jp.jp-on:not(:has(input[name="job"]:checked)) .jp-book { display: none; }
  @media (prefers-reduced-motion: no-preference) {
    .jp-a { animation: jp-in .35s cubic-bezier(.2, .7, .2, 1); }
    .jp-book { animation: jp-in .35s cubic-bezier(.2, .7, .2, 1); }
  }
}
@supports not selector(:has(*)) { .jp-a { display: block; margin-bottom: .8rem; } }
@keyframes jp-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .jp-tile, .jp-tile:hover { transition: none; transform: none; } }
