/* The generator (template-parts/tool-generator.php, root .tg; its script assets/js/tool-generator.js), the one form of
   the five model-backed tools, loaded only on their pages after the kit and tool.css. One column, 760 px at most,
   centred under the hero's words: the form in the product's crisp card (BRANDBOOK section 20: a 1px hairline, radius
   12, the card's own ground, no shadow, no tint), the privacy line under it, then the results, each a card of its own
   (or one card of rows for the short lines). The kind switch is the cadence builder's segmented control, wrapping
   into a grid on a narrow screen. Colour means something: the primary on the chosen kind, the warn ink for what needs
   the person (a field to fix, a refusal, a count over its limit), the green on a copy that worked. Nothing moves but
   the button's ring while a request runs, and not even that with reduced motion. In forced colours (a Windows
   contrast theme) the chosen kind keeps a mark of its own, the system's selected colours, since the theme's ground,
   ring and ink are dropped there. */

:root{
  --tg-card:var(--k-card,var(--panel));
  --tg-warn:#B9410E;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){--tg-warn:#FF9466}
}
:root[data-theme="dark"]{--tg-warn:#FF9466}

.tg{max-width:760px;margin:0 auto;text-align:left}
.tg-card{min-width:0;border:1px solid var(--line);border-radius:12px;background:var(--tg-card);color:var(--ink)}
.tg-form{padding:20px 20px 18px}
.tg-l{display:block;float:none;margin:0 0 8px;padding:0;font:600 13.5px/1.3 var(--sans);color:var(--ink2)}

/* the kind switch: native radios in a segmented control, a grid that wraps on a phone */
.tg-kinds{min-width:0;margin:0 0 20px;padding:0 0 20px;border:0;border-bottom:1px solid var(--line)}
.tg-seg{display:grid;grid-template-columns:repeat(auto-fit,minmax(124px,1fr));gap:2px;padding:2px;border-radius:10px;background:var(--sunk);box-shadow:inset 0 0 0 1px var(--line)}
.tg-seg label{position:relative;display:block;cursor:pointer}
.tg-seg input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.tg-seg span{display:grid;place-items:center;min-height:36px;padding:4px 8px;border-radius:8px;font:500 13.5px/1.2 var(--sans);color:var(--mute);text-align:center}
.tg-seg label:hover span{color:var(--ink2)}
.tg-seg input:checked+span{background:var(--tg-card);box-shadow:0 0 0 1px var(--line);color:var(--ink2)}
.tg-seg input:focus-visible+span{outline:2px solid var(--blue);outline-offset:1px}
.tg-seg input:disabled+span{cursor:progress}
@media (forced-colors:active){
  .tg-seg input:checked+span{forced-color-adjust:none;background:SelectedItem;color:SelectedItemText}
}

/* the fields */
.tg-fs{display:grid;gap:18px;min-width:0;margin:0;padding:0;border:0}
.tg-fs[hidden]{display:none}
.tg-f{min-width:0}
.tg-in{display:block;box-sizing:border-box;width:100%;margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--tg-card);font:400 15px/1.5 var(--sans);color:var(--ink)}
textarea.tg-in{resize:vertical}
input.tg-in{height:44px}
.tg-num{max-width:160px}
.tg-in::placeholder{color:var(--mute);opacity:1}
.tg-in:hover{border-color:color-mix(in srgb,var(--mute) 55%,transparent)}
.tg-in:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
.tg-in[aria-invalid="true"]{border-color:var(--tg-warn)}
.tg-sel{position:relative;max-width:320px}
.tg-sel select{height:44px;padding:0 36px 0 12px;-webkit-appearance:none;appearance:none;cursor:pointer;font-weight:500;color:var(--ink2)}
.tg-sel svg{position:absolute;top:50%;right:12px;width:16px;height:16px;margin-top:-8px;color:var(--mute);pointer-events:none}
.tg-f-foot{display:flex;align-items:baseline;gap:4px 14px;margin-top:6px}
.tg-hint{min-width:0;margin:0;font:400 12.5px/1.45 var(--sans);color:var(--mute);text-wrap:pretty}
.tg-n{flex:none;margin-left:auto;font:500 12px/1.45 var(--mono);font-variant-numeric:tabular-nums;color:var(--mute);white-space:nowrap}
.tg-n.tg-near{color:var(--ink2)}
.tg-err{margin:6px 0 0;font:500 13px/1.45 var(--sans);color:var(--tg-warn)}
.tg-err[hidden]{display:none}

/* the button, the daily line, the bot check under them, the refusal. The button is printed disabled until the script
   binds the form (drawn as it is, so it does not flicker on load), and busy is aria-disabled, so it keeps the focus */
