/*
 * One column, 808px wide at most, over the photo background.
 * Sizes follow the screen width, so the page keeps its proportions on phones.
 */

@font-face {
    font-family: 'Roboto Condensed';
    src: url('../fonts/roboto-condensed-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --blue: #1b4287;
    --red: #c60d1b;
    --swiss-red: #e30613;
    --title-font: 'Roboto Condensed', 'Arial Narrow', sans-serif;

    /* The only font sizes of the page (the footer excepted) */
    --xl: min(8vw, 60px);    /* big titles */
    --l: min(5.5vw, 34px);   /* subtitles, messages, buttons */
    --text: 16px;            /* also avoids the zoom on form fields in iOS */
    --small: 14px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    background: #3a2c22 url('../images/background.jpg') no-repeat 50% 0 fixed;
    background-size: cover;
}

body {
    margin: 0;
    font: var(--text)/1.4 Arial, Helvetica, sans-serif;
    color: var(--blue);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

h1, h2 {
    margin: 0;
    font-family: var(--title-font);
    font-weight: 700;
    line-height: 1.05;
    text-transform: uppercase;
}

.page {
    max-width: 808px;
    margin: 0 auto;
    background: rgba(255, 255, 255, .78);
}

/* Blocks narrower than the page, like the gifts box in the design */
.notice,
.result,
form,
.gifts,
.infos {
    width: min(624px, calc(100% - 32px));
    margin: 0 auto;
}

.top {
    display: block;
    width: 100%;
}

/* The wheel: only its top half is visible, the white half circle in the middle is the play button */

.wheel {
    position: relative;
    width: 93%;
    margin: -6% auto 0;
}

.window {
    aspect-ratio: 2;
    overflow: hidden;
}

#wheel {
    display: block;
    width: 100%;
    transition: transform 6s cubic-bezier(.15, .6, .1, 1);
}

.tick {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 50%;
    width: 7.5%;
    transform: translate(-50%, -45%);
}

/* White half circle in the middle of the wheel, holding the play button */
.hub {
    position: absolute;
    bottom: 0;
    left: 50%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 32%;
    aspect-ratio: 2;
    padding-bottom: 3%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 999px 999px 0 0;
}

/* Smaller than the other buttons on phones, to fit in the half circle */
#play {
    font-size: min(4.5vw, 34px);
}

#play:enabled {
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
    50% { transform: scale(1.08); }
}

/* Messages: white cards */

.notice,
.result {
    margin-top: 24px;
    padding: 16px 20px;
    text-align: center;
    background: #fff;
    border-top: 6px solid var(--blue);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(27, 66, 135, .2);
}

#won {
    border-top-color: var(--red);
}

.result h2 {
    font-size: var(--xl);
}

#won h2 {
    color: var(--red);
}

.result p {
    margin: 8px 0 0;
}

.big,
.notice {
    font-family: var(--title-font);
    font-weight: 700;
    font-size: var(--l);
    line-height: 1.15;
}

.intro {
    margin: 24px 16px 0;
    text-align: center;
}

.intro h1 {
    font-size: var(--xl);
}

.intro p {
    margin: 6px 0 0;
    color: var(--red);
}

/* Registration form: labels on the left of the fields, above them on phones */

form {
    margin-top: 24px;
}

form h2 {
    font-size: var(--l);
}

.fields {
    display: grid;
    grid-template-columns: 1fr 4fr;
    gap: 12px 16px;
    align-items: center;
}

.fields label[for] {
    text-align: right;
    font-weight: bold;
}

.fields input[type=text],
.fields input[type=email] {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    font: inherit;
    color: #333;
    background: #fff;
    border: 1px solid #b8c2d6;
    border-radius: 4px;
}

.fields input:focus {
    border-color: var(--blue);
    outline: 2px solid rgba(27, 66, 135, .25);
}

.checkbox,
.actions {
    grid-column: 2;
}

.checkbox {
    position: relative;
    padding-left: 22px;
    font-size: var(--small);
    cursor: pointer;
}

.checkbox input {
    position: absolute;
    left: 0;
    top: 1px;
    margin: 0;
}

