/* =============================================================
   ChipHead Ghost Theme — Main Stylesheet
   Design language: chiphead.tech
   Fonts: Quicksand (headings) + Inter (body)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* =============================================================
   1. DESIGN TOKENS
   ============================================================= */
:root {
    --ch-bg:          #15151d;
    --ch-bg-alt:      #111118;
    --ch-card:        #1e1e2a;
    --ch-card-alt:    #232334;
    --ch-border:      #2a2a38;
    --ch-border-2:    #33334a;

    --ch-accent:      #0ea7e7;
    --ch-accent-hover:#0c8ec4;
    --ch-accent-soft: rgba(14, 167, 231, 0.10);
    --ch-accent-glow: rgba(14, 167, 231, 0.20);
    --ch-green:       #53dd6c;
    --ch-green-hover: #45c95e;
    --ch-green-soft:  rgba(83, 221, 108, 0.12);

    --ch-text:        #e6fafc;
    --ch-muted:       #a0b0b8;
    --ch-dim:         #6b7a82;

    --ch-font-head:   'Quicksand', system-ui, sans-serif;
    --ch-font-body:   'Inter', system-ui, sans-serif;

    --radius:         10px;
    --radius-lg:      16px;
    --radius-xl:      24px;

    --shadow:         0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-up:      0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow:    0 0 40px rgba(14, 167, 231, 0.12);

    --ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --transition:     0.3s var(--ease);

    --max-w:          1200px;
    --max-w-content:  760px;
}

/* =============================================================
   2. RESET & BASE
   ============================================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--ch-font-body);
    background: var(--ch-bg);
    color: var(--ch-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    font-size: 16px;
}

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

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

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

/* =============================================================
   3. LAYOUT UTILITIES
   ============================================================= */
.ch-wrap {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

.ch-wrap-sm {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

.ch-section {
    padding: clamp(60px, 8vw, 100px) 0;
}

/* =============================================================
   4. HEADER / NAV
   ============================================================= */
.ch-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(21, 21, 29, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--ch-border);
    transition: background var(--transition), border-color var(--transition);
}

.ch-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    gap: 32px;
}

/* Logo */
.ch-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.ch-logo-mark {
    width: 36px;
    height: 36px;
}

.ch-logo-text {
    font-family: var(--ch-font-head);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ch-text);
    letter-spacing: 0.5px;
    line-height: 1;
}

.ch-logo-text span {
    color: var(--ch-accent);
}

/* Nav links */
.ch-nav ul {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ch-nav {
    display: flex;
    align-items: center;
}

.ch-nav a {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ch-muted);
    border-radius: var(--radius);
    transition: all var(--transition);
    text-decoration: none;
    letter-spacing: 0.2px;
}

.ch-nav a:hover,
.ch-nav a.active {
    color: var(--ch-text);
    background: rgba(255, 255, 255, 0.06);
}

.ch-nav a.nav-current {
    color: var(--ch-accent);
}

/* Nav CTA */
.ch-nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--ch-green);
    color: #0e0e14 !important;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    letter-spacing: 0.3px;
}

.ch-nav-cta:hover {
    background: var(--ch-green-hover);
    transform: translateY(-1px);
    color: #0e0e14 !important;
}

/* Search toggle */
.ch-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ch-muted);
    padding: 8px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    transition: color var(--transition), background var(--transition);
}

.ch-search-btn:hover {
    color: var(--ch-text);
    background: rgba(255, 255, 255, 0.06);
}

/* Mobile menu toggle */
.ch-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ch-muted);
    padding: 8px;
    border-radius: var(--radius);
    flex-direction: column;
    gap: 5px;
}

.ch-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all var(--transition);
}

/* =============================================================
   5. HERO — INDEX PAGE
   ============================================================= */
.ch-hero {
    position: relative;
    padding: clamp(80px, 12vw, 130px) 0 clamp(60px, 8vw, 100px);
    overflow: hidden;
    text-align: center;
}

.ch-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(14, 167, 231, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(83, 221, 108, 0.05) 0%, transparent 60%);
    z-index: 0;
    pointer-events: none;
}

