/* Custom Properties for Colors */
:root {
    --color-dark: #5A827E;   /* Dark Teal */
    --color-medium: #84AE92; /* Medium Green */
    --color-light: #B9D4AA;  /* Light Green */
    --color-accent: #FAFFCA; /* Very Light Yellow / Cream */
    --text-color-dark: #333;
    --text-color-light: #FAFFCA;
}

/* General Body Styles */
body {
    font-family: 'Open Sans', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-accent);
    color: var(--text-color-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll from animations */
}

/* Scrollbar Styling */
body::-webkit-scrollbar {
    width: 8px;
}
body::-webkit-scrollbar-track {
    background: var(--color-light);
}
body::-webkit-scrollbar-thumb {
    background: var(--color-medium);
    border-radius: 10px;
}
body::-webkit-scrollbar-thumb:hover {
    background: var(--color-dark);
}

/* Header Styles */
header {
    background-color: var(--color-dark);
    color: var(--text-color-light);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0% 100%);
    animation: header-fade-in 1s ease-out forwards;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(132, 174, 146, 0.3) 0%, rgba(90, 130, 126, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

header.loaded::before {
    opacity: 1;
}

header div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

header span {
    font-weight: 600;
    font-size: 1.4em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: pop-in 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    opacity: 0;
    transform: scale(0.8);
}

header h1 {
    margin-top: 10px;
    font-size: 3em; /* Slightly smaller than homepage H1 for project pages */
    letter-spacing: 0.08em;
    font-weight: 700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
    animation: text-reveal 1.5s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

header h1 .subtitle {
    font-size: 0.6em; /* Smaller for "Part 1" / "Part 2" */
    margin-left: 10px;
    opacity: 0.8;
    color: var(--color-light);
}

.intro-text {
    font-size: 1.1em;
    max-width: 800px;
    margin: 1.5rem auto 2.5rem auto;
    color: var(--text-color-light);
    opacity: 0.9;
    animation: fade-in 1.5s ease-out forwards;
}

/* Navigation Links (top row) */
.a1 {
    color: var(--text-color-light);
    text-decoration: none;
    font-weight: 600;
    padding: 0.7rem 1.2rem;
    border-radius: 30px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.a1:hover {
    background-color: var(--color-medium);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: var(--color-light);
}

/* Project Navigation (within header) */
.project-navigation {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem; /* Space between project links */
    background-color: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 10px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.project-navigation .nav-link {
    color: var(--text-color-light);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: 1px solid transparent;
}

.project-navigation .nav-link:hover {
    background-color: rgba(132, 174, 146, 0.5); /* Medium green with transparency */
    transform: translateY(-2px);
    border-color: var(--color-light);
}

/* Main Content Styles */
main {
    flex-grow: 1;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column; /* Stack projects vertically */
    align-items: center;
    gap: 3rem; /* Space between project cards */
}

/* Project Card Styles */
.project-card {
    background-color: var(--color-light);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    width: 100%; /* Ensure it takes full width within max-width */
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: slide-in-bottom 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

/* Staggered animation for project cards */
.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }
.project-card:nth-child(7) { animation-delay: 0.7s; }
.project-card:nth-child(8) { animation-delay: 0.8s; }
.project-card:nth-child(9) { animation-delay: 0.9s; }
.project-card:nth-child(10) { animation-delay: 1.0s; }
.project-card:nth-child(11) { animation-delay: 1.1s; }
.project-card:nth-child(12) { animation-delay: 1.2s; }
.project-card:nth-child(13) { animation-delay: 1.3s; }
.project-card:nth-child(14) { animation-delay: 1.4s; }
.project-card:nth-child(15) { animation-delay: 1.5s; }


.project-card h2 {
    font-size: 2em;
    color: var(--color-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Space between icon and text */
}

.project-card h2 .icon {
    color: var(--color-medium);
    font-size: 0.9em;
}

.code-info-container {
    display: flex;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    gap: 2rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.code-block, .info-block {
    flex: 1; /* Allows them to grow and shrink */
    min-width: 300px; /* Minimum width before wrapping */
    background-color: var(--color-accent); /* Lighter background for these blocks */
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05); /* Soft inset shadow */
    text-align: left;
    display: flex;
    flex-direction: column;
}

.code-block h3, .info-block h3 {
    color: var(--color-dark);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3em;
}

.code-block pre {
    background-color: #282c34; /* Dark background for code */
    color: #abb2bf; /* Light text for code */
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto; /* Enable horizontal scrolling for long lines */
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    white-space: pre-wrap; /* Wrap lines within pre tag */
    word-break: break-all; /* Break long words */
}

.info-block p {
    color: var(--text-color-dark);
    font-size: 1.05em;
    margin: 0;
}

.button-group {
    display: flex;
    gap: 10px; /* Space between copy and download buttons */
    margin-top: 1rem;
    justify-content: center; /* Center buttons within their block */
}

.copy-button, .download-button {
    background-color: var(--color-medium);
    color: var(--text-color-light);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.copy-button:hover, .download-button:hover {
    background-color: var(--color-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.copy-button:active, .download-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Navigation to next/previous page */
.navigation-footer {
    margin-top: 4rem;
    padding: 2rem;
    background-color: var(--color-light);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.navigation-footer p {
    font-size: 1.2em;
    color: var(--color-dark);
    margin-bottom: 1rem;
}

.next-page-button {
    display: inline-block;
    background-color: var(--color-medium);
    color: var(--text-color-light);
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.next-page-button:hover {
    background-color: var(--color-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.next-page-button i {
    margin-left: 8px;
    margin-right: -4px;
}

/* Footer Styles */
footer {
    background-color: var(--color-dark);
    color: var(--text-color-light);
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.25);
    font-size: 0.9em;
    clip-path: polygon(0 10%, 100% 0, 100% 100%, 0% 100%);
    animation: footer-fade-in 1s ease-out forwards;
}

/* Keyframe Animations */
@keyframes header-fade-in {
    0% { opacity: 0; transform: translateY(-50px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes text-reveal {
    0% { opacity: 0; transform: translateY(20px); letter-spacing: 0.2em; }
    100% { opacity: 1; transform: translateY(0); letter-spacing: 0.08em; }
}

@keyframes pop-in {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes slide-in-bottom {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes footer-fade-in {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 900px) {
    .code-info-container {
        flex-direction: column;
        align-items: center;
    }
    .code-block, .info-block {
        width: 100%; /* Take full width when stacked */
        min-width: unset;
    }
}

@media (max-width: 768px) {
    header {
        padding: 2rem 1.5rem;
    }
    header div {
        flex-direction: column;
        gap: 0.8rem;
    }
    header h1 {
        font-size: 2.2em;
    }
    header h1 .subtitle {
        font-size: 0.5em;
        margin-left: 5px;
    }
    .intro-text {
        font-size: 1em;
        margin: 1rem auto 2rem auto;
    }
    .project-navigation {
        padding: 0.8rem;
        gap: 0.6rem;
    }
    .project-navigation .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9em;
    }
    main {
        padding: 2rem 1rem;
        gap: 2rem;
    }
    .project-card {
        padding: 1.5rem;
    }
    .project-card h2 {
        font-size: 1.8em;
    }
    .code-block h3, .info-block h3 {
        font-size: 1.2em;
    }
    .copy-button, .download-button {
        padding: 0.7rem 1.2rem;
        font-size: 0.9em;
    }
    .navigation-footer {
        padding: 1.5rem;
    }
    .navigation-footer p {
        font-size: 1.1em;
    }
    .next-page-button {
        padding: 0.8rem 1.5rem;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    header {
        clip-path: polygon(0 0, 100% 0, 100% 95%, 0% 100%);
    }
    header h1 {
        font-size: 1.8em;
    }
    header span {
        font-size: 1.1em;
    }
    .a1 {
        padding: 0.6rem 1rem;
        font-size: 0.9em;
    }
    .project-navigation {
        flex-direction: column;
        align-items: stretch;
    }
    .project-navigation .nav-link {
        width: 100%;
        text-align: center;
    }
    .project-card {
        padding: 1rem;
    }
    .project-card h2 {
        font-size: 1.5em;
    }
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    .copy-button, .download-button {
        width: 100%;
    }
    footer {
        clip-path: polygon(0 5%, 100% 0, 100% 100%, 0% 100%);
    }
}