* {
    box-sizing: border-box;
}

html {
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
    /* font-size: calc(0.5dvw + 0.5rem); */
    font-size: calc(1dvw);
    font-weight: 200;
    font-family: ness, sans-serif;
}

body {
    margin: 0;
    font-size: var(--h3);
    line-height: var(--lineHeight);
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    hyphenate-character: "-";
    overflow-x: hidden;
    overflow-y: hidden;
    position: absolute;
    width: 100dvw;
    height: 200dvh;
}

/* .transitioner {
    width: 100dvw;
    height: 200dvh;
    position: fixed;

} */


a {
    color: var(--black);
}

a:hover {
    color: var(--black);
}

#appImg {
    display: none;
}

#app {
    width: 100dvw;
    height: 100dvh;
    position: absolute;
    bottom: 0;
    /* display: none; */
}

/* -------------------------------------------------------------- Configurator */

#configurator {
    position: absolute;
    width: 100dvw;
    height: 100dvh;
    pointer-events: none;
}

/* -------------------------------------------------------------- Menu */
#menu {
    pointer-events: all;
    position: absolute;
    top: 0;
    right: var(--mm);

    width: calc(var(--c4) + var(--gap));
    height: calc(100dvh - var(--footer) + 1px);

    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;

    padding: 0 0 0 0;

    overflow-y: scroll;
    border-radius: var(--radius);

    /* TEMP */
    background-color: white;
    z-index: 2;
}

#menu .menuTitle {
    text-align: left;
    padding: var(--mm) var(--m) 0 var(--m);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--dm);
}

#menu> :last-child {
    margin-top: auto;
}

#menuHeader {
    /* background-color: red; */
    text-align: center;
    /* always visible */
    flex: 0 0 auto;
}

#menuPage {
    display: flex;
    flex-direction: column;
    gap: var(--m);
    padding: var(--m) var(--m) var(--m) var(--m);
    /* full space */
    flex: 1 1 auto;
    min-height: 0;
    /* scroll if needed */
    overflow-y: auto;
}

/* Scroll bar for Firefox */
#menu,
#menuPage {
    scrollbar-width: none;
}

/* Scroll bar for Chrome, Safari, Edge */
#menu::-webkit-scrollbar,
#menuPage::-webkit-scrollbar {
    display: none;
}

/* #menuDots {
    display: flex;
    height: 1px;
    background-color: var(--borderColor);
    justify-content: space-between;
    margin-top: calc(var(--m) / 2);
    width: 50%;
    align-self: center;
} */

#menuFooter {
    /* background-color: red; */
    flex: 0 0 auto;
}

.line {
    position: relative;
    justify-content: space-between;
    font-weight: lighter;
    /* padding-left: var(--m); */
    font-size: var(--h6);
    line-height: var(--lineHeight);
    text-transform: uppercase;
}

/* .line::before {
    position: absolute;
    content: "-";
    left: 0;
} */
.subname {
    display: block;
    font-weight: normal;
}

.total {
    margin: 0 var(--m) 0 var(--m);
    padding: var(--m);

    text-align: center;
    font-size: var(--h4);
    line-height: var(--lineHeight);
    text-transform: uppercase;
    font-weight: normal;
}


/* .total {
    border-top: 1px solid black;
    padding-top: 0.25rem;
    text-align: right;
    font-size: var(--h6);
    line-height: var(--lineHeight);
    text-transform: uppercase;
    font-weight: bold;
} */

/* #menuSummary {
    width: 100%;
    row-gap: 0.25rem;
    justify-content: space-between;
}

#menuSummary h5 {
    padding-bottom: var(--m);
} */

/* -------------------------------------------------------------- Buttons */
#buttons {
    justify-content: center;
    gap: 0;
}

#buttons .button {
    /* border-left-width: 0 !important;
    border-right-width: 0 !important; */
}

