:root {
    --discord-blurple: #5865F2;
    --discord-blurple-hover: #4752C4;
    --bg-color: #f6f8fa;
    --card-bg: #ffffff;
    --text-main: #1a1d20;
    --text-muted: #626972;
    --text-disabled: #727b882;
    --border-color: #e1e4e8;
    --search-bar-bg: #5865F2;
    --sidebar-width: 260px;
    --secondary-bg: #f1f3f5;
}

[data-theme='dark'] {
    --bg-color: #1e1f22;
    --card-bg: #2b2d31;
    --text-main: #f2f3f5;
    --text-muted: #949ba4;
    --text-disabled: #727b882;
    --border-color: #3f4248;
    --search-bar-bg: #5865F2;
    --secondary-bg: #35373c;
}
@font-face {
    font-family: 'AtoZ3';
    src: url('../font/3Light.ttf') format('truetype');
    font-style: normal;
}
@font-face {
    font-family: 'AtoZ4';
    src: url('../font/4Regular.ttf') format('truetype');
    font-style: normal;
}

@font-face {
    font-family: 'AtoZ6';
    src: url('../font/6SemiBold.ttf') format('truetype');
    font-style: normal;
}

@font-face {
    font-family: 'AtoZ7';
    src: url('../font/7Bold.ttf') format('truetype');
    font-style: normal;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    font-family: "AtoZ3", sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.05em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
    gap: 32px;
    max-width: 1500px;
    margin: 0 auto;
    margin-top: 32px;
    padding: 0 24px;
}

.sidebar-left,
.sidebar-right {
    position: sticky;
    top: 110px;
    height: calc(100vh - 140px);
    overflow-y: auto;
    background: transparent;
}

.sidebar-left::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar {
    width: 0px;
}

.blog-list {
    min-width: 0;
    padding: 0;
}


/* 광고 박스 고정 */
.ad-box {
    background: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

/* 모바일 대응: 화면이 좁아지면 사이드바 숨기기 */
@media (max-width: 1100px) {
    .main-layout {
        grid-template-columns: 1fr;
        padding: 0 16px;
    }

    .sidebar-left,
    .sidebar-right {
        display: none;
    }
}


/* 상단 메뉴바 */

nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.nav-menu a {
    text-decoration: none;
    margin-right: 10px;
    color: white;
    font-size: 0.9rem;
}

.nav-menu a:hover {
    background-color: var(--discord-blurple);
    color: white;
}

.nav-menu hr {
    border: none;
    border-top: 1px solid var(--border-color);
    
    width: 80%; 
    margin: 2px auto;

}

/* 글 목록 카드 */
.post-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: stretch;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 8px 24px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}


.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.post-card:hover .thumbnail {
    transform: scale(1.03);
}

.thumbnail {
    width: 220px;
    height: 100%;
    min-height: 155px;
    flex-shrink: 0;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.thumbnail-placeholder {
    width: 220px;
    height: 100%;
    min-height: 155px;
    background: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.thumbnail-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.thumbnail-icon::before {
    content: "📝";
    /* 이미지 없을 때 기본 아이콘 폰트 대신 이모지로 세련되게 */
    font-size: 2.2rem;
    opacity: 0.7;
}

.post-content {
    padding: 20px;
    flex-grow: 1;
}

.post-content h2 {
    margin: 0 0 10px 0;
    font-size: 1.4rem;
}

.post-content a {
    text-decoration: none;
    color: var(--text-main);
}

.post-content p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin: 0 0 16px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 다크모드 토글 버튼 */
.theme-toggle {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    font-size: 18px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    transform: scale(1.08);
    background: var(--discord-blurple);
    color: white;
    border-color: var(--discord-blurple);
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .thumbnail {
        width: 120px;
    }
}

.detail-container {
    max-width: 100%;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 8px 24px rgba(0, 0, 0, 0.04);
    margin-bottom: 40px;
}

.content {
    font-size: 1.1rem;
    color: var(--text-main);
    line-height: 1.8;
}

.content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

/* 코드 블록 스타일 (디스코드 느낌) */
pre {
    background: #2f3136;
    color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
}

code {
    font-family: "Consolas", monospace;
}

/* 사이드바 전용 수직 메뉴 스타일 */
.nav-menu-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-menu-vertical h3 {
    letter-spacing: 0.05em;
    font-weight: 700;
    padding-left: 12px;
    margin-bottom: 12px;
}

.nav-menu-vertical a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 14px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.nav-menu-vertical i {
    margin-right: 8px;
    color: var(--text-muted);
}

.nav-menu-vertical a:hover {
    background: var(--secondary-bg);
    color: var(--text-main);
}

/* 현재 선택된 카테고리 강조 (선택 사항) */
.nav-menu-vertical a.active {
    background: var(--discord-blurple);
    color: white;
}

.post-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
    gap: 15px;
}

.post-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.edit-btn {
    background: var(--discord-blurple);
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.2s;
    white-space: nowrap;
}

.edit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}


