/* Cyclists Hub comparison box ("X vs. Y" articles): front-end styles. Same tokens as review-box.css.
   Rules are scoped ".chcb .chcb-body …" so they outrank theme rules like ".entry-content p / ul / a / button".
   The layout switches on the box width (container queries), so it also fits the admin preview. */

.chcb {
    --chcb-main: #1d3461;
    --chcb-main-dark: #1a2f58;
    --chcb-medium: #247ba0;
    --chcb-light: #e7f8ff;
    --chcb-cta: #ff1861;
    --chcb-cta-dark: #e01050;
    --chcb-border: #e0e6ef;
    --chcb-line: #c3dfec;
    --chcb-good: #00de00;   /* same green as the review box and /ratings/ score badges */
    --chcb-mid: #ffa500;
    --chcb-bad: #ff0000;
    --chcb-n: 2;
    container-type: inline-size;
    margin: 0 0 2em;
    border: 1px solid var(--chcb-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 4px #1d346112, 0 8px 24px #1d346114;
    color: var(--chcb-main);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.chcb *,
.chcb *::before,
.chcb *::after {
    box-sizing: border-box;
}

.chcb .chrb-good { --chcb-band: var(--chcb-good); }
.chcb .chrb-mid  { --chcb-band: var(--chcb-mid); }
.chcb .chrb-bad  { --chcb-band: var(--chcb-bad); }

/* ---------- Header ---------- */

.chcb .chcb-title {
    padding: 12px 16px;
    border-radius: 10px 10px 0 0;
    background: linear-gradient(135deg, var(--chcb-main) 0%, var(--chcb-main-dark) 100%);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.chcb .chcb-draft {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: #fff;
    color: var(--chcb-main);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    vertical-align: middle;
}

.chcb .chcb-title a.chcb-edit,
.chcb .chcb-title a.chcb-edit:visited {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    vertical-align: middle;
}

.chcb .chcb-body {
    padding: 0 24px 24px;
}

/* ".chcb.chcb" doubles the class so these resets outrank theme rules such as ".single-post .entry-content ul". */
.chcb.chcb .chcb-body p,
.chcb.chcb .chcb-body ul {
    margin: 0;
    padding: 0;
}

.chcb.chcb .chcb-body ul {
    list-style: none;
}

.chcb.chcb .chcb-body li {
    margin: 0;
    list-style: none;
}

/* ---------- Table: label column + one column per product ---------- */

.chcb .chcb-row {
    position: relative;
    display: grid;
    grid-template-columns: 200px repeat(var(--chcb-n), minmax(0, 1fr));
    align-items: stretch;
    border-top: 1px solid var(--chcb-border);
}

.chcb .chcb-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-weight: 500;
}

.chcb .chcb-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    text-align: center;
}

.chcb .chcb-cell.chcb-spec {
    font-size: 15px;
    font-weight: 700;
}

.chcb .chcb-line {
    display: block;
}

/* Second version of a product (e.g. Solar): its value on a second line, only where it differs. */
.chcb .chcb-variant {
    display: block;
    flex-basis: 100%;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.chcb .chcb-variant .chcb-alt {
    display: inline;
}

.chcb .chcb-alt {
    display: block;
    font-weight: 500;
    white-space: nowrap;
}

.chcb .chcb-photos {
    border-top: 0;
}

.chcb .chcb-photos .chcb-cell {
    padding: 14px 10px 0;
}

.chcb .chcb-body img.chcb-thumb {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    aspect-ratio: 16 / 10;
    margin: 0;
    border-radius: 5px;
    background: var(--chcb-light);
    object-fit: cover;
}

/* Table header: the product names. */
.chcb .chcb-heads {
    border-top: 0;
    border-bottom: 2px solid var(--chcb-main);
}

.chcb .chcb-heads .chcb-cell {
    padding: 10px 6px;
}

.chcb .chcb-heads:first-child .chcb-cell {
    padding-top: 14px;
}

.chcb .chcb-heads + .chcb-row {
    border-top: 0;
}

/* Overall Score: the first score row, its numbers in line with the criterion scores below. */
.chcb .chcb-overall .chcb-row-label {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

.chcb .chcb-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* A row where a second version (e.g. Solar) adds a line: values start on the same line, the extra line hangs below. */
.chcb .chcb-row-top .chcb-cell {
    justify-content: flex-start;
    align-content: flex-start;
}

.chcb .chcb-row-top .chcb-row-label {
    align-items: flex-start;
}

/* The label then sits on the line of the numbers: half the difference between chip and text height. */
.chcb .chcb-crit.chcb-row-top .chcb-row-label {
    padding-top: 10px;
}

.chcb .chcb-overall.chcb-row-top .chcb-row-label {
    padding-top: 17px;
}

.chcb .chcb-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

.chcb .chcb-chip {
    display: inline-block;
    min-width: 40px;
    padding: 3px 0;
    border-radius: 5px;
    background: var(--chcb-band);
    color: #fff;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.chcb .chcb-chip.chcb-chip-big {
    min-width: 58px;
    padding: 4px 8px;
    font-size: 22px;
}

/* ---------- Tooltips ---------- */

.chcb .chcb-body button.chcb-info {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--chcb-medium);
    border-radius: 50%;
    box-shadow: none;
    background: transparent;
    color: var(--chcb-medium);
    font: 700 11px/1 'Roboto', sans-serif;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

.chcb .chcb-body button.chcb-info:hover,
.chcb .chcb-body button.chcb-info[aria-expanded="true"] {
    background: var(--chcb-medium);
    color: #fff;
}

.chcb .chcb-body button.chcb-info:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(127, 211, 239, .5);
}

.chcb .chcb-body .chcb-tip {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    width: min(360px, 100%);
    padding: 14px 16px;
    border: 1px solid var(--chcb-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 8px #1d346114, 0 16px 40px #1d34611f;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
}

.chcb .chcb-body .chcb-tip[hidden] {
    display: none;
}

.chcb.chcb .chcb-body .chcb-tip-title {
    margin-bottom: 4px;
    font-size: 15px;
    font-weight: 700;
}

.chcb.chcb .chcb-body .chcb-tip-levels {
    margin-top: 10px;
}

.chcb.chcb .chcb-body .chcb-tip-levels li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 5px;
    background: var(--chcb-light);
}

.chcb.chcb .chcb-body .chcb-tip-levels li + li {
    margin-top: 4px;
}

.chcb .chcb-tip-levels .chcb-chip {
    flex: 0 0 auto;
    min-width: 26px;
    padding: 0;
    font-size: 13px;
}

.chcb .chcb-range {
    position: relative;
    height: 6px;
    margin: 20px 7px 6px;
    border-radius: 999px;
    background: #eef2f6;
}

.chcb .chcb-range-band {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: var(--chcb-line);
}

.chcb .chcb-range-avg {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    margin-left: -1px;
    background: var(--chcb-main);
}

.chcb .chcb-range-dot {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--chcb-band);
    box-shadow: 0 0 0 1px var(--chcb-main);
}

.chcb .chcb-range-scale {
    display: flex;
    justify-content: space-between;
    margin: 0 4px;
    font-size: 12px;
}

.chcb.chcb .chcb-body .chcb-tip-avg {
    margin-top: 6px;
    font-size: 13px;
}

/* ---------- Main Specs, My Pick ---------- */

.chcb.chcb .chcb-body .chcb-section {
    margin: 20px 0 8px;
    font-size: 17px;
    font-weight: 700;
}

.chcb .chcb-body .chcb-pick {
    font-size: 16px;
}

/* ---------- Choose if + buy buttons ---------- */

.chcb .chcb-choose {
    display: grid;
    grid-template-columns: repeat(var(--chcb-n), minmax(0, 1fr));
    gap: 12px 24px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--chcb-border);
}

