/*
 * The comparison "then and now" in the text of an article (BlogCompare, js/blog-compare.js): a card that shows one thing at a time (the buttons at the top pick it),
 * what it cost then and what it costs now as a share of the wage, as two bars (then in the colour of the article, now in gold: it is the bar the slider of the
 * reader's wage moves), and one sentence under them. The bars have their widths in the custom property --w, so the card is whole without the script (the things
 * one under another, the buttons and the slider hidden); the script only picks one thing, lets the bars grow when they come into view and shows the slider.
 */
.blog-body .blog-compare {
    clear: both;
    margin: 1.75rem 0;
    padding: 1.1rem 1.3rem 1rem;
    background: var(--blog-soft);
    border-radius: 14px;
    font-size: .98rem;
    line-height: 1.45;
}

.blog-compare-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin: 0 0 .9rem;
    color: var(--blog-accent);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
}

/* the button with the bubble "what the numbers are from", at the right of the title; with the script only (without it the note is under the card) */
.blog-compare-source {
    position: relative;
    display: none;
    flex: none;
}

.blog-compare.has-js .blog-compare-source {
    display: block;
}

.blog-compare.has-js .blog-compare-note {
    display: none;
}

.blog-compare-source-button {
    padding: .1rem .45rem;
    background: #fff;
    border: 1px solid rgba(20, 40, 70, .2);
    border-radius: 999px;
    color: #5a6878;
    font-size: .9rem;
    line-height: 1.3;
    cursor: pointer;
}

.blog-compare-source-button:hover,
.blog-compare-source-button:focus-visible,
.blog-compare-source-button[aria-expanded="true"] {
    border-color: var(--blog-accent);
}

/* ---- the buttons that pick the thing ---- */
.blog-compare-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: 0 0 1rem;
}

.blog-compare-picker[hidden] {
    display: none;
}