#buttons .button+.button {
    /* border-left-width: 0 !important; */
    border-left: 1px solid black;
}

.button {
    display: flex;
    flex-direction: row;
    column-gap: var(--m);
    align-items: center;
    justify-content: space-between;
    text-align: center;

    background-color: white;
    color: var(--lightContrast);

    padding: var(--mm);

    width: 100%;

    font-size: var(--h5);
    line-height: var(--lineHeightTitle);
    text-transform: uppercase;
    font-weight: bold;

    /* border: 1px solid var(--borderColor); */
    border: var(--lineWidth) solid var(--dark);
    border-width: 1px 0px;


    border-radius: var(--radius);
    cursor: pointer;
}

.button.center {
    justify-content: center;
}

.button.invert {
    background-color: var(--dark);
    color: var(--bgColor);
}

.button:hover {
    background-color: var(--dark) !important;
    /* background-color: var(--lightContrast) !important; */
    color: var(--bgColor);
    /* border-color: var(--bgColor); */
}

/* CASSSSE */
.layer .button:hover {
    color: var(--bgColor) !important;
}

.button.invert:hover {
    background-color: white !important;
    color: var(--dark);
    border-color: var(--dark);
}

.button.disable {
    border-color: var(--lightContrast) !important;
    background-color: var(--light) !important;
    color: var(--lightContrast) !important;
    opacity: 0.5;
    cursor: none;
    pointer-events: none;
}

.return {
    width: unset;
}

.validate {
    width: unset;
    flex-grow: 1;
}


.dot {
    width: var(--m);
    height: var(--m);
    background-color: white;
    border: 1px solid var(--borderColor);
    margin-top: calc(var(--m) / -2);
    border-radius: 100%;
    cursor: pointer;
}

.dot:hover,
.dot.full {
    background-color: var(--borderColor);
}

.category {
    display: flex;
    flex-direction: column;
    row-gap: var(--m);
    align-items: start;
    justify-content: start;

    padding: var(--m);
    border: var(--lineWidth) solid transparent;

    cursor: pointer;
}

.category:hover {
    border: var(--lineWidth) solid var(--dark);
}

.category.unavailable {
    opacity: 0.5;
    pointer-events: none;
}

/* .category.unavailable.visible {
    opacity: 1;
    pointer-events: all;
} */

/* .category.visible {
    display: flex;
    opacity: 1;
} */


/* OLD item in rect */
/* .item {
    width: 100%;
    font-size: var(--h5);
    line-height: var(--lineHeightTitle);
    padding: var(--m);
    border: 1px solid var(--borderColor);
    display: flex;
    flex-direction: row;
    column-gap: var(--m);
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius);
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
} */

/* .item.selected {
    background-color: var(--schemeColor);
    color: var(--textColorHover);
} */

/* .item:hover {
    background-color: var(--schemeColorHover);
    color: var(--textColorHover);
} */

.categoryTitle {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
}

.categoryTitle p {
    position: relative;
}

.categoryTitle p:first-child {
    flex: 1;
}

.categoryTitle .remix {
    flex: 0;
    padding-left: var(--m);
}



.items {
    display: none;
    flex-direction: row;
    gap: var(--mm);
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

/* .items {
    display: none;
    gap: var(--mm);
    width: 100%;
} */

.category.visible .items {
    display: flex;
    /* display: grid; */
}

.category.editable {
    border: var(--lineWidth) solid var(--dark);
    /* content: "✐";
    display: block;
    position: absolute;
    right: calc(-1 * var(--mm));
    top: 0px; */

}

.item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--dm);


    /* flex: 0 0 calc((100% - 3 * var(--mm)) / 4 - 1px); */
    width: calc((100% - 3 * var(--mm)) / 4 - 1px);
    font-size: var(--h5);
    line-height: var(--lineHeightTitle);
    /* padding: var(--m); */


    border-radius: var(--radius);
    cursor: pointer;
    text-transform: uppercase;
    text-align: center;
    /* font-weight: bold; */
    font-weight: 100;
}

