/* =========================================================================
   Music Page — Listening Room
   ========================================================================= */

/* --- Page Reset & Base --- */
body.page-template-page-music {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: #f2f0ec;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
}

.music-page {
    min-height: 100vh;
    padding-bottom: 120px; /* Space for fixed player */
}

/* --- Navigation --- */
.music-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 3rem;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(242, 240, 236, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.music-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1a1a1a;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
}

.music-nav-logo img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.music-nav-back {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #1a1a1a;
    text-decoration: none;
    padding: 8px 20px;
    border: 2px solid #1a1a1a;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.music-nav-back:hover {
    background: #1a1a1a;
    color: #f2f0ec;
    opacity: 1;
}

/* --- Hero Section --- */
.music-hero {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 4rem 3rem 2rem;
    max-width: 1200px;
}

.music-hero-character {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid #1a1a1a;
    background: #fff;
}

.music-hero-character img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: hero-twitch 5s ease-in-out infinite;
}

@keyframes hero-twitch {
    0%, 90%, 100% { transform: translate(0, 0) rotate(0); }
    93% { transform: translate(2px, -3px) rotate(1deg); }
    96% { transform: translate(-1px, 0) rotate(0); }
}

.music-hero-text {
    flex: 1;
    min-width: 0;
}

.music-hero-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    color: #555;
}

.music-hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 10vw, 8rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
}

.music-hero-sub {
    font-size: 0.95rem;
    line-height: 1.9;
    color: #666;
    max-width: 480px;
}

/* Platform Links (Spotify, YouTube, etc.) */
.music-hero-links {
    display: flex;
    gap: 12px;
    margin-top: 1.5rem;
}

.music-platform-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4A6FA5;
    border-radius: 50%;
    color: #fff;
    transition: all 0.3s ease;
    position: relative;
}

.music-platform-link:hover {
    background: #3A5A8C;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(74, 111, 165, 0.4);
    opacity: 1;
}

.music-platform-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.music-platform-link--coming-soon {
    cursor: not-allowed;
    opacity: 0.5;
}

