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

body {
    font-family: pixal;
    background: #8b5766;
    color: #b3ba64;
    min-height: 100vh;
    overflow-x: hidden;
}

.content {
    width: 25cm;
    min-height: 250cm;
    padding: 20px;
    background-color: #b3ba64;
    overflow-wrap: break-word;
    display: flex;
    flex-direction: column;
    margin: 0 auto; /* This centers the box horizontally */
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(215, 143, 71, 0.9);
    padding: 20px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-btn {
    background: #e5e5be;
    color: #333;
    border: 2px solid #b3ba64;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: lowercase;
    font-family: pixal;
}

.nav-btn:hover {
    background: #8b5766;
    border-color: #b3ba64;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: #b3ba64;
    color: #333;
    border-color: #8b5766;
}

/* Main content */
main {
    padding-top: 100px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.section {
    display: none;
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.project-item {
    background: #def1a3;
    border: 4px solid #8b5766;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-color: #8b5766;
}

.home-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.project-item.large {
    height: auto;
    width: 85%;
    align-self: center;
}

.small-projects-row {
    display: flex;
    gap: 20px;
}

.project-item.medium {
    height: auto;
    flex: 1;
}

.project-item.small {
    height: fit-content;
    flex: 1;
}

.project-placeholder {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #888;
    color: #333;
    font-size: 18px;
    font-weight: bold;
}

.project-placeholder img {
    width: 100%;
    height: auto;
    object-fit: cover; /* crops image to fit container */
    object-position: center; /* centers the crop */
}

/* About section */
.about-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.about-image {
    width: 400px; /* or whatever size you want */
    height: auto; /* set a height for your colored block */
    border: 4px solid #8b5766;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 24px;
    font-weight: bold;
    overflow: hidden; /* keeps image within the border */
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* this will crop the image to fit nicely */
    object-position: center; /* centers the image */
}

.about-text {
    font-size: 18px;
    line-height: 1.6;
    color: #333;
    max-width: 500px;
}

/* Projects section */
.projects-container {
    display: flex;
    flex-direction: column;
    gap: 60px;
    max-width: 800px;
    margin: 0 auto;
}

.project-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.project-entry:hover {
    transform: translateY(-5px);
}

.project-image {
    width: 600px;
    height: auto;
    background: #888;
    border: 4px solid #8b5766;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #868686;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* crops image to fit container */
    object-position: center; /* centers the crop */
}

.project-entry:hover .project-image {
    border-color: #def1a3;
}

.project-description {
    font-size: 18px;
    color: #333;
    text-align: center;
    max-width: 600px;
}

/* Contact section */
.contact-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-text {
    font-size: 18px;
    line-height: 1.6;
    color: #333;
}

/* Individual project page */
.project-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.project-title {
    font-size: 28px;
    color: #333;
    text-align: center;
    font-weight: bold;
}

.project-detail-image {
    width: 700px;
    height: auto;
    background: #888;
    border: 4px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.project-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* crops image to fit container */
    object-position: center; /* centers the crop */
}

.project-images-row {
    display: flex;
    gap: 20px; /* space between images */
    margin: 20px 0;
}

.project-images-row .project-detail-image {
    width: fit-content;
}

.project-text {
    font-size: 18px;
    color: #333;
    text-align: center;
    max-width: 600px;
    line-height: 1.6;
}

/* Back button */
.back-btn {
    background: #e5e5be;
    color: #333;
    border: 2px solid #8b5766;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    min-height: 44px; /* Touch-friendly */
}

.back-btn:hover {
    background: #8b5766;
    border-color: #e5e5be;
}

/* Book Container */
.book {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 20cm;
    margin: 0 auto;
    overflow: hidden;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* Arrows */
.arrow {
    background: none;
    color: #8b5766;
    border: none;
    padding: 10px 20px;
    font-size: 2.5em;
    cursor: pointer;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0.7;
}

.arrow:hover {
    opacity: 1;
}

.arrow.left {
    left: 10px;
}

.arrow.right {
    right: 0px;
}

.book-pages {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 100%;
}

.book-pages2 {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 100%;
}

.page {
    display: none;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.page2 {
    display: none;
    width: 120%;
    max-width: 120%;
    height: auto;
}

.page2.active {
    display: block;
}

.page.active {
    display: block;
}

.video {
    align-self: center;
    width: 19cm;
    height: 11cm;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #c21f1f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@font-face {
    font-family: pixal;
    src: url(Pixellari.ttf);
}

/* ===== MOBILE RESPONSIVE STYLES (TABLETS AND PHONES) ===== */
@media (max-width: 768px) {
    /* Content container - make it responsive */
    .content {
        width: 100%;
        min-height: 100vh;
        padding: 15px;
    }

    /* Navigation - stack on very small screens */
    nav {
        padding: 15px 10px;
        gap: 10px;
        flex-wrap: wrap;
    }

    .nav-btn {
        padding: 8px 15px;
        font-size: 16px;
        min-height: 44px;
    }

    /* Main content */
    main {
        padding-top: 120px; /* More space for wrapped navigation */
    }

    .section {
        padding: 20px 10px;
    }

    /* Home container */
    .small-projects-row {
        flex-direction: column;
        gap: 15px;
    }

    /* About section */
    .about-container {
        gap: 20px;
        max-width: 100%;
        padding: 0 15px;
    }

    .about-image {
        width: 280px;
        height: 350px;
    }

    .about-text {
        font-size: 16px;
        max-width: 100%;
    }

    /* Projects section */
    .projects-container {
        gap: 40px;
        max-width: 100%;
        padding: 0 15px;
    }

    .project-image {
        width: 100%;
        max-width: 350px;
        height: 250px;
    }

    .project-description {
        font-size: 16px;
        max-width: 100%;
    }

    /* Individual project pages */
    .project-detail {
        gap: 30px;
        max-width: 100%;
        padding: 0 15px;
    }

    .project-title {
        font-size: 24px;
    }

    .project-detail-image {
        width: 100%;
        max-width: 100%;
        height: 250px;
    }

    .project-images-row {
        flex-direction: column;
        gap: 15px;
    }

    .project-images-row .project-detail-image {
        width: 100%;
    }

    .project-text {
        font-size: 16px;
        max-width: 100%;
    }

    /* Book container */
    .book {
        max-width: 100%;
        padding: 15px;
    }

    .arrow {
        font-size: 2em;
        padding: 8px 15px;
        min-height: 44px;
    }

    .arrow.left {
        left: 5px;
    }

    .arrow.right {
        right: 5px;
    }

    /* Video */
    .video {
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 16/9; /* Maintains video proportions */
    }

    /* Contact section */
    .contact-container {
        max-width: 100%;
        padding: 0 15px;
    }

    .contact-text {
        font-size: 16px;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .content {
        padding: 10px;
    }

    nav {
        padding: 10px 5px;
        gap: 8px;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 14px;
    }

    main {
        padding-top: 140px; /* Even more space for wrapped nav */
    }

    .section {
        padding: 15px 5px;
    }

    .about-image {
        width: 250px;
        height: 300px;
    }

    .project-image {
        max-width: 300px;
        height: auto; /* Natural proportions on small phones too */
        min-height: 150px; /* Smaller minimum for very small screens */
    }

    .project-detail-image {
        height: auto; /* Natural proportions on small phones too */
        min-height: 150px; /* Smaller minimum for very small screens */
    }

    .project-title {
        font-size: 20px;
    }

    .project-text,
    .about-text,
    .contact-text,
    .project-description {
        font-size: 14px;
    }

    .arrow {
        font-size: 1.5em;
        padding: 6px 10px;
    }
}

/* Landscape phones and small tablets */
@media (max-width: 768px) and (orientation: landscape) {
    main {
        padding-top: 80px;
    }

    .project-detail-image {
        height: 200px;
    }

    .video {
        height: auto;
        max-height: 60vh;
    }
}

/* Enhanced Ladybug Animation */
.css-bug {
    position: fixed;
    width: 40px;
    height: 40px;
    z-index: 9999;
    pointer-events: none;
    animation: randomWalk 180s linear infinite;
}

.css-bug::before {
    content: '🐞';
    font-size: 40px;
    display: block;
    animation: bugWiggle 0.4s ease-in-out infinite;
}

@keyframes bugWiggle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Extended random walk animation with instant rotation and proper border boundaries */
@keyframes randomWalk {
    0% { left: 10%; top: 15%; transform: rotate(67deg); }
    1% { left: 16%; top: 22%; transform: rotate(67deg); }
    2% { left: 22%; top: 18%; transform: rotate(-45deg); }
    3% { left: 28%; top: 12%; transform: rotate(-45deg); }
    4% { left: 34%; top: 28%; transform: rotate(123deg); }
    5% { left: 40%; top: 35%; transform: rotate(123deg); }
    6% { left: 34%; top: 42%; transform: rotate(-135deg); }
    7% { left: 28%; top: 48%; transform: rotate(-135deg); }
    8% { left: 35%; top: 55%; transform: rotate(89deg); }
    9% { left: 42%; top: 62%; transform: rotate(89deg); }
    10% { left: 48%; top: 55%; transform: rotate(-23deg); }
    11% { left: 55%; top: 48%; transform: rotate(-23deg); }
    12% { left: 62%; top: 41%; transform: rotate(156deg); }
    13% { left: 68%; top: 47%; transform: rotate(156deg); }
    14% { left: 75%; top: 35%; transform: rotate(-78deg); }
    15% { left: 82%; top: 28%; transform: rotate(-78deg); }
    16% { left: 88%; top: 22%; transform: rotate(234deg); }
    17% { left: 94%; top: 16%; transform: rotate(234deg); }
    18% { left: 90%; top: 10%; transform: rotate(-167deg); }
    19% { left: 84%; top: 7%; transform: rotate(-167deg); }
    20% { left: 78%; top: 13%; transform: rotate(45deg); }
    21% { left: 72%; top: 19%; transform: rotate(45deg); }
    22% { left: 78%; top: 26%; transform: rotate(90deg); }
    23% { left: 84%; top: 32%; transform: rotate(90deg); }
    24% { left: 90%; top: 39%; transform: rotate(135deg); }
    25% { left: 93%; top: 45%; transform: rotate(135deg); }
    26% { left: 87%; top: 52%; transform: rotate(-90deg); }
    27% { left: 81%; top: 46%; transform: rotate(-90deg); }
    28% { left: 75%; top: 53%; transform: rotate(0deg); }
    29% { left: 69%; top: 60%; transform: rotate(0deg); }
    30% { left: 63%; top: 67%; transform: rotate(180deg); }
    31% { left: 57%; top: 74%; transform: rotate(180deg); }
    32% { left: 51%; top: 68%; transform: rotate(-45deg); }
    33% { left: 45%; top: 75%; transform: rotate(-45deg); }
    34% { left: 39%; top: 82%; transform: rotate(-135deg); }
    35% { left: 33%; top: 89%; transform: rotate(-135deg); }
    36% { left: 27%; top: 83%; transform: rotate(234deg); }
    37% { left: 21%; top: 76%; transform: rotate(234deg); }
    38% { left: 15%; top: 70%; transform: rotate(45deg); }
    39% { left: 12%; top: 77%; transform: rotate(45deg); }
    40% { left: 8%; top: 84%; transform: rotate(90deg); }
    41% { left: 14%; top: 91%; transform: rotate(90deg); }
    42% { left: 20%; top: 94%; transform: rotate(0deg); }
    43% { left: 26%; top: 88%; transform: rotate(0deg); }
    44% { left: 32%; top: 94%; transform: rotate(67deg); }
    45% { left: 38%; top: 91%; transform: rotate(67deg); }
    46% { left: 44%; top: 85%; transform: rotate(-23deg); }
    47% { left: 50%; top: 78%; transform: rotate(-23deg); }
    48% { left: 56%; top: 72%; transform: rotate(156deg); }
    49% { left: 62%; top: 79%; transform: rotate(156deg); }
    50% { left: 68%; top: 86%; transform: rotate(123deg); }
    51% { left: 74%; top: 93%; transform: rotate(123deg); }
    52% { left: 80%; top: 87%; transform: rotate(-67deg); }
    53% { left: 86%; top: 80%; transform: rotate(-67deg); }
    54% { left: 92%; top: 74%; transform: rotate(-134deg); }
    55% { left: 88%; top: 68%; transform: rotate(-134deg); }
    56% { left: 94%; top: 62%; transform: rotate(178deg); }
    57% { left: 91%; top: 56%; transform: rotate(178deg); }
    58% { left: 85%; top: 63%; transform: rotate(-89deg); }
    59% { left: 79%; top: 57%; transform: rotate(-89deg); }
    60% { left: 73%; top: 64%; transform: rotate(34deg); }
    61% { left: 67%; top: 71%; transform: rotate(34deg); }
    62% { left: 61%; top: 78%; transform: rotate(145deg); }
    63% { left: 55%; top: 85%; transform: rotate(145deg); }
    64% { left: 49%; top: 91%; transform: rotate(-12deg); }
    65% { left: 43%; top: 85%; transform: rotate(-12deg); }
    66% { left: 37%; top: 78%; transform: rotate(-156deg); }
    67% { left: 31%; top: 72%; transform: rotate(-156deg); }
    68% { left: 25%; top: 66%; transform: rotate(78deg); }
    69% { left: 19%; top: 59%; transform: rotate(78deg); }
    70% { left: 13%; top: 53%; transform: rotate(123deg); }
    71% { left: 7%; top: 60%; transform: rotate(123deg); }
    72% { left: 10%; top: 67%; transform: rotate(56deg); }
    73% { left: 16%; top: 73%; transform: rotate(56deg); }
    74% { left: 22%; top: 66%; transform: rotate(-34deg); }
    75% { left: 28%; top: 59%; transform: rotate(-34deg); }
    76% { left: 34%; top: 53%; transform: rotate(167deg); }
    77% { left: 40%; top: 47%; transform: rotate(167deg); }
    78% { left: 46%; top: 41%; transform: rotate(-89deg); }
    79% { left: 52%; top: 35%; transform: rotate(-89deg); }
    80% { left: 58%; top: 29%; transform: rotate(234deg); }
    81% { left: 64%; top: 23%; transform: rotate(234deg); }
    82% { left: 70%; top: 17%; transform: rotate(12deg); }
    83% { left: 76%; top: 11%; transform: rotate(12deg); }
    84% { left: 82%; top: 5%; transform: rotate(89deg); }
    85% { left: 88%; top: 8%; transform: rotate(89deg); }
    86% { left: 94%; top: 14%; transform: rotate(134deg); }
    87% { left: 90%; top: 20%; transform: rotate(134deg); }
    88% { left: 84%; top: 26%; transform: rotate(-23deg); }
    89% { left: 78%; top: 32%; transform: rotate(-23deg); }
    90% { left: 72%; top: 25%; transform: rotate(-156deg); }
    91% { left: 66%; top: 19%; transform: rotate(-156deg); }
    92% { left: 60%; top: 13%; transform: rotate(67deg); }
    93% { left: 54%; top: 7%; transform: rotate(67deg); }
    94% { left: 48%; top: 14%; transform: rotate(145deg); }
    95% { left: 42%; top: 20%; transform: rotate(145deg); }
    96% { left: 36%; top: 27%; transform: rotate(-67deg); }
    97% { left: 30%; top: 21%; transform: rotate(-67deg); }
    98% { left: 24%; top: 15%; transform: rotate(-178deg); }
    99% { left: 18%; top: 9%; transform: rotate(-178deg); }
    100% { left: 12%; top: 16%; transform: rotate(89deg); }
}