.tg-go{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;margin-top:22px}
.tg-btn{min-width:150px}
.tg-btn:disabled{cursor:default}
.tg-btn[aria-disabled="true"]{cursor:progress;opacity:.8}
.tg-spin{display:none;flex:none;width:15px;height:15px;box-sizing:border-box;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:tg-spin .8s linear infinite}
.tg-busy .tg-spin{display:block}
@keyframes tg-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.tg-spin{animation:none;border-right-color:currentColor;opacity:.55}}
.tg-limit{margin:0;font:400 13px/1.45 var(--sans);color:var(--mute)}
/* the widget's frame, 65 px (140 compact, which the script picks under a 300 px slot, a viewport under 362 px): the
   room is kept and line-height is 0, so nothing jumps when it lands */
.tg-ts{min-height:65px;margin-top:14px;line-height:0}
.tg-alert{margin:14px 0 0;padding:10px 12px;border-radius:8px;background:color-mix(in srgb,var(--tg-warn) 9%,var(--tg-card));font:500 14px/1.5 var(--sans);color:var(--tg-warn);text-wrap:pretty}
.tg-alert[hidden]{display:none}

/* the privacy line sits under the form here (tool.css draws it), the results under it */
.tg .tp-priv{margin-top:14px}

/* ---- the results ------------------------------------------------------------------------------------------------ */
.tg-out{margin-top:32px}
.tg-out[hidden]{display:none}
.tg-out-h{display:flex;flex-wrap:wrap;align-items:center;gap:4px 16px;margin-bottom:14px}
.tg-out-t{margin:0;font:600 20px/1.3 var(--sans);letter-spacing:-.01em;color:var(--ink2)}
.tg-out-t:focus{outline:none}
.tg-out-t:focus-visible{outline:2px solid var(--blue);outline-offset:4px;border-radius:4px}
.tg-out-sub{flex:1 0 100%;order:3;margin:0;font:400 13.5px/1.45 var(--sans);color:var(--mute)}
.tg-out-h .tg-all{margin-left:auto}
.tg-list{display:grid;gap:12px;margin:0;padding:0;list-style:none}
.tg-r{min-width:0;padding:16px 16px 10px 18px;border:1px solid var(--line);border-radius:12px;background:var(--tg-card)}
.tg-r-t{margin:0;font:400 15.5px/1.6 var(--sans);color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere}
.tg-r-k{margin:0 0 4px;font:500 11px/1.3 var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--mute)}
.tg-r-s{margin:0 0 12px;padding-bottom:12px;border-bottom:1px solid var(--line);font:600 15.5px/1.45 var(--sans);color:var(--ink2);overflow-wrap:anywhere}
.tg-r-s.tg-none{font-weight:400;font-style:italic;color:var(--mute)}
.tg-r-f{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px 6px;margin-top:12px;padding-top:8px;border-top:1px solid var(--line)}
.tg-r-ns{display:flex;flex-wrap:wrap;gap:2px 14px;margin-right:auto}
.tg-r-ns .tg-n{margin-left:0}
.tg-n.tg-over{font-weight:600;color:var(--tg-warn)}
.tg-copy{display:inline-flex;align-items:center;gap:6px;height:34px;margin:0;padding:0 10px;border:0;border-radius:8px;background:transparent;font:500 14px/1 var(--sans);color:var(--k-text,var(--ink));white-space:nowrap;cursor:pointer}
.tg-copy:hover{background:var(--sunk);color:var(--ink2)}
.tg-copy:focus-visible{outline:2px solid var(--blue);outline-offset:1px}
.tg-copy svg{display:block;flex:none;width:16px;height:16px}
.tg-copy.tg-done{color:var(--k-ok-ink,var(--ok))}
.tg-copy[hidden]{display:none}

/* the short lines: one card, a row each, the line, its count and Copy on one line */
.tg-list-lines{gap:0;border:1px solid var(--line);border-radius:12px;background:var(--tg-card);overflow:hidden}
.tg-list-lines .tg-r{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;padding:8px 8px 8px 16px;border:0;border-radius:0}
.tg-list-lines .tg-r+.tg-r{border-top:1px solid var(--line)}
.tg-list-lines .tg-r-t{flex:1 1 260px;min-width:0;font-weight:500;color:var(--ink2)}
.tg-list-lines .tg-r-f{flex:none;margin:0;padding:0;border:0}

.tg-msg{margin:12px 0 0;font:500 13.5px/1.45 var(--sans);color:var(--ink2)}
.tg-msg[hidden]{display:none}
.tg-out-f{display:flex;justify-content:center;margin-top:18px}
.tg-again[aria-disabled="true"]{cursor:progress;opacity:.6}

/* ==== widths ========================================================================================================= */
@media (max-width:760px){
  .tg-form{padding:16px 14px 16px}
  .tg-in,.tg-sel select{font-size:16px}
  .tg-sel{max-width:none}
  .tg-btn{flex:1 1 100%}
  .tg-r{padding:14px 12px 8px 14px}
  .tg-list-lines .tg-r{padding:10px 8px 8px 14px}
  .tg-list-lines .tg-r-f{margin-left:auto}
}
@media (max-width:361px){
  .tg-ts{min-height:140px}
}
