/* Racket comparison, proposal B: two to four columns on the black page, rackets as cut-outs,
   characteristics grouped and read as big values. Two columns on phones. */

.cmp {
    --cols: 3;
}

/* The select stays the source; select.js puts a pill button over it with the same class. */
.cmp__select.dd {
    justify-content: flex-start;
}

.cmp__head,
.cmp__row {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: 0 clamp(16px, 3vw, 56px);
}

/* Model pickers stay in reach while the rows scroll. */
.cmp__head {
    position: sticky;
    top: var(--hdr-top);
    transition: top .35s var(--ease);
    z-index: 5;
    padding: 12px 0;
    background: var(--holo);
}

.cmp__select {
    appearance: none;
    display: flex;
    align-items: center;
    width: 100%;
    height: 48px;
    padding: 0 44px 0 20px;
    border: 0;
    border-radius: 999px;
    background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c0c0c' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center / 16px;
    color: var(--on-ink);
    font-size: .9375rem;
    font-weight: 700;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background-color .2s;
}

.cmp__select:hover {
    background-color: var(--ink-2);
}

.cmp__select option {
    background: var(--paper);
    color: var(--ink);
    --ink: #0c0c0c;
    --accent: var(--orange-deep);
    --ink-2: #2a2a2a;
    --ink-line: rgba(12, 12, 12, .16);
    --on-ink: #f2f0ec;
    --holo: #0c0c0c;
    color: var(--ink);
}

.cmp__row {
    padding: clamp(18px, 2.4vw, 28px) 0;
}

.cmp__val {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 8px;
    text-align: center;
}

/* Only a model the visitor just picked slides in; first paint stays still. */
.cmp__val.is-swapped {
    animation: cmp-swap .5s var(--ease);
}

@keyframes cmp-swap {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

.cmp__val b {
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 800;
    font-family: var(--fd);
    font-variation-settings: var(--fd-var);
    line-height: 1;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.cmp__big {
    font-size: clamp(2.6rem, 5vw, 4.2rem) !important;
    line-height: .9 !important;
    letter-spacing: 0 !important;
}

.cmp__sig {
    font-family: var(--hand);
    font-weight: 400 !important;
    font-variation-settings: normal !important;
    letter-spacing: 0 !important;
    transform: rotate(-4deg);
}

.cmp__label {
    order: -1;
    font-size: .8125rem;
    font-weight: 600;
}

.cmp__group {
    margin-top: clamp(48px, 6vw, 88px);
    padding-bottom: 14px;
    border-bottom: 2px solid var(--ink);
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
}

/* Product row: the racket stands on the black page, each column tilted its own way. */

.cmp__row--product {
    padding-top: clamp(24px, 3vw, 40px);
}

.cmp__img {
    display: block;
    width: min(100%, 300px);
    aspect-ratio: 1;
}

.cmp__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6%;
    transform: rotate(var(--tilt, -8deg));
    filter: drop-shadow(0 24px 22px rgba(0, 0, 0, .35));
    transition: transform .6s var(--ease);
}

.cmp__cell[data-col="1"] {
    --tilt: 6deg;
}

.cmp__cell[data-col="2"] {
    --tilt: -3deg;
}

.cmp__img:hover img {
    transform: rotate(calc(var(--tilt, -8deg) - 5deg)) scale(1.04);
}

.cmp__name {
    margin-top: 6px;
    font-size: clamp(1.4rem, 2.4vw, 2.1rem);
}

.cmp__val .cmp__price {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.cmp__go {
    height: 44px;
    margin-top: 6px;
    font-size: .9375rem;
}

/* Visual helpers, drawn in ink only. */

.cmp__shape {
    width: 40px;
    height: 64px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2.5;
    stroke-linejoin: round;
}

/* Balance: a thin ink rule from grip to head; the racket's range is a marker dash on it. */
.cmp__scale {
    position: relative;
    width: min(100%, 200px);
    height: 14px;
    margin-top: 4px;
}

.cmp__scale::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    height: 2px;
    background: var(--ink);
}

.cmp__scale::after {
    content: "";
    position: absolute;
    inset: 0;
    border-inline: 2px solid var(--ink);
}

.cmp__scale i {
    position: absolute;
    top: 1px;
    height: 12px;
    min-width: 12px;
    border-radius: 999px;
    background: var(--ink);
}

.cmp__scale-ends {
    display: flex;
    justify-content: space-between;
    width: min(100%, 200px);
    font-size: .9375rem;
}

/* Feel: three rings, filled up to the racket's stiffness. */
.cmp__meter {
    display: flex;
    gap: 6px;
}

.cmp__meter i {
    width: 16px;
    height: 16px;
    border: 2px solid var(--ink);
    border-radius: 999px;
}

.cmp__meter i.is-on {
    background: var(--ink);
}

.cmp__big small {
    margin-left: 2px;
    font-size: .4em;
    letter-spacing: 0;
    opacity: .6;
}

.cmp__ticks {
    width: min(100%, 200px);
}

.cmp__style {
    font-size: clamp(1.6rem, 2.6vw, 2.2rem) !important;
}

.cmp__val .cmp__rate {
    margin: -4px 0 0;
    font-size: .8125rem;
    color: var(--ink-2);
}

/* "Only differences": rows equal in every column fold away. */
.cmp.is-diff .is-same {
    display: none;
}

/* Short version (product page): the way out to the full page. */
.cmp__more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px 40px;
    margin-top: clamp(40px, 5vw, 64px);
    padding-top: 28px;
    box-shadow: inset 0 2px 0 var(--ink-line);
}

.cmp__more p {
    max-width: 52ch;
    margin: 0;
    color: var(--ink-2);
}

@media (max-width: 760px) {
    /* !important: the column count also arrives inline from compare.php. */
    .cmp {
        --cols: 2 !important;
    }

    .cmp [data-col="2"],
    .cmp [data-col="3"] {
        display: none;
    }

    .cmp__select {
        height: 44px;
        padding: 0 32px 0 14px;
        font-size: .8125rem;
        background-position: right 12px center;
    }

    .cmp__go {
        padding: 0 1.1em;
    }
}
