@font-face {
  font-family: PixelText;
  src: url(https://assets.codepen.io/36869/Grand9KPixel.ttf);
}

:root {
  font-family: 'PixelText', serif;
  font-optical-sizing: auto;
  line-height: 1.5;
  font-weight: 400;
    /* overflow-y: auto; */

  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  /* background-color: #242424; */
      background: url('assets/back.jpg') no-repeat center center;
        background-size: cover;
    background-attachment: fixed;
  
    z-index: 1;
    font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;

  /* sprite image */
  --sprite-image: url(https://assets.codepen.io/36869/book.webp);

  /* sprite animation settings */
  /* animation duration */
  --sprite-as: .8s;
  /* animation direction */
  --sprite-ad: normal;
  /* animation fill mode */
  --sprite-af: none;
  /* animation play state */
  --sprite-ap: running;
  /* animation iteration count */
  --sprite-ai: infinite;
  /* animation timing function */
  --sprite-at: linear;
  /* animation frame rate */
  --sprite-fr: 12;
}

@layer base {
  *{
    box-sizing: border-box;
  }
  body {
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1rem;
    
    overflow-y: auto;

  }

  .sprite-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
  }
}

@layer main {
  /* Frame start position */
  @property --sprite-fs {
    syntax: "<integer>";
    initial-value: 0;
    inherits: true
  }
  @property --_progress {
    syntax: "<percentage>";
    inherits: false;
    initial-value: 0%;
  }

  .container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 100vw;
    overflow-x: hidden; /* Prevent horizontal overflow */
    padding: 0 20px; /* Add horizontal padding */

    /* sprite columns */
    --sprite-c: 5;
    /* sprite image height */
    --sprite-h: 3000;
    /* sprite image width */
    --sprite-w: 9600;
    /* sprite frames */
    --sprite-f: 7;
    /* animation duration based on frame rate */
    --sprite-as: calc(var(--sprite-f) / var(--sprite-fr) * 1s);

    /* frame rows */
    --sprite-r: round(up, calc(var(--sprite-f) / var(--sprite-c)), 1);
    /* frame height */
    --sprite-sh: calc(var(--sprite-h) / var(--sprite-r));
    /* frame target height, width */
    --sprite-th: calc(var(--sprite-sh) / 2);

    /* aspect ratio */
    --sprite-ar: calc(var(--sprite-th) / var(--sprite-sh));
    --sprite-uh: calc(var(--sprite-h) * var(--sprite-ar));
    --sprite-uw: calc(var(--sprite-w) * var(--sprite-ar));

    /* frame width */
    --sprite-tw: calc(var(--sprite-uw) / var(--sprite-c));

    > h1 {
      /* color: #d2d4e1; */
      margin-top: 140px;
      width: fit-content;
      font-weight: 500;
      font-size: 1.75rem;
      text-align: center;
      font-size: 3rem;
    color: #512F13;
    /* margin: 40px auto 20px; */
    /* width: 0; */
        font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    }
    
    .book .carousel {
    width: min(calc(1px * (var(--sprite-tw) * 0.7042)), 90vw); /* Limit max width */
    height: min(calc(1px * (var(--sprite-th) * 0.6107)), 70vh); /* Limit max height */
    margin: 0 auto;
}

    .book {
      position: relative;
      display: grid;
      grid-template-areas:
            "scroll scroll scroll"
            "left markers right";
      gap: 1rem;

      .sprite {
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        height: calc(1px * var(--sprite-th));
        width: calc(1px * var(--sprite-tw));
        margin: calc(-1px * calc((var(--sprite-th) - (var(--sprite-th) * 0.6107)) / 2)) calc(-1px * calc((var(--sprite-tw) - (var(--sprite-tw) * 0.7042)) / 2));
        background-image: var(--sprite-image);
        transform-origin: center center;
        background-repeat: no-repeat;
        background-size: calc(1px * var(--sprite-uw)) calc(1px * var(--sprite-uh));
        z-index: -1;

        /* Frame end position */
        --sprite-fe: calc(var(--sprite-f) * (var(--slides) - 1));
        --sprite-fs-n: mod(var(--sprite-fs), var(--sprite-f));
        /* calculate the row and column position */
        --row: calc(round(down, calc(calc(var(--sprite-tw) * var(--sprite-fs-n)) / var(--sprite-uw)), 1) * var(--sprite-th));
        --col: mod(calc(var(--sprite-tw) * var(--sprite-fs-n)), var(--sprite-uw));

        background-position: calc(-1px * var(--col)) calc(-1px * var(--row));
        animation: frame var(--sprite-as) var(--sprite-at) 0s var(--sprite-ad) var(--sprite-af) var(--sprite-ap);
        animation-timeline: --carousel-timeline;
      }

      .carousel {
        counter-increment: curpage;
        grid-area: scroll;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        overscroll-behavior-x: contain;

        display: grid;
        margin: 0 auto;
        width: calc(1px * (var(--sprite-tw) * 0.7042));
        height: calc(1px * (var(--sprite-th) * 0.6107));
        grid: 1fr / auto-flow 100%;
        scroll-timeline: --carousel-timeline x;
        scroll-behavior: smooth;
        scrollbar-width: none;
        scroll-marker-group: after;

        &::scroll-button(*) {
          inline-size: clamp(48px, 8vw, 64px);
    aspect-ratio: 1;
    border-radius: 0;
    border: 0;
    background-color: transparent;
    cursor: pointer;
    position: relative;
    z-index: 10;
        }

        &::scroll-button(*):disabled{
          filter: invert(1);
          opacity: 0.5;
        }
        &::scroll-button(*):not(:disabled):is(:hover, :active) {
          filter: drop-shadow(2px 4px 6px black);
        }

        &::scroll-button(*):not(:disabled):active {
          scale: 90%;
        }

        &::scroll-button(left) {
          content: url("assets/next.png") / "Scroll Left";
    scale:0.5;
    grid-area: left;
    transform: translateX(47px) rotate(180deg);
  
        }

        &::scroll-button(right) {
          /* content: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMCIgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjMyLjAwMDAwMCAyNTYuMDAwMDAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBtZWV0Ij4KCjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAuMDAwMDAwLDI1Ni4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiIGZpbGw9IiNmZmYiI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MCAwIC02MCAwIDAgNjAgMCA2MCAtNjAgMCAtNjAgMCAwIDYwIDAgNjAgLTYwIDAgLTYwIDAgMCA2MCAwIDYwIC02MCAwIC02MCAwIDAgNjAgMCA2MCAtMTIwIDAgLTEyMCAwIDAgLTE4MHoiLz4KPC9nPgo8L3N2Zz4=") / "Scroll Right"; */
          content: url("assets/next.png") / "Scroll Right";  
          scale: 0.5;
          transform: translateX(-47px);
          grid-area: right;
          justify-self: flex-end;
          
        }

        &::scroll-marker-group {
              position: relative; /* Change from absolute */
    margin-top: 10px; /* Add some spacing */
    width: 100%;
    height: 8px;
    padding: 2px 0;
    display: grid;
    grid-area: markers;
    grid-auto-flow: column;
    place-self: center;
    overflow: hidden;
    border: 5px solid #512F13;
    border-radius: 13px;
    background: linear-gradient(90deg, #f1e2b2 0%) no-repeat left center;
    --_progress: calc(calc(100 / var(--slides)) * 1%);
    background-size: var(--_progress, 20%) 100%;
    animation: progress linear both;
    animation-timeline: --carousel-timeline;
        }

        & > .carousel-item {
          scroll-snap-stop: always;
          scroll-snap-align: start;
          animation: count-before linear forwards;
          animation-range: exit;
          counter-increment: page;
          animation-timeline: view(x);

          position: relative;
          box-sizing: border-box;
          color: #333;

          &::scroll-marker {
            content: '';
            position: relative;
            left: -1px;
            width: 100%;
            height: 100%;
            display: block;
            box-sizing: border-box;
            box-shadow: 2px 0 0 #512F13;
          }

          &:last-of-type{
            &::scroll-marker {
              box-shadow: none;
            }
          }

          .page-container {
            display: flex;
            gap: 3rem;
            height: 100%;

            animation: stay-centered linear both;
            animation-timeline: view(x);
            timeline-scope: --parallax-item;
          }

          .left-page, .right-page {
            flex: 1;
            font-size: small;
            overflow: hidden;
            display: grid;
            grid-template-rows: 1fr auto;

            &:after {
              bottom: 15px;
              color: hsl(45.71deg 69.23% 30%);
            }

            > div {
              text-align: justify;
              hyphens: auto;
              line-height: normal;
              display: block;
              word-wrap: break-word;
            }
          }

          .left-page {
            padding: 20px 0 20px 20px;
            &:after {
              content: counter(curpage);
            }
          }

          .right-page {
            padding: 20px 20px 20px 0;
            counter-increment: curpage;
            &:after {
              content: counter(curpage);
              place-self: self-end;
            }
          }
        }
      }
    }
  }
}

@media (width < 748px) {
  .container {
    --sprite-th: calc(var(--sprite-sh) / 2.5);

    > h1 {
      font-size: 1.25rem;
    }

    .page {
      > div {
        font-size: .6rem;
      }
    }
  }
}

@media (width < 560px) {
  .container {
    --sprite-th: calc(var(--sprite-sh) / 4);

    > h1 {
      font-size: 1rem;
    }

    .page {
      > div {
        font-size: .35rem;
      }

      &:after {
        font-size: .5rem;
      }
    }
  }
}

@keyframes stay-centered {
  entry 0% {
    opacity: 0;
    translate: -100%;
  }
  entry 75%  {
    opacity: 0;
    translate: -25%;
  }
  entry 100% {
    opacity: 1;
    translate: 0%;
  }
  exit 0% {
    opacity: 1;
    translate: 0%;
  }
  exit 50% {
    opacity: 0;
    translate: 50%;
  }
  exit 100% {
    opacity: 0;
    translate: 100%;
  }
}

@keyframes count-before {
  1%,
  100% {
    counter-increment: page curpage;
  }
}

@keyframes progress {
  100% {
    --_progress: 100%;
  }
}

@keyframes frame {
  to {
    --sprite-fs: var(--sprite-fe);
  }
}

@media (prefers-reduced-motion) {
  * {
    animation: none;
  }
}

.title{
  transform: translateX(105px); /* Responsive translation */
  margin-top: 220px;
}


.back-btn-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 60px;
    margin-top: 300px;
    position: fixed;
    /* left:  100px; */
    z-index: 100;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    position: relative;
    width: 64px;
    height: 64px;
    padding: 0;
}

