:root {

    --tb-dark: #282538;

    --tb-pink: #EDD2CB;

    --tb-blue: #608791;

    --tb-burgundy: #730B32;

}


/* ======================================================
   RESET
   ====================================================== */

* {
    box-sizing: border-box;
}


html,
body {

    margin: 0 !important;
    padding: 0 !important;

    width: 100%;
    min-height: 100%;

    overflow: hidden;

}


body.tarotbar-fullscreen-page {

    margin: 0 !important;
    padding: 0 !important;

    background: var(--tb-dark);

}


/* ======================================================
   HOME
   ====================================================== */

.tb-home {

    position: relative;

    width: 100vw;
    height: 100dvh;

    min-height: 100dvh;

    overflow: hidden;

    background: var(--tb-dark);

    color: var(--tb-pink);

}


/* ======================================================
   SCENA 16:9
   ====================================================== */

.tb-scene {

    position: absolute;

    left: 50%;
    top: 50%;

    width: max(
        100vw,
        calc(100dvh * 16 / 9)
    );

    height: max(
        100dvh,
        calc(100vw * 9 / 16)
    );

    transform:
        translate(-50%, -50%);

    background-image:
        url("../img/home-background.webp");

    background-size:
        100% 100%;

    background-position:
        center center;

    background-repeat:
        no-repeat;

    overflow: hidden;

    z-index: 1;

}


/* ======================================================
   HEADER
   ====================================================== */

.tb-header {

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 86px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding:
        0 4vw;

    z-index: 50;

}


.tb-logo {

    color: var(--tb-pink);

    text-decoration: none;

    font-size: 16px;

    font-weight: 600;

    letter-spacing: .28em;

}


.tb-nav {

    display: flex;

    gap: 34px;

}


.tb-nav a {

    color: var(--tb-pink);

    text-decoration: none;

    font-size: 10px;

    letter-spacing: .17em;

    text-transform: uppercase;

    opacity: .72;

    transition:
        opacity 250ms ease;

}


.tb-nav a:hover {

    opacity: 1;

}


/* ======================================================
   PORTE
   ====================================================== */

.tb-door {

    position: absolute;

    top: 17.5%;

    width: 26%;

    aspect-ratio:
        449.23 / 600.89;

    display: block;

    color: var(--tb-pink);

    text-decoration: none;

    z-index: 5;

    transition:
        filter 350ms ease,
        opacity 350ms ease;

}


.tb-door-school {

    left: 7.5%;

}


.tb-door-bar {

    right: 7.5%;

}


.tb-door-art {

    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    object-fit: contain;

    pointer-events: none;

    user-select: none;

    transition:
        transform 450ms ease,
        filter 450ms ease,
        opacity 450ms ease;

}


.tb-door-content {

    position: absolute;

    left: 50%;
    top: 56%;

    transform:
        translate(-50%, -50%);

    width: 80%;

    display: flex;

    flex-direction: column;

    align-items: center;

    text-align: center;

    z-index: 3;

    pointer-events: none;

    transition:
        transform 350ms ease;

}


.tb-door-kicker {

    margin-bottom: 20px;

    color: var(--tb-pink);

    font-size: 9px;

    letter-spacing: .30em;

    text-transform: uppercase;

    opacity: .66;

}


.tb-door-title {

    color: var(--tb-blue);

    font-size:
        clamp(
            28px,
            3.1vw,
            58px
        );

    font-weight: 300;

    line-height: 1;

    letter-spacing: .08em;

    white-space: nowrap;

}


.tb-door-action {

    margin-top: 36px;

    padding:
        10px 24px;

    border:
        1px solid rgba(
            237,
            210,
            203,
            .72
        );

    color: var(--tb-pink);

    font-size: 8px;

    letter-spacing: .22em;

    text-transform: uppercase;

    transition:
        background 250ms ease,
        color 250ms ease;

}


@media (hover: hover) {

    .tb-door:hover
    .tb-door-art {

        transform:
            scale(1.012);

        filter:
            drop-shadow(
                0 16px 25px
                rgba(0, 0, 0, .20)
            );

    }


    .tb-door:hover
    .tb-door-content {

        transform:
            translate(-50%, -53%);

    }


    .tb-door:hover
    .tb-door-action {

        background:
            var(--tb-pink);

        color:
            var(--tb-dark);

    }

}


.tb-door.is-selected
.tb-door-art {

    transform:
        scale(1.025);

    filter:
        brightness(1.10)
        drop-shadow(
            0 0 30px
            rgba(96, 135, 145, .26)
        );

}


/* ======================================================
   MATTO
   ====================================================== */

