/* Basic Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth !important;
}

body {
    font-family: 'Inter', sans-serif;
    background-image: url('../img/NYC.png');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    overflow-x: hidden;
    font-size: 16px;
    padding-top: 70px;
    background-color: transparent;
    color: var(--text-primary);
    transition: color 0.4s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-overlay-main);
    z-index: -2;
    transition: background-color 0.4s ease;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- Focus Indicator --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 3px solid var(--focus-outline-color, Highlight);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--focus-shadow-color, rgba(0,100,255,0.3));
}
html.high-contrast-mode a:focus-visible,
html.high-contrast-mode button:focus-visible,
html.high-contrast-mode input:focus-visible,
html.high-contrast-mode select:focus-visible,
html.high-contrast-mode textarea:focus-visible,
html.high-contrast-mode [tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 3px solid var(--text-accent);
    outline-offset: 2px;
    box-shadow: none;
}

/* --- About Section Content Wrapper --- */


/* About Section Styles */
.portfolio-header {
    width: 100%;
}

.portfolio-title-text.animate-on-load {
    font-family: 'DM Mono', monospace;
    font-size: 0.7875em;
    letter-spacing: 5.625px;
    color: var(--text-secondary);
    margin-bottom: 33.75px;
    opacity: 0;
    transform: translateY(20px);
}

.about-section {
    min-height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    padding-left: 6vw;
    padding-right: 6vw;
    padding-top: 11vh;
    padding-bottom: 45px;
    position: relative;
    z-index: 1;
    max-width: 1400px;
}

.about-heading.animate-on-load {
    font-family: 'Dela Gothic One', cursive;
    font-size: 3.15em;
    font-weight: normal;
    color: var(--text-accent);
    margin-top: 0;
    margin-bottom: 16.875px;
    letter-spacing: 0.5625px;
    opacity: 0;
    transform: translateY(20px);
}

.about-subtitle.animate-on-load {
    font-family: 'Inter', sans-serif;
    font-size: 1.0125em;
    color: var(--text-secondary);
    line-height: 2;
    letter-spacing: 1.125px;
    margin-bottom: 33.75px;
    max-width: none;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
}

.about-text.animate-on-load {
    font-family: 'Inter', sans-serif;
    font-size: 1.0125em;
    color: var(--text-about-main);
    line-height: 2;
    letter-spacing: 1.125px;
    margin-bottom: 0.625em;
    max-width: none;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
}

.highlight {
    font-weight: 700;
    color: var(--highlight-color);
}

.commission-status {
    font-weight: 700;
    color: var(--commission-status-color);
}

.cta-button.animate-on-load {
    font-family: 'Inter', sans-serif;
    font-size: 0.95625em;
    line-height: normal;
    letter-spacing: 1.6875px;
    padding: 13.5px 45px;
    text-decoration: none;
    font-weight: 700;
    margin-top: 39.375px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    transform: translateY(20px);
    border: 2.25px solid var(--border-button-cta);
    color: var(--text-button-cta);
    background-color: var(--bg-button-cta);
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background-color: var(--bg-button-cta-hover);
    color: var(--text-button-cta-hover);
    border-color: var(--border-button-cta-hover);
}

.fadeInUp-active {
    animation-name: fadeInUpAnimation;
    animation-duration: 0.8s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}
