/*
 Theme Name:     GeneratePress Child2 (Custom Homepage)
 Theme URI:      https://generatepress.com
 Description:    GeneratePress Child Theme with a custom homepage for web services.
 Author:         [여기에 본인 이름 또는 닉네임 입력]
 Author URI:     [웹사이트 주소 입력]
 Template:       generatepress
 Version:        1.1.0
 License:        GNU General Public License v2 or later
 License URI:    http://www.gnu.org/licenses/gpl-2.0.html
*/

/* --- 전역 CSS 변수 정의 --- */
:root {
    --primary-color: #0073aa;
    --secondary-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --light-gray: #f9f9f9;
}

/* --- 공통 타이틀 --- */
.homepage-title {
    text-align: left;
    font-size: 1.8em;
    margin: 0 0 30px;
    font-weight: 700;
}

/* --- 공통 섹션 컨테이너 --- */
.homepage-section {
    padding: 30px 30px;
    background-color: #fff;
}
.homepage-section:nth-child(odd) {
    background-color: #fff;
}

/* --- 섹션 내부 공통 래퍼 --- */
.homepage-inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- 공통 그리드 레이아웃 --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin: 0 auto;
}

/* --- 공통 카드 스타일 (서비스 & 최신글 공유) --- */
.card {
    display: flex;
    flex-direction: column;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 20px 20px;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
    text-align: left;
}
.card-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    text-align: left;
}

/* --- 웹서비스 카드(서비스 카드) 설명 3줄 제한 --- */
.service-card .card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;      /* 최대 3줄 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.5em;          /* 최대 3줄까지만 보이게 */
    line-height: 1.5;           /* 줄 간격 (있어도 되고 없어도 됨, 통일용) */
}

/* PC 이상에서만: 항상 3줄 높이 확보 */
@media (min-width: 769px) {
    .service-card .card-desc {
        min-height: 4.5em;   /* 3줄 높이 */
    }
}

/* --- 서비스 카드 전용 (아이콘은 출력 안 하지만 클래스는 남겨둠) --- */
.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    color: var(--primary-color);
    align-self: center;
}

.text-post-card .card-desc {
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;          /* 최대 3줄 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.5em;              /* 1.5(line-height) * 3줄 */
}

.text-post-card .post-date {
    font-size: 0.85rem;
    color: #777;
    margin-top: auto; /* 날짜를 카드 하단에 위치 */
    align-self: flex-start;
}

/* --- FAQ 카드 리스트 --- */
.faq-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* FAQ 카드 자체는 기존 .card 스타일을 상속받고, 약간만 덜 '버튼같게' */
.faq-card {
    padding: 20px;
    cursor: default;
}

/* 질문 영역 버튼 */
.faq-question {
    width: 100%;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    text-align: left;
    font-size: 0.98rem;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

/* --- FAQ 카드 호버 시 글자색 유지 --- */
.faq-card {
    color: var(--text-color);
}

.faq-card .faq-question,
.faq-card .faq-question-text,
.faq-card .faq-answer {
    color: var(--text-color);
}

/* 카드에 호버/포커스가 들어와도 글자색 고정 */
.faq-card:hover,
.faq-card:focus-within {
    color: var(--text-color);
}

.faq-card:hover .faq-question,
.faq-card:hover .faq-question-text,
.faq-card:hover .faq-answer,
.faq-card:focus-within .faq-question,
.faq-card:focus-within .faq-question-text,
.faq-card:focus-within .faq-answer {
    color: var(--text-color);
}

/* 혹시 버튼 기본 스타일이 또 덮어쓰면 대비용 */
.faq-question {
    color: var(--text-color);
    background: transparent;
}
.faq-question:hover,
.faq-question:focus,
.faq-question:active {
    color: var(--text-color);
    background-color: transparent;
    outline: none;
    box-shadow: none;
}


/* 질문 텍스트 */
.faq-question-text {
    flex: 1;
    line-height: 1.5;
}

/* 오른쪽 토글 아이콘 (+ / -) */
.faq-toggle-icon {
    flex: 0 0 16px;
    height: 16px;
    margin-left: 8px;
    position: relative;
}

.faq-toggle-icon::before,
.faq-toggle-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    background: #999;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
}

/* 세로 막대 (기본은 + 모양) */
.faq-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* 열렸을 때는 - 모양으로 변경 (세로 막대 숨김 효과) */
.faq-question.open .faq-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg) scaleX(0);
}

/* 답변 영역 */
.faq-answer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
}

.faq-answer p {
    margin: 0;
}

/* --- 데스크탑 이상에서만 FAQ 답변 4줄 제한 --- */
@media (min-width: 769px) {
    .faq-answer p {
        display: -webkit-box;
        -webkit-line-clamp: 8;          /* 최대 4줄만 노출 */
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-height: 12.8em;              /* line-height(1.6) * 4줄 = 6.4em */
    }
}

/* =========================================================
   웹서비스: 모바일에서 4개만 노출 + "더보기" 카드
   ========================================================= */

/* 모바일: 4개 이후 웹서비스 카드 숨김 + 더보기 카드 표시 */
@media (max-width: 768px) {
    .services-grid .grid > .service-card.extra-service-card {
        display: none;
    }

    .service-more-card {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        cursor: pointer;
    }
}

/* 데스크탑: 더보기 카드 숨김 */
@media (min-width: 769px) {
    .service-more-card {
        display: none;
    }
}

