/* Compliance scanner — /compliance
 *
 * Tokens only (DESIGN.md is the contract; assets/css/tokens.css is the
 * source of truth). Reuses .card, .grade-letter--*, .ent-bar, .ent-badge.
 * What is new here and nowhere else in the codebase:
 *   - severity badges (critical/high/medium/low): only local
 *     .sec-topfix-sev--* existed before
 *   - the before/after consent contrast, this tool's signature block
 *   - findings as CARDS on mobile instead of a horizontally scrolled table
 *     (ТЗ §52; the house pattern is horizontal scroll, which buries the
 *     severity column exactly where it matters most)
 */

/* ── form ─────────────────────────────────────────────────────────────── */
.cmp-form-note {
    margin-top: 10px;
    font-size: .8125rem;
    color: var(--muted);
}

/* ── progress ─────────────────────────────────────────────────────────── */
.cmp-progress__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.cmp-progress__phase {
    font-weight: 600;
    color: var(--text);
}

.cmp-progress__count {
    font-family: var(--mono);
    font-size: .8125rem;
    color: var(--muted2);
}

.cmp-progress__note {
    margin-top: 10px;
    font-size: .8125rem;
    color: var(--muted);
}

/* ── score ────────────────────────────────────────────────────────────── */
.cmp-score {
    display: flex;
    align-items: center;
    gap: 24px;
}

.cmp-score__grade {
    flex: 0 0 auto;
}

.cmp-score__body {
    min-width: 0;
}

.cmp-score__title {
    margin: 0 0 4px;
    font-size: 1.375rem;
    font-weight: 600;
}

.cmp-score__meta {
    margin: 0;
    font-size: .875rem;
    color: var(--muted2);
    word-break: break-word;
}

.cmp-frameworks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.cmp-framework {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    font-size: .8125rem;
}

.cmp-framework__name {
    color: var(--muted2);
}

.cmp-framework__value {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--text);
}

/* ── signature: before / after consent ────────────────────────────────── */
.cmp-section-title {
    margin: 0 0 6px;
    font-size: 1.125rem;
    font-weight: 600;
}

.cmp-section-lead {
    margin: 0 0 18px;
    font-size: .875rem;
    color: var(--muted2);
}

.cmp-consent__grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.cmp-consent__side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 18px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    background: var(--surface2);
    text-align: center;
}

/* Before-consent is the number that carries the risk, so it is the one
   that gets colour. After-consent stays neutral: loading trackers once
   the visitor agreed is normal behaviour, not a finding. */
.cmp-consent__side--before.is-risk {
    border-color: var(--status-warn-border, var(--border3));
    background: var(--status-warn-bg, var(--surface2));
}

.cmp-consent__label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.cmp-consent__value {
    font-family: var(--mono);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.cmp-consent__side--before.is-risk .cmp-consent__value {
    color: var(--yellow);
}

.cmp-consent__unit {
    font-size: .8125rem;
    color: var(--muted2);
}

.cmp-consent__arrow {
    width: 28px;
    height: 2px;
    background: var(--border3);
    position: relative;
}

.cmp-consent__arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    border-left: 7px solid var(--border3);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.cmp-trackers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 18px;
}

.cmp-tracker {
    padding: 3px 9px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    background: var(--surface2);
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--muted2);
}

.cmp-trackers__more {
    align-self: center;
    font-size: .75rem;
    color: var(--muted);
}

/* ── findings ─────────────────────────────────────────────────────────── */
.cmp-finding {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.cmp-finding:first-child {
    border-top: 0;
    padding-top: 4px;
}

.cmp-finding__label {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--text);
}

.cmp-finding__pages {
    margin: 0;
    font-size: .8125rem;
    color: var(--muted);
    word-break: break-word;
}

.cmp-finding__page {
    font-family: var(--mono);
}

/* Severity badges — the codebase had no global set, only page-local
   .sec-topfix-sev--* in security.css. Built on the shared status tokens
   so a future theme change moves them with everything else. */
.cmp-sev {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid var(--border2);
    background: var(--surface2);
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    color: var(--muted2);
}

.cmp-sev--critical {
    border-color: var(--status-fail-border, var(--border3));
    background: var(--status-fail-bg, var(--surface2));
    color: var(--red);
}

