@charset "UTF-8";

/* --- Design Tokens --- */
:root,
.dark-theme {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(30, 41, 59, 0.7);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --font-main: 'Inter', 'Pretendard', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.1);
    --glass: rgba(255, 255, 255, 0.8);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* --- Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul,
ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Layout --- */
#app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px 40px;
    /* Increased top padding */
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
    /* Ensure top alignment */
}

@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
}

/* --- Sidebar --- */
#sidebar {
    margin-top: 64px;
    /* Adjusted to 68px for precise alignment */
}

/* --- Header --- */
#header {
    position: sticky;
    top: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-container {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gnb ul {
    display: flex;
    gap: 24px;
}

.gnb a {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.gnb a:hover {
    color: var(--accent);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 20px;
    padding: 6px 16px;
    border: 1px solid var(--border);
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    width: 120px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-box input:focus {
    width: 200px;
}

/* --- Hero --- */
.hero {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    margin-bottom: 40px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 700;
    margin-top: 20px;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* --- Article Grid --- */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.post-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
}

.post-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.post-thumb {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: var(--bg-tertiary);
}

.post-category {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.post-info {
    padding: 24px;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.post-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 20px;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

/* --- Post View --- */
.post-view {
    background: var(--bg-secondary);
    padding: 60px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .post-view {
        padding: 30px 20px;
    }
}

.post-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 30px;
}

.post-header .post-title {
    font-size: 2.5rem;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    margin-top: 10px;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #e2e8f0;
}

.post-content h2,
.post-content h3 {
    margin: 40px 0 20px;
    color: white;
}

.post-content p {
    margin-bottom: 24px;
}

/* --- Sidebar --- */
.widget {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent);
    padding-left: 12px;
}

.profile-widget {
    text-align: center;
}

.profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 20px;
    background-size: cover;
    border: 3px solid var(--accent);
}

.profile-name {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.profile-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.profile-btns {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.sub-btn-wrapper {
    width: 100%;
}

.sub-btn-wrapper button,
.sub-btn-wrapper .t_subscription_button {
    width: 100% !important;
    justify-content: center !important;
}

.secondary-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.theme-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.2rem;
}

.theme-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
    border-color: var(--accent);
}

.light-theme .theme-btn.light,
.dark-theme .theme-btn.dark {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.github-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    color: var(--text-primary);
}

.github-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

/* --- Search Widget --- */
.search-widget .search-form,
.widget-search .search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    /* Ensure vertical alignment */
}

.search-widget input,
.widget-search input {
    flex: 1;
    height: 44px;
    /* Explicit height to match button */
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 14px;
    /* Remove vertical padding, rely on height/flex */
    color: var(--text-primary);
    outline: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-widget input:focus,
.widget-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.search-widget button,
.widget-search button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    /* Matching height */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    padding: 0;
    /* consistent box model */
}

.search-widget button:hover,
.widget-search button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* --- Category Widget --- */
.category-widget ul,
.widget-category ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    gap: 8px;
}

.category-widget li,
.widget-category li {
    margin: 0;
}

.category-widget li a,
.widget-category li a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    /* Softer radius for list items */
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    width: 100%;
    /* Fill width for cleaner vertical look */
    box-sizing: border-box;
}

.category-widget li a:hover,
.widget-category li a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateX(4px);
    /* Slide effect instead of lift */
}

/* Sub-categories styling */
.category-widget li ul,
.widget-category li ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
}

.category-widget li ul li a {
    background: transparent;
    border: none;
    padding: 4px 8px;
    font-size: 0.85rem;
    border-radius: 4px;
}

.category-widget li ul li a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    border-color: transparent;
    transform: translateX(4px);
}

.category-widget .c_cnt,
.widget-category .c_cnt {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-left: auto;
    /* Push count to right */
    float: right;
}

/* --- List Header Alignment --- */
.list-header {
    margin-bottom: 30px;
    margin-top: -5px;
    /* Visually align text top with sidebar box top */
    padding: 0 0 15px 0;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 12px;
}

