/* ===== Base (page-level overrides) ===== */
body { background: #f0f4f8; }
.article-detail-body { background: #ffffff; }

/* ============================================================
   articles.html  (page-articles)
   Header sits over a dark-blue hero → white logo + white nav
   ============================================================ */

/* > 768px: always show white logo over dark hero; swap to normal when scrolled */
@media (min-width: 769px) {
    .page-articles #logo-white  { display: block; }
    .page-articles #logo-default { display: none; }
    .page-articles .site-header.scrolled #logo-white  { display: none; }
    .page-articles .site-header.scrolled #logo-default { display: block; }
}

/* > 1024px desktop: white nav link text on dark hero; revert when scrolled */
@media (min-width: 1025px) {
    .page-articles .header-nav a              { color: rgba(255,255,255,0.85); }
    .page-articles .header-nav a:hover        { color: #ffffff; }
    .page-articles .site-header.scrolled .header-nav a       { color: #64748b; }
    .page-articles .site-header.scrolled .header-nav a:hover { color: #2563EB; }
}

/* ============================================================
   article-detail.html  (page-detail)
   Header sits over a white page → colored logo, grey hamburger
   ============================================================ */

/* Never show white logo — override the mobile block's display:block rule via specificity */
.page-detail #logo-white  { display: none; }
.page-detail #logo-default { display: block; }

/* Hamburger bars: grey on white background (overrides main.css white default) */
@media (max-width: 1023px) {
    .page-detail #mobile-menu-btn span                         { background-color: #64748b; }
    .page-detail .site-header.scrolled #mobile-menu-btn span  { background-color: #1a1a2e; }
    .page-detail .site-header.nav-open #mobile-menu-btn span  { background-color: #64748b; }
}

/* No blue gradient on header at any width — transparent until scrolled */
.page-detail .site-header                { background: transparent !important; }
.page-detail .site-header.scrolled       { background: rgba(255,255,255,0.85) !important; }

/* ===== Page Hero Banner (articles.html) ===== */
.page-hero {
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top right, #0c1d5e 0%, #0e2470 30%, #1540a8 70%, #2a75d8 100%);
    overflow: hidden;
    padding-top: 72px;
}
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1581093458791-9f3c3900df4b?q=80&w=2070&auto=format&fit=crop') center/cover;
    opacity: 0.15;
    mix-blend-mode: overlay;
}
.page-hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    color: white;
    padding: 0 24px;
}
.badge-knowledge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
}

/* ===== Article Cards ===== */
.article-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03), 0 2px 4px -1px rgba(0,0,0,0.02);
    transition: transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}
.article-img-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 60%;
    overflow: hidden;
}
.article-img-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25,0.46,0.45,0.94);
}
.article-card:hover .article-img-wrap img { transform: scale(1.05); }

.article-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #1e3a5f;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 2;
}
.article-badge.blue  { color: #2563EB; background: rgba(232,238,246,0.95); }
.article-badge.green { color: #059669; background: rgba(209,250,229,0.95); }

.article-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 12px;
}
.meta-item { display: flex; align-items: center; gap: 4px; }

.article-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    line-height: 1.4;
    transition: color 0.3s ease;
}
.article-card:hover .article-title { color: #2563EB; }

.article-excerpt {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.btn-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2563EB;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: gap 0.3s ease;
}
.btn-read-more svg { transition: transform 0.3s ease; }
.article-card:hover .btn-read-more { gap: 12px; }

/* ===== Featured Article (articles.html) ===== */
.featured-article {
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.featured-article:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.08);
}
.featured-img-wrap {
    position: relative;
    height: 100%;
    min-height: 400px;
    overflow: hidden;
}
.featured-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}
.featured-article:hover .featured-img-wrap img { transform: scale(1.03); }
.featured-content {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.featured-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    line-height: 1.3;
}
.featured-excerpt {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 32px;
    font-weight: 300;
}

/* ===== Article Detail Header ===== */
.article-header {
    padding-top: 140px;
    padding-bottom: 40px;
    background: #ffffff;
    text-align: center;
}
.badge-category {
    display: inline-block;
    background: #e8eef6;
    color: #2563EB;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
}

