:root {
    --bg-color: #0f172a;
    --surface: #131e33;
    --surface-high: #1e293b;
    --surface-highest: #2b3a50;
    --text-color: #f1f5f9;
    --secondary-color: #94a3b8;
    --accent-color: #2dd4bf;
    --accent-container: #164e4a;
    --accent-on-container: #ccfbf1;
    --coral-container: #49333d;
    --coral-on-container: #ffe0e6;
    --violet-container: #37375b;
    --violet-on-container: #e5e7ff;
    --outline: #7f8da3;
    --outline-variant: #334155;
    --card-bg: var(--surface-high);
    --glass-border: var(--outline-variant);
    --heading-font: 'Roboto Flex', 'Google Sans Flex', sans-serif;
    --body-font: 'Google Sans Flex', 'Roboto Flex', sans-serif;
    --code-font: 'Inconsolata', monospace; /*400, 600 */
    --shape-small: 12px;
    --shape-medium: 20px;
    --shape-large: 32px;
    --shape-extra-large: 48px;
    --expressive-ease: cubic-bezier(0.2, 0, 0, 1);
}

html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

.lightmode {
    --bg-color: #f5f7f3;
    --surface: #eef1ec;
    --surface-high: #e5e9e3;
    --surface-highest: #dce1da;
    --text-color: #18201b;
    --secondary-color: #4f5b53;
    --accent-color: #006b52;
    --accent-container: #8bf8cf;
    --accent-on-container: #002117;
    --coral-container: #ffdad5;
    --coral-on-container: #3b0908;
    --violet-container: #e5deff;
    --violet-on-container: #201a3b;
    --outline: #707a72;
    --outline-variant: #bfc9c0;
    --card-bg: var(--surface-high);
    --glass-border: var(--outline-variant);
}

body {
    color: var(--text-color);
    background: var(--bg-color);
    font-family: var(--body-font);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
}

.container {
    width: calc(100% - 2rem);
    max-width: 1240px;
    margin-inline: auto;
}

a {
    text-decoration: none;
    color: var(--accent-color);
    transition: color 0.2s ease;
}

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

.titles h1 {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-color);
    font-family: var(--heading-font);
    font-weight: 800;
    font-size: 4rem;
    font-variation-settings: 'opsz' 72, 'slnt' -5, 'wdth' 118, 'wght' 800;
    letter-spacing: 0;
    margin-bottom: 2rem;
}

/* Header & Navbar */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% - 2rem);
    margin: 1rem;
    padding: 0.7rem 0.8rem 0.7rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: var(--surface-high);
    border: 1px solid var(--outline-variant);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.lightmode .header {
    background: var(--surface);
}

.header h3 {
    color: var(--accent-color);
    font-family: var(--body-font);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    margin: 0;
    white-space: nowrap;
}

.links-container {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.navbar {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.navbar a {
    color: var(--secondary-color);
    font-family: var(--body-font);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.navbar a:hover {
    color: var(--accent-on-container);
    background: var(--accent-container);
}

.navbar a.active {
    color: var(--accent-on-container);
    background: var(--accent-container);
    font-weight: 700;
}

.container-header {
    font-family: var(--heading-font);
    font-weight: 820;
    text-align: left;
    font-size: clamp(3.5rem, 8vw, 6.5rem);
    font-variation-settings: 'opsz' 72, 'slnt' -6, 'wdth' 122, 'wght' 820;
    letter-spacing: 0;
    line-height: 0.9;
    margin: 0;
}

/* Buttons */
.btn {
    font-family: var(--body-font);
    font-weight: 500;
    color: var(--bg-color);
    background-color: var(--accent-color);
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 999px;
    transition: transform 0.25s var(--expressive-ease), box-shadow 0.25s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
    background-color: var(--accent-color);
    color: var(--bg-color);
}

/* Theme Switch */
#theme-switch {
    background: var(--surface-highest);
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 999px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-switch:hover {
    background-color: var(--glass-border);
}

#theme-switch svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: currentColor;
}

#theme-switch svg:last-child {
    display: none;
}

.lightmode #theme-switch svg:first-child {
    display: none;
}

.lightmode #theme-switch svg:last-child {
    display: block;
}

/* Mobile Menu */
#sidebar-active,
.open-sidebar-button,
.close-sidebar-button {
    display: none;
}

/* Mobile Menu Overlay */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#sidebar-active:checked~#overlay {
    opacity: 1;
    visibility: visible;
}