@keyframes fadeInUpAnimation {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
    .about-section { padding-top: 9vh; max-width: 800px; }
    .portfolio-title-text.animate-on-load { font-size: 0.675em; letter-spacing: 4.5px; margin-bottom: 30px; }
    .about-heading.animate-on-load { font-size: 2.625em; margin-bottom: 15px; }
    .about-subtitle.animate-on-load, .about-text.animate-on-load { font-size: 0.825em; letter-spacing: 0.9px; }
    .about-subtitle.animate-on-load { margin-bottom: 26.25px; }
    .cta-button.animate-on-load { font-size: 0.825em; padding: 12px 37.5px; margin-top: 33.75px; border-width: 1.875px;}
}
@media (max-width: 768px) {
    .about-section { padding-top: 9vh; padding-left: 4vw; padding-right: 4vw; max-width: none; /* Full width on smaller screens */}
    .portfolio-title-text.animate-on-load { font-size: 0.6em; letter-spacing: 3.75px; margin-bottom: 22.5px; }
    .about-heading.animate-on-load { font-size: 2.25em; margin-bottom: 13.5px; }
    .about-subtitle.animate-on-load, .about-text.animate-on-load { font-size: 0.75em; letter-spacing: 0.75px; line-height: 1.8; }
    .about-subtitle.animate-on-load { margin-bottom: 22.5px; }
    .cta-button.animate-on-load { font-size: 0.75em; padding: 10.5px 33.75px; margin-top: 30px; border-width: 1.875px; }
}
@media (max-width: 480px) {
    .about-section { padding-top: 8vh; padding-left: 3vw; padding-right: 3vw;}
    .portfolio-title-text.animate-on-load { font-size: 0.7em; letter-spacing: 5px; margin-bottom: 25px; }
    .about-heading.animate-on-load { font-size: 2.8em; margin-bottom: 15px; }
    .about-subtitle.animate-on-load, .about-text.animate-on-load { font-size: 0.75em; line-height: 2; letter-spacing: 1px; }
    .about-subtitle.animate-on-load { margin-bottom: 25px; }
    .cta-button.animate-on-load { font-size: 0.85em; padding: 12px 40px; margin-top: 35px; border-width: 2px; letter-spacing: 1.5px; }
}

:root, html.dark-mode {
    --bg-overlay-main: rgba(8, 8, 18, 0.65);
    --bg-primary-content: #0f0f1a;
    --bg-secondary-content: rgba(22, 22, 38, 0.9);
    --bg-tertiary-content: rgba(30, 30, 55, 0.8);
    --bg-header: rgba(12, 12, 22, 0.65);
    --bg-footer: #040408;

    --text-primary: #d5d8de;
    --text-secondary: #b0b8c5;
    --text-accent: #ffffff;
    --text-about-main: #e0e0e0;
    --text-card-primary: #d5d8de;
    --text-card-secondary: #b0b8c5;

    --text-link-nav: #c0c8d0;
    --text-link-nav-hover: #ffffff;
    --text-link-footer: #a0a8b0;
    --text-link-footer-hover: #ffffff;

    --text-button-cta: #ffffff;
    --bg-button-cta: transparent;
    --border-button-cta: #ffffff;
    --text-button-cta-hover: #0f0f1a;
    --bg-button-cta-hover: #ffffff;
    --border-button-cta-hover: #ffffff;

    --border-secondary: rgba(255,255,255,0.1);
    --border-project-item-hover: rgba(255, 255, 255, 0.4);
    --border-theme-button: #b0b8c5;
    --border-theme-button-hover: #ffffff;

    --highlight-color: #f0f0f0;
    --commission-status-color: #aaffaa;

    --focus-outline-color: #d5d8de;
    --focus-shadow-color: rgba(213, 216, 222, 0.3);

    --theme-transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, opacity 0.35s ease;
}