.ch-hero-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(14, 167, 231, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 167, 231, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: linear-gradient(to bottom, transparent, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0.6) 70%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0.6) 70%, transparent);
    z-index: 0;
    pointer-events: none;
}

.ch-hero-inner {
    position: relative;
    z-index: 1;
}

.ch-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--ch-green-soft);
    border: 1px solid rgba(83, 221, 108, 0.2);
    color: var(--ch-green);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 24px;
}

.ch-hero-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--ch-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.ch-hero h1 {
    font-family: var(--ch-font-head);
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.ch-hero h1 .accent { color: var(--ch-accent); }
.ch-hero h1 .green  { color: var(--ch-green); }

.ch-hero-sub {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: var(--ch-muted);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.75;
}

/* =============================================================
   6. FEATURED POST (hero card)
   ============================================================= */
.ch-featured {
    padding: clamp(40px, 6vw, 70px) 0;
    border-bottom: 1px solid var(--ch-border);
}

.ch-featured-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(32px, 5vw, 64px);
    align-items: center;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
}

.ch-featured-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ch-accent), var(--ch-green));
}

.ch-featured-card:hover {
    border-color: rgba(14, 167, 231, 0.25);
    box-shadow: var(--shadow-up), var(--shadow-glow);
    transform: translateY(-4px);
}

.ch-featured-img {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.ch-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.ch-featured-card:hover .ch-featured-img img {
    transform: scale(1.04);
}

.ch-featured-img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(14, 167, 231, 0.15), rgba(83, 221, 108, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.ch-featured-body {
    padding: clamp(28px, 4vw, 48px);
    padding-left: 0;
}

.ch-featured-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--ch-accent-soft);
    color: var(--ch-accent);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.ch-featured-title {
    font-family: var(--ch-font-head);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 14px;
    letter-spacing: -0.3px;
}

.ch-featured-excerpt {
    color: var(--ch-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ch-featured-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ch-featured-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ch-featured-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ch-border-2);
}

.ch-featured-author-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ch-text);
}

.ch-featured-date {
    font-size: 0.82rem;
    color: var(--ch-dim);
}

.ch-featured-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--ch-accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    margin-top: 8px;
}

.ch-featured-read-more:hover {
    background: var(--ch-accent-hover);
    color: #fff;
    transform: translateX(4px);
}

.ch-featured-read-more svg {
    transition: transform var(--transition);
}

.ch-featured-card:hover .ch-featured-read-more svg {
    transform: translateX(4px);
}

/* =============================================================
   7. POST GRID
   ============================================================= */
.ch-posts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    flex-wrap: wrap;
    gap: 16px;
}

.ch-posts-title {
    font-family: var(--ch-font-head);
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ch-posts-title::after {
    content: '';
    display: block;
    height: 3px;
    width: 40px;
    background: #0ea7e7;
    border-radius: 2px;
}

.ch-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* Post Card */
.ch-post-card {
    display: flex;
    flex-direction: column;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
}

.ch-post-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #0ea7e7;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s var(--ease);
}

.ch-post-card:hover {
    border-color: rgba(14, 167, 231, 0.2);
    transform: translateY(-5px);
    box-shadow: var(--shadow-up);
}

.ch-post-card:hover::after {
    transform: scaleX(1);
}

.ch-post-card-img {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--ch-card-alt);
}

.ch-post-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease);
}

.ch-post-card:hover .ch-post-card-img img {
    transform: scale(1.06);
}

.ch-post-card-img-placeholder {
    width: 100%;
    height: 100%;
    min-height: 180px;
    background: linear-gradient(135deg, rgba(14, 167, 231, 0.1), rgba(83, 221, 108, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ch-dim);
}

.ch-post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 22px 22px;
}

.ch-post-card-tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--ch-accent-soft);
    color: var(--ch-accent);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    width: fit-content;
}

.ch-post-card-title {
    font-family: var(--ch-font-head);
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--transition);
}

