/* keyframes */

@keyframes typing {
    from {
        width: 0;
    }
}

@keyframes cursor {
    50% {
        border-right-color: transparent;
    }
}

@keyframes appear-logo {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes appear-item {
    from {
        opacity: 0;
        scale: 0;
    }

    to {
        opacity: 1;
        scale: 1;
    }
}

@keyframes rotateX {
    from {
        transform: rotateX(0);
    }

    to {
        transform: rotateX(360deg);
    }
}

@keyframes rotate370deg {
    from {
        transform: translate(-50%, -50%) rotate(10deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(370deg);
    }
}

/* css */

:root {
    --root-color: #2E2B36;
    --root-background-color: #EEE;
}

::selection {
    background-color: var(--root-color);
    color: var(--root-background-color);
}

::-webkit-scrollbar {
    width: 1em;
}

::-webkit-scrollbar-track {
    background-color: slategray;
}

::-webkit-scrollbar-thumb {
    background-color: var(--root-background-color);
    border: .3em solid slategray;
    border-radius: 50px;
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html,
body {
    background-color: var(--root-background-color);
    font-family: Noto Sans TC, Noto Sans, Noto Sans JP, sans-serif;
    line-height: 1.5;
}

a {
    text-decoration: none;
}

img {
    user-select: none;
}

main {
    margin: 2em;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
}

/* introduce */

#introduce-section {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#ashton-logo {
    width: clamp(15em, 25vw, 30em);
    border-radius: 50%;
    border: .25em solid slategray;
    transition: all .3s ease;
    animation: appear-logo .5s ease;
}

#introduce-profession {
    color: slategray;
    position: relative;
    padding: .5em 1em;
    margin: 1em 0 .5em 0;
    overflow: hidden;
    white-space: nowrap;
    border-radius: 5px;
    z-index: 1;

    &::before {
        content: "";
        position: absolute;
        width: 120%;
        height: 60%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(10deg);
        background: linear-gradient(var(--root-background-color), slategray, var(--root-background-color));
        animation: rotate370deg 10s linear infinite;
        z-index: -1;
    }

    &::after {
        content: "";
        position: absolute;
        background-color: var(--root-background-color);
        inset: 3px;
        border-radius: 5px;
        z-index: -1;
    }
}

#introduce-title-container {
    display: inline-block;
    margin-bottom: .5em;
}

#introduce-title {
    width: 100%;
    color: var(--root-color);
    border-right: .5rem solid var(--root-color);
    border-bottom: .2rem solid var(--root-color);
    letter-spacing: .2rem;
    white-space: nowrap;
    overflow: hidden;
    animation: typing 2s steps(15),
        cursor .5s step-end infinite alternate;
}

#introduce-can-container {
    width: clamp(15em, 25vw, 30em);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.introduce-can-item {
    background-color: slategrey;
    color: var(--root-background-color);
    border-radius: 50px;
    padding: .25rem 1rem;
    margin: .25rem;
    user-select: none;
    transition: all .2s ease;
    animation: appear-item ease;

    &:hover {
        background-color: var(--root-background-color);
        color: slategray;
        box-shadow: 0 0 0 2px slategray;
    }

    &:nth-child(1) {
        animation-duration: .1s;
    }

    &:nth-child(2) {
        animation-duration: .2s;
    }

    &:nth-child(3) {
        animation-duration: .3s;
    }

    &:nth-child(4) {
        animation-duration: .4s;
    }

    &:nth-child(5) {
        animation-duration: .5s;
    }

    &:nth-child(6) {
        animation-duration: .6s;
    }

    &:nth-child(7) {
        animation-duration: .7s;
    }
}

/* social media */

#social-media-section {
    width: 15em;
    background-color: rgba(112, 128, 144, .1);
    padding: 1em;
    margin: 1em;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.social-media-logo {
    width: 100%;
    animation: rotateX 2s cubic-bezier(.3, 1.5, .6, 1);
}

.social-media-link {
    width: clamp(2em, 25%, 4em);
    position: relative;

    &::before {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%) scale(0);
        background-color: #808080;
        color: var(--root-background-color);
        padding: .5rem 1rem;
        border-radius: 5px;
        transition: all .2s ease;
    }

    &:nth-child(1)::before {
        content: "Facebook";
    }

    &:nth-child(2)::before {
        content: "Instagram";
    }

    &:nth-child(3)::before {
        content: "Github";
    }

    &:hover::before {
        transform: translateX(-50%) scale(1);
    }
}

/* portfolio */

#portfolio-section {
    width: clamp(15em, 50vw, 30em);
}

#portfolio-container {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
    gap: 2em;
}

#portfolio-title {
    color: var(--root-color);
    font-weight: 900;
    margin-bottom: 1em;
}

.portfolio-card {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background-color: rgba(112, 128, 144, .4);
    box-shadow: 0 0 0 1em rgba(112, 128, 144, .4);
    animation: appear-item .5s linear;
    animation-timeline: view();
    animation-range: entry 0;
}

.portfolio-carousel-inner {
    aspect-ratio: 16 / 9;
    display: flex;
    gap: 1em;
    overflow-y: hidden;
    overflow-x: auto;
    scroll-snap-type: x mandatory;

    &::-webkit-scrollbar-track {
        border-radius: 0 0 10px 10px;
    }

    &::-webkit-scrollbar-thumb {
        border: .4em solid slategray;
    }
}

.portfolio-carousel-item {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.portfolio-card-image {
    width: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.portfolio-card-introduce-container {
    width: 100%;
    position: absolute;
    top: calc(100% + 1.5em);
    left: -1em;
    display: flex;
}

.portfolio-card-introduce {
    text-align: left;
    padding: .5em;
}

.portfolio-card-introduce-title {
    font-weight: 900;
    font-size: 1.1em;
    color: var(--root-color);
    transition: all .1s ease;
    border-radius: 10px;
    padding: 0 .5em;

    &:hover {
        background-color: #808080;
        color: var(--root-background-color);
    }
}

.portfolio-card-introduce-description {
    color: #808080;
    font-weight: 600;
    font-size: .9em;
    padding: 0 1em;
}

.portfolio-card-logo {
    width: 4em;
    height: 4em;
    background-color: var(--root-background-color);
    border-radius: 30%;
    border: .5em solid slategray;
    transition: all 1s cubic-bezier(.3, 1.5, .6, 1);

    &:hover {
        transform: rotate(360deg);
    }
}