/* 더보기 카드 텍스트 */
.service-more-card .service-more-text {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* 기본 텍스트 색 고정 */
.service-more-card,
.service-more-card .service-more-text {
    color: var(--text-color);
}

/* 호버/포커스/클릭 시에도 색/배경/음영 그대로 유지 */
.service-more-card:hover,
.service-more-card:focus,
.service-more-card:active {
    color: var(--text-color);
    background-color: var(--secondary-color); /* 배경색 변하지 않게 */

    box-shadow: 0 2px 5px rgba(0,0,0,0.05);   /* 기본 카드 그림자 수준으로 고정 */

}

/* 안쪽 텍스트 색도 hover 시 고정 */
.service-more-card:hover .service-more-text,
.service-more-card:focus .service-more-text,
.service-more-card:active .service-more-text {
    color: var(--text-color);
}


/* 더보기 카드 플러스 아이콘 (+ 표시) */
.service-more-icon {
    width: 16px;
    height: 16px;
    margin-left: 8px;
    position: relative;
    flex: 0 0 16px;
}

.service-more-icon::before,
.service-more-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 2px;
    background: #999;
    transform: translate(-50%, -50%);
}

/* 세로 막대 */
.service-more-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* =========================================
   웹서비스 더보기 카드: + 아이콘 우측 정렬
   ========================================= */

/* 모바일에서 정렬 변경 (row 레이아웃, 양 끝 정렬) */
@media (max-width: 768px) {
    .services-grid .grid > .service-card.extra-service-card {
        display: none;
    }

    .service-more-card {
        display: flex;
        flex-direction: row;      /* 가로로 배치 */
        align-items: center;
        justify-content: center;  /* 텍스트를 중앙으로 */
        text-align: center;
        cursor: pointer;

        padding: 20px;            /* FAQ 카드(.faq-card)와 같은 높이 느낌 */
        position: relative;       /* 아이콘을 오른쪽에 고정하기 위해 기준점 */
    }

    .service-more-card .service-more-text {
        flex: 0 0 auto;
        width: 100%;              /* 가운데 정렬 위해 전체 너비 차지 */
        text-align: center;       /* 텍스트 중앙 정렬 */
    }

    .service-more-icon {
        position: absolute;
        right: 20px;              /* 카드 오른쪽 여백 (FAQ 느낌에 맞게 조정 가능) */
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0;           /* 이전 margin-left는 무시 */
        flex: none;
    }
}


/* 배지 묶음: 카드 하단 왼쪽으로 */
.service-card .service-badges {
    margin-top: auto;         /* 카드 맨 아래로 밀기 */
    align-self: flex-start;   /* 왼쪽 정렬 */
    display: flex;
    flex-wrap: wrap;
    gap: 6px;                 /* 배지 사이 간격 */
	min-height: 24px;
}

/* 개별 배지 스타일 */
.service-card .service-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;

    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;

    background-color: #f1f3f5;
    color: #555;
    border: 1px solid #e0e0e0;
}

/* 타입별 색상 예시 */
.service-card .service-badge.badge-new {
    background-color: #e6f4ff;
    border-color: #c2e0ff;
    color: #0053a0;
}

.service-card .service-badge.badge-opendata {
    background-color: #e8f5e9;
    border-color: #c8e6c9;
    color: #1b5e20;
}

.service-card .service-badge.badge-updated {
    background-color: #fff3e0;
    border-color: #ffe0b2;
    color: #e65100;
}


/* =========================================================
   FAQ: 모바일에서 4개만 노출 + "더보기" 카드
   ========================================================= */
@media (max-width: 768px) {
    /* 4개 이후 FAQ 카드 숨김 */
    .faq-list .faq-card.extra-faq-card {
        display: none;
    }

    /* FAQ 더보기 카드 보이기 */
    .faq-more-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        text-align: center;
        cursor: pointer;
        position: relative;
    }

    .faq-more-card .faq-more-text {
        flex: 0 0 auto;
        width: 100%;
        text-align: center;
        font-size: 1rem;
        font-weight: 600;
        margin: 0;
    }

    .faq-more-icon {
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
    }

    .faq-more-icon::before,
    .faq-more-icon::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 14px;
        height: 2px;
        background: #999;
        transform: translate(-50%, -50%);
    }

    .faq-more-icon::after {
        transform: translate(-50%, -50%) rotate(90deg); /* + 모양 */
    }
}

/* 데스크탑: FAQ 더보기 버튼 숨김 (모든 FAQ 항상 보이기) */
@media (min-width: 769px) {
    .faq-more-card {
        display: none;
    }
}


/* FAQ 더보기 카드: hover 시 색/배경 고정 */
.faq-more-card,
.faq-more-card .faq-more-text {
    color: var(--text-color);
}

/* 호버/포커스/클릭 시에도 색/배경/음영 그대로 유지 */
.faq-more-card:hover,
.faq-more-card:focus,
.faq-more-card:active {
    color: var(--text-color);
    background-color: var(--secondary-color); /* 배경색 변하지 않게 */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);   /* 기본 카드 그림자 수준으로 고정 */
}

/* 안쪽 텍스트 색도 hover 시 고정 */
.faq-more-card:hover .faq-more-text,
.faq-more-card:focus .faq-more-text,
.faq-more-card:active .faq-more-text {
    color: var(--text-color);
}
