/*
 * MoonTree Public Archive — Aurora Bento Theme
 * 기존 기능 CSS 위에 시각 디자인만 덮어쓰는 moontree.kr 전용 테마
 */

body.theme-aurora {
    --bg-primary: #050a17;
    --bg-secondary: #081326;
    --bg-tertiary: #10203a;
    --bg-hover: #14294a;
    --bg-active: rgba(78, 140, 255, 0.18);
    --border-color: rgba(139, 170, 226, 0.2);
    --border-active: #69a7ff;
    --text-primary: #f3f7ff;
    --text-secondary: #aabbd6;
    --text-muted: #7187a8;
    --accent: #69a7ff;
    --accent-hover: #90c2ff;
    --danger: #ff6f7d;
    --success: #54d6a1;
    --warning: #ffc95e;
    --header-height: 56px;
    --tree-width: 292px;
    --font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.4);
    --transition: 180ms ease;
    min-width: 320px;
    font-family: var(--font-family);
    font-size: 14px;
    background: #050a17;
}

.theme-aurora ::selection {
    background: rgba(101, 165, 255, 0.34);
    color: #ffffff;
}

/* 상단 */
.theme-aurora #app-header {
    position: relative;
    padding: 0 22px;
    background:
        radial-gradient(circle at 18% -160%, rgba(55, 137, 255, 0.36), transparent 48%),
        linear-gradient(90deg, rgba(5, 13, 30, 0.98), rgba(8, 16, 37, 0.96));
    border-bottom-color: rgba(123, 158, 216, 0.22);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.theme-aurora #app-header::after {
    content: '';
    position: absolute;
    right: 18%;
    bottom: -1px;
    width: 210px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #6a8cff, #a66cff, transparent);
    opacity: 0.72;
}

.theme-aurora .header-left .logo {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #f5f8ff;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-shadow: 0 0 24px rgba(105, 167, 255, 0.24);
}

.theme-aurora .header-btn {
    padding: 7px 12px;
    background: rgba(16, 32, 58, 0.72);
    border-color: rgba(139, 170, 226, 0.22);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 13px;
    backdrop-filter: blur(12px);
}

.theme-aurora .header-btn:hover {
    background: rgba(37, 70, 119, 0.72);
    border-color: rgba(105, 167, 255, 0.62);
    color: #ffffff;
}

/* 탐색기 */
.theme-aurora #tree-panel {
    background:
        radial-gradient(circle at 15% 12%, rgba(50, 117, 220, 0.11), transparent 32%),
        linear-gradient(180deg, #071326 0%, #08111f 62%, #07101d 100%);
    border-right-color: rgba(126, 160, 218, 0.18);
}

.theme-aurora .panel-header {
    min-height: 48px;
    padding: 10px 14px;
    border-bottom-color: rgba(126, 160, 218, 0.17);
    color: #dce8fa;
    font-size: 14px;
    font-weight: 700;
}

.theme-aurora .tree-toggle-all {
    min-height: 28px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #dce8fa;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.theme-aurora .tree-toggle-all:hover,
.theme-aurora .tree-toggle-all:focus-visible {
    background: rgba(41, 78, 129, 0.5);
    border-color: rgba(105, 167, 255, 0.28);
    outline: none;
}

.theme-aurora .tree-toggle-all:active {
    transform: translateY(1px);
}

.theme-aurora .icon-btn {
    width: 30px;
    height: 30px;
    background: rgba(31, 57, 96, 0.58);
    border-color: rgba(119, 157, 220, 0.28);
    border-radius: 8px;
    color: #bcd4f8;
}

.theme-aurora #tree-container {
    padding: 4px 0;
}

.theme-aurora .category-header {
    min-height: 24px;
    margin: 0 6px;
    padding: 1px 7px;
    border: 1px solid transparent;
    border-radius: 7px;
    gap: 6px;
}

/* 1단 → 2단 → 게시글이 단계마다 일정하게 안쪽으로 들어가도록 표시한다. */
.theme-aurora .tree-level-1 > .category-header {
    padding-left: 7px;
}

.theme-aurora .tree-level-2 > .category-header,
.theme-aurora .tree-level-1 > .category-branch > .post-item {
    padding-left: 27px;
}

.theme-aurora .category-header:hover {
    background: rgba(41, 78, 129, 0.34);
    border-color: rgba(105, 167, 255, 0.12);
}

.theme-aurora .category-header.active {
    background: linear-gradient(90deg, rgba(54, 116, 223, 0.25), rgba(126, 87, 221, 0.12));
    border-color: rgba(105, 167, 255, 0.2);
}

.theme-aurora .category-arrow {
    color: #6f89ad;
}

.theme-aurora .category-icon {
    filter: drop-shadow(0 0 6px rgba(255, 201, 94, 0.2));
}