.back-btn img {
    width: 102px;
    height: 92px;
    border-radius: 50%;
    border: none;
    background: none;
    box-shadow: none;
    transform: rotate(180deg);
    transition: box-shadow 0.2s;
}

.back-btn:hover img {
    box-shadow: none;
}

.back-btn-tooltip {
    display: none;
    position: absolute;
    left: 50px;
    top: 38%;
    transform: translateY(-50%);
    background: #402108;
    color: #F2B87A;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.back-btn:hover + .back-btn-tooltip {
    display: block;
}

.contact-btn {
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    width: 64px;
    height: 64px;
    margin-top: 18px;
    position: relative;
    padding: 0;
}

.contact-btn img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: none;
    box-shadow: none;
    transition: box-shadow 0.2s;
    margin-left: 7px;
    margin-top: 13px;
}

.contact-btn:hover img {
    box-shadow: 0 0 12px #F2B87A88;
}

.contact-btn-tooltip {
    display: none;
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: #402108;
    color: #F2B87A;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.profile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    width: 64px;
    height: 64px;
    margin-top: 18px;
    position: relative;
    padding: 0;
}

.profile-menu-btn img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: none;
    box-shadow: none;
    transition: box-shadow 0.2s;
    margin-left: 7px;
    margin-top: 22px;
}

