/* ===== 의료정보 메인 (/medical) =====
 * 시안: 의료정보페이지.png (1440 폭). 템플릿 main/medical_info.html, 데이터 MainController.MEDICAL_INFO_CATEGORIES.
 * 래퍼가 .branches-page.mi-page 라 branches.css 의 색 변수(--bp-*)·헤더 높이(--bp-header)·box-sizing 을 이어 쓰고,
 * 여기 규칙은 모두 .mi-page 로 스코핑한다(사이트 CSS 와 같이 로드되므로 래퍼 없이 쓰면 헤더·푸터를 건드린다).
 */
.mi-page {
    --mi-accent: var(--bp-accent);
    --mi-accent-dark: #651226;
    --mi-hero: #4d4342;
    --mi-dark: #2b2223;
    --mi-slot: #ddd5cf;
}

/* ---------- 공통 ---------- */
.mi-page .mi-kicker {
    margin: 0;
    color: var(--mi-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
}
.mi-page .mi-kicker--light { color: #f2b6c2; }
.mi-page .mi-title {
    margin: 10px 0 0;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    word-break: keep-all;
    text-wrap: balance;
}
.mi-page .mi-lead {
    margin: 10px 0 0;
    color: var(--bp-mute);
    font-size: 16px;
    line-height: 1.6;
    word-break: keep-all;
}
.mi-page .mi-sec { padding: 110px 0; background: #fff; }
.mi-page .mi-sec--beige { background: var(--bp-beige); }
.mi-page .mi-note {
    margin: 24px 0 0;
    color: var(--bp-mute);
    font-size: 14px;
    line-height: 1.6;
    word-break: keep-all;
}

/* ---------- 히어로 ---------- */
.mi-page .mi-hero {
    padding: calc(var(--bp-header) + 120px) 0 150px;
    background: var(--mi-hero);
    text-align: center;
}
.mi-page .mi-hero__title {
    margin: 16px 0 0;
    color: #fff;
    font-size: 40px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    word-break: keep-all;
    text-wrap: balance;
}
/* 검색창: 휴대폰에서만 (PC 는 GNB 의료정보 패널의 검색) */
.mi-page .mi-search { display: none; }

/* ---------- 분류 칩 ---------- */
.mi-page .mi-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 40px 0 0;
}
.mi-page .mi-chip {
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--bp-line);
    border-radius: 20px;
    background: #fff;
    color: var(--bp-ink);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.mi-page .mi-chip:hover { border-color: var(--mi-accent); color: var(--mi-accent); }
.mi-page .mi-chip.is-active {
    border-color: var(--mi-accent);
    background: var(--mi-accent);
    color: #fff;
    font-weight: 700;
}
.mi-page .mi-chip:focus-visible,
.mi-page .mi-cchip:focus-visible { outline: 2px solid var(--mi-accent); outline-offset: 2px; }

/* ---------- 분류 패널 ---------- */
.mi-page .mi-panels { margin: 24px 0 0; }
.mi-page .mi-panel[hidden] { display: none; }
.mi-page .mi-panel {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    min-height: 580px;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
}
.mi-page .mi-panel__media {
    position: relative;
    min-height: 580px;
    background: var(--mi-slot);
}
.mi-page .mi-slide {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease, visibility .5s;
}
.mi-page .mi-slide.is-active { opacity: 1; visibility: visible; }
/* 장비 사진은 누끼 · 제품 컷이 섞여 있어 자르지 않고 담는다 */
.mi-page .mi-slide img {
    width: 100%;
    height: 100%;
    padding: 48px 48px 80px;
    object-fit: contain;
}
.mi-page .mi-slide__name {
    position: absolute;
    left: 20px;
    bottom: 34px;
    padding: 8px 16px;
    border-radius: 18px;
    background: #fff;
    color: var(--bp-ink);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
.mi-page .mi-progress {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 14px;
    display: flex;
    gap: 6px;
}
.mi-page .mi-progress span {
    flex: 1;
    height: 3px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, .6);
}
.mi-page .mi-progress i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--mi-accent);
}
.mi-page .mi-progress span.is-done i { width: 100%; }
.mi-page .mi-progress span.is-active i { animation: mi-fill 3s linear forwards; }
@keyframes mi-fill { from { width: 0; } to { width: 100%; } }

