/**
 * Theme Name: CarOptimiz
 */

:root {
    --blanc: #fff;
    --gris: #363638;
    --bleu: #289bd2;
    --bleu2: #45a1dd;
    --bleu3: #359ee0;
    --bleu4: #227bbf;

    --header-foreground-color: var(--blanc);
    --footer-foreground-color: var(--blanc);
    --footer-background-color: var(--gris);
    --primary-color: var(--bleu);

    --container-width: 1024px;

    --fs-base: 16px;
    --fs-ratio: 0.8;
    --fs-header-menu: calc(26px * var(--fs-ratio));
    --fs-header-title: calc(80px * var(--fs-ratio));
    --fs-header-title-mobile: calc(45px * var(--fs-ratio));
    --fs-part1-title: calc(33px * var(--fs-ratio));
    --fs-part1-text: calc(24px * var(--fs-ratio));
    --fs-part2-title: calc(40px * var(--fs-ratio));
    --fs-part2-text: calc(33px * var(--fs-ratio));
    --fs-part2-bubble: calc(24px * var(--fs-ratio));
    --fs-footer-menu: calc(24px * var(--fs-ratio));
    --fs-footer-submenu: calc(16px * var(--fs-ratio));
    --fs-h3: calc(33px * var(--fs-ratio));
    --fs-h4: calc(33px * var(--fs-ratio));
    --fs-mailto: calc(33px * var(--fs-ratio));
}

@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Black.ttf"); font-weight: 800; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Bold.ttf"); font-weight: 700; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Heavy.ttf"); font-weight: 900; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Light.ttf"); font-weight: 200; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Medium.ttf"); font-weight: 500; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Regular.ttf"); font-weight: 400; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Semibold.ttf"); font-weight: 600; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Thin.ttf"); font-weight: 300; font-style: normal; }
@font-face { font-family: "SFUIDisplay"; src: url("fonts/SFUIDisplay-Ultralight.ttf"); font-weight: 100; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-Bold.ttf"); font-weight: 700; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-BoldItalic.ttf"); font-weight: 700; font-style: italic; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-Heavy.ttf"); font-weight: 900; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-HeavyItalic.ttf"); font-weight: 900; font-style: italic; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-Light.ttf"); font-weight: 200; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-LightItalic.ttf"); font-weight: 200; font-style: italic; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-Medium.ttf"); font-weight: 500; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-MediumItalic.ttf"); font-weight: 500; font-style: italic; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-Regular.ttf"); font-weight: 400; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-RegularItalic.ttf"); font-weight: 400; font-style: italic; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-Semibold.ttf"); font-weight: 600; font-style: normal; }
@font-face { font-family: "SFUIText"; src: url("fonts/SFUIText-SemiboldItalic.ttf"); font-weight: 600; font-style: italic; }

html {
    font-family: "SFUIText", sans-serif;
    font-size: var(--fs-base);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;

    img {
        margin: 0 1em;
        width: 512px;
        max-width: calc(100% - 2em);
    }

    section:nth-child(1) {
    }

    section:nth-child(2) {
        color: var(--header-foreground-color);
        background-position: center center;
        background-size: cover;
    }

    summary {
        display: inline-block;
        list-style: none;
        cursor: pointer;

        @media (max-width: 1024px) {
            font-weight: bold;
            font-size: 0;
        }

        @media (min-width: 1024px) {
            display: none;
        }

        &::marker {
          content: "";
        }

        &::before {
            content: '☰';
            font-size: 4rem;
        }

        [open] &::before {
            content: '×';
        }
    }

    .menu {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        justify-content: space-between;

        @media (max-width: 1024px) {
            flex-direction: column;
            text-align: left;
        }

        @media (min-width: 1024px) {
            flex-direction: row;
        }

        a {
            display: block;
            font-size: var(--fs-header-menu);
            font-weight: 100;
            text-decoration: none;

            @media (max-width: 1024px) {
                margin: 0.5em 1em;
            }

            @media (min-width: 1024px) {
                margin: 2em 0;
            }
        }

        li {
            @media (max-width: 1024px) {
            }

            @media (min-width: 1024px) {
                position: relative;

                & .sub-menu {
                    display: none;
                    visibility: hidden;
                }

                &:hover .sub-menu {
                    display: flex;
                    visibility: visible;
                }
            }
        }
    }

    .sub-menu {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        z-index: 1;

        @media (max-width: 1024px) {
            text-align: left;
            padding-left: 5em;
        }

        @media (min-width: 1024px) {
            position: absolute;
            margin-top: -1rem;
        }

        a {
            font-weight: normal;
            white-space: nowrap;

            @media (max-width: 1024px) {
                margin: 0.5em 0;
            }

            @media (min-width: 1024px) {
                margin: 0.5rem 0;
                text-align: left;
            }
        }
    }

    .menu-item:hover>a,
    .current-menu-item>a {
        text-shadow: 1px 0px 0px currentColor;
    }

    h1 {
        font-weight: normal;
        line-height: 1;
        margin: 0;
        padding: 2em 0.5em 3em 0.5em;
        max-width: 100%;

        @media (max-width: 1024px) {
            font-size: var(--fs-header-title-mobile);
        }

        @media (min-width: 1024px) {
                font-size: var(--fs-header-title);

                .is-front-page & em {
                    font-size: 43.5689px;
                }
        }

        em {
            font-style: italic;
            font-weight: normal;
            color: var(--primary-color);

            &.with-dashes {
                @media (max-width: 1024px) {
                    display: flex;
                    flex-direction: column;
                }

                @media (min-width: 1024px) {
                    span+span::before {
                        content: '-';
                        margin: 0 0.25em;
                    }
                }
            }
        }
    }

}

