/* ============================================================================
   COMPOSITE TRUST SCORE — firm detail page section
   White-card theme on the purple page gradient. Renders below the firm-stats
   grid and above Price & Rating Trends. Companion CSS to firm-show.css.

   OPAQUE-BACKGROUND RULE: outer section uses solid #fff so the purple page
   gradient never bleeds through. All text is dark (#1a1a2e / #333 / #666)
   for WCAG AAA contrast against the white surface.
   ============================================================================ */

.firm-trust-aggregate {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 24px;
    margin: 32px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.firm-trust-aggregate::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--ta-grade-color, #6366f1);
    border-radius: 14px 0 0 14px;
}

.firm-trust-aggregate__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f3f5;
}

.firm-trust-aggregate__title {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.firm-trust-aggregate__title i {
    color: var(--ta-grade-color, #6366f1);
    font-size: 22px;
}

.firm-trust-aggregate__subtitle {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.firm-trust-aggregate__methodology-link {
    color: #6366f1;
    font-weight: 600;
    text-decoration: none;
    margin-left: 6px;
    transition: color 0.2s ease;
}

.firm-trust-aggregate__methodology-link:hover,
.firm-trust-aggregate__methodology-link:focus-visible {
    color: #4f46e5;
    text-decoration: underline;
}

.firm-trust-aggregate__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============ BODY: GAUGE + COMPONENT GRID ============ */

.firm-trust-aggregate__body {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 32px;
    align-items: start;
}

/* ============ GAUGE: CIRCULAR SCORE RING ============ */

.firm-trust-aggregate__gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.firm-trust-aggregate__ring {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background:
        conic-gradient(
            var(--ta-grade-color, #6366f1) 0%,
            var(--ta-grade-color, #6366f1) var(--ta-fill-pct, 0%),
            #f1f3f5 var(--ta-fill-pct, 0%),
            #f1f3f5 100%
        );
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: background 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        inset 0 2px 6px rgba(0, 0, 0, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.06);
}

.firm-trust-aggregate__ring-center {
    width: 144px;
    height: 144px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.firm-trust-aggregate__score {
    font-size: 48px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.firm-trust-aggregate__score-out {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    margin-top: 2px;
}

.firm-trust-aggregate__grade {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 14px;
    background: var(--ta-grade-color, #6366f1);
    color: #fff;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.firm-trust-aggregate__verdict {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #444;
    line-height: 1.55;
    max-width: 240px;
    font-style: italic;
}

/* ============ COMPONENTS: PER-DIMENSION BAR ROWS ============ */

.firm-trust-aggregate__components {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.firm-ta-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
        "head points"
        "bar bar";
    gap: 4px 12px;
    align-items: center;
}

.firm-ta-row__head {
    grid-area: head;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    min-width: 0;
}

.firm-ta-row__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #1a1a2e;
    font-weight: 600;
    flex-shrink: 0;
}

.firm-ta-row__label i {
    color: #6366f1;
    font-size: 15px;
}

.firm-ta-row__value {
    color: #666;
    font-size: 12px;
    font-weight: 500;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.firm-ta-row__points {
    grid-area: points;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    letter-spacing: 0.02em;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.firm-ta-row__bar-wrap {
    grid-area: bar;
    width: 100%;
    height: 8px;
    background: #f1f3f5;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.firm-ta-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.firm-ta-bar--strong  { background: linear-gradient(90deg, #10b981, #059669); }
.firm-ta-bar--solid   { background: linear-gradient(90deg, #6366f1, #4f46e5); }
.firm-ta-bar--weak    { background: linear-gradient(90deg, #f59e0b, #d97706); }
.firm-ta-bar--missing { background: linear-gradient(90deg, #9ca3af, #6b7280); }
.firm-ta-bar--penalty { background: linear-gradient(90deg, #ef4444, #b91c1c); }

/* ============ SUSPENDED STATE ============ */

.firm-trust-aggregate--suspended {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.08);
}

.firm-trust-aggregate--suspended::before {
    background: #ef4444;
}

/* ============ FOOTER ============ */

.firm-trust-aggregate__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f5;
}

.firm-trust-aggregate__legend {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    max-width: 580px;
}

.firm-trust-aggregate__legend i {
    color: #6366f1;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.firm-trust-aggregate__api-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #555;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.firm-trust-aggregate__api-link:hover,
.firm-trust-aggregate__api-link:focus-visible {
    background: #eef0ff;
    border-color: #c7cae0;
    color: #4f46e5;
    transform: translateY(-1px);
}

.firm-trust-aggregate__api-link i {
    font-size: 14px;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 880px) {
    .firm-trust-aggregate__body {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .firm-trust-aggregate__gauge {
        order: 1;
    }

    .firm-trust-aggregate__components {
        order: 2;
    }

    .firm-trust-aggregate__ring {
        width: 160px;
        height: 160px;
    }

    .firm-trust-aggregate__ring-center {
        width: 128px;
        height: 128px;
    }

    .firm-trust-aggregate__score {
        font-size: 42px;
    }
}

@media (max-width: 580px) {
    .firm-trust-aggregate {
        padding: 18px;
        margin: 24px 0;
    }

    .firm-trust-aggregate__header {
        flex-direction: column;
        gap: 8px;
    }

    .firm-trust-aggregate__title {
        font-size: 17px;
    }

    .firm-trust-aggregate__ring {
        width: 140px;
        height: 140px;
    }

    .firm-trust-aggregate__ring-center {
        width: 112px;
        height: 112px;
    }

    .firm-trust-aggregate__score {
        font-size: 36px;
    }

    .firm-ta-row__head {
        font-size: 12px;
    }

    .firm-ta-row__value {
        max-width: 140px;
    }

    .firm-trust-aggregate__footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============ MOTION-SAFETY ============ */

@media (prefers-reduced-motion: reduce) {
    .firm-trust-aggregate__ring,
    .firm-ta-bar,
    .firm-trust-aggregate__methodology-link,
    .firm-trust-aggregate__api-link {
        transition: none;
    }
    .firm-trust-aggregate__api-link:hover,
    .firm-trust-aggregate__api-link:focus-visible {
        transform: none;
    }
}
