/*
 * Licence Guide: pages/what-motorbike-can-i-ride. The size cards are the shared text
 * cards (sections.css); the bar of sections is the shared .section-nav.
 */

/* Licences, smallest to largest
   ========================================================================== */

/* A line runs through the badges, down the page on a phone and across on a computer.
   Each badge is a little bigger than the one before; their centres stay on the line. */
.licence-ladder {
    --badge-max: 56px;
    --ladder-gap: var(--space-6);

    display: grid;
    gap: var(--ladder-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.licence-step {
    --badge: calc(var(--badge-max) * (0.7 + var(--step, 3) * 0.1));

    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding-inline-start: calc(var(--badge-max) + var(--space-4));
    scroll-margin-top: calc(var(--header-height) + 48px + var(--space-5));
}

.licence-step__code {
    position: absolute;
    z-index: 1;
    top: calc((var(--badge-max) - var(--badge)) / 2);
    left: calc((var(--badge-max) - var(--badge)) / 2);
    display: grid;
    place-items: center;
    width: var(--badge);
    height: var(--badge);
    border-radius: var(--radius-card);
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-family: var(--font-heading);
    font-size: calc(var(--badge) * 0.38);
    font-weight: var(--heading-weight);
    line-height: 1;
}

/* From this badge's centre to the next one's. */
.licence-step:not(:last-child)::before {
    content: "";
    position: absolute;
    top: calc(var(--badge-max) / 2);
    bottom: calc((var(--ladder-gap) + var(--badge-max) / 2) * -1);
    left: calc(var(--badge-max) / 2 - 1px);
    width: 2px;
    background: var(--color-border);
}

/* On a phone the title sits level with its badge. */
.licence-step h3 {
    display: flex;
    align-items: center;
    min-height: var(--badge-max);
    font-size: var(--text-xl);
}

.licence-step__facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.licence-step__facts li {
    padding: 0.125rem var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-badge);
    font-family: var(--font-label);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.5;
}

.licence-step > p {
    line-height: 1.65;
}

/* Sits at the foot of each licence, so the links line up across a row. When the words
   wrap, as with a brand's wide lettering, the arrow follows the last one. */
.licence-link {
    align-self: start;
    margin-top: auto;
    padding-block: var(--space-3);
    color: var(--color-accent-text);
    font-family: var(--font-label);
    font-weight: 700;
    letter-spacing: var(--button-tracking);
    text-decoration: none;
    text-transform: var(--button-transform);
}

.licence-link:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* The last word and the arrow never part. */
.licence-link__end {
    white-space: nowrap;
}

.licence-link svg {
    margin-inline-start: var(--space-2);
    vertical-align: -0.2em;
    transition: translate 0.2s ease;
}

.licence-link:hover svg {
    translate: 3px 0;
}

@media (min-width: 900px) {
    .licence-ladder {
        --badge-max: 76px;

        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .licence-step {
        padding: calc(var(--badge-max) + var(--space-5)) 0 0;
    }

    .licence-step:not(:last-child)::before {
        top: calc(var(--badge-max) / 2 - 1px);
        right: calc((var(--ladder-gap) + var(--badge-max) / 2) * -1);
        bottom: auto;
        left: calc(var(--badge-max) / 2);
        width: auto;
        height: 2px;
    }

    .licence-step h3 {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .licence-link svg {
        transition: none;
    }
}


/* Engine sizes
   ========================================================================== */

.licence-size__tag {
    justify-self: start;
    margin-bottom: var(--space-2);
    text-decoration: none;
}

.licence-size__tag:hover {
    text-decoration: underline;
}

.licence-size__title {
    color: var(--color-accent-text);
    font-size: var(--text-2xl);
    line-height: 1.1;
}

/* The sizes this brand sells, each a link to its bikes. */
.licence-sizes {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-7);
}

.licence-sizes .pill-list {
    margin-bottom: 0;
}
