@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    font-family: 'Poppins', sans-serif;
}

:root {
    --bg-color: #020c13;
    --text-color: #333;
    --main-color: #080707;
    --white-color: #fff;
    --cover-color: linear-gradient(45deg, #075b7d, #040505);
    --pages-color: linear-gradient(90deg, #fff, #ddd);
    --border: .125rem solid var(--main-color);
    --box-shadow: 0 0 .6rem rgba(0, 0, 0, .5);
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

/* ── Wrapper ── */
.wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 66rem;
    height: 45rem;
    padding: 2rem;
    perspective: 2000px;
}

/* ── Covers ── */
.cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: var(--cover-color);
    box-shadow: var(--box-shadow);
    border-top-left-radius: .6rem;
    border-bottom-left-radius: .6rem;
    transform-style: preserve-3d;
    z-index: 0;
}

.cover.cover-right {
    left: 50%;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: .6rem;
    border-bottom-right-radius: .6rem;
    z-index: 5;
}

/* ── Book ── */
.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    container-type: size;
}

/* ── Book Pages ── */
.book-page {
    position: absolute;
    right: 0;
    width: 50%;
    height: 100%;
    transform-origin: left;
    transform-style: preserve-3d;
    transition: transform 1s ease;
    z-index: 1;
}

.book-page.turn {
    transform: rotateY(-180deg);
}

/* ── Page Front & Back ── */
.book-page .page-front,
.book-page .page-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--pages-color);
    padding: 1.5rem 2rem;
    overflow: hidden;
    font-size: clamp(0.6rem, 1.5cqw, 1rem);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.book-page .page-front {
    transform: rotateY(0deg);
}

.book-page .page-back {
    transform: rotateY(180deg);
}

.book-page.turn {
    transform: rotateY(-180deg);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* ── Z-index Stacking ── */
#turn-1 {
    z-index: 4;
}

#turn-2 {
    z-index: 3;
}

#turn-3 {
    z-index: 2;
}

#turn-4 {
    z-index: 1;
}

/* ── Profile Page ── */
.profile-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.profile-page img {
    max-width: 160px;
    border: .25rem solid var(--main-color);
    border-radius: 30% 30% 50% 50%;
    margin-bottom: .8rem;
}

.profile-page h1 {
    font-size: 2.7rem;
    line-height: 1;
}

.profile-page h3 {
    font-size: 1.5rem;
    color: var(--main-color);
}

.profile-page .social-media {
    margin: .6rem 0 .8rem;
}

.profile-page .social-media a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    border: var(--border);
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--main-color);
    margin: 0 .2rem;
    transition: .5s;
}

.profile-page .social-media a:hover {
    background: var(--main-color);
    color: var(--white-color);
}

.profile-page .social-media a svg {
    width: 1.1rem;
    height: 1.1rem;
}

.profile-page p {
    text-align: justify;
    font-size: .95rem;
}

.profile-page .btn-box {
    margin-top: 1.2rem;
    display: flex;
    gap: 1rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 9.5rem;
    height: 3rem;
    background: var(--main-color);
    border: var(--border);
    border-radius: .3rem;
    font-size: 1rem;
    color: var(--white-color);
    font-weight: 500;
    transition: .5s;
    cursor: pointer;
}

.btn:hover {
    background: transparent;
    color: var(--main-color);
}

.btn-box .btn:nth-child(2) {
    background: transparent;
    color: var(--main-color);
}

.btn-box .btn:nth-child(2):hover {
    background: var(--main-color);
    color: var(--white-color);
}

/* ── Work Experience & Education ── */
.title {
    text-align: center;
    margin-bottom: .8rem;
    font-size: 1.5rem;
}

.workeduc-box {
    border-left: var(--border);
}

.workeduc-box .workeduc-content {
    position: relative;
    padding-left: 1.6rem;
    margin-bottom: 1.2rem;
}

.workeduc-box .workeduc-content::before {
    content: '';
    position: absolute;
    top: .15rem;
    left: -0.65rem;
    width: 1.2rem;
    height: 1.2rem;
    background: var(--main-color);
    border-radius: 50%;
}