.music-platform-link--coming-soon:hover {
    background: #4A6FA5;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

/* --- Track Grid --- */
.music-grid-section {
    padding: 2rem 3rem 4rem;
}

.music-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1200px) {
    .music-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 800px) {
    .music-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.music-pagination {
    margin-top: 4rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.music-pagination .page-numbers {
    padding: 0.6rem 1rem;
    border: 2px solid #ccc;
    border-radius: 50px;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    transition: all 0.3s;
}

.music-pagination .page-numbers:hover,
.music-pagination .page-numbers.current {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

/* --- Card --- */
.music-card {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.music-card:hover {
    transform: translateY(-6px);
}

.music-card.is-placeholder {
    opacity: 0.4;
    cursor: default;
}

.music-card.is-placeholder:hover {
    transform: none;
}

.music-card-artwork {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.music-card:hover .music-card-artwork {
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.08);
}

.music-card-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.music-card-placeholder-art {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-card-placeholder-art svg {
    width: 60%;
    height: 60%;
    animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
    to { transform: rotate(360deg); }
}

/* Play overlay on hover */
.music-card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.music-card-play svg {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.music-card:hover .music-card-play {
    opacity: 1;
}

.music-card:hover .music-card-play svg {
    transform: scale(1.1);
}

/* Playing state */
.music-card.is-playing .music-card-artwork {
    box-shadow:
        0 0 0 3px #1a1a1a,
        0 12px 32px rgba(0, 0, 0, 0.2);
}

.music-card.is-playing .music-card-play {
    opacity: 1;
}

/* Card info */
.music-card-info {
    padding: 0.75rem 0.2rem 0;
}

.music-card-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.music-card-artist {
    font-size: 0.8rem;
    color: #888;
}

.music-card-desc {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.25rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Note section --- */
.music-note {
    text-align: center;
    padding: 2rem 3rem 4rem;
    color: #aaa;
    font-size: 0.85rem;
}

/* --- Empty state --- */
.music-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
    font-size: 0.95rem;
    line-height: 2;
}

/* =========================================================================
   Fixed Bottom Player
   ========================================================================= */
.music-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: #1a1a1a;
    color: #fff;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.music-player.is-active {
    transform: translateY(0);
}

.music-player-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Spinning disc */
.music-player-art {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #333;
    position: relative;
}

.music-player-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #555, #222, #555, #111, #555);
    position: relative;
}

.music-player-disc::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #1a1a1a;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #444;
}

.music-player-disc.spinning {
    animation: disc-spin 2s linear infinite;
}

@keyframes disc-spin {
    to { transform: rotate(360deg); }
}

/* Track info */
.music-player-info {
    flex: 0 1 200px;
    min-width: 0;
}

.music-player-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-player-artist {
    font-size: 0.7rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls */
.music-player-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.music-btn-prev,
.music-btn-next,
.music-btn-play {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.music-btn-prev svg,
.music-btn-next svg {
    width: 20px;
    height: 20px;
}

.music-btn-play {
    width: 44px;
    height: 44px;
    background: #fff;
    color: #1a1a1a;
}

.music-btn-play svg {
    width: 20px;
    height: 20px;
}

.music-btn-play:hover {
    transform: scale(1.1);
}

.music-btn-prev:hover,
.music-btn-next:hover {
    color: #ccc;
}

/* Progress */
.music-player-progress {
    flex: 1;
    min-width: 0;
}

.music-progress-bar {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: height 0.2s;
}

.music-progress-bar:hover {
    height: 6px;
}

.music-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0067C0, #6EC6FF);
    border-radius: 2px;
    width: 0;
    transition: width 0.1s linear;
}

.music-player-time {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #666;
    margin-top: 4px;
    font-family: 'Nunito', sans-serif;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 768px) {
    .music-nav {
        padding: 1rem 1.5rem;
    }

    .music-nav-back {
        font-size: 0.75rem;
        padding: 6px 14px;
    }

    .music-hero {
        flex-direction: column;
        padding: 3rem 1.5rem 2rem;
        text-align: center;
    }

    .music-hero-character {
        width: 140px;
        height: 140px;
    }

    .music-hero-sub {
        margin: 0 auto;
    }

    .music-hero-title {
        font-size: clamp(3rem, 15vw, 5rem);
    }

    .music-grid-section {
        padding: 1rem 1.5rem 3rem;
    }

    .music-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .music-card-title {
        font-size: 0.85rem;
    }

    .music-card-artist {
        font-size: 0.7rem;
    }

    /* Player compact on mobile */
    .music-player-inner {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .music-player-info {
        flex: 1;
        min-width: 0;
    }

    .music-player-progress {
        width: 100%;
        order: 10;
    }

    .music-player-time {
        display: none;
    }
}

@media (max-width: 480px) {
    .music-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .music-hero-title {
        font-size: 3rem;
    }

    .music-card-play svg {
        width: 40px;
        height: 40px;
    }
}

/* =========================================================================
   Entry Animation
   ========================================================================= */
.music-card {
    opacity: 0;
    transform: translateY(24px);
    animation: card-appear 0.6s ease forwards;
}

.music-card:nth-child(1) { animation-delay: 0.1s; }
.music-card:nth-child(2) { animation-delay: 0.2s; }
.music-card:nth-child(3) { animation-delay: 0.3s; }
.music-card:nth-child(4) { animation-delay: 0.4s; }
.music-card:nth-child(5) { animation-delay: 0.5s; }
.music-card:nth-child(6) { animation-delay: 0.6s; }
.music-card:nth-child(7) { animation-delay: 0.7s; }
.music-card:nth-child(8) { animation-delay: 0.8s; }

@keyframes card-appear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.music-hero-character,
.music-hero-label,
.music-hero-title,
.music-hero-sub {
    opacity: 0;
    transform: translateY(20px);
    animation: card-appear 0.8s ease forwards;
}

.music-hero-character { animation-delay: 0s; }
.music-hero-label { animation-delay: 0.15s; }
.music-hero-title { animation-delay: 0.3s; }
.music-hero-sub   { animation-delay: 0.45s; }