.theme-aurora .category-name,
.theme-aurora .post-name {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.015em;
}

.theme-aurora .tree-category.is-private > .category-header .category-name {
    color: #c9b7ff;
}

.theme-aurora .post-item {
    min-height: 23px;
    margin: 0 6px;
    padding-top: 1px;
    padding-bottom: 1px;
    border: 1px solid transparent;
    border-radius: 7px;
    gap: 6px;
}

.theme-aurora .tree-level-2 > .category-branch > .post-item {
    padding-left: 47px;
}

.theme-aurora .post-item:hover {
    background: rgba(35, 68, 113, 0.34);
    border-color: rgba(105, 167, 255, 0.1);
    color: #d8e8ff;
}

.theme-aurora .post-item.active {
    background: linear-gradient(90deg, rgba(54, 116, 223, 0.3), rgba(126, 87, 221, 0.14));
    border-color: rgba(105, 167, 255, 0.24);
    color: #ffffff;
}

.theme-aurora .tree-action-btn {
    min-width: 22px;
    height: 22px;
    border-radius: 6px;
    color: #8fa6c7;
}

.theme-aurora #status-bar {
    min-height: 29px;
    background: rgba(2, 8, 18, 0.36);
    border-top-color: rgba(126, 160, 218, 0.15);
    color: #657b9d;
}

.theme-aurora #resize-handle {
    background: rgba(75, 104, 151, 0.28);
}

.theme-aurora #resize-handle:hover,
.theme-aurora #resize-handle.active {
    background: linear-gradient(180deg, #4f97ff, #8d68ff);
}

/* 콘텐츠 배경 */
.theme-aurora #content-panel {
    container-type: inline-size;
    background:
        radial-gradient(circle at 82% 0%, rgba(98, 65, 205, 0.1), transparent 28%),
        radial-gradient(circle at 30% 12%, rgba(38, 112, 220, 0.08), transparent 30%),
        #050a17;
    scrollbar-color: #244269 transparent;
}

.theme-aurora #content-panel::-webkit-scrollbar-thumb,
.theme-aurora #tree-container::-webkit-scrollbar-thumb {
    background: #244269;
}

/* 공개 대시보드 */
.theme-aurora #dashboard {
    width: 100%;
    max-width: 1240px;
    padding: 22px 24px 44px;
}

.theme-aurora .dashboard-welcome {
    position: relative;
    min-height: 164px;
    margin-bottom: 12px;
    padding: 34px 38px;
    overflow: hidden;
    text-align: left;
    background:
        radial-gradient(circle at 84% 24%, rgba(121, 92, 255, 0.42), transparent 20%),
        radial-gradient(circle at 67% 72%, rgba(38, 187, 218, 0.26), transparent 28%),
        linear-gradient(120deg, rgba(9, 27, 58, 0.97), rgba(17, 29, 72, 0.94) 55%, rgba(40, 24, 83, 0.92));
    border: 1px solid rgba(115, 155, 225, 0.32);
    border-radius: 14px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), var(--shadow-md);
}

.theme-aurora .dashboard-welcome::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 72% 22%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.5px),
        radial-gradient(circle at 88% 44%, rgba(255, 255, 255, 0.62) 0 1px, transparent 1.5px),
        radial-gradient(circle at 58% 32%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.5px),
        radial-gradient(circle at 94% 17%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.5px);
    opacity: 0.75;
    pointer-events: none;
}

.theme-aurora .dashboard-welcome::after {
    content: '';
    position: absolute;
    right: -6%;
    bottom: -70%;
    width: 58%;
    height: 150%;
    background: linear-gradient(100deg, transparent, rgba(52, 211, 205, 0.14), rgba(139, 91, 255, 0.22), transparent);
    filter: blur(20px);
    transform: rotate(-9deg);
    pointer-events: none;
}

.theme-aurora .dashboard-welcome h1,
.theme-aurora .dashboard-welcome p {
    position: relative;
    z-index: 1;
}

.theme-aurora .dashboard-welcome h1 {
    margin-bottom: 10px;
    color: #ffffff;
    font-size: clamp(28px, 3.3cqi, 40px);
    font-weight: 800;
    letter-spacing: -0.045em;
    text-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.theme-aurora .dashboard-welcome p {
    max-width: 610px;
    color: #bfd0ea;
    font-size: 14px;
    line-height: 1.65;
}

.theme-aurora .dashboard-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.theme-aurora .stat-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 2px 13px;
    min-height: 108px;
    padding: 18px;
    overflow: hidden;
    text-align: left;
    background: linear-gradient(145deg, rgba(15, 34, 65, 0.94), rgba(10, 24, 48, 0.94));
    border-color: rgba(112, 155, 224, 0.24);
    border-radius: 12px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.045);
}

