/*
 * 마사지엠 공통 순위 페이지
 * /massage/ranking/ · /homecare/ranking/
 */

body.msgm-ranking-page {
    margin: 0;
    overflow-x: hidden;
    background: var(--rank-bg);
    color: #202124;
    font-family: 'Noto Sans KR', sans-serif;
}

body.ranking-massage {
    --rank-accent: #a68055;
    --rank-accent-dark: #765633;
    --rank-soft: #f4efe8;
    --rank-bg: #f8f8f7;
    --rank-shadow: 0 12px 34px rgba(44, 36, 27, 0.07);
}

body.ranking-homecare {
    --rank-accent: #83539a;
    --rank-accent-dark: #5f3971;
    --rank-soft: #f4edf7;
    --rank-bg: #fbf9fc;
    --rank-shadow: 0 12px 34px rgba(89, 54, 104, 0.08);
}

.msgm-ranking-root,
.msgm-ranking-root * {
    box-sizing: border-box;
}

.msgm-ranking-root {
    min-height: 70vh;
    padding-bottom: 90px;
}

.msgm-ranking-root a {
    color: inherit;
}

.msgm-ranking-container {
    width: min(100% - 32px, 1180px);
    margin: 0 auto;
    padding-top: 54px;
}

.msgm-ranking-hero {
    padding: 34px 20px 42px;
    text-align: center;
}

.msgm-ranking-kicker {
    display: block;
    margin-bottom: 12px;
    color: var(--rank-accent);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.22em;
}

.msgm-ranking-hero h1 {
    margin: 0 0 14px;
    color: #1f2023;
    font-size: clamp(31px, 4vw, 46px);
    font-weight: 900;
    line-height: 1.18;
    letter-spacing: -0.05em;
    word-break: keep-all;
}

.msgm-ranking-hero p {
    max-width: 700px;
    margin: 0 auto;
    color: #777b82;
    font-size: 15px;
    line-height: 1.75;
    word-break: keep-all;
}

.msgm-ranking-tabs-wrap {
    position: sticky;
    top: 68px;
    z-index: 40;
    margin-bottom: 34px;
    padding: 10px 0;
    background: color-mix(in srgb, var(--rank-bg) 92%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.msgm-ranking-tabs {
    display: flex;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 5px;
    gap: 3px;
    overflow-x: auto;
    border: 1px solid #e5e5e5;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.035);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.msgm-ranking-tabs::-webkit-scrollbar {
    display: none;
}

.msgm-ranking-tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 17px;
    border-radius: 999px;
    color: #696d74;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.msgm-ranking-tab:hover,
.msgm-ranking-tab:focus-visible {
    color: var(--rank-accent-dark);
    background: var(--rank-soft);
}

.msgm-ranking-tab.is-active {
    color: #fff;
    background: var(--rank-accent);
    box-shadow: 0 5px 14px color-mix(in srgb, var(--rank-accent) 30%, transparent);
}

.msgm-top-ranking {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 30px;
}

.msgm-rank-card,
.msgm-rank-mid,
.msgm-rank-list {
    position: relative;
    overflow: hidden;
    border: 1px solid #ececec;
    background: #fff;
    box-shadow: var(--rank-shadow);
}

.msgm-rank-card {
    border-radius: 20px;
}

.msgm-rank-card.rank-1 {
    border-color: color-mix(in srgb, var(--rank-accent) 55%, #e9e9e9);
}

.msgm-rank-card-link,
.msgm-rank-mid-link,
.msgm-rank-row-link {
    position: absolute;
    inset: 0;
    z-index: 5;
    border-radius: inherit;
}

.msgm-rank-card-link:focus-visible,
.msgm-rank-mid-link:focus-visible,
.msgm-rank-row-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--rank-accent) 55%, transparent);
    outline-offset: -3px;
}

.msgm-rank-image {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #f0f0f0;
}

