/*
 * @Author: Leo Zhao
 * @Date: 2023-09-04 14:15:53
 * @LastEditTime: 2023-09-18 11:15:08
 * @Description: file content
 * @FilePath: /HuaJing/src/optimized/elegant/css/style.css
 */

/* TODO: confirm font */
/* this font is mainly used in `footer` element and login inputs
    therefore, it might not be probable to be replaced by subsets
*/
@font-face {
    font-family: 'PuHuiTi';
    /* TODO: make woff2 and woff type to optimize performance */
    src: url(../assets/Alibaba_PuHuiTi_2.0_45_Light_45_Light.ttf) format('truetype');
}

body {
    margin: 0;
    /* only one page, no need to scroll */
    overflow: hidden;

    --color-main: "white"; /* controls the color of logo and footer */
    --color-indicator: #000;
}

/* ----------- MARK: preset animations ----------- */
@keyframes fadeInOut {
    0% { opacity: 1.0; }
    100% { opacity: 0.5; }
}

@keyframes scaleOut {
    0% {
        transform:scale(0, 0);
        opacity: 0.0;
    }
    10% {
        opacity: 1.0;
    }
    60% {
        opacity: 1.0;
    }
    100% {
        transform:scale(1, 1);
        opacity: 0.0;
    }
}

@keyframes bounceScaleOut {
    0% {
        transform: translate(-50%, -50%) scale(1.0);
    }

    30% {
        transform: translate(-50%, -50%) scale(1.2);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        transform: translate(-50%, -50%) scale(0.001);
    }
}

@keyframes scaleUp {
    0% { transform: scale(0.6); }
    100% { transform: scale(1.0); }
}

/* ----------- MARK: preset elements ----------- */
img.prompt {
    position: fixed;
    width: auto;
    height: 1.8rem;

    transform: translateX(-50%);
}

/* ----------- MARK: indicator ----------- */
.indicator {
    position: absolute;
    cursor: pointer;

    /* indicator is always on the very top */
    z-index: 999; 
}

.indicatorInner {
    width: 100%;
    height: 100%;

    transform-origin: 50% 50%;
}

/* indicator's waves */
.indicatorInner > div {
    position: absolute;
    top: 0;
    left: 0;

    display: block;
    width: 100%;
    height: 100%;

    border: 2px solid var(--color-indicator);

    box-sizing: border-box;
    border-radius: 50%;

    opacity: 1;
}

/* central circle */
.indicatorInner > div:nth-child(1) {
    width: 7.5%;
    height: 7.5%;

    top: 46.25%;
    left: 46.25%;

    background-color: var(--color-indicator);

    animation: fadeInOuteOut 1s 0s infinite linear alternate;
}

/* first ring */
.indicatorInner > div:nth-child(2) {
    transform: scale(0, 0);
    animation: scaleOut 3s 0.1s infinite linear normal;
}

.indicatorInner > div:nth-child(3) {
    transform: scale(0, 0);
    animation: scaleOut 3s 1.1s infinite linear normal;
}

.indicatorInner > div:nth-child(4) {
    transform: scale(0, 0);
    animation: scaleOut 3s 2.1s infinite linear normal;
}


/* ----------- MARK: main framework ----------- */

/* ----------- MARK: logo ----------- */
/* TODO: RDN responsiveness design needed */
#logo {
    position: absolute;
    top: 5%;
    left: 4%;

    width: 8%;
    min-width: 7rem;

    /* show logo when the window is ready to make it more natural */
    opacity: 0.0;

    transition: opacity 0.5s, filter 1s;

    z-index: 997;
}

#logo > img {
    width: 100%;
}

/* ----------- MARK: first stage ----------- */
#firstStage {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background-color: black;
}

#firstStageBackground {
    width: 100%;
    height: 100%;
}

/* ----------- MARK: second stage ----------- */
#secondStage {
    position: absolute;
    top: 0;
    left: 0;

    opacity: 0.0;
    transition: opacity 0.5s;
}

#meteorsContainer > .meteor {
    position: absolute;

    width: 0;
    height: 0;

    border-top: 1.5px solid transparent;
    border-bottom: 1.5px solid transparent;
    border-radius: 0 3px 3px 0;
}

/* right top */
#meteorsContainer > div:nth-child(1) {
    right: 0;
    top: 0;

    border-left: 10vw solid white;
    border-image: linear-gradient( to right, white, transparent ) 1 100%;

    transform-origin: 0 100%;
}