.ch-post-card:hover .ch-post-card-title {
    color: var(--ch-accent);
}

.ch-post-card-excerpt {
    font-size: 0.875rem;
    color: var(--ch-muted);
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
    flex: 1;
}

.ch-post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--ch-border);
    gap: 8px;
    flex-wrap: wrap;
}

.ch-post-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ch-post-card-author img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.ch-post-card-author-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ch-muted);
}

.ch-post-card-date {
    font-size: 0.78rem;
    color: var(--ch-dim);
}

.ch-post-card-read-time {
    font-size: 0.78rem;
    color: var(--ch-dim);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* =============================================================
   8. PAGINATION
   ============================================================= */
.ch-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 60px 0 20px;
}

.ch-pagination a,
.ch-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--ch-border);
    color: var(--ch-muted);
    background: var(--ch-card);
    transition: all var(--transition);
    text-decoration: none;
}

.ch-pagination a:hover {
    border-color: var(--ch-accent);
    color: var(--ch-accent);
    background: var(--ch-accent-soft);
}

.ch-pagination .active,
.ch-pagination .current {
    background: var(--ch-accent);
    border-color: var(--ch-accent);
    color: #fff;
}

.ch-pagination .older-posts,
.ch-pagination .newer-posts {
    width: auto;
    padding: 0 16px;
    gap: 6px;
}

/* =============================================================
   9. SINGLE POST
   ============================================================= */
.ch-post-hero {
    position: relative;
    padding: clamp(60px, 8vw, 100px) 0 0;
    text-align: center;
    overflow: hidden;
}

.ch-post-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(14, 167, 231, 0.1) 0%, transparent 65%);
    z-index: 0;
    pointer-events: none;
}

.ch-post-hero-inner {
    position: relative;
    z-index: 1;
    max-width: var(--max-w-content);
    margin: 0 auto;
    padding: 0 24px;
}

.ch-post-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ch-post-tag {
    display: inline-block;
    padding: 4px 14px;
    background: var(--ch-accent-soft);
    border: 1px solid rgba(14, 167, 231, 0.2);
    color: var(--ch-accent);
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: all var(--transition);
}

.ch-post-tag:hover {
    background: var(--ch-accent);
    color: #fff;
    border-color: var(--ch-accent);
}

.ch-post-title {
    font-family: var(--ch-font-head);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.ch-post-excerpt-intro {
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    color: var(--ch-muted);
    line-height: 1.75;
    margin-bottom: 28px;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.ch-post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.ch-post-meta-author {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.ch-post-meta-author img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ch-border-2);
}

.ch-post-meta-author-info {
    text-align: left;
}

.ch-post-meta-author-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ch-text);
    display: block;
}

.ch-post-meta-date {
    font-size: 0.8rem;
    color: var(--ch-dim);
}

.ch-post-meta-divider {
    width: 1px;
    height: 32px;
    background: var(--ch-border);
}

.ch-post-meta-read-time {
    font-size: 0.85rem;
    color: var(--ch-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Feature image */
.ch-post-feature-img {
    margin: 40px auto 0;
    max-width: var(--max-w);
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.ch-post-feature-img img {
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    border-radius: var(--radius-xl);
    border: 1px solid var(--ch-border);
    box-shadow: var(--shadow-up);
}

/* Post content */
.ch-post-content-wrap {
    display: grid;
    grid-template-columns: 1fr min(var(--max-w-content), 100%) 1fr;
    padding: clamp(40px, 6vw, 70px) 24px;
}

.ch-post-content-wrap > * {
    grid-column: 2;
}

.gh-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--ch-text);
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
    font-family: var(--ch-font-head);
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    margin: 2em 0 0.6em;
    letter-spacing: -0.3px;
}

.gh-content h2 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); }
.gh-content h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
.gh-content h4 { font-size: 1.1rem; }

.gh-content p { margin-bottom: 1.5em; }

.gh-content a {
    color: var(--ch-accent);
    text-decoration: underline;
    text-decoration-color: rgba(14, 167, 231, 0.4);
    text-underline-offset: 3px;
    transition: all var(--transition);
}

