@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: #081b29;
    --text-color: #333;
    --main-color: #080707;
    --second-text-color: #fff;
    --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)
}

.wrapper{
    position: relative;
    width: 66rem;
    height: 45rem;
    padding: 2rem;
    perspective: 2000px;
}

.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-origin:right;
}

.cover.cover-left{
    z-index: -1;
}

.cover.cover-right.turn{
    transform: rotateY(180deg);
}

.book{
    visibility: hidden;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    transform-style: preserve-3d;
}

.book .book-page{
    position: absolute;
    width: 50%;
    height: 103%;
    background: var(--white-color);
    box-shadow: 0 0 .6rem rgba(0, 0, 0, .1);
    display: flex;
    padding: 1rem;
}

.profile-page{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.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 p{
    text-align: justify;
}

.profile-page .btn-box{
    margin-top: 1.2rem;
}

.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: 500px;
    margin: 0 1rem;
    transition: .5s;
}

.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);
}

.book-page.page-right{
    position: absolute;
    right: 0;
    transform-style: preserve-3d;
    transition: transform 1s ease;
    transform-origin: left;
    z-index: 2;
}

.book-page.page-left{
    position: absolute;
    left: 0;
    transform-style: preserve-3d;
    transition: transform 1s ease;
    transform-origin: right;
    z-index: 1;
}

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

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

.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;
}

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

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

.title{
    text-align: center;
    margin-bottom: .3rem;
    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 h3{
    font-size:medium;
}

.workeduc-box .workeduc-content p{
    font-size: 14.8px;
}

.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: 100;
    color: var(--main-color);
}

.workeduc-content .year img{
    margin-right: .1rem
}

.number-page{
    position: absolute;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
}

.nextprev-btn img{
    position: absolute;
    bottom: .9rem;
    right: 1.5rem;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: 2rem;
    color: var(--second-text-color);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: .5s;
}

.nextprev-btn img:hover{
    color: var(--main-color);
}

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

.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;
    min-height: 100%;
    transition: .3s ease;
}

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

.services-content img{
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    color: var(--main-color);
}

.services-content h3{
    display: flex;
    margin: .5rem auto;
    font-size: 1.1rem;
    text-align: center;
}

.services-content p{
    display: flex;
    text-align: center;
    font-size: .9rem;
    margin: .1rem 0;
    justify-content: center;
    align-items: center;
}

.services-content .btn{
    display: flex;
    margin: .5rem auto;
    width: 6rem;
    height: 2rem;
    font-size: .9rem;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.skills-box{
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem
}

.skills-box .skill-content{
    flex: 1 1 20rem;
}

.skills-content h3{
    font-size: 1.05rem;
    line-height: 1;
    margin-bottom: .3rem;
}

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

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

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

.skill-content .content span img{
    font-size: 2rem;
    color: var(--main-color);
}

.portfolio-box .img-box{
    display: flex;
    width: 100%;
    height: 18rem;
    overflow: hidden;
    border-radius: .4rem;
    border: var(--border);
    margin-bottom: .5rem;
}

.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: 1rem 0 1.5rem;
}

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

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

.portfolio-box .info-box .project-desc p{
    font-size: 1rem;
}

.portfolio-box .info-box .project-desc ul{
    font-size: 0.8rem;
    padding-bottom: 0.5rem;
}

.portfolio-box .info-box .project-stack p{
    font-size: 1rem;
}

.portfolio-box .info-box .project-stack ul{
    font-size: 0.8rem;
}

.portfolio-box .info-box .info-title a{
    display: flex;
    align-items: center;
    color: var(--main-color);
}

.portfolio-box .info-box .info-title a img{
    margin-left: .2rem;
}

.portfolio-box .info-box p:nth-of-type(1){
    font-weight: 600;
}

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

.portfolio-box .btn-box .btn{
    margin: 0 1.15;
    width: 6.5rem;
    height: 2rem;
    font-size: .8rem;
}

.contact-box{
    text-align: center;
}

.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.5rem;
}

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

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

.contact-box .btn{
    cursor: pointer;
}

.back-profile{
    position: absolute;
    bottom: 1.2rem;
    right: 2rem;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: var(--border);
    border-radius: .3rem;
    font-size: 1.1rem;
    color: var(--main-color);
    justify-content: center;
    align-items: center;
    display: inline-flex;
    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;
}

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

.back-profile img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: invert(0);
    transition: 0.5s;
}

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

.book-page.page-right.turn,
.book-page.page-left.turn {
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.book-page.page-right,
.book-page.page-left {
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.book-page .page-front,
.book-page .page-back {
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Always present as horizontal (landscape) on mobile portrait devices
   - rotate the wrapper 90deg so users holding phone portrait see a horizontal layout
   - swap width/height using viewport units so the book perfectly fits without vertical scroll
   - keep transform-style/perspective so 3D page flips remain intact */
@media (max-width: 1200px) and (orientation: portrait) {
  html, body {
    height: 100%;
    width: 100%;
    overflow: visible /* prevent vertical scrolling */
  }

  .wrapper{
    /* use viewport height as the horizontal width so the rotated layout fills the screen */
    position: absolute;
    width: 100vh;
    height: 100vw;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg) scale(0.985);
    transform-origin: center center;
    perspective: 1200px; /* keep good 3D depth */
    padding: .4rem;
  }

  .book{
    visibility: visible; /* ensure book is visible after JS reset */
    opacity: 1;
    width: 100%;
    height: 100%;
    transform: none;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
  }

  /* keep same left/right page layout but make them fully fit vertically after rotation */
  .book .book-page{
    width: 50%;
    height: 100%;
    padding: .5rem;
  }

  /* small size adjustments to ensure no overflow */
  .profile-page img{ max-width: 100px; }
  .profile-page h1{ font-size: 1.4rem; }
  .profile-page h3{ font-size: .95rem; }
  .profile-page p{ font-size: .9rem; }
  .btn{ width: 6.6rem; height: 2.2rem; font-size: .85rem; }
  .nextprev-btn img{ width: 1.5rem; height: 1.5rem; bottom: .5rem; }

  .portfolio-box .img-box{ height: 11.5rem; }
  .contact-box textarea{ height: 9rem; }
  .skills-content .content span{ width: 4.4rem; height: 2.3rem; font-size: .72rem; }
}

/* Landscape small screens: scale to fit while preserving 3D effects */
@media (max-width: 900px) and (orientation: landscape) {
  .wrapper{
    width: calc(100vw - 1rem);
    height: calc(70vh);
    padding: .6rem;
    perspective: 1200px;
  }

  .book{ transform: scale(0.95); }
  .book .book-page{ height: 100%; }
}