.itemQuarter {
    width: calc((100% - 3 * var(--mm)) / 4 - 1px);
}

.itemThird {
    width: calc((100% - 2 * var(--mm)) / 3 - 1px);
}

.itemHalf {
    width: calc((100% - 1 * var(--mm)) / 2 - 1px);
}

.itemFull {
    width: calc((100% - 0 * var(--mm)) / 1 - 1px);
}

.item.selected {
    font-weight: 600;
}

.item.unavailable {
    opacity: 0.5;
    pointer-events: none;
}

.item:hover .checkbox::after {
    opacity: 1;
}

.item.selected .checkbox::after {
    opacity: 1;
}

.item.selected .itemImg img {
    border: 3px solid var(--borderColor) !important;
}

.price {
    font-size: var(--h6);
    line-height: var(--lineHeight);
    font-weight: 100;
}

.checkbox {
    position: relative;
    display: block;
    width: var(--h4);
    aspect-ratio: 1;

    border: 2px solid var(--borderColor);
    border-radius: 100%;

    cursor: pointer;
}

.checkbox input {
    position: absolute;
    opacity: 0;
}

.checkbox::after {
    content: "";
    position: absolute;

    width: 70%;
    aspect-ratio: 1;

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    border-radius: 100%;
    background-color: var(--dark);

    /* opacity: 1; */
    opacity: 0;
}

.itemImg {
    /* as checkbox values */
    /* width: 100%;
    max-width: calc((100% - 3 * var(--mm)) / 4 - 1px); */
    max-width: var(--c1);
}

.itemImg img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;

    border: 1px solid var(--borderColor);
}



#nav {
    position: absolute;
    bottom: calc(var(--footer) + var(--mmm));
    left: var(--mm);
    pointer-events: all;
}

#nav>div {
    cursor: pointer;
}

#help {
    line-height: var(--lineHeightTitle);
    position: absolute;
    /* top: calc(var(--header) + var(--mm)); */
    top: var(--m);
    left: var(--mm);
    border: 1px solid var(--borderColor);
    padding: var(--m);
    border-radius: var(--radius);
    background-color: var(--bgColor);
}

/* -------------------------------------------------------------- Intro */

#intro {
    position: absolute;
    width: 100dvw;
    height: 100dvh;

    display: grid;
    grid-template-columns: var(--c8) var(--c4);
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "title image"
        "layers image";
    column-gap: var(--gap);

    padding: calc(var(--h2) + var(--mmmm)) var(--mm) 0 var(--mm);

    background-color: var(--bgColor);
    /* height: 100dvh;
    overflow-y: scroll; */
}

#introTitle {
    grid-area: title;
}

/* #introTitle h1 {
    font-weight: bolder;
} */

#introLayers {
    grid-area: layers;
    position: relative;
    width: 100%;
}

#introImage {
    grid-area: image;
    height: 100%;
}

/* -------------------------------------------------------------- Header */
#header {
    position: absolute;
    top: var(--mm);
    line-height: var(--lineHeightTitle) !important;

    height: var(--header);

    align-content: center;
    left: var(--mm);
    right: var(--mm);
    justify-content: space-between;

    /* PATCH? */
    background-color: var(--bgColor);
    /* background-color: red; */
    z-index: 3;

    flex-wrap: nowrap;
}

#logo {
    height: var(--h2);
    margin: var(--m) 0 var(--m) var(--mm);
}

#titleWrapper {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

#title {
    margin-top: 5px;
    height: 60%;
}