.gh-content a:hover {
    color: var(--ch-accent-hover);
    text-decoration-color: var(--ch-accent);
}

.gh-content strong { color: #fff; font-weight: 700; }
.gh-content em { color: var(--ch-muted); }

.gh-content ul,
.gh-content ol {
    margin: 0 0 1.5em 1.5em;
    padding: 0;
}

.gh-content li { margin-bottom: 0.5em; color: var(--ch-muted); }
.gh-content li strong { color: var(--ch-text); }

.gh-content blockquote {
    margin: 2em 0;
    padding: 20px 24px;
    border-left: 4px solid var(--ch-accent);
    background: var(--ch-card);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--ch-muted);
    font-size: 1.05rem;
    line-height: 1.75;
}

.gh-content blockquote p { margin: 0; }

.gh-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    background: var(--ch-card-alt);
    color: var(--ch-green);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--ch-border);
}

.gh-content pre {
    background: #0e0e14;
    border: 1px solid var(--ch-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    overflow-x: auto;
    margin: 2em 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--ch-text);
}

.gh-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

.gh-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ch-border), transparent);
    margin: 3em 0;
}

.gh-content img {
    border-radius: var(--radius-lg);
    border: 1px solid var(--ch-border);
    margin: 1.5em 0;
}

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.9rem;
}

.gh-content th {
    background: var(--ch-card-alt);
    color: var(--ch-text);
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border: 1px solid var(--ch-border);
    font-family: var(--ch-font-head);
}

.gh-content td {
    padding: 10px 16px;
    border: 1px solid var(--ch-border);
    color: var(--ch-muted);
    vertical-align: top;
}

.gh-content tr:nth-child(even) td {
    background: rgba(30, 30, 42, 0.4);
}

/* Wide / full content */
.kg-width-wide {
    grid-column: 1 / 4 !important;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
}

.kg-width-full {
    grid-column: 1 / 4 !important;
    margin: 0;
}

/* Ghost cards */
.kg-card { margin: 2em 0; }

.kg-image-card img {
    border-radius: var(--radius-lg);
    border: 1px solid var(--ch-border);
}

.kg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.kg-gallery-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 0;
}

.kg-embed-card iframe {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--ch-border);
}

.kg-callout-card {
    display: flex;
    gap: 16px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.kg-callout-card-green { border-left: 4px solid var(--ch-green); }
.kg-callout-card-blue  { border-left: 4px solid var(--ch-accent); }

.kg-callout-emoji { font-size: 1.4rem; flex-shrink: 0; }

.kg-toggle-card {
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.kg-toggle-card-header {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.kg-toggle-content { padding: 0 20px 16px; color: var(--ch-muted); }

/* =============================================================
   10. POST SHARING + TAGS
   ============================================================= */
.ch-post-footer {
    max-width: var(--max-w-content);
    margin: 0 auto;
    padding: 0 24px 60px;
}

.ch-post-footer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--ch-border);
}

.ch-post-footer-tag {
    display: inline-block;
    padding: 6px 16px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    color: var(--ch-muted);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
}

.ch-post-footer-tag:hover {
    border-color: var(--ch-accent);
    color: var(--ch-accent);
    background: var(--ch-accent-soft);
}

.ch-share {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ch-share-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ch-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ch-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition);
}

