/**
 * 맞춤형 생활법령(UI-A-03-03) — 시안 A 화면 전용 스타일.
 * kebab-case(custom-law-*) — 퍼블 클래스(snake_case)와 구분.
 */

/* 퍼블 --row-gap-lg(40~80px)가 배너↔본문·안내↔패널 간격을 과하게 벌림 → 이 화면만 축소
 * (notice-list.css / service-intro.css 와 동일 사유) */
/* (#contents 위쪽 여백은 pub/css/custom.css 공통 규칙으로 통일) */

#customLawPage.law_list {
    gap: 10px;
}

.custom-law-intro {
    margin: 0;
    font-size: var(--text-17, 16px);
    line-height: 1.45;
}

.custom-law-panel {
    border: 1px solid var(--alpha-g15, #e5e5e5);
    border-radius: 10px;
    background: var(--gray-0, #fff);
    padding: 12px clamp(12px, 2vw, 20px) 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.custom-law-group-title {
    font-size: var(--text-16, 15px);
    color: var(--gray-90, #222);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
}

.custom-law-required {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 3px;
    background: var(--primary-50, #1a6dd6);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.custom-law-option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.custom-law-option-grid.cols-2 {
    max-width: none;
}

/* 주제별 목록용 큰 카드(min-height:128px · .on 4px secondary 테두리)를 칩형으로 축소 */
.custom-law-option-grid .law_category_card,
.custom-law-topic-grid .law_category_card {
    width: auto;
    min-width: 64px;
    min-height: 32px;
    height: auto;
    padding: 5px 12px;
    gap: 0;
    border: 1px solid var(--alpha-g40, #ccc);
    border-radius: 6px;
    background: var(--gray-0, #fff);
    color: var(--gray-80, #444);
    font-size: var(--text-16, 15px);
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    box-sizing: border-box;
    flex: 0 0 auto;
    position: relative;
}

/* 선택: 두꺼운 secondary 테두리 대신 primary 채움 + 체크 표식
 * (색상만으로 선택을 표현하지 않는다 — 채움·굵은 글씨·체크가 함께 바뀐다) */
.custom-law-option-grid .law_category_card.on {
    border-color: var(--primary-50, #1a6dd6);
    border-width: 1px;
    background: var(--primary-50, #1a6dd6);
    color: var(--on-primary);
    font-weight: 600;
    box-shadow: none;
    padding-right: 26px;
}

.custom-law-option-grid .law_category_card.on::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    width: 5px;
    height: 9px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: translateY(-65%) rotate(45deg);
}

.custom-law-option-grid .law_category_card:hover:not(.on),
.custom-law-topic-grid .law_category_card:hover:not(.on) {
    border-color: var(--primary-50, #1a6dd6);
    color: var(--primary-60, #1256b0);
}

.custom-law-option-grid .law_category_card:focus-visible,
.custom-law-topic-grid .law_category_card:focus-visible {
    outline: 2px solid var(--primary-50, #1a6dd6);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------
 * 조건 선택영역 배치 (2026-08-27)
 *
 * 넓은 화면은 2열이다. 서버(cstGpRowList)가 선택지 2개짜리 그룹을 한 덩어리로 묶어 주므로
 * 조건 블록이 4개(관심연령 / 성별·결혼여부·자녀유무 / 직업 / 나의상황)가 되고, 2열에 넣으면
 * 2×2 로 꽉 찬다. 블록마다 한 행을 통째로 주면 내용이 왼쪽 30~45% 만 채워 오른쪽이 비었다.
 *
 * 열 폭을 span 으로 조정하지 않는다 — 블록 하나가 한 칸이라 시작선이 자동으로 1열·2열에
 * 맞고, 그룹이 늘거나 줄어도 그리드가 알아서 흐른다.
 *
 * DOM 순서는 화면 순서와 같다(cstGpListBySeq = CST_GP_SEQ 오름차순).
 * 좁은 화면(≤640px)은 1열로 적층한다.
 * ------------------------------------------------------------------ */
.custom-law-condition-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    /* 블록끼리 붙어 보이지 않도록 행·열 간격을 넉넉히 준다 */
    gap: 18px 32px;
}

.custom-law-condition-grid > .custom-law-group {
    min-width: 0;
}

@media (min-width: 641px) {
    .custom-law-condition-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ------------------------------------------------------------------
 * 한 줄 묶음 그룹 (2026-08-27)
 * 선택지가 2개뿐인 그룹(성별·결혼여부·자녀유무)을 한 덩어리로 모아 구분선으로 나눈다.
 * 서버(cstGpRowList)가 묶어 주므로 CSS 는 배치만 맡으며, 묶음은 그리드 한 칸을 쓴다.
 * 넓은 화면 : 제목 한 줄("2. 성별 · 3. 결혼여부 · 4. 자녀유무") + 가로 나열
 * 좁은 화면(≤900px) : 제목 대신 각 묶음의 자기 이름을 보여 주고 세로로 적층
 *   (열이 좁아지면 세 묶음이 가로로 들어가지 않아 구분선이 어긋난 채 줄바꿈된다)
 * ------------------------------------------------------------------ */
.custom-law-inline-sets {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 0;
}

.custom-law-inline-set {
    min-width: 0;
}

.custom-law-inline-set + .custom-law-inline-set {
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px solid var(--alpha-g20, #ddd);
}

/* 묶음 전체 제목("2. 성별 · 3. 결혼여부 · 4. 자녀유무")은 숨기고, 각 묶음 위에 자기 제목을 둔다.
 * 제목과 선택지가 같은 칸에 놓여 어느 제목의 선택지인지 바로 맞는다(.custom-law-group-title 과 같은 서식).
 * 개별 제목은 화면낭독기에도 읽히는 글자로 두고 묶음(role=group)이 aria-labelledby 로 가리킨다
 * (aria-label 만 두면 iOS VoiceOver 쓸어넘기기에서 묶음 이름을 읽지 않는다). */
.custom-law-inline-title {
    display: none;
}

.custom-law-inline-set-label {
    display: block;
    margin-bottom: 7px;
    font-size: var(--text-16, 15px);
    font-weight: 700;
    color: var(--gray-90, #222);
}

/* 넓은 화면: 2·3·4 묶음이 1번(관심연령)과 같은 줄의 오른쪽 칸을 쓴다.
 * 칸이 좁아 묶음이 줄바꿈될 수 있으므로 구분선(border-left) 대신 간격으로만 나눈다
 * (줄바꿈된 묶음에 구분선이 남아 어긋나는 것을 막는다). */
@media (min-width: 901px) {
    .custom-law-inline-sets {
        gap: 12px 24px;
    }

    .custom-law-inline-set + .custom-law-inline-set {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }
}

/* ------------------------------------------------------------------
 * 관심연령 아이콘 (CR-04)
 * 신규 이미지 생성 없이 기존 자산 재사용:
 *   WEB/CSP/images/myset/myset_btn.png (980x287 스프라이트, AS-IS 맞춤형 관심연령 버튼)
 * 첫 행 7타일이 CST_CAT_SEQ 1~7(출생·유아기·청소년·대학생·청년·중장년·고령자)에 1:1 대응.
 *   타일 간격 71px, 아이콘 글리프 영역 = 타일 x+13, y+6, 35x32
 *   0.6배 축소 → background-size 588px 172.2px, 아이콘 상자 21x19
 * 스프라이트는 알파가 없는 RGB(흰 배경)이라 그대로 얹으면 칩 위에 흰 사각형이 남는다.
 *   기본(흰 칩)  : mix-blend-mode multiply 로 흰 배경을 지운다.
 *   선택(파란 칩): invert 로 반전해 배경을 검게 만든 뒤 screen 으로 지우고 글리프만 밝게 남긴다.
 * 선택 상태에 스프라이트의 주황 변형(x+490)을 쓰지 않는 이유도 같다 — 흰 배경이 그대로 남는다.
 * ------------------------------------------------------------------ */
.custom-law-option-grid .law_category_card.custom-law-age-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 4px 12px 4px 8px;
    text-align: left;
}

.custom-law-age-ico {
    flex: 0 0 auto;
    width: 21px;
    height: 19px;
    background-image: url('../images/myset/myset_btn.png');
    background-repeat: no-repeat;
    background-size: 588px 172.2px;
    background-position: -7.8px -3.6px;
    mix-blend-mode: multiply;
}

/* 맞춤설정항목일련번호 → 스프라이트 첫 행 타일 (맞춤설정항목의 정렬순서 1~7과 동일) */
.custom-law-age-card[data-val="1"] .custom-law-age-ico { background-position: -7.8px -3.6px; }
.custom-law-age-card[data-val="2"] .custom-law-age-ico { background-position: -50.4px -3.6px; }
.custom-law-age-card[data-val="3"] .custom-law-age-ico { background-position: -93px -3.6px; }
.custom-law-age-card[data-val="4"] .custom-law-age-ico { background-position: -135.6px -3.6px; }
.custom-law-age-card[data-val="5"] .custom-law-age-ico { background-position: -178.2px -3.6px; }
.custom-law-age-card[data-val="6"] .custom-law-age-ico { background-position: -220.8px -3.6px; }
.custom-law-age-card[data-val="7"] .custom-law-age-ico { background-position: -263.4px -3.6px; }

.custom-law-option-grid .law_category_card.custom-law-age-card.on {
    /* 아래 age-card 규칙의 padding 단축속성이 위 .on 의 padding-right 를 덮으므로 다시 준다 */
    padding-right: 26px;
}

.custom-law-option-grid .law_category_card.custom-law-age-card.on .custom-law-age-ico {
    /* 반전(흰 배경→검정) 후 screen — 배경은 사라지고 글리프만 밝게 남는다 */
    filter: invert(1);
    mix-blend-mode: screen;
}

/* 다크모드: 칩 배경이 검정(--gray-0)이라 multiply 로는 글리프(검정)가 배경에 묻혀 보이지 않는다.
 *   기본(검정 칩)  : invert 로 글리프를 흰색, 배경을 검정으로 만든 뒤 screen 으로 배경만 지운다.
 *   선택(파란 칩)  : 선택 글자색이 --gray-0(검정)이 되므로 글리프도 원본(검정)을 multiply 로 얹는다.
 *                   (라이트의 invert+screen 규칙을 되돌린다) */
@media (prefers-color-scheme: dark) {
    .custom-law-age-ico {
        filter: invert(1);
        mix-blend-mode: screen;
    }

    /*.custom-law-option-grid .law_category_card.custom-law-age-card.on .custom-law-age-ico {
        filter: none;
        mix-blend-mode: multiply;
    }*/
}

.custom-law-topic-group {
    margin-bottom: 4px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--alpha-g20, #ddd);
}

.custom-law-topic-limit {
    color: var(--gray-60, #777);
    font-size: var(--text-15, 14px);
    font-weight: 400;
}

.custom-law-topic-count {
    margin-left: auto;
    color: var(--primary-60, #1256b0);
    font-size: var(--text-15, 14px);
    font-weight: 700;
    white-space: nowrap;
}

/* ------------------------------------------------------------------
 * 관심주제 대분류 칩 풀 (2026-08-27, Select2 다중선택 대체)
 * 아이콘은 메인 화면과 같은 주제 아이콘 자산을 쓰되, 경로는 서버가 준
 * ast.iconPath(cs.common.util.LifeLawTopicIcons) 그대로다 — CSS 에 매핑을 다시 적지 않는다.
 * 18개 = 넓은 화면 6열×3행이 기본 목표. 고정 픽셀 폭으로 자르지 않고 열 수만 줄인다.
 * 칩 수는 DB 가 정하므로 열 수만 정하고 행 수는 그리드가 알아서 흐르게 둔다.
 * ------------------------------------------------------------------ */
.custom-law-topic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
}

@media (min-width: 641px) {
    .custom-law-topic-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 769px) {
    .custom-law-topic-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1025px) {
    /* 18개 = 6열 × 3행 */
    .custom-law-topic-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.custom-law-topic-grid .law_category_card.custom-law-topic-card {
    position: relative;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 6px 26px 6px 8px;
    text-align: left;
    white-space: normal;
}

.custom-law-topic-ico {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.custom-law-topic-ico img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.custom-law-topic-label {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: keep-all;
    line-height: 1.25;
}

/* 선택: 색만으로 구분하지 않는다 — 테두리 굵기·굵은 글씨·체크 표식을 함께 바꾼다.
 * 조건 칩과 달리 primary 채움을 쓰지 않는 이유는 아이콘이 컬러 SVG 라
 * 파란 배경 위에서 식별이 떨어지기 때문이다. */
.custom-law-topic-grid .law_category_card.custom-law-topic-card.on {
    border-color: var(--primary-50, #1a6dd6);
    border-width: 2px;
    background: var(--primary-5, #f0f6ff);
    color: var(--primary-70, #0d4a9c);
    font-weight: 700;
    padding: 5px 25px 5px 7px;
    box-shadow: none;
}

.custom-law-topic-grid .law_category_card.custom-law-topic-card.on::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 9px;
    width: 6px;
    height: 11px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: translateY(-65%) rotate(45deg);
}

.custom-law-panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--alpha-g15, #e5e5e5);
}

.custom-law-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 28px;
    flex: 1 1 auto;
}

.custom-law-summary-empty {
    color: var(--gray-60, #999);
    font-size: var(--text-16, 15px);
}

.custom-law-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.custom-law-actions .sub_btn {
    min-height: 36px;
    padding: 0 16px;
    font-size: var(--text-16, 15px);
}

.custom-law-actions .sub_btn:disabled,
.custom-law-actions .sub_btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 2열이 되면 한 칸 폭으로는 세 묶음이 가로로 들어가지 않는다.
 * 줄바꿈된 묶음의 구분선이 엉뚱한 위치에 남으므로 아예 풀어서 세로로 쌓는다. */
@media (max-width: 900px) {
    .custom-law-inline-sets {
        display: block;
    }

    .custom-law-inline-set + .custom-law-inline-set {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
        margin-top: 8px;
    }

}

@media (max-width: 640px) {
    .custom-law-topic-grid .law_category_card.custom-law-topic-card {
        min-height: 40px;
        padding: 5px 22px 5px 6px;
    }

    .custom-law-topic-grid .law_category_card.custom-law-topic-card.on {
        padding: 4px 21px 4px 5px;
    }

    .custom-law-topic-ico {
        width: 20px;
        height: 20px;
    }

    .custom-law-option-grid .law_category_card {
        min-width: 64px;
        padding: 6px 12px;
    }

    .custom-law-option-grid .law_category_card.custom-law-age-card {
        padding: 5px 12px 5px 8px;
    }

    .custom-law-panel-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-law-actions {
        width: 100%;
    }

    .custom-law-actions .sub_btn {
        flex: 1 1 auto;
    }
}

/* 결과 */
#customLawResult[hidden] {
    display: none;
}

.custom-law-result-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 4px solid var(--alpha-g80, #333);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.custom-law-result-head .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.custom-law-result-title {
    margin-bottom: 6px;
}

.custom-law-result-desc {
    color: var(--gray-70, #666);
    font-size: var(--text-18, 17px);
}

.custom-law-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.custom-law-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--primary-50, #1a6dd6);
    color: var(--primary-60, #1256b0);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: var(--text-18, 16px);
    font-weight: 600;
}

/* 조회조건 요약 칩 — 우측 상단 X 로 선택 해제 */
#clSummaryChips button.custom-law-summary-chip {
    position: relative;
    gap: 6px;
    padding: 4px 22px 4px 12px;
    font: inherit;
    font-size: var(--text-18, 16px);
    font-weight: 600;
    line-height: 1.2;
    background: var(--gray-0, #fff);
    cursor: pointer;
}

#clSummaryChips button.custom-law-summary-chip:hover,
#clSummaryChips button.custom-law-summary-chip:focus-visible {
    background: var(--primary-5, #f0f6ff);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(26, 109, 214, 0.16);
}

.custom-law-chip-remove {
    position: absolute;
    top: 3px;
    right: 5px;
    width: 12px;
    height: 12px;
    pointer-events: none;
}

.custom-law-chip-remove::before,
.custom-law-chip-remove::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 1.5px;
    background: currentColor;
    translate: -50% -50%;
}

.custom-law-chip-remove::before {
    rotate: 45deg;
}

.custom-law-chip-remove::after {
    rotate: -45deg;
}

.custom-law-ast-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: visible;
}

.custom-law-ast-group {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-law-ast-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--primary-10, #eaf2fb);
}

.custom-law-ast-title {
    margin: 0;
    font-size: var(--text-19, 18px);
    color: var(--gray-90, #222);
    font-weight: 700;
}

.custom-law-ast-count {
    color: var(--primary-60, #1256b0);
    font-size: var(--text-16, 15px);
    font-weight: 600;
    white-space: nowrap;
}

/* 대분류별 10개 = 데스크톱 5열 × 2행. 박스 높이 통일 + 말줄임, 전체 문구는 .cta 툴팁
 * 그리드 자체 min-height 는 두지 않는다(결과가 적은 분야에 빈 줄이 생김).
 * 넘김(swiper) 묶음의 높이 유지는 .custom-law-ast-swiper .swiper-slide 의 min-height 가 맡는다. */
#clResultGroups .custom-law-result-grid.law_item_grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    align-content: start;
}

.custom-law-result-grid > li {
    min-width: 0;
    height: 64px;
    overflow: visible;
}

.custom-law-result-grid .law_item_btn {
    width: 100%;
    height: 64px;
    min-height: 64px;
    max-height: 64px;
    padding: 8px 10px;
    gap: 0;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--gray-0, #fff);
    border: 1px solid var(--alpha-g40, #ccc);
}

.custom-law-result-grid .law_item_btn:hover,
.custom-law-result-grid .law_item_btn:focus-visible {
    border-color: var(--primary-50, #1a6dd6);
    background: var(--primary-5, #f0f6ff);
    color: var(--primary-70, #0d4a9c);
    font-weight: 600;
}

.custom-law-result-grid .custom-law-item-text {
    display: -webkit-box;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.3;
    font-size: var(--text-16, 15px);
}

/* 퍼블 .cta 기본(left:50% · translate -12%)은 우측 열이 잘림 → fixed 로 재배치(JS) */
.custom-law-result-grid .cta {
    position: fixed;
    left: 0;
    top: 0;
    right: auto;
    bottom: auto;
    z-index: 1000;
    width: min(280px, calc(100vw - 32px));
    max-width: min(280px, calc(100vw - 32px));
    padding: 12px 14px;
    translate: none;
    transform: none;
    box-sizing: border-box;
    pointer-events: none;
}

.custom-law-result-grid .cta:before,
.custom-law-result-grid .cta:after {
    left: 20px;
    right: auto;
}

.custom-law-result-grid .cta.is-above:before,
.custom-law-result-grid .cta.is-above:after {
    top: auto;
    bottom: -13px;
    rotate: 0deg;
}

.custom-law-result-grid .cta.is-align-end:before,
.custom-law-result-grid .cta.is-align-end:after {
    left: auto;
    right: 20px;
}

.custom-law-result-grid .cta dl {
    gap: 4px;
}

.custom-law-result-grid .cta dl dt {
    font-size: var(--text-18, 17px);
}

.custom-law-result-grid .cta dl dd {
    font-size: var(--text-16, 15px);
    -webkit-line-clamp: 4;
}

@media (min-width: 1024px) {
    .custom-law-result-grid li:is(:hover, :focus-within) .cta,
    .custom-law-result-grid .cta.is-open {
        opacity: 1;
        visibility: visible;
        translate: none;
        transform: none;
    }
}

/* 페이징 정상 동작을 위해 swiper overflow 유지. 툴팁은 fixed 라 잘리지 않음 */
#clResultGroups .custom-law-ast-swiper.swiper {
    overflow: hidden;
}

.custom-law-ast-group:has(.custom-law-result-grid > li:is(:hover, :focus-within)) {
    z-index: 20;
}

.custom-law-ast-swiper {
    width: 100%;
    overflow: hidden;
}

.custom-law-ast-swiper .swiper-slide {
    height: auto;
    min-height: calc(64px * 2 + 8px);
    overflow: hidden;
    box-sizing: border-box;
}

.custom-law-ast-controller {
    margin-top: 8px;
}

.custom-law-ast-groups .law_empty_result {
    padding: 40px 16px;
    text-align: center;
    color: var(--gray-70, #666);
}

@media (max-width: 1024px) {
    /* 4열 × 3행(10개) 기준 */
    #clResultGroups .custom-law-result-grid.law_item_grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .custom-law-ast-swiper .swiper-slide {
        min-height: calc(64px * 3 + 8px * 2);
    }
}

@media (max-width: 640px) {
    /* 2열 × 5행(10개) 기준 */
    #clResultGroups .custom-law-result-grid.law_item_grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .custom-law-ast-swiper .swiper-slide {
        min-height: calc(48px * 5 + 6px * 4);
    }

    .custom-law-result-grid > li,
    .custom-law-result-grid .law_item_btn {
        height: 48px;
        min-height: 48px;
        max-height: 48px;
    }

    .custom-law-result-grid .custom-law-item-text {
        display: block;
        white-space: nowrap;
        -webkit-line-clamp: unset;
    }

    .custom-law-result-grid .cta {
        display: none;
    }
}

/* 다크 모드 명도 대비 보정(KWCAG 8) */
@media (prefers-color-scheme: dark) {
    .custom-law-required { background: #2b6cc4; }
}