@media(max-width: 768px) {
    .header {
        width: calc(100% - 1rem);
        margin: 0.5rem;
        padding: 0.75rem 0.8rem 0.75rem 1rem;
    }

    .open-sidebar-button {
        display: block;
        cursor: pointer;
        color: var(--text-color);
        transition: color 0.3s ease;
    }

    .open-sidebar-button:hover {
        color: var(--accent-color);
    }

    .open-sidebar-button svg {
        fill: currentColor;
    }

    .links-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3rem;
        background: var(--surface-high);
        border-left: 1px solid var(--outline-variant);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 999;
    }

    .lightmode .links-container {
        background: var(--surface);
    }

    #sidebar-active:checked~.links-container {
        right: 0;
    }

    .navbar a {
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--text-color);
        padding: 0.8rem 1.25rem;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
    }

    #sidebar-active:checked~.links-container a {
        opacity: 1;
        transform: translateY(0);
        transition-delay: 0.1s;
    }

    /* Staggered animation for links */
    #sidebar-active:checked~.links-container a:nth-child(2) {
        transition-delay: 0.1s;
    }

    #sidebar-active:checked~.links-container a:nth-child(3) {
        transition-delay: 0.2s;
    }

    #sidebar-active:checked~.links-container a:nth-child(4) {
        transition-delay: 0.3s;
    }

    .navbar a:hover {
        color: var(--accent-color);
        transform: translateX(10px);
    }

    .close-sidebar-button {
        display: block;
        position: absolute;
        top: 2rem;
        right: 2rem;
        cursor: pointer;
        color: var(--secondary-color);
        transition: color 0.3s ease, transform 0.3s ease;
    }

    .close-sidebar-button:hover {
        color: var(--accent-color);
        transform: rotate(90deg);
    }

    .close-sidebar-button svg {
        fill: currentColor;
        width: 32px;
        height: 32px;
    }
}

/* Sections */
section {
    min-height: auto;
    padding: 8rem 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.theme-transitioning,
.theme-transitioning .header,
.theme-transitioning #projects,
.theme-transitioning .project-card,
.theme-transitioning .quiet-picks-links a,
.theme-transitioning .album-gallery-card,
.theme-transitioning .spotify-widget,
.theme-transitioning .tech-tag,
.theme-transitioning .project-link,
.theme-transitioning .icons a {
    transition:
        background-color 0.45s var(--expressive-ease),
        color 0.38s ease,
        border-color 0.45s ease,
        box-shadow 0.45s ease;
}

.theme-transitioning .project-card-wrapper:nth-child(2n) .project-card,
.theme-transitioning .album-gallery-card:nth-child(2n) {
    transition-delay: 45ms;
}

.theme-transitioning .project-card-wrapper:nth-child(3n) .project-card,
.theme-transitioning .album-gallery-card:nth-child(3n) {
    transition-delay: 90ms;
}

@media (max-width: 1181px) {
    #about {
        padding-top: 6.5rem;
    }
}

@media (max-width: 768px) {
    section {
        padding: 6rem 0;
    }

    #about {
        padding-top: 5.75rem;
    }

    #projects {
        border-radius: var(--shape-large);
    }

    #personal-picks {
        border-radius: var(--shape-large);
    }
}

#about {
    min-height: 100vh;
    padding-top: 9rem;
    background: var(--bg-color);
    justify-content: center;
}

#projects {
    background: var(--surface);
    border-radius: var(--shape-extra-large);
}

#personal-picks {
    background: var(--bg-color);
    padding: 3.5rem 0 5rem;
}

.personal-picks-container,
.albums-container {
    max-width: 1240px;
}

.quiet-picks {
    align-items: center;
    border-top: 1px solid var(--outline-variant);
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    padding-top: 2rem;
}

.quiet-picks-copy {
    min-width: 0;
}

.quiet-picks .section-label {
    margin-bottom: 0.55rem;
}

.quiet-picks h2 {
    color: var(--text-color);
    font-family: var(--heading-font);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-variation-settings: 'opsz' 40, 'slnt' -4, 'wdth' 108, 'wght' 760;
    line-height: 1;
    margin: 0;
}

.quiet-picks-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
}

.quiet-picks-links a {
    align-items: center;
    background: transparent;
    border: 1px solid var(--outline-variant);
    border-radius: 999px;
    color: var(--text-color);
    display: inline-flex;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.9rem;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--expressive-ease);
}