.tb-mat {

    position: absolute;

    left: 50%;
    top: 25%;

    transform:
        translateX(-50%);

    width: 23%;

    aspect-ratio:
        1 / 1;

    z-index: 10;

    cursor: default;

    pointer-events: none;

    /*
     * Il movimento deve durare più o meno
     * quanto l'animazione Lottie rallentata.
     */
    transition:
        transform 3200ms
        cubic-bezier(.45, .05, .25, 1);

    will-change:
        transform;

}

.tb-mat-animation {

    width: 100%;
    height: 100%;

    transform:
        scaleX(1);

    transform-origin:
        center center;

    transition:
        transform 450ms ease;

    will-change:
        transform;

}

/* ======================================================
   MOVIMENTO DEL MATTO VERSO LE PORTE
   ====================================================== */

/*
 * TAROT BAR
 *
 * Il bastone guarda già verso destra.
 * Spostiamo tutto il personaggio verso destra.
 */
.tb-mat.is-moving-right {

    transform:
        translateX(-50%)
        translateX(27%);

}


/*
 * SCUOLA
 *
 * Prima ribaltiamo graficamente il Matto,
 * così il bastone guarda verso sinistra.
 */
.tb-mat-animation.is-flipped {

    transform:
        scaleX(-1);

}


/*
 * Poi muoviamo tutto il personaggio
 * verso la porta di sinistra.
 */
.tb-mat.is-moving-left {

    transform:
        translateX(-50%)
        translateX(-27%);

}


/*
 * Piccolo feedback nel momento del contatto.
 */
.tb-door.is-touched .tb-door-art {

    filter:
        brightness(1.15)
        drop-shadow(
            0 0 28px
            rgba(96, 135, 145, .45)
        );

}


.tb-door.is-touched .tb-door-content {

    transform:
        translate(-50%, -53%)
        scale(1.025);

}

.tb-mat-animation svg {

    width: 100% !important;
    height: 100% !important;

    overflow: visible !important;

    filter:
        drop-shadow(
            0 16px 22px
            rgba(0, 0, 0, .12)
        );

}


/* ======================================================
   FOOTER
   ====================================================== */

.tb-footer {

    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    min-height: 54px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding:
        0 4vw;

    color:
        var(--tb-pink);

    font-size: 8px;

    letter-spacing: .14em;

    text-transform: uppercase;

    opacity: .56;

    z-index: 50;

}


.tb-footer nav {

    display: flex;

    gap: 26px;

}


.tb-footer a {

    color: inherit;

    text-decoration: none;

}


/* ======================================================
   TABLET
   ====================================================== */

@media (
    max-width: 1000px
) {

    .tb-door {

        width: 28%;

    }


    .tb-door-school {

        left: 4.5%;

    }


    .tb-door-bar {

        right: 4.5%;

    }


    .tb-mat {

        width: 26%;

    }

}


/* ======================================================
   MOBILE - PRIMO FALLBACK
   ====================================================== */

@media (
    max-width: 700px
) {

    .tb-header {

        height: 65px;

        padding:
            0 18px;

    }


    .tb-logo {

        font-size: 12px;

    }


    .tb-nav {

        gap: 16px;

    }


    .tb-nav a {

        font-size: 8px;

    }


    .tb-footer {

        padding:
            0 18px;

        font-size: 7px;

    }


    .tb-door-title {

        font-size: 24px;

    }


    .tb-door-kicker {

        font-size: 7px;

    }


    .tb-door-action {

        padding:
            7px 12px;

        font-size: 7px;

    }

}

/* ======================================================
   ORIENTATION LOCK
   ====================================================== */

.tb-orientation-lock {
    display: none;
}


/*
 * Smartphone in verticale:
 * nascondiamo l'esperienza e chiediamo
 * la rotazione del dispositivo.
 */
@media (orientation: portrait) and (max-width: 900px) {

    body.tarotbar-fullscreen-page {
        overflow: hidden;
    }


    .tb-home {
        visibility: hidden;
        pointer-events: none;
    }


    .tb-orientation-lock {

        position: fixed;

        inset: 0;

        display: flex;

        align-items: center;
        justify-content: center;

        padding: 32px;

        background:
            radial-gradient(
                circle at center,
                #302d43 0%,
                #282538 60%,
                #1f1d2c 100%
            );

        color: #EDD2CB;

        z-index: 99999;

    }


    .tb-orientation-lock-inner {

        width: min(360px, 90vw);

        display: flex;

        flex-direction: column;

        align-items: center;

        text-align: center;

    }


    .tb-orientation-title {

        margin-top: 34px;

        font-size: 15px;

        font-weight: 500;

        letter-spacing: .22em;

    }


    .tb-orientation-text {

        margin-top: 14px;

        max-width: 310px;

        font-size: 11px;

        line-height: 1.7;

        letter-spacing: .06em;

        opacity: .66;

    }


    /*
     * Icona telefono
     */

    .tb-phone-rotate {

        position: relative;

        width: 72px;
        height: 118px;

        border:
            2px solid rgba(
                237,
                210,
                203,
                .82
            );

        border-radius: 11px;

        animation:
            tbRotatePhone
            2200ms
            ease-in-out
            infinite;

        transform-origin:
            center center;

    }


    .tb-phone-rotate-screen {

        position: absolute;

        inset: 8px;

        border:
            1px solid rgba(
                96,
                135,
                145,
                .65
            );

        border-radius: 5px;

    }


    @keyframes tbRotatePhone {

        0% {

            transform:
                rotate(0deg);

        }


        25% {

            transform:
                rotate(0deg);

        }


        65% {

            transform:
                rotate(90deg);

        }


        90%,
        100% {

            transform:
                rotate(90deg);

        }

    }

}