/* -------------------------------------------------------------- Footer */
#footer {
    z-index: 10;
    position: absolute;
    /* bottom: var(--mm); */
    bottom: var(--mm);

    /* height: calc(var(--h3)*3); */
    align-content: center;
    left: var(--mm);
    right: var(--mm);
    /* justify-content: flex-end; */
    border-radius: var(--radius);
    padding: var(--mm);


    /* TO fix ? */
    /* height: fit-content; */
    /* align-content: center; */
    /* left: var(--mm); */
    /* right: var(--mm); */
    /* padding: var(--mm); */
    /* border-radius: var(--radius); */

    /* background-color: var(--light); */
    color: var(--dark);

    font-size: var(--h6);
    background-color: var(--bgColor);
}

#footer * {
    line-height: var(--lineHeightFooter) !important;
}

/* #footer>div>div {
    width: var(--c2);
} */

#footer *.noGap {
    gap: 0 !important;
}

#footer .label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--dm);
}


/* -------------------------------------------------------------- Layer */
.layer {
    position: absolute;
    /* inset: var(--mm); */
    /* width: 50dvw; */
    border-radius: var(--radius);
    padding: var(--mm);

    cursor: pointer;
}


.layerRow {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: space-between;
    gap: var(--mm);
}

.layerColumnLeft,
.layerColumnRight {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    font-size: var(--h3);
    line-height: var(--lineHeight);
    height: 100%;
    /* background-color: blue; */
    justify-content: space-between;

}

/* .layerInnerWrapper {

} */

.layerColumnLeft {
    width: calc(75% - var(--m));
    /* width: 100%; */
}

/* .layerColumnRight {
    width: calc(25% - var(--m));
} */

.layerDetails {
    width: 100%;
    font-size: var(--h2);
    line-height: var(--lineHeight);
    display: flex;
    flex-direction: row;
    column-gap: var(--mm);
}

.layerContents {
    /* width: calc(70% - var(--m)); */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--mm);
    font-size: var(--h4);
    line-height: var(--lineHeight);
    /* height: 100%; */
}

.layerContents>div {
    width: calc(50% - var(--m));
}

/* .layer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
} */

.imgLayer {
    height: 100%;
    margin-left: calc(-1 * var(--mm));
}

.imgLayer img {
    width: 100%;
    height: 100%;
    object-fit: contain;

    mix-blend-mode: darken;
}


.layer .button {
    background-color: unset;
    margin-top: var(--m);
    font-weight: 100;
    border: 1px solid black;
}

.layerTitle {
    font-weight: bold;
    padding-bottom: var(--m);
    text-transform: uppercase;
}

#dev {
    line-height: var(--lineHeightTitle);
}


/* -------------------------------------------------------------- Custom */
.blur {
    background-color: var(--bgBlur);
    -webkit-backdrop-filter: blur(var(--blur));
    backdrop-filter: blur(var(--blur));
}

.border {
    border: var(--lineWidth) solid var(--dark);
}

.borderLR {
    border-left: var(--lineWidth) solid var(--dark);
    border-right: var(--lineWidth) solid var(--dark);
}

.borderL {
    border-left: var(--lineWidth) solid var(--dark);
}

.borderR {
    border-right: var(--lineWidth) solid var(--dark);
}

.pad {
    padding: var(--mm);
}

@media screen and (orientation: portrait) {
    html {
        font-size: calc(2dvw);
    }


    #header,
    #header * {
        border: unset;
    }

    #titleWrapper {
        justify-content: end;
    }

    #title {
        margin: unset;
        height: 50%;
    }

    #logo {
        margin: unset;
    }

    #intro {
        padding-right: 0;
        padding-bottom: 0;
        padding-left: 0;

        grid-template-columns: 1fr;
        grid-template-rows: auto 30dvh 1fr;
        grid-template-areas:
            "title"
            "image"
            "layers";
        /* row-gap: var(--mm); */
    }

    #introTitle,
    #introImage {
        border: unset;
        border-top: var(--lineWidth) solid var(--dark);
    }

    .imgLayer {
        padding-right: unset;
    }

    /* #introTitle {
        margin-top: var(--mm);
    } */

    .layerColumnLeft {
        width: 100%;
    }

    /* -------------------------------------------------------------- Configurator */
    #menu {
        top: unset;
        bottom: var(--footer);
        right: 0;
        left: 0;

        width: calc(var(--c12) + var(--mmmm));
        height: 50dvh;

        padding-top: var(--m);

        border: unset;

        /* TEMP */
        /* background-color: var(--bgColor) !important; */
    }

    /* #menu::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--bgColor);
    } */


    .checkbox {
        border: 1px solid var(--dark);
    }

    #nav {
        bottom: calc(50dvh + var(--mm));
    }


    #footer {
        display: none;
    }
}