.workeduc-content .year {
    font-weight: 400;
    color: var(--main-color);
    display: flex;
    align-items: center;
    gap: .3rem;
}

.workeduc-content .year img {
    width: 1rem;
    height: 1rem;
}

.workeduc-box .workeduc-content h3 {
    font-size: .95rem;
    margin: .2rem 0;
}

.workeduc-box .workeduc-content p {
    font-size: .85rem;
}

.workeduc-box .workeduc-content ul {
    padding-left: 1.2rem;
    font-size: .85rem;
}

/* ── Page Numbers ── */
.number-page {
    position: absolute;
    bottom: .4rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: .9rem;
    color: var(--text-color);
}

/* ── Navigation Chevrons ── */
.nextprev-btn {
    position: absolute;
    bottom: .4rem;
    cursor: pointer;
}

/* ── Mobile Only Elements ── */
.mobile-only {
    display: none;
}

.nextprev-btn img {
    width: 2rem;
    height: 2rem;
    transition: .5s;
}

.nextprev-btn img:hover {
    opacity: .6;
}

.nextprev-btn.next {
    right: 1.5rem;
}

.nextprev-btn.back {
    left: 1.5rem;
}

/* ── Services ── */
.services-box {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    align-items: stretch;
}

.services-content {
    flex: 1 1 10rem;
    border: var(--border);
    border-radius: .5rem;
    padding: .6rem .5rem 1.1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: .3s ease;
}

.services-content:hover {
    box-shadow: var(--box-shadow);
}

.services-content img {
    max-width: 2.5rem;
    height: auto;
    display: block;
    margin: 0 auto;
}

.services-content h3 {
    font-size: 1rem;
    margin: .5rem 0 .3rem;
}

.services-content p {
    font-size: .85rem;
    line-height: 1.4;
}

/* ── Skills ── */
.skills-box {
    display: flex;
    flex-direction: column;
    gap: .8rem;
}

.skills-content h3 {
    font-size: 1rem;
    margin-bottom: .05rem;
}

.skills-content .content {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.skills-content .content span {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 4.8rem;
    height: 2.7rem;
    border: var(--border);
    border-radius: .3rem;
    font-weight: 500;
    font-size: .72rem;
    transition: .3s ease;
    gap: .15rem;
}

.skills-content .content span:hover {
    box-shadow: var(--box-shadow);
    cursor: default;
}

.skills-content .content span img {
    width: 1.2rem;
    height: 1.2rem;
    object-fit: contain;
}

/* ── Latest Project ── */
.portfolio-box .img-box {
    width: 100%;
    height: 12rem;
    overflow: hidden;
    border-radius: .4rem;
    border: var(--border);
    margin-bottom: .8rem;
}

.portfolio-box .img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: .5s ease;
}

.portfolio-box .img-box img:hover {
    transform: scale(1.1);
}

.portfolio-box .info-box {
    margin-bottom: .8rem;
}

.portfolio-box .info-box .info-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .3rem;
}

.portfolio-box .info-box .info-title h3 {
    font-size: 1.1rem;
}

.portfolio-box .info-box .info-title a {
    display: flex;
    align-items: center;
    gap: .2rem;
    color: var(--main-color);
    font-size: .85rem;
}

.portfolio-box .info-box .info-title a img {
    width: 1rem;
    height: 1rem;
}

.portfolio-box .info-box p {
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: .2rem;
}

.portfolio-box .info-box ul {
    font-size: .8rem;
    padding-left: 1.2rem;
    margin-bottom: .5rem;
}

.project-desc ul {
    list-style: none;
    padding-left: 0;
}

