@import url("./colors.css");

@font-face {
    font-family: "TT Norms";
    src: url("../fonts/tt-norms/TT-Norms-Fonts/TTNorms-Regular.otf");
}

@font-face {
    font-family: "TT Norms";
    src: url("../fonts/tt-norms/TT-Norms-Fonts/TTNorms-Bold.otf");
    font-weight: bold;
}

@font-face {
    font-family: "Monotalic";
    src: url("../fonts/monotalic/Monotalic/Monotalic-Regular.ttf");
}

@font-face {
    font-family: "Monotalic";
    src: url("../fonts/monotalic/Monotalic/Monotalic-Light.ttf");
    font-weight: 300;
}

html {
    /* scroll-snap-type: y proximity; */
    /* scroll-snap-type: block; */
    scroll-behavior: smooth;

    font-family: "TT Norms", sans-serif;
    font-variant-ligatures: no-discretionary-ligatures;
    height: 100%;
}

body {
    margin: 0;
    height: 100%;
}

main {
    width: 100%;
    height: 100%;
    position: relative;
    overflow-x: clip;
}

main>section:not(#form) {
    scroll-snap-align: start;
}

main>section#form {
    width: calc(100% - 200px);
    min-width: 90%;
}

#form-content>fieldset,
#form-content>.question-end {
    scroll-snap-align: center;
}

/*
    MARK: Header
*/

body>header {
    z-index: 100;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 15px;

    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: start;
}

body>header>img {
    width: 50px;
}

body>header>button {
    font-size: 28px;
    display: block;
    padding: 10px;
    margin: 0;
    border: none;
    background: none;
    cursor: pointer;
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    border-radius: 100%;
}

body>header>button:hover,
body>header>button:focus,
body>header>button:active {
    background: rgba(0, 0, 0, 0.15);
}

body>header>button:last-child {
    margin-right: 10px;
}

body>header>img+* {
    margin-left: auto;
}

@media (monochrome) {
    #theme-switch-button {
        display: none;
    }
}

/*
    MARK: Section
*/

main>section {
    min-height: 100%;
    box-sizing: border-box;

    max-width: 800px;
    margin-left: auto;
    margin-right: auto;

    /* padding: 15px; */
    padding: 0 2em;
    padding-top: 80px;
}

main>section:last-child {
    margin-bottom: 26vh;
}

/*
    MARK: Form
*/

#form-content>fieldset {
    border: none;
}

#form-content>fieldset>button {
    width: fit-content;
    margin-left: auto;
}

#form-content legend {
    display: block;
}

#form-content>fieldset,
#form-content>.question-end {
    min-height: 50vh;
    margin-bottom: 85px;
}

#form-content>fieldset[disabled] {
    display: none;
}

.question-section:has(input:invalid:focus)::after {
    content: "Veuillez sélectionner une des options ci-dessus";
    color: red;
}

.question-section:has(input:invalid:focus) label::before {
    border-color: red;
}

/*
    MARK: Identity
*/

#question-identity {
    display: grid;
    grid-template-columns: [start] 1fr 1fr [end];
    grid-auto-rows: min-content;
    gap: 15px;
    justify-content: center;
}

@media screen and (max-width: 700px) {
    #question-identity {
        grid-template-columns: [start] 1fr [end];
    }
}

#question-identity> :not(.form-control) {
    grid-column: start / end;
}

/*
    MARK: Fields
*/

.form-control {
    margin: 0;
}

.form-control.text-field {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: min-content 1fr min-content;
}

.form-control.checkbox label,
.form-control.text-field input {
    font-size: 1.5em;
}

.form-control.checkbox label {
    display: flex;
    align-items: start;
}

.form-control.text-field input {
    border: none;
    background: none;
    padding: 5px;
    border-bottom: solid 1px currentColor;
    min-width: 0;
    border-radius: 0;
}

.form-control.checkbox {
    position: relative;
}

.form-control.checkbox input {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.form-control.checkbox label::before {
    content: "";
    width: 1.2em;
    height: 1.2em;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    border: solid 1px currentColor;
    margin-right: 1ex;
}

@keyframes checked {
    0% {
        transform: scale(1);
    }

    10% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.form-control.checkbox input~label svg-icon {
    display: block;
    position: absolute;
    left: -0.6em;
    width: 2.8em;
    height: 2.3em;
    top: -0.7em;
    visibility: hidden;
}

.form-control.checkbox input:checked~label svg-icon {
    visibility: visible;
    animation: ease-out checked 1s;
}

.form-control.checkbox small {
    display: block;
    font-size: 0.8em;
    margin-left: calc(1.94em + 1ex);
    margin-bottom: 1.5em;
}

#photo-input {
    width: min(60vw, 800px, 50vh);
    height: min(60vw, 800px, 50vh);
    display: block;
    margin-left: auto;
    margin-right: auto;

    border: solid 1px currentColor;
    border-radius: 100%;
    overflow: hidden;

    background: white;
}

#photo-input.capture {
    background: black;
}

#photo-input p {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

#photo-input svg {
    margin-bottom: 15px;
}

#photo-input::part(capture-button) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: currentColor;
}

