@font-face {
    font-family: 'GangwonEdu_OTFBoldA';
    src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/noonfonts_2201-2@1.0/GangwonEdu_OTFBoldA.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
/* =========================
   1. 색상 팔레트 import
========================= */
@import url('colors.css');

/* =========================
   2. 기본 레이아웃/타이포
========================= */
html{
    font-size: 16px;
}
body {
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    font-family: 'GangwonEdu_OTFBoldA', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: transparent;
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
}
.container {
    display: inline-block;
    min-width: 200px;
    max-width: 1000px;
    padding: 0;
    border-radius: 12px;
    top: 2vh;
}
h1, h2, h3, h4, h5, h6 {
    margin: 1.5rem 0 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}
h1 {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.25rem;
    font-family: 'GangwonEdu_OTFBoldA', sans-serif;
}
h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
}
h4 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}
h5 {
    font-size: 1.05rem;
    color: var(--text-secondary);
}
h6 {
    font-size: 1rem;
    color: var(--text-secondary);
}
a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover);
    text-decoration: underline;
    opacity: 0.8;
}

/* =========================
   3. 폼 요소
========================= */
form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}
input, textarea {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-family: GangwonEdu_OTFBoldA;
    font-size: 1rem;
}
input:focus, textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}
button,
.button,
input[type="submit"],
.menu-button,
.view-menu-btn {
    font-family: 'GangwonEdu_OTFBoldA', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    background: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: inline-block;
    text-decoration: none;
}
button:hover, input[type="submit"]:hover, .button:hover {
    background: var(--button-hover);
    color: white;
    text-decoration: none;
    opacity: 0.9;
}

/* =========================
   4. 메시지/알림
========================= */
.message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}
.message.error {
    background: var(--error-bg);
    color: var(--error-text);
}
.message.success {
    background: var(--success-bg);
    color: var(--success-text);
}

/* =========================
   5. 마크다운/에디터 공통
========================= */
.markdown-content, .post-content, .toastui-editor-contents {
    font-size: 1rem !important;
    line-height: 1.7 !important;
    font-family: 'GangwonEdu_OTFBoldA', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    color: var(--text-primary) !important;
}
.markdown-content p, .post-content p, .toastui-editor-contents p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}
.markdown-content strong, .post-content strong, .toastui-editor-contents strong {
    font-weight: 600;
    color: var(--text-primary);
}
.markdown-content em, .post-content em, .toastui-editor-contents em {
    font-style: italic;
    color: var(--text-secondary);
}
.markdown-content code, .post-content code, .toastui-editor-contents code {
    background: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'IBM Plex Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    color: #333;
}
.markdown-content pre, .post-content pre, .toastui-editor-contents pre {
    background: #f8f9fa;
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid #e9ecef;
}
.markdown-content pre code, .post-content pre code, .toastui-editor-contents pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 0.875rem;
}
.markdown-content blockquote, .post-content blockquote, .toastui-editor-contents blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 0 4px 4px 0;
}
.markdown-content ul, .post-content ul, .toastui-editor-contents ul,
.markdown-content ol, .post-content ol, .toastui-editor-contents ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}
.markdown-content ul, .post-content ul, .toastui-editor-contents ul {
    list-style: disc !important;
}
.markdown-content ol, .post-content ol, .toastui-editor-contents ol {
    list-style: decimal !important;
}
.markdown-content ul li, .post-content ul li, .toastui-editor-contents ul li,
.markdown-content ol li, .post-content ol li, .toastui-editor-contents ol li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
}
.markdown-content h1, .post-content h1, .toastui-editor-contents h1,
.markdown-content h2, .post-content h2, .toastui-editor-contents h2,
.markdown-content h3, .post-content h3, .toastui-editor-contents h3,
.markdown-content h4, .post-content h4, .toastui-editor-contents h4,
.markdown-content h5, .post-content h5, .toastui-editor-contents h5,
.markdown-content h6, .post-content h6, .toastui-editor-contents h6 {
    margin: 1.5rem 0 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
}
.markdown-content h1, .post-content h1, .toastui-editor-contents h1 {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.markdown-content h2, .post-content h2, .toastui-editor-contents h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.25rem;
}
.markdown-content h3, .post-content h3, .toastui-editor-contents h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
}
.markdown-content h4, .post-content h4, .toastui-editor-contents h4 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.markdown-content h5, .post-content h5, .toastui-editor-contents h5 {
    font-size: 1.05rem;
    color: var(--text-secondary);
}
.markdown-content h6, .post-content h6, .toastui-editor-contents h6 {
    font-size: 1rem;
    color: var(--text-secondary);
}
.markdown-content a, .post-content a, .toastui-editor-contents a {
    color: var(--link-color);
    text-decoration: none;
}
.markdown-content a:hover, .post-content a:hover, .toastui-editor-contents a:hover {
    color: var(--link-hover);
    text-decoration: underline;
    opacity: 0.8;
}
.markdown-content table, .post-content table, .toastui-editor-contents table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    border: 1px solid var(--border-light);
}
.markdown-content th, .post-content th, .toastui-editor-contents th {
    background: #f8f9fa;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border-medium);
}
.markdown-content td, .post-content td, .toastui-editor-contents td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}
.markdown-content tr:nth-child(even) td, .post-content tr:nth-child(even) td, .toastui-editor-contents tr:nth-child(even) td {
    background: #f8f9fa;
}
.markdown-content img, .post-content img, .toastui-editor-contents img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.75rem 0;
}
.markdown-content ul li::marker, .post-content ul li::marker, .toastui-editor-contents ul li::marker {
    color: var(--text-secondary);
    font-weight: 500;
}
.markdown-content ol li::marker, .post-content ol li::marker, .toastui-editor-contents ol li::marker {
    color: var(--text-secondary);
    font-weight: 500;
}
.markdown-content hr, .post-content hr, .toastui-editor-contents hr {
    border: none;
    height: 1px;
    background: var(--border-light);
    margin: 2rem 0;
}

