/* ========================================
   CHARM BLOG - Stylesheet
   Matches notes app aesthetic
   ======================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --cyan: #00d4aa;
    --blue: #4a9eff;
    --purple: #a855f7;
    --cyan-glow: rgba(0, 212, 170, 0.45);
    --blue-glow: rgba(74, 158, 255, 0.45);
    --purple-glow: rgba(168, 85, 247, 0.45);
    --cyan-glow-soft: rgba(0, 212, 170, 0.12);
    --blue-glow-soft: rgba(74, 158, 255, 0.12);
    --purple-glow-soft: rgba(168, 85, 247, 0.12);

    --app-bg: rgba(255, 255, 255, 0.82);
    --app-border: rgba(0, 0, 0, 0.12);
    --app-shadow: 0 20px 80px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    --sidebar-bg: rgba(246, 244, 241, 0.65);
    --sidebar-border: rgba(0, 0, 0, 0.06);
    --sidebar-active: rgba(59, 130, 245, 0.1);
    --sidebar-active-border: rgba(59, 130, 245, 0.35);
    --titlebar-bg: rgba(246, 244, 241, 0.45);
    --toolbar-bg: rgba(246, 244, 241, 0.55);
    --toolbar-border: rgba(0, 0, 0, 0.06);
    --editor-bg: rgba(255, 255, 255, 0.95);
    --statusbar-bg: rgba(246, 244, 241, 0.5);
    --text-1: #1a1a1a;
    --text-2: #555;
    --text-3: #999;
    --text-ghost: rgba(0, 0, 0, 0.15);
    --divider: rgba(0, 0, 0, 0.08);
    --callout-bg: rgba(59, 130, 245, 0.06);
    --callout-border: rgba(59, 130, 245, 0.2);
    --callout-subtle-bg: rgba(0, 0, 0, 0.03);
    --callout-subtle-border: rgba(0, 0, 0, 0.08);
    --check-color: #34C759;
    --tb-hover: rgba(0, 0, 0, 0.06);
    --tb-active: rgba(0, 0, 0, 0.1);
}

html, body {
    height: 100%;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    background: linear-gradient(180deg,
        #f0e4d0 0%, #e8dcc4 8%, #dfd5be 16%,
        #d4cfbf 24%, #c9cbc2 32%, #bdc8ca 40%,
        #b0c4d2 48%, #a4c0d8 56%, #97bbdd 64%,
        #8ab5e0 72%, #7eafe2 80%, #72a9e3 88%,
        #6ba4e1 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* App frame */
.blog-app {
    width: calc(100% - 64px);
    max-width: 1200px;
    margin: 32px auto;
    min-height: calc(100vh - 64px);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(50px) saturate(1.4);
    -webkit-backdrop-filter: blur(50px) saturate(1.4);
    border: 0.5px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 2px 8px rgba(0,0,0,0.02), 0 8px 24px rgba(0,0,0,0.04),
        0 24px 60px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: appEntrance 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(12px) scale(0.998);
}

@keyframes appEntrance {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Titlebar */
.titlebar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    user-select: none;
}