.ch-share-btn.twitter { background: rgba(29, 161, 242, 0.12); color: #1da1f2; }
.ch-share-btn.twitter:hover { background: #1da1f2; color: #fff; }
.ch-share-btn.linkedin { background: rgba(0, 119, 181, 0.12); color: #0077b5; }
.ch-share-btn.linkedin:hover { background: #0077b5; color: #fff; }
.ch-share-btn.copy { background: var(--ch-card); color: var(--ch-muted); border: 1px solid var(--ch-border); }
.ch-share-btn.copy:hover { border-color: var(--ch-accent); color: var(--ch-accent); background: var(--ch-accent-soft); }

/* =============================================================
   11. AUTHOR BIO (post bottom)
   ============================================================= */
.ch-author-bio {
    max-width: var(--max-w-content);
    margin: 0 auto 60px;
    padding: 0 24px;
}

.ch-author-bio-card {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius-xl);
    padding: clamp(24px, 4vw, 36px);
}

.ch-author-bio-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--ch-border-2);
}

.ch-author-bio-name {
    font-family: var(--ch-font-head);
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    display: block;
    text-decoration: none;
    transition: color var(--transition);
}

.ch-author-bio-name:hover { color: var(--ch-accent); }

.ch-author-bio-bio {
    font-size: 0.9rem;
    color: var(--ch-muted);
    line-height: 1.65;
    margin-bottom: 14px;
}

.ch-author-bio-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ch-accent);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    transition: gap var(--transition);
}

.ch-author-bio-link:hover { gap: 10px; }

/* =============================================================
   12. RELATED POSTS
   ============================================================= */
.ch-related {
    background: var(--ch-bg-alt, #111118);
    border-top: 1px solid var(--ch-border);
    padding: clamp(50px, 7vw, 80px) 0;
}

.ch-related-title {
    font-family: var(--ch-font-head);
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ch-related-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ch-border);
}

.ch-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* =============================================================
   13. TAG PAGE
   ============================================================= */
.ch-tag-hero {
    padding: clamp(60px, 8vw, 100px) 0 clamp(40px, 5vw, 60px);
    text-align: center;
    border-bottom: 1px solid var(--ch-border);
    position: relative;
    overflow: hidden;
}

.ch-tag-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(14, 167, 231, 0.1) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.ch-tag-hero-inner {
    position: relative;
    z-index: 1;
}

.ch-tag-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    background: var(--ch-accent-soft);
    border: 1px solid rgba(14, 167, 231, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
}

.ch-tag-name {
    font-family: var(--ch-font-head);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.ch-tag-name .hash { color: var(--ch-accent); }

.ch-tag-desc {
    color: var(--ch-muted);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto 16px;
}

.ch-tag-count {
    display: inline-block;
    padding: 4px 14px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    color: var(--ch-dim);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 50px;
}

/* =============================================================
   14. AUTHOR PAGE
   ============================================================= */
.ch-author-hero {
    padding: clamp(60px, 8vw, 100px) 0 clamp(40px, 5vw, 60px);
    text-align: center;
    border-bottom: 1px solid var(--ch-border);
    position: relative;
    overflow: hidden;
}

.ch-author-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(14, 167, 231, 0.08) 0%, transparent 65%);
    z-index: 0;
    pointer-events: none;
}

.ch-author-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.ch-author-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--ch-border-2);
    position: relative;
    z-index: 1;
}

.ch-author-avatar-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(14, 167, 231, 0.3);
    animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
    to { transform: rotate(360deg); }
}

.ch-author-name {
    font-family: var(--ch-font-head);
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.ch-author-bio-text {
    color: var(--ch-muted);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto 20px;
}

.ch-author-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
}

.ch-author-stat-value {
    font-family: var(--ch-font-head);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ch-accent);
    display: block;
}

