/* Skyra Landing Page - Responsive Redesign v2 */

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7c3aed;
    --primary-glow: rgba(124, 58, 237, 0.3);
    --bg-deep: #08080c;
    --bg-card: rgba(255, 255, 255, 0.03);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-head: 'Outfit', sans-serif;
}

html,
body {
    height: 100%;
    background: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* === Main Layout ===
   min-height so the page can grow when needed on desktop with many songs.
   Pagination keeps each page bounded so overflow is not an issue. */
.landing-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        var(--bg-deep);
}

/* === Header Section (Sticky) === */
.skyra-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    /* Subtle backdrop so it stays legible while scrolling */
    background: rgba(8, 8, 12, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);

    padding: clamp(0.75rem, 2.5vh, 1.5rem) clamp(1rem, 5vw, 3rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 1.5vh, 1rem);
    text-align: center;
}

/* Plumnet Logo */
.logo-link {
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.logo-link:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.plumnet-logo {
    height: clamp(28px, 6vw, 44px);
    width: auto;
    object-fit: contain;
}

/* Premium Badge */
.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: clamp(0.688rem, 1.8vw, 0.813rem);
    color: var(--text-muted);
    animation: fadeIn 0.6s ease-out;
}

.premium-badge a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.premium-badge a:hover {
    color: var(--primary);
}

/* Title */
.site-title {
    font-family: var(--font-head);
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.site-subtitle {
    font-size: clamp(0.813rem, 2vw, 0.9375rem);
    color: var(--text-muted);
    max-width: 400px;
}

/* Search Bar */
.search-wrapper {
    width: 100%;
    max-width: min(400px, 90vw);
    position: relative;
}

.search-input {
    width: 100%;
    padding: clamp(0.5rem, 1.5vw, 0.75rem) 1rem;
    padding-left: 2.5rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: clamp(0.813rem, 1.8vw, 0.9375rem);
    font-family: var(--font-body);
    transition: all 0.25s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* Open Button */
.open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.125rem;
    background: var(--text-main);
    color: var(--bg-deep);
    font-weight: 600;
    font-size: clamp(0.75rem, 1.8vw, 0.875rem);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

/* === Gallery Area ===
   flex: 1 fills remaining space; pagination bounds page height naturally. */
.gallery-area {
    flex: 1;
    padding: clamp(1rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Gallery Container (Glass Box) */
.gallery-container {
    width: 100%;
    max-width: 1100px;
    background: rgba(15, 15, 20, 0.5);
    border: 1px solid var(--border);
    border-radius: clamp(12px, 2.5vw, 24px);
    padding: clamp(0.875rem, 2.5vw, 1.75rem);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-height: 200px;
}

/* === Charts Grid ===
   Key fix: use auto-fill with a safe min that never exceeds the available width.
   clamp(200px, 30vw, 320px) ensures cards don't overflow on narrow viewports.
   We also removed justify-items: center so cards always stretch to fill columns. */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(200px, 30vw, 300px), 1fr));
    gap: clamp(0.625rem, 1.5vw, 1.125rem);
}

/* Single Chart Card */
.chart-card {
    width: 100%;
    /* stretch to fill the grid column */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: clamp(0.75rem, 1.8vw, 1.125rem);
    display: flex;
    gap: 0.875rem;
    align-items: center;
    text-decoration: none;
    transition: all 0.25s ease;
    animation: fadeInUp 0.4s ease-out backwards;
    /* Prevent the card itself from overflowing its column */
    min-width: 0;
    overflow: hidden;
}

.chart-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.chart-cover {
    width: clamp(44px, 10vw, 58px);
    height: clamp(44px, 10vw, 58px);
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-color: rgba(124, 58, 237, 0.15);
    /* fallback when no image */
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chart-info {
    flex: 1;
    min-width: 0;
    /* critical: allows text-overflow ellipsis inside flex child */
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.chart-title {
    font-family: var(--font-head);
    font-size: clamp(0.875rem, 2.2vw, 1rem);
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-artist {
    font-size: clamp(0.688rem, 1.8vw, 0.8125rem);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-level {
    display: inline-block;
    font-size: clamp(0.594rem, 1.4vw, 0.6875rem);
    font-weight: 500;
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
    padding: 0.175rem 0.45rem;
    border-radius: 6px;
    margin-top: 0.2rem;
    width: fit-content;
    white-space: nowrap;
}

/* Pagination Bar */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: clamp(0.875rem, 2.5vw, 1.25rem) auto 0;
}

.page-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.2);
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.page-indicator {
    font-size: clamp(0.813rem, 1.8vw, 0.9rem);
    color: var(--text-muted);
    font-weight: 500;
    min-width: 3.5rem;
    text-align: center;
}

/* Footer — Pushed to bottom of flex column via margin-top:auto */
.site-footer {
    margin-top: auto;
    padding: 1.5rem 1rem 1rem;
    text-align: center;
    font-size: clamp(0.625rem, 1.4vw, 0.75rem);
    color: var(--text-muted);
    opacity: 0.6;
    pointer-events: none;
    user-select: none;
}

/* === Animations === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Responsive Breakpoints === */

/* Medium screens: 2 columns */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 44vw, 320px), 1fr));
    }
}

/* Small phones: force single column */
@media (max-width: 480px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .gallery-area {
        padding: 0.75rem;
    }

    .gallery-container {
        padding: 0.75rem;
        border-radius: 12px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .skyra-header {
        padding: 0.625rem 0.75rem;
        gap: 0.375rem;
    }

    .chart-card {
        padding: 0.625rem;
        gap: 0.625rem;
    }
}

/* Landscape phones (short viewport) */
@media (max-height: 500px) and (orientation: landscape) {
    .skyra-header {
        padding: 0.5rem 1rem;
        gap: 0.375rem;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .site-title {
        font-size: 1.375rem;
    }

    .site-subtitle {
        display: none;
    }

    .premium-badge {
        display: none;
    }
}

/* Large Screens: 3 fixed columns */
@media (min-width: 900px) {
    .charts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Very large screens: can fit 4 columns */
@media (min-width: 1200px) {
    .charts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Empty/Loading States */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p {
    font-size: clamp(0.875rem, 2vw, 1rem);
}