/* ═══════════════════════════════════════════════════════
   EMERGY AI OPS: the free tools (/tools/ai-policy-builder, /tools/ai-task-finder and the /he twins).
   Loaded after site.css, brief.css, page.css (and rtl.css on Hebrew pages). Tokens from site.css only.
   Logical properties, so the Hebrew pages mirror without extra rules.
   ═══════════════════════════════════════════════════════ */

.tool {
    max-width: 880px; padding: 30px 32px 32px; border: 1px solid var(--line); border-radius: var(--radius-card);
    background: linear-gradient(180deg, rgba(14, 30, 52, 0.85), rgba(8, 17, 32, 0.9));
    box-shadow: 0 1px 0 rgba(139, 213, 255, 0.06) inset;
}
.tool [hidden] { display: none !important; }
.tool button { cursor: pointer; }
.tool-noscript { color: var(--amber); font-size: 15px; margin-bottom: 18px; }

/* Progress */
.tool-top { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.tool-count { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sky); white-space: nowrap; min-height: 1.2em; }
.tool-progress { flex: 1; height: 3px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.tool-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width 0.3s ease; }
[dir=rtl] .tool-progress span { background: linear-gradient(270deg, var(--blue), var(--cyan)); }
.tool:not(.is-ready) .tool-top, .tool:not(.is-ready) .tool-nav { display: none; }

/* A question */
.tool-step { border: 0; margin: 0; padding: 0; min-width: 0; }
.tool-step:focus { outline: none; }
.tool:not(.is-ready) .tool-step + .tool-step { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line-soft); }
.tool-q { padding: 0; font-family: var(--grotesk); font-size: clamp(20px, 2.3vw, 25px); font-weight: 600; letter-spacing: -0.012em; line-height: 1.3; color: var(--text); }
.tool-hint { margin: 8px 0 18px; font-size: 14.5px; line-height: 1.7; color: var(--muted); }
.tool-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tool-opts.row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tool-group + .tool-group { margin-top: 18px; }
.tool-sub { font-size: 14.5px; font-weight: 600; color: #D6E2F5; margin-bottom: 10px; }

/* An answer: the native input stays (keyboard, screen readers), the span draws it */
.tool-opt { position: relative; display: block; }
.tool-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; inset-inline-start: 18px; top: 18px; margin: 0; }
.tool-opt span {
    position: relative; display: flex; align-items: center; min-height: 52px; height: 100%;
    padding: 12px 16px; padding-inline-start: 46px; border: 1px solid var(--line); border-radius: 12px;
    background: rgba(12, 26, 46, 0.55); color: #D6E2F5; font-size: 15px; line-height: 1.45; cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.tool-opt span::before {
    content: ''; position: absolute; inset-inline-start: 16px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
    border: 1.5px solid var(--line-strong); border-radius: 50%; background: transparent; transition: all 0.2s ease;
}
.tool-opt input[type=checkbox] + span::before { border-radius: 5px; }
.tool-opt:hover span { border-color: var(--line-strong); background: rgba(56, 189, 248, 0.05); }
.tool-opt input:checked + span { border-color: var(--cyan); background: rgba(56, 189, 248, 0.11); color: var(--text); }
.tool-opt input:checked + span::before { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 0 3px rgba(5, 10, 20, 0.9) inset, 0 0 10px var(--glow); }
.tool-opt input[type=checkbox]:checked + span::before { box-shadow: 0 0 0 2.5px rgba(5, 10, 20, 0.9) inset, 0 0 10px var(--glow); }
.tool-opt input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.tool-opts.row .tool-opt span { justify-content: flex-start; }

.tool-error { margin-top: 16px; color: var(--amber); font-size: 14.5px; }
.tool-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.tool-nav .btn-primary { margin-inline-start: auto; }

