/* Hero Section */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 120px 24px 60px;
    position: relative;
}

.hero__inner {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(48px, 9vw, 110px);
    letter-spacing: -0.03em;
    font-weight: 900;
    line-height: 0.95;
    margin-bottom: 0.2em;
    color: var(--fg);
    padding-right: 0.1em;
}

.subtitle {
    margin-top: 16px;
    color: var(--muted);
    font-size: clamp(16px, 2.5vw, 22px);
    font-weight: 500;
    letter-spacing: -0.01em;
    max-width: 600px;
}

.hero__links {
    margin-top: 80px;
}

.links-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    width: 100%;
}

/* Projects Section */
.projects {
    margin-top: 120px;
}

.projects-row {
    list-style: none;
    position: relative;
    margin-top: 0;
}

.projects-row>li {
    position: absolute;
    width: 100%;
}

/* Playlists Section */
.playlists-section {
    margin-top: 120px;
}

.playlists-row {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px;
    margin-top: 0;
}

.playlist-card {
    display: block;
    text-decoration: none;
    color: var(--fg);
    perspective: 1000px;
    position: relative;
    transition: z-index 0s step-start 0s;
    z-index: 1;
}

.playlist-card:hover,
.playlist-card.is-active {
    z-index: 50;
}

.vinyl-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    margin-bottom: 24px;
    z-index: 1;
}

/* The Vinyl Record */
.vinyl-record {
    position: absolute;
    top: 2%;
    bottom: 2%;
    left: 2%;
    right: 2%;
    border-radius: 50%;
    background: #101010;
    background-image:
        radial-gradient(circle at center, #1a1a1a 25%, transparent 25.5%),
        repeating-radial-gradient(#101010 0, #101010 2px, #222 3px, #101010 4px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 0;
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vinyl-record::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    background: #000;
    border-radius: 50%;
    z-index: 2;
}

/* Vinyl Rotator - for continuous spinning */
.vinyl-rotator {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spin-continuous 4s linear infinite;
    animation-play-state: paused;
}

/* The Center Label of the Record */
.vinyl-label {
    width: 35%;
    height: 35%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255,255,255,0.1);
}

/* The Album Cover */
.playlist-cover-art {
    position: absolute;
    inset: 0;
    background: var(--card);
    border-radius: 8px;
    overflow: hidden;
    z-index: 10;
    box-shadow:
        0 10px 20px -5px rgba(0,0,0,0.3),
        inset 0 0 0 1px rgba(255,255,255,0.1);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center bottom;
}

.playlist-cover-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* Glass/Gloss effect on cover */
.playlist-cover-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, rgba(255,255,255,0) 35%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 65%);
    background-size: 200% 100%;
    background-position: 100% 0;
    background-repeat: no-repeat;
    z-index: 20;
    pointer-events: none;
    transition: background-position 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.playlist-card:hover .playlist-cover-art::after,
.playlist-card.is-active .playlist-cover-art::after {
    background-position: 0% 0;
}

/* Hover Interactions */
.playlist-card:hover .vinyl-record,
.playlist-card.is-active .vinyl-record {
    transform: translateY(-55%);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.playlist-card:hover .vinyl-rotator,
.playlist-card.is-active .vinyl-rotator {
    animation-play-state: running;
}

.playlist-card:hover .playlist-cover-art,
.playlist-card.is-active .playlist-cover-art {
    transform: translateY(5px) rotateX(15deg);
    box-shadow:
        0 25px 30px -10px rgba(0,0,0,0.6),
        inset 0 0 0 1px var(--border-hover);
}

.playlist-card:hover .playlist-cover-art img,
.playlist-card.is-active .playlist-cover-art img {
    transform: rotateX(-5deg);
}

/* Rotating animation for the vinyl when hovering */
@keyframes spin-continuous {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Typography & Details */
.playlist-content {
    position: relative;
    z-index: 20;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.playlist-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--fg);
    transition: color 0.3s ease;
}

.playlist-card:hover .playlist-header h3,
.playlist-card.is-active .playlist-header h3 {
    color: var(--accent-ink);
}

.playlist-meta {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-ink);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
    opacity: 0.8;
}