.cmp-sev--high {
    border-color: var(--status-fail-border, var(--border3));
    background: var(--status-fail-bg, var(--surface2));
    color: var(--red);
}

.cmp-sev--medium {
    border-color: var(--status-warn-border, var(--border3));
    background: var(--status-warn-bg, var(--surface2));
    color: var(--yellow);
}

.cmp-sev--low {
    color: var(--muted2);
}

.cmp-disclaimer {
    margin: 18px 0 0;
    padding: 14px 16px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--muted2);
}

/* ── mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .cmp-score {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    /* Stack the contrast vertically and turn the connector into a
       downward arrow — side-by-side at 360px would squeeze both numbers
       below legibility. */
    .cmp-consent__grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cmp-consent__arrow {
        width: 2px;
        height: 22px;
        margin: 0 auto;
    }

    .cmp-consent__arrow::after {
        right: -3px;
        top: auto;
        bottom: -1px;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 7px solid var(--border3);
        border-bottom: 0;
    }

    /* Findings become cards: the severity badge goes above the text
       instead of into a column that horizontal scroll would hide. */
    .cmp-finding {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

/* ── findings: explanation + recommendation ───────────────────────────── */
.cmp-finding {
    display: block;
    padding: 18px 0;
    border-top: 1px solid var(--border);
}

.cmp-finding__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.cmp-finding__label {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
}

.cmp-finding__body {
    margin: 0 0 8px;
    font-size: .9375rem;
    line-height: 1.55;
    color: var(--text2, var(--muted2));
}

.cmp-finding__why {
    color: var(--muted2);
}

.cmp-finding__tag {
    font-weight: 600;
    color: var(--muted);
}

/* The recommendation is the line people act on, so it gets the accent
   rail — the one place in the card that earns emphasis. */
.cmp-finding__fix {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface2);
    font-size: .9375rem;
    line-height: 1.55;
    color: var(--text);
}

.cmp-finding__pages {
    margin: 10px 0 0;
    font-size: .8125rem;
    color: var(--muted);
}

.cmp-finding__page {
    font-family: var(--mono);
    color: var(--muted2);
    text-decoration: none;
    border-bottom: 1px dotted var(--border3);
}

.cmp-finding__page:hover,
.cmp-finding__page:focus-visible {
    color: var(--accent);
}

.cmp-trackers__lead {
    flex: 1 0 100%;
    margin: 0 0 4px;
    font-size: .8125rem;
    color: var(--muted);
}

/* ── hero artwork ─────────────────────────────────────────────────────── */
/* The scan's whole thesis in one image: scattered data crossing a consent
   threshold on the left, ordered flow on the right. Decorative — the same
   thing is said in words directly below, so it carries alt="". */
/* The hero render lives BEHIND the card content: the form must be visible
   the moment the page loads, so the art gets zero vertical space of its
   own. The render is near-black already — a low opacity plus an edge fade
   keeps the text readable on top without a separate overlay element. */
.tool-hero .card {
    position: relative;
    overflow: hidden;
}

.cmp-hero-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.22;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(130% 120% at 50% 40%, rgba(0, 0, 0, 1) 40%, transparent 100%);
    mask-image: radial-gradient(130% 120% at 50% 40%, rgba(0, 0, 0, 1) 40%, transparent 100%);
}

/* Content paints above the positioned background layer. */
.tool-hero .card > :not(.cmp-hero-art) {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: no-preference) {
    .cmp-hero-art {
        animation: cmpHeroIn .9s ease-out both;
    }

    @keyframes cmpHeroIn {
        from { opacity: 0; }
        to   { opacity: 0.22; }
    }
}

/* ── PDF export ─────────────────────────────────────────────────────── */

.cmp-score__actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Plans without compliance_pdf see a quiet upsell link instead of a
   button that would 403 — the page decides which one to render. */
.cmp-pdf-upsell {
    font-size: 13px;
    color: var(--muted2);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cmp-pdf-upsell:hover {
    color: var(--text);
}

.cmp-pdf-upsell:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}


/* ── Fine chips (КоАП exposure) ─────────────────────────────────────── */

/* Rouble figure sits at the row's end: the severity says how bad,
   the chip says what it can cost. Only fail-status findings carry one. */
.cmp-finding__head { flex-wrap: wrap; }

.cmp-fine {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
    color: var(--yellow);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    background: var(--surface2);
}


/* ── Check catalog (rendered from the rule registry) ────────────────── */

