:root {
    --bg-color: #111111;
    --text-color: #eeeeee;
    --text-secondary: #888888;
    --accent-color: #ffd22d;
    /* Yellow/Orange accent */
    --border-color: #333333;
    --font-main: 'Google Sans Flex', sans-serif;
    --container-width: 800px;
    --spacing-unit: 1rem;
}

.light-theme {
    --bg-color: #f5f5f5;
    --text-color: #111111;
    --text-secondary: #555555;
    --accent-color: #e6bc28;
    /* Slightly darker yellow for light mode contrast */
    --border-color: #e0e0e0;
}

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

body {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    /* iOS Safe Area Support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-color);
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.site-header {
    padding: 2rem 0 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-color);
    padding-bottom: 2rem;
    /* Adjust padding to look good when sticky */
    margin-bottom: 2rem;
    /* Compensate for reduced padding if needed, or just rely on existing margins */
    transition: background-color 0.3s ease;
}

.header-title-wrapper {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.header-title-wrapper.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.sticky-header-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

/* Hero */
.hero {
    margin-bottom: 5rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.hero .highlight {
    color: var(--accent-color);
}

.bio {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 2rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.social-divider {
    width: 1px;
    height: 30px;
    background-color: var(--border-color);
    margin: 0 0.5rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-color);
    transition: all 0.2s ease;
    position: relative;
    background-color: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.social-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5px;
}

/* Theme Toggle Animation */
#themeToggle {
    position: relative;
    overflow: visible;
}

#themeToggle svg {
    position: absolute;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Sun Icon (Default / Dark Mode) */
.sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Moon Icon (Hidden by default in Dark Mode) */
.moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

/* Light Theme State */
.light-theme .sun-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.light-theme .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.social-btn:hover {
    border-color: var(--text-color);
    background-color: rgba(128, 128, 128, 0.1);
    transform: translateY(-2px);
    color: var(--accent-color);
}

/* Tooltip */
.social-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    border: 1px solid var(--border-color);
}

.social-btn:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip positioning for header buttons (appear below) */
.site-header .social-btn::after {
    bottom: auto;
    top: 120%;
    transform: translateX(-50%) translateY(-10px);
}

.site-header .social-btn:hover::after {
    transform: translateX(-50%) translateY(0);
}

/* Projects */
.projects h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 3rem 0 2rem;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Wave Animation */
.wave {
    display: inline-block;
    animation-name: wave-animation;
    animation-duration: 2.5s;
    animation-iteration-count: infinite;
    transform-origin: 70% 70%;
}

@keyframes wave-animation {
    0% {
        transform: rotate(0.0deg)
    }

    10% {
        transform: rotate(14.0deg)
    }

    20% {
        transform: rotate(-8.0deg)
    }

    30% {
        transform: rotate(14.0deg)
    }

    40% {
        transform: rotate(-4.0deg)
    }

    50% {
        transform: rotate(10.0deg)
    }

    60% {
        transform: rotate(0.0deg)
    }

    100% {
        transform: rotate(0.0deg)
    }
}

.project-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.02);
}

.project-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.project-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    margin-right: 1.5rem;
    background-color: #222;
    /* Fallback */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.project-info {
    flex: 1;
}

.project-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-color);
}

.project-summary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.project-action {
    margin-left: 1.5rem;
}

.view-btn {
    background-color: #222;
    color: #fff;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.light-theme .view-btn {
    background-color: #e0e0e0;
    color: #111;
}

.project-item:hover .view-btn {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Light Theme Project Item Overrides */
.light-theme .project-item {
    background-color: #ffffff;
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.light-theme .project-item:hover {
    background-color: #ffffff;
    border-color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: #1a1a1a;
    width: 90%;
    max-width: 700px;
    max-height: 90dvh;
    border-radius: 12px;
    border: 1px solid #333;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent double scrollbars */
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
}


.light-theme .modal {
    background-color: #ffffff;
    border-color: var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: color 0.2s;
}

.light-theme .close-btn {
    color: var(--text-secondary);
}

.light-theme .close-btn:hover {
    color: var(--text-color);
}

.close-btn:hover {
    color: var(--text-color);
}



/* Modal Content Styling */
.modal-header-content {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    padding-right: 2.5rem;
    /* Prevent overlap with close button */
}

.modal-project-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    margin-right: 1.5rem;
    background-color: #222;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.light-theme .modal-project-icon {
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-title-group h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    /* Reduced padding */
    color: var(--text-color);
}

.modal-title-group p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
}



.modal-action-container {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-start;
    /* Align button to the left, or center if preferred */
}

