/* 추천 영역 제목 폰트 크기 조정 */
#recommendation-section .section-title {
    font-size: 2.0rem !important;
}

/* 맞춤형 추천 콘텐츠 섹션 CSS */
.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    /*margin-bottom: 40px;*/
}

.rec-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.rec-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.rec-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.rec-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.rec-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.rec-card:hover .rec-img img {
    transform: scale(1.05);
}

.rec-content {
    padding: 20px;
}

.rec-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.rec-date {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

/* 이미지 대체 플레이스홀더 (텍스트 스니펫용) */
.rec-img-placeholder.text-placeholder {
    padding: 24px;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #334155;
    font-weight: 500;
    text-align: left;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    position: relative;
    box-sizing: border-box;
}
.rec-card:hover .rec-img-placeholder.text-placeholder {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
}
.text-snippet {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
    z-index: 1;
    font-style: normal;
}
.text-snippet::before {
    content: '"';
    font-size: 3.5rem;
    color: rgba(0,0,0,0.08);
    position: absolute;
    top: -15px;
    left: -10px;
    font-family: serif;
    z-index: -1;
    line-height: 1;
    transition: color 0.4s ease;
}
.rec-card:hover .text-snippet::before {
    color: rgba(67, 56, 202, 0.15);
}

/* 폰트어썸 아이콘 대체 방식 (안전장치) */
.rec-img-placeholder i {
    font-size: 3.5rem;
    color: #94a3b8;
    transition: all 0.4s ease;
}
.rec-card:hover .rec-img-placeholder i {
    transform: scale(1.1);
    color: #6366f1;
}

/* 뷰 모드 토글 컨트롤 */
.rec-view-controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 5px;
}
.btn-view-mode {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: #475569;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}
.btn-view-mode:hover {
    background: #e2e8f0;
}
.btn-view-mode.active {
    background: #3b82f6;
    color: #fff;
    border-color: #2563eb;
}

/* 기본 그룹 숨김 처리 (카드형, 웹진형) */
.view-card .group-title, .view-webzine .group-title {
    display: none;
}
.view-card .rec-group-recs, .view-card .rec-group-recent,
.view-webzine .rec-group-recs, .view-webzine .rec-group-recent {
    display: contents;
}

/* 웹진 뷰 스타일 (.view-webzine) */
.view-webzine .recommendation-grid {
    grid-template-columns: 1fr;
    gap: 16px;
}
.view-webzine .rec-card a {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}
.view-webzine .rec-img, .view-webzine .rec-img-placeholder {
    width: 250px;
    height: 150px;
    flex-shrink: 0;
}
.view-webzine .rec-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 24px;
}
.view-webzine .rec-title {
    font-size: 1.25rem;
    margin-bottom: 8px;
    -webkit-line-clamp: 1;
}
.view-webzine .rec-summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.95rem;
    color: #64748b;
    margin: 0 0 10px 0;
    line-height: 1.5;
}
.view-webzine .text-snippet {
    -webkit-line-clamp: 2;
}
.rec-summary {
    display: none;
}
.view-webzine .rec-date {
    margin-top: auto;
}

/* 리스트 뷰 스타일 (.view-list) - 공지사항 스타일 (2단 분리) */
.view-list .recommendation-grid {
    display: flex;
    flex-direction: row;
    gap: 40px;
}
.view-list .rec-group-recs, .view-list .rec-group-recent {
    flex: 1;
    min-width: 0;
}
.view-list .group-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    border-bottom: 2px solid #111;
    padding-bottom: 12px;
    color: #111;
}
.view-list .rec-card {
    box-shadow: none;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 0;
    background: transparent;
}
.view-list .rec-card:hover {
    transform: none;
}
.view-list .rec-card:last-child {
    border-bottom: none;
}
.view-list .rec-card a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row;
}
.view-list .rec-img {
    display: none;
}
.view-list .rec-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0;
}
.view-list .rec-title {
    color: #334155;
    font-size: 0.95rem;
    font-weight: 400;
    margin: 0 15px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: unset;
    display: block;
    flex: 1;
}
.view-list .rec-card a:hover .rec-title {
    color: #2563eb;
    font-weight: 500;
}
.view-list .rec-date {
    color: #94a3b8;
    font-size: 0.85rem;
    white-space: nowrap;
    margin: 0;
}