.list-header h2,
.category-title {
    margin: 0;
    line-height: 1;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.list-header span {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 600;
}

/* --- Protected Content --- */
.protected-form {
    padding: 40px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    text-align: center;
    max-width: 400px;
    margin: 40px auto;
}

.protected-form p {
    margin-bottom: 20px;
}

.protected-form input[type="password"] {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    margin-bottom: 20px;
    outline: none;
}

/* --- Tag Cloud Page --- */
.tag-cloud-page .tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 20px;
}

.tag-list a {
    font-size: 1rem;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 30px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.tag-list a:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

.tag-list .cloud1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.tag-list .cloud2 {
    font-size: 1.3rem;
    font-weight: 700;
    opacity: 0.9;
}

.tag-list .cloud3 {
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.8;
}

.tag-list .cloud4 {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
}

/* --- Guestbook --- */
.guestbook-section {
    padding: 40px;
}

.guestbook-section .tt-comment-group {
    margin-top: 20px;
}

/* --- Tistory Search Highlight --- */
.search-highlight {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent);
    padding: 0 4px;
    border-radius: 4px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 60px;
}

.page-numbers {
    display: flex;
    gap: 10px;
}

.page-num,
.page-nav {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 600;
}

.page-num:hover,
.page-nav:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* --- Footer --- */
#footer {
    background: var(--bg-secondary);
    padding: 60px 0;
    margin-top: auto;
    border-top: 1px solid var(--border);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.footer-links a {
    margin-left: 20px;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* --- Tistory Fixes --- */
.tt-calendar {
    display: none;
}

/* Hide old calendar */
.another_category {
    margin-top: 50px !important;
}

.container_postbtn {
    border-top: 1px solid var(--border) !important;
    padding: 30px 0 !important;
}


/* =========================
   Contrast Fix (Dark/Light)
   맨 아래에 추가
   ========================= */

/* 1) 다크모드 텍스트 대비를 조금 올림 (카테고리/메타/요약 등) */
:root,
.dark-theme{
  --text-secondary: #cbd5e1; /* 기존 #94a3b8 보다 밝게 */
  --text-muted: #94a3b8;     /* 기존 #64748b 보다 밝게 */
}

/* 2) 검색바 input이 라이트모드에서 흰색으로 고정돼 안 보이는 문제 */
.search-box input{
  color: var(--text-primary) !important; /* 기존 color: white; 덮어쓰기 */
}
.search-box input::placeholder{
  color: var(--text-muted);
  opacity: 1;
}

/* 3) 본문/헤딩이 white로 고정돼 라이트모드에서 안 보이는 문제 */
.post-content,
.article_view,
.entry-content,
.tt_article_useless_p_margin{
  color: var(--text-secondary);
}

.post-content h1, .post-content h2, .post-content h3, .post-content h4, .post-content h5, .post-content h6,
.article_view h1, .article_view h2, .article_view h3, .article_view h4, .article_view h5, .article_view h6,
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6,
.tt_article_useless_p_margin h1, .tt_article_useless_p_margin h2, .tt_article_useless_p_margin h3,
.tt_article_useless_p_margin h4, .tt_article_useless_p_margin h5, .tt_article_useless_p_margin h6{
  color: var(--text-primary) !important; /* 기존 color: white; 덮어쓰기 */
}

/* 4) 본문 링크가 color: inherit 때문에 배경과 비슷해지는 경우 방지 */
.post-content a,
.article_view a,
.entry-content a,
.tt_article_useless_p_margin a{
  color: var(--accent);
}
.post-content a:hover,
.article_view a:hover,
.entry-content a:hover,
.tt_article_useless_p_margin a:hover{
  color: var(--accent-hover);
}

/* 5) 카테고리 pill 글자가 다크에서 약한 경우(선택사항이지만 보통 같이 해결됨) */
.dark-theme .category-widget li a,
.dark-theme .widget-category li a{
  color: var(--text-primary);
}
.dark-theme .category-widget .c_cnt,
.dark-theme .widget-category .c_cnt{
  opacity: 0.85; /* 기존 0.6은 다크에서 너무 흐림 */
}


/* =========================
   Contrast Hotfix (Dark/Light)
   -> CSS 맨 아래에 추가
   ========================= */

/* 0) 라이트 테마 변수(텍스트/테두리) 재고정
   - 이전에 :root 쪽 변수가 뒤에서 덮이면(패치/순서 문제) 라이트가 흐려질 수 있어서,
     light-theme에서 한 번 더 '강하게' 고정합니다. */
.light-theme{
  --text-primary: #0f172a;
  --text-secondary: #334155; /* 기존보다 조금 진하게 */
  --text-muted: #475569;
  --border: rgba(15, 23, 42, 0.18); /* 테두리 대비 강화 */
}

/* 1) 라이트모드: 카테고리 pill 글자/테두리 안 보이는 문제 해결 */
.light-theme .category-widget li a,
.light-theme .widget-category li a,
.light-theme .tt_category li a{
  background: #ffffff !important;
  border-color: var(--border) !important;
  color: var(--text-secondary) !important;
  opacity: 1 !important; /* 혹시 상위/기본CSS에서 opacity로 흐려지는 경우 방지 */
}

.light-theme .category-widget .c_cnt,
.light-theme .widget-category .c_cnt,
.light-theme .tt_category .c_cnt{
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

/* 2) 다크모드: 본문 일부가 '검정색'으로 박혀 안 보이는 문제
   - 티스토리 에디터/코드블럭/인라인 스타일에서 color:#000 계열이 들어오는 경우가 흔합니다.
   - 검정 계열 인라인만 선별적으로 덮어씁니다(다른 색 강조는 최대한 보존). */
.dark-theme .post-content,
.dark-theme .article_view,
.dark-theme .entry-content,
.dark-theme .tt_article_useless_p_margin{
  color: var(--text-secondary);
}

.dark-theme .post-content [style*="color:#000"],
.dark-theme .post-content [style*="color: #000"],
.dark-theme .post-content [style*="color:rgb(0"],
.dark-theme .post-content [style*="color: rgb(0"],
.dark-theme .post-content [style*="color:rgba(0"],
.dark-theme .post-content [style*="color: rgba(0"],
.dark-theme .article_view  [style*="color:#000"],
.dark-theme .article_view  [style*="color: #000"],
.dark-theme .article_view  [style*="color:rgb(0"],
.dark-theme .article_view  [style*="color: rgb(0"],
.dark-theme .article_view  [style*="color:rgba(0"],
.dark-theme .article_view  [style*="color: rgba(0"]{
  color: var(--text-secondary) !important;
}

/* 3) 다크모드: code/pre가 기본 검정으로 나오는 경우 대비 */
.dark-theme pre,
.dark-theme code,
.dark-theme tt,
.dark-theme kbd,
.dark-theme samp{
  color: #e5e7eb !important;
}

.dark-theme pre{
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid var(--border) !important;
}

/* 4) 검색 input이 white로 고정되어(또는 반대로) 테마에서 안 보이는 문제 */
.search-box input{
  color: var(--text-primary) !important; /* 기존 color:white 덮기 */
}
.search-box input::placeholder{
  color: var(--text-muted);
  opacity: 1;
}


/* =========================
   Dark Mode Visibility Patch
   - 접은 글(더보기/접기) 내부 코드블럭 + 일부 검정 텍스트 보정
   - CSS 맨 아래에 추가
   ========================= */

.dark-theme{
  --code-bg: rgba(255,255,255,0.06);
  --code-border: rgba(255,255,255,0.12);
  --code-text: #e5e7eb;
}

/* 1) 다크모드: 코드블럭(접은 글 안/밖 모두) 배경/글자 강제 */
.dark-theme pre,
.dark-theme pre[data-ke-type="codeblock"],
.dark-theme pre.codeblock,
.dark-theme .codeblock,
.dark-theme .tt_codeblock,
.dark-theme .tt-codeblock,
.dark-theme pre[class*="language-"],
.dark-theme code[class*="language-"],
.dark-theme .hljs{
  background: var(--code-bg) !important;
  border: 1px solid var(--code-border) !important;
  color: var(--code-text) !important;
}

/* 하이라이터가 span에 어두운 색을 넣어도 강제 밝게(가독성 우선) */
.dark-theme pre code,
.dark-theme .hljs,
.dark-theme .hljs *{
  color: var(--code-text) !important;
}

/* 2) 다크모드: 인라인 코드(문장 중간 `code`)도 대비 보정 */
.dark-theme code:not(pre code){
  color: var(--code-text) !important;
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid var(--code-border) !important;
  border-radius: 6px;
  padding: 0.12em 0.35em;
}

/* 3) 다크모드: "접은 글" 컨테이너 내부에 검정 텍스트가 박혀 안 보이는 케이스 보정
   (티스토리/에디터 마크업이 케이스마다 달라서 여러 후보 셀렉터를 같이 잡음) */
.dark-theme [data-ke-type="moreLess"],
.dark-theme .tt_moreless,
.dark-theme .tt-moreless,
.dark-theme .moreless_content,
.dark-theme .moreless-content,
.dark-theme .btn_moreless,
.dark-theme .btn-moreless{
  color: var(--text-secondary) !important;
}

/* 4) 다크모드: 특정 문장만 검정(#000~#555) 계열로 박힌 경우(스크린샷 같은 케이스)
   -> 해당 인라인 스타일만 선별적으로 밝게 덮음 */
.dark-theme .post-content [style*="color:#000"],
.dark-theme .post-content [style*="color: #000"],
.dark-theme .post-content [style*="color:#111"],
.dark-theme .post-content [style*="color: #111"],
.dark-theme .post-content [style*="color:#222"],
.dark-theme .post-content [style*="color: #222"],
.dark-theme .post-content [style*="color:#333"],
.dark-theme .post-content [style*="color: #333"],
.dark-theme .post-content [style*="color:#444"],
.dark-theme .post-content [style*="color: #444"],
.dark-theme .post-content [style*="color:#555"],
.dark-theme .post-content [style*="color: #555"],
.dark-theme .post-content [style*="color:rgb(0"],
.dark-theme .post-content [style*="color: rgb(0"],
.dark-theme .post-content [style*="color:rgb(17"],
.dark-theme .post-content [style*="color: rgb(17"],
.dark-theme .post-content [style*="color:rgb(34"],
.dark-theme .post-content [style*="color: rgb(34"],
.dark-theme .post-content [style*="color:rgb(51"],
.dark-theme .post-content [style*="color: rgb(51"]{
  color: var(--text-secondary) !important;
}

/* article_view/entry-content로 렌더링되는 스킨도 같이 커버 */
.dark-theme .article_view [style*="color:#000"],
.dark-theme .entry-content [style*="color:#000"],
.dark-theme .tt_article_useless_p_margin [style*="color:#000"]{
  color: var(--text-secondary) !important;
}

/* =========================
   Sidebar alignment fix
   - 상세 글: sidebar는 위로 붙임
   - 목록(전체글/카테고리 등): list-header가 있을 때만 아래로 내림
   ========================= */

/* 기본(상세 글 포함): 사이드바 보정 제거 */
#sidebar{
  margin-top: 0 !important;
}

/* 목록 페이지에서만(= list-header가 존재할 때만) 보정 적용 */
.content-wrapper:has(.list-header) #sidebar{
  margin-top: 65px !important;
}