html.light-mode {
    --bg-overlay-main: rgba(8, 8, 18, 0.65);
    --bg-primary-content: #ffffff;
    --bg-secondary-content: #f8f9fa;
    --bg-tertiary-content: #e9ecef;
    --bg-header: rgba(240, 242, 248, 0.85);
    --bg-footer: #e4e9ef;

    /* Text colors for elements directly on the dark overlay (e.g., About Section) */
    --text-primary: #d5d8de;
    --text-secondary: #b0b8c5;
    --text-accent: #ffffff;
    --text-about-main: #e0e0e0;
    --highlight-color: #f0f0f0;
    --commission-status-color: #aaffaa;
    --focus-outline-color:  #d5d8de;
    --focus-shadow-color: rgba(213, 216, 222, 0.3);

    /* Text colors and accents for light UI components (Header, Cards, Footer, Project Area) */
    --text-on-light-bg: #212529;
    --text-secondary-on-light-bg: #495057;
    --accent-on-light-bg: #0056b3;
    --link-on-light-bg: #0056b3;
    --link-hover-on-light-bg: #003875;
    --focus-outline-on-light-bg: #0056b3;
    --focus-shadow-on-light-bg: rgba(0, 86, 179, 0.3);
    --border-secondary-on-light-bg: #d1d9e0;
    --border-theme-button-on-light-bg: #505868;
    --border-theme-button-hover-on-light-bg: #000000;

    --text-card-primary: var(--text-on-light-bg);
    --text-card-secondary: var(--text-secondary-on-light-bg);
    --border-project-item-hover: #6c757d;


    --text-button-cta: var(--text-primary);
    --bg-button-cta: transparent;
    --border-button-cta: var(--text-primary);
    --text-button-cta-hover: var(--text-on-light-bg);
    --bg-button-cta-hover: var(--text-primary);
    --border-button-cta-hover: var(--text-primary);
}

html.high-contrast-mode {
    --bg-overlay-main: rgba(8, 8, 18, 0.65);
    --bg-primary-content: #000000;
    --bg-secondary-content: #080808;
    --bg-tertiary-content: #030303;
    --bg-header: #000000;
    --bg-footer: #000000;

    --text-primary: #ffffff;
    --text-secondary: #f0f0f0;
    --text-accent: #ffff00;
    --text-about-main: #ffffff;
    --text-card-primary: #ffffff;
    --text-card-secondary: #f0f0f0;

    --text-link-nav: #ffffff;
    --text-link-nav-hover: var(--text-accent);
    --text-link-footer: #f0f0f0;
    --text-link-footer-hover: var(--text-accent);

    --text-button-cta: var(--text-accent);
    --bg-button-cta: transparent;
    --border-button-cta: var(--text-accent);
    --text-button-cta-hover: #000000;
    --bg-button-cta-hover: var(--text-accent);
    --border-button-cta-hover: var(--text-accent);

    --border-secondary: #ffffff;
    --border-project-item-hover: var(--text-accent);
    --border-theme-button: #ffffff;
    --border-theme-button-hover: var(--text-accent);

    --highlight-color: var(--text-accent);
    --commission-status-color: #00ff00;

    --focus-outline-color: var(--text-accent);
    --focus-shadow-color: rgba(255, 255, 0, 0.4);
}

.overlay, .page-header, .projects-section, .project-item, .page-footer, #theme-toggle-button,
    /* .about-content-wrapper, removed */
.about-section .portfolio-title-text, .about-section .about-heading, .about-section .about-subtitle, .about-section .about-text,
.about-section .highlight, .about-section .commission-status {
    transition: var(--theme-transition);
}

/* --- Light Mode Specific Text and Focus Styling --- */
html.light-mode body {
    color: var(--text-primary); /* Default body text (for About Section) is light */
}

/* Header in Light Mode */
html.light-mode .page-header {
    color: var(--text-on-light-bg);
    border-bottom-color: var(--border-secondary-on-light-bg);
}
html.light-mode .page-header .main-navigation ul li a { color: var(--link-on-light-bg); }
html.light-mode .page-header .main-navigation ul li a:hover,
html.light-mode .page-header .main-navigation ul li a:focus-visible { color: var(--link-hover-on-light-bg); }
html.light-mode .page-header .main-navigation ul li a::before { background-color: var(--link-hover-on-light-bg); }
html.light-mode #theme-toggle-button {
    color: var(--text-secondary-on-light-bg);
    border-color: var(--border-theme-button-on-light-bg);
}
html.light-mode #theme-toggle-button:hover,
html.light-mode #theme-toggle-button:focus-visible {
    color: var(--text-on-light-bg);
    border-color: var(--border-theme-button-hover-on-light-bg);
    box-shadow: 0 0 8px 2px var(--border-theme-button-hover-on-light-bg);
}
html.light-mode .page-header a:focus-visible,
html.light-mode .page-header button:focus-visible {
    outline-color: var(--focus-outline-on-light-bg);
    box-shadow: 0 0 0 4px var(--focus-shadow-on-light-bg);
}