.theme-aurora .stat-card:nth-child(2) {
    background: linear-gradient(145deg, rgba(13, 53, 105, 0.94), rgba(11, 30, 61, 0.94));
    border-color: rgba(68, 143, 255, 0.38);
}

.theme-aurora .stat-card:nth-child(3) {
    background: linear-gradient(145deg, rgba(48, 28, 91, 0.94), rgba(24, 21, 59, 0.94));
    border-color: rgba(151, 104, 255, 0.35);
}

.theme-aurora .stat-card:nth-child(4) {
    background: linear-gradient(145deg, rgba(8, 55, 77, 0.94), rgba(7, 30, 52, 0.94));
    border-color: rgba(45, 177, 208, 0.32);
}

.theme-aurora .stat-card:hover {
    border-color: rgba(112, 171, 255, 0.64);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.07);
    transform: translateY(-2px);
}

.theme-aurora .stat-icon {
    grid-row: 1 / 3;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0;
    background: rgba(89, 134, 255, 0.14);
    border: 1px solid rgba(125, 169, 255, 0.24);
    border-radius: 50%;
    font-size: 20px;
}

.theme-aurora .stat-value {
    align-self: end;
    margin: 0;
    color: #ffffff;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.05;
}

.theme-aurora .stat-label {
    align-self: start;
    color: #91a7c8;
    font-size: 12px;
}

.theme-aurora .dashboard-content {
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.9fr);
    gap: 12px;
    margin-top: 12px;
}

.theme-aurora .dashboard-section {
    padding: 16px;
    background: linear-gradient(145deg, rgba(11, 27, 53, 0.94), rgba(8, 19, 39, 0.96));
    border-color: rgba(113, 154, 219, 0.23);
    border-radius: 12px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), var(--shadow-sm);
}

.theme-aurora .dashboard-section-header {
    margin-bottom: 7px;
    padding: 0 2px 11px;
    border-bottom-color: rgba(119, 155, 212, 0.2);
}

.theme-aurora .dashboard-section-header h2 {
    color: #eef5ff;
    font-size: 15px;
}

.theme-aurora .dashboard-section-header span {
    color: #7187a8;
}

.theme-aurora .dashboard-post-link {
    min-height: 48px;
    padding: 8px 9px;
    border: 1px solid transparent;
}

.theme-aurora .dashboard-post-link:hover {
    background: linear-gradient(90deg, rgba(42, 91, 159, 0.26), rgba(106, 69, 173, 0.12));
    border-color: rgba(105, 167, 255, 0.16);
    color: #ffffff;
}

.theme-aurora .dashboard-rank {
    background: rgba(77, 119, 213, 0.17);
    border: 1px solid rgba(110, 159, 255, 0.18);
    color: #91bdff;
}

.theme-aurora .dashboard-post-title {
    color: #eaf2ff;
    font-size: 13px;
}

.theme-aurora .dashboard-post-path,
.theme-aurora .dashboard-post-meta {
    color: #7188aa;
}

/* 게시글 읽기 */
.theme-aurora #post-view,
.theme-aurora #post-editor {
    width: 100%;
    max-width: 1120px;
    padding: 26px 30px 44px;
    view-transition-name: content-panel;
}

.theme-aurora .post-header {
    margin-bottom: 22px;
    padding: 22px 24px 18px;
    background: linear-gradient(145deg, rgba(12, 29, 56, 0.94), rgba(9, 21, 42, 0.96));
    border: 1px solid rgba(114, 156, 223, 0.22);
    border-radius: 12px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.theme-aurora .post-header h2 {
    color: #ffffff;
    font-size: clamp(23px, 3cqi, 32px);
    letter-spacing: -0.04em;
}

.theme-aurora .meta-badge {
    background: rgba(53, 105, 190, 0.18);
    border-color: rgba(91, 154, 255, 0.28);
    color: #8fbfff;
}

.theme-aurora .post-body {
    min-height: 260px;
    padding: 6px 4px 10px;
    color: #e7eef9;
    font-size: 15px;
    line-height: 1.55;
}

.theme-aurora .post-body p {
    margin-bottom: 6px;
}

.theme-aurora .post-body h1,
.theme-aurora .post-body h2,
.theme-aurora .post-body h3 {
    color: #ffffff;
    letter-spacing: -0.035em;
}

.theme-aurora .post-body a {
    color: #70b2ff;
    text-decoration: underline;
    text-decoration-color: rgba(112, 178, 255, 0.32);
    text-underline-offset: 3px;
}

.theme-aurora .post-body img {
    border: 1px solid rgba(122, 159, 219, 0.22);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.theme-aurora .post-body pre,
.theme-aurora .post-body blockquote,
.theme-aurora .post-body table {
    background: rgba(9, 22, 43, 0.82);
    border-color: rgba(119, 158, 220, 0.2);
}

.theme-aurora .post-footer {
    border-top-color: rgba(118, 153, 210, 0.2);
}

.theme-aurora .like-btn,
.theme-aurora .action-btn {
    background: rgba(13, 28, 52, 0.8);
    border-radius: 8px;
}

.theme-aurora .like-btn:hover,
.theme-aurora .action-btn:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

/* 댓글 */
.theme-aurora #comments-section {
    padding: 20px;
    background: linear-gradient(145deg, rgba(10, 24, 47, 0.92), rgba(7, 18, 36, 0.95));
    border: 1px solid rgba(112, 151, 214, 0.2);
    border-radius: 12px;
}

.theme-aurora #comment-content {
    background: rgba(4, 12, 26, 0.64);
    border-color: rgba(119, 157, 218, 0.24);
    border-radius: 9px;
    color: #edf5ff;
}