.error {
    padding: 12px;
    color: #a94442;
    background: #f2dede;
    border: 1px solid #dca7a7;
    border-radius: 4px;
}

/* Red "3D" buttons: play and send the form */
.button {
    padding: .25em .9em;
    font-family: var(--title-font);
    font-weight: 700;
    font-size: var(--l);
    text-transform: uppercase;
    color: #fff;
    background: var(--red);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 4px 0 #8d0913;
    cursor: pointer;
}

.button:hover:enabled {
    background: #e0101f;
}

.button:active:enabled {
    box-shadow: 0 1px 0 #8d0913;
    translate: 0 3px;
}

.button:disabled {
    background: #aab3c5;
    box-shadow: 0 4px 0 #8a93a6;
    cursor: default;
}

.actions .button {
    margin-top: 12px;
}

/* Gifts: blue box with the cow on the top right */

.gifts {
    margin-top: 60px;
    padding: 16px 20px 20px;
    color: #fff;
    background: var(--blue);
}

.cow {
    float: right;
    width: 44%;
    margin: -56px -24px 0 8px;
}

.gifts h2 {
    display: inline-block;
    margin-left: 12%;
    padding: 2px 40px;
    font-size: var(--l);
    color: var(--blue);
    background: #fff;
}

.gifts ul {
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
    font-weight: bold;
}

.gifts li {
    position: relative;
    margin-top: 10px;
    padding-left: 38px;
}

/* Red circle with a white Swiss cross */
.gifts li::before {
    content: '';
    position: absolute;
    left: 0;
    top: -2px;
    width: 26px;
    height: 26px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Ccircle cx='13' cy='13' r='13' fill='%23e30613'/%3E%3Cpath d='M11 6h4v5h5v4h-5v5h-4v-5H6v-4h5z' fill='%23fff'/%3E%3C/svg%3E");
}

/* Links under the gifts */

.infos {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    font-size: var(--small);
}

.infos p {
    margin: 0;
}

.facebook {
    display: inline-block;
    padding: 4px 12px;
    color: #fff;
    background: #1877f2;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
}

/* Footer: red blocks with the Swiss and AOP logos */

footer {
    display: flex;
    gap: 6px;
    margin-top: 60px;
    padding-top: 6px;
    background: #fff;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
}

.tagline,
.aop,
.brand {
    height: 90px;
    color: #fff;
    background: var(--swiss-red);
}

.tagline {
    position: relative;
    width: 25%;
    padding: 62px 0 0 14px;
    font-size: 13px;
}

/* Swiss cheese badge, overlapping the top of the footer */
.tagline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: -47px;
    width: 72px;
    height: 72px;
    background: url('../images/logo_sprite.png') 0 -128px no-repeat;
}

.aop {
    display: grid;
    place-items: center;
    width: 90px;
    background: #fff;
    border: 3px solid var(--swiss-red);
}

.brand {
    display: flex;
    flex: 1;
    justify-content: flex-end;
    font-size: 25px;
    text-decoration: none;
}

.brand span {
    margin: 22px 14px 0 0;
}

.brand small {
    display: block;
    font-size: 14px;
}

.brand::after {
    content: '';
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    margin: 27px 22px 0 0;
    background: url('../images/logo_sprite.png') 0 -256px no-repeat;
}

/* Phones */

@media (max-width: 600px) {
    .fields {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .fields label[for] {
        margin-top: 8px;
        text-align: left;
    }

    .checkbox,
    .actions {
        grid-column: auto;
        margin-top: 10px;
    }

    .gifts {
        padding: 12px 14px 16px;
    }

    .cow {
        width: 38%;
        margin: -40px -14px 0 6px;
    }

    .gifts h2 {
        margin-left: 0;
        padding: 2px 16px;
    }

    /* The list starts below the cow */
    .gifts ul {
        clear: both;
    }

    .infos {
        flex-direction: column;
    }

    .tagline {
        display: none;
    }

    .aop {
        width: 70px;
    }

    .brand {
        font-size: 18px;
    }

    .brand span {
        margin: 24px 10px 0 0;
    }

    .brand::after {
        margin: 26px 12px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #wheel {
        transition-duration: 1s;
    }

    #play:enabled {
        animation: none;
    }
}