.cmp-catalog { margin: 46px 0 8px; }

.cmp-catalog__title {
    font-size: 26px;
    text-align: center;
    margin: 0 0 10px;
}

.cmp-catalog__sub {
    max-width: 720px;
    margin: 0 auto 22px;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted2);
}

.cmp-catalog__art {
    display: block;
    width: 100%;
    max-width: 980px;
    height: auto;
    margin: 0 auto 26px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    -webkit-mask-image: radial-gradient(140% 120% at 50% 50%, rgba(0, 0, 0, 1) 60%, transparent 100%);
    mask-image: radial-gradient(140% 120% at 50% 50%, rgba(0, 0, 0, 1) 60%, transparent 100%);
}

.cmp-catalog__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.cmp-catalog__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.cmp-catalog__cat {
    font-size: 14px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted2);
    margin: 0 0 10px;
}

.cmp-catalog__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cmp-catalog__rule {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
    line-height: 1.4;
}

.cmp-catalog__dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    align-self: center;
}

.cmp-catalog__dot--critical { background: var(--red); }
.cmp-catalog__dot--high     { background: var(--yellow); }
.cmp-catalog__dot--medium   { background: var(--accent); }
.cmp-catalog__dot--low      { background: var(--muted); }

.cmp-catalog__label { color: var(--text); }

.cmp-catalog__fine {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 11px;
    white-space: nowrap;
    color: var(--yellow);
}

.cmp-catalog__note {
    max-width: 720px;
    margin: 20px auto 0;
    text-align: center;
    font-size: 13.5px;
    color: var(--muted2);
}

@media (max-width: 600px) {
    .cmp-catalog__grid { grid-template-columns: 1fr; }
    .cmp-catalog__title { font-size: 21px; }
}

/* ── Evidence screenshots (root page, before/after consent) ─────────── */
.cmp-evidence {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

.cmp-evidence__shot {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface2);
}

.cmp-evidence__shot img {
    display: block;
    width: 100%;
    height: auto;
}

.cmp-evidence__caption {
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--muted2);
    border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
    .cmp-evidence { grid-template-columns: 1fr; }
}

/* ── Policy draft generator ─────────────────────────────────────────── */
.cmp-draft__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 12px;
    margin: 16px 0;
}

.cmp-draft__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cmp-draft__label {
    font-size: 12.5px;
    color: var(--muted2);
}

.cmp-draft__field input {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    min-height: 44px;
}

.cmp-draft__field input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.cmp-draft__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.cmp-draft__note {
    font-size: 12.5px;
    color: var(--muted);
    max-width: 480px;
}

@media (max-width: 600px) {
    .cmp-draft__grid { grid-template-columns: 1fr; }
}

/* ── RKN operator-registry check ────────────────────────────────────── */
.cmp-rkn__row {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.cmp-rkn__row input {
    flex: 1 1 220px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    min-height: 44px;
    font-family: var(--mono);
}

.cmp-rkn__row input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.cmp-rkn__result {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.5;
}

.cmp-rkn__result--found { border-color: var(--green); }
.cmp-rkn__result--notfound { border-color: var(--yellow); }
.cmp-rkn__result--unavailable,
.cmp-rkn__result--invalid { border-color: var(--border2); color: var(--muted2); }

.cmp-rkn__verdict {
    display: block;
    color: var(--green);
    font-weight: 600;
    margin-bottom: 6px;
}

.cmp-rkn__entry { margin-top: 8px; }

/* ── Landing ticker: recent public reports ──────────────────────────── */
.cmp-ticker {
    margin: 14px 0 4px;
}

.cmp-ticker__stats {
    font-size: 12.5px;
    color: var(--muted2);
    margin: 0 0 8px;
    text-align: center;
}

.cmp-ticker__strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.cmp-ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    min-height: 36px;
}

.cmp-ticker__item:hover {
    border-color: var(--border2);
}

.cmp-ticker__grade {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 13px;
}

.cmp-ticker__grade--good { color: var(--green); }
.cmp-ticker__grade--mid  { color: var(--yellow); }
.cmp-ticker__grade--bad  { color: var(--red); }

.cmp-ticker__host {
    font-family: var(--mono);
    font-size: 12.5px;
}

.cmp-ticker__age {
    font-size: 12px;
    color: var(--muted);
}