/* Focus for CTA button in about section (directly on dark overlay) */
html.light-mode .about-section .cta-button.animate-on-load:focus-visible {
    outline-color: var(--focus-outline-color);
    box-shadow: 0 0 0 4px var(--focus-shadow-color);
}

/* Projects Section in Light Mode */
html.light-mode .projects-section { color: var(--text-on-light-bg); }
html.light-mode .projects-section h2.section-title-animate { color: var(--accent-on-light-bg); }
html.light-mode .project-item {
    border-color: var(--border-secondary-on-light-bg);
}
html.light-mode .project-item img {
    border-color: rgba(0,0,0,0.05);
}
html.light-mode .project-item h3 { color: var(--accent-on-light-bg); }
html.light-mode .project-item p { color: var(--text-card-primary); }
html.light-mode .project-item figcaption { color: var(--text-card-secondary); }

html.light-mode .project-category-filter { }
html.light-mode .category-button { color: var(--text-secondary-on-light-bg); }
html.light-mode .category-button:hover { color: var(--accent-on-light-bg); background-color: #d8dfe6; }
html.light-mode .category-button.active { background-color: var(--accent-on-light-bg); color: #ffffff; }
html.light-mode .category-button.active .category-icon { color: #ffffff; }
html.light-mode .projects-section a:focus-visible,
html.light-mode .projects-section button:focus-visible {
    outline-color: var(--focus-outline-on-light-bg);
    box-shadow: 0 0 0 4px var(--focus-shadow-on-light-bg);
}

/* Footer in Light Mode */
html.light-mode .page-footer {
    color: var(--text-secondary-on-light-bg);
    border-top-color: var(--border-secondary-on-light-bg);
}
html.light-mode .page-footer .footer-navigation ul li a { color: var(--text-on-light-bg); }
html.light-mode .page-footer .footer-navigation ul li a:hover,
html.light-mode .page-footer .footer-navigation ul li a:focus-visible { color: #000000; }
html.light-mode .page-footer a:focus-visible {
    outline-color: var(--focus-outline-on-light-bg);
    box-shadow: 0 0 0 4px var(--focus-shadow-on-light-bg);
}

/* General main, header, footer structure */
main { flex-grow: 1; }
.page-header {
    background-color: var(--bg-header); padding: 0.7em 3vw;
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
    border-bottom: 1px solid var(--border-secondary);
    display: flex; justify-content: space-between; align-items: center;
}
html.high-contrast-mode .page-header { border-bottom-color: var(--text-accent); }

.page-header .main-navigation ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.8em; }
.page-header .main-navigation ul li a {
    color: var(--text-link-nav); text-decoration: none;
    font-family: 'DM Mono', monospace; font-size: 0.85em;
    padding: 0.3em 0.1em; position: relative; overflow: hidden;
}
.page-header .main-navigation ul li a .link-text-wrapper { display: inline-block; position: relative; z-index: 1; transition: transform 0.3s cubic-bezier(0.77, 0, 0.175, 1); }
.page-header .main-navigation ul li a:hover .link-text-wrapper { transform: translateY(-1px); }
.page-header .main-navigation ul li a::before {
    content: ''; position: absolute; bottom: -2px; left: 0;
    width: 100%; height: 2px; background-color: var(--text-link-nav-hover);
    transform: scaleX(0); transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1), background-color 0.35s ease;
    z-index: 0;
}
.page-header .main-navigation ul li a:hover::before,
.page-header .main-navigation ul li a:focus-visible::before {
    transform: scaleX(1);
}
.page-header .main-navigation ul li a:hover,
.page-header .main-navigation ul li a:focus-visible {
    color: var(--text-link-nav-hover);
}

.theme-switcher-container { position: relative; }
#theme-toggle-button {
    background: transparent; border: 1px solid var(--border-theme-button);
    color: var(--text-secondary); padding: 0; border-radius: 50%; cursor: pointer;
    font-size: 1rem; overflow: hidden; width: 40px; height: 40px;
    display: flex; position: relative;
}
#theme-toggle-button:hover,
#theme-toggle-button:focus-visible {
    color: var(--text-accent); border-color: var(--border-theme-button-hover);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 8px 2px var(--border-theme-button-hover);
}

