/* =============================================
   articles.css  –  ARTICLE LIST PAGE styles
   ============================================= */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-color: #667eea;
    --accent-hover: #5568d3;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 12px 24px rgba(0, 0, 0, 0.15);
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 12px 24px rgba(0, 0, 0, 0.5);
}

body[data-page="articles"] {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition), color var(--transition);
}

/* ── Page header ── */
.articles-page-header { margin-bottom: 1.5rem; }
.intro-text      { color: #555; font-size: 1rem; margin-bottom: .4rem; line-height: 1.6; }
.intro-text-more { color: #888; font-size: .9rem; line-height: 1.6; }

/* ── Toolbar ── */
.articles-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.2rem 0 1.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
}
.articles-toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.articles-search-wrap {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #f7f7f7;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    padding: .65rem 1rem;
    transition: border .2s, box-shadow .2s;
}
.articles-search-wrap:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,.1);
    background: #fff;
}
.search-icon { font-size: 1rem; }
.articles-search-wrap input {
    border: none;
    background: transparent;
    outline: none;
    font-size: .95rem;
    width: 100%;
    color: #1a1a1a;
}
.articles-count {
    font-size: .82rem;
    color: #aaa;
    white-space: nowrap;
}

/* ── Loading skeleton ── */
.articles-loading {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.loading-pulse {
    height: 280px;
    border-radius: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.articles-error, .articles-empty {
    color: #999;
    padding: 3rem 0;
    font-size: 1rem;
    text-align: center;
}

/* ── Grid wrapper ── */
.articles-grid-wrapper { display: flex; flex-direction: column; gap: 1.5rem; }

/* ── Base card ── */
.article-card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.22,.61,.36,1), box-shadow .3s;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    position: relative;
    text-decoration: none;
    color: inherit;
}
.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,.11);
    border-color: #d0d4ff;
}

/* ── Featured (2-col on desktop) ── */
.featured-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 300px;
}
@media (max-width: 768px) {
    .featured-card { grid-template-columns: 1fr; min-height: unset; }
}

/* ── Image wraps ── */
.featured-card-image-wrap,
.small-card-image-wrap {
    position: relative;
    overflow: hidden;
}
.featured-card-image-wrap { height: 100%; min-height: 220px; }
.small-card-image-wrap    { height: 160px; }

.article-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s cubic-bezier(.22,.61,.36,1);
}
.article-card:hover .article-card-image { transform: scale(1.06); }

.card-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.3));
    pointer-events: none;
}

.article-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #667eea;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .28rem .72rem;
    border-radius: 20px;
}

/* ── Card content ── */
.article-card-content {
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.article-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: .6rem;
    line-height: 1.35;
    color: #1a1a1a;
}
.featured-card .article-card-title { font-size: 1.45rem; }

.article-card-excerpt {
    font-size: .88rem;
    color: #777;
    margin-bottom: 1.2rem;
    flex: 1;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1.1rem;
    font-size: .78rem;
    color: #999;
    border-top: 1px solid #f0f0f0;
    padding-top: .9rem;
    align-items: center;
}
.article-meta-author {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: #555;
    font-weight: 600;
}
.author-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: .6rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.article-meta-item { display: flex; align-items: center; gap: .25rem; }

.card-read-cta {
    margin-top: 1.1rem;
    font-size: .82rem;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: .35rem;
    transition: gap .2s;
}
.article-card:hover .card-read-cta { gap: .6rem; }
.cta-arrow { transition: transform .2s; }
.article-card:hover .cta-arrow { transform: translateX(4px); }

/* ── Secondary grid ── */
.articles-secondary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
}

/* ── Modal (subscription) ── */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.55);
    justify-content: center;
    align-items: center;
    z-index: 600;
    backdrop-filter: blur(5px);
}
.modal.show { display: flex; }
.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 18px;
    max-width: 520px;
    width: 92%;
    position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,.2);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp .3s ease-out;
}
@keyframes slideUp { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }

.close-modal {
    position: absolute;
    top: 1rem; right: 1rem;
    background: #f5f5f5;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #555;
    transition: all .2s;
}
.close-modal:hover { background: #ffe0e6; color: #e0284f; }

/* ── Plans ── */
.plans-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.plan { border: 1.5px solid #e8e8e8; border-radius: 12px; padding: 1.2rem; text-align: center; }
.plan.featured { border-color: #667eea; background: #f5f6ff; }
.plan-price { font-size: 1.55rem; font-weight: 900; color: #667eea; margin: .4rem 0; }
.plan-features { list-style: none; padding: 0; margin: .6rem 0; text-align: left; font-size: .83rem; color: #555; }
.plan-features li::before { content: '✓ '; color: #667eea; font-weight: 700; }
.plan-features li { margin-bottom: .35rem; }
.modal-button {
    width: 100%;
    background: #667eea;
    color: #fff;
    border: none;
    padding: .55rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: .65rem;
    transition: background .2s;
}
.modal-button:hover { background: #5568d3; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .articles-toolbar { flex-direction: column; align-items: stretch; }
    .articles-secondary-grid { grid-template-columns: 1fr; }
}

/* ── Article Reader Block (from attached file) ── */
.header-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #667eea, #5568d3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.dark-mode-toggle {
    background: #667eea;
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dark-mode-toggle:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    animation: fadeIn 0.5s ease;
}

@media (max-width: 768px) {
    .articles-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.article-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.article-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: #f5f5f5;
    transition: transform 0.3s ease;
}

.article-card:hover .article-card-image {
    transform: scale(1.05);
}

.article-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.article-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
    line-height: 1.4;
}

.article-card-excerpt {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 1rem;
    flex: 1;
    line-height: 1.6;
}

.article-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.article-view {
    display: none;
    animation: fadeIn 0.5s ease;
}

.article-view.active {
    display: block;
}

.article-back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid #e0e0e0;
    color: #1a1a1a;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.article-back-button:hover {
    background: #f5f5f5;
    border-color: #667eea;
    color: #667eea;
    transform: translateX(-4px);
}

.article-full {
    max-width: 850px;
    margin: 0 auto;
}

.article-featured-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-full-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.article-full-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    font-size: 0.95rem;
    color: #666;
}

.article-meta-author {
    font-weight: 600;
    color: #667eea;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #1a1a1a;
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.article-content h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content li,
.article-content blockquote,
.article-content strong,
.article-content em {
    color: #666;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
