/* ========================================
   Home rail — the right-hand column on the home page.
   One glass surface (HomeRail) split into hairline-separated sections:
   promos → monthly goal → top sponsors → magnates → Discord. Sections reuse
   glass-card, server-table-row, ranks-medal-*, discord-join-btn, servers-dot
   and SponsorBadge by name; this file only holds what none of those cover.
   ======================================== */

.home-rail {
    position: relative;
    overflow: hidden;
    padding: 0 !important;
    background:
        radial-gradient(120% 60% at 100% 0%, rgba(255, 203, 49, 0.09) 0%, transparent 55%),
        radial-gradient(120% 50% at 0% 100%, rgba(88, 101, 242, 0.12) 0%, transparent 60%),
        rgba(15, 22, 33, 0.6) !important;
}

.home-rail:hover {
    border-color: rgba(255, 203, 49, 0.3) !important;
}

/* xxl side column: capped (unclamped col-xxl-3 is 620px of empty rows at 2560px) and sticky. */
@media (min-width: 1400px) {
    /* Never scrolls inside itself: a tall rail scrolls with the page until its bottom is in view,
       then stays. The min-height makes a rail shorter than the viewport stick at the top instead. */
    .home-rail-col {
        flex: 0 0 auto;
        width: clamp(18rem, 28%, 27rem);
        align-self: flex-end;
        position: sticky;
        bottom: 1rem;
        min-height: calc(100vh - 2rem);
    }
}

.home-rail-sec {
    position: relative;
    padding: 1rem 1.25rem;
}

