/**
 * TechMansion — SEO comparison pages (/compare/<a>-vs-<b>/)
 * and the "Popular comparisons" rail.
 *
 * Scoped under .tm-compare-wrap / .tm-popular-comparisons so it can
 * sit inside any theme. Brand: navy #003366, orange #FF6600. Score
 * bands are matte and match the device listing: <6 red, 6–6.9 amber
 * (dark text — white on this amber fails contrast), >=7 green.
 */

.tm-compare-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    color: #1a2332;
    font-size: 16px;
    line-height: 1.55;
}

.tm-cmp-breadcrumb {
    font-size: 0.875rem;
    color: #5b6b82;
    margin-bottom: 12px;
}

.tm-cmp-breadcrumb a {
    color: #003366;
    text-decoration: none;
}

.tm-cmp-breadcrumb a:hover {
    text-decoration: underline;
}

.tm-cmp-breadcrumb span {
    margin: 0 4px;
}

.tm-cmp-title {
    font-size: 2rem;
    line-height: 1.2;
    margin: 0 0 16px;
    color: #003366;
}

.tm-cmp-rumored-note {
    background: #fff7ed;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.925rem;
    margin: 0 0 20px;
}

/* ---------- Verdict cards ---------- */

.tm-cmp-cards {
    display: flex;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
}

.tm-cmp-device {
    position: relative;
    flex: 1 1 0;
    background: #f4f7fb;
    border: 1px solid #d8e1ee;
    border-radius: 12px;
    padding: 20px 16px 16px;
    text-align: center;
}

.tm-cmp-device--winner {
    border-color: #15803d;
    box-shadow: 0 0 0 1px #15803d;
}

.tm-cmp-winner-tag {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: #15803d;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.tm-cmp-device-media {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.tm-cmp-device-media img {
    max-height: 180px;
    max-width: 100%;
    object-fit: contain;
}

.tm-cmp-placeholder {
    width: 100%;
    height: 180px;
    border-radius: 10px;
    background: #003366;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
}

.tm-cmp-placeholder-mark {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.tm-cmp-placeholder-name {
    font-size: 0.85rem;
    opacity: 0.85;
}

.tm-cmp-device-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #003366;
}

.tm-cmp-device-meta {
    margin: 0 0 12px;
    color: #5b6b82;
    font-size: 0.9rem;
}

.tm-cmp-rumored-pill {
    display: inline-block;
    background: #f59e0b;
    color: #251300;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 2px 8px;
    margin-left: 6px;
    vertical-align: middle;
}

.tm-cmp-overall {
    margin: 0 0 12px;
}

.tm-cmp-score {
    display: inline-block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 8px;
}

.tm-cmp-score-note {
    margin-left: 8px;
    color: #41546f;
    font-weight: 600;
}