.ch-author-stat-label {
    font-size: 0.8rem;
    color: var(--ch-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =============================================================
   15. NEWSLETTER / SUBSCRIBE
   ============================================================= */
.ch-subscribe-section {
    margin-top: 80px;
}

.ch-subscribe {
    background: linear-gradient(135deg, rgba(14, 167, 231, 0.08) 0%, rgba(83, 221, 108, 0.04) 100%);
    border-top: 1px solid rgba(14, 167, 231, 0.12);
    border-bottom: 1px solid rgba(14, 167, 231, 0.12);
    padding: clamp(50px, 7vw, 80px) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ch-subscribe::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 50% 80% at 50% 50%, rgba(14, 167, 231, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.ch-subscribe-inner {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: 0 auto;
    padding: 0 24px;
    padding-bottom: 50px;
}

.ch-subscribe h2 {
    font-family: var(--ch-font-head);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.ch-subscribe h2 span { color: var(--ch-accent); }

.ch-subscribe p {
    color: var(--ch-muted);
    margin-bottom: 28px;
    line-height: 1.7;
}

.ch-subscribe-form {
    display: flex;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.ch-subscribe-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius);
    color: var(--ch-text);
    font-family: var(--ch-font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ch-subscribe-input::placeholder { color: var(--ch-dim); }

.ch-subscribe-input:focus {
    border-color: var(--ch-accent);
    box-shadow: 0 0 0 3px rgba(14, 167, 231, 0.1);
}

.ch-subscribe-btn {
    padding: 14px 24px;
    background: var(--ch-green);
    color: #0e0e14;
    font-family: var(--ch-font-body);
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.ch-subscribe-btn:hover {
    background: var(--ch-green-hover);
    transform: translateY(-2px);
}

/* =============================================================
   16. FOOTER
   ============================================================= */
.ch-footer {
    background: var(--ch-bg-alt, #111118);
    border-top: 1px solid var(--ch-border);
    padding: clamp(50px, 7vw, 80px) 0 0;
}

.ch-footer-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr 1fr;
    gap: clamp(24px, 4vw, 48px);
    margin-bottom: 48px;
}

.ch-footer-brand p {
    color: var(--ch-muted);
    font-size: 0.9rem;
    line-height: 1.65;
    margin: 16px 0 20px;
    max-width: 280px;
}

.ch-footer-social {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ch-footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    color: var(--ch-muted);
    text-decoration: none;
    transition: all var(--transition);
    font-size: 0.9rem;
}

.ch-footer-social-link:hover {
    background: var(--ch-accent-soft);
    border-color: var(--ch-accent);
    color: var(--ch-accent);
}

.ch-footer-col-title {
    font-family: var(--ch-font-head);
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 18px;
}

.ch-footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ch-footer-links a {
    font-size: 0.9rem;
    color: var(--ch-muted);
    text-decoration: none;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ch-footer-links a:hover { color: var(--ch-accent); }

.ch-footer-bottom {
    border-top: 1px solid var(--ch-border);
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.ch-footer-copyright {
    font-size: 0.82rem;
    color: var(--ch-dim);
}

.ch-footer-copyright a {
    color: var(--ch-accent);
    text-decoration: none;
}

.ch-footer-ghost-credit {
    font-size: 0.78rem;
    color: var(--ch-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =============================================================
   17. PAGE (static)
   ============================================================= */
.ch-page-hero {
    padding: clamp(80px, 10vw, 120px) 0 clamp(40px, 5vw, 60px);
    text-align: center;
    border-bottom: 1px solid var(--ch-border);
}

.ch-page-title {
    font-family: var(--ch-font-head);
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.ch-page-content {
    max-width: var(--max-w-content);
    margin: 0 auto;
    padding: clamp(40px, 6vw, 70px) 24px;
}

/* =============================================================
   18. SEARCH
   ============================================================= */
.ch-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 15, 21, 0.95);
    backdrop-filter: blur(16px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
}

.ch-search-overlay.open {
    display: flex;
}

.ch-search-box {
    width: 100%;
    max-width: 640px;
    padding: 0 24px;
}

.ch-search-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    color: var(--ch-muted);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition);
}

.ch-search-close:hover {
    border-color: var(--ch-accent);
    color: var(--ch-accent);
}

.ch-search-field {
    width: 100%;
    padding: 18px 24px;
    background: var(--ch-card);
    border: 2px solid var(--ch-border);
    border-radius: var(--radius-lg);
    color: var(--ch-text);
    font-family: var(--ch-font-body);
    font-size: 1.2rem;
    outline: none;
    transition: border-color var(--transition);
}

.ch-search-field:focus {
    border-color: var(--ch-accent);
}

/* =============================================================
   19. MISC COMPONENTS
   ============================================================= */

/* Reading progress bar */
.ch-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ch-accent), var(--ch-green));
    z-index: 9999;
    width: 0%;
    transition: width 0.1s linear;
}

/* Scroll to top */
.ch-scroll-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ch-muted);
    font-size: 1rem;
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(10px);
    z-index: 100;
}

.ch-scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.ch-scroll-top:hover {
    background: var(--ch-accent-soft);
    border-color: var(--ch-accent);
    color: var(--ch-accent);
}

/* Error / 404 */
.ch-error {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
}

.ch-error-code {
    font-family: var(--ch-font-head);
    font-size: clamp(5rem, 15vw, 10rem);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--ch-accent), var(--ch-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.ch-error h1 {
    font-family: var(--ch-font-head);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.ch-error p {
    color: var(--ch-muted);
    margin-bottom: 28px;
}

/* =============================================================
   20. RESPONSIVE
   ============================================================= */
@media (max-width: 1024px) {
    .ch-posts-grid { grid-template-columns: repeat(2, 1fr); }
    .ch-related-grid { grid-template-columns: repeat(2, 1fr); }
    .ch-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
    .ch-featured-card { grid-template-columns: 1fr; }
    .ch-featured-body { padding: 28px; }
    .ch-author-bio-card { flex-direction: column; }
}

@media (max-width: 768px) {
    .ch-nav { display: none; }
    .ch-menu-toggle { display: flex; }
    .ch-posts-grid { grid-template-columns: 1fr; }
    .ch-related-grid { grid-template-columns: 1fr; }
    .ch-footer-grid { grid-template-columns: 1fr; }
    .ch-subscribe-form { flex-direction: column; }
    .ch-author-stats { gap: 20px; }
    .ch-share { flex-direction: column; align-items: flex-start; }
    .ch-post-meta { flex-direction: column; gap: 12px; }
    .ch-post-meta-divider { display: none; }
    .ch-footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .ch-wrap { padding: 0 16px; }
    .ch-post-content-wrap { padding: 32px 16px; }
    .ch-posts-grid { gap: 16px; }
    .ch-featured-card { border-radius: var(--radius-lg); }
}

/* Mobile nav drawer */
.ch-mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(21, 21, 29, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    list-style: none;
}

.ch-mobile-nav.open { display: flex; }

.ch-mobile-nav a {
    font-family: var(--ch-font-head);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--ch-muted);
    text-decoration: none;
    transition: color var(--transition);
    letter-spacing: -0.5px;
}

.ch-mobile-nav a:hover { color: var(--ch-accent); }

/* =============================================================
   21. SCROLL ANIMATIONS
   ============================================================= */
.rv {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.rv.vis {
    opacity: 1;
    transform: translateY(0);
}

.d1 { transition-delay: 0.05s; }
.d2 { transition-delay: 0.12s; }
.d3 { transition-delay: 0.18s; }
.d4 { transition-delay: 0.24s; }
.d5 { transition-delay: 0.30s; }
.d6 { transition-delay: 0.36s; }

/* =============================================================
   22. PREV / NEXT POST NAVIGATION
   ============================================================= */
.ch-post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 740px;
    margin: 80px auto 0;
    padding: 0 24px;
}

.ch-post-nav-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 24px;
    background: var(--ch-card);
    border: 1px solid var(--ch-border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: border-color var(--transition), background var(--transition);
}

.ch-post-nav-item:hover {
    border-color: var(--ch-accent);
    background: var(--ch-card-alt);
}

.ch-post-nav-next {
    text-align: right;
}

.ch-post-nav-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ch-accent);
}

.ch-post-nav-next .ch-post-nav-label {
    justify-content: flex-end;
}

.ch-post-nav-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ch-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 600px) {
    .ch-post-nav {
        grid-template-columns: 1fr;
        padding: 0 16px;
    }
    .ch-post-nav-next {
        text-align: left;
    }
    .ch-post-nav-next .ch-post-nav-label {
        justify-content: flex-start;
    }
}

/* Pagination info counter */
.ch-pagination-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ch-muted);
    padding: 8px 16px;
}

/* Logo image sizing */
.ch-logo-img {
    height: 60px;
    width: auto;
    display: block;
}