/* left bottom */
#meteorsContainer > div:nth-child(2) {
    left: 0;
    bottom: 0;

    border-right: 10vw solid white;
    border-image: linear-gradient( to left, white, transparent ) 1 100%;

    transform-origin: 100% 0;
}

#secondStageBackground > canvas {
    transition: opacity 1.5s;
}

/* ----------- MARK: third stage ----------- */
#thirdStage {
    position: absolute;
    top: 0;
    left: 0;

    width: 100vw;
    height: 100vh;
}

#porcelainSVG {
    position: absolute;
    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%) scale(0.01);
}

#coloredPorcelain {
    position: absolute;
    top: 50%;
    left: 50%;

    background-image: url(../assets/third-stage-mounts.png);
    background-size: 143% 70%;
    background-repeat: no-repeat;
    background-position: center bottom -30%;

    mask-image: url(../assets/third-stage-porcelain.svg);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: cover;
    -webkit-mask-image: url(../assets/third-stage-porcelain.svg);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: cover;

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

    opacity: 0.0;

    z-index: 5;
}

.strokedPorcelainContainer {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;
}

.strokedPorcelain {
    position: absolute;
    top: 50%;
    left: 50%;

    opacity: 0.0;

    transform-origin: center 80%;
}

/* ----------- MARK: login module ----------- */
#loginModule {
    visibility: hidden;
    opacity: 0.0;
    z-index: 995;
}

#loginModuleBackground {
    display: flex;
    justify-content: center;
    align-items: center;

    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background-color: white;
}

#loginModuleBackground > div {
    width: 100%;
    height: 100%;

    background-image: url(../assets/third-stage-mounts.png);
    background-size: cover;
    background-position: center;

    opacity: 0.0;
}

#loginComponentsContainer {
    visibility: hidden;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    position: absolute;
    top: 47%;
    left: 50%;

    background-color: white;
    border-radius: 8px;
    box-shadow: 0 0 20px 6px rgba(0,0,0,0.3);
    padding: 4rem 2.5rem 3.5rem 2.5rem;

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

    z-index: inherit;
}

#loginComponentsContainer > img:first-child {
    width: 8%;
    min-width: 7rem;

    margin-bottom: 3.5rem;
}

#loginComponentsContainer > input {
    width: 16rem;
    font-size: 1.15rem;
    font-family: 'PuHuiTi';
    letter-spacing: 2px;

    background-position: 3% center;
    background-repeat: no-repeat;
    background-size: auto 1.5rem;
    background-color: transparent;

    padding: 5px;
    margin: 1rem 0;
    border: none;
    outline: none;
}

#loginComponentsContainer > input::selection {
    background-color: #000;
    color: #fff;
}

#loginComponentsContainer > input[name="username"] {
    background-image: url(../assets/login-module-username.svg);
}

#loginComponentsContainer > input[name="password"] {
    background-image: url(../assets/login-module-password.svg);
}

#loginConfirmButton {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 10rem;

    background-color: transparent;
    margin-top: 3rem;
    border-radius: 4px;

    cursor: auto;

    transition: background-color 0.5s;
}

/* if username input and password input have contents */
#loginComponentsContainer:has(input[name="username"]:not(:placeholder-shown)):has(input[name="password"]:not(:placeholder-shown))
> #loginConfirmButton {
    background-color: #000;
    cursor: pointer;
}

/* the button caption */
#loginConfirmButton > svg {
    width: 70%;
    padding: 2% 7%;

    transition: fill 0.5s;
}

#loginComponentsContainer:has(input[name="username"]:not(:placeholder-shown)):has(input[name="password"]:not(:placeholder-shown))
> #loginConfirmButton > svg {
    fill: #fff;
}


/* ----------- MARK: footer ----------- */
#footer {
    --footer-bg-color: black;
    --footer-text-color: white;

    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;

    position: fixed;
    bottom: 0;
    left: 15%;

    width: 70%;
    height: 4rem;

    font-family: "PuHuiTi";
    font-size: 0.95rem;

    color: var(--footer-text-color);
    background-color: var(--footer-bg-color);
    border-radius: 16px 16px 0 0;

    transform: translateY(100%);
    transition: transform 0.8s;

    z-index: 999;
}

#footer > span {
    padding-left: 6px;
    border-left: 2px solid var(--footer-text-color);
}

#footer img {
    vertical-align: middle;
    padding-right: 4px;
}