/* rankings.css — scoped styles for the charts index and chart view pages.
   All rules are under .rnk2 root so the legacy .ranking-box styles in
   main.css are untouched (still used by the home panel). */

.rnk2 {
    color: #1D1929;
    font-family: "Lato", "Inter", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Section heading (index page) ---------- */

.rnk2-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.rnk2-head h3 {
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0;
    padding-left: 52px;
    position: relative;
}
.rnk2-head h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: url("../img/smile title.svg") no-repeat center;
    background-size: contain;
}

/* ---------- Chart card (index) ---------- */

.rnk2-chart {
    background: #fff;
    border: 1px solid #ececf2;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(10, 8, 20, 0.06);
    overflow: hidden;
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
}
/* No admin image → collapse to a single full-width body (no fallback image). */
.rnk2-chart.rnk2-chart--no-hero { grid-template-columns: 1fr; }
.rnk2-chart:last-child { margin-bottom: 0; }

.rnk2-chart-hero {
    position: relative;
    display: block;
    overflow: hidden;
    background: linear-gradient(135deg, #F57D14 0%, #E31E24 100%);
    aspect-ratio: 4 / 5;
    width: 100%;
}
.rnk2-chart-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s cubic-bezier(.22,1,.36,1);
}
.rnk2-chart-hero:hover img { transform: scale(1.04); }
.rnk2-chart-hero-cta {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(29, 25, 41, 0.72);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .22s ease, transform .22s ease;
    pointer-events: none;
}
.rnk2-chart-hero:hover .rnk2-chart-hero-cta { opacity: 1; transform: translateY(0); }
.rnk2-chart-hero-cta svg { width: 16px; height: 16px; flex: 0 0 auto; }

.rnk2-chart-body {
    display: flex;
    flex-direction: column;
    padding: 18px 22px 18px;
    min-height: 0;
}
.rnk2-chart-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: min-content;
    align-content: start;
    column-gap: 18px;
    row-gap: 4px;
}
.rnk2-chart-foot {
    display: flex;
    justify-content: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f3;
}
.rnk2-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 22px;
    border-radius: 999px;
    background: #EF7D00;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background .18s ease, transform .18s ease;
}
.rnk2-btn:hover  { background: #d86f00; transform: translateY(-1px); }
.rnk2-btn svg    { width: 16px; height: 16px; }

/* ---------- Song row (shared between index cards and view page) ---------- */

.rnk2-row {
    display: grid;
    grid-template-columns: 36px 56px minmax(0, 1fr) auto;
    min-width: 0;
    column-gap: 12px;
    align-items: center;
    padding: 8px 6px;
    border-radius: 10px;
    transition: background .16s ease;
}
.rnk2-row + .rnk2-row { border-top: 1px solid #f5f5f8; }
.rnk2-row:hover { background: #fafafd; }

.rnk2-pos {
    font-size: 22px;
    font-weight: 800;
    color: #d4d4dc;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.rnk2-cover {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: #f2f2f5;
    flex: 0 0 auto;
}
.rnk2-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.rnk2-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rnk2-song {
    font-size: 14px;
    font-weight: 700;
    color: #1D1929;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rnk2-artist {
    font-size: 13px;
    font-weight: 500;
    color: #7a7888;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rnk2-ext {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f3f6;
    transition: background .16s ease, transform .16s ease;
}
.rnk2-ext img { width: 16px; height: 16px; display: block; }
.rnk2-ext:hover { background: #ffe2cc; transform: scale(1.06); }

/* Top-3 highlight on the view page */
.rnk2-row.is-top .rnk2-pos { color: #EF7D00; }
.rnk2-row.is-top-1 .rnk2-pos { font-size: 26px; }

/* ---------- View page (full chart listing) ---------- */

.rnk2-view-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}
.rnk2-view-head .rnk2-date {
    font-size: 13px;
    color: #7a7888;
    font-weight: 500;
}

.rnk2-archive {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b6777;
}
.rnk2-archive label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rnk2-archive label::before {
    content: "";
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23E9540E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='3'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>") no-repeat center;
    background-size: contain;
}
.rnk2-archive .rnk2-archive-wrap {
    position: relative;
    display: inline-flex;
}
.rnk2-archive select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    padding: 10px 40px 10px 16px;
    border: 1px solid #ececf0;
    border-radius: 12px;
    font: 600 13px/1.2 "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    letter-spacing: 0;
    text-transform: none;
    color: #1D1929;
    cursor: pointer;
    min-width: 240px;
    box-shadow: 0 1px 2px rgba(18, 14, 30, 0.04);
    transition: border-color .18s ease, box-shadow .22s ease;
}
.rnk2-archive select:hover { border-color: #fbd9c3; box-shadow: 0 4px 12px rgba(232, 78, 15, 0.12); }
.rnk2-archive select:focus-visible {
    outline: 0;
    border-color: #E9540E;
    box-shadow: 0 0 0 3px rgba(232, 78, 15, 0.14);
}
.rnk2-archive .rnk2-archive-wrap::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23E9540E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center;
    background-size: contain;
    pointer-events: none;
    transition: transform .2s ease;
}
.rnk2-archive .rnk2-archive-wrap:hover::after { transform: translateY(1px); }

.rnk2-list {
    background: #fff;
    border: 1px solid #ececf2;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(10, 8, 20, 0.05);
    padding: 8px 14px;
    margin-bottom: 28px;
}
.rnk2-list .rnk2-row { padding: 12px 8px; }
.rnk2-list .rnk2-cover { width: 64px; height: 64px; }
.rnk2-list .rnk2-row { grid-template-columns: 48px 64px minmax(0, 1fr) auto; }
.rnk2-list .rnk2-pos { font-size: 26px; }
.rnk2-list .rnk2-song { font-size: 15px; white-space: normal; }
.rnk2-list .rnk2-artist { font-size: 13.5px; white-space: normal; }

/* ---------- Related charts ---------- */

.rnk2-related {
    margin-top: 8px;
}
.rnk2-related-title {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0 0 12px;
}
.rnk2-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.rnk2-related-card {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #ececf2;
    text-decoration: none;
    color: #1D1929;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.rnk2-related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(10, 8, 20, 0.08);
    border-color: #EF7D00;
}
.rnk2-related-card img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}
.rnk2-related-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rnk2-related-card-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
            line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rnk2-related-card-date {
    font-size: 12px;
    color: #8a8898;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .rnk2-chart { grid-template-columns: 1fr; }
    .rnk2-chart-hero { min-height: 220px; aspect-ratio: 16 / 9; }
    .rnk2-chart-list { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .rnk2-chart-body { padding: 14px 14px 14px; }
    .rnk2-row { grid-template-columns: 30px 48px 1fr auto; column-gap: 10px; }
    .rnk2-pos { font-size: 18px; }
    .rnk2-cover { width: 48px; height: 48px; }
    .rnk2-song { font-size: 13px; }
    .rnk2-artist { font-size: 12.5px; }
    .rnk2-list .rnk2-row { grid-template-columns: 40px 56px 1fr auto; }
    .rnk2-list .rnk2-cover { width: 56px; height: 56px; }
    .rnk2-list .rnk2-pos { font-size: 22px; }
    .rnk2-list .rnk2-song { font-size: 14px; }
    .rnk2-view-head { flex-direction: column; align-items: flex-start; gap: 10px; }
    .rnk2-archive { width: 100%; align-items: stretch; flex-wrap: wrap; }
    .rnk2-archive .rnk2-archive-wrap { flex: 1 1 auto; display: flex; }
    .rnk2-archive select { min-width: 0; width: 100%; }
}
