/**
 * Track Card V4 CSS - Extracted from test_track_card_design_v4.html
 * Modern responsive track card design with container queries
 */

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

.track-card {
    width: min(100vw - 40px, 1200px);
    min-width: 380px;
    margin: 0 auto;
    padding: 0; /* Override any padding from other CSS files */
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    container-type: inline-size;
    border-width: 2px 1px 3px 1px; /* Thicker but no left border for accent */
    border-style: solid;
    border-color: #e0e7ff #e0e7ff #c2c2c2 #6366f1; /* Light border to define edges on white background */

    box-shadow:
      -6px 0 0 var(--artist-color, #6366f1),  /* Left accent border using artist color */
      0 8px 32px rgba(0, 0, 0, 0.1); /* Keep existing shadow */

    /* Override publisher's Inter font with v4's system font stack */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Subtle texture overlay for content section only */
.track-content::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/static/images/freepik__upload__15004.png');
    background-size: cover; /* Cover the content area without repeating */
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.03; /* Very subtle texture */
    pointer-events: none; /* Don't interfere with interactions */
    z-index: 1;
    background-color: #fff !important;
}

/* Main layout - stacked vertically like mockup */
.card-layout {
    display: grid;
    grid-template-rows: minmax(240px, 40cqi) 1fr;
}

/* Top - artwork section */
.artwork-section {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center 20%; /* Focal point control that actually works! */
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 16px 16px 0 0; /* Mobile: top corners rounded */
    box-shadow:
      inset 30px 0 30px -20px rgba(0, 0, 0, 0.4),   /* Darker left edge */
      inset -30px 0 30px -20px rgba(0, 0, 0, 0.671),  /* Darker right edge */
      inset 10px 0 110px -5px rgba(0, 0, 0, 0.2),     /* Subtle left fade */
      inset -10px 0 70px -5px rgba(0, 0, 0, 0.4);    /* Subtle right fade */
}

/* Track ranking number - tucked into corner with selective rounding */
.track-ranking {
    position: absolute;
    top: 0;
    right: 0;
    background: #b42693;
    color: white;
    width: min(22cqi, 76px);
    height: min(20cqi, 72px);
    border-radius: 0 16px 0 0; /* Only top-right corner rounded */
    display: grid;
    place-items: center;
    font-weight: bold;
    font-size: min(11cqi, 48px);
    z-index: 10;
    box-shadow: -3px 10px 28px rgba(0, 0, 0, 0.604);
}

/* Bottom - content section matching mockup exactly */
.track-content {
    background: var(--track-background-color, #0e141d);
    color: white;
    padding: min(5cqi, 24px);
    display: grid;
    grid-template-columns: 170px 1fr;
    grid-template-rows: auto auto auto 1fr auto;
    grid-template-areas:
        "title title"
        "artist artist"
        "play-section bio"
        "play-section facts"
        "release facts"
        "full-track full-track"
        "meta meta";
    gap: min(3cqi, 16px);
    position: relative; /* For texture overlay positioning */
}

/* Track title */
.track-title {
    grid-area: title;
    font-size: min(7cqi, 28px);
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 15px;
}

/* Artist section - positioned 15px below title */
.artist-section {
    grid-area: artist;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    margin-top: -25px;
    margin-bottom: 8px;
}

/* Play section - left column, minimal width */
.play-section-wrapper {
    grid-area: play-section;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min-content; /* Take minimal width needed */
    justify-self: start;
}

.artist-by {
    color: #ffffff;
    font-size: min(4cqi, 18px);
}

.artist-name {
    font-size: min(10cqi, 24px);
    color: #d946ef;
    font-weight: bold;
    margin-bottom: 0px;
}

/* Play button - positioned LEFT like mockup */
.play-section {
    display: flex;
    align-items: top;
    gap: 2px;
}

.play-button {
    width: min(20cqi, 100px);
    height: min(20cqi, 100px);
    background: #d946ef;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(217, 70, 239, 0.3);
    flex-shrink: 0;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(217, 70, 239, 0.4);
}

.play-button svg {
    width: min(20cqi, 72px);
    height: min(20cqi, 72px);
    fill: white;
    margin-left: 4px;
}

.preview-duration {
    color: #94a3b8;
    font-size: min(2.5cqi, 14px);
}

/* Release info - 3-line stack with label */
.release-section {
    grid-area: release;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.release-label {
    color: #ffffff;
    font-size: min(3cqi, 17px);
    letter-spacing: 0.5px;
}

.release-info {
    color: #ffffff;
    font-size: min(2.8cqi, 14px);
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.release-name {
    color: white;
    font-weight: bold;
}

/* Bio section - hidden on mobile, visible on larger screens */
.bio-section {
    grid-area: bio;
    display: none;
}

/* Facts section - right side spanning two rows, expands horizontally */
.facts-section {
    grid-area: facts;
    background: #2c3c57;
    border-radius: 12px;
    padding:
        min(.5cqi, 4px)     /* top */
        min(2cqi, 10px)    /* right */
        min(2cqi, 10px)    /* bottom */
        min(3cqi, 10px);   /* left */
    border-left: 4px solid #d946ef;
    border-top: 1px solid #c77cd3;
    border-bottom: 1px solid #ac52b9;
    border-right: 1px solid #af2dc4;
    display: flex;
    flex-direction: column;
    align-self: start;
    justify-self: end;
    width: 100%;
    max-width: min(60cqi, 550px);
    margin-top: -20px;
    margin-bottom: 15px;
    box-shadow: inset 6px 6px 12px rgba(0, 0, 0, 0.3),
                inset -8px -8px 12px rgba(0,0,0, 0.3);
    position: relative; /* For z-index stacking */
    z-index: 2; /* Above the texture overlay */
}

.facts-header {
    color: #d8a3c7;
    font-weight: bold;
    font-size: min(3.5cqi, 19px);
    margin-bottom: 7px;
    margin-right: 4px;
    text-align: right;
}

.facts-content {
    color: #e2e8f0;
    font-size: min(2.9cqi, 14px);
    line-height: 1.1;
    text-align: right;
}

.facts-content p {
    margin: 0 4px 8px 0; /* Small gap between bullet points */
}

.facts-content p:last-child {
    margin-bottom: 0; /* Remove margin from last paragraph */
    padding-bottom: 4px; /* Small padding under last bullet */
}

/* Full track section - right justified and bottom aligned */
.full-track-section {
    grid-area: full-track;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: start;
    justify-self: end;
    align-self: end;
    width: 100%;
    max-width: min(72cqi, 390px);
}

.full-track-text {
    color: #b4b0b0;
    font-size: min(2.9cqi, 16px);
    text-align: left;
    letter-spacing: 0.075em;
}

/* Platform buttons - fixed grid, right justified */
.platform-links {
    display: grid;
    grid-template-columns: 120px repeat(2, minmax(70px, 1fr));
    gap: min(1.5cqi, 5px);
    width: 100%;
}

.platform-btn {
    padding: min(2.1cqi, 9px) min(2cqi, 13px);
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    font-size: min(2.6cqi, 14px);
    display: grid;
    place-items: center;
}

.platform-btn.apple {
    background: #000;
    color: white;
    background-image: url("../images/US-UK_Apple_Music_Listen_on_Lockup_RGB_wht_072720.svg");
    background-size: 90% auto;
    background-repeat: no-repeat;
    background-position: center;
    padding-left: 10px;
    padding-right: 10px;
}

.platform-btn.youtube {
    background: #ffffff;
    color: white;
    background-image: url("../images/YouTube_Logo_2017.svg");
    background-size: 70% auto;
    background-repeat: no-repeat;
    background-position: center;
    padding: 15px;
}

.platform-btn.spotify {
    background: #1db954;
    color: white;
    background-image: url("../images/Full_Logo_Green_RGB.svg");
    background-size: 70% auto;
    background-repeat: no-repeat;
    background-position: center;
    padding: 20px 10px 20px 10px;
}

.platform-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Bottom row - links and meta */
.links-section {
    grid-area: links;
}

.meta-section {
    grid-area: meta;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    font-size: min(2.2cqi, 12px);
    color: #94a3b8;
}

.station-info {
    display: grid;
    grid-template-rows: auto auto;
    color: white;
    font-size: min(2.8cqi, 16px);
    justify-self: start;
    align-self: end;
    gap: 2px;
}

.station-info strong {
    font-weight: bold;
}

.intensity-section {
    display: grid;
    grid-template-rows: auto auto;
    justify-self: end;
    align-self: end;
    justify-items: end;
    gap: 4px;
}

.intensity-label {
    color: white;
    font-size: min(2.8cqi, 16px);
}

.intensity-badge {
    background: #374151;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
    font-size: min(2.5cqi, 15px);
    color: white;
}

/* Container query to show bio on tablet+ screens */
@container (min-width: 490px) {
    .track-content {
        grid-template-columns: min-content 1fr;
    }

    .release-section {
        max-width: 150px;
        word-wrap: break-word;
    }

    .bio-section {
        display: block;
        color: white;
        font-size: min(2.4cqi, 14px);
        line-height: 1.6;
        letter-spacing: 0.025em;
        padding: min(3cqi, 2px);
        text-align: right;
        margin-bottom: 2px;
        max-height: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: -12px;
        margin-bottom: 15px;
    }

    .facts-section {
        grid-area: facts;
        background: #2c3c57;
        border-radius: 12px;
        padding:
            min(.5cqi, 4px)     /* top */
            min(2cqi, 10px)    /* right */
            min(2cqi, 10px)    /* bottom */
            min(3cqi, 10px);   /* left */
        border-left: 4px solid #d946ef;
        border-top: 1px solid #c77cd3;
        border-bottom: 1px solid #ac52b9;
        border-right: 1px solid #af2dc4;
        display: flex;
        flex-direction: column;
        align-self: start;
        justify-self: end;
        width: 100%;
        max-width: min(60cqi, 550px);
    }

    .release-section {
        max-width: 300px;
    }
}

/* Container query for very wide screens */
@container (min-width: 800px) {
    .bio-section {
        display: block;
        color: white;
        font-size: min(2.4cqi, 14px);
        line-height: 1.6;
        letter-spacing: 0.025em;
        padding: min(3cqi, 2px);
        text-align: right;
        margin-bottom: 2px;
        max-height: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: -12px;
        margin-bottom: 15px;
        padding-left: 10px;
    }

    .facts-section {
        grid-area: facts;
        background: #2c3c57;
        border-radius: 12px;
        padding: min(.35qi, 5px);
        border-left: 4px solid #d946ef;
        border-top: 1px solid #c77cd3;
        border-bottom: 1px solid #ac52b9;
        border-right: 1px solid #af2dc4;
        display: flex;
        flex-direction: column;
        align-self: start;
        justify-self: end;
        width: 100%;
        max-width: min(60cqi, 550px);
        margin-top: 0px; /* Push facts section down from bio at wide screens */
    }

    .card-layout {
        grid-template-columns: minmax(320px, 40%) 1fr;
        grid-template-rows: 1fr;
        height: 640px;
    }

    .facts-content {
        font-size: min(2.2cqi, 12px); /* Starts smaller on side-by-side, grows with container */
    }

    .track-content {
        grid-template-columns: min-content max-content 30px 1fr;
        grid-template-rows: auto auto auto auto 1fr auto;
        grid-template-areas:
            "title title title title"
            "artist artist artist artist"
            "play-section bio bio bio"
            "release release gap facts"
            "full-track full-track full-track full-track"
            "meta meta meta meta";
        gap: min(2cqi, 10px); /* Reduced gap at wider screens */
    }

    /* Keep play section minimal width on desktop too */
    .play-section-wrapper {
        width: min-content;
        justify-self: start;
    }

    /* Fix artwork section border radius for side-by-side layout */
    .artwork-section {
        border-radius: 16px 0 0 16px; /* Desktop: left corners rounded */
    }

    /* Remove corner rounding on expanded horizontal layout */
    .track-ranking {
        border-radius: 0;
    }
}