.quiet-picks-links a:hover {
    background: var(--surface-high);
    border-color: var(--accent-color);
    color: var(--text-color);
    transform: translateY(-2px);
}

.quiet-picks-links span {
    font-weight: 750;
}

.quiet-picks-links small {
    color: var(--secondary-color);
    font-size: 0.78rem;
}

.personal-card-placeholder {
    align-items: center;
    background: var(--surface-highest);
    color: var(--secondary-color);
    display: flex;
    font-family: var(--code-font);
    justify-content: center;
    min-height: 9rem;
    padding: 1rem;
    text-align: center;
}

.personal-empty {
    color: var(--secondary-color);
    background: color-mix(in srgb, var(--surface-highest) 60%, transparent);
    border: 1px solid var(--outline-variant);
    border-radius: var(--shape-medium);
    padding: 1.5rem;
}

.personal-empty p {
    margin: 0;
}

.albums-page {
    min-height: 100vh;
    padding-top: 7rem;
}

.albums-hero {
    align-items: flex-start;
    padding: 5rem 0 4rem;
}

.albums-intro {
    max-width: 640px;
    margin: 1.75rem 0 0;
    color: var(--secondary-color);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.spotify-profile-link {
    align-items: center;
    border: 1px solid var(--outline-variant);
    border-radius: 999px;
    color: var(--accent-color);
    display: inline-flex;
    font-weight: 750;
    gap: 0.45rem;
    margin-top: 1.25rem;
    padding: 0.65rem 1rem;
    width: fit-content;
}

.spotify-profile-link:hover {
    background: var(--accent-container);
    color: var(--accent-on-container);
}

.albums-section {
    background: var(--surface);
    border-radius: var(--shape-extra-large) var(--shape-extra-large) 0 0;
    padding: 4rem 0 7rem;
}

.album-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(1.25rem, 2.5vw, 2rem);
}

.album-gallery-card {
    background: transparent;
    transition: transform 0.3s var(--expressive-ease);
}

.album-gallery-card:hover {
    transform: translateY(-4px);
}

.album-gallery-card a {
    color: var(--text-color);
    display: grid;
    gap: 0.85rem;
}

.album-gallery-card img,
.album-gallery-card .personal-card-placeholder {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--shape-small);
    display: block;
    object-fit: cover;
    transition: filter 0.25s ease, transform 0.35s var(--expressive-ease);
}

.album-gallery-card:hover img,
.album-gallery-card:focus-within img {
    filter: saturate(1.08);
    transform: translateY(-2px);
}

.album-gallery-card div:last-child {
    min-width: 0;
}

.album-gallery-card h2 {
    font-family: var(--heading-font);
    font-size: 1.05rem;
    font-weight: 740;
    line-height: 1.1;
    margin: 0 0 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-gallery-card p {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.album-gallery-card span {
    color: var(--accent-color);
    display: block;
    font-family: var(--code-font);
    font-size: 0.75rem;
    margin-top: 0.35rem;
}

.albums-empty h2 {
    color: var(--text-color);
    margin: 0 0 0.5rem;
}

/* Animations */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, visibility;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}

.footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent-color);  
    padding: 2rem 0;
    font-family: var(--code-font);
    margin-top: auto;
    width: 100%;
    opacity: 0.5;
}

@media (max-width: 992px) {
    .album-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .albums-hero {
        align-items: center;
        text-align: center;
    }

    .albums-hero .container-header {
        text-align: center;
    }

    .quiet-picks {
        align-items: flex-start;
        flex-direction: column;
    }

    .quiet-picks-links {
        justify-content: flex-start;
        width: 100%;
    }

    .albums-page {
        padding-top: 5rem;
    }

    .albums-hero {
        padding: 3rem 1rem;
    }

    .albums-section {
        border-radius: var(--shape-large) var(--shape-large) 0 0;
        padding: 2.5rem 0 5rem;
    }
}

@media (max-width: 560px) {
    .container {
        --bs-gutter-x: 0;
    }

    .album-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.4rem 0.85rem;
    }

    .album-gallery-card a {
        gap: 0.65rem;
    }

    .album-gallery-card h2 {
        font-size: 0.92rem;
    }

    .album-gallery-card p {
        font-size: 0.78rem;
    }

    .album-gallery-card span {
        font-size: 0.68rem;
        margin-top: 0.25rem;
    }
}