.theme-aurora #comment-content:focus {
    border-color: rgba(105, 167, 255, 0.64);
    box-shadow: 0 0 0 3px rgba(83, 143, 239, 0.12);
}

.theme-aurora .comment-submit-btn {
    background: linear-gradient(135deg, #367fe5, #7561e8);
    border-radius: 8px;
    color: #ffffff;
}

.theme-aurora .comment-item {
    padding: 14px 2px;
    border-bottom-color: rgba(116, 151, 207, 0.16);
}

/* 편집기와 모달 */
.theme-aurora .editor-header h2,
.theme-aurora .modal-box h3 {
    color: #ffffff;
}

.theme-aurora .form-row input[type="text"],
.theme-aurora .modal-box input[type="password"] {
    background: rgba(5, 14, 30, 0.78);
    border-color: rgba(116, 156, 220, 0.24);
    border-radius: 8px;
    color: #ffffff;
}

.theme-aurora .note-editor.note-frame {
    overflow: hidden;
    background: rgba(6, 16, 34, 0.84);
    border-color: rgba(115, 155, 219, 0.25) !important;
    border-radius: 10px;
}

.theme-aurora .note-toolbar,
.theme-aurora .note-statusbar {
    background: #0d1c33 !important;
    border-color: rgba(118, 155, 214, 0.2) !important;
}

.theme-aurora .note-editing-area .note-editable {
    background: #071225 !important;
    color: #edf4ff !important;
    font-family: 'Noto Sans KR', var(--font-family) !important;
    font-size: 14px !important;
}

.theme-aurora .modal-overlay {
    background: rgba(1, 5, 14, 0.78);
    backdrop-filter: blur(8px);
}

.theme-aurora .modal-box {
    background: linear-gradient(145deg, #0d1e39, #09162b);
    border: 1px solid rgba(118, 160, 226, 0.28);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.theme-aurora .modal-btn {
    background: linear-gradient(135deg, #3f82e8, #7564e6);
    border-radius: 8px;
}

.theme-aurora .toast {
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
}

@container (max-width: 900px) {
    .theme-aurora .dashboard-content {
        grid-template-columns: 1fr;
    }

    .theme-aurora .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container (max-width: 560px) {
    .theme-aurora .dashboard-welcome {
        min-height: 145px;
        padding: 26px 22px;
    }

    .theme-aurora .dashboard-welcome h1 {
        font-size: 27px;
    }

    .theme-aurora .dashboard-stats {
        grid-template-columns: 1fr 1fr;
    }

    .theme-aurora .stat-card {
        grid-template-columns: 36px minmax(0, 1fr);
        min-height: 86px;
        padding: 12px;
    }

    .theme-aurora .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .theme-aurora .dashboard-post-meta {
        display: none;
    }
}

@media (max-width: 768px) {
    body.theme-aurora {
        --header-height: 50px;
        font-size: 14px;
    }

    .theme-aurora #app-header {
        padding: 0 12px;
    }

    .theme-aurora .header-left .logo {
        font-size: 16px;
    }

    .theme-aurora .header-btn {
        padding: 6px 9px;
        font-size: 12px;
    }

    .theme-aurora #tree-panel {
        max-height: 36vh;
    }

    .theme-aurora #dashboard {
        padding: 14px 12px 28px;
    }

    .theme-aurora .dashboard-welcome {
        border-radius: 11px;
    }

    .theme-aurora .dashboard-section,
    .theme-aurora .stat-card,
    .theme-aurora .post-header,
    .theme-aurora #comments-section {
        border-radius: 10px;
    }

    .theme-aurora #post-view,
    .theme-aurora #post-editor {
        padding: 16px 14px 30px;
    }

    .theme-aurora .post-header {
        padding: 18px 16px 15px;
    }

    .theme-aurora .post-body {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-aurora *,
    .theme-aurora *::before,
    .theme-aurora *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