.view-project-btn {
    width: auto;
    /* Allow button to size to content */
    min-width: 120px;
    /* Minimum width for touch targets */
    padding: 0.8rem 2rem;
    /* Reduced padding */
    border-radius: 100px;
    /* Pill shape like HP */
    background-color: #222;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.light-theme .view-project-btn {
    background-color: #e0e0e0;
    color: #111;
}

.view-project-btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}



.gallery-container {
    position: relative;
    margin-bottom: 2rem;
}

.modal-gallery {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 2rem 4rem;
    /* Increased horizontal padding, reduced vertical */
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 4rem;
    /* Ensure snap respects padding */
    scrollbar-width: none;
    /* Hide scrollbar for cleaner look */

    /* Container Box */
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.light-theme .modal-gallery {
    background-color: #f5f5f5;
    border-color: var(--border-color);
}

.modal-gallery::-webkit-scrollbar {
    display: none;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.light-theme .gallery-nav {
    background-color: rgba(255, 255, 255, 0.8);
    color: #111;
    border-color: var(--border-color);
}

.light-theme .gallery-nav:hover {
    background-color: var(--accent-color);
    color: #fff;
}

.gallery-nav:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav.prev {
    left: 1rem;
}

.gallery-nav.next {
    right: 1rem;
}

@media (max-width: 768px) {
    .gallery-nav {
        display: none;
        /* Hide buttons on mobile where swipe is natural */
    }
}

.gallery-item {
    min-width: auto;
    /* Allow width to adjust based on aspect ratio */
    max-width: 300px;
    /* Limit max width */
    height: 450px;
    /* Slightly taller to fit modern phones better */
    border-radius: 16px;
    /* Smoother corners */
    scroll-snap-align: start;

    /* Professional styling */
    border: 4px solid #2a2a2a;
    /* Dark frame-like border */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    /* Depth */
    object-fit: contain;
    background-color: transparent;

    /* Prevent selection and interaction */
    user-select: none;
    -webkit-user-drag: none;
}

/* Remove the specific img override as we are styling the class directly now */

.modal-description {
    font-size: 1rem;
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.modal-description p {
    margin-bottom: 1rem;
}

.modal-description p:last-child {
    margin-bottom: 0;
}

.light-theme .modal-description {
    color: var(--text-secondary);
}

.modal-links {
    display: none;
    /* Hidden as we moved button to footer */
}

/* Hidden content in list */
.project-content-hidden {
    display: none;
}

/* Footer */
/* Footer */
.site-footer {
    margin-top: 6rem;
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-info p {
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
}

.footer-credit {
    font-size: 0.85rem !important;
    color: var(--text-secondary) !important;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
}

.footer-social a {
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
}

.footer-social a:hover {
    color: var(--text-color);
    transform: translateY(-2px);
}

/* Responsive Footer */
@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

/* Responsive */
@media (max-width: 768px) {

    /* Social Links Mobile Layout */
    .social-links {
        justify-content: flex-start;
    }

    /* Ensure theme toggle appears first */
    #themeToggle {
        order: -2;
    }

    /* Divider appears second */
    .social-divider {
        order: -1;
    }

    /* Social buttons wrap to next lines as needed */
    .social-links a {
        order: 0;
    }

    .container {
        padding: 1.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .project-header {
        padding: 1.5rem 0;
    }

    .project-title {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

}

/* Changelog Page Styles */
.changelog-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 60vh;
}

.changelog-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
    gap: 1.5rem;
}

.changelog-title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.changelog-app-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background-color: #222;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.light-theme .changelog-app-icon {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.changelog-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

.changelog-tabs {
    display: flex;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.3rem;
    border-radius: 100px;
    border: 1px solid var(--border-color);
}

.light-theme .changelog-tabs {
    background-color: rgba(0, 0, 0, 0.05);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 100px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.tab-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.tab-version {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 400;
}

.tab-btn.active {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.tab-btn.active .tab-version {
    opacity: 0.9;
}

/* 404 Page */
.error-container {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-color) 0%, var(--text-secondary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.05em;
}

.error-message {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 400px;
}

@media (max-width: 768px) {
    .error-code {
        font-size: 6rem;
    }

    .error-message {
        font-size: 1.2rem;
    }
}

/* Markdown Content Styles */
.markdown-content {
    color: var(--text-color);
    line-height: 1.6;
}

.markdown-content h2 {
    font-size: 1.5rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.markdown-content h2:first-child {
    margin-top: 0;
}

.markdown-content h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.markdown-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.markdown-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.markdown-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.error-msg {
    color: #ff5252;
    text-align: center;
}