/* =========================
   Header 3-part symmetry
   (logo)  (gnb/home)  (theme buttons)
   ========================= */

.header-container{
  display: grid !important;
  grid-template-columns: 1fr auto 1fr; /* 핵심 */
  align-items: center;
  column-gap: 28px; /* 홈 기준 좌/우 간격(원하면 조절) */
}

/* 왼쪽(블로그 이름)은 가운데 기준 왼쪽에 붙게 */
.header-container .logo{
  justify-self: end;
  margin: 0;
}

/* 가운데(홈/메뉴)는 정확히 중앙 */
.header-container .gnb{
  justify-self: center;
}

/* 오른쪽(모드 버튼)은 가운데 기준 오른쪽에 붙게 */
.header-container .header-utils{
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 메뉴 ul 기본 여백 제거(센터 정렬 흔들림 방지) */
.gnb ul{
  margin: 0;
  padding: 0;
}

/* =========================
   Header align to content + sidebar edges
   - Title: content(포스팅/홈) 좌측 라인에 정렬
   - Home + Theme buttons: 프로필(사이드바) 우측 라인에 정렬
   ========================= */

/* 1) 헤더 컨테이너: flex로 전환 (기존 grid/space-between 덮기) */
#header .header-container{
  display: flex !important;
  justify-content: flex-start !important; /* 기존 space-between/grid 덮기 */
  align-items: center;
  gap: 16px;
}

