/* KINGMODE Journal — articles section. Extends style.css (vars, nav, footer,
   glows, fade-in); everything here is scoped to the journal layout. */

/* Layout shell: sticky sidebar + fluid main column */
.journal-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 48px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 140px 5% 80px;
    position: relative;
    z-index: 10;
    align-items: start;
}

.nav-active { color: var(--accent-1) !important; }
.logo-link { text-decoration: none; color: var(--text-main); }

/* ---------- Sidebar ---------- */
.journal-sidebar {
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    scrollbar-width: none;
}
.journal-sidebar::-webkit-scrollbar { display: none; }

.sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 28px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.sidebar-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Search */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
#search-input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
#search-input::placeholder { color: var(--text-muted); }
#search-input:focus {
    border-color: rgba(255, 42, 95, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(255, 42, 95, 0.12);
}
#search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-kbd {
    position: absolute;
    right: 12px;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    pointer-events: none;
}

/* Categories */
.category-nav ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.category-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s ease;
}
.category-btn:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); }
.category-btn.active {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(255, 42, 95, 0.16), rgba(138, 43, 226, 0.16));
    border-color: rgba(255, 42, 95, 0.35);
}
.category-count {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}
.category-btn.active .category-count {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-color: transparent;
    color: #fff;
}

/* Trending */
.trending-panel ol { list-style: none; counter-reset: trend; display: flex; flex-direction: column; }
.trending-panel li { counter-increment: trend; }
.trending-link {
    display: flex;
    gap: 14px;
    align-items: baseline;
    padding: 10px 4px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.25s ease;
}
.trending-panel li:last-child .trending-link { border-bottom: none; }
.trending-link::before {
    content: "0" counter(trend);
    font-size: 0.95rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}
.trending-link span {
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.45;
    transition: color 0.25s;
}
.trending-link:hover span { color: var(--text-main); }
.trending-link:hover { transform: translateX(3px); }

/* Sidebar CTA */
.sidebar-cta {
    background: linear-gradient(135deg, rgba(255, 42, 95, 0.12), rgba(138, 43, 226, 0.12));
    border: 1px solid rgba(255, 42, 95, 0.25);
    border-radius: 18px;
    padding: 20px;
}
.sidebar-cta-title { font-weight: 700; margin-bottom: 6px; }
.sidebar-cta p { font-size: 0.84rem; margin-bottom: 14px; }
.cta-btn {
    display: inline-block;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
}

/* ---------- List view ---------- */
.journal-heading { margin-bottom: 48px; }
.journal-heading h1 { font-size: clamp(2.4rem, 4.5vw, 3.6rem); margin-bottom: 16px; }
.journal-heading p { max-width: 560px; font-size: 1.05rem; }

.results-bar {
    margin-bottom: 24px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.results-bar strong { color: var(--text-main); }

/* Featured story */
.featured-card {
    position: relative;
    display: block;
    text-decoration: none;
    border-radius: 28px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 42, 95, 0.5), rgba(138, 43, 226, 0.5), rgba(0, 210, 255, 0.3));
    margin-bottom: 28px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s;
}
.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 60px rgba(255, 42, 95, 0.15);
}
.featured-inner {
    background: rgba(12, 12, 12, 0.92);
    border-radius: 27px;
    padding: 44px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.featured-tag {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-1);
}
.featured-tag::after {
    content: "";
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-1), transparent);
}
.featured-card h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: -0.5px;
    line-height: 1.15;
    margin: 0;
    color: var(--text-main);
}
.featured-card p { font-size: 1rem; max-width: 640px; }

/* Meta row (shared by featured + cards + article view) */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.meta-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}
.meta-dot { opacity: 0.4; }

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

.article-card {
    background: rgba(20, 20, 20, 0.4);
    border-radius: 24px;
    position: relative;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-decoration: none;
    display: block;
}
/* Spotlight treatment (same recipe as .app-card on the home page) */
.article-card::before, .article-card::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 500ms ease;
    pointer-events: none;
}
.article-card::before {
    background: radial-gradient(700px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.06), transparent 40%);
    z-index: 3;
}
.article-card::after {
    background: radial-gradient(500px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.4), transparent 40%);
    z-index: 1;
}
.article-card:hover::before, .article-card:hover::after { opacity: 1; }

.article-card .card-border {
    position: absolute;
    inset: 1px;
    background: rgba(15, 15, 15, 0.85);
    border-radius: 23px;
    z-index: 2;
}
.article-card .card-content {
    position: relative;
    z-index: 4;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
}
.article-card .icon-wrapper {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
    margin-bottom: 0;
    border-radius: 14px;
}
.article-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.3px;
    color: var(--text-main);
    transition: color 0.3s;
}
.article-card:hover h3 { color: var(--accent-1); }
.article-card .excerpt {
    font-size: 0.88rem;
    color: #a1a1aa;
    line-height: 1.55;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.read-more {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.read-more::after { content: "→"; transition: transform 0.3s; }
.article-card:hover .read-more::after { transform: translateX(4px); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    border: 1px dashed var(--glass-border);
    border-radius: 24px;
}
.empty-icon { font-size: 2.4rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { font-size: 0.95rem; margin-bottom: 24px; }
.empty-state button { cursor: pointer; color: var(--text-main); font-family: inherit; font-size: 0.9rem; }

/* ---------- Article view ---------- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 36px;
    transition: color 0.3s;
}
.back-link:hover { color: var(--text-main); }
.back-link::before { content: "←"; transition: transform 0.3s; }
.back-link:hover::before { transform: translateX(-4px); }

.article-hero { margin-bottom: 40px; }
.article-hero-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 28px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}
.article-hero h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: -1px;
    line-height: 1.12;
    margin-bottom: 20px;
}
.article-hero .article-meta { font-size: 0.86rem; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.byline-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}
.byline-name { font-size: 0.9rem; font-weight: 600; color: var(--text-main); }
.byline-role { font-size: 0.78rem; color: var(--text-muted); }

.article-body {
    max-width: 720px;
    border-top: 1px solid var(--glass-border);
    padding-top: 40px;
}
.article-body p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #c8c8ce;
    margin-bottom: 24px;
}
.article-body h2 {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    margin: 40px 0 16px;
    font-weight: 700;
}
.article-body strong { color: var(--text-main); }
.article-body em { color: #e4e4e9; }
.article-body code {
    font-family: 'SF Mono', ui-monospace, Menlo, monospace;
    font-size: 0.85em;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border);
    color: var(--accent-1);
}
.article-body blockquote {
    margin: 32px 0;
    padding: 24px 28px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 42, 95, 0.08), rgba(138, 43, 226, 0.08));
    border: 1px solid rgba(255, 42, 95, 0.2);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.6;
}

/* Related articles */
.related-section { margin-top: 72px; }
.related-section .sidebar-label { margin-bottom: 20px; }
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .journal-shell {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
        padding-top: 120px;
    }
    .journal-sidebar { position: static; max-height: none; overflow: visible; }
    .sidebar-inner { gap: 20px; }
    /* Categories become horizontal chips; trending + CTA hide on small screens */
    .category-nav ul { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .category-btn {
        width: auto;
        padding: 8px 14px;
        border: 1px solid var(--glass-border);
        border-radius: 30px;
        font-size: 0.82rem;
    }
    .sidebar-label { margin-bottom: 10px; }
    .trending-panel, .sidebar-cta, .search-kbd { display: none; }
}

@media (max-width: 600px) {
    .featured-inner { padding: 28px; }
    .article-body p { font-size: 1rem; }
}