.titlebar-left { display: flex; align-items: center; gap: 2px; min-width: 80px; }
.traffic-lights { display: flex; gap: 8px; margin-right: 16px; }
.tl { width: 10px; height: 10px; border-radius: 50%; position: relative; transition: filter 0.15s ease; }
.tl:hover { filter: brightness(1.1); }
.tl::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 -0.5px 1px rgba(0,0,0,0.1); }
.tl-close { background: #FF5F57; }
.tl-mini { background: #FEBC2E; }
.tl-expand { background: #28C840; }

.titlebar-center {
    flex: 1; text-align: center;
    font-size: 0.72rem; font-weight: 600; color: var(--text-3);
}

.titlebar-right {
    min-width: 80px; display: flex;
    align-items: center; justify-content: flex-end; gap: 8px;
}

.titlebar-cta {
    display: inline-flex; align-items: center;
    padding: 3px 12px; border-radius: 6px;
    font-size: 0.65rem; font-weight: 600;
    color: var(--check-color); text-decoration: none;
    background: rgba(52, 199, 89, 0.06);
    border: 1px solid rgba(52, 199, 89, 0.2);
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.titlebar-cta:hover {
    background: rgba(52, 199, 89, 0.12);
    border-color: rgba(52, 199, 89, 0.35);
    text-decoration: none;
}

/* Main layout */
.blog-main { flex: 1; display: flex; overflow: hidden; }

/* Sidebar */
.blog-sidebar {
    width: 220px; min-width: 220px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column;
    padding: 12px 8px; overflow-y: auto;
}

.sidebar-label {
    font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3); padding: 8px 10px 6px;
}

.sidebar-back {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 10px; border-radius: 6px;
    font-size: 0.78rem; font-weight: 500;
    color: var(--blue); text-decoration: none;
    margin-bottom: 8px;
    transition: background 0.15s ease;
}

.sidebar-back:hover { background: rgba(0, 0, 0, 0.03); }
.sidebar-back svg { width: 14px; height: 14px; stroke: var(--blue); }

.blog-nav-item {
    padding: 8px 10px; border-radius: 6px;
    cursor: pointer; border-left: 2px solid transparent;
    margin-bottom: 1px; text-decoration: none; display: block;
    transition: background 0.15s ease;
}

.blog-nav-item:hover { background: rgba(0, 0, 0, 0.03); }

.blog-nav-item.active {
    background: var(--sidebar-active);
    border-left-color: var(--sidebar-active-border);
}

.blog-nav-title {
    font-size: 0.78rem; font-weight: 600; color: var(--text-1);
    margin-bottom: 2px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.blog-nav-meta { font-size: 0.62rem; color: var(--text-3); }

/* Editor area */
.blog-editor {
    flex: 1; display: flex; flex-direction: column;
    background: var(--editor-bg); overflow: hidden;
}

/* Toolbar */
.toolbar {
    display: flex; align-items: center; gap: 3px;
    padding: 4px 12px; height: 36px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--toolbar-border);
    flex-shrink: 0;
}

.tb-breadcrumb {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.7rem; color: var(--text-3);
}

.tb-breadcrumb a { color: var(--text-3); text-decoration: none; transition: color 0.15s ease; }
.tb-breadcrumb a:hover { color: var(--blue); }
.tb-breadcrumb .tb-sep-arrow { opacity: 0.4; }
.tb-breadcrumb .tb-current { color: var(--text-2); font-weight: 500; }
.tb-spacer { flex: 1; }

.charm-indicator {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.7rem; font-weight: 600; color: var(--text-3);
}

.charm-indicator img { width: 16px; height: 16px; border-radius: 4px; }

/* Article content */
.article-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.article-body { max-width: 680px; margin: 0; padding: 32px 48px 80px; }

.article-title {
    font-size: 1.8rem; font-weight: 700;
    letter-spacing: -0.01em; line-height: 1.2; margin-bottom: 8px;
}

.article-meta {
    display: flex; align-items: center; gap: 12px;
    font-size: 0.75rem; color: var(--text-3); margin-bottom: 28px;
}

.article-tag {
    display: inline-block; padding: 1px 8px; border-radius: 4px;
    font-size: 0.65rem; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
}

.article-tag-guide       { background: rgba(74, 158, 255, 0.1);  color: var(--blue); }
.article-tag-writing     { background: rgba(168, 85, 247, 0.1);  color: var(--purple); }
.article-tag-product     { background: rgba(0, 212, 170, 0.1);   color: var(--cyan); }
.article-tag-comparison  { background: rgba(74, 158, 255, 0.1);  color: var(--blue); }
.article-tag-howto       { background: rgba(0, 212, 170, 0.1);   color: var(--cyan); }
.article-tag-trouble     { background: rgba(255, 179, 0, 0.1);   color: #d97706; }
.article-tag-edu         { background: rgba(168, 85, 247, 0.1);  color: var(--purple); }
.article-tag-persona     { background: rgba(99, 102, 241, 0.1);  color: #6366f1; }
.article-tag-glossary    { background: rgba(100, 116, 139, 0.1); color: #64748b; }
.article-tag-listicle    { background: rgba(249, 115, 22, 0.1);  color: #ea580c; }
.article-tag-pillar      { background: rgba(52, 199, 89, 0.1);   color: var(--check-color); }

.article-body h2 { font-size: 1.2rem; font-weight: 700; margin: 32px 0 12px; }
.article-body h3 { font-size: 1rem; font-weight: 600; margin: 24px 0 8px; }

.article-body p {
    font-size: 0.9rem; line-height: 1.75;
    color: var(--text-2); margin-bottom: 14px;
}

.article-body strong { color: var(--text-1); }
.article-body a { color: var(--blue); text-decoration: none; }
.article-body a:hover { text-decoration: underline; }

/* Callout */
.callout {
    padding: 14px 16px; border-radius: 8px;
    background: var(--callout-subtle-bg); border: 1px solid var(--callout-subtle-border);
    font-size: 0.88rem; line-height: 1.6; color: var(--text-2); margin: 16px 0;
}

.callout strong { color: var(--text-1); }

/* Checklist */
.note-checklist { list-style: none; padding: 0; margin: 12px 0; }

.note-checklist li {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.88rem; color: var(--text-2);
    margin-bottom: 6px; line-height: 1.5;
}

.check-box {
    width: 16px; height: 16px; border-radius: 4px;
    background: var(--check-color);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
}

.check-box::after { content: '\2713'; color: #fff; font-size: 0.6rem; font-weight: 700; }

/* Table */
.note-table-wrapper {
    overflow-x: auto; border-radius: 8px;
    border: 1px solid var(--callout-subtle-border); margin: 16px 0;
}

.note-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

.note-table th {
    padding: 8px 14px; text-align: left;
    font-weight: 600; font-size: 0.72rem;
    background: var(--callout-subtle-bg);
    border-bottom: 1px solid var(--callout-subtle-border);
}

.note-table td { padding: 8px 14px; border-bottom: 1px solid var(--callout-subtle-border); }
.note-table tr:last-child td { border-bottom: none; }

/* CTA block */
.article-cta {
    margin-top: 32px;
}

.article-cta-headline {
    font-size: 1.05rem; font-weight: 700;
    color: var(--text-1); margin-bottom: 6px;
}

.article-cta-intro {
    font-size: 0.82rem; color: var(--text-3);
    margin-bottom: 12px; line-height: 1.5;
}

.article-cta-buttons {
    display: flex; gap: 10px;
}

.article-cta-btn {
    flex: 1; display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; border-radius: 12px;
    background: rgba(52, 199, 89, 0.06);
    border: 1.5px solid rgba(52, 199, 89, 0.2);
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease,
                transform 0.2s ease, box-shadow 0.2s ease;
}

.article-cta-btn:hover {
    background: rgba(52, 199, 89, 0.12);
    border-color: rgba(52, 199, 89, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.15);
    text-decoration: none;
}

.article-cta-checkbox {
    width: 24px; height: 24px; border-radius: 7px;
    border: 2.5px solid rgba(52, 199, 89, 0.35);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: transparent;
}

.article-cta-btn:hover .article-cta-checkbox {
    border-color: #34C759;
    background: #34C759;
    transform: scale(1.08);
}

.article-cta-tick {
    opacity: 0; color: #fff;
    font-size: 0.75rem; font-weight: 800;
    transition: opacity 0.2s ease;
}

.article-cta-btn:hover .article-cta-tick { opacity: 1; }

.article-cta-label {
    font-size: 1rem; font-weight: 700;
    color: var(--text-1); flex: 1;
}

.article-cta-price {
    font-size: 0.85rem; font-weight: 600;
    color: #34C759; white-space: nowrap;
}

.article-cta-secondary {
    flex: 1; display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; border-radius: 12px;
    text-decoration: none;
    border: 1.5px solid rgba(74, 158, 255, 0.25);
    background: rgba(74, 158, 255, 0.06);
    transition: background 0.2s ease, border-color 0.2s ease,
                transform 0.2s ease, box-shadow 0.2s ease;
}

.article-cta-secondary:hover {
    background: rgba(74, 158, 255, 0.12);
    border-color: rgba(74, 158, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.15);
    text-decoration: none;
}

.article-cta-secondary .article-cta-label { color: var(--blue); }

.article-cta-secondary .article-cta-checkbox {
    border: 2.5px solid rgba(74, 158, 255, 0.35);
}

.article-cta-secondary:hover .article-cta-checkbox {
    border-color: var(--blue);
    background: var(--blue);
    transform: scale(1.08);
}

.article-cta-secondary:hover .article-cta-tick { opacity: 1; }

@media (max-width: 768px) {
    .article-cta-buttons { flex-direction: column; }
}

/* Related posts */
.related-posts { margin-top: 32px; }

.related-posts h3 {
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3); margin-bottom: 12px;
}

.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.related-card {
    padding: 14px 16px; border-radius: 8px;
    background: var(--callout-subtle-bg); border: 1px solid var(--callout-subtle-border);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.related-card:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

.related-card-title {
    font-size: 0.82rem; font-weight: 600; color: var(--text-1);
    margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.related-card-meta { font-size: 0.65rem; color: var(--text-3); }

/* Status bar */
.statusbar {
    display: flex; align-items: center; justify-content: space-between;
    height: 26px; padding: 0 14px;
    background: var(--statusbar-bg);
    border-top: 1px solid var(--divider);
    font-size: 0.65rem; color: var(--text-3); flex-shrink: 0;
}

/* Blog index grid */
.blog-index-body { padding: 32px 48px 80px; }

.blog-index-title {
    font-size: 1.8rem; font-weight: 700;
    letter-spacing: -0.01em; margin-bottom: 6px;
}

.blog-index-meta {
    font-size: 0.85rem; color: var(--text-3); margin-bottom: 28px;
}

.blog-category-label {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3); margin: 24px 0 10px;
}

.blog-category-label:first-of-type { margin-top: 0; }

.blog-post-card {
    display: block; padding: 16px 18px; border-radius: 10px;
    background: var(--callout-subtle-bg); border: 1px solid var(--callout-subtle-border);
    text-decoration: none; margin-bottom: 8px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.blog-post-card:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

.blog-post-card-title {
    font-size: 0.95rem; font-weight: 600; color: var(--text-1); margin-bottom: 4px;
}

.blog-post-card-desc {
    font-size: 0.82rem; color: var(--text-2); line-height: 1.5; margin-bottom: 6px;
}

.blog-post-card-meta { font-size: 0.65rem; color: var(--text-3); }

/* Sidebar "View all posts" link */
.sidebar-view-all {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 10px; border-radius: 6px;
    font-size: 0.72rem; font-weight: 600;
    color: var(--blue); text-decoration: none;
    margin-top: 4px;
    transition: background 0.15s ease;
}

.sidebar-view-all:hover { background: rgba(0, 0, 0, 0.03); }

/* Responsive */
@media (max-width: 900px) {
    .blog-app {
        width: calc(100% - 32px);
        margin: 16px auto;
        min-height: calc(100vh - 32px);
    }
}

@media (max-width: 768px) {
    .blog-app {
        width: 100%; margin: 0;
        border-radius: 0; border: none; min-height: 100vh;
        backdrop-filter: none; -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: none;
        animation: none; opacity: 1; transform: none;
    }
    .blog-sidebar { display: none; }
    .toolbar { display: none; }
    .article-body { padding: 24px 20px 60px; }
    .blog-index-body { padding: 24px 20px 60px; }
    .article-title, .blog-index-title { font-size: 1.5rem; }
    .related-grid { grid-template-columns: 1fr; }
    .titlebar-left .tl { display: none; }
    .titlebar-left .traffic-lights { display: none; }
    .article-cta { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .article-body { padding: 20px 16px 60px; }
    .blog-index-body { padding: 20px 16px 60px; }
    .article-title, .blog-index-title { font-size: 1.3rem; }
}