.profile-menu-btn:hover img {
    box-shadow: 0 0 12px #F2B87A88;
}

.profile-menu-hover-tip {
    display: none;
    position: absolute;
    left: 50px;
    top: 59%;
    transform: translateY(-50%);
    background: #402108;
    color: #F2B87A;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    white-space: nowrap;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.profile-menu-btn:hover + .profile-menu-hover-tip {
    display: block;
}

.profile-menu-tooltip {
    display: none;
    position: absolute;
    left: 50px;
    top: 65%;
    transform: translateY(-50%);
    background: #402108;
    color: #F2B87A;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    white-space: nowrap;
    z-index: 30;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.profile-menu-tooltip.active {
    display: block;
}

.profile-menu-tooltip a {
    color: #F2B87A;
    text-decoration: none;
    font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    font-size: 1rem;
    display: block;
    margin-bottom: 6px;
    transition: color 0.2s;
}

.profile-menu-tooltip a:hover {
    background: #2b1402;
}


.contact-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.45);
    justify-content: center;
    align-items: center;
}

.contact-modal-content {
    background: #6B3E1D;
    border-radius: 18px;
    padding: 38px 38px 28px 38px;
    min-width: 340px;
    max-width: 95vw;
    box-shadow: 0 8px 40px 0 rgba(0,0,0,0.45);
    font-family: 'Press Start 2P', monospace, 'Roboto', sans-serif;
    color: #F2B87A;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
}