.mi-page .mi-panel__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #e6dfd9, #d3cac3);
}
.mi-page .mi-panel__media--empty p {
    margin: 0;
    color: #5c5250;
    font-size: 16px;
    font-weight: 500;
}

.mi-page .mi-panel__body {
    display: flex;
    flex-direction: column;
    padding: 40px 32px 32px;
}
.mi-page .mi-panel__name {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.mi-page .mi-panel__desc {
    margin: 14px 0 0;
    color: var(--bp-sub);
    font-size: 16px;
    line-height: 1.6;
    word-break: keep-all;
}
.mi-page .mi-badge {
    align-self: flex-start;
    margin: 18px 0 0;
    padding: 5px 12px;
    border-radius: 14px;
    background: #f8e1e6;
    color: var(--mi-accent);
    font-size: 12px;
    font-weight: 700;
}
.mi-page .mi-items {
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--bp-line);
}
.mi-page .mi-items a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 2px;
    border-bottom: 1px solid var(--bp-line);
    color: var(--bp-ink);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: color .2s;
}
.mi-page .mi-items a i { color: var(--bp-mute); font-size: 16px; transition: transform .2s, color .2s; }
.mi-page .mi-items a:hover { color: var(--mi-accent); }
.mi-page .mi-items a:hover i { color: var(--mi-accent); transform: translateX(3px); }
.mi-page .mi-panel__empty {
    margin: 24px 0 0;
    color: var(--bp-sub);
    font-size: 14px;
    line-height: 1.7;
    word-break: keep-all;
}
.mi-page .mi-panel__foot {
    margin-top: auto;
    padding-top: 24px;
}
.mi-page .mi-panel__hint {
    margin: 0 0 12px;
    color: var(--bp-mute);
    font-size: 12px;
}
.mi-page .mi-more {
    color: var(--mi-accent);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.mi-page .mi-more:hover { text-decoration: underline; }

/* ---------- 고민별 ---------- */
.mi-page .mi-concern-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 10px;
    margin: 40px 0 0;
}
.mi-page .mi-cchip {
    height: 50px;
    padding: 0 26px;
    border: 1px solid var(--bp-line);
    border-radius: 25px;
    background: #fff;
    color: var(--bp-ink);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}