.playlist-description {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (hover: none) {
    .playlists-row {
        gap: 20px;
    }
}

/* Github Stats */
.github-stats {
    margin-top: 100px;
    margin-bottom: 120px;
}

.section-header-wrapper {
    margin-bottom: 40px;
    animation: fade-in-up 0.8s var(--transition-smooth) forwards;
}

.section-subtitle {
    font-size: 16px;
    color: var(--muted);
    margin-top: 8px;
    font-weight: 400;
    max-width: 600px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: 1.5fr 2fr;
        align-items: start;
    }
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    transition: transform 0.4s var(--transition-smooth), border-color 0.4s ease, box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--accent-glow), transparent 50%);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
    z-index: 0;
    transform: scale(0.8);
}

.stat-card:hover .card-glow {
    opacity: 0.15;
    transform: scale(1);
}

.card-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    z-index: 1;
}

.card-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg);
    opacity: 0.9;
}

.card-icon {
    color: var(--muted);
    font-size: 18px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.stat-card:hover .card-icon {
    color: var(--accent);
    transform: rotate(15deg);
}

.card-content {
    padding: 24px;
    position: relative;
    z-index: 1;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Images */
.stats-image-wrapper,
.graph-wrapper {
    width: 100%;
    position: relative;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
}

.stats-error {
    padding: 28px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.stats-img,
.graph-img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.4s ease, filter 0.4s ease;
}

/* Theme Switching for Images */
.stats-img--dark, .graph-img--dark {
    position: relative;
    opacity: 1;
    z-index: 2;
}

.stats-img--light, .graph-img--light {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: 1;
}

:root[data-theme="light"] .stats-img--dark,
:root[data-theme="light"] .graph-img--dark {
    opacity: 0;
    z-index: 1;
}

:root[data-theme="light"] .stats-img--light,
:root[data-theme="light"] .graph-img--light {
    opacity: 1;
    z-index: 2;
}

/* Graph Specifics */
.graph-card .card-content {
    overflow-x: hidden;
    justify-content: center;
    padding: 24px;
    display: flex;
    align-items: center;
}

.graph-wrapper {
    width: 100%;
    position: relative;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden; 
}

.graph-img--dark {
    filter: invert(1) brightness(2.1);
    opacity: 0.9;
}

.graph-img--light {
    filter: saturate(2) brightness(0.9);
    mix-blend-mode: multiply;
}

.graph-card .card-content::-webkit-scrollbar {
    display: none;
}

.split-char {
    display: inline-block;
    background-image: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
}

/* Projects Show More */
.projects-show-more {
    display: none;
}

/* Playlist Stack Dots (mobile only) */
.stack-dots {
    display: none;
}

/* Media Queries */
@media (max-width: 768px) {
    .hero {
        padding: 80px 20px 32px;
        display: block;
        min-height: auto;
    }

    .hero h1 {
        font-size: clamp(36px, 10vw, 48px);
    }

    .subtitle {
        font-size: 15px;
        margin-top: 12px;
    }

    .hero__links {
        margin-top: 48px;
    }

    .links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .link-card {
        padding: 18px;
        gap: 12px;
    }

    .projects {
        margin-top: 64px;
    }

    .projects-row>li {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        margin-bottom: 12px;
    }

    .projects-row {
        display: flex;
        flex-direction: column;
    }

    .project-card {
        padding: 20px;
        min-height: auto;
    }

    .project-card h3 {
        font-size: 17px;
    }

    .project-card p {
        font-size: 13px;
    }

    .project-tags {
        margin-top: 12px;
    }

    .projects-row:not(.is-expanded) > li:nth-child(n+6) {
        display: none;
    }

    .projects-show-more {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        margin-top: 16px;
        padding: 14px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        color: var(--muted);
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.02em;
        cursor: pointer;
        transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    }

    .projects-show-more:hover {
        color: var(--fg);
        border-color: var(--border-hover);
    }

    .projects-show-more svg {
        transition: transform 0.3s var(--transition-smooth);
    }

    .projects-show-more[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .playlists-section {
        margin-top: 64px;
    }

    .playlists-row {
        display: block;
        position: relative;
        height: auto;
        touch-action: pan-y;
    }

    .playlists-row > li {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
        transition: transform 0.5s var(--transition-smooth), opacity 0.5s ease;
        transform-origin: center bottom;
    }

    /* First card (active) */
    .playlists-row > li.stack-active {
        position: relative;
        z-index: 3;
        transform: none;
        opacity: 1;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    /* Second card (peek) — offset right + slight tilt */
    .playlists-row > li.stack-next {
        z-index: 2;
        transform: translateY(10px) translateX(6px) scale(0.96) rotate(1.5deg);
        opacity: 0.7;
        pointer-events: none;
    }

    /* Third card (deep peek) — offset left + opposite tilt */
    .playlists-row > li.stack-after {
        z-index: 1;
        transform: translateY(20px) translateX(-6px) scale(0.92) rotate(-1.5deg);
        opacity: 0.4;
        pointer-events: none;
    }

    /* Hidden cards */
    .playlists-row > li.stack-hidden {
        z-index: 0;
        transform: translateY(24px) scale(0.88);
        opacity: 0;
        pointer-events: none;
    }

    /* Swipe exit animation */
    .playlists-row > li.stack-exit-left {
        z-index: 4;
        transform: translateX(-110%) rotate(-8deg);
        opacity: 0;
        transition: transform 0.4s var(--transition-smooth), opacity 0.35s ease;
        pointer-events: none;
    }

    .playlists-row > li.stack-exit-right {
        z-index: 4;
        transform: translateX(110%) rotate(8deg);
        opacity: 0;
        transition: transform 0.4s var(--transition-smooth), opacity 0.35s ease;
        pointer-events: none;
    }


    /* Stack dots indicator */
    .stack-dots {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: 20px;
        position: relative;
        z-index: 10;
    }

    .stack-dot {
        position: relative;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--muted);
        opacity: 0.3;
        transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
        cursor: pointer;
        border: none;
        padding: 0;
    }

    /* Tall tap target (44px) without overlapping neighbours: the dots sit
       8px apart, so widen only into the gap, not a full 44px square */
    .stack-dot::before {
        content: '';
        position: absolute;
        inset: -19px -4px;
    }

    .stack-dot.is-active {
        opacity: 1;
        background: var(--accent);
        transform: scale(1.3);
    }

    .vinyl-wrapper {
        margin-bottom: 16px;
    }

    /* Disable vinyl hover/active effects on mobile */
    .playlist-card:hover .vinyl-record,
    .playlist-card.is-active .vinyl-record {
        transform: none;
    }

    .playlist-card:hover .vinyl-rotator,
    .playlist-card.is-active .vinyl-rotator {
        animation-play-state: paused;
    }

    .playlist-card:hover .playlist-cover-art,
    .playlist-card.is-active .playlist-cover-art {
        transform: none;
        box-shadow: 0 10px 20px -5px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.1);
    }

    .playlist-card:hover .playlist-cover-art img,
    .playlist-card.is-active .playlist-cover-art img {
        transform: none;
    }

    .playlist-card:hover .playlist-cover-art::after,
    .playlist-card.is-active .playlist-cover-art::after {
        background-position: 100% 0;
    }

    .playlist-card:hover .playlist-header h3,
    .playlist-card.is-active .playlist-header h3 {
        color: var(--fg);
    }

    .github-stats {
        margin-top: 64px;
        margin-bottom: 64px;
    }

    .section-header-wrapper {
        margin-bottom: 24px;
    }

    .section-subtitle {
        font-size: 14px;
    }

    .stats-grid {
        gap: 16px;
    }

    .stat-card {
        border-radius: 16px;
    }

    .stat-card:hover {
        transform: none;
    }

    .card-header {
        padding: 14px 16px;
    }

    .card-label {
        font-size: 11px;
    }

    .card-icon {
        font-size: 15px;
    }

    .card-content {
        padding: 12px;
        min-height: auto;
    }

    /* Make contribution graph scrollable on mobile */
    .graph-card .card-content {
        padding: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .graph-card .card-content::-webkit-scrollbar {
        display: none;
    }

    .graph-card .graph-wrapper {
        min-width: 640px;
    }

    .graph-card .card-content.fade-left {
        -webkit-mask-image: linear-gradient(to left, black 80%, transparent 100%);
        mask-image: linear-gradient(to left, black 80%, transparent 100%);
    }

    .graph-card .card-content.fade-right {
        -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
        mask-image: linear-gradient(to right, black 80%, transparent 100%);
    }

    .graph-card .card-content.fade-both {
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
    }


    .spotify-widget-container {
        margin-top: 48px;
        margin-bottom: 24px;
    }

    .site-footer {
        margin-top: 48px;
        padding: 28px 0;
    }

    .site-footer__inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .theme-toggle {
        top: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 72px 16px 24px;
    }

    .links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .link-card {
        padding: 16px;
        gap: 10px;
    }

    .link-card i {
        font-size: 20px;
    }

    .link-card span {
        font-size: 13px;
    }

    .project-card {
        padding: 16px;
    }

    .section-title {
        font-size: 11px;
        margin-bottom: 16px;
    }
}