/* ==========================================================================
   HARU LIVE
   Feed / 종합속보

   File:
   public/css/feed/feed-mobile.css
   ========================================================================== */


/* ==========================================================================
   1. VARIABLES
   ========================================================================== */

.feed-page {
    --feed-bg: #f5f6f8;
    --feed-surface: #ffffff;
    --feed-surface-soft: #f8fafc;

    --feed-text: #111827;
    --feed-text-soft: #334155;
    --feed-subtext: #64748b;
    --feed-muted: #94a3b8;

    --feed-border: #e2e8f0;
    --feed-border-soft: #eef2f7;

    --feed-blue: #2563eb;
    --feed-blue-soft: #eff6ff;
    --feed-blue-border: #dbeafe;

    --feed-red: #ef4444;
    --feed-red-soft: #fef2f2;
    --feed-red-border: #fee2e2;

    --feed-orange: #ea580c;
    --feed-orange-soft: #fff7ed;
    --feed-orange-border: #fed7aa;

    --feed-indigo: #4f46e5;
    --feed-indigo-soft: #eef2ff;
    --feed-indigo-border: #e0e7ff;

    --feed-radius-sm: 6px;
    --feed-radius-md: 10px;
    --feed-radius-lg: 14px;

    --feed-shadow:
        0 1px 2px rgba(15, 23, 42, 0.03),
        0 4px 14px rgba(15, 23, 42, 0.035);
}


/* ==========================================================================
   2. DESKTOP BASE
   ========================================================================== */

.feed-page {
    width: 100%;
}


/* 목록 */
.feed-list {
    overflow: hidden;

    border: 1px solid var(--feed-border);
    border-radius: var(--feed-radius-lg);

    background: var(--feed-surface);

    box-shadow: var(--feed-shadow);
}


/* 목록 헤더 */
.feed-list-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 16px;

    padding: 12px 20px;

    border-bottom: 1px solid var(--feed-border);

    background: var(--feed-surface-soft);
}


/* 실시간 */
.feed-list-title {
    display: flex;

    align-items: center;

    gap: 8px;

    flex-shrink: 0;
}

.feed-list-title__dot {
    display: block;

    width: 8px;
    height: 8px;

    border-radius: 999px;

    background: var(--feed-red);
}

.feed-list-title__text {
    font-size: 14px;
    font-weight: 700;

    color: var(--feed-text-soft);
}


/* 게시물 */
.feed-post {
    border-bottom: 1px solid var(--feed-border-soft);
}

.feed-post:last-child {
    border-bottom: 0;
}

.feed-post__link {
    display: flex;

    align-items: center;

    gap: 14px;

    width: 100%;

    padding: 16px 20px;

    background: var(--feed-surface);

    transition:
        background-color .15s ease,
        color .15s ease;
}

.feed-post__link:hover {
    background: var(--feed-surface-soft);
}

.feed-post__body {
    min-width: 0;

    flex: 1;
}


/* 메타 */
.feed-post__meta {
    display: flex;

    flex-wrap: wrap;

    align-items: center;

    gap: 4px 8px;

    margin-bottom: 8px;
}