.home-rail-sec + .home-rail-sec {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* Between sm and xxl the rail spans the full row, so its sections pair up in
   two columns instead of stacking into one very wide, very tall strip. A
   container query rather than a media query: the side navigation eats 260px
   of the viewport, so the viewport width says little about the rail's own. */
.home-rail-col {
    container-type: inline-size;
}

@container (min-width: 40rem) {
    .home-rail {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-rail-sec + .home-rail-sec {
        border-top: 0;
    }

    .home-rail-sec:nth-child(even) {
        border-left: 1px solid rgba(255, 255, 255, 0.07);
    }

    .home-rail-sec:nth-child(n + 3) {
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    /* Rows stretch to the taller neighbour; keep the short Discord block centred. */
    .home-rail-discord {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.home-rail-num {
    font-variant-numeric: tabular-nums;
}

/* ---------- Section heading ---------- */

.home-rail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.home-rail-tile {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.home-rail-title {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---------- Promo slot ---------- */

/* 2:1 slot. Creatives are cropped to fill it, so one far from 2:1 (a 5:1 banner) loses its edges. */
.home-rail-ad {
    position: relative;
    display: grid;
    overflow: hidden;
    isolation: isolate;
    aspect-ratio: 2 / 1;
    border-radius: 0.75rem;
    background: rgba(15, 22, 33, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-rail-ad:hover {
    border-color: rgba(255, 203, 49, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 203, 49, 0.1);
}

.home-rail-ad-slide {
    grid-area: 1 / 1;
    position: relative;
    display: block;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

.home-rail-ad-slide.is-active {
    opacity: 1;
    visibility: visible;
}

.home-rail-ad-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-rail-ad:hover .home-rail-ad-img {
    transform: scale(1.03);
}

.home-rail-ad-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1.25rem 4rem 0.5rem 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
    color: #fff;
    font-weight: 600;
    line-height: 1.3;
    pointer-events: none;
}

.home-rail-ad-dots {
    position: absolute;
    right: 0.6rem;
    bottom: 0.55rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.home-rail-ad-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.35);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-rail-ad-dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

.home-rail-ad-dot.is-active {
    width: 18px;
    background: #0dcaf0;
    box-shadow: 0 0 8px rgba(13, 202, 240, 0.7);
}

/* ---------- Monthly goal ---------- */

.home-rail-goal {
    padding-bottom: 1.25rem;
}

/* Keeps the content above the celebration stars. */
.home-rail-goal > :not(.home-rail-sparkles) {
    position: relative;
    z-index: 1;
}

.home-rail-amount {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.home-rail-meter {
    position: relative;
    height: 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.home-rail-meter-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 9999px;
    background: #ffc107;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-rail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
    font-variant-numeric: tabular-nums;
}

.home-rail-pct {
    color: #ffc107;
    font-weight: 600;
}

.home-rail-no-goal {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.5);
}

.home-rail-record {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-top: 0.875rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.18) 0%, rgba(255, 152, 0, 0.1) 55%, rgba(255, 193, 7, 0.18) 100%);
    background-size: 200% 100%;
    border: 1px solid rgba(255, 193, 7, 0.45);
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.08) inset, 0 4px 14px -6px rgba(255, 193, 7, 0.45);
    color: rgba(255, 255, 255, 0.85);
    font-variant-numeric: tabular-nums;
    animation: home-rail-shimmer 6s ease-in-out infinite;
}

.home-rail-record::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 40%, rgba(255, 235, 150, 0.22) 50%, transparent 60%);
    transform: translateX(-100%);
    animation: home-rail-glint 4.5s ease-in-out infinite;
    pointer-events: none;
}

.home-rail-record-label {
    display: inline-flex;
    align-items: center;
    color: #ffd454;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-shadow: 0 0 8px rgba(255, 193, 7, 0.4);
}

.home-rail-record-label i {
    color: #ffc107;
    filter: drop-shadow(0 0 4px rgba(255, 193, 7, 0.6));
}

.home-rail-record-value {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    font-weight: 600;
    white-space: nowrap;
}

.home-rail-record-value .text-white {
    text-shadow: 0 0 6px rgba(255, 193, 7, 0.35);
}

.home-rail-record-date {
    color: rgba(255, 215, 130, 0.85);
}

/* Goal reached / over-reached. */

.home-rail-goal.is-complete {
    background: radial-gradient(90% 80% at 50% 0%, rgba(25, 238, 25, 0.1) 0%, transparent 70%);
}

.home-rail-goal.is-overreached {
    background: radial-gradient(90% 80% at 50% 0%, rgba(255, 203, 49, 0.12) 0%, transparent 70%);
}

.home-rail-goal.is-complete .home-rail-tile {
    background: rgba(25, 238, 25, 0.15);
    color: rgb(25, 238, 25);
    animation: home-rail-pop 2s ease-in-out infinite;
}

.home-rail-goal.is-overreached .home-rail-tile {
    background: rgba(255, 203, 49, 0.15);
    color: rgb(255, 203, 49);
    animation: home-rail-pop 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.home-rail-goal.is-complete .home-rail-meter {
    background: rgba(25, 238, 25, 0.08);
    border-color: rgba(25, 238, 25, 0.2);
}

.home-rail-goal.is-overreached .home-rail-meter {
    background: rgba(255, 203, 49, 0.08);
    border-color: rgba(255, 203, 49, 0.2);
}

.home-rail-goal.is-complete .home-rail-meter-fill {
    background: linear-gradient(90deg, rgb(25, 238, 25) 0%, rgb(120, 255, 120) 50%, rgb(25, 238, 25) 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 12px rgba(25, 238, 25, 0.55), inset 0 0 8px rgba(255, 255, 255, 0.25);
    animation: home-rail-shift 2.4s linear infinite;
}

.home-rail-goal.is-overreached .home-rail-meter-fill {
    background: linear-gradient(90deg, rgb(255, 203, 49) 0%, rgb(255, 230, 130) 50%, rgb(255, 203, 49) 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 12px rgba(255, 203, 49, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.25);
    animation: home-rail-shift 2s linear infinite;
}

.home-rail-meter-shine {
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
    animation: home-rail-sweep 2.8s ease-in-out infinite;
    pointer-events: none;
}

.home-rail-goal.is-complete .home-rail-pct {
    color: rgb(25, 238, 25);
}

.home-rail-done {
    display: inline-flex;
    align-items: center;
    color: rgb(25, 238, 25);
    font-weight: 600;
    text-shadow: 0 0 8px rgba(25, 238, 25, 0.4);
}

.home-rail-over {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    background: rgba(255, 203, 49, 0.12);
    border: 1px solid rgba(255, 203, 49, 0.3);
    color: rgb(255, 203, 49);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(255, 203, 49, 0.35);
    animation: home-rail-pulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.home-rail-sparkles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.home-rail-sparkle {
    position: absolute;
    color: rgb(120, 255, 120);
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(25, 238, 25, 0.7));
    animation: home-rail-sparkle 3.5s ease-in-out infinite;
}

.home-rail-goal.is-overreached .home-rail-sparkle {
    color: rgb(255, 203, 49);
    filter: drop-shadow(0 0 6px rgba(255, 203, 49, 0.7));
}

.home-rail-sparkle:nth-child(1) { top: 12%; left: 8%; animation-delay: 0s; }
.home-rail-sparkle:nth-child(2) { top: 20%; right: 10%; animation-delay: 0.8s; }
.home-rail-sparkle:nth-child(3) { bottom: 22%; left: 14%; animation-delay: 1.6s; }
.home-rail-sparkle:nth-child(4) { bottom: 14%; right: 16%; animation-delay: 2.4s; }

/* ---------- Leader lists ---------- */

/* Rows run edge to edge like the old widgets, so the list cancels the section padding. */
.home-rail-list {
    padding-bottom: 0;
}

.home-rail-rows {
    margin: 0 -1.25rem;
}

/* The next section's hairline takes over from the last row's border. */
.home-rail-rows > :last-child {
    border-bottom: 0 !important;
}

/* No row above the promo footer to draw its top line, so it draws its own. */
.home-rail-ad + .home-rail-rows {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.home-rail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.home-rail-toggle-btn {
    border: 0;
    border-radius: 9999px;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    padding: 0.25rem 0.7rem;
    line-height: 1.2;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-rail-toggle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.home-rail-toggle-btn.is-active {
    color: #fff;
    background: rgba(13, 202, 240, 0.2);
    box-shadow: 0 0 0 1px rgba(13, 202, 240, 0.45) inset, 0 4px 10px rgba(13, 202, 240, 0.18);
}

.home-rail-pos {
    width: 1.5rem;
    flex-shrink: 0;
    text-align: center;
}

.home-rail-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    padding: 2px;
    background-color: rgba(255, 255, 255, 0.08);
}

.home-rail-avatar-empty {
    color: rgba(255, 255, 255, 0.5);
}

/* ---------- Discord ---------- */

.home-rail-discord {
    overflow: hidden;
}

/* Server banner behind the block; fades in at the top so the section hairline stays visible. */
.home-rail-discord-art {
    position: absolute;
    inset: 0;
    background: url('/img/dc-banner.webp') center / cover no-repeat;
    opacity: 0.15;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 1.5rem, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 1.5rem, transparent 100%);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.home-rail-discord:hover .home-rail-discord-art {
    opacity: 0.25;
}

.home-rail-discord-logo {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(15, 22, 33, 0.9);
    border: 2px solid rgba(88, 101, 242, 0.55);
    box-shadow: 0 0 14px rgba(88, 101, 242, 0.35);
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.home-rail-discord:hover .home-rail-discord-logo {
    border-color: rgba(88, 101, 242, 0.9);
    box-shadow: 0 0 20px rgba(88, 101, 242, 0.55);
}

.home-rail-discord-btn {
    position: relative;
}

/* ---------- Motion ---------- */

@keyframes home-rail-sweep {
    0% { left: -40%; }
    60%, 100% { left: 110%; }
}

@keyframes home-rail-shift {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes home-rail-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes home-rail-glint {
    0% { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
}

@keyframes home-rail-pop {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.12) rotate(-6deg); }
}

@keyframes home-rail-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 203, 49, 0); background: rgba(255, 203, 49, 0.12); }
    50% { box-shadow: 0 0 12px 2px rgba(255, 203, 49, 0.3); background: rgba(255, 203, 49, 0.2); }
}

@keyframes home-rail-sparkle {
    0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.1) rotate(180deg); }
}

@media (prefers-reduced-motion: reduce) {
    .home-rail-goal .home-rail-tile,
    .home-rail-meter-fill,
    .home-rail-meter-shine,
    .home-rail-record,
    .home-rail-record::before,
    .home-rail-over,
    .home-rail-sparkle {
        animation: none !important;
    }

    .home-rail-ad-slide {
        transition: none;
    }
}