/* Each column spans two shared rows (reasons, then actions), so the first buy buttons line up across
   columns and a second button (Solar) hangs below. Without subgrid the blocks simply stack. */
.chcb .chcb-choose-col {
    display: grid;
    grid-template-rows: auto auto;
    gap: 12px;
    align-content: start;
    min-width: 0;
}

@supports (grid-template-rows: subgrid) {
    .chcb .chcb-choose {
        grid-template-rows: auto auto;
    }

    .chcb .chcb-choose-col {
        grid-row: span 2;
        grid-template-rows: subgrid;
    }
}

.chcb .chcb-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-self: start;
}

.chcb.chcb .chcb-body .chcb-choose-title {
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 700;
}

.chcb.chcb .chcb-body .chcb-choose-list li {
    position: relative;
    margin-bottom: 4px;
    padding-left: 24px;
    font-size: 15px;
}

.chcb .chcb-body .chcb-choose-list li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: #0a8f0a;
    font-weight: 700;
}

.chcb .chcb-body a.chcb-buy,
.chcb .chcb-body a.chcb-buy:visited {
    display: block;
    padding: 8px 10px;
    border-radius: 5px;
    background: var(--chcb-cta);
    box-shadow: 0 4px 14px #ff186159;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background-color .2s, box-shadow .2s, transform .2s;
}

.chcb .chcb-body a.chcb-buy:hover,
.chcb .chcb-body a.chcb-buy:focus-visible {
    background: var(--chcb-cta-dark);
    box-shadow: 0 8px 22px #ff186173;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.chcb.chcb .chcb-body .chcb-promo {
    margin-top: -4px;
    font-size: 14px;
    text-align: center;
}

.chcb .chcb-body a.chcb-review,
.chcb .chcb-body a.chcb-review:visited {
    display: block;
    margin-top: -4px;
    color: var(--chcb-medium);
    font-size: 14px;
    text-align: center;
    text-decoration: underline;
}

.chcb.chcb .chcb-body .chcb-method {
    padding: 10px 10px 0;
    border-top: 1px solid var(--chcb-border);
    font-size: 14px;
}

.chcb .chcb-body .chcb-method a {
    color: var(--chcb-medium);
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    .chcb * { transition: none !important; }
}

/* ---------- Phone: same rows, narrower label column ---------- */

@container (max-width: 560px) {
    .chcb .chcb-title { font-size: 18px; }
    .chcb .chcb-body { padding: 0 16px 16px; }
    .chcb .chcb-row { grid-template-columns: minmax(0, 1.25fr) repeat(var(--chcb-n), minmax(0, 1fr)); }
    .chcb .chcb-row-label { gap: 6px; padding: 8px 4px 8px 0; font-size: 14px; line-height: 1.25; }
    .chcb .chcb-cell { padding: 8px 4px; }
    .chcb .chcb-cell.chcb-spec { font-size: 13px; }
    .chcb .chcb-alt { font-size: 11px; }
    .chcb .chcb-variant { flex-basis: auto; font-size: 12px; }
    .chcb .chcb-photos .chcb-cell { padding: 12px 4px 0; }
    .chcb .chcb-overall .chcb-row-label,
    .chcb .chcb-name { font-size: 15px; }
    .chcb .chcb-heads .chcb-cell { padding: 10px 4px; }
    .chcb .chcb-choose { grid-template-columns: 1fr; }
    .chcb.chcb .chcb-body .chcb-method { padding: 10px 0 0; }
}