#theme-toggle-button .icon-wrapper { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; position: relative; }
#theme-toggle-button .theme-icon { position: absolute; font-size: 0.9em; opacity: 0; transform: translateY(100%) scale(0.5); transition: opacity 0.3s ease-out, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
#theme-toggle-button .theme-icon.active { opacity: 1; transform: translateY(0) scale(1); }

.projects-section {
    padding: 60px 6vw;
    background-color: var(--bg-primary-content);
}
.projects-section .section-container { max-width: 1200px; margin: 0 auto; }
.projects-section h2.section-title-animate {
    font-family: 'Dela Gothic One', cursive; font-size: 2.6em; color: var(--text-accent);
    text-align: center; margin-bottom: 50px;
    opacity: 0; transform: translateY(30px) scale(0.95);
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1), color 0.35s ease;
}
.projects-section h2.section-title-animate.visible { opacity: 1; transform: translateY(0) scale(1); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 30px; }
.project-item.project-animate {
    background-color: var(--bg-tertiary-content); padding: 20px; border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex; flex-direction: column; border: 1px solid var(--border-secondary);
    opacity: 0; transform: translateY(40px) rotateX(-10deg); transform-origin: bottom center;
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.3s ease-out, opacity 0.5s ease-out,
    background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}
.project-item.project-animate.visible { opacity: 1; transform: translateY(0) rotateX(0deg); }
.project-item:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    border-color: var(--border-project-item-hover);
}
.project-item figure { margin: 0 0 15px 0; overflow: hidden; border-radius: 4px;}
.project-item img {
    width: 100%; height: auto; border-radius: 4px; margin-bottom: 10px;
    aspect-ratio: 16 / 9; object-fit: cover;
    border: 1px solid var(--border-secondary);
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), border-color 0.35s ease;
}
.project-item:hover img { transform: scale(1.1); }
.project-item figcaption { font-size: 0.75em; text-align: center; font-style: italic; color: var(--text-card-secondary); opacity: 0.8; }
.project-item h3 { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.25em; color: var(--text-accent); margin-bottom: 10px; }
.project-item p { font-family: 'Inter', sans-serif; font-size: 0.95em; line-height: 1.6; flex-grow: 1; color: var(--text-card-primary); }

.page-footer {
    background-color: var(--bg-footer);
    padding: 30px 5vw;
    text-align: center; font-size: 0.8em; margin-top: auto;
    border-top: 1px solid var(--border-secondary);
}
html.high-contrast-mode .page-footer { border-top-color: var(--text-accent); }
.footer-content.footer-animate { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s; }
.footer-content.footer-animate.visible { opacity: 1; transform: translateY(0); }
.footer-content { max-width: 900px; margin: 0 auto; }
.page-footer p { margin-bottom: 15px; }
.page-footer .footer-navigation ul { list-style: none; padding: 0; margin: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 20px; }
.page-footer .footer-navigation ul li a { color: var(--text-link-footer); text-decoration: none; transition: color 0.2s ease; }
.page-footer .footer-navigation ul li a:hover,
.page-footer .footer-navigation ul li a:focus-visible {
    color: var(--text-link-footer-hover); text-decoration: underline;
}