/* =========================
   6. 카드/리스트/카테고리
========================= */
.post-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
}
.post-card img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    min-width: 0; /* flex 컨테이너라면 필요 */
  }
.recent-post-card {
    border: 0px solid var(--border-light);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0rem;
    background: var(--bg-card);
    position: relative;
}
.post-card:hover, .recent-post-card:hover {
    border-color: var(--border-medium);
}
.post-header, .recent-header {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.category-badge, .recent-category-badge {
    flex-shrink: 0; /* 뱃지는 줄어들지 않음 */
    margin-right: 0.5rem;
}

.post-title, .recent-post-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 0;
    min-width: 0;
    /* 필요시 width: 0; 도 추가 */
}
.post-date {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 300;
    margin-left: auto;
    margin-right: 0em;
}
.category-badge, .recent-category-badge {
    background: var(--category-badge-bg);
    color: var(--category-badge-text);
    padding: 0.2em 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
    display: inline-block;
    vertical-align: middle;
}
.category-badge:hover {
    background: var(--category-badge-hover);
}
.category-text {
    color: var(--category-text);
    font-weight: 600;
    margin-right: 0rem;
}
.category-text:hover {
    color: var(--category-text-hover);
}
.category-section {
    position: relative;
    margin-bottom: 1rem;
}
.category-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}
.category-section input {
    width: 100%;
    box-sizing: border-box;
}
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}
.suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}
.suggestion-item:hover {
    background-color: var(--bg-light);
    opacity: 0.8;
}
.suggestion-item:last-child {
    border-bottom: none;
}
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.category-item {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 1rem;
}
.category-item:hover {
    border-color: var(--border-medium);
    opacity: 0.8;
}
.category-item h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}
.category-item h3 a {
    color: var(--text-primary);
    text-decoration: none;
}
.category-item h3 a:hover {
    color: var(--primary-color);
    opacity: 0.8;
}
.category-count {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* =========================
   7. 메뉴/네비게이션
========================= */
.post-menu {
    position: relative;
    margin-left: auto;
}
.menu-button {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.3rem;
    border-radius: 4px;
}
.menu-button:hover {
    background: #f7fafc;
    color: var(--primary-color);
    opacity: 0.8;
}
.menu-options {
    position: absolute;
    top: 2em;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    z-index: 1001;
    white-space: nowrap;
    overflow: hidden;
    display: none;
}
.menu-options a {
    display: block;
    padding: 0.8rem 1.2em;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--bg-light);
}
.menu-options a:last-child {
    border-bottom: none;
}
.menu-options a:hover {
    background: var(--primary-color);
    color: white;
    opacity: 0.9;
}
.post-menu:hover .menu-options {
    display: block;
}