.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    text-decoration: none;
    color: inherit;
}

.category {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-muted);
}

.category i {
    color: var(--text-disabled);
    margin-right: 6px;
}

.search-input {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-main);
}

/* =========================
   HERO 전체 영역
========================= */
.hero {
    position: relative;
    width: 100%;
    height: 40vh;
    min-height: 370px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: white;
}


.hero-link {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* =========================
   배경 이미지 (캐러셀)
========================= */
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero-bg img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 🔥 꽉 채우기 */
    object-position: center center;
    /* 🔥 잘림 중심 */
    opacity: 0;
    transition: opacity 0.7s ease-in-out;
    z-index: 0;
}

.hero-bg img.active {
    opacity: 1;
}

.hero::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

/* =========================
   중앙 콘텐츠
========================= */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: left;
    max-width: 700px;
    padding: 20px;
    margin-left: 10%;
}

.hero-content h1 {
    font-family: "AtoZ4", sans-serif;
    font-size: 52px;
    margin-bottom: 25px;
}

.hero-content p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 20px;
}

.hero-desc {
    text-align: left;

}

/* =========================
   좌우 버튼
========================= */
.hero-prev,
.hero-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    border: none;
    color: white;
    font-size: 28px;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 3;
    border-radius: 6px;
}

.hero-prev {
    left: 20px;
}

.hero-next {
    right: 20px;
}

.hero-prev:hover,
.hero-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* =========================
   dot 네비게이션
========================= */
.hero-dots {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: 8px;
    z-index: 3;

    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.hero-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.hero-dots .dot.active {
    background: white;
}

/* =========================
   로고 (있을 경우)
========================= */
.hero-logo {
    width: 80px;
    margin-bottom: 15px;
}

/* =========================
   모바일 최적화
========================= */
@media (max-width: 768px) {
    .hero {
        height: 50vh;
    }

    .hero-content h1 {
        font-size: 28px;
    }

    .hero-content p {
        font-size: 14px;
    }

}

.content.ql-editor {
    padding: 0;
    overflow-y: visible;
    font-size: 1.08rem;
    line-height: 1.2;
    color: var(--text-main);
}

.content.ql-editor blockquote {
    border-left: 4px solid var(--discord-blurple);
    padding-left: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    background: var(--secondary-bg);
    padding-top: 8px;
    padding-bottom: 8px;
    border-radius: 0 8px 8px 0;

    /* [추가] 긴 문장 자동 줄바꿈 처리 */
    white-space: pre-wrap;
    /* 공백과 줄바꿈을 유지하면서 너비를 넘으면 줄바꿈 */
    word-break: break-all;
    /* 텍스트가 박스를 벗어나지 않도록 강제 줄바꿈 */
}

/* 코드 블록(Pre) 디스코드 감성 및 줄바꿈/스크롤 해결 */
.content.ql-editor pre.ql-syntax {
    background: #2b2d31 !important;
    color: #f2f3f5 !important;
    border-radius: 8px;
    padding: 16px 20px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.95rem;
    margin: 20px 0;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2);

    /* [추가/변경] 가로 스크롤 및 줄바꿈 설정 */
    white-space: pre-wrap;
    /* 코드 블록 내에서도 가로 스크롤 없이 아래로 줄바꿈하길 원할 때 */
    word-break: break-all;
    overflow-x: auto;
    /* 만약 원래대로 한 줄로 길게 나오고 가로 스크롤바를 원한다면 white-space: pre; 로 두고 이 속성을 켜세요 */
}

