* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    background: #f3f3f3;
    font-size: 14px;
    color: #222;
}

/* 2. 이미지 컨테이너: 여백 제로 설정 */
.header-banner-container {
  grid-column: 1 / -1;
  line-height: 0;      /* 이미지 하단 미세 틈 제거 */
  overflow: hidden;
  border-radius: 0 0 8px 8px; /* 위는 각지게, 아래만 라운드 */
  border: 1px solid var(--border);
  border-top: none;    /* 헤더와 겹치는 선 제거 */
  margin-bottom: 10px;
}

/* 3. 이미지 태그: 블록화 */
.header-banner-container img {
  width: 100%;
  display: block;      /* 인라인 여백 제거 필수 */
  margin: 0;
  padding: 0;
}

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0;
    background-color: #fff;
}

/* 헤더 */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap;
    gap: 8px;
    background-color: white;
    padding-right:20px;
}

.logo-area img { height: 48px; }
.top-util { display: flex; gap: 12px; flex-wrap: wrap; }
.top-util a {
    font-size: 12px;
    color: #555;
    text-decoration: none;
}
.top-util a.orange { color: #e07000; font-weight: 700; }
.top-util a:hover { color: #1a3a6b; }

/* 내비 */
.header-banner-group header {
    background: #26734d;
    margin-bottom: 12px;
    color: white;
    padding: 10px 0;
    font-weight: bold;
}
.main-nav {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}
.main-nav li a {
    display: block;
    padding: 10px 18px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 15px;
}
.main-nav li a:hover { color: #c8a951; }

/* 콘텐츠 레이아웃 */
.contents-wrap {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 14px;
    align-items: start;
    padding: 0 10px 10px 10px; 
}

/* 사이드바 */
.sidebar { display: flex; flex-direction: column; gap: 10px; }

.side-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 12px;
    color: #555;
    line-height: 1.8;
}
.side-menu-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.side-menu-list,
.side-submenu-list { list-style: none; }
.side-menu-list li a,
.side-submenu-list li a {
    display: block;
    padding: 7px 12px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}
.side-menu-list li:last-child a,
.side-submenu-list li:last-child a { border-bottom: none; }
.side-menu-list li a:hover,
.side-submenu-list li a:hover { background: #f7f5f0; color: #1a3a6b; }
    
.side-menu-list li a {
    padding: 12px 15px; /* 기존 7px에서 12px 정도로 확장 */
}

/* 메인 게시판 */
.board-section { min-width: 0; }

.board-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}
.board-title {
    background: #1a3a6b;
    color: #fff;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
}
.post-header {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
}
.post-subject {
    font-size: 14px;
    font-weight: 700;
    color: #1a3a6b;
    margin-bottom: 6px;
}
.post-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #777;
}
.post-read {
    padding: 14px;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

/* 게시글 목록 */
.board-list {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}
.post-list { list-style: none; }
.post-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid #cdcdcd;
    gap: 8px;
}

/* 짝수(even) 번째 리스트 아이템에 바탕색 적용 */
.post-list li:nth-child(even) {
    background-color: #e0ebeb;
}

.post-list li:last-child { border-bottom: none; }
.post-list .subject {
    font-size: 13px;
    color: #222;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-list a { text-decoration: none; flex: 1; min-width: 0; }
.post-list a:hover .subject { color: #1a3a6b; text-decoration: underline; }
.post-list span:last-child {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.attached-file ul {
    margin: 0;
    padding: 0;
    list-style: none;
    margin-bottom: 10px;
}

.attached-file ul li {
    padding: 3px 0;
    border-bottom: 1px dashed #e5e5e5;
}

.attached-file ul li:last-child {
    border-bottom: 1px solid #ededed;
}

.attached-file a {
    text-decoration: none;
    color: #5211f7;
    font-size: 14px;
    font-weight: bold;
}

.attached-file a:hover {
    color: #769741;
    text-decoration: underline;
}

/* 페이지네이션 */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
}
.pagination a {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    background: #fff;
}
.pagination a:hover { background: #eef2f8; color: #1a3a6b; }
.pagination a.active {
    background: #1a3a6b;
    color: #fff;
    border-color: #1a3a6b;
    font-weight: 700;
}

/* 푸터 */
.footer {
    background: #1a3a6b;
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 16px;
    border-radius: 0 0 6px 6px;
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.8;
}

    /* ── 햄버거 버튼 (PC에서 숨김) ── */
    .hamburger-btn {
        display: none;
        /*display: flex; *//* none에서 flex로 변경 (모바일 매체쿼리 안에서 처리 권장) */

        flex-direction: column;
        justify-content: center;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 6px;

        position: static;
    }

    .hamburger-btn span {
        display: block;
        width: 24px;
        height: 2px;
        background: #1a3a6b;
        border-radius: 2px;
        transition: all 0.3s ease-in-out; /* 0.7초는 너무 느리므로 0.3~0.4초 권장 */
    }

    /* 클릭 시 상태 (X자 변경) */
    .hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger-btn.open span:nth-child(2) { opacity: 0; }
    .hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* 사이드바 닫기 버튼 (PC에서 숨김) */
    .sidebar-close {
        display: none;
        width: 100%;
        padding: 10px 12px;
        background: #f0f0f0;
        border: none;
        cursor: pointer;
        font-size: 13px;
        text-align: right;
        color: #555;
        border-radius: 4px;
        margin-bottom: 10px;
    }

    /* ── 오버레이 ── */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.45);
        z-index: 99;
    }
    .sidebar-overlay.open { display: block; }

    @media (max-width: 768px) {
        /* 텍스트 링크 숨기고 햄버거 버튼 표시 */
        .top-util { display: none; }
        .hamburger-btn { display: flex; }
        .sidebar-close { display: block; }

        /* 1컬럼 레이아웃 */
        .contents-wrap { grid-template-columns: 1fr; 
                         padding: 12px; 
                         gap: 12px; }
        
        .header-banner-container {
            margin-bottom: 0px;
        }

        /* 사이드바 → 슬라이드 오버레이 */
        .sidebar {
            display: block !important;
            position: fixed;
            top: 0;
            left: -270px;
            width: 260px;
            height: 100%;
            background: #fff;
            z-index: 100;
            overflow-y: auto;
            padding: 15px;
            box-shadow: 2px 0 10px rgba(0,0,0,0.2);
            transition: left 0.3s ease;
            flex-direction: column;
            gap: 12px;
        }
        .sidebar.open { left: 0; }

        .post-subject { font-size: 15px; }
        .post-info { flex-direction: column; gap: 4px; }
        .view-content { padding: 14px; font-size: 13px; }
        .search-box form { justify-content: flex-start; }
        .search-box input { flex: 1; }
    }

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex; /* 모바일에서만 보임 */
    }
    .top-util {
        display: none; /* 모바일에서 PC용 텍스트 링크 숨김 */
    }
}