@media (max-width: 768px) {
    body { padding-top: 55px; }
    .about-section { min-height: calc(100vh - 55px); }
    .page-header { padding: 0.6em 3vw; }
    .page-header .main-navigation ul { gap: 1em; }
    #theme-toggle-button { width: 36px; height: 36px; font-size: 0.9rem; }
    .projects-section h2.section-title-animate { font-size: 2.2em; margin-bottom: 35px; }
    .project-item.project-animate { transform: translateY(20px) rotateX(0deg); }
}
@media (max-width: 520px) {
    body { padding-top: 90px; }
    .about-section { min-height: calc(100vh - 90px); }
    .page-header { flex-direction: column; align-items: center; gap: 0.5em; padding: 0.6em 2vw; }
    .page-header .main-navigation ul { flex-wrap: wrap; justify-content: center; gap: 0.5em 1em; }
    #theme-toggle-button { margin-top: 0.3em; }
    .projects-section { padding: 40px 4vw; }
    .projects-section h2.section-title-animate { font-size: 2em; }
    .project-grid { gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }

    .animate-on-load,
    .project-animate,
    .footer-animate,
    .section-title-animate,
    .fadeInUp-active {
        opacity: 1 !important;
        transform: none !important;
    }

    .section-title-animate.visible,
    .project-item.project-animate.visible,
    .footer-content.footer-animate.visible {
        opacity: 1 !important;
        transform: none !important;
    }

    .page-header .main-navigation ul li a .link-text-wrapper {
        transform: none !important;
    }
    .page-header .main-navigation ul li a::before {
        transform: scaleX(0) !important;
    }
    .page-header .main-navigation ul li a:hover::before,
    .page-header .main-navigation ul li a:focus-visible::before {
        transform: scaleX(1) !important;
    }

    #theme-toggle-button:hover,
    #theme-toggle-button:focus-visible {
        transform: none !important;
        box-shadow: 0 0 8px 2px var(--border-theme-button-hover);
    }

    .project-item:hover {
        transform: none !important;
    }
    .project-item:hover img {
        transform: none !important;
    }
}

.visible-reduced-motion {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
}

/* --- Project Category Filter (Segmented Control) Styles --- */
.project-category-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    background-color: var(--bg-tertiary-content);
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 5px;
}

.category-button {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9em;
    padding: 10px 20px;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    flex-basis: auto;
    text-align: center;
    justify-content: center;
}

.category-button .category-icon {
    font-size: 1.1em;
    line-height: 1;
}

.category-button:hover {
    color: var(--text-accent);
    background-color: rgba(255,255,255,0.05);
}

.category-button.active {
    background-color: var(--text-accent);
    color: var(--bg-primary-content);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}
.category-button.active .category-icon {
    color: var(--bg-primary-content);
}

html.high-contrast-mode .project-category-filter {
    background-color: #000000;
    border: 1px solid var(--text-accent);
}
html.high-contrast-mode .category-button {
    color: var(--text-primary);
    border: 1px solid transparent;
}
html.high-contrast-mode .category-button:hover {
    color: var(--text-accent);
    background-color: #1a1a1a;
    border-color: var(--text-accent);
}
html.high-contrast-mode .category-button.active {
    background-color: var(--text-accent);
    color: #000000;
    border-color: var(--text-accent);
    font-weight: bold;
}
html.high-contrast-mode .category-button.active .category-icon {
    color: #000000;
}
.category-button:focus-visible {
    outline: 3px solid var(--focus-outline-color);
    outline-offset: 1px;
}
html.high-contrast-mode .category-button:focus-visible {
    outline-color: var(--text-accent);
}


.project-item-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .project-category-filter {
        flex-direction: column;
        align-items: stretch;
    }
    .category-button {
        flex-grow: 0;
        margin-bottom: 5px;
    }
    .category-button:last-child {
        margin-bottom: 0;
    }
}