@media (max-aspect-ratio: 565/1015) {
    html {

        font-size: calc(3dvw);
    }
}


/* -------------------------------------------------------------- Request form */
/* The form fills the menu height; only .formFields scrolls */
#menuForm {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

#requestForm {
    gap: var(--m);
    padding: var(--m);
    flex: 1 1 0;
    min-height: 0;
    flex-wrap: nowrap;
}

#requestForm .formFields {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--m);
    /* hidden scrollbar, like #menuPage */
    scrollbar-width: none;
}

#requestForm .formFields::-webkit-scrollbar {
    display: none;
}

#requestForm .field {
    display: flex;
    flex-direction: column;
    gap: var(--dm);
}

#requestForm input,
#requestForm textarea {
    background-color: transparent;
    width: 100%;
    font: inherit;
    font-size: var(--h4);
    line-height: var(--lineHeightFooter);
    padding: var(--m);
    border: var(--lineWidth) solid var(--dark);
    border-radius: var(--radiusInput);
    /* background-color: white; */
    color: var(--dark);
    outline: none;
}

#requestForm input:focus,
#requestForm textarea:focus {
    box-shadow: inset 0 0 0 var(--lineWidth) var(--dark);
}

/* Generated configuration (read-only): hidden, but still sent with the form */
#requestForm .field-configuration {
    display: none;
}

#requestForm .field-configuration textarea {
    background-color: transparent;
    font-size: var(--h6);
}

#requestForm .field.invalid input,
#requestForm .field.invalid textarea {
    border-color: var(--errorColor);
}

#requestForm .fieldError {
    color: var(--errorColor);
    font-size: var(--h6);
    line-height: 1.3em;
}

#requestForm .fieldError:empty {
    display: none;
}

#requestForm .formStatus {
    font-size: var(--h6);
    line-height: 1.3em;
}

#requestForm .formStatus:empty {
    display: none;
}

#requestForm .formStatus[data-kind="error"] {
    color: var(--errorColor);
}

#requestForm .formStatus[data-kind="success"] {
    font-weight: bold;
}

/* Step "thank you": only the thank-you text, centered vertically
   between the top of the block and the Restart button */
#requestForm .formThanks {
    display: none;
}

#requestForm.thanks h2,
#requestForm.thanks h6,
#requestForm.thanks .formFields,
#requestForm.thanks .formStatus {
    display: none;
}

#requestForm.thanks .formThanks {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Bottom buttons disabled while sending */
#buttons.busy .button {
    pointer-events: none;
    opacity: 0.5;
}

/* Honeypot: off-screen for humans, still "visible" to bots */
.hpField {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Visible to screen readers only */
.srOnly {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* -------------------------------------------------------------- GLB loader */
.glbLoader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.glbLoader.hidden {
    opacity: 0;
}

.glbLoaderBar {
    width: min(240px, 50vw);
    height: 2px;
    background: var(--light);
    overflow: hidden;
}

.glbLoaderBar span {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--dark);
    transition: width 0.2s linear;
}

.glbLoaderText {
    color: var(--dark);
}

.glbLoader.error .glbLoaderBar {
    display: none;
}

/* -------------------------------------------------------------- Nav info (dimensions) */
.navInfo {
    align-self: center;
    margin-left: var(--m);
    cursor: default;
}