/* =========================================================================
   School website widget maker (/for-schools/website-widget, src/routes/widgets.js).
   The choices, then the code and help, on the left; the live preview on the right, staying in
   view as you scroll (on phones: choices, preview, code, help).
   The widget itself has its own inline styles (it's shown on other websites).
   ========================================================================= */

.wm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "form preview" "out preview" "help preview"; gap: 24px 32px; align-items: start; }
.wm-form, .wm-preview, .wm-out, .wm-help { min-width: 0; padding: 28px; border-radius: 24px; background: #fff; box-shadow: var(--c-shadow); }
.wm-form { grid-area: form; }
.wm-preview { grid-area: preview; }
.wm-out { grid-area: out; }
.wm-help { grid-area: help; }

/* steps */
.wm-step { min-width: 0; margin: 0 0 30px; padding: 0; border: 0; }
.wm-step > legend { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 0; color: var(--c-ink); font-size: clamp(1.2rem, 2.2vw, 1.4rem); font-weight: 800; line-height: 1.25; }
.wm-step__n { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--c-sun); color: var(--c-indigo); font-size: 1.05rem; font-weight: 800; }
.wm-step .c-field { margin: 0 0 16px; }
.wm-sub { min-width: 0; margin: 18px 0 0; padding: 0; border: 0; }
.wm-sub > legend { margin: 0 0 6px; padding: 0; color: var(--c-ink); font-weight: 800; }
.wm-hint { margin: 4px 0 0; color: var(--c-muted); font-size: 0.92rem; line-height: 1.5; }
.wm-hint a { color: var(--c-raspberry-dark); font-weight: 700; }
.wm-opt-word { color: var(--c-muted); font-weight: 500; }
.wm-err { min-height: 0; margin: 0; color: #b0302a; font-weight: 700; font-size: 0.92rem; }
.wm-err:empty { display: none; }
.c-field input[aria-invalid="true"] { border-color: #b0302a; }

/* tick boxes and radio buttons as large tappable rows */
.wm-opts { display: grid; gap: 10px; }
.wm-opts--row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.wm-years { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.wm-opt { position: relative; display: flex; align-items: flex-start; gap: 10px; min-height: 48px; padding: 12px 14px; border: 2px solid var(--c-line); border-radius: 14px; background: #fff; cursor: pointer; }
.wm-opt input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--c-raspberry-btn); }
.wm-opt span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wm-opt strong { color: var(--c-ink); font-size: 0.98rem; line-height: 1.3; }
.wm-opt small { color: var(--c-muted); font-size: 0.85rem; line-height: 1.35; }
.wm-opt:has(input:checked) { border-color: var(--c-indigo); background: #f3f4fb; }
.wm-opt:has(input:focus-visible) { outline: 3px solid var(--c-ink); outline-offset: 2px; }
.wm-opt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.wm-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wm-chipbtn { min-height: 44px; padding: 8px 16px; border: 2px solid var(--c-line); border-radius: 999px; background: #fff; color: var(--c-ink); font: 700 0.92rem/1.2 "Red Hat Display", "Segoe UI", Arial, sans-serif; cursor: pointer; }
.wm-chipbtn:hover { border-color: var(--c-indigo); }
.wm-chipbtn:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 2px; }
.wm-count { max-width: 220px; margin-top: 16px; }

.wm-go { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.wm-msg { min-height: 1.4em; margin: 0; color: #b0302a; font-weight: 700; }
.wm-msg.is-ok { color: #4c6112; }
.wm-privacy { display: flex; gap: 10px; margin: 22px 0 0; color: var(--c-muted); font-size: 0.9rem; line-height: 1.5; }
.wm-privacy svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--c-green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* preview */
.wm-preview__h, .wm-out__h, .wm-help__h { margin: 0 0 14px; color: var(--c-ink); font-size: 1.3rem; font-weight: 800; }
.wm-preview__box { padding: 16px; border-radius: 16px; background: repeating-linear-gradient(45deg, #f4f5f9 0 10px, #eceef4 10px 20px); }
.wm-preview__box iframe { display: block; width: 100%; height: 420px; border: 0; }
@media (min-width: 901px) {
  .wm-preview { position: sticky; top: 90px; }
  .wm-preview__box { max-height: calc(100vh - 230px); overflow: auto; }
}

/* the code */
.wm-out__h:focus { outline: none; }
.wm-verified { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: #fff4e0; color: #6b3d00; font-weight: 700; }
.wm-verified.is-ok { background: #ebf3dc; color: #3d5210; }
.wm-code-label { display: block; margin: 0 0 6px; color: var(--c-ink); font-weight: 700; }
.wm-code { display: block; width: 100%; min-height: 110px; padding: 12px 14px; border: 2px solid #8a8f99; border-radius: 14px; background: #f7f8fb; color: var(--c-ink); font: 0.85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; overflow-wrap: anywhere; }
.wm-code:focus { outline: none; border-color: var(--c-indigo); box-shadow: 0 0 0 3px rgba(33, 39, 113, 0.15); }
.wm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.wm-more { margin: 14px 0; }
.wm-more summary, .wm-help summary { min-height: 44px; padding: 10px 0; color: var(--c-ink); font-weight: 800; cursor: pointer; }
.wm-more summary:focus-visible, .wm-help summary:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 2px; border-radius: 6px; }
.wm-more p, .wm-help p { margin: 0 0 12px; line-height: 1.55; }
.wm-more .c-btn { margin-top: 10px; }
.wm-help details { border-top: 1px solid var(--c-line); }
.wm-help details:last-child { border-bottom: 1px solid var(--c-line); }

@media (max-width: 900px) {
  .wm-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "form" "preview" "out" "help"; }
}
@media (max-width: 600px) {
  .wm.c-sec { padding-left: 16px; padding-right: 16px; }
  .wm-form, .wm-preview, .wm-out, .wm-help { padding: 20px 16px; border-radius: 20px; }
  .wm-preview__box { padding: 8px; }
  .wm-actions .c-btn { width: 100%; }
}