/* ======================================================
   PWA INSTALL
   ====================================================== */

.tb-install-button {

    display: none;

    border: 0;

    background: transparent;

    color: var(--tb-pink);

    padding: 0;

    font: inherit;

    font-size: 10px;

    letter-spacing: .17em;

    text-transform: uppercase;

    opacity: .72;

    cursor: pointer;

    transition:
        opacity 250ms ease;

}


.tb-install-button:hover {
    opacity: 1;
}


.tb-orientation-install {

    display: none;

    margin-top: 28px;

    padding:
        11px 20px;

    border:
        1px solid rgba(
            237,
            210,
            203,
            .70
        );

    background:
        transparent;

    color:
        var(--tb-pink);

    font-size: 9px;

    letter-spacing: .18em;

    cursor: pointer;

}


/* ======================================================
   INSTALL MODAL
   ====================================================== */

.tb-install-modal {

    position: fixed;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        rgba(20, 18, 30, .82);

    backdrop-filter:
        blur(10px);

    -webkit-backdrop-filter:
        blur(10px);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 250ms ease,
        visibility 250ms ease;

    z-index: 100000;

}


.tb-install-modal.is-visible {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

}


.tb-install-panel {

    position: relative;

    width:
        min(430px, 92vw);

    max-height:
        90dvh;

    overflow-y: auto;

    padding:
        38px 34px 32px;

    border:
        1px solid rgba(
            237,
            210,
            203,
            .22
        );

    background:
        #282538;

    color:
        var(--tb-pink);

    box-shadow:
        0 24px 70px
        rgba(0, 0, 0, .30);

}


.tb-install-close {

    position: absolute;

    top: 14px;
    right: 17px;

    border: 0;

    background:
        transparent;

    color:
        var(--tb-pink);

    font-size: 25px;

    cursor: pointer;

    opacity: .55;

}


.tb-install-kicker {

    margin-bottom: 12px;

    font-size: 8px;

    letter-spacing: .30em;

    color:
        var(--tb-blue);

}


.tb-install-title {

    margin: 0;

    font-size: 25px;

    font-weight: 300;

    letter-spacing: .04em;

}


.tb-install-description {

    margin:
        14px 0 27px;

    font-size: 12px;

    line-height: 1.65;

    opacity: .68;

}


.tb-install-step {

    display: grid;

    grid-template-columns:
        32px 1fr;

    gap: 13px;

    align-items: center;

    padding:
        13px 0;

    border-bottom:
        1px solid rgba(
            237,
            210,
            203,
            .09
        );

}


.tb-install-step > span {

    width: 28px;
    height: 28px;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        1px solid
        rgba(
            96,
            135,
            145,
            .75
        );

    border-radius:
        50%;

    color:
        var(--tb-blue);

    font-size: 10px;

}


.tb-install-step p {

    margin: 0;

    font-size: 11px;

    line-height: 1.5;

}


.tb-install-generic {

    display: none;

    font-size: 12px;

    line-height: 1.7;

}


.tb-install-ok {

    width: 100%;

    margin-top: 28px;

    padding:
        12px 20px;

    border:
        1px solid
        rgba(
            237,
            210,
            203,
            .72
        );

    background:
        transparent;

    color:
        var(--tb-pink);

    font-size: 9px;

    letter-spacing:
        .20em;

    cursor: pointer;

}


.tb-install-ok:hover {

    background:
        var(--tb-pink);

    color:
        var(--tb-dark);

}


/*
 * Il JS aggiunge questa classe quando
 * l'installazione è disponibile.
 */

body.tb-pwa-installable
.tb-install-button,

body.tb-pwa-installable
.tb-orientation-install {

    display: inline-block;

}


/*
 * Su iPhone vogliamo mostrare il pulsante
 * anche senza beforeinstallprompt.
 */

body.tb-pwa-ios
.tb-install-button,

body.tb-pwa-ios
.tb-orientation-install {

    display: inline-block;

}


/*
 * App già installata:
 * niente pulsante.
 */

body.tb-pwa-standalone
.tb-install-button,

body.tb-pwa-standalone
.tb-orientation-install {

    display: none !important;

}