/* Result */
.tool-result-head { margin-bottom: 24px; }
.tool-result-k { font-family: var(--grotesk); font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; letter-spacing: -0.012em; color: var(--text); }
.tool-result-k:focus { outline: none; }
.tool-result-text { margin-top: 6px; font-size: 15px; color: var(--muted); line-height: 1.7; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.tool-actions .btn-primary, .tool-actions .btn-ghost { padding: 12px 20px; }
.tool-status { margin-top: 12px; min-height: 1.4em; font-size: 14px; color: var(--mint); }
.tool-note { margin-top: 14px; font-size: 13.5px; line-height: 1.75; color: var(--dim); }

/* The policy document */
.policy-doc { padding: 34px 36px 30px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--bg-3); color: #D6E2F5; }
.pd-title { font-family: var(--grotesk); font-size: clamp(24px, 3vw, 30px); font-weight: 600; letter-spacing: -0.014em; color: var(--text); }
.pd-meta { margin-top: 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.pd-sec { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.pd-sec h4 { font-family: var(--grotesk); font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.pd-sec p { font-size: 15px; line-height: 1.8; }
.pd-sec p + p, .pd-sec ul + p, .pd-sec p + ul, .pd-sec ul + .pd-k { margin-top: 10px; }
.pd-k { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sky); margin-top: 14px; }
.pd-sec ul, .pd-sec ol { margin-top: 6px; padding-inline-start: 22px; }
.pd-sec li { font-size: 15px; line-height: 1.75; margin-top: 4px; }
.pd-sec li::marker { color: var(--cyan); }
.pd-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.pd-cols .pd-k { margin-top: 6px; }
.pd-flag { margin-top: 12px; padding: 12px 14px; border: 1px dashed rgba(247, 185, 85, 0.45); border-radius: 10px; color: #F3D9A8; font-size: 14.5px; line-height: 1.7; }
.pd-sign { margin-top: 26px; font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.pd-note { margin-top: 10px; font-size: 12.5px; color: var(--dim); }
.pd-checklist { margin-top: 30px; padding: 22px 22px 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(56, 189, 248, 0.04); }

/* The task finder result */
.tf-doc { display: grid; gap: 16px; }
.tf-card { padding: 26px 26px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-3); }
.tf-card.first { border-color: rgba(56, 189, 248, 0.5); box-shadow: 0 0 40px -18px rgba(56, 189, 248, 0.5); }
.tf-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tf-rank-n { width: 36px; height: 36px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-family: var(--grotesk); font-weight: 600; color: #fff; border: 1px solid var(--cyan); background: rgba(56, 189, 248, 0.14); }
.tf-top h4 { flex: 1; min-width: 0; font-family: var(--grotesk); font-size: 19px; font-weight: 600; color: var(--text); line-height: 1.3; }
.tf-score { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--sky); padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(56, 189, 248, 0.06); white-space: nowrap; }
.tf-k { margin-top: 18px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sky); }
.tf-card p:not(.tf-k) { margin-top: 6px; font-size: 15px; line-height: 1.75; color: #D6E2F5; }
.tf-card p.tf-flag { color: #F3D9A8; font-size: 14.5px; padding: 10px 12px; border: 1px dashed rgba(247, 185, 85, 0.45); border-radius: 10px; margin-top: 10px; }
.tf-card ul { margin-top: 6px; padding-inline-start: 20px; }
.tf-card li { font-size: 14.5px; line-height: 1.7; color: #D6E2F5; margin-top: 3px; }
.tf-card li::marker { color: var(--cyan); }
.tf-rank { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.tf-rank-h { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sky); margin-bottom: 12px; }
.tf-rank-list { list-style: none; display: grid; gap: 8px; }
.tf-rank-list li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 34px; gap: 12px; align-items: center; font-size: 14.5px; color: #D6E2F5; }
.tf-bar { height: 8px; border-radius: 8px; background: var(--line-soft); overflow: hidden; }
.tf-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
[dir=rtl] .tf-bar i { background: linear-gradient(270deg, var(--blue), var(--cyan)); }
.tf-rank-list b { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--sky); text-align: end; }

/* Call to action under the result */
.tool-cta { margin-top: 28px; padding: 28px 26px; text-align: center; border: 1px solid var(--line); border-radius: 16px;
    background: radial-gradient(ellipse 70% 80% at 50% 0%, rgba(56, 189, 248, 0.12), transparent 70%), var(--bg-2); }
.tool-cta-h { font-family: var(--grotesk); font-size: 22px; font-weight: 600; color: var(--text); }
.tool-cta > p { margin: 8px auto 0; max-width: 600px; font-size: 15px; line-height: 1.75; color: var(--muted); }
.tool-cta .page-actions { justify-content: center; margin-top: 20px; }
.tool-cta .pg-fine { margin-top: 14px; }

/* Hebrew: no capitals or wide tracking on the mono labels */
[dir=rtl] .tool-count, [dir=rtl] .pd-meta, [dir=rtl] .pd-k, [dir=rtl] .tf-k, [dir=rtl] .tf-rank-h, [dir=rtl] .pd-sign {
    font-family: var(--sans); font-size: 13px; letter-spacing: 0.02em; text-transform: none;
}
[dir=rtl] .tf-score { font-family: var(--sans); font-size: 13px; letter-spacing: 0; }
.ltr-run { direction: ltr; unicode-bidi: isolate; }

@media (max-width: 768px) {
    .tool { padding: 22px 18px 24px; }
    .tool-opts, .tool-opts.row { grid-template-columns: minmax(0, 1fr); }
    .tool-opts.row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tool-nav .btn-primary, .tool-nav .btn-ghost { width: auto; flex: 1; justify-content: center; padding: 14px 16px; }
    .tool-actions .btn-primary, .tool-actions .btn-ghost { width: auto; flex: 1 1 140px; justify-content: center; }
    .policy-doc { padding: 22px 18px 20px; }
    .pd-cols { grid-template-columns: minmax(0, 1fr); }
    .tf-card { padding: 20px 18px; }
    .tf-top h4 { flex: 1 1 calc(100% - 52px); font-size: 18px; }
    .tf-score { margin-inline-start: 50px; }
    .tf-rank-list li { grid-template-columns: minmax(0, 1fr) 72px 30px; gap: 10px; }
    .tool-cta { padding: 22px 16px; }
    .tool-cta .page-actions { flex-direction: column; align-items: center; }
}

/* Print: only the policy (assets/policy-builder.js copies it into #toolPrint, a direct child of body) */
#toolPrint { display: none; }
@media print {
    html.tool-print body { background: #fff !important; color: #111 !important; }
    html.tool-print body > *:not(#toolPrint) { display: none !important; }
    html.tool-print #toolPrint { display: block; }
    /* Compact type so the policy fits one page; the checklist stays in one piece, so it moves to page 2 when page 1 is full */
    #toolPrint .policy-doc { border: 0; padding: 0; background: #fff; color: #111; font-size: 8.5pt; line-height: 1.28; }
    #toolPrint .pd-title { font-size: 15pt; color: #000; }
    #toolPrint .pd-meta { margin-top: 1pt; font-size: 7pt; letter-spacing: 0.06em; color: #555; }
    #toolPrint .pd-sec { margin-top: 5pt; padding-top: 4pt; border-top: 0.5pt solid #bbb; }
    #toolPrint .pd-sec h4 { margin-bottom: 1.5pt; font-size: 10pt; color: #000; }
    #toolPrint .pd-sec p, #toolPrint .pd-sec li { font-size: 8.5pt; line-height: 1.28; }
    #toolPrint .pd-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14pt; }
    #toolPrint .pd-sec p + p, #toolPrint .pd-sec ul + p, #toolPrint .pd-sec p + ul, #toolPrint .pd-sec ul + .pd-k { margin-top: 2.5pt; }
    #toolPrint .pd-k { margin-top: 3pt; font-size: 7pt; letter-spacing: 0.08em; color: #555; }
    #toolPrint .pd-sec ul, #toolPrint .pd-sec ol { margin-top: 1.5pt; padding-inline-start: 13pt; }
    #toolPrint .pd-sec li { margin-top: 0.5pt; break-inside: avoid; }
    #toolPrint .pd-sec li::marker { color: #000; }
    #toolPrint .pd-flag { margin-top: 3pt; padding: 2.5pt 6pt; border-color: #999; color: #111; font-size: 8.2pt; }
    #toolPrint .pd-sign { margin-top: 7pt; font-size: 8.5pt; color: #222; }
    #toolPrint .pd-note { margin-top: 2pt; font-size: 7pt; color: #555; }
    #toolPrint .pd-checklist { break-inside: avoid; border: 0; background: none; margin-top: 14pt; padding: 0; }
    #toolPrint .pd-checklist h4 { font-size: 13pt; margin-bottom: 6pt; }
    #toolPrint .pd-checklist ol { padding-inline-start: 22pt; }
    #toolPrint .pd-checklist li { font-size: 10.5pt; line-height: 1.5; margin-top: 4pt; }
    @page { margin: 11mm 13mm; }
}