.tm-band-green { background: #15803d; color: #fff; }
.tm-band-amber { background: #f59e0b; color: #251300; }
.tm-band-red   { background: #dc2626; color: #fff; }

.tm-cmp-device-link {
    color: #003366;
    font-weight: 600;
    text-decoration: none;
}

.tm-cmp-device-link:hover {
    text-decoration: underline;
}

.tm-cmp-vs {
    align-self: center;
    font-weight: 800;
    color: #ff6600;
    font-size: 1.1rem;
}

/* ---------- Verdict lines + scores ---------- */

.tm-cmp-verdict-lines,
.tm-cmp-scores {
    margin-bottom: 24px;
}

.tm-cmp-verdict-lines h2,
.tm-cmp-scores h2,
.tm-cmp-specs h2 {
    font-size: 1.35rem;
    color: #003366;
    margin: 0 0 10px;
}

.tm-cmp-verdict-lines ul {
    margin: 0;
    padding-left: 20px;
}

.tm-cmp-verdict-lines li {
    margin-bottom: 6px;
}

.tm-cmp-score-table,
.tm-cmp-spec-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.tm-cmp-score-table th,
.tm-cmp-score-table td,
.tm-cmp-spec-table th,
.tm-cmp-spec-table td {
    border: 1px solid #d8e1ee;
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    font-size: 0.925rem;
}

.tm-cmp-score-table thead th,
.tm-cmp-spec-table thead th {
    background: #003366;
    color: #fff;
    font-weight: 700;
}

.tm-cmp-score-table tbody th,
.tm-cmp-spec-table tbody th {
    background: #f4f7fb;
    font-weight: 600;
    width: 22%;
}

.tm-cmp-spec-table td {
    width: 39%;
}

.tm-cmp-cell--win {
    background: #eefbf2;
}

.tm-cmp-bar {
    display: block;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
    max-width: 180px;
}

.tm-cmp-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.tm-cmp-cell-score {
    font-weight: 700;
}

.tm-cmp-win-tag {
    display: inline-block;
    margin-left: 8px;
    background: #15803d;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 2px 8px;
    vertical-align: middle;
}

.tm-cmp-tie-tag {
    display: inline-block;
    margin-left: 8px;
    background: #e2e8f0;
    color: #41546f;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 999px;
    padding: 2px 8px;
    vertical-align: middle;
}

.tm-cmp-missing {
    /* 6.7.6 (audit B2): #94a3b8 on white is 2.56:1; #64748b is 4.76:1. */
    color: #64748b;
}

/* ---------- CTA ---------- */

.tm-cmp-cta {
    margin: 8px 0 32px;
}

/* 6.7.6 (audit B1): white on #FF6600 is 2.94:1 — fails. The
   button takes the deepened house orange instead: white on
   #c25100 measures 4.70:1, white on the #9a3e00 hover 6.85:1. */
.tm-cmp-cta-button {
    display: inline-block;
    background: #c25100;
    color: #fff;
    font-weight: 700;
    padding: 12px 22px;
    border-radius: 8px;
    text-decoration: none;
}

.tm-cmp-cta-button:hover {
    background: #9a3e00;
    color: #fff;
}

.tm-cmp-cta-note {
    margin-left: 12px;
    color: #5b6b82;
    font-size: 0.9rem;
}

/* ---------- Spec groups ---------- */

/* 6.7.6 (audit B5): the spec section is ONE table now — the
   per-group <h3> headings are gone, replaced by group
   subheader rows inside the table that mirror the app's
   .tmx-grouphead treatment (deep navy band, white uppercase
   label). The generic tbody th rule above (pale background,
   22% width) must not leak into the band: this selector
   outranks it and resets the width for the colspan cell. */
.tm-cmp-spec-table tbody tr.tm-cmp-grouphead th {
    background: #0f2440;
    color: #ffffff;
    width: auto;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 16px;
    border-bottom: none;
}

.tm-cmp-table-scroll {
    overflow-x: auto;
}

/* 6.7.6 (audit B6): the verdict cards' price line — stored
   price in navy, or the Amazon check-price link in the
   deepened house orange when no price is stored. */
.tm-cmp-device-price {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #003366;
}

.tm-cmp-device-price a {
    color: #c25100;
    text-decoration: none;
}

.tm-cmp-device-price a:hover {
    text-decoration: underline;
}

/* ---------- Popular comparisons rail (6.7.3: cards) ----------
 * Restyled from a plain list to cards in the device page's
 * "Similar devices" visual language. The metrics are mirrored
 * here (not inherited from the theme) so the rail renders the
 * same on /compare/ pages, where the theme's device-card rules
 * may not apply: white panel section (1.6rem padding, 20px
 * radius, hairline navy border, soft navy shadow), section
 * heading 1.35rem/800 navy, cards white with a #e3eaf1 hairline,
 * 20px radius and the same two-stop shadow + hover lift as
 * .tm-dcard.tm10-card, card body padding 16px 18px 18px.
 * Score chips reuse the matte .tm-band-* classes above; the
 * hover orange for title text is deepened to #c25100 because
 * pure #FF6600 on white is 2.94:1 — #c25100 measures 4.70:1.
 */

.tm-popular-comparisons {
    margin: 28px 0;
    padding: 1.6rem;
    background: #fff;
    border: 1px solid rgba(0, 51, 102, 0.09);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0, 51, 102, 0.05), 0 16px 36px -18px rgba(0, 51, 102, 0.22);
}

.tm-popular-comparisons h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #003366;
    margin: 0 0 1.1rem;
}

.tm-cmp-rail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tm-cmp-rail-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    /* No height:100% — a percentage height on a grid item whose
       row is content-sized resolves against the wrong box in
       Chrome and the card outgrows its row (rig-proven). The
       grid's default stretch already equalises row heights. */
    padding: 16px 18px 18px;
    background: #fff;
    border: 1px solid #e3eaf1;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(10, 37, 71, 0.05), 0 10px 30px -12px rgba(10, 37, 71, 0.14);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.tm-cmp-rail-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 51, 102, 0.17);
    box-shadow: 0 2px 4px rgba(10, 37, 71, 0.06), 0 18px 38px -14px rgba(10, 37, 71, 0.22);
}

.tm-cmp-rail-card:focus-within {
    border-color: rgba(255, 102, 0, 0.55);
}

.tm-cmp-rail-link {
    color: #0b1f3a;
    font-size: 1.06rem;
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: -0.015em;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Reserve two title lines so the score rows align across a
       row of cards even when a pair title wraps to one line. */
    min-height: 2.72rem;
}

.tm-cmp-rail-link:hover,
.tm-cmp-rail-link:focus-visible {
    color: #c25100;
    text-decoration: none;
}

.tm-cmp-rail-scores {
    display: block;
    min-width: 0;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e3eaf1;
}

.tm-cmp-rail-caption {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5b6b82;
    margin-bottom: 8px;
}

.tm-cmp-rail-sides {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.tm-cmp-rail-side {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tm-cmp-rail-name {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: #41546f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-cmp-rail-chip {
    align-self: flex-start;
    display: inline-block;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    padding: 7px 11px;
    border-radius: 8px;
}

.tm-cmp-rail-vs {
    flex: 0 0 auto;
    align-self: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: #c25100;
}

/* Rail grid steps: 4 across on wide screens, 2 on tablet/small,
   1 on narrow phones (mirrors the site grid's step-down rhythm). */
@media (max-width: 1150px) {
    .tm-cmp-rail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tm-popular-comparisons {
        padding: 1.15rem;
    }
}

@media (max-width: 560px) {
    .tm-cmp-rail-grid {
        /* minmax(0, …), not plain 1fr: a plain 1fr track sizes to
           the card's min-content and overflows narrow phones. */
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tm-cmp-rail-card {
        transition: none;
    }

    .tm-cmp-rail-card:hover {
        transform: none;
    }
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
    .tm-cmp-title {
        font-size: 1.5rem;
    }

    .tm-cmp-cards {
        flex-direction: column;
    }

    .tm-cmp-vs {
        text-align: center;
    }

    .tm-cmp-device-media,
    .tm-cmp-placeholder {
        height: 150px;
    }

    .tm-cmp-device-media img {
        max-height: 150px;
    }

    .tm-cmp-cta-note {
        display: block;
        margin: 8px 0 0;
    }

    .tm-cmp-score-table th,
    .tm-cmp-score-table td,
    .tm-cmp-spec-table th,
    .tm-cmp-spec-table td {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
}