/* 2) 타이틀(logo): 항상 왼쪽(콘텐츠 시작점) */
#header .logo{
  margin: 0;
  flex: 0 0 auto;
}

/* 3) 메뉴(홈): 오른쪽 그룹 시작점으로 밀기 */
#header .gnb{
  margin-left: auto !important; /* 핵심: 오른쪽 정렬의 기준점 */
}

/* 티스토리 메뉴 출력([##_blog_menu_##]) 대응 */
#header .gnb ul{
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 0;
}

/* 4) 모드 버튼: 홈 오른쪽에 붙이고, 우측 끝이 프로필 우측 끝과 일치 */
#header .header-utils{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 12px;           /* 홈과 버튼 사이 간격 */
  justify-content: flex-end;
}

/* (선택) 헤더 오른쪽 라인에 더 딱 붙이고 싶으면 */
#header .header-utils{
  padding-right: 0;
}

/* =========================
   Header: Title | Home(center) | Theme buttons
   홈을 TITLE과 모드버튼의 '중앙'에 배치
   ========================= */

#header .header-container{
  display: grid !important;
  grid-template-columns: auto 1fr auto; /* 좌(타이틀) / 중앙(홈) / 우(버튼) */
  align-items: center;
  column-gap: 16px;
}

/* 좌측: 블로그 타이틀 */
#header .logo{
  justify-self: start;
  margin: 0 !important;
}