/* =========================
   8. 리스트/ul/ol
========================= */
ul {
    list-style: none;
    padding: 0;
}
ul li {
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
}
ul li a {
    display: block;
    padding: 0.5rem 0;
    color: var(--text-primary);
    font-weight: 500;
}
ul li small {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-left: 1rem;
}

/* =========================
   9. 푸터
========================= */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2em;
    font-size: 0.85rem;
    color: var(--text-light);
    border-top: 2px solid var(--bg-light);
}
footer a {
    color: var(--primary-color);
    font-weight: 500;
}

/* =========================
   10. 에디터 UI/Toast UI
========================= */
.toastui-editor-toolbar {
    border-bottom: 1px solid var(--border-light) !important;
    background: var(--bg-card) !important;
}
.toastui-editor-toolbar button {
    color: var(--text-primary) !important;
}
.toastui-editor-toolbar button:hover {
    color: var(--text-secondary) !important;
}
.toastui-editor-defaultUI {
    border: 1px solid var(--border-medium) !important;
    border-radius: 6px !important;
    background: var(--bg-card) !important;
}
.toastui-editor-main {
    background: var(--bg-card) !important;
}
.toastui-editor-main .toastui-editor-md-splitter {
    background: var(--bg-card) !important;
}
.toastui-editor-main .toastui-editor-md-vertical-style .toastui-editor-md-splitter {
    background: var(--border-light) !important;
}
.toastui-editor-main .toastui-editor-md-preview {
    background: var(--bg-card) !important;
    padding: 1rem !important;
}
.toastui-editor-defaultUI .toastui-editor-status {
    background: var(--bg-light) !important;
    border-top: 1px solid var(--border-light) !important;
    color: var(--text-secondary) !important;
}

/* =========================
   11. 2열 레이아웃/메인
========================= */
.main-columns {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.left-column, .right-column {
  flex: 1 1 0;
  min-width: 0;
}
.main-content {
    position: relative;
    min-height: calc(100vh - 4vh);
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 2vh;
    margin-left: 10px;
    margin-right: 10px;
}
.setup {
    display: flex;
    justify-content: center;
    align-items: center;
    top: 1.5rem;
    min-height: calc(100vh - 4vh);
    margin-bottom: 2vh;
    margin-left: 10px;
    margin-right: 10px;
}
.blur-text {
    filter: blur(10px);
    cursor: pointer;
    transition: filter 0.3s;
}

/* =========================
   플로팅 메뉴 버튼 (header.php에서 이동)
========================= */
.floating-menu-btn {
    display: flex;
    position: fixed;
    right: 2vw;
    bottom: 2vh;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: none;
    z-index: 1100;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    text-align: center !important;
    padding: 0;
}
.floating-menu-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}
.floating-menu-btn span {
    font-size: 2rem;
    color: white;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle; 
    width: 100%;
    height: 100%;

}

/* =========================
   12. 반응형 스타일
========================= */
body, .markdown-content, .post-content, .toastui-editor-contents {
    font-size: 1.1rem;
    line-height: 1.7;
}

