400;500;700&family=Comic+Relief:wght@400;700&family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap');

*{
    margin: 0;
    padding: 0;
    text-decoration: none;
    box-sizing: border-box;
    border: none;
    outline: none;
}
:root {
    --bg-color: #f4f7ff;
    --main-color: #163784;
    --text-color: #333;
    --second-text-color: #555;
    --white-color:#fff;
    --cover-color:linear-gradient(135deg, #173784, #1f55b8);
    --pages-color:linear-gradient(90deg, #ffffff, #eef4ff);
    --border: 0.125rem solid #163784;
    --box-shadow: 0 1.4rem 4rem rgba(22,55,132,.18);

}
body{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; 
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    font-family: Tahoma, Arial, sans-serif;
    /* جهت کلی را LTR نگه می‌داریم تا ورق‌خوردن کتاب مثل قالب اصلی درست بماند */
    direction: ltr;
}

/* Drag-to-turn helpers */
body.dragging{
    user-select: none;
    -webkit-user-select: none;
}


/* محتوای صفحات فارسی است */
.profile-page,
.book-page .page-front,
.book-page .page-back {
    direction: rtl;
    text-align: right;
}

.title {
    text-align: center;
}
.wrapper{
    position: relative;
    width: 66rem;
    height: 45rem;
    padding: 2rem;
    perspective: 250rem;
    animation: show-animate 2s forwards;
}
@keyframes show-animate {
    0%,
    30% {
        opacity: 0;
        transform: rotate(-20deg);
    }
    100% {
        opacity: 1;
        transform: rotate(0deg);
    }
}
.cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background-color: var(--cover-color);
    background-color: #029bca;
    box-shadow: var(--box-shadow);
    border-top-left-radius: 0.6rem;
    border-bottom-left-radius: 0.6rem;
    transform-origin: right;
}
.cover.cover-left{
    z-index: -1;
}
.cover.cover-right{
    z-index: 100;
    transition: transform 1s cubic-bezier(.645, .045, .355, 1);

}
.cover.cover-right.turn {
    transform: rotateY(180deg);
}
.book {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    perspective: 250rem;
    cursor: grab;
    touch-action: none;
}
.book.dragging{
    cursor: grabbing;
}

.book .book-page {
    position: absolute;
    width: 50%;
    height: 100%;
    background: var(--pages-color);
    box-shadow: 0 0 .6rem rgba(0,0,0,0.1);
    display: flex;
    padding: 2rem;
}
.book-page.page-left{
    box-shadow: -.6rem .6rem .6rem rgba(0,0,0,0.1);
}
.profile-page{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.profile-page img{
     max-width: 180px;
     border-radius: 50%;
     border: 0.25rem solid var(--main-color);
     margin-bottom: .8rem;
     object-fit: cover;
     object-position: top center;
}
.mnote-profile img{
     object-fit: cover;
     object-position: top center;
}
.profile-page h1 {
    font-size: 2.7rem;
    line-height: 1;
}
.profile-page h3{
    color: var(--main-color);
    font-size: 1.5rem;
}
.profile-page .social-media {
    margin: .6rem .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-color: var(--main-color);
    color: var(--white-color);
}
.profile-page p {
    text-align: justify;
    font-size: 1.1rem;
}
.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: 500;
    margin: 0 1rem;
    transition: .5s;
}
.btn-box .btn:nth-child(2){
    background: transparent;
    color: var(--main-color);
}
.btn-box .btn:nth-child(1):hover{
    background: transparent;
    color: var(--main-color);
}
.btn-box .btn:nth-child(2):hover{
    background: var(--main-color);
    color: var(--white-color);
}

/* right page */
.book-page.page-right{
    position: absolute;
    right: 0;
    transform-style: preserve-3d;
    transform-origin: left;
    transition: transform 1s cubic-bezier(.645, .045, .355, 1);
}
.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;
    /* جلوگیری از بیرون‌زدن محتوای صفحات (خصوصاً صفحات مدارک) */
    overflow: hidden;
    /* کمک می‌کند ویوِرِ مدارک با ارتفاع صفحه فیت شود */
    display: flex;
    flex-direction: column;
}

/*
  صفحات مدارک از یک <div> رَپِر استفاده می‌کنند.
  این قوانین فقط همان صفحات را فلکس می‌کند تا ویوِرِ مدرک داخل صفحه فیت شود.
*/
.book-page .page-front > div,
.book-page .page-back > div{
    height: 100%;
    display: flex;
    flex-direction: column;
}
.book-page .page-front{
    transform: rotateY(0deg) translateZ(1px);
}
.book-page .page-back{
    transform: rotateY(180deg) translateZ(1px);
}

.title {
    text-align: center;
}
.workeduc-box {
    border-left: var(--border);
    margin-top: 2rem;
}
.workeduc-box .workeduc-content {
    position: relative;
    padding-left: 1.6rem;
    padding-bottom: 1.2rem;
}
.workeduc-box .workeduc-content::before{
    content: '';
    position: absolute;
    top: 0;
    left: -0.65rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: var(--main-color);
}
.workeduc-content .year {
    color: var(--main-color);
    font-size: 1.2rem;
}
.workeduc-content h3{
    font-size: 1.4rem;
    margin: .3rem 0;
}
.workeduc-content p{
    font-size: 1.15rem;
    text-align: justify ;
}
.workeduc-content .year i {
    margin-right: .4rem;
    font-size: 1.2rem;
}
.number-page{
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 600;
}