#photo-input::part(shot-button) {
    position: absolute;
    left: 50%;
    bottom: 15px;
    width: max(5vw, 75px);
    height: max(5vw, 75px);
    border-radius: 100%;
    border: solid 3px transparent;
    outline: solid 3px black;
    background: black;
    background-clip: content-box;
    transform: translateX(-50%);
    box-sizing: content-box;
    padding: 0;
    cursor: pointer;
    color: transparent;
}

#photo-input.filled p {
    opacity: 0;
}

#photo-input::part(preview) {
    transform: scaleX(-1);
}

#photo-input::part(gallery-button),
#photo-input::part(cancel-capture-button) {
    margin: 15px;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
}

#photo-input:not(.capture)::part(gallery-button) {
    display: none;
}

#photo-input.capture {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    z-index: 10;
    border: none;
}

#photo-input .mask {
    display: none;
}

#photo-input.capture .mask {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 55;
}

#photo-input:not(.filled)~.toolbar .big-button:not(.empty-photo) {
    display: none;
}

#photo-input.filled~.toolbar .big-button.empty-photo {
    display: none;
}

#photo-input~.privacy-note {
    text-align: center;
    margin-top: 1em;
}

#photo-input~.toolbar {
    text-align: end;
    margin-top: 75px;
    margin-top: min(75px, 10vh);
}

/*
    MARK: Form
*/

.question-choice-section {
    margin-top: 1ex;
    margin-bottom: 1ex;
}

/*
    MARK: Privacy note
*/

.privacy-note {
    margin: 0;
    font-size: 0.8em;
    opacity: 0.5;
}

/*
    MARK: Home
*/

#home {
    display: flex;
    flex-direction: column;
    margin-bottom: 30vh;
}

.home-title-block {
    flex: 1;
    width: min-content;
    margin-left: auto;
    margin-right: auto;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: end;
    margin-bottom: 10vh;
    font-size: min(5.14rem, 13vw, 13vh);

    position: relative;
}

#home h1 {
    font-family: "Monotalic", sans-serif;
    font-weight: 300;
    font-size: 1em;
    line-height: 1;
    position: relative;
    margin: 0;
}

#home h1 small {
    font-size: 0.5em;
}

#home h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    border: solid 1px currentColor;
    width: 100%;
    max-width: 326px;
}

#home h1+p {
    text-align: right;
    font-size: max(0.2em, 1rem);
    margin-bottom: 0;
}

.home-start-block {
    position: relative;
    color: var(--on-accent-color);
    padding: 2em 0;
    min-height: 26vh;
    display: flex;
    flex-direction: column;
}

.home-start-block::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    width: 100vw;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    z-index: -1;
}

.home-start-block .end-blob {
    width: 100vw;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(99%);
    z-index: -1;
    height: auto;
}

.home-start-block .end-blob-path {
    fill: var(--accent-color);
    width: 100%;
}

.home-start-block p {
    max-width: 380px;
    margin-bottom: 0;
}

.home-start-block p:first-of-type {
    margin: 0;
}

.home-start-block nav {
    flex: 1;

    display: flex;
    flex-direction: row;
    justify-content: end;
    align-items: end;
}

@keyframes home-graphics {
    0% {
        transform: translate(-30%, 5%) rotate(0deg);
    }

    25% {
        transform: translate(-30%, 5%) rotate(10deg) translateX(10%) translateY(-5%);
    }

    75% {
        transform: translate(-30%, 5%) rotate(-15deg) translateX(-10%) translateY(5%);
    }

    100% {
        transform: translate(-30%, 5%) rotate(0deg);
    }
}

#home .graphic {
    position: absolute;
    animation: infinite ease-in-out 30s home-graphics;
    z-index: -1;
    width: min(60vw, 490px, 44vh);
    height: auto;
    bottom: 0;
    left: 0;
}

/*
    MARK: Buttons
*/

.big-button {
    padding: 10px;
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1ex;
    text-transform: uppercase;
    border: solid 1px currentColor;
    border-radius: 5px;
    background: none;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-weight: bold;
    transition: opacity 250ms;
}

.big-button:disabled {
    opacity: 0.5;
}

.big-button svg-icon {
    font-size: 1.16em;
}

.big-button svg-icon[src$="chevron-right.svg"] {
    transition: ease-out 0.3s transform;
    transform: translateX(0);
}

.big-button:hover svg-icon[src$="chevron-right.svg"]:last-child,
.big-button:active svg-icon[src$="chevron-right.svg"]:last-child {
    transform: translateX(0.5ex);
}

.letter {
    width: auto;
    height: min(10em, 30vh);
    position: absolute;
    z-index: -1;
    transform: translate(-15%, -55%);
}

#background-blob {
    position: absolute;
    right: -290px;
    pointer-events: none;
    z-index: -1;
    top: 370%;

    path {
        fill: var(--accent-color, rgb(240, 54, 88));
    }
}

@media screen and (max-width: 400px) {
    #home .graphic {
        height: 230px;
        width: auto;
    }

    .home-title-block {
        margin-bottom: 20vh;
    }
}

@media screen and (max-height: 400px) {
    .home-title-block {
        margin-bottom: 0.5em;
    }

    #home {
        padding: 0 1em;
    }

    #home h1+p {
        text-align: right;
    }

    .home-start-block {
        padding: 1em 0;
    }
}