@media (max-width: 768px) {
    .sidebar {
        /* 1. PC에서 숨겨져 있을 수 있으므로 강제로 표시 */
        display: block !important; 
        
        /* 2. 위치 설정 */
        position: fixed;
        top: 0;
        left: -270px; /* 처음엔 숨김 */
        width: 260px;
        height: 100%;
        background: #fff;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    /* 3. open 클래스가 붙었을 때 화면에 등장 */
    .sidebar.open {
        left: 0 !important;
    }
}

/* 반응형 */
@media (max-width: 768px) {
    .main-nav li a { padding: 8px 12px; font-size: 13px; }
    .post-info { flex-direction: column; gap: 2px; }
}

/* [수정] 480px 이하에서 위아래로 떨어지는 문제 해결 */
@media (max-width: 480px) {
    .post-list li { 
        /* flex-direction: column; 을 제거하거나 row로 고정 */
        flex-direction: row !important; 
        justify-content: space-between;
        align-items: center;
        gap: 10px; 
    }
    
    .post-list a {
        flex: 1;
        min-width: 0; /* flex 안에서 ellipsis 작동을 위한 필수 설정 */
    }

    .board-list .subject {
        /* 한 줄 고정 및 말줄임표 필수 속성 */
        display: block;
        max-width: 18ch; /* 480px~375px 사이에서도 안전하게 18~20ch 추천 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .post-list span:last-child { 
        font-size: 12px; 
        flex-shrink: 0; /* 날짜가 찌그러지지 않게 */
        white-space: nowrap;
    }
}

/* 400px 이하 아주 작은 화면 대응 */
@media (max-width: 480px) {
    .board-list .subject {
        max-width: 38ch; /* 화면이 더 작아지면 글자수를 더 제한 */
    }
    .header-top-row .top-util {
        padding-left: 15px;
    }
}

@media (max-width: 768px) {

    /* 콘텐츠 랩의 좌우 패딩 제거 또는 최소화 */
    .contents-wrap {
        grid-template-columns: 1fr;
        padding: 10px; /* 좌우 패딩을 0으로 만들어 꽉 차게 함 */
        gap: 10px;
    }

    /* 게시판 박스의 테두리와 둥근 모서리를 제거하여 넓게 보임 */
    .board-item, .board-list {
        border-left: none;
        border-right: none;
        border-radius: 0; /* 모바일에서는 꽉 차게 보이는 게 시원합니다 */
        margin-bottom: 10px;
    }

    /* 제목 바의 좌우 여백 조정 */
    .board-title {
        padding: 10px 15px;
        border-radius: 0;
    }

    /* 게시글 리스트의 내부 여백 조정 */
    .post-list li {
        padding: 8px 6px; /* 좌우 패딩을 조금 더 줄임 */
    }

    .header-top-row {
        padding-right: 10px;
    }

    .container {
        padding-bottom: 0;
    }
    
    .post-read img.almafoto {
        width: 100%;
    }
}