/* next button */
.nextprev-btn{
    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:hover{
    color: var(--main-color);
}
.nextprev-btn.back{
    left: 1.5rem;
}

/* my services */
.services-box{
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
}
.services-box .services-content{
    flex: 1 1 10rem ;
    border: var(--border);
    border-radius: .5rem;
    padding: .8rem .5rem 1.1rem;
    text-align: center;
    transition: .3s ease;
}
.services-box .services-content:hover{
    box-shadow: var(--box-shadow);
}
.services-content i{
    font-size: 2.5rem;
    color: var(--main-color);
}
.services-content h3{
    font-size: 1.1rem;
}
.services-content p {
    margin: .2rem 0 .8rem;
}
.services-content .btn {
    width: 8rem;
    height: 2.5rem;
}
.services-content .btn:hover{
    background-color: transparent;
    color: var(--main-color);
}


/* skilss box */
.skills-box{
    display: flex;
    flex-direction: column; /* هر بخش مهارت زیر قبلی */
    flex-wrap: nowrap;
    gap: 1.1rem;
    margin-top: 1.2rem;
}
.skills-box .skills-content{
    width: 100%;
}
.skills-content h3{
    font-size: 1.3rem;
    line-height: 1;
    margin-bottom: .6rem;
}
.skills-content .content{
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    justify-content: flex-start;
}
.skills-content .content span{
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 7rem;
    height: 4.3rem;
    border: var(--border);
    border-radius: .3rem;
    font-weight: 600;
    transition: .3 ease;
}
.skills-content .content span:hover{
    box-shadow: var(--box-shadow);
}
.skills-content .content span i{
    color: var(--main-color);
    font-size: 2.3rem;
}

/* portfolio */
.portfolio-box{
    margin-top: 2rem;

}
.portfolio-box .img-box{
    display: flex;
    width: 100%;
    height: 15rem;
    border-radius: .5rem;
    border: var(--border);
    overflow: hidden;
}
.portfolio-box .img-box img{
    width: 100%;
    object-fit: cover;
    transition: .5s ease;
}
.portfolio-box .img-box:hover img{
    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: 1rem;
}
.portfolio-box .info-box .info-title h3{
    font-size: 1.3rem;
}
.portfolio-box .info-box .info-title a{
    display: flex;
    align-items: center;
    color: var(--main-color);
}
.portfolio-box .info-box .info-title a i{
    margin-left: .3rem;
}
.portfolio-box .info-box p:nth-of-type(1){
    font-weight: 600;
}
.portfolio-box .info-box p{
    text-align: justify;
}
.portfolio-box .btn-box{
    display: flex;
    justify-content: center;
}
.portfolio-box .btn-box .btn{
    margin: 0 1 .15rem;
}


/* Contact Me! */
.contact-box{
    margin-top: 2rem;
    text-align: center;
}
.contact-box .field{
    width: 100%;
    background-color: 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;
}
.contact-box .btn:hover{
    background-color: transparent;
    color: var(--main-color);
}

.back-profile{
    position: absolute;
    bottom: 1.2rem;
    right: 2rem;
    width: 2rem;
    height: 2rem;
    background-color: transparent;
    border: var(--border);
    border-radius: .3rem;
    font-size: 1.1rem;
    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: 1rem;
    opacity: 0;
    transition: .5s;
    color: var(--main-color);
}
.back-profile:hover p{
    opacity: 1;
    transform: translateX(-50%) scale(1);
    top: -1.8rem;
}

/* RTL tweaks */
.profile-page p,
.workeduc-content p,
.portfolio-box .info-box p{
    text-align: right;
}
.workeduc-content .year i{
    margin-right: 0;
    margin-left: .4rem;
}
.portfolio-box .info-box .info-title a i{
    margin-left: 0;
    margin-right: .3rem;
}
.contact-hint{
    margin-top: .8rem;
    font-size: .95rem;
    color: var(--second-text-color);
}


/* Documents */
.doc-viewer{
    width: 100%;
    /*
      ارتفاع ثابت باعث می‌شد در بعضی صفحات مدارک، محتوا از پایین بیرون بزند.
      در حالت فلکس، ویوِر فضای باقی‌مانده صفحه را می‌گیرد.
    */
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    border: var(--border);
    border-radius: .5rem;
    overflow: hidden;
    background: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.2rem;
}
.doc-viewer img{
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.doc-actions{
    display: flex;
    justify-content: center;
    margin-top: .9rem;
}
.doc-link{
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--main-color);
    font-weight: 700;
}
.doc-link:hover{
    text-decoration: underline;
}

@media (max-width: 900px){
    .wrapper{ width: 96vw; height: 78vh; padding: 1rem; }
    .doc-viewer{ height: auto; min-height: 40vh; }
    .book .book-page{ padding: 1.1rem; }
}

/* Performance + responsive polish added for mehrdadrahimi.com */
.bx{display:inline-flex;align-items:center;justify-content:center;font-style:normal;line-height:1}
.bx:before{content:"•";font-weight:700}
.bxs-calendar:before{content:"📅"}.bxs-graduation:before{content:"🎓"}.bxs-badge-check:before{content:"✓"}.bxs-chalkboard:before{content:"▣"}
.bx-wallet:before{content:"💼"}.bx-receipt:before{content:"▤"}.bx-line-chart:before{content:"↗"}.bx-book-open:before{content:"📘"}
.bx-spreadsheet:before{content:"▦"}.bx-calculator:before{content:"＋"}.bx-briefcase:before{content:"▣"}.bx-building-house:before{content:"⌂"}
.bx-analyse:before{content:"◎"}.bx-target-lock:before{content:"◉"}.bx-git-branch:before{content:"⌁"}.bx-chess:before{content:"♟"}
.bx-check-shield:before,.bx-shield-quarter:before,.bx-award:before{content:"✓"}.bx-link-external:before{content:"↗"}.bx-chevron-left:before{content:"‹"}.bx-chevron-right:before{content:"›"}.bxs-user:before{content:"👤"}
.bxl-linkedin-square:before{content:"in"}.bxl-instagram:before{content:"◎"}.bxl-telegram:before{content:"✈"}.bx-envelope:before{content:"@"}
.doc-viewer img,.img-box img{content-visibility:auto;contain-intrinsic-size:420px 300px}
.mobile-resume{display:none}
@media (max-width: 980px){
  body{display:block;overflow:auto;background:linear-gradient(180deg,#f6f9ff,#eaf1ff);padding:16px;direction:rtl;}
  .wrapper{display:none!important;}
  .mobile-resume{display:block;max-width:720px;margin:0 auto;padding:16px 0 32px;direction:rtl;text-align:right;color:#122650;}
  .mobile-head{background:rgba(255,255,255,.86);border:1px solid rgba(22,55,132,.12);border-radius:28px;padding:22px;box-shadow:0 18px 45px rgba(22,55,132,.13);text-align:center;}
  .mobile-head img{border-radius:50%;box-shadow:0 14px 32px rgba(22,55,132,.18);}
  .mobile-head h1{font-size:clamp(1.5rem,7vw,2.4rem);line-height:1.45;margin:12px 0 8px;color:#163784;}
  .mobile-head p{line-height:2;color:rgba(18,38,80,.72);}
  .mobile-grid{display:grid;gap:18px;margin-top:18px;}
  .mobile-card{background:#fff;border:1px solid rgba(22,55,132,.10);border-radius:24px;padding:14px;box-shadow:0 16px 38px rgba(22,55,132,.12);}
  .mobile-card img{width:100%;height:auto;border-radius:18px;background:#eef4ff;display:block;}
  .mobile-card h2{font-size:1rem;line-height:1.9;margin:12px 4px;color:#122650;}
  .mobile-card a{display:inline-flex;margin:0 4px 4px;padding:10px 16px;border-radius:16px;background:#163784;color:#fff;font-weight:700;}
}
@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}.cover.cover-right{transition:none!important}}

/* Desktop embed fix for mehrdadrahimi.com resume page */
@media (min-width: 981px){
  html, body{
    width:100%;
    height:100%;
    min-height:100dvh;
    overflow:hidden;
  }
  body{
    padding:clamp(10px,1.2vw,18px);
    align-items:center;
    background:
      radial-gradient(circle at 12% 12%, rgba(22,55,132,.08), transparent 22rem),
      linear-gradient(135deg,#ffffff 0%,#f5f8ff 48%,#edf4ff 100%);
  }
  .wrapper{
    width:min(94vw, 66rem);
    height:min(63.6vw, 45rem, calc(100dvh - 2rem));
    padding:clamp(.8rem,1.4vw,1.5rem);
    animation: show-animate .7s ease-out forwards;
  }
  @keyframes show-animate{
    0%{opacity:0;transform:translateY(12px) scale(.985)}
    100%{opacity:1;transform:translateY(0) scale(1)}
  }
  .book .book-page{padding:clamp(1rem,1.55vw,1.45rem)}
  .book-page .page-front,.book-page .page-back{padding:clamp(1rem,1.5vw,1.5rem)}
  .profile-page img{max-width:clamp(105px,12vw,150px);margin-bottom:.65rem}
  .profile-page h1{font-size:clamp(1.65rem,2.4vw,2.25rem);line-height:1.35;text-align:center}
  .profile-page h3{font-size:clamp(1rem,1.35vw,1.2rem);line-height:1.75;text-align:center}
  .profile-page p{font-size:clamp(.86rem,1vw,.98rem);line-height:1.95;text-align:right}
  .profile-page .social-media{margin:.4rem .6rem}.profile-page .social-media a{width:2.15rem;height:2.15rem;font-size:1rem}
  .btn{width:auto;min-width:7.6rem;height:2.55rem;padding:0 .9rem;margin:0 .35rem;border-radius:.55rem;font-size:.9rem}
  .title{font-size:clamp(1.35rem,1.9vw,1.8rem);line-height:1.6;margin-bottom:.5rem}
  .workeduc-box{border-left:0;border-right:var(--border);margin-top:1.1rem;padding-right:.2rem}
  .workeduc-box .workeduc-content{padding-left:0;padding-right:1.35rem;padding-bottom:.9rem}
  .workeduc-box .workeduc-content::before{left:auto;right:-.65rem;width:1.05rem;height:1.05rem}
  .workeduc-content .year{font-size:clamp(.85rem,1vw,1rem);display:inline-flex;align-items:center;gap:.25rem}
  .workeduc-content h3{font-size:clamp(1rem,1.25vw,1.18rem);line-height:1.65;margin:.2rem 0}
  .workeduc-content p{font-size:clamp(.84rem,1vw,.96rem);line-height:1.85;text-align:right}
  .services-box{gap:.9rem;margin-top:1.1rem;align-content:flex-start}
  .services-box .services-content{flex:1 1 11rem;padding:.75rem .6rem .9rem;min-height:8.5rem}
  .services-content i{font-size:1.65rem}.services-content h3{font-size:1rem;line-height:1.7}.services-content p{font-size:.84rem;line-height:1.75}.services-content .btn{height:2.25rem;min-width:6rem;font-size:.82rem}
  .skills-box{gap:.8rem;margin-top:.8rem}.skills-content h3{font-size:1.05rem;line-height:1.6}.skills-content .content{gap:.55rem}.skills-content .content span{width:6.2rem;height:3.65rem;font-size:.82rem}.skills-content .content span i{font-size:1.55rem}
  .portfolio-box{margin-top:1rem}.portfolio-box .img-box{height:clamp(10rem,22vh,13rem)}.portfolio-box .info-box{margin:.8rem 0 1rem}.portfolio-box .info-box p{font-size:.88rem;line-height:1.85}.portfolio-box .info-box .info-title h3{font-size:1.05rem}
  .doc-viewer{margin-top:.8rem}.doc-actions{margin-top:.55rem}.doc-link{font-size:.86rem}.number-page{bottom:.65rem}.nextprev-btn{bottom:.55rem}
}

/* Mobile notebook viewer: bottom-to-top page flip */
.mobile-notebook{display:none}
@media (max-width: 980px){
  html,body{width:100%;min-height:100%;overflow:auto;}
  body{
    display:block;
    min-height:100dvh;
    padding:0;
    background:
      radial-gradient(circle at 50% -10%, rgba(22,55,132,.16), transparent 18rem),
      linear-gradient(180deg,#f8fbff 0%, #eef5ff 100%);
    direction:rtl;
  }
  .wrapper,.mobile-resume{display:none!important;}
  .mobile-notebook{display:block;min-height:100dvh;padding:16px 12px 22px;direction:rtl;color:#122650;}
  .mnote-shell{max-width:430px;margin:0 auto;}
  .mnote-topbar{
    display:flex;align-items:center;justify-content:space-between;gap:12px;
    margin:0 0 12px;padding:12px 14px;border:1px solid rgba(22,55,132,.12);
    border-radius:22px;background:rgba(255,255,255,.88);backdrop-filter:blur(14px);
    box-shadow:0 14px 34px rgba(22,55,132,.12);
  }
  .mnote-topbar strong{display:block;font-size:.95rem;line-height:1.6;color:#0f2f77}
  .mnote-topbar span{display:block;font-size:.76rem;color:rgba(18,38,80,.58)}
  .mnote-count{display:inline-flex;align-items:center;gap:4px;min-width:66px;justify-content:center;padding:8px 10px;border-radius:16px;background:#eef4ff;color:#0f2f77;font-weight:800;direction:ltr;}
  .mnote-count span,.mnote-count b{font-size:.86rem;color:#0f2f77}

  .mnote-book{
    position:relative;height:min(72dvh, 650px);min-height:560px;perspective:1500px;
    border-radius:30px;overflow:visible;
    filter:drop-shadow(0 24px 46px rgba(22,55,132,.18));
    touch-action:pan-y;
  }
  .mnote-book::before{
    content:"";position:absolute;inset:10px 10px -8px;border-radius:28px;background:#dbe8fb;transform:translateY(10px) scale(.96);z-index:0;
  }
  .mnote-book::after{
    content:"";position:absolute;left:24px;right:24px;bottom:-10px;height:18px;border-radius:999px;background:rgba(22,55,132,.18);filter:blur(12px);z-index:0;
  }
  .mnote-page{
    position:absolute;inset:0;z-index:1;display:block;opacity:0;pointer-events:none;
    transform-origin:50% 100%;transform:translateY(14px) rotateX(10deg) scale(.965);
    transition:transform .58s cubic-bezier(.22,.9,.2,1), opacity .36s ease, filter .36s ease;
    backface-visibility:hidden;transform-style:preserve-3d;
  }
  .mnote-page.is-active{opacity:1;pointer-events:auto;z-index:10;transform:translateY(0) rotateX(0) scale(1);}
  .mnote-page.is-prev{opacity:0;z-index:4;transform:translateY(-34px) rotateX(-74deg) scale(.985);filter:brightness(.98);}
  .mnote-page.is-next{opacity:0;z-index:3;transform:translateY(42px) rotateX(16deg) scale(.955);}
  .mnote-page.flipping-up{animation:mnoteFlipUp .62s cubic-bezier(.2,.9,.2,1) both;}
  .mnote-page.flipping-down{animation:mnoteFlipDown .62s cubic-bezier(.2,.9,.2,1) both;}
  @keyframes mnoteFlipUp{0%{opacity:1;transform:translateY(0) rotateX(0) scale(1)}55%{opacity:.85;transform:translateY(-22px) rotateX(-54deg) scale(.995)}100%{opacity:0;transform:translateY(-46px) rotateX(-82deg) scale(.98)}}
  @keyframes mnoteFlipDown{0%{opacity:1;transform:translateY(0) rotateX(0) scale(1)}55%{opacity:.85;transform:translateY(38px) rotateX(44deg) scale(.99)}100%{opacity:0;transform:translateY(62px) rotateX(76deg) scale(.97)}}

  .mnote-page-inner{
    position:relative;height:100%;overflow:hidden;border-radius:30px;padding:24px 20px 28px;
    background:
      linear-gradient(90deg, rgba(15,47,119,.08), transparent 14px),
      linear-gradient(180deg,#ffffff 0%, #f8fbff 100%);
    border:1px solid rgba(22,55,132,.13);
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.75), 0 16px 38px rgba(22,55,132,.10);
  }
  .mnote-page-inner::before{
    content:"";position:absolute;top:0;left:0;right:0;height:6px;background:linear-gradient(90deg,#0f96c4,#173784,#d6a944);border-radius:30px 30px 0 0;
  }
  .mnote-page-inner::after{
    content:attr(data-page-label);position:absolute;bottom:10px;left:50%;transform:translateX(-50%);width:46px;height:5px;border-radius:999px;background:rgba(22,55,132,.13);
  }
  .mnote-page h1,.mnote-page h2,.mnote-page h3,.mnote-page p{margin:0;text-align:right;}
  .mnote-page h1{font-size:clamp(1.7rem,9vw,2.4rem);line-height:1.45;color:#0f2f77;text-align:center;margin-top:8px;}
  .mnote-page h2{font-size:clamp(1.12rem,5.5vw,1.45rem);line-height:1.7;color:#15233e;text-align:center;margin-bottom:18px;}
  .mnote-page h3{font-size:1rem;line-height:1.75;color:#122650;}
  .mnote-page p{font-size:.92rem;line-height:2;color:rgba(18,38,80,.72);}
  .mnote-profile .mnote-page-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;}
  .mnote-profile img{border-radius:50%;border:4px solid #173784;box-shadow:0 14px 34px rgba(22,55,132,.18);background:#fff;}
  .mnote-profile h2{font-size:1rem;margin-bottom:0;color:#173784;}
  .mnote-profile p{text-align:center;max-width:310px;}
  .mnote-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:8px;}
  .mnote-actions a,.mnote-doc a,.mnote-contact a{
    display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 18px;border-radius:16px;
    background:#173784;color:#fff;font-weight:800;box-shadow:0 10px 22px rgba(22,55,132,.18);
  }
  .mnote-actions .ghost{background:#fff;color:#173784;border:1px solid rgba(22,55,132,.22);box-shadow:none;}
  .mnote-timeline{display:grid;gap:12px;margin-top:6px;}
  .mnote-timeline section,.mnote-list p,.mnote-services section{
    border:1px solid rgba(22,55,132,.12);border-radius:20px;background:rgba(255,255,255,.72);padding:13px 14px;box-shadow:0 12px 26px rgba(22,55,132,.07);
  }
  .mnote-timeline small{display:inline-flex;margin-bottom:5px;color:#0f65b3;font-weight:800;}
  .mnote-list{display:grid;gap:12px;}
  .mnote-list p{display:grid;gap:6px;}
  .mnote-list b{color:#173784;font-size:1rem;line-height:1.7;}
  .mnote-list span{color:rgba(18,38,80,.68);font-size:.9rem;line-height:1.9;}
  .mnote-services{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
  .mnote-services section{min-height:128px;text-align:center;padding:12px 10px;}
  .mnote-services span{display:block;font-size:1.55rem;margin-bottom:6px;color:#173784;}
  .mnote-services h3{text-align:center;font-size:.9rem;line-height:1.65;margin-bottom:4px;}
  .mnote-services p{text-align:center;font-size:.78rem;line-height:1.8;}
  .mnote-tags{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px;}
  .mnote-tags span{padding:11px 12px;border-radius:15px;background:#eef4ff;border:1px solid rgba(22,55,132,.12);color:#173784;font-weight:800;font-size:.86rem;}
  .mnote-preview{width:100%;max-height:320px;object-fit:contain;border-radius:22px;background:#eef4ff;border:1px solid rgba(22,55,132,.12);margin:4px 0 14px;}
  .mnote-doc .mnote-page-inner{display:flex;flex-direction:column;gap:12px;}
  .mnote-doc h2{font-size:clamp(1rem,4.6vw,1.22rem);margin-bottom:0;}
  .mnote-doc img{width:100%;height:calc(100% - 104px);min-height:0;object-fit:contain;background:#f1f6ff;border:1px solid rgba(22,55,132,.12);border-radius:22px;padding:8px;}
  .mnote-doc a{align-self:center;min-height:40px;padding:0 16px;font-size:.86rem;}
  .mnote-contact .mnote-page-inner,.mnote-contact{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px;}
  .mnote-contact p{text-align:center;}

  .mnote-controls{display:grid;grid-template-columns:74px 1fr 74px;align-items:center;gap:10px;margin-top:14px;}
  .mnote-controls button{border:0;border-radius:17px;min-height:46px;background:#173784;color:#fff;font-weight:900;box-shadow:0 12px 24px rgba(22,55,132,.18);}
  .mnote-controls button:disabled{opacity:.42;box-shadow:none;}
  .mnote-hint{text-align:center;color:rgba(18,38,80,.58);font-size:.78rem;line-height:1.8;}
}
@media (max-width: 390px){
  .mobile-notebook{padding:10px 8px 18px;}
  .mnote-book{height:74dvh;min-height:525px;}
  .mnote-page-inner{padding:20px 15px 24px;border-radius:24px;}
  .mnote-services{grid-template-columns:1fr;}
  .mnote-services section{min-height:auto;}
}
@media (prefers-reduced-motion: reduce){
  .mnote-page,.mnote-page.flipping-up,.mnote-page.flipping-down{animation:none!important;transition:none!important;}
}

/* Desktop clean two-page reader: replaces the old 3D stack on desktop to remove clipping, center artifacts, and hidden-page peeking. */
.desktop-spread-viewer{display:none}
@media (min-width: 981px){
  .wrapper{display:none!important;}
  .desktop-spread-viewer{
    display:block;
    width:100%;
    height:100dvh;
    padding:clamp(10px,1.5vw,18px);
    direction:rtl;
    color:#122650;
  }
  .dspread-shell{
    width:min(96vw, 1060px);
    height:calc(100dvh - clamp(20px,3vw,36px));
    margin:0 auto;
    display:grid;
    grid-template-rows:auto 1fr auto;
    gap:10px;
  }
  .dspread-toolbar{
    display:grid;
    grid-template-columns:120px 1fr 120px;
    align-items:center;
    gap:12px;
    min-height:52px;
    padding:8px 10px;
    border:1px solid rgba(22,55,132,.10);
    border-radius:22px;
    background:rgba(255,255,255,.88);
    box-shadow:0 14px 34px rgba(22,55,132,.10);
    backdrop-filter:blur(14px);
  }
  .dspread-toolbar button{
    min-height:38px;
    border-radius:15px;
    background:#173784;
    color:#fff;
    font-weight:900;
    cursor:pointer;
    box-shadow:0 10px 22px rgba(22,55,132,.16);
    transition:transform .2s ease, opacity .2s ease;
  }
  .dspread-toolbar button:hover{transform:translateY(-1px)}
  .dspread-toolbar button:disabled{opacity:.42;cursor:not-allowed;box-shadow:none;transform:none;}
  .dspread-title{text-align:center;line-height:1.6;min-width:0;}
  .dspread-title strong{display:block;font-size:1rem;color:#0f2f77;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .dspread-title span{display:block;font-size:.78rem;color:rgba(18,38,80,.58);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .dspread-book{
    position:relative;
    display:grid;
    grid-template-columns:1fr 1fr;
    overflow:hidden;
    border-radius:28px;
    border:1px solid rgba(22,55,132,.12);
    background:
      linear-gradient(90deg, #079bc7 0 10px, transparent 10px calc(100% - 10px), #079bc7 calc(100% - 10px) 100%),
      linear-gradient(135deg,#fdfefe 0%,#f3f7ff 100%);
    box-shadow:0 26px 58px rgba(22,55,132,.14);
    isolation:isolate;
  }
  .dspread-book::before{
    content:"";
    position:absolute;
    inset:8px;
    border-radius:24px;
    pointer-events:none;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.75);
    z-index:4;
  }
  .dspread-spine{
    position:absolute;
    top:0;
    bottom:0;
    left:50%;
    width:24px;
    transform:translateX(-50%);
    z-index:5;
    pointer-events:none;
    background:
      linear-gradient(90deg, rgba(22,55,132,.18), rgba(22,55,132,.05) 32%, rgba(255,255,255,.92) 50%, rgba(22,55,132,.05) 68%, rgba(22,55,132,.18));
    box-shadow:0 0 22px rgba(22,55,132,.18);
  }
  .dspread-page{
    position:relative;
    min-width:0;
    min-height:0;
    overflow:hidden;
    padding:clamp(24px,2.5vw,34px) clamp(34px,3.1vw,46px);
    background:linear-gradient(180deg,#fff 0%,#f7faff 100%);
    display:block;
    opacity:1;
    transition:opacity .26s ease, transform .26s ease;
  }
  .dspread-page-left{border-radius:22px 0 0 22px;padding-right:clamp(48px,4.6vw,70px);box-shadow:inset -14px 0 24px rgba(22,55,132,.055)}
  .dspread-page-right{border-radius:0 22px 22px 0;padding-left:clamp(48px,4.6vw,70px);box-shadow:inset 14px 0 24px rgba(22,55,132,.055)}
  .dspread-page.is-changing{opacity:.18;transform:translateY(8px)}
  .dspread-page .mnote-page-inner{
    height:100%;
    overflow:hidden;
    background:transparent!important;
    border:0!important;
    border-radius:0!important;
    padding:0!important;
    box-shadow:none!important;
    display:block;
  }
  .dspread-page .mnote-page-inner::before,.dspread-page .mnote-page-inner::after{display:none!important;}
  .dspread-page h1,.dspread-page h2,.dspread-page h3,.dspread-page p{margin:0;text-align:right;}
  .dspread-page h1{font-size:clamp(1.8rem,2.7vw,2.55rem);line-height:1.35;text-align:center;color:#0f2f77;margin:10px 0 10px;}
  .dspread-page h2{font-size:clamp(1.35rem,2vw,1.75rem);line-height:1.65;text-align:center;color:#15233e;margin:0 0 20px;}
  .dspread-page h3{font-size:clamp(.98rem,1.22vw,1.15rem);line-height:1.8;color:#122650;}
  .dspread-page p{font-size:clamp(.84rem,1vw,.95rem);line-height:2;color:rgba(18,38,80,.72);}
  .dspread-page .mnote-profile .mnote-page-inner,
  .dspread-page.mnote-profile .mnote-page-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;}
  .dspread-page img{max-width:100%;height:auto;display:block;}
  .dspread-page .mnote-profile img,.dspread-page.mnote-profile img{width:132px;height:132px;border-radius:50%;border:4px solid #173784;box-shadow:0 14px 34px rgba(22,55,132,.16);background:#fff;}
  .dspread-page .mnote-profile p,.dspread-page.mnote-profile p{text-align:center;max-width:360px;}
  .dspread-page .mnote-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:12px;}
  .dspread-page .mnote-actions a,.dspread-page .mnote-doc a,.dspread-page .mnote-contact a{
    display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:0 18px;border-radius:14px;background:#173784;color:#fff;font-weight:800;box-shadow:0 10px 22px rgba(22,55,132,.16);
  }
  .dspread-page .mnote-actions .ghost{background:#fff;color:#173784;border:1px solid rgba(22,55,132,.22);box-shadow:none;}
  .dspread-page .mnote-timeline{display:grid;gap:12px;margin-top:4px;}
  .dspread-page .mnote-timeline section,.dspread-page .mnote-list p,.dspread-page .mnote-services section{
    border:1px solid rgba(22,55,132,.12);border-radius:18px;background:rgba(255,255,255,.72);padding:13px 14px;box-shadow:0 12px 24px rgba(22,55,132,.06);
  }
  .dspread-page .mnote-timeline small{display:inline-flex;margin-bottom:5px;color:#0f65b3;font-weight:900;}
  .dspread-page .mnote-list{display:grid;gap:12px;}
  .dspread-page .mnote-list p{display:grid;gap:6px;}
  .dspread-page .mnote-list b{color:#173784;font-size:1rem;line-height:1.8;}
  .dspread-page .mnote-list span{color:rgba(18,38,80,.68);font-size:.9rem;line-height:2;}
  .dspread-page .mnote-services{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
  .dspread-page .mnote-services section{min-height:135px;text-align:center;padding:14px 12px;display:flex;flex-direction:column;align-items:center;justify-content:center;}
  .dspread-page .mnote-services span{display:block;font-size:1.6rem;margin-bottom:6px;color:#173784;}
  .dspread-page .mnote-services h3{text-align:center;font-size:.95rem;line-height:1.65;margin-bottom:5px;}
  .dspread-page .mnote-services p{text-align:center;font-size:.8rem;line-height:1.85;}
  .dspread-page .mnote-tags{display:flex;flex-wrap:wrap;gap:10px;margin-top:10px;}
  .dspread-page .mnote-tags span{padding:10px 12px;border-radius:14px;background:#eef4ff;border:1px solid rgba(22,55,132,.12);color:#173784;font-weight:850;font-size:.84rem;}
  .dspread-page .mnote-preview{width:100%;height:min(42vh,300px);object-fit:contain;border-radius:18px;background:#eef4ff;border:1px solid rgba(22,55,132,.12);margin:0 0 14px;}
  .dspread-page.mnote-doc .mnote-page-inner,.dspread-page .mnote-doc .mnote-page-inner{display:flex;flex-direction:column;gap:12px;height:100%;}
  .dspread-page.mnote-doc h2,.dspread-page .mnote-doc h2{font-size:clamp(1rem,1.45vw,1.18rem);line-height:1.8;margin:0;}
  .dspread-page.mnote-doc img,.dspread-page .mnote-doc img{width:100%;height:calc(100% - 92px);min-height:0;object-fit:contain;background:#f1f6ff;border:1px solid rgba(22,55,132,.12);border-radius:18px;padding:8px;}
  .dspread-page.mnote-doc a,.dspread-page .mnote-doc a{align-self:center;min-height:38px;padding:0 16px;font-size:.84rem;}
  .dspread-page.mnote-contact .mnote-page-inner,.dspread-page .mnote-contact .mnote-page-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px;}
  .dspread-page.mnote-contact p,.dspread-page .mnote-contact p{text-align:center;}
  .dspread-foot{
    display:flex;align-items:center;justify-content:space-between;gap:10px;
    color:rgba(18,38,80,.56);font-size:.82rem;line-height:1.7;
    padding:0 8px;
  }
  .dspread-foot span:first-child{direction:ltr;white-space:nowrap;font-weight:900;color:#173784;background:#eef4ff;border-radius:999px;padding:6px 12px;}
}
@media (min-width: 981px) and (max-height: 760px){
  .desktop-spread-viewer{padding:8px;}
  .dspread-shell{gap:8px;}
  .dspread-toolbar{min-height:46px;padding:6px 8px;}
  .dspread-page{padding-top:20px;padding-bottom:20px;}
  .dspread-page h2{margin-bottom:12px;}
  .dspread-page .mnote-timeline{gap:9px;}
  .dspread-page .mnote-timeline section,.dspread-page .mnote-list p,.dspread-page .mnote-services section{padding:10px 12px;}
  .dspread-page p{line-height:1.85;}
}


/* Desktop stable reader: mouse page flip + opening cover
   This keeps the clean two-page layout and adds only a visual flip layer,
   so hidden old book pages can never leak into the center. */
@media (min-width: 981px){
  .dspread-book{perspective:1800px; cursor:grab; user-select:none; -webkit-user-select:none;}
  .dspread-book.is-dragging{cursor:grabbing;}
  .dspread-book.is-opening{pointer-events:none;}
  .dspread-page{backface-visibility:hidden;}
  .dspread-flipper{
    position:absolute;
    top:0;
    bottom:0;
    width:50%;
    z-index:20;
    transform-style:preserve-3d;
    pointer-events:none;
    will-change:transform;
  }
  .dspread-flipper.forward{right:0;transform-origin:left center;}
  .dspread-flipper.backward{left:0;transform-origin:right center;}
  .dspread-flip-face{
    position:absolute;
    inset:0;
    overflow:hidden;
    backface-visibility:hidden;
    background:linear-gradient(180deg,#fff 0%,#f7faff 100%);
    padding:clamp(24px,2.5vw,34px) clamp(34px,3.1vw,46px);
    display:block;
    box-shadow:0 18px 44px rgba(22,55,132,.14);
  }
  .dspread-flipper.forward .dspread-flip-face{border-radius:0 22px 22px 0;padding-left:clamp(48px,4.6vw,70px);}
  .dspread-flipper.backward .dspread-flip-face{border-radius:22px 0 0 22px;padding-right:clamp(48px,4.6vw,70px);}
  .dspread-flip-back{transform:rotateY(180deg);}
  .dspread-flipper.forward .dspread-flip-back{box-shadow:inset -14px 0 24px rgba(22,55,132,.055);}
  .dspread-flipper.backward .dspread-flip-back{box-shadow:inset 14px 0 24px rgba(22,55,132,.055);}
  .dspread-flip-face .mnote-page-inner{
    height:100%;
    overflow:hidden;
    background:transparent!important;
    border:0!important;
    border-radius:0!important;
    padding:0!important;
    box-shadow:none!important;
    display:block;
  }
  .dspread-flip-face .mnote-page-inner::before,
  .dspread-flip-face .mnote-page-inner::after{display:none!important;}
  .dspread-flip-face h1,.dspread-flip-face h2,.dspread-flip-face h3,.dspread-flip-face p{margin:0;text-align:right;}
  .dspread-flip-face h1{font-size:clamp(1.8rem,2.7vw,2.55rem);line-height:1.35;text-align:center;color:#0f2f77;margin:10px 0 10px;}
  .dspread-flip-face h2{font-size:clamp(1.35rem,2vw,1.75rem);line-height:1.65;text-align:center;color:#15233e;margin:0 0 20px;}
  .dspread-flip-face h3{font-size:clamp(.98rem,1.22vw,1.15rem);line-height:1.8;color:#122650;}
  .dspread-flip-face p{font-size:clamp(.84rem,1vw,.95rem);line-height:2;color:rgba(18,38,80,.72);}
  .dspread-flip-face .mnote-timeline{display:grid;gap:12px;margin-top:4px;}
  .dspread-flip-face .mnote-timeline section,
  .dspread-flip-face .mnote-list p,
  .dspread-flip-face .mnote-services section{border:1px solid rgba(22,55,132,.12);border-radius:18px;background:rgba(255,255,255,.72);padding:13px 14px;box-shadow:0 12px 24px rgba(22,55,132,.06);}
  .dspread-flip-face .mnote-timeline small{display:inline-flex;margin-bottom:5px;color:#0f65b3;font-weight:900;}
  .dspread-flip-face .mnote-list{display:grid;gap:12px;}
  .dspread-flip-face .mnote-list p{display:grid;gap:6px;}
  .dspread-flip-face .mnote-list b{color:#173784;font-size:1rem;line-height:1.8;}
  .dspread-flip-face .mnote-list span{color:rgba(18,38,80,.68);font-size:.9rem;line-height:2;}
  .dspread-flip-face .mnote-services{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
  .dspread-flip-face .mnote-services section{min-height:135px;text-align:center;padding:14px 12px;display:flex;flex-direction:column;align-items:center;justify-content:center;}
  .dspread-flip-face .mnote-services span{display:block;font-size:1.6rem;margin-bottom:6px;color:#173784;}
  .dspread-flip-face .mnote-services h3{text-align:center;font-size:.95rem;line-height:1.65;margin-bottom:5px;}
  .dspread-flip-face .mnote-services p{text-align:center;font-size:.8rem;line-height:1.85;}
  .dspread-flip-face .mnote-tags{display:flex;flex-wrap:wrap;gap:10px;margin-top:10px;}
  .dspread-flip-face .mnote-tags span{padding:10px 12px;border-radius:14px;background:#eef4ff;border:1px solid rgba(22,55,132,.12);color:#173784;font-weight:850;font-size:.84rem;}
  .dspread-flip-face .mnote-preview{width:100%;height:min(42vh,300px);object-fit:contain;border-radius:18px;background:#eef4ff;border:1px solid rgba(22,55,132,.12);margin:0 0 14px;}
  .dspread-flip-face.mnote-doc .mnote-page-inner,
  .dspread-flip-face .mnote-doc .mnote-page-inner{display:flex;flex-direction:column;gap:12px;height:100%;}
  .dspread-flip-face.mnote-doc h2,
  .dspread-flip-face .mnote-doc h2{font-size:clamp(1rem,1.45vw,1.18rem);line-height:1.8;margin:0;}
  .dspread-flip-face.mnote-doc img,
  .dspread-flip-face .mnote-doc img{width:100%;height:calc(100% - 92px);min-height:0;object-fit:contain;background:#f1f6ff;border:1px solid rgba(22,55,132,.12);border-radius:18px;padding:8px;}
  .dspread-flip-face.mnote-doc a,
  .dspread-flip-face .mnote-doc a{align-self:center;min-height:38px;padding:0 16px;font-size:.84rem;}
  .dspread-flip-face.mnote-contact .mnote-page-inner,
  .dspread-flip-face .mnote-contact .mnote-page-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px;}
  .dspread-flip-face.mnote-contact p,
  .dspread-flip-face .mnote-contact p{text-align:center;}
  .dspread-opening-cover{
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    width:50%;
    z-index:30;
    transform-origin:left center;
    transform-style:preserve-3d;
    border-radius:0 28px 28px 0;
    background:linear-gradient(135deg,#173784,#089cca);
    box-shadow:0 24px 50px rgba(22,55,132,.22), inset 18px 0 30px rgba(255,255,255,.12);
    pointer-events:none;
    will-change:transform;
  }
  .dspread-opening-cover::before{
    content:"MR";
    position:absolute;
    inset:0;
    display:grid;
    place-items:center;
    color:#fff;
    font-weight:1000;
    font-size:clamp(3.2rem,6vw,5.5rem);
    letter-spacing:.08em;
    text-shadow:0 8px 24px rgba(0,0,0,.22);
  }
  .dspread-opening-cover.is-open{animation:dspread-cover-open 1.05s cubic-bezier(.645,.045,.355,1) forwards;}
  @keyframes dspread-cover-open{to{transform:rotateY(-180deg);opacity:.92;}}
}