/* --- Existing animation definition (should already be there) --- */
@keyframes fadeInUpAnimation {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fadeInUp-active {
    animation-name: fadeInUpAnimation;
    animation-duration: 0.8s; /* Or your preferred duration */
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* --- Initial state for elements to be animated --- */ /* For project items that get .fadeInUp-active via JS */
.animate-on-load,
.project-animate,
.animate-project-stats, /* For the new statistics elements */
.section-title-animate, /* For the project heading */
.footer-animate { /* For the footer */
    opacity: 0;
    transform: translateY(20px); /* Uniform start for fadeInUp */
}

/* --- Styles for the statistics container variant in the project section --- */
.extended-stats-container.project-stats-variant {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 50px;
    margin-bottom: 40px;
    padding: 20px 0;
    width: 100%;
    flex-wrap: wrap;
    /* opacity and transform are controlled by .animate-project-stats and .fadeInUp-active */
}

.extended-stats-container.project-stats-variant .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    /* opacity and transform are controlled by .animate-project-stats and .fadeInUp-active */
}

.extended-stats-container.project-stats-variant .stat-number {
    font-family: 'Dela Gothic One', cursive;
    font-size: 2.8em;
    font-weight: normal;
    color: var(--text-accent); /* Is overridden for Light Mode */
    line-height: 1.1;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.extended-stats-container.project-stats-variant .stat-description {
    font-family: 'Inter', sans-serif;
    font-size: 0.9em;
    color: var(--text-secondary); /* Is overridden for Light Mode */
    line-height: 1.4;
    letter-spacing: 0.5px;
    max-width: 180px;
}

/* Color adjustment of stats for the project section in Light Mode */
html.light-mode .extended-stats-container.project-stats-variant .stat-number {
    color: var(--accent-on-light-bg);
}
html.light-mode .extended-stats-container.project-stats-variant .stat-description {
    color: var(--text-secondary-on-light-bg);
}

/* High Contrast Mode remains consistent */
html.high-contrast-mode .extended-stats-container.project-stats-variant .stat-number {
    color: var(--text-accent);
}
html.high-contrast-mode .extended-stats-container.project-stats-variant .stat-description {
    color: var(--text-secondary);
}


/* --- Responsive adjustments for the Extended Stats in the project section --- */
@media (max-width: 768px) {
    .extended-stats-container.project-stats-variant {
        gap: 30px;
        margin-bottom: 30px;
    }
    .extended-stats-container.project-stats-variant .stat-number {
        font-size: 2.4em;
    }
    .extended-stats-container.project-stats-variant .stat-description {
        font-size: 0.85em;
    }
}

@media (max-width: 520px) {
    .extended-stats-container.project-stats-variant {
        flex-direction: column;
        align-items: center;
        gap: 25px;
        margin-bottom: 25px;
    }
    .extended-stats-container.project-stats-variant .stat-item {
        min-width: auto;
        width: 100%;
        max-width: 300px;
    }
    .extended-stats-container.project-stats-variant .stat-number {
        font-size: 2.2em;
    }
}

/* --- Adjustment for .project-animate (Project Items) --- */
.project-item.project-animate {
    background-color: var(--bg-tertiary-content);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-secondary);
    /* opacity and transform come from the global .project-animate rule */
    transition: transform 0.3s ease, /* Only hover effect transition here */
    box-shadow 0.3s ease-out,
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease;
    /* The animation transition (opacity, transform) is taken over by .fadeInUp-active */
}

/* Ensure that section-title-animate also has the initial state */
.projects-section h2.section-title-animate {
    font-family: 'Dela Gothic One', cursive;
    font-size: 2.6em;
    color: var(--text-accent);
    text-align: center;
    margin-bottom: 50px;
    /* opacity and transform from the global .section-title-animate above */
    /* The transition here is for the color change during theme switch, not for the fade-in animation */
    transition: color 0.35s ease;
    /* The fade-in animation is controlled by .fadeInUp-active */
}

/* Similar for footer-animate */
.footer-content.footer-animate {
    /* opacity and transform from the global .footer-animate above */
    /* Transition for color adjustments etc. */
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
    /* Fade-in animation by .fadeInUp-active */
}