/* 모바일 최적화 - 아이폰12 기준 */
@media (max-width: 1079px) {
    html {
        font-size: 24px; /* 24에서 18 조정 */
    }
    /* 기본 텍스트 크기 조정 */
    body, .markdown-content, .post-content, .toastui-editor-contents {
        font-size: 1em;
    }
    /* 제목 크기 조정 */
    h1 {
        font-size: 1.8rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    h3 {
        font-size: 1.2rem;
    }
    /* 레이아웃 조정 */
    .main-columns {
        flex-direction: column;
    }
    .left-column, .right-column {
        width: 100%;
    }
    .main-content {
        margin: 0;
        min-height: auto;
    }
    .container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: calc(100vw - 1rem) !important;
        max-width: 100vw !important;
        box-sizing: border-box;
    }
    /* 버튼 및 입력 필드 최적화 */
    button, .button, input, textarea, input[type="submit"] {
        font-size: 1rem;
        padding: 0.8em 1.2em; /* 터치 영역 확대 */
        min-height: 2.5em; /* 최소 높이 증가 */
        line-height: 1.2;
        -webkit-appearance: none; /* iOS 기본 스타일 제거 */
        appearance: none; /* 표준 속성 추가 */
        border-radius: 8px;
    }
    /* 카드 패딩 조정 */
    .post-card {
        padding: 1rem;
        margin-bottom: 1em;
    }
    /* 플로팅 메뉴 버튼 크기 조정 */
    .floating-menu-btn {
        width: min(20vw, 100px);
        height: min(20vw, 100px);
        right: 1rem;
        bottom: 1rem;
    }
    .floating-menu-btn span {
        font-size: 2rem;
    }
}

/* 작은 모바일 화면 (아이폰 SE 등) */
@media (max-width: 480px) {

    .container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: calc(100vw - 1rem) !important;
        max-width: 100vw !important;
        box-sizing: border-box;
    }
    .post-card {
        padding: 0.75em;
    }
    /* 플로팅 메뉴 위치 조정 */
    .floating-menu-btn {
        right: 0.75rem;
        bottom: 0.75em;
    }
    /* 헤더 이미지 높이 조정 */
    .header-image {
        min-height: 60px;
        max-height: 120px;
    }
    .site-title {
        font-size: 1.2rem;
        bottom: 8px;
        left: 1rem;
    }
}

/* 터치 인터랙션 개선 */
@media (hover: none) and (pointer: coarse) {
    /* 터치 디바이스에서 호버 효과 제거 */
    button:hover, input[type="submit"]:hover, .button:hover {
        transform: none;
    }
    .post-card:hover, .recent-post-card:hover {
        border-color: var(--border-light);
    }
    .category-badge:hover {
        background: var(--category-badge-bg);
    }
    .category-text:hover {
        color: var(--category-text);
    }
    .menu-button:hover {
        background: none;
        color: var(--text-light);
    }
    .menu-options a:hover {
        background: var(--bg-light);
        color: var(--text-secondary);
    }
    .markdown-content a:hover, .post-content a:hover, .toastui-editor-contents a:hover {
        color: var(--link-color);
        text-decoration: none;
    }
    .markdown-content img:hover, .post-content img:hover, .toastui-editor-contents img:hover {
        box-shadow: none;
    }
    .category-item:hover {
        border-color: var(--border-light);
        box-shadow: none;
    }
    .category-item h3 a:hover {
        color: var(--text-primary);
    }
    .suggestion-item:hover {
        background-color: var(--bg-light);
    }
}

/* iOS Safari 최적화 */
@supports (-webkit-touch-callout: none) {
    /* iOS에서 입력 필드 최적화 */
    input, textarea {
        font-size: 16px; /* iOS에서 자동 확대 방지 */
        -webkit-appearance: none;
        appearance: none; /* 표준 속성 추가 */
        border-radius: 8px;
    }
    /* iOS에서 버튼 터치 영역 확대 */
    button, .button, input[type="submit"] {
        min-height: 44px; /* Apple 권장 최소 터치 영역 */
        padding: 0.8rem 1.2em;
    }
    /* iOS에서 스크롤 부드럽게 */
    .floating-dropdown, .category-dropdown {
        -webkit-overflow-scrolling: touch;
    }
}

.banner {
    cursor: pointer;
    width:200px !important; 
    height:auto; 
    display:inline-block !important;
}
.banner:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    opacity: 0.8;
}
.banner-tooltip {
    position: absolute;
    text-align: center;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.8em;
    padding: 5px 12px;
    border-radius: 8px;
    white-space: pre-line;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    opacity: 0.9;
    top: 0;
    left: 0;
    transform: translateY(-8px);
}