/* 중앙: 홈(메뉴) */
#header .gnb{
  justify-self: center;        /* 핵심: 남는 공간의 정중앙 */
  margin: 0 !important;        /* 이전 margin-left:auto 같은거 무력화 */
}

#header .gnb ul{
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  gap: 14px;
}

/* 우측: 모드 버튼 */
#header .header-utils{
  justify-self: end;           /* 오른쪽 끝 정렬 */
  display: flex;
  align-items:

/* =========================
   Posting Activity Heatmap
   ========================= */
:root{
  --activity-0: rgba(37, 99, 235, 0.10);
  --activity-1: rgba(37, 99, 235, 0.22);
  --activity-2: rgba(37, 99, 235, 0.40);
  --activity-3: rgba(37, 99, 235, 0.62);
  --activity-4: rgba(37, 99, 235, 0.88);
}

.activity-widget{
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.activity-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.activity-title{
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.activity-nav{
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-month-btn{
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.activity-month-btn:hover{
  background: var(--surface);
  border-color: var(--link);
  color: var(--link);
}

.activity-month-label{
  min-width: 68px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.activity-weekdays{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.activity-weekdays span{
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.activity-grid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.activity-cell{
  aspect-ratio: 1 / 1;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--activity-0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.activity-cell:hover{
  transform: translateY(-1px);
  border-color: var(--link);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.activity-cell.is-outside{
  opacity: 0.28;
}

.activity-cell[data-level="0"]{ background: var(--activity-0); }
.activity-cell[data-level="1"]{ background: var(--activity-1); }
.activity-cell[data-level="2"]{ background: var(--activity-2); }
.activity-cell[data-level="3"]{ background: var(--activity-3); }
.activity-cell[data-level="4"]{ background: var(--activity-4); }

.activity-day-num{
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.activity-legend{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.legend-text{
  font-size: 11px;
  color: var(--muted);
}

.legend-box{
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-block;
}

.legend-box.level-0{ background: var(--activity-0); }
.legend-box.level-1{ background: var(--activity-1); }
.legend-box.level-2{ background: var(--activity-2); }
.legend-box.level-3{ background: var(--activity-3); }
.legend-box.level-4{ background: var(--activity-4); }

.activity-note{
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 1024px){
  .activity-cell{
    min-height: 28px;
  }

  .activity-day-num{
    font-size: 10px;
  }
}

/* =========================
   Commit Calendar
   ========================= */
:root{
  --commit-rgb: 37, 99, 235;
}

#sidebar .widget-category .commit-calendar{
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

#sidebar .widget-category .commit-calendar__header{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 22px !important;
  margin-bottom: 18px !important;
}

#sidebar .widget-category .commit-calendar__month{
  min-width: 110px;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1;
}

#sidebar .widget-category .commit-calendar__nav{
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 28px;
  height: 28px;
  font-size: 2rem;
  line-height: 1;
  color: var(--link);
  cursor: pointer;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#sidebar .widget-category .commit-calendar__nav:hover{
  transform: scale(1.08);
  opacity: 0.8;
}

#sidebar .widget-category .commit-calendar__grid{
  display: grid !important;
  grid-template-columns: repeat(7, 30px) !important;
  grid-auto-rows: 30px !important;
  justify-content: center !important;
  gap: 14px 18px !important;
  width: 100%;
}

#sidebar .widget-category .commit-calendar__cell{
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  border-radius: 999px !important;
  border: 1.6px solid rgba(var(--commit-rgb), 0.65) !important;
  background: transparent !important;
  box-sizing: border-box !important;
  padding: 0 !important;
  margin: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: default;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

#sidebar .widget-category .commit-calendar__cell:hover{
  transform: translateY(-1px);
}

#sidebar .widget-category .commit-calendar__cell[data-level="0"]{
  background: transparent !important;
}

#sidebar .widget-category .commit-calendar__cell[data-level="1"]{
  background: rgba(var(--commit-rgb), 0.25) !important;
}

#sidebar .widget-category .commit-calendar__cell[data-level="2"]{
  background: rgba(var(--commit-rgb), 0.45) !important;
}

#sidebar .widget-category .commit-calendar__cell[data-level="3"]{
  background: rgba(var(--commit-rgb), 0.68) !important;
}

#sidebar .widget-category .commit-calendar__cell[data-level="4"]{
  background: rgba(var(--commit-rgb), 0.95) !important;
}

#sidebar .widget-category .commit-calendar__cell.is-empty{
  visibility: hidden;
  pointer-events: none;
}