.blog-compare-pick {
    padding: .4rem 1rem;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 999px;
    color: #2d3b4b;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.blog-compare-pick:hover,
.blog-compare-pick:focus-visible {
    border-color: var(--blog-accent);
}

.blog-compare-pick[aria-pressed="true"] {
    background: var(--blog-fill);
    border-color: var(--blog-fill);
    color: #fff;
}

/* ---- a thing: its name (only when they are one under another), the two bars, the sentence ---- */
.blog-body .blog-compare-panel {
    margin: 0 0 1rem;
}

.blog-compare-panel[hidden] {
    display: none;
}

.blog-body .blog-compare-name {
    margin: 0 0 .3rem;
    color: inherit;
    font-size: 1.05rem;
    font-weight: 800;
}

.blog-compare.is-tabbed .blog-compare-name {
    display: none;
}

.blog-compare-line {
    display: grid;
    grid-template-columns: 3.6rem minmax(0, 1fr);
    gap: .1rem .6rem;
    align-items: center;
    margin-top: .45rem;
}

.blog-compare-era {
    color: #5a6878;
    font-size: .88rem;
    font-weight: 800;
}

.blog-compare-track {
    display: block;
    height: 1.1rem;
    overflow: hidden;
    background: rgba(20, 40, 70, .1);
    border-radius: 999px;
}

.blog-compare-bar {
    display: block;
    width: var(--w, 100%);
    height: 100%;
    border-radius: 999px;
    transition: width .8s cubic-bezier(.2, .7, .2, 1);
}

.blog-compare-bar--then {
    background: var(--blog-fill);
}

/* today: gold, so it is the bar that the slider of the reader's wage moves that stands out */
.blog-compare-bar--now {
    background: #d99a00;
}

/* the script lays the bars down and lets them grow when the card is seen or another thing is picked */
.blog-compare.is-armed .blog-compare-bar {
    width: 0;
    transition: none;
}

.blog-compare-value {
    grid-column: 2;
    font-size: .94rem;
}

.blog-compare-price {
    color: #5a6878;
}

@media (min-width: 640px) {
    .blog-compare-line {
        grid-template-columns: 3.6rem minmax(0, 1fr) 13.5rem;
    }

    .blog-compare-value {
        grid-column: auto;
        white-space: nowrap;
    }
}

.blog-body .blog-compare-verdict {
    margin: .7rem 0 0;
    padding: .5rem .8rem;
    background: rgba(255, 255, 255, .75);
    border-radius: 8px;
    font-size: 1rem;
}

/* ---- the overview: a bar for every thing, how many times smaller a share of the wage it takes now; the line is "the same as then" ---- */
.blog-body .blog-compare-rank {
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-body .blog-compare-rank-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5.4rem;
    gap: .15rem .6rem;
    align-items: center;
    margin: .55rem 0 0;
    padding: 0;
}

.blog-compare-rank-name {
    grid-column: 1 / -1;
    font-weight: 700;
}

.blog-compare-rank-row .blog-compare-track {
    position: relative;
}

.blog-compare-rank-row .blog-compare-value {
    grid-column: auto;
    text-align: right;
    white-space: nowrap;
}

/* the number of a row ("3,8×") is a button that opens a bubble saying what it means; without the script it is just the number */
.blog-compare-rank-row .blog-compare-value {
    position: relative;
}

.blog-compare-factor {
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: default;
}

.blog-compare-factor .bi {
    display: none;
}

.blog-compare.has-js .blog-compare-factor {
    padding: .1rem .5rem;
    background: #fff;
    border: 1px solid rgba(20, 40, 70, .2);
    border-radius: 999px;
    cursor: pointer;
}

.blog-compare.has-js .blog-compare-factor .bi {
    display: inline;
    margin-left: .15rem;
    color: #5a6878;
    font-size: .8em;
}

.blog-compare.has-js .blog-compare-factor:hover,
.blog-compare.has-js .blog-compare-factor:focus-visible,
.blog-compare.has-js .blog-compare-factor[aria-expanded="true"] {
    border-color: var(--blog-accent);
}

.blog-compare-tip {
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    z-index: 5;
    width: min(16rem, 70vw);
    padding: .55rem .75rem;
    background: #fff;
    border: 1px solid rgba(20, 40, 70, .2);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(20, 40, 70, .18);
    font-size: .9rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
}

.blog-compare-tip[hidden] {
    display: none;
}

.blog-compare-mark {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: #2d3b4b;
    transition: left .4s ease;
}

@media (min-width: 640px) {
    .blog-body .blog-compare-rank-row {
        grid-template-columns: 11rem minmax(0, 1fr) 5.4rem;
    }

    .blog-compare-rank-name {
        grid-column: auto;
    }
}

.blog-body .blog-compare-hint {
    margin: .6rem 0 0;
    color: #5a6878;
    font-size: .85rem;
    line-height: 1.4;
}

/* ---- the slider of the reader's wage ---- */
.blog-compare-control {
    display: block;
    margin: 0 0 .8rem;
    padding-top: .9rem;
    border-top: 1px dashed rgba(20, 40, 70, .25);
}

.blog-compare-control[hidden] {
    display: none;
}

.blog-compare-control-text {
    display: block;
    margin-bottom: .35rem;
    font-weight: 800;
}

.blog-compare-control output {
    color: var(--blog-accent);
}

.blog-compare-control-hint {
    display: block;
    margin-top: .35rem;
    color: #5a6878;
    font-size: .85rem;
}

.blog-compare-control input[type="range"] {
    display: block;
    width: 100%;
    margin: 0;
    accent-color: var(--blog-fill);
    cursor: pointer;
}

.blog-body .blog-compare-note {
    margin: 0;
    color: #5a6878;
    font-size: .85rem;
    line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
    .blog-compare-bar {
        transition: none;
    }
}

html[data-theme="dark"] .blog-body .blog-compare {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
}

html[data-theme="dark"] .blog-compare-pick {
    background: var(--dark-surface-2);
    color: var(--dark-text);
}

html[data-theme="dark"] .blog-compare-pick[aria-pressed="true"] {
    background: var(--blog-fill);
    color: #fff;
}

html[data-theme="dark"] .blog-compare-track {
    background: var(--dark-surface-3);
}

html[data-theme="dark"] .blog-compare-bar--now {
    background: #e0a722;
}

html[data-theme="dark"] .blog-compare-source-button,
html[data-theme="dark"] .blog-compare.has-js .blog-compare-factor,
html[data-theme="dark"] .blog-compare-tip {
    background: var(--dark-surface-2);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

html[data-theme="dark"] .blog-compare-mark {
    background: var(--dark-text);
}

html[data-theme="dark"] .blog-body .blog-compare-hint,
html[data-theme="dark"] .blog-compare-era,
html[data-theme="dark"] .blog-compare-control-hint,
html[data-theme="dark"] .blog-compare-price,
html[data-theme="dark"] .blog-body .blog-compare-note {
    color: var(--dark-muted);
}

html[data-theme="dark"] .blog-body .blog-compare-verdict {
    background: var(--dark-surface-2);
}

html[data-theme="dark"] .blog-compare-control {
    border-top-color: var(--dark-border);
}