.feed-post__channel {
    display: inline-flex;

    align-items: center;

    max-width: 160px;

    padding: 4px 8px;

    border: 1px solid var(--feed-border);
    border-radius: var(--feed-radius-sm);

    background: #f8fafc;

    font-size: 12px;
    font-weight: 500;

    color: #475569;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-post__author,
.feed-post__time,
.feed-post__separator {
    font-size: 12px;

    color: var(--feed-subtext);
}

.feed-post__author {
    max-width: 160px;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-post__separator {
    color: #cbd5e1;
}

.feed-post__time {
    white-space: nowrap;
}


/* 제목 */
.feed-post__title-row {
    display: flex;

    align-items: center;

    gap: 6px;

    min-width: 0;
}

.feed-post__title {
    min-width: 0;

    margin: 0;

    overflow: hidden;

    flex: 0 1 auto;

    font-size: 15px;
    font-weight: 700;

    line-height: 1.45;

    letter-spacing: -0.025em;

    color: var(--feed-text);

    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-post__link:hover .feed-post__title {
    color: var(--feed-blue);
}

.feed-post__comment-count {
    flex: 0 0 auto;

    font-size: 13px;
    font-weight: 700;

    color: var(--feed-blue);
}


/* 게시물 badge */
.feed-post-badge {
    flex: 0 0 auto;

    display: inline-flex;

    align-items: center;

    padding: 2px 6px;

    border-radius: 5px;

    font-size: 10px;
    font-weight: 700;

    line-height: 1.2;
}

.feed-post-badge--notice {
    border: 1px solid var(--feed-red-border);

    background: var(--feed-red-soft);

    color: var(--feed-red);
}

.feed-post-badge--best {
    border: 1px solid var(--feed-orange-border);

    background: var(--feed-orange-soft);

    color: var(--feed-orange);
}


/* 통계 */
.feed-post__stats {
    display: flex;

    flex-wrap: wrap;

    align-items: center;

    gap: 6px;

    margin-top: 11px;
}

.feed-stat {
    display: inline-flex;

    align-items: center;

    gap: 4px;

    padding: 4px 8px;

    border: 1px solid var(--feed-border);
    border-radius: 999px;

    font-size: 12px;

    line-height: 1;

    white-space: nowrap;
}

.feed-stat__value {
    font-weight: 700;
}

.feed-stat--views {
    background: #fff;

    color: var(--feed-subtext);
}

.feed-stat--views .feed-stat__value {
    color: var(--feed-text);
}

.feed-stat--likes {
    border-color: var(--feed-blue-border);

    background: var(--feed-blue-soft);

    color: var(--feed-blue);
}

.feed-stat--dislikes {
    border-color: var(--feed-red-border);

    background: var(--feed-red-soft);

    color: var(--feed-red);
}

.feed-stat--comments {
    border-color: var(--feed-indigo-border);

    background: var(--feed-indigo-soft);

    color: var(--feed-indigo);
}


/* 화살표 */
.feed-post__arrow {
    flex: 0 0 auto;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    border-radius: 999px;

    color: #cbd5e1;

    transition:
        color .15s ease,
        transform .15s ease,
        background-color .15s ease;
}

.feed-post__arrow svg {
    width: 18px;
    height: 18px;
}

.feed-post__link:hover .feed-post__arrow {
    color: #64748b;

    background: #f1f5f9;

    transform: translateX(2px);
}


/* ==========================================================================
   3. EMPTY
   ========================================================================== */

.feed-empty {
    display: flex;

    min-height: 260px;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    padding: 40px 20px;

    text-align: center;
}

.feed-empty__icon {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    border-radius: 999px;

    background: #f1f5f9;

    color: #94a3b8;
}

.feed-empty__icon svg {
    width: 24px;
    height: 24px;
}

.feed-empty__title {
    margin-top: 13px;

    font-size: 14px;

    color: #475569;
}

.feed-empty__description {
    margin-top: 4px;

    font-size: 12px;

    color: #94a3b8;
}


/* ==========================================================================
   4. PAGINATION
   ========================================================================== */

.feed-pagination {
    margin-top: 18px;
}


/* ==========================================================================
   5. MOBILE
   ========================================================================== */

@media screen and (max-width: 640px) {

    /* ----------------------------------------------------------------------
       page body
       ---------------------------------------------------------------------- */

    .feed-page {
        width: 100%;
        max-width: none !important;

        margin: 0 !important;

        padding:
            14px
            10px
            calc(26px + env(safe-area-inset-bottom))
            10px !important;

        overflow-x: hidden;
    }


    /* ----------------------------------------------------------------------
       HEADER
       x-slot 내부라 .feed-page 밖에 존재함
       ---------------------------------------------------------------------- */

    .feed-page-header {
        width: 100%;

        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            auto;

        align-items: start !important;

        gap: 10px !important;
    }

    .feed-page-header__text {
        min-width: 0;
    }

    .feed-page-header__title {
        margin: 0 !important;

        font-size: 19px !important;
        font-weight: 800 !important;

        line-height: 1.25 !important;

        letter-spacing: -0.045em;

        color: #111827;
    }

    .feed-page-header__description {
        max-width: 260px;

        margin:
            4px
            0
            0 !important;

        font-size: 10.5px !important;

        line-height: 1.45 !important;

        letter-spacing: -0.015em;

        color: #64748b !important;

        word-break: keep-all;
    }

    .feed-page-header__count {
        display: inline-flex;

        align-items: center;

        gap: 2px;

        margin-top: 3px;

        white-space: nowrap;
    }

    .feed-page-header__count-label,
    .feed-page-header__count-unit {
        font-size: 10px;

        color: #94a3b8;
    }

    .feed-page-header__count-number {
        font-size: 10px;

        font-weight: 700;

        color: #475569;
    }


    /* ----------------------------------------------------------------------
       MAIN CARD
       ---------------------------------------------------------------------- */

    .feed-list {
        border-radius: 12px;

        box-shadow:
            0 1px 2px rgba(15, 23, 42, .035),
            0 3px 10px rgba(15, 23, 42, .025);
    }


    /* ----------------------------------------------------------------------
       LIST HEADER
       ---------------------------------------------------------------------- */

    .feed-list-header {
        min-height: 49px;

        display: grid;

        grid-template-columns:
            auto
            minmax(0, 1fr);

        align-items: center;

        gap: 7px;

        padding:
            7px
            8px;

        background: #f8fafc;
    }

    .feed-list-title {
        gap: 5px;
    }

    .feed-list-title__dot {
        width: 6px;
        height: 6px;

        box-shadow:
            0 0 0 3px rgba(239, 68, 68, .07);
    }

    .feed-list-title__text {
        font-size: 10.5px;

        font-weight: 800;

        letter-spacing: -0.025em;

        white-space: nowrap;
    }


    /* ----------------------------------------------------------------------
       SORT
       ---------------------------------------------------------------------- */

    .feed-sort-wrap {
        min-width: 0;

        overflow-x: auto;
        overflow-y: hidden;

        scrollbar-width: none;

        -webkit-overflow-scrolling: touch;
    }

    .feed-sort-wrap::-webkit-scrollbar {
        display: none;
    }

    /*
     * x-post-sort-tabs 최상위
     */
    .feed-sort-wrap > * {
        width: max-content !important;
        min-width: max-content !important;
    }

    .feed-sort-wrap .flex {
        display: flex !important;

        flex-wrap: nowrap !important;

        align-items: center !important;

        gap: 1px !important;

        padding: 2px !important;

        border-radius: 8px;

        background: #f1f5f9;
    }

    .feed-sort-wrap a,
    .feed-sort-wrap button {
        flex: 0 0 auto !important;

        min-width: auto !important;
        min-height: 27px !important;

        display: inline-flex !important;

        align-items: center;
        justify-content: center;

        padding:
            4px
            7px !important;

        border: 0 !important;
        border-radius: 6px !important;

        font-size: 8px !important;
        font-weight: 500 !important;

        line-height: 1 !important;

        color: #64748b !important;

        white-space: nowrap !important;

        box-shadow: none !important;
    }

    /*
     * 선택된 sort
     */
    .feed-sort-wrap a.bg-white,
    .feed-sort-wrap button.bg-white,
    .feed-sort-wrap a.font-semibold,
    .feed-sort-wrap button.font-semibold,
    .feed-sort-wrap a.font-bold,
    .feed-sort-wrap button.font-bold {
        background: #fff !important;

        color: #111827 !important;

        font-weight: 700 !important;

        box-shadow:
            0 1px 2px rgba(15, 23, 42, .07) !important;
    }


    /* ----------------------------------------------------------------------
       POST
       ---------------------------------------------------------------------- */

    .feed-post__link {
        gap: 5px;

        padding:
            10px
            9px
            9px;

        background: #fff;
    }

    .feed-post__link:hover {
        background: #fff;
    }

    .feed-post__link:active {
        background: #f8fafc;
    }


    /* ----------------------------------------------------------------------
       META
       ---------------------------------------------------------------------- */

    .feed-post__meta {
        flex-wrap: nowrap;

        gap: 4px;

        margin-bottom: 5px;

        overflow: hidden;
    }

    .feed-post__channel {
        flex: 0 1 auto;

        max-width: 108px;

        min-height: 22px;

        padding:
            3px
            6px;

        border-radius: 5px;

        font-size: 7.5px;

        line-height: 1;
    }

    .feed-post__author {
        flex: 0 1 auto;

        max-width: 72px;

        font-size: 8px;

        line-height: 1.2;
    }

    .feed-post__separator {
        flex: 0 0 auto;

        font-size: 10px;
    }

    .feed-post__time {
        flex: 0 0 auto;

        font-size: 7.5px;

        line-height: 1.2;

        color: var(--feed-muted);
    }


    /* ----------------------------------------------------------------------
       TITLE
       ---------------------------------------------------------------------- */

    .feed-post__title-row {
        gap: 3px;
    }

    .feed-post__title {
        flex: 1 1 auto;

        font-size: 11.5px;

        line-height: 1.35;

        letter-spacing: -0.02em;
    }

    .feed-post__comment-count {
        font-size: 8.5px;
    }

    .feed-post-badge {
        padding:
            2px
            4px;

        font-size: 10px;

        border-radius: 4px;
    }


    /* ----------------------------------------------------------------------
       STATS
       ---------------------------------------------------------------------- */

    .feed-post__stats {
        flex-wrap: nowrap;

        gap: 3px;

        margin-top: 7px;

        overflow-x: auto;

        scrollbar-width: none;

        -webkit-overflow-scrolling: touch;
    }

    .feed-post__stats::-webkit-scrollbar {
        display: none;
    }

    .feed-stat {
        flex: 0 0 auto;

        min-height: 22px;

        gap: 2px;

        padding:
            3px
            6px;

        font-size: 7.5px;
    }

    .feed-stat__value {
        font-size: 7.5px;
    }


    /* ----------------------------------------------------------------------
       ARROW
       ---------------------------------------------------------------------- */

    .feed-post__arrow {
        width: 20px;
        height: 20px;

        margin-left: 1px;
    }

    .feed-post__arrow svg {
        width: 13px;
        height: 13px;
    }

    .feed-post__link:hover .feed-post__arrow {
        background: transparent;

        transform: none;
    }


    /* ----------------------------------------------------------------------
       Empty
       ---------------------------------------------------------------------- */

    .feed-empty {
        min-height: 180px;

        padding:
            30px
            14px;
    }

    .feed-empty__icon {
        width: 40px;
        height: 40px;
    }

    .feed-empty__icon svg {
        width: 20px;
        height: 20px;
    }

    .feed-empty__title {
        margin-top: 10px;

        font-size: 12px;
    }

    .feed-empty__description {
        font-size: 9.5px;
    }


    /* ----------------------------------------------------------------------
       pagination
       ---------------------------------------------------------------------- */

    .feed-pagination {
        margin-top: 10px;
    }

    .feed-pagination nav {
        max-width: 100%;

        overflow-x: auto;

        scrollbar-width: none;
    }

    .feed-pagination nav::-webkit-scrollbar {
        display: none;
    }


    /* ----------------------------------------------------------------------
       Safe overflow
       ---------------------------------------------------------------------- */

    .feed-page * {
        min-width: 0;
    }

}


/* ==========================================================================
   6. <= 430px
   ========================================================================== */

@media screen and (max-width: 430px) {

    .feed-page {
        padding-left: 9px !important;
        padding-right: 9px !important;
    }

}


/* ==========================================================================
   7. <= 390px
   ========================================================================== */

@media screen and (max-width: 390px) {

    .feed-page {
        padding-left: 7px !important;
        padding-right: 7px !important;
    }

    .feed-page-header__title {
        font-size: 18px !important;
    }

    .feed-page-header__description {
        max-width: 230px;

        font-size: 10px !important;
    }

    .feed-list-header {
        gap: 6px;

        padding-left: 7px;
        padding-right: 7px;
    }

    .feed-list-title__text {
        font-size: 10px;
    }

    .feed-sort-wrap a,
    .feed-sort-wrap button {
        padding-left: 6px !important;
        padding-right: 6px !important;

        font-size: 7.5px !important;
    }

    .feed-post__link {
        padding-left: 8px;
        padding-right: 8px;
    }

}


/* ==========================================================================
   8. <= 360px
   ========================================================================== */

@media screen and (max-width: 360px) {

    .feed-page {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .feed-post__channel {
        max-width: 92px;
    }

    .feed-post__author {
        max-width: 60px;
    }

    .feed-stat {
        padding-left: 5px;
        padding-right: 5px;
    }

}


/* ==========================================================================
   9. <= 330px
   ========================================================================== */

@media screen and (max-width: 330px) {

    /*
     * 매우 작은 화면에서는 정렬을 아래 줄로
     */
    .feed-list-header {
        display: block;
    }

    .feed-sort-wrap {
        margin-top: 6px;
    }

}


/* ==========================================================================
   10. TOUCH
   ========================================================================== */

@media screen and (max-width: 640px) and (hover: none) and (pointer: coarse) {

    .feed-post__link {
        -webkit-tap-highlight-color: transparent;

        touch-action: manipulation;
    }

    .feed-post__link:active {
        background: #f8fafc;
    }

    .feed-sort-wrap a,
    .feed-sort-wrap button {
        -webkit-tap-highlight-color: transparent;
    }

}


/* ==========================================================================
   11. REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .feed-page *,
    .feed-page *::before,
    .feed-page *::after {
        transition-duration: .01ms !important;

        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }

}