/* 모바일 반응형 */
@media (max-width: 991px) {
    .recommendation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .view-list .recommendation-grid {
        flex-direction: column;
        gap: 30px;
    }
}
@media (max-width: 576px) {
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
    .rec-view-controls {
        width: 100%;
        justify-content: flex-end;
    }
    .recommendation-grid {
        grid-template-columns: 1fr;
    }
    .rec-img {
        height: 200px;
    }
    .view-webzine .rec-card a {
        flex-direction: column;
    }
    .view-webzine .rec-img, .view-webzine .rec-img-placeholder {
        width: 100%;
        height: 200px;
    }
}

/* ──────────────────────────────────────────────────────────────
   카드형 보기 — 모바일에서 한 줄에 두 개
   576px 이하에서는 위쪽 규칙이 한 줄에 하나로 잡는다. 카드형만
   두 칸으로 되돌린다. 이름 두 겹 (0,2,0) 이라 (0,1,0) 을 이긴다.
   리스트형·웹진형은 지금 그대로 한 줄에 하나다.
   ────────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
    .view-card .recommendation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    /* 폭이 반으로 줄었으니 사진과 글자도 함께 조인다 */
    .view-card .rec-img {
        height: 120px;
    }

    .view-card .rec-content {
        padding: 12px;
    }

    .view-card .rec-title {
        font-size: 0.92rem;
        margin-bottom: 6px;
        line-height: 1.35;
    }

    .view-card .rec-date {
        font-size: 0.75rem;
    }

    /* 좁은 칸에서 제목이 넘치지 않게 */
    .view-card .rec-card {
        min-width: 0;
    }

    /* 사진이 없어 «글월» 을 대신 보여 주는 칸.
       폭이 반으로 줄면 글자가 그대로라 줄이 잘려 보인다.
       글자·여백·줄 수를 함께 조인다. */
    .view-card .rec-img-placeholder.text-placeholder {
        padding: 12px 12px 10px;
        font-size: 0.8rem;
        line-height: 1.5;
    }

    .view-card .text-snippet {
        -webkit-line-clamp: 5;
    }

    /* 큰 따옴표 꾸밈은 좁은 칸에서 자리만 차지한다 */
    .view-card .text-snippet::before {
        display: none;
    }
}

/* ──────────────────────────────────────────────────────────────
   게시판 딱지 — 제목 앞에 붙는다 (리스트형·웹진형·카드형 모두)
   원색으로 튀지 않게 옅은 바탕 + 짙은 글자 (커서룰 §9.1)
   ────────────────────────────────────────────────────────────── */