/* ===== Prose Content ===== */
.prose-container { max-width: 800px; margin: 0 auto; padding: 60px 24px; }
.prose {
    color: #334155;
    line-height: 1.8;
    font-size: 1.125rem;
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 300;
}
.prose h2 {
    color: #0f172a; font-weight: 700; font-size: 2rem;
    margin-top: 3.5rem; margin-bottom: 1.5rem; line-height: 1.3;
    font-family: 'Inter', 'Noto Sans Thai', sans-serif;
}
.prose h3 {
    color: #1e293b; font-weight: 600; font-size: 1.5rem;
    margin-top: 2.5rem; margin-bottom: 1rem; line-height: 1.4;
}
.prose p { margin-bottom: 1.75rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.75rem; }
.prose ul { list-style-type: none; }
.prose ul li { position: relative; margin-bottom: 0.75rem; padding-left: 0.5rem; }
.prose ul li::before { content: "•"; position: absolute; left: -1rem; color: #2563EB; font-weight: bold; }
.prose blockquote {
    border-left: 4px solid #2563EB;
    background: #f8fafc;
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: #475569;
    font-size: 1.25rem;
    line-height: 1.6;
}
.prose img { border-radius: 16px; margin: 3rem 0; width: 100%; height: auto; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1); }
.prose strong { font-weight: 600; color: #1e293b; }

/* ===== Author Card ===== */
.author-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 2.5rem;
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-top: 4rem;
    margin-bottom: 4rem;
}
.author-card img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ===== Share Buttons ===== */
.share-buttons { display: flex; gap: 12px; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid #e2e8f0; }
.share-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: #f1f5f9; color: #64748b;
    transition: all 0.3s ease;
}
.share-btn:hover { background: #2563EB; color: white; transform: translateY(-2px); }

/* ===== Related Articles area ===== */
.related-area { background: #f0f4f8; padding: 80px 0; }

/* ===== Scroll Animations ===== */
.fade-up { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25,0.46,0.45,0.94); }
.fade-up.visible { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .featured-article { grid-template-columns: 1fr; }
    .featured-img-wrap { min-height: 300px; }
    .featured-content { padding: 32px; }
}
@media (max-width: 768px) {
    .page-hero { min-height: 320px; }
    .featured-content { padding: 24px; }
    .article-header { padding-top: 110px; padding-bottom: 30px; }
    .prose-container { padding: 40px 24px; }
    .prose h2 { font-size: 1.75rem; }
    .author-card { flex-direction: column; text-align: center; padding: 2rem; }
}

/* ===== Skeleton Loading ===== */
@keyframes shimmer {
    0%   { background-position: -800px 0; }
    100% { background-position:  800px 0; }
}
.skeleton-line,
.skeleton-img {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: 8px;
}
.skeleton-line         { height: 16px; margin-bottom: 10px; width: 100%; }
.skeleton-line.short   { width: 40%; }
.skeleton-line.medium  { width: 65%; }
.skeleton-img          { width: 100%; height: 100%; border-radius: 0; }
.skeleton-card         { pointer-events: none; }
.skeleton-card .article-img-wrap { background: #e2e8f0; padding-bottom: 60%; }
.skeleton-card .featured-img-wrap { min-height: 400px; }

/* ===== Category Filter Pills ===== */
.filter-pill {
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}
.filter-pill:hover { background: #f1f5f9; color: #1e293b; }
.filter-pill.active {
    background: #2563EB;
    color: #ffffff;
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* ===== Pagination Buttons ===== */
.pagination-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    font-weight: 500;
}
.pagination-btn:hover:not(:disabled) { background: #f1f5f9; color: #1e293b; }
.pagination-btn.active {
    background: #2563EB; color: #ffffff;
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* ===== Article Tag Chips (detail page) ===== */
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tag {
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: #94a3b8;
    font-size: 1.1rem;
}

/* ===== View Transition ===== */
#view-articles, #view-detail {
    animation: fadeInView 0.35s ease;
}
@keyframes fadeInView {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
