/* =============================================================================
   pages/articles.css
   ----
   Loaded by both article_list.html and article_detail.html.
   Sections:
     1. Hero decorations (book, pen, bookmark)
     2. Article cards & posts grid (list view)
     3. Article detail (cover, video, post-content prose styling)
     4. Sidebar (related articles, tag cloud)
     5. Empty state
   ========================================================================== */

/* =============================================================================
   1. HERO DECORATIONS â€” open book, pen, bookmark
   ========================================================================== */
.article-deco {
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    display: grid; place-items: center;
    border-radius: var(--r-md);
    color: var(--gold-300);
}
@media (max-width: 980px) { .article-deco { display: none; } }

.article-deco--book {
    top: -28px; left: 36px;
    width: 102px; height: 102px;
    font-size: 2.4rem;
    transform: rotate(-10deg);
    background: linear-gradient(135deg, rgba(255, 211, 74, .14), rgba(255, 194, 24, .06));
    border: 1px solid var(--gold-line);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .35);
    opacity: .92;
}
.article-deco--pen {
    top: 78px; left: 152px;
    width: 76px; height: 76px;
    font-size: 1.6rem;
    transform: rotate(8deg);
    background: linear-gradient(135deg, rgba(65, 84, 173, .25), rgba(54, 71, 130, .12));
    border: 1px solid rgba(138, 150, 209, .22);
    color: var(--navy-200);
    border-radius: 22px;
    opacity: .82;
}
.article-deco--bookmark {
    top: 158px; left: 50px;
    width: 60px; height: 60px;
    font-size: 1.4rem;
    transform: rotate(-6deg);
    background: rgba(255, 194, 24, .04);
    border: 1px dashed rgba(255, 194, 24, .55);
    color: var(--gold-400);
    opacity: .85;
}

/* =============================================================================
   2. POSTS GRID â€” list view
   ========================================================================== */
.posts-grid,
.posts-grid2 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}
.posts-grid4 {grid-template-columns: repeat(3, minmax(0, 1fr));}



@media (max-width: 1080px) {
	.posts-grid,
    .posts-grid2 {
     display: grid;
	 grid-template-columns: repeat(2, minmax(0, 1fr));}
	.posts-grid4 {grid-template-columns: repeat(2, minmax(0, 1fr));}
}


@media (max-width: 720px) {
	
	.posts-grid,
    .posts-grid2 {
     display: grid;
	 grid-template-columns: repeat(2, minmax(0, 1fr));}
	.posts-grid4 {grid-template-columns: repeat(1, minmax(0, 1fr));}
	
}




@media (max-width: 720px) {
    .posts-grid,
    .posts-grid2 { grid-template-columns: 1fr; }
}

/* =============================================================================
   POST CARD (article preview)
   ========================================================================== */
.post-card,
.post-card2 {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: var(--r);
    background: var(--surface-1);
    border: 1px solid var(--line);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.post-card:hover,
.post-card2:hover {
    transform: translateY(-4px);
    border-color: var(--gold-line);
    box-shadow:
        0 14px 36px rgba(0, 0, 0, .35),
        0 0 0 1px rgba(255, 194, 24, .08) inset;
}

.post-cover {
    display: block;
    position: relative;
    background: var(--navy-900);
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.post-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .6s var(--t-slow), filter var(--t);
    filter: brightness(.92);
}
.post-card:hover .post-cover img,
.post-card2:hover .post-cover img {
    transform: scale(1.05);
    filter: brightness(1);
}
/* Subtle gradient overlay so titles stand out if cards have text-on-image somewhere */
.post-cover::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(12, 17, 36, .35), transparent 50%);
    pointer-events: none;
}

.post-body {
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.post-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.55;
    color: var(--ink-white);
}
.post-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--t-fast);
}
.post-title a:hover { color: var(--gold-300); }

.post-excerpt {
    color: var(--ink-soft);
    font-size: .88rem;
    line-height: 1.85;
    flex: 1;
}
.post-excerpt p { margin: 0; color: inherit; }

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-top: 6px;
    font-size: .78rem;
    color: var(--ink-muted);
}
.post-meta a { color: var(--gold-300); text-decoration: none; }
.post-meta a:hover { color: var(--gold-400); }

.article-time,
.article-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-muted);
    font-size: .78rem;
    margin: 0;
}
.article-time time { color: var(--ink-soft); }
.article-reading-time i { color: var(--gold-400); }

.post-actions {
    margin-top: 10px;
}
.btn-list,
.btn-list2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    color: var(--ink-white);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--t-fast);
}
.btn-list::after,
.btn-list2::after {
       content: "←";
    transition: transform var(--t-fast);
}
.btn-list:hover,
.btn-list2:hover {
    border-color: var(--gold-line);
    color: var(--gold-300);
    background: var(--surface-gold);
}
.btn-list:hover::after,
.btn-list2:hover::after {
    transform: translateX(-3px);
}

/* =============================================================================
   3. ARTICLE DETAIL â€” main content view
   ========================================================================== */

/* Cover image / video at top of article */
.post-figure {
    margin: 0 0 22px;
    border-radius: var(--r);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--navy-900);
}
.post-figure img,
.post-figure video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--r) !important;
}