.rec-tag {
    /* 세로 가운데 맞추기 — 한글은 CSS 만으로는 가운데에 오지 않는다.
       글꼴의 «아래 여유»(g·y 같은 내림 글자를 위한 자리)를 한글은 쓰지
       않아서, line-height 를 어떻게 주어도 글자가 위쪽에 앉는다.
       실제로 stretch/center × 줄높이 12~20px 여덟 가지를 찍어 견줬는데
       모두 같은 자리였다. 그래서 위 안여백으로 «밀어» 준다.
       밀기 0·1·2·3px 을 7배로 키워 견준 결과 2px 이 가운데였다. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 22px;
    padding: 2px 8px 0;
    /* 제목 글자와 눈높이 맞추기 — 실제 화면 글꼴(Pretendard)로 재서 정했다.
       딱지 가운데와 제목 글자 가운데의 차이(px):
         middle 2.61 · baseline 1.78 · 1px 0.78 · 2px -0.22 · 3px -1.22
       위 안여백 2px 을 준 뒤로 기준선이 달라져, 예전 값 3px 은 안 맞는다. */
    vertical-align: 2px;
    margin-right: 6px;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 게시판별 색 — 없는 구분은 위의 기본(회색)을 쓴다 */
.rec-tag-free      { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.rec-tag-gallery   { background: #fdf2f8; border-color: #fbcfe8; color: #be185d; }
.rec-tag-pinboard  { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.rec-tag-notice    { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.rec-tag-research  { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.rec-tag-webzine,
.rec-tag-webzineo  { background: #ecfeff; border-color: #a5f3fc; color: #0e7490; }
/* 게시판이 아닌 것 — 웹페이지·캠페인 따위 */
.rec-tag-\@\@\@webpage,
.rec-tag-\@\@\@static    { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }
.rec-tag-\@\@\@campaign  { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.rec-tag-\@\@\@event     { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.rec-tag-\@\@\@volunteer { background: #f0fdfa; border-color: #99f6e4; color: #0f766e; }
.rec-tag-\@\@\@blog      { background: #faf5ff; border-color: #e9d5ff; color: #7e22ce; }

/* 리스트형에서만 딱지 가로 폭을 하나로 맞춘다 — 줄줄이 늘어서므로
   왼쪽 끝이 가지런해야 읽기 좋다. 긴 이름은 … 로 줄인다.
   카드형·웹진형은 글자만큼만 차지한다. */
.view-list .rec-tag {
    width: 78px;
    padding: 2px 6px 0;   /* 위 2px 은 한글 밀기 (기본 규칙과 같다) */
}

/* ──────────────────────────────────────────────────────────────
   미리보기 글월을 더 많이 보여 준다
   ────────────────────────────────────────────────────────────── */

/* 웹진형 줄거리는 칸이 넓어 그대로 늘려도 된다 */
.view-webzine .rec-summary {
    -webkit-line-clamp: 4;
}

/* 글월 칸은 «상자 높이가 정해져 있다». 줄 수만 늘리면 넘쳐서 마지막 줄이
   반쯤 잘린다. 글자와 줄간격을 함께 줄여야 줄 수를 늘릴 수 있다.
     웹진형  상자 150px · 안여백 14×2 → 속 122px
     카드형  상자 180px · 안여백 16×2 → 속 148px            */
.view-webzine .rec-img-placeholder.text-placeholder {
    padding: 14px 16px;
    font-size: 0.85rem;
    line-height: 1.45;
}

.view-webzine .text-snippet {
    -webkit-line-clamp: 6;
}

.view-card .rec-img-placeholder.text-placeholder {
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.45;
}

.view-card .text-snippet {
    -webkit-line-clamp: 7;
}

@media (max-width: 991px) {
    .view-webzine .rec-summary { -webkit-line-clamp: 3; }
    .view-webzine .text-snippet { -webkit-line-clamp: 5; }
}

@media (max-width: 576px) {
    /* 좁은 화면에서는 알맞게 잘라 낸다 */
    .view-webzine .rec-summary { -webkit-line-clamp: 2; }
    .view-webzine .text-snippet { -webkit-line-clamp: 3; }
    .view-card .text-snippet { -webkit-line-clamp: 5; }

    .rec-tag {
        height: 20px;
        line-height: 1;
        font-size: 0.66rem;
        padding: 2px 6px 0;   /* 위 2px 은 한글 밀기 */
        margin-right: 4px;
    }

    .view-list .rec-tag {
        width: 64px;
        padding: 2px 4px 0;
    }
}

/* ──────────────────────────────────────────────────────────────
   구역 제목·구분선 다듬기
   ────────────────────────────────────────────────────────────── */

/* 「DIAL님을 위한 맞춤 추천」 아래 여백 — 공통 .section-header 는 50px 이라
   이 구역에서는 지나치게 벌어진다. */
#recommendation-section .section-header {
    margin-bottom: 20px;
}

/* 「맞춤 추천」·「최근 열람한 페이지」 아래 가로선
   2px 짙은 먹선(#111)은 눈에 너무 세다. 옅게 하고 위아래도 조인다. */
.view-list .group-title {
    font-size: 1.05rem;
    margin: 0 0 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

/* 줄과 줄 사이 가로선 — 「최신 콘텐츠」처럼 한 덩어리만 나오는 때에도
   줄이 구분되도록 색을 조금 또렷하게 한다(원래 #f1f5f9 는 거의 안 보인다). */
.view-list .rec-card {
    border-bottom: 1px solid #eef2f7;
}
