@charset "utf-8";

/*
 * 전후사진 게시판 IST-case 전용 스타일 (카드형 IST-card 와 같은 배치 · 분류 메뉴)
 * 게시판 공통 배치(카드 목록 · 검색 · 보기 · 분류 칩 등)는 /css/ist/board.css, M3 토큰 · 컴포넌트는 /css/ist/m3.css
 * 사진 비율은 게시판 설정의 갤러리 이미지 크기 (--case-ratio, skin/board/case/case.lib.php)
 */

/* 목록 : 왼쪽 분류 메뉴 (게시판 분류를 쓸 때) : 고르지 않음 = Outlined 버튼, 고름 = 테마 컬러 (IST-card 와 같음) */
.ist-case.has-cate {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.ist-case__main { min-width: 0; }

/* 넓은 화면 : 목록을 내려도 분류 메뉴가 따라온다. 사이트 머리가 화면에 고정이면 --board-sticky-top 을 머리 높이 + 여백으로 */
.ist-case.has-cate .ist-case__cate { position: sticky; top: var(--board-sticky-top, 24px); }

.ist-case__cate ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ist-case__cate .m3-button {
    width: 100%;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border-radius: 1em;
    padding: 25px 15px;
}

.ist-case__cate .m3-button.is-selected {
    background: var(--theme-color);
    color: #fff;
}

.ist-case.has-cate .ist-board-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 카드 배경 : 흰색 (surface-container-lowest, 다른 IST- 스킨과 같음) */
.ist-case .m3-card { background: var(--m3-surface-container-lowest); }

/* 목록 카드 : BEFORE · AFTER 사진 나란히 */
.ist-case__card { display: flex; flex-direction: column; }

.ist-case__photos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
}

.ist-case__photo {
    position: relative;
    display: block;
    aspect-ratio: var(--case-ratio, 4 / 5);
    overflow: hidden;
    background: var(--m3-surface-container-highest);
    color: inherit;
    text-decoration: none;
}

/* 칸 비율 = 사진 원본 비율(--case-ratio, 쌍마다 BEFORE 기준). BEFORE · AFTER 비율이 달라도 자르지 않는다 */
.ist-case__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 사진 이름표 : 왼쪽 아래 scrim(#000 0.32 위에 흰 글자, M3 scrim) */
.ist-case__label {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 2;
    padding: 2px 8px;
    background: rgb(0 0 0 / 0.32);
    color: #fff;
    letter-spacing: 0.5px;
}

.ist-case__body { color: inherit; text-decoration: none; }

/* AFTER 를 볼 수 없는 사람 : 흐린 작은 썸네일 + 로그인 안내 (surface 반투명) */
.ist-case__photo--locked img,
.ist-case__frame--locked img {
    filter: blur(8px);
    transform: scale(1.15);
}

.ist-case__lock {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: color-mix(in srgb, var(--m3-surface) 72%, transparent);
    color: var(--m3-on-surface-variant);
    text-align: center;
    text-decoration: none;
}

.ist-case__lock .m3-icon { font-size: 24px; }
.ist-case__lock:hover { color: var(--m3-primary-text); }

/* 보기 : 시술 내용 (작성일 · 조회는 보이지 않는다) */
.ist-case__view-desc { margin: 8px 0 0; color: var(--m3-on-surface-variant); }

/* 보기 : 각도별 BEFORE · AFTER 한 쌍 (Outlined 카드 두 장) + 각도 칩 */
.ist-case__view { max-width: 1144px; margin: 0 auto 32px; } /* 사진 영역 1000px + 좌우 화살표 (사진 한 장이 너무 커지지 않게, 레퍼런스 사진 한 장 585px) */

/* 사진 좌우 화살표 = 이전 · 다음글 : 가는 선 꺾쇠(레퍼런스), 56 원형 상태 레이어 */
.ist-case__stage {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    gap: 16px;
    align-items: center;
}

.ist-case__pairs { grid-column: 2; min-width: 0; }

.ist-case__nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--m3-corner-full);
    color: var(--m3-on-surface-variant);
}

.ist-case__nav--prev { grid-column: 1; grid-row: 1; }
.ist-case__stage > .ist-case__nav { margin-bottom: 46px; } /* 사진 아래 이름표 높이만큼 올려 사진 가운데에 */
.ist-case__nav--next { grid-column: 3; grid-row: 1; }

