:root {
    --button-edge-dark: #03233e;
    --button-edge-green: #055b34;
    --button-edge-light: #d3e1db;
    --button-press-transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease,
        border-color 120ms ease;
}

/* Shared by the main site, course pages and the intersection trainer. */
:where(
    .button, .press-button, .hero-exam-link, .phone-button, .mode-arrow,
    .player-answer, .book-tests-answer, .learning-category-toggle,
    .theory-section-picker-button, .admin-page button,
    .mode-card, .player-topic-card, .theory-section-card, .book-tests-day,
    .theory-rule-card, .theory-term-card, .theory-sign-folder, .theory-disclosure,
    .theory-section-pagination a, .theory-point-index a, .theory-sign-folder-index a,
    .theory-image-viewer-controls button,
    .premium-page .plan-card, .homepage .benefit-card, .homepage .steps-grid > article,
    .course-sales-features > article, .book-feature,
    .course-experience :is(.btn, .primary, button.answer), .course-scene .btn,
    #pdr-driving-prototype :is(.p-primary, .p-secondary, .p-option)
) {
    --press-edge: var(--button-edge-dark);
    --press-depth: 5px;
    --press-transform: none;
    /* Replace legacy shadows and hover lifts, including those in course assets. */
    box-shadow: 0 var(--press-depth) 0 var(--press-edge, var(--button-edge-dark)) !important;
    transform: var(--press-transform, none) !important;
    transition: var(--button-press-transition) !important;
}

:where(
    .button-outline, .button-light, .hero-exam-link, .mode-arrow, .player-answer, .book-tests-answer,
    .learning-category-toggle, .theory-section-picker-button, .admin-page button.secondary,
    .mode-card, .player-topic-card, .theory-section-card, .book-tests-day,
    .theory-rule-card, .theory-term-card, .theory-sign-folder, .theory-disclosure,
    .theory-section-pagination a, .theory-point-index a, .theory-sign-folder-index a,
    .premium-page .plan-card, .homepage .benefit-card, .homepage .steps-grid > article,
    .course-sales-features > article, .book-feature,
    .course-experience :is(.btn:not(.primary), button.answer),
    .course-scene :is(.btn:not(.primary), .intro .primary),
    #pdr-driving-prototype :is(.p-secondary, .p-option)
) {
    --press-edge: var(--button-edge-light);
}

:where(.mode-exam .button, .account-heading-actions .button, #pdr-driving-prototype .p-primary:not([data-start], .p-paywall-primary)) {
    --press-edge: var(--button-edge-green);
}

/* Other controls can inherit these variables without taking on the button style. */
:where(button, a, [role="button"]):active:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) {
    --press-depth: 1px;
    --press-transform: translateY(4px);
}

/* The catalogue arrow extends its link hit area across its parent card. */
.mode-arrow:active {
    --press-transform: none;
}

.mode-secondary:has(.mode-arrow:active),
:where(.theory-sign-folder, .theory-disclosure):not([open]):has(> summary:active) {
    --press-depth: 1px;
    --press-transform: translateY(4px);
}

.mode-secondary:has(.mode-arrow:active) .mode-arrow::after {
    inset-block-start: -4px;
}

:where(button, a, [role="button"]):is(:disabled, [aria-disabled="true"], [aria-busy="true"]) {
    --press-depth: 0px;
}

:where(button, [role="button"], a:is(.button, .press-button, .hero-exam-link, .phone-button, .mode-arrow,
    .theory-section-card, .book-tests-day, .primary, .p-primary, .p-secondary)):focus-visible {
    outline: 2px solid #246575;
    outline-offset: 3px;
}

.button::before, .hero-exam-link .hero-exam-sheen {
    display: none;
}

.auth-form-side > .auth-google-form {
    margin-block-start: 1rem;
}

.google-auth-button {
    min-height: 44px;
    gap: .65rem;
    background: #fff;
}

.auth-form-side .google-auth-button {
    width: 100%;
}

.google-auth-button svg {
    flex: 0 0 20px;
}

.account-google-access {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    margin-block-end: 1rem;
}

.account-google-access h2 {
    font-size: 1.125rem;
    margin-block: 0 .3rem;
}

.account-google-access p {
    margin: 0;
}

.google-registration {
    max-width: 34rem;
    margin-inline: auto;
    overflow-wrap: anywhere;
}

@media (max-width: 860px) {
    .site-header .main-menu.is-open > a {
        --menu-edge: var(--button-edge-light);
        --menu-depth: 5px;
        --menu-transform: none;
        box-shadow: 0 var(--menu-depth) 0 var(--menu-edge) !important;
        transform: var(--menu-transform) !important;
        transition: var(--button-press-transition) !important;
    }

    .site-header .main-menu.is-open > a[href="/premium"] {
        --menu-edge: #c6dac1;
        grid-column: auto;
    }

    .site-header .main-menu.is-open > a.button {
        --menu-edge: var(--button-edge-dark);
    }

    .site-header .main-menu.is-open > a:active {
        --menu-depth: 1px;
        --menu-transform: translateY(4px);
    }

    .site-header .main-menu.is-open .trainer-nav-link {
        position: relative;
    }

    .site-header .main-menu.is-open .trainer-nav-badge {
        inset: 8px 10px auto auto;
        color: #8b650e;
        font-size: 10px;
        font-weight: 800;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --button-press-transition: none;
    }
}