.close-modal-btn {
    position: absolute;
    top: 18px;
    right: 22px;
    background: none;
    border: none;
    color: #F2B87A;
    font-size: 2rem;
    cursor: pointer;
    font-family: inherit;
}

.contact-modal-title {
    font-size: 1.5rem;
    color: #F2B87A;
    margin-bottom: 24px;
    letter-spacing: 2px;
}

.contact-modal-list {
    width: 100%;
    margin-bottom: 24px;
}

.contact-modal-item {
    margin-bottom: 18px;
    font-size: 1rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.contact-modal-item span {
    color: #fff;
    font-weight: bold;
    min-width: 90px;
    display: inline-block;
}

.contact-modal-item a {
    color: #F2B87A;
    text-decoration: underline;
    font-family: inherit;
    font-size: 1rem;
    transition: color 0.2s;
}

.contact-modal-item a:hover {
    color: #fff;
}

.contact-modal.active {
    display: flex;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .cards-container {
        margin-left: 150px;
    }
    
    .project-card {
        width: 600px;
    }
    
    .project-card:hover .card-image {
        right: -80px;
    }
}

@media (max-width: 768px) {
    .cards-container {
        margin-left: 120px;
    }
    
    .project-card {
        width: 500px;
        height: 160px;
    }
    
    .project-card:hover {
        height: 320px;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    
    .project-card:hover .card-image {
        right: -60px;
        width: 120px;
        height: 80px;
    }
}


  .crazy {
    color: #6B3E1D; /* Change to any color you want */
  }

  /* Large laptop screens (1200px - 1600px) */
@media (min-width: 1200px) and (max-width: 1600px) {
    .back-btn-container {
        left: clamp(200px, 15vw, 95px);
        margin-top: clamp(250px, 20vh, 300px);
    }

    
    .container {
        --sprite-th: calc(var(--sprite-sh) / 1.8);
    }
}

/* Standard laptop screens (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
    .back-btn-container {
        left: clamp(150px, 12vw, 90px);
        margin-top: clamp(200px, 18vh, 280px);
    }

    
    .container {
        --sprite-th: calc(var(--sprite-sh) / 2.2);
    }
    
    .page > div {
        font-size: 0.9rem;
    }
}

/* Small laptop/tablet screens (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .back-btn-container {
        left: clamp(80px, 8vw, 30px);
        margin-top: clamp(150px, 15vh, 220px);
    }
    

    
    .container {
        --sprite-th: calc(var(--sprite-sh) / 2.8);
        gap: 2rem;
    }
    
    .page > div {
        font-size: 0.75rem;
    }
    
    .book .carousel {
        width: min(calc(1px * (var(--sprite-tw) * 0.7042)), 85vw);
        height: min(calc(1px * (var(--sprite-th) * 0.6107)), 60vh);
        margin: 0 auto;
    padding: 0 80px; /* Add padding to accommodate scroll buttons */
    box-sizing: content-box; /* Ensure padding doesn't affect internal sizing */
    }
}

/* Very small screens - update existing media queries */
@media (max-width: 767px) {
    .back-btn-container {
        left: 7px;
        margin-top: 120px;
    }
    

    
    .container {
        --sprite-th: calc(var(--sprite-sh) / 3.5);
        gap: 1.5rem;
        padding: 0 10px;
    }
    
    .book .carousel {
        width: min(calc(1px * (var(--sprite-tw) * 0.7042)), 95vw);
        height: min(calc(1px * (var(--sprite-th) * 0.6107)), 50vh);
    }
    
    .page > div {
        font-size: 0.6rem;
    }
}

/* Ultra-wide screens (1601px+) */
@media (min-width: 1601px) {
    .back-btn-container {
        left: clamp(280px, 18vw, 150px);
        margin-top: clamp(300px, 22vh, 350px);
    }
    

    
    .container {
        --sprite-th: calc(var(--sprite-sh) / 1.5);
        max-width: 1400px;
        margin: 0 auto;
    }
    
    .page > div {
        font-size: 1rem;
    }
}