/* CSS Variables for easy customization and Dark Mode support */
:root {
    --bg-color: #ffffff;
    --text-main: #1d1d1f;
    --text-secondary: #86868b;
    --accent: #fa243c;
    /* Apple Music Red */
    --border-color: #f2f2f2;
    --card-bg: #f5f5f7;
    --system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --text-main: #f5f5f7;
        --text-secondary: #a1a1a6;
        --border-color: #1d1d1f;
        --card-bg: #1c1c1e;
    }
}

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

body {
    font-family: var(--system-font);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Navigation */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: saturate(180%) blur(20px);
    background: rgba(var(--bg-color), 0.8);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.logo svg {
    fill: var(--accent);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.nav-link:hover {
    color: var(--accent);
}

/* Views management */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Hero Section */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

/* Chart Section */
.charts-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Chart Grid/List */
.chart-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.song-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 12px;
    transition: background 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.song-item:hover {
    background-color: var(--card-bg);
}

.rank {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    width: 30px;
    margin-right: 1rem;
    text-align: center;
}

.artwork {
    width: 56px;
    height: 56px;
    background: #eee;
    border-radius: 6px;
    margin-right: 1rem;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.song-info {
    flex: 1;
    overflow: hidden;
}

.song-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.artist-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Blog/Preview Page Styles */
.preview-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 2rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    gap: 5px;
}

.blog-header {
    margin-bottom: 3rem;
}

.preview-artwork {
    width: 100%;
    aspect-ratio: 1/1;
    max-width: 400px;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: block;
}

.blog-header h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.blog-header .artist {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.action-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(250, 36, 60, 0.2);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.blog-body {
    font-size: 1.15rem;
    color: var(--text-main);
}

.blog-body h3 {
    margin: 2.5rem 0 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.lyrics-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    white-space: pre-line;
    font-style: italic;
    color: var(--text-main);
    border-left: 4px solid var(--accent);
    margin: 2rem 0;
}

.track-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Related Music Section */
.related-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.related-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.related-card {
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    width: 100%;
    padding: 0;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

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

.related-card img {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    object-fit: cover;
    background: #eee;
}

.related-card .title {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-card .artist {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive Mobile Tweak */
@media (max-width: 640px) {
    .chart-list {
        grid-template-columns: 1fr;
    }

    .preview-artwork {
        max-width: 100%;
    }

    .track-meta {
        grid-template-columns: 1fr;
    }

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

    .nav-links {
        display: none;
        /* Simple mobile strategy: hide extra links */
    }
}