.portfolio-box .btn-box {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.portfolio-box .btn-box .btn {
    width: 7rem;
    height: 2.2rem;
    font-size: .8rem;
}

/* ── Contact Form ── */
.contact-box {
    text-align: center;
    margin-top: 1rem;
}

.contact-box .field {
    width: 100%;
    background: transparent;
    border: var(--border);
    border-radius: .3rem;
    padding: .8rem;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1.2rem;
    font-family: 'Poppins', sans-serif;
}

.contact-box .field::placeholder {
    color: var(--text-color);
}

.contact-box textarea {
    resize: none;
    height: 12rem;
}

.contact-box .btn {
    cursor: pointer;
    width: 100%;
}

/* ── Back to Profile Button ── */
.back-profile {
    position: absolute;
    bottom: 1.2rem;
    right: 2rem;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: var(--border);
    border-radius: .3rem;
    color: var(--main-color);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: .5s;
}

.back-profile:hover {
    background: var(--main-color);
    color: var(--white-color);
}

.back-profile p {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scale(.5);
    font-size: .9rem;
    color: var(--main-color);
    opacity: 0;
    transition: 0.5s;
    white-space: nowrap;
}

.back-profile:hover p {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    top: -1.8rem;
}

.back-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.back-profile:hover img {
    filter: invert(1);
}

/* ── Opening Animation ── */
@keyframes slideIn {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }

    60% {
        transform: translateX(0);
        opacity: 1;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes openBook {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(-180deg);
    }
}

.wrapper.animate {
    animation: slideIn 1s ease forwards;
}

.book-page.open {
    animation: openBook 1s ease forwards;
    animation-delay: 0.8s;
}

/* ── Mobile Styles ── */
@media (max-width: 768px) {

    .mobile-only {
        display: block;
    }

    .wrapper {
        width: 100vw;
        height: 100dvh;
        padding: 0;
        position: fixed;
        top: 0;
        left: 0;
        transform: none !important;
    }

    .book {
        width: 100%;
        height: 100%;
    }

    .cover {
        display: none;
    }

    .book-page {
        width: 100%;
        right: 0;
        left: 0;
        transform: none !important;
        transition: none;
        display: none;
    }

    .book-page .page-front,
    .book-page .page-back {
        width: 100%;
        height: 100%;
        padding: 1.2rem 1rem 5rem;
        left: 0;
        transform: none;
        display: none;
        box-shadow: none;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .profile-page { justify-content: flex-start; padding-top: 1rem; }
    .profile-page h1 { font-size: 1.8rem; }
    .profile-page h3 { font-size: 1rem; }
    .profile-page img { max-width: 100px; }
    .profile-page p { font-size: .82rem; }
    .profile-page .btn-box { flex-wrap: wrap; justify-content: center; gap: .5rem; }

    .workeduc-content .year { font-size: .85rem; font-weight: 600; }
    .workeduc-box .workeduc-content h3 { font-size: .85rem; }
    .workeduc-box .workeduc-content p { font-size: .78rem; }
    .workeduc-box .workeduc-content ul { font-size: .78rem; }

    .title { font-size: 1.2rem; margin-bottom: .6rem; }

    .services-box { gap: .5rem; }
    .services-content { padding: .4rem; }
    .services-content h3 { font-size: .85rem; }
    .services-content p { font-size: .75rem; }

    .skills-content h3 { font-size: .9rem; }
    .skills-content .content span { width: 3.8rem; height: 2.3rem; font-size: .62rem; }
    .skills-content .content span img { width: 1rem; height: 1rem; }

    .portfolio-box .img-box { height: 8rem; }
    .portfolio-box .info-box p { font-size: .82rem; }
    .portfolio-box .info-box ul { font-size: .75rem; }
    .portfolio-box .btn-box { gap: .5rem; }
    .portfolio-box .btn-box .btn { width: 6rem; height: 2rem; font-size: .75rem; }

    .contact-box textarea { height: 7rem; }
    .contact-box .field { font-size: .85rem; padding: .6rem; margin-bottom: .8rem; }
    .contact-box .btn { width: 100%; }

    .btn { width: 7.5rem; height: 2.5rem; font-size: .85rem; }
    .nextprev-btn.next { right: 1rem; }
    .nextprev-btn.back { left: 1rem; }
    .number-page { bottom: 1.5rem; }
}