.ist-case__nav::before {
    content: "";
    width: 26px;
    height: 26px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateX(6px) rotate(45deg);
}

.ist-case__nav--next::before { transform: translateX(-6px) rotate(-135deg); }
.ist-case__nav:hover { color: var(--m3-on-surface); background: color-mix(in srgb, var(--m3-on-surface) 8%, transparent); }

.ist-case__pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ist-case__pair[hidden] { display: none; }

.ist-case__figure {
    margin: 0;
    overflow: hidden;
}

.ist-case__frame {
    position: relative;
    aspect-ratio: var(--case-ratio, 4 / 5);
    overflow: hidden;
    background: var(--m3-surface-container-highest);
}

.ist-case__frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ist-case__frame--locked img { filter: blur(14px); }

.ist-case__figure figcaption {
    padding: 12px 16px;
    color: var(--m3-on-surface);
    letter-spacing: 0.5px;
    text-align: center;
}

/* 각도 버튼 : 알약 모양, 고르지 않음 = 흰 바탕 + 테두리, 고름 = 테마 컬러 + 그림자(elevation 2), 마우스 올림 = 그림자(elevation 1) */
.ist-case__angles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin: 24px 0 0;
}

.m3b .ist-case__angle {
    min-width: 88px;
    height: 40px;
    padding: 0 24px;
    border: 1px solid var(--m3-outline-variant);
    border-radius: var(--m3-corner-full);
    background: var(--m3-surface-container-lowest);
    color: var(--m3-on-surface-variant);
    cursor: pointer;
    transition: box-shadow 0.15s linear, background-color 0.15s linear, color 0.15s linear;
}

.m3b .ist-case__angle:hover { box-shadow: var(--m3-elevation-1); color: var(--m3-on-surface); }

.m3b .ist-case__angle.is-selected {
    border-color: transparent;
    background: var(--theme-color);
    color: var(--theme-color-text);
    box-shadow: var(--m3-elevation-2);
}

.ist-case__empty {
    padding: 64px 16px;
    color: var(--m3-on-surface-variant);
    text-align: center;
}

/* 글쓰기 : 각도마다 [각도 이름 · BEFORE · AFTER] (Outlined 틀, 칸 이름은 테두리 위) */
.ist-case__w-help { margin: 0; color: var(--m3-on-surface-variant); }

.ist-case__w-angle {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    margin: 0;
    padding: 8px 16px 16px;
    border: 1px solid var(--m3-outline-variant);
    border-radius: var(--m3-corner-medium);
}

.ist-case__w-angle legend {
    position: static; /* 그누보드 기본(css/default.css)은 legend 를 숨긴다 */
    margin-left: -4px;
    padding: 0 4px;
    font-size: 14px;
    line-height: 20px;
    text-indent: 0;
    overflow: visible;
    color: var(--m3-on-surface);
}

@media (max-width: 839px) {
    .ist-case.has-cate { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .ist-case.has-cate .ist-case__cate { position: static; }
    .ist-case__cate ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ist-case.has-cate .ist-board-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 839px) {
    /* 화살표를 사진 위 양옆에 (반투명 원) */
    .ist-case__stage { position: relative; grid-template-columns: minmax(0, 1fr); gap: 0; }
    .ist-case__pairs { grid-column: 1; }
    .ist-case__nav {
        position: absolute;
        top: calc(50% - 44px);
        z-index: 3;
        width: 40px;
        height: 40px;
        background: color-mix(in srgb, var(--m3-surface-container-lowest) 80%, transparent);
        box-shadow: var(--m3-elevation-1);
    }
    .ist-case__nav--prev { left: 4px; }
    .ist-case__nav--next { right: 4px; }
    .ist-case__nav::before { width: 14px; height: 14px; transform: translateX(3px) rotate(45deg); }
    .ist-case__nav--next::before { transform: translateX(-3px) rotate(-135deg); }
}

@media (max-width: 599px) {
    .ist-case.has-cate .ist-board-cards { grid-template-columns: minmax(0, 1fr); }
    .ist-case__angles { gap: 8px; }
    .ist-case__pair { gap: 8px; }
    .ist-case__figure figcaption { padding: 8px; }
}