.msgm-rank-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msgm-rank-image::after {
    position: absolute;
    inset: 0;
    content: '';
    background: linear-gradient(to top, #fff 4%, rgba(255,255,255,0.55) 31%, transparent 62%);
}

.msgm-rank-card-info {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 24px;
}

.msgm-rank-badge {
    position: absolute;
    top: -19px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    height: 38px;
    padding: 0 15px;
    border: 1px solid var(--rank-accent);
    border-radius: 10px;
    background: #fff;
    color: var(--rank-accent-dark);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 900;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.rank-1 .msgm-rank-badge {
    color: #fff;
    background: var(--rank-accent);
}

.msgm-rank-location {
    display: block;
    margin-bottom: 5px;
    color: var(--rank-accent-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.msgm-rank-name {
    display: -webkit-box;
    margin: 0 0 13px;
    overflow: hidden;
    color: #22242a;
    font-size: 19px;
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -0.035em;
    word-break: keep-all;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.msgm-rank-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.msgm-rank-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #34363c;
    font-size: 13px;
    font-weight: 800;
}

.msgm-rank-score i {
    color: #f4ad19;
}

.msgm-rank-reviews {
    color: #a0a4ab;
    font-size: 11px;
    font-weight: 500;
}

.msgm-rank-price {
    color: #c93b36;
    font-family: 'Montserrat', 'Noto Sans KR', sans-serif;
    font-size: 16px;
    font-weight: 900;
    white-space: nowrap;
}

.msgm-mid-ranking {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 38px;
}

.msgm-rank-mid {
    display: flex;
    min-height: 145px;
    border-radius: 16px;
}

.msgm-rank-mid-image {
    width: 145px;
    flex: 0 0 145px;
    background: #f1f1f1;
}

.msgm-rank-mid-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msgm-rank-mid-info {
    position: relative;
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    padding: 22px;
}

.msgm-rank-mid-number {
    position: absolute;
    top: 8px;
    right: 15px;
    color: color-mix(in srgb, var(--rank-accent) 18%, transparent);
    font-family: 'Montserrat', sans-serif;
    font-size: 32px;
    font-weight: 900;
}

.msgm-low-ranking {
    overflow: hidden;
    padding: 8px 22px;
    border-radius: 18px;
}

.msgm-rank-row {
    position: relative;
    display: grid;
    grid-template-columns: 52px 62px minmax(0, 1fr) 95px 115px;
    align-items: center;
    min-height: 78px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.msgm-rank-row:last-child {
    border-bottom: 0;
}

.msgm-rank-row-number {
    color: #bfc2c7;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
}

.msgm-rank-row img {
    display: block;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
}

.msgm-rank-row-name {
    min-width: 0;
    padding: 0 12px;
    overflow: hidden;
    color: #292b30;
    font-size: 14px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msgm-rank-row-region {
    margin-left: 7px;
    color: #a1a5ab;
    font-size: 11px;
    font-weight: 500;
}

.msgm-rank-row-score {
    color: #f4ad19;
    font-size: 13px;
    font-weight: 900;
    text-align: right;
}

.msgm-rank-row-price {
    color: #c93b36;
    font-family: 'Montserrat', 'Noto Sans KR', sans-serif;
    font-size: 14px;
    font-weight: 900;
    text-align: right;
    white-space: nowrap;
}

.msgm-ranking-status {
    grid-column: 1 / -1;
    padding: 90px 20px;
    color: #92969d;
    font-size: 14px;
    text-align: center;
}

.msgm-ranking-status i {
    margin-right: 6px;
    color: var(--rank-accent);
}

@media (hover: hover) and (pointer: fine) {
    .msgm-rank-card,
    .msgm-rank-mid,
    .msgm-rank-row {
        transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    }

    .msgm-rank-card:hover,
    .msgm-rank-mid:hover {
        transform: translateY(-5px);
        border-color: color-mix(in srgb, var(--rank-accent) 45%, #ececec);
    }

    .msgm-rank-row:hover {
        background: var(--rank-soft);
    }
}

@media (max-width: 767px) {
    .msgm-ranking-root {
        padding-bottom: 70px;
    }

    .msgm-ranking-container {
        width: min(100% - 24px, 560px);
        padding-top: 20px;
    }

    .msgm-ranking-hero {
        padding: 25px 10px 28px;
    }

    .msgm-ranking-hero h1 {
        font-size: 29px;
    }

    .msgm-ranking-hero p {
        font-size: 14px;
    }

    .msgm-ranking-tabs-wrap {
        top: 52px;
        margin-right: -12px;
        margin-bottom: 24px;
        margin-left: -12px;
        padding: 9px 12px;
    }

    .msgm-ranking-tabs {
        width: 100%;
        justify-content: flex-start;
        margin: 0;
    }

    .msgm-ranking-tab {
        min-height: 36px;
        padding: 0 15px;
        font-size: 12px;
    }

    .msgm-top-ranking {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        margin-bottom: 22px;
    }

    .msgm-rank-image {
        aspect-ratio: 16 / 10;
    }

    .msgm-rank-card-info {
        padding: 20px;
    }

    .msgm-rank-badge {
        top: -17px;
        left: 20px;
        height: 34px;
        min-width: 62px;
        font-size: 14px;
    }

    .msgm-mid-ranking {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        margin-bottom: 28px;
    }

    .msgm-rank-mid {
        min-height: 118px;
    }

    .msgm-rank-mid-image {
        width: 112px;
        flex-basis: 112px;
    }

    .msgm-rank-mid-info {
        padding: 17px;
    }

    .msgm-rank-mid-number {
        font-size: 27px;
    }

    .msgm-low-ranking {
        padding: 5px 12px;
        border-radius: 15px;
    }

    .msgm-rank-row {
        grid-template-columns: 34px 48px minmax(0, 1fr) 58px;
        min-height: 68px;
    }

    .msgm-rank-row img {
        width: 42px;
        height: 42px;
        border-radius: 8px;
    }

    .msgm-rank-row-name {
        padding: 0 8px;
        font-size: 13px;
    }

    .msgm-rank-row-region {
        display: none;
    }

    .msgm-rank-row-score {
        font-size: 12px;
    }

    .msgm-rank-row-price {
        display: none;
    }
}