.mi-page .mi-cchip:hover { border-color: var(--mi-accent); color: var(--mi-accent); }
.mi-page .mi-cchip.is-active { border-color: var(--mi-accent); background: var(--mi-accent); color: #fff; font-weight: 600; }

.mi-page .mi-concerns {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
}
.mi-page .mi-concern {
    position: relative;
    display: block;
    aspect-ratio: 312 / 300;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(180deg, #d9d1cb 0%, #cfc6bf 45%, #7a706c 100%);
    color: #fff;
    text-decoration: none;
    transition: opacity .3s, transform .3s;
}
.mi-page .mi-concern img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s ease;
}
/* 글자 쪽(아래)을 어둡게: 사진이 밝아도 흰 글자 대비를 지킨다 */
.mi-page .mi-concern::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(30, 24, 24, .78) 100%);
}
.mi-page .mi-concern:hover img { transform: scale(1.04); }
.mi-page .mi-concern__body {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 22px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mi-page .mi-concern__body strong {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.mi-page .mi-concern__body span {
    color: rgba(255, 255, 255, .9);
    font-size: 14px;
    line-height: 1.5;
    word-break: keep-all;
}
/* 고민 칩을 고르면 그 카드만 또렷하게 */
.mi-page .mi-concerns.is-filtered .mi-concern { opacity: .35; }
.mi-page .mi-concerns.is-filtered .mi-concern.is-match {
    opacity: 1;
    box-shadow: 0 0 0 3px var(--mi-accent);
}

/* ---------- 마지막 행동 ---------- */
.mi-page .mi-cta {
    padding: 120px 0;
    background: var(--mi-dark);
}
.mi-page .mi-cta__title {
    margin: 0;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.02em;
    word-break: keep-all;
}
.mi-page .mi-cta__btns {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 40px 0 0;
}
.mi-page .mi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    padding: 0 40px;
    border: 0;
    border-radius: 28px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s;
}
.mi-page .mi-btn--primary { min-width: 300px; background: var(--mi-accent); color: #fff; }
.mi-page .mi-btn--primary:hover { background: var(--mi-accent-dark); }
.mi-page .mi-btn--light { background: #fff; color: var(--bp-ink); }
.mi-page .mi-btn--light:hover { background: #eee; }

/* ---------- 태블릿 ---------- */
@media (max-width: 1199px) {
    .mi-page .mi-panel { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); min-height: 480px; }
    .mi-page .mi-panel__media { min-height: 480px; }
    .mi-page .mi-concerns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .mi-page .mi-concern { aspect-ratio: 16 / 10; }
}

/* ---------- 휴대폰 ---------- */
@media (max-width: 767px) {
    .mi-page .v2Container { padding-left: 20px; padding-right: 20px; }
    .mi-page .mi-sec { padding: 64px 0; }
    .mi-page .mi-title { font-size: 24px; }
    .mi-page .mi-lead { font-size: 14px; }

    .mi-page .mi-hero { padding: calc(var(--bp-header) + 48px) 0 56px; }
    .mi-page .mi-hero__title { font-size: 24px; }
    .mi-page .mi-search {
        display: flex;
        align-items: center;
        gap: 8px;
        height: 48px;
        margin: 28px 0 0;
        padding: 0 16px;
        border-radius: 24px;
        background: #fff;
        text-align: left;
    }
    .mi-page .mi-search i { color: var(--bp-mute); font-size: 18px; }
    .mi-page .mi-search input {
        flex: 1;
        min-width: 0;
        height: 100%;
        border: 0;
        background: none;
        color: var(--bp-ink);
        font-size: 16px;   /* 16px 미만이면 iOS 가 확대한다 */
        outline: none;
    }

    /* 칩: 한 줄 가로 스크롤 (화면 끝까지) */
    .mi-page .mi-chips {
        flex-wrap: nowrap;
        gap: 8px;
        margin: 28px -20px 0;
        padding: 0 20px 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .mi-page .mi-chips::-webkit-scrollbar { display: none; }
    .mi-page .mi-chip { flex: none; height: 36px; padding: 0 14px; }

    .mi-page .mi-panel { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .mi-page .mi-panel__media { min-height: 0; aspect-ratio: 4 / 3; }
    .mi-page .mi-panel__media--empty { aspect-ratio: 2 / 1; }
    .mi-page .mi-slide img { padding: 24px 24px 64px; }
    .mi-page .mi-slide__name { left: 14px; bottom: 26px; font-size: 12px; padding: 6px 12px; }
    .mi-page .mi-progress { left: 14px; right: 14px; bottom: 12px; }
    .mi-page .mi-panel__body { padding: 24px 20px 24px; }
    .mi-page .mi-panel__name { font-size: 20px; }
    .mi-page .mi-panel__desc { font-size: 14px; }
    .mi-page .mi-items { margin-top: 18px; }
    .mi-page .mi-items a { padding: 12px 2px; font-size: 14px; }
    .mi-page .mi-panel__hint { display: none; }

    .mi-page .mi-concern-chips { gap: 8px; margin-top: 28px; }
    .mi-page .mi-cchip { height: 40px; padding: 0 16px; font-size: 14px; }
    .mi-page .mi-concerns { gap: 12px; margin-top: 28px; }
    .mi-page .mi-concern { aspect-ratio: 1 / 1; border-radius: 10px; }
    .mi-page .mi-concern__body { left: 14px; right: 14px; bottom: 14px; gap: 4px; }
    .mi-page .mi-concern__body strong { font-size: 16px; }
    .mi-page .mi-concern__body span { font-size: 12px; }

    .mi-page .mi-cta { padding: 64px 0; }
    .mi-page .mi-cta__title { font-size: 22px; }
    .mi-page .mi-cta__btns { gap: 10px; margin-top: 28px; }
    .mi-page .mi-btn { flex: 1; min-width: 0; height: 50px; padding: 0 16px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .mi-page .mi-slide,
    .mi-page .mi-concern,
    .mi-page .mi-concern img { transition: none; }
    .mi-page .mi-progress span.is-active i { animation: none; width: 100%; }
}