/* 다크모드 대응 카테고리 태그 */
.category-tag {
    display: inline-block;
    background: var(--secondary-bg);
    color: var(--discord-blurple);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* 이미지 리사이징 대응 */
.content.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 0 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ql-align-center {
    text-align: center !important;
}

.ql-align-right {
    text-align: right !important;
}

.ql-align-justify {
    text-align: justify !important;
}

/* 이미지 정렬 대응 (이미지도 가운데 정렬 시 영향을 받도록 처리) */
.ql-align-center img {
    margin: 0 auto;
    display: block;
}

.ql-align-right img {
    margin-left: auto;
    display: block;
}


@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr !important;
        /* 1단 구성 강제 */
        gap: 16px;
        padding: 0 16px;
        margin-top: 16px;
    }

    .sidebar-left,
    .sidebar-right {
        display: none !important;
        /* 양쪽 사이드바 숨김 */
    }

    .blog-list,
    .blog-detail-content {
        width: 100% !important;
        min-width: 0;
    }
}

@media (max-width: 768px) {

    /* 1. 상단 네비게이션바 햄버거 메뉴 튜닝 */
    nav {
        padding: 12px 0;
    }

    .nav-container {
        padding: 0 16px;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }

    /* 햄버거 버튼 스타일 정의 */
    .menu-toggle {
        display: block !important;
        font-size: 1.6rem;
        color: var(--text-main);
        cursor: pointer;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 110;
    }

    /* 모바일 탑 다운 메뉴 형태 전환 */
    .nav-menu {
        display: none;
        /* JS 제어용 기본 숨김 */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        gap: 12px;
        box-sizing: border-box;
        z-index: 109;
    }

    /* 토글 활성화 시 */
    .nav-menu.show {
        display: flex !important;
    }

    .nav-menu {
        display: none; /* JS 제어용 */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 20px 16px; /* 안쪽 여백을 넉넉하고 정돈되게 */
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08); /* 그림자를 부드럽게 고도화 */
        gap: 6px; /* 💡 hr 대신 아이템 사이의 간격으로 조절 */
        box-sizing: border-box;
        z-index: 109;
    }

    .nav-menu.show {
        display: flex !important;
    }

    /* 카테고리 대제목 스타일 */
    .nav-menu h3.category {
        font-size: 0.8rem;
        color: var(--text-muted);
        letter-spacing: 0.05em;
        font-weight: 700;
        margin: 0 0 8px 8px;
        text-transform: uppercase;
    }
    
    .nav-menu h3.category i {
        margin-right: 4px;
        opacity: 0.7;
    }

    /* 💡 개별 메뉴 아이템 디자인 (디스코드 앱 메뉴 감성) */
    .nav-menu a.nav-menu-item {
        display: flex;
        align-items: center;
        text-decoration: none;
        color: var(--text-main) !important; /* 글자색 유지 */
        background-color: transparent; /* 기본 배경 투명 */
        font-weight: 600;
        font-size: 0.95rem;
        padding: 12px 14px; /* 터치하기 편하게 영역 확장 */
        border-radius: 8px; /* 둥근 모서리 */
        text-align: left; /* 정직한 중앙 정렬 탈피 */
        width: 100%;
        box-sizing: border-box;
        transition: all 0.2s ease;
    }

    /* 아이콘에 살짝 간격과 색상 부여 */
    .nav-menu a.nav-menu-item i {
        margin-right: 12px;
        width: 18px;
        text-align: center;
        color: var(--text-muted);
        font-size: 1.05rem;
        transition: color 0.2s ease;
    }

    /* 🔥 누르거나 Hover했을 때 촌티를 벗겨낼 하이라이트 효과 */
    .nav-menu a.nav-menu-item:hover,
    .nav-menu a.nav-menu-item:active {
        background: var(--secondary-bg) !important; /* 살짝 어두운/밝은 디스코드식 배경 */
        color: var(--text-main) !important;
    }
    
    .nav-menu a.nav-menu-item:hover i {
        color: var(--discord-blurple); /* 호버 시 아이콘은 블러플 색상으로 포인트 */
    }

    /* 2. Hero 배너 영역 반응형 크래시 해결 */
    .hero {
        height: auto !important;
        min-height: 240px !important;
    }

    .hero-content {
        margin-left: 20px !important;
        /* 왼쪽 여백 축소 */
        padding: 16px;
        width: calc(100% - 40px);
    }

    .hero-content h1 {
        font-size: 24px !important;
        margin-bottom: 16px !important;
        line-height: 1.3;
    }

    .hero-content p {
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }

    .hero-prev,
    .hero-next {
        padding: 6px 10px !important;
        font-size: 20px !important;
    }

    .post-card {
    flex-direction: column !important; 
    border-radius: 12px;
    margin-bottom: 16px;
    }

    .post-card > a {
        flex-direction: column !important;
        width: 100%;
    }

    .thumbnail, .thumbnail-placeholder {
        width: 100% !important;   /* 👈 이제 100%를 주어도 아래로 밀릴 뿐 글자가 사라지지 않습니다! */
        height: 180px !important;
        min-height: 180px !important;
    }


    .post-content {
        padding: 16px !important;
    }

    .post-content h2 {
        font-size: 1.2rem !important;
        margin-bottom: 8px !important;
    }

    .post-content a {
        text-decoration: none;
        color: var(--text-main);
    }

    .post-content p {
        display: block !important;
        -webkit-line-clamp: unset !important;
        overflow: visible !important;
    }

    .post-content .meta {
        flex-wrap: wrap;
        /* 메타 데이터가 넘칠 때 줄바꿈 */
        font-size: 0.8rem !important;
        gap: 4px 8px !important;
    }

    /* 4. 상세 보기 페이지 패딩 조율 */
    .detail-container {
        padding: 20px 16px !important;
        /* 모바일용 안쪽 여백 축소 */
        border-radius: 12px;
    }

    .detail-container h1 {
        font-size: 1.5rem !important;
        /* 타이틀 폰트 크기 최적화 */
        margin: 10px 0 !important;
        line-height: 1.4;
    }

    .post-meta-row {
        flex-direction: column !important;
        /* 메타 정보와 수정 버튼 세로 배열 */
        align-items: flex-start !important;
        gap: 12px !important;
        padding-bottom: 12px !important;
        margin-bottom: 20px !important;
    }

    .edit-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .content.ql-editor {
        font-size: 1rem !important;
        /* 본문 가독성 보정 */
    }

    /* 코드 블록 스크롤 강제 및 삐져나옴 방지 */
    .content.ql-editor pre.ql-syntax {
        padding: 12px 14px !important;
        font-size: 0.85rem !important;
        white-space: pre-wrap !important;
        /* 화면을 벗어나면 자동 줄바꿈 원할 시 */
        word-break: break-all !important;
    }

    /* 우측 하단 테마 버튼 모바일 위치 */
    .theme-toggle {
        bottom: 20px !important;
        right: 20px !important;
        width: 42px !important;
        height: 42px !important;
        font-size: 16px !important;
    }
}

/* PC 화면 초기 햄버거 메뉴 숨김 정의 */
.menu-toggle {
    display: none;
}

#navMenu {
    display: none;
}

.pagination {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    background: var(--card-bg);
    transition: all 0.2s ease;
    font-size: 14px;
}

.page-btn:hover {
    background: var(--discord-blurple);
    color: white;
}

.page-btn.active {
    background: var(--discord-blurple);
    color: white;
    font-weight: bold;
}