main {
    flex-grow: 1;

    .part1,
    .part2 {
        padding: 2rem calc((100vw - var(--container-width)) / 2 + 2rem); 
    }

    .part1 {
        gap: 1rem;

        @media (max-width: 1024px) {
            display: flex;
            flex-direction: column;
        }

        @media (min-width: 1024px) {
            display: grid;
            justify-items: center;
            align-items: center;
            grid-template-columns: 1fr 1fr 1fr;

            &>*:nth-child(1) { order: 2; }
            &>*:nth-child(2) { order: 1; }
            &>*:nth-child(3) { order: 3; }
            &>*:nth-child(4) { order: 5; }
            &>*:nth-child(5) { order: 4; }
            &>*:nth-child(6) { order: 6; }
        }

        figure {
            margin: 0;
        }

        .card {
            text-align: center;

            h2 {
                color: var(--bleu3);
            }
            p {
                color: var(--bleu4);
            }

        }

        [class*="picto"]::before {
            content: '';
            position: relative;
            display: block;
            width: 100%;
            height: 6rem;
            background-position: top center;
            background-size: contain;
            background-repeat: no-repeat;
        }
        .picto-engrenage::before {
            background-image: url('images/picto-engrenage.jpg');
        }
        .picto-voiture::before {
            background-image: url('images/picto-voiture.jpg');
        }
    }

    .part2 {
        background-image: url('images/fond-voiture.jpg');
        background-repeat: no-repeat;
        background-position: center center;
        background-size: cover;
        color: var(--blanc);

        h2 {
            text-align: center;
            font-weight: normal;

            &::after {
                content: '';
                display: block;
                height: 2px;
                width: 100%;
                margin-top: 2rem;
                background: linear-gradient(
                    to right,
                    transparent 0%,
                    transparent 33%,
                    currentColor 33%,
                    currentColor 66%,
                    transparent 66%,
                    transparent 100%
                );
            }
        }

        .cards {
            display: block;
            text-align: center;
            font-size: 0;
        }

        .card {
            color: var(--bleu3);
            background-color: var(--blanc);
            aspect-ratio: 1/1;
            font-size: var(--fs-part2-text);
            vertical-align: middle;
            display: inline-block;
            width: var(--cards-size);
            height: var(--cards-size);
            border-radius: 50%;
            margin: 0 calc((100% - var(--cards-count) * var(--cards-size)) / (2 * var(--cards-count)) - 1px);
            position: relative;
            margin-bottom: 1rem;

            @media (max-width: 1024px) {
                --cards-count: 1;
                --cards-size: 11ch;
            }

            @media (min-width: 1024px) {
                --cards-count: 3;
                --cards-size: 11ch;
            }

            &>* {
                --safety-padding: 0.5em;
                position: absolute;
                top: 50%;
                width: calc(100% - 2 * var(--safety-padding));
                transform: translateY(-50%);
                margin: 0;
                padding: 0 var(--safety-padding);
                font-size: var(--fs-part2-bubble);
            }
        }
    }

    h2 {
        margin-top: 2em;

        small {
            display: block;
            opacity: 0.25;
        }
    }

    h3 {
        color: var(--bleu3);
        font-size: var(--fs-h3);
        margin-top: 3em;
    }

    h4 {
        font-size: var(--fs-h4);
    }

    .container {
        @media (max-width: 1024px) {
            padding: 0 0.5em;
        }
    }

    a[href^="mailto:"] {
        color: var(--bleu3);
        font-size: var(--fs-mailto);
        font-weight: bold;
        text-decoration: none;
    }
}

footer {
    color: var(--footer-foreground-color);
    background-color: var(--footer-background-color);
    border-top: 3rem solid var(--bleu2);

    .container {
        display: flex;
        gap: 1rem;

        @media (max-width: 1024px) {
            flex-direction: column;
            padding: 2em 1em;
        }

        @media (min-width: 1024px) {
            flex-direction: row;
            justify-content: space-between;
            align-items: flex-start;
            padding: 2em 0;
        }
    }

    a {
        text-decoration: none;
    }

    .menu {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        gap: 1em;

        @media (max-width: 1024px) {
            flex-direction: column;
        }

        @media (min-width: 1024px) {
            flex-direction: row;
        }

        &>.menu-item>a {
            font-size: var(--fs-footer-menu);
            font-weight: bold;
        }
    }

    .sub-menu {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;

        &>.menu-item>a {
            display: inline-block;
            font-size: var(--fs-footer-submenu);
            padding-top: 1em;
        }
    }

    .sidebar {
        list-style: none;
        margin: 0;
        padding: 0;

        p:first-of-type {
            margin-top: 0;
        }

        strong {
            font-size: var(--fs-footer-menu);
            font-weight: bold;
        }
    }
}

a {
    color: inherit;
}

.container {
    display: block;
    max-width: min(100vw, var(--container-width));
    margin: 0 auto;
}

.fit {
    display: inline-block;
    white-space: nowrap;
}

.mw-50vw {
    max-width: 50vw;
}