#sidebar .widget-category .commit-calendar__info{
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  min-height: 18px;
}

@media (max-width: 1200px){
  #sidebar .widget-category .commit-calendar__grid{
    grid-template-columns: repeat(7, 26px) !important;
    grid-auto-rows: 26px !important;
    gap: 12px 14px !important;
  }

  #sidebar .widget-category .commit-calendar__cell{
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
  }

  #sidebar .widget-category .commit-calendar__month{
    font-size: 1.6rem;
  }
}

:root{
  --commit-rgb: 37, 99, 235;
}

#sidebar .widget-category .commit-calendar{
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

#sidebar .widget-category .commit-calendar__header{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-bottom: 18px;
}

#sidebar .widget-category .commit-calendar__month{
  min-width: 110px;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1;
}

#sidebar .widget-category .commit-calendar__nav{
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
  width: 28px;
  height: 28px;
  font-size: 2rem;
  line-height: 1;
  color: var(--link);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#sidebar .widget-category .commit-calendar__grid{
  display: grid;
  grid-template-columns: repeat(7, 30px);
  grid-auto-rows: 30px;
  justify-content: center;
  gap: 14px 18px;
  width: 100%;
}

#sidebar .widget-category .commit-calendar__cell{
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 999px;
  border: 1.6px solid rgba(var(--commit-rgb), 0.65);
  background: transparent;
  box-sizing: border-box;
}

#sidebar .widget-category .commit-calendar__cell[data-level="0"]{
  background: transparent;
}

#sidebar .widget-category .commit-calendar__cell[data-level="1"]{
  background: rgba(var(--commit-rgb), 0.25);
}

#sidebar .widget-category .commit-calendar__cell[data-level="2"]{
  background: rgba(var(--commit-rgb), 0.45);
}

#sidebar .widget-category .commit-calendar__cell[data-level="3"]{
  background: rgba(var(--commit-rgb), 0.68);
}

#sidebar .widget-category .commit-calendar__cell[data-level="4"]{
  background: rgba(var(--commit-rgb), 0.95);
}

#sidebar .widget-category .commit-calendar__cell.is-empty{
  visibility: hidden;
  pointer-events: none;
}

#sidebar .widget-category .commit-calendar__info{
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  min-height: 18px;
}





