/* --- ARTICLES STYLES --- */

.articles-page {
    padding: 40px 0 80px 0;
}

.articles-page__title {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    text-align: center;
    color: var(--text-dark);
}

.articles-page__subtitle {
    font-size: 16px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 48px;
    font-family: var(--font-main);
}

/* Grid layout */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Article Card */
.article-card {
    border-radius: var(--radius-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.article-card:nth-child(odd) {
    background: var(--hero-gradient);
}

.article-card:nth-child(even) {
    background: var(--feature-gradient);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

.article-card__image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.article-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .article-card__image {
    transform: scale(1.05);
}

.article-card__content {
    padding: 30px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-card__date {
    font-size: 12px;
    color: #787E88; /* default text color */
    margin-bottom: 10px;
    font-weight: 500;
}

.article-card__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.4;
}

.article-card__description {
    font-size: 14px;
    color: #787E88; /* default text color */
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1;
}

.article-card__button {
    align-self: flex-start;
    background: #809EFF; /* main background color */
    color: #ffffff;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.article-card__button:hover {
    background: #6b8be6;
}

.article-card__button:active {
    transform: scale(0.98);
}

/* Detail Page */
.article-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 80px 20px;
}

.article-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #809EFF; /* main background color */
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 30px;
    transition: color 0.3s;
}

.article-detail__back:hover {
    color: #6b8be6;
}

.article-detail__header {
    margin-bottom: 40px;
}

.article-detail__title {
    font-size: 40px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 16px;
}

.article-detail__date {
    font-size: 14px;
    color: #787E88; /* default text color */
    font-weight: 500;
}

/* Markdown -> HTML content styling */
.article-detail__body {
    font-size: 16px;
    line-height: 1.8;
    color: #787E88; /* default text color */
    font-family: var(--font-main);
}

.article-detail__body p {
    margin-bottom: 24px;
}

.article-detail__body h1,
.article-detail__body h2,
.article-detail__body h3,
.article-detail__body h4 {
    color: var(--text-dark);
    font-weight: 700;
    margin: 40px 0 16px 0;
    line-height: 1.3;
}

.article-detail__body h1 { font-size: 28px; }
.article-detail__body h2 { font-size: 24px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.article-detail__body h3 { font-size: 20px; }

.article-detail__body ul,
.article-detail__body ol {
    margin: 0 0 24px 24px;
}

.article-detail__body li {
    margin-bottom: 8px;
}

.article-detail__body a {
    color: #809EFF; /* main background color */
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.article-detail__body a:hover {
    color: #6b8be6;
    text-decoration: underline;
}

.article-detail__body img {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin: 32px 0;
    display: block;
}

.article-detail__body blockquote {
    border-left: 4px solid #809EFF;
    padding-left: 20px;
    margin: 30px 0;
    font-style: italic;
    color: #787E88;
}

.article-detail__body code {
    background: #F5F5F5; /* input background color */
    color: #787E88; /* input text color */
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 14px;
    font-family: monospace;
}

.article-detail__body pre {
    background: #F5F5F5;
    padding: 20px;
    border-radius: 16px;
    overflow-x: auto;
    margin: 30px 0;
}

.article-detail__body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 13px;
}

/* Pagination styles */
.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.pagination-container nav svg {
    width: 20px;
    height: 20px;
}

.pagination-container nav div {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Article Navigation (Prev / Next buttons) */
.article-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    gap: 20px;
}

.article-navigation__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    color: #787E88;
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    max-width: 45%;
}

.article-navigation__btn:hover {
    color: #809EFF;
    border-color: #809EFF;
    transform: translateY(-2px);
}

.article-navigation__btn--next {
    margin-left: auto;
    text-align: right;
}

/* Comments Section */
.comments-section {
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
}

.comments-section__title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 30px;
}

/* Comments List */
.comments-list {
    margin-bottom: 40px;
}

.comment-item {
    background: var(--bg-light);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.comment-item__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.comment-item__author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comment-item__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border-color);
}

.comment-item__author {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-dark);
}

.comment-item__date {
    font-size: 12px;
    color: #787E88;
}

.comment-item__content {
    font-size: 15px;
    line-height: 1.6;
    color: #787E88;
    word-break: break-word;
}

/* Comment Form */
.comment-form {
    margin-top: 40px;
}

.comment-form__group {
    margin-bottom: 16px;
}

.comment-form__textarea {
    width: 100%;
    height: 120px;
    background: #F5F5F5; /* input background color */
    color: #787E88; /* input text color */
    border: 1.5px solid transparent;
    border-radius: 16px;
    padding: 16px;
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.comment-form__textarea::placeholder {
    color: #B0B0B0B2; /* placeholder text color with opacity 70% */
}

.comment-form__textarea:focus {
    border-color: #809EFF; /* main color on focus */
    background: #ffffff;
}

.comment-form__submit {
    background: #809EFF; /* main background color */
    color: #ffffff;
    padding: 12px 32px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.comment-form__submit:hover {
    background: #6b8be6;
}

.comment-form__submit:active {
    transform: scale(0.98);
}

.comment-form__error {
    color: #FF3B30; /* error color */
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.comments-section__login-prompt {
    background: var(--bg-light);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    color: #787E88;
    font-size: 15px;
    border: 1px dashed var(--border-color);
}

.comments-section__login-prompt a {
    color: #809EFF;
    font-weight: 700;
    text-decoration: none;
}

.comments-section__login-prompt a:hover {
    text-decoration: underline;
}

/* Media Queries */
@media (max-width: 768px) {
    .articles-page__title {
        font-size: 28px;
    }
    .article-detail__title {
        font-size: 30px;
    }
    .article-navigation {
        flex-direction: column;
        align-items: stretch;
    }
    .article-navigation__btn {
        max-width: 100%;
    }
}

/* Badges */
.article-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.article-badge--invisible {
    background-color: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border: 1px solid rgba(255, 59, 48, 0.2);
}