/* Long-form prose body (Wagtail / RichText output) */
.post-content {
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 2;
}
.post-content p {
    margin: 0 0 1.2em;
    color: var(--ink-soft);
    line-height: 2;
}
.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--ink-white);
    font-weight: 800;
    margin: 1.6em 0 .7em;
    line-height: 1.4;
}
.post-content h2 {
    font-size: 1.3rem;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    position: relative;
}
.post-content h2::after {
    content: ""; position: absolute;
    bottom: -1px; right: 0;
    width: 36px; height: 2px;
    background: linear-gradient(90deg, var(--gold-500), transparent);
}
.post-content h3 { font-size: 1.1rem; }
.post-content h4 { font-size: 1rem; }
.post-content a {
    color: var(--gold-300);
    border-bottom: 1px dashed rgba(255, 194, 24, .35);
    text-decoration: none;
    transition: all var(--t-fast);
}
.post-content a:hover {
    color: var(--gold-400);
    border-bottom-color: var(--gold-400);
}
.post-content strong { color: var(--ink-white); font-weight: 800; }
.post-content blockquote {
    margin: 1.4em 0;
    padding: 16px 22px;
    border-right: 4px solid var(--gold-500);
    background: var(--surface-1);
    color: var(--ink-soft);
    border-radius: 0 var(--r) var(--r) 0;
    font-style: italic;
}
.post-content code {
    padding: 2px 8px;
    background: rgba(255, 194, 24, .08);
    border: 1px solid var(--gold-line);
    border-radius: 6px;
    color: var(--gold-300);
    font-size: .9em;
}
.post-content pre {
    padding: 18px;
    background: var(--navy-950);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow-x: auto;
    line-height: 1.7;
    direction: ltr;
}
.post-content ul,
.post-content ol {
    color: var(--ink-soft);
    padding-right: 1.5em;
    margin: 0 0 1.2em;
}
.post-content li { margin-bottom: .5em; line-height: 1.95; }
.post-content img {
    max-width: 100%; height: auto;
    border-radius: var(--r);
    border: 1px solid var(--line);
    margin: 1.2em 0;
    display: block;
}
.post-content hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 1.8em 0;
}
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}
.post-content th,
.post-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    text-align: right;
}
.post-content th {
    background: var(--surface-2);
    color: var(--ink-white);
    font-weight: 800;
}

/* =============================================================================
   4. SIDEBAR â€” related articles & tag cloud
   ========================================================================== */
.side-card2 .simple-list li.muted {
    padding: 8px 0;
    font-size: .82rem;
    color: var(--ink-muted);
    border-bottom: 1px dashed var(--line);
}

.tag-cloud {
    /* display: flex; */
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

/* Chip variants used by the article cards / sidebar */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    background: var(--surface-gold);
    border: 1px solid var(--gold-line);
    color: var(--gold-300);
    font-size: .76rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--t-fast);
}
.chip:hover {
    background: rgba(255, 194, 24, .12);
    color: var(--gold-400);
}
.chip3 {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink-soft);
}
.chip3:hover {
    border-color: var(--gold-line);
    color: var(--gold-300);
    background: var(--surface-gold);
}
.mt-2 { margin-top: 4px; }

.articles-related {
    padding: 14px 0;
    border-bottom: 1px dashed var(--line);
}
.articles-related.is-last,
.articles-related:last-child {
    border-bottom: none;
}
.articles-related img {
    width: 100%;
    border-radius: 10px !important;
    aspect-ratio: 16/9;
    object-fit: cover;
    border: 1px solid var(--line);
}

/* =============================================================================
   5. EMPTY STATE
   ========================================================================== */
.empty-state {
    padding: 40px 24px;
    text-align: center;
    border-radius: var(--r);
    background: var(--surface-1);
    border: 1px dashed var(--line-strong);
    color: var(--ink-soft);
}
.empty-state p { margin: 0 0 .5em; }
.empty-state a {
    color: var(--gold-300);
    border-bottom: 1px dashed var(--gold-line);
    transition: color var(--t-fast);
}
.empty-state a:hover { color: var(--gold-400); }

/* =============================================================================
   6. CLEAR-SEARCH ghost link (used inside .searchbar with q present)
   ========================================================================== */
.searchbar .clear-search {
    background: transparent;
    color: var(--ink-faint);
    border: none;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    text-decoration: none;
    transition: color var(--t-fast);
}
.searchbar .clear-search:hover { color: var(--gold-300); }

/* =============================================================================
   7. LIGHT-MODE OVERRIDES
   ========================================================================== */
[data-theme="light"] .post-cover,
[data-theme="light"] .post-figure {
    background: linear-gradient(135deg, #ffffff, #f7f9fc);
}
[data-theme="light"] .post-cover::after { display: none; }
[data-theme="light"] .post-cover img { filter: none; }
[data-theme="light"] .post-card:hover .post-cover img,
[data-theme="light"] .post-card2:hover .post-cover img { filter: none; }
[data-theme="light"] .post-content pre {
    background: rgba(28, 36, 71, .06);
    color: var(--navy-900);
}
[data-theme="light"] .post-content code {
    background: rgba(255, 194, 24, .12);
    color: var(--gold-700);
}
[data-theme="light"] .post-content a { color: var(--gold-700); }
[data-theme="light"] .post-content a:hover { color: var(--gold-600); }
[data-theme="light"] .post-content blockquote {
    background: rgba(255, 194, 24, .04);
    color: var(--ink-soft);
}
[data-theme="light"] .post-meta a { color: var(--gold-700); }
[data-theme="light"] .article-reading-time i { color: var(--gold-600); }
[data-theme="light"] .chip { color: var(--gold-700); }
[data-theme="light"] .chip3 { color: var(--navy-700); }
[data-theme="light"] .chip3:hover { color: var(--gold-700); }
