/* =========================================
   MELOYTECHVIEWS — ARTICLE PAGE
   ========================================= */

.article-header {
    margin-bottom: 24px;
}

.article-category {
    display: inline-flex;
    margin-bottom: 15px;
}

.article-header h1 {
    margin: 0 0 18px;
    color: var(--text, #101828);
    font-size: clamp(2rem, 4vw, 3.15rem);
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
}

.article-header .lead {
    margin: 0 0 20px;
    color: var(--muted, #667085);
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    line-height: 1.8;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    color: var(--muted, #667085);
    font-size: 0.88rem;
}

.article-meta span + span::before {
    content: '·';
    margin-right: 16px;
    color: var(--muted, #667085);
    font-weight: 800;
}

.article-hero {
    margin: 26px 0 34px;
    overflow: hidden;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 20px);
    background: var(--surface2, #f1f4f9);
}

.article-hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
}

/* =========================================
   ARTICLE BODY
   ========================================= */

.article-content {
    --article-accent: var(--primary, #4f46e5);
    --article-text: var(--text, #101828);
    --article-surface: var(--surface, #ffffff);
    --article-surface-2: var(--surface2, #f1f4f9);
    --article-border: var(--border, #e5e7eb);

    min-width: 0;
    color: var(--article-text);
    font-size: 1.04rem;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.article-content p {
    margin: 0 0 1.4rem;
    line-height: 1.9;
}

.article-content strong,
.article-content b {
    color: var(--article-text);
    font-weight: 750;
}

.article-content em,
.article-content i {
    font-style: italic;
}

.article-content a {
    color: var(--article-accent);
    font-weight: 650;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
    transition: opacity 0.2s ease;
}

.article-content a:hover {
    opacity: 0.75;
}

.article-content h2 {
    position: relative;
    margin: 3rem 0 1.2rem;
    padding: 0.15rem 0 0.15rem 1rem;
    border-left: 4px solid var(--article-accent);
    color: var(--article-text);
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.035em;
    scroll-margin-top: 100px;
}

.article-content h3 {
    margin: 2rem 0 0.8rem;
    color: var(--article-text);
    font-size: clamp(1.12rem, 2vw, 1.35rem);
    font-weight: 750;
    line-height: 1.5;
    scroll-margin-top: 100px;
}

.article-content h4 {
    margin: 1.5rem 0 0.65rem;
    color: var(--article-text);
    font-size: 1.05rem;
    font-weight: 750;
    line-height: 1.5;
}

.article-content > h2:first-child,
.article-content > h3:first-child,
.article-content > h4:first-child {
    margin-top: 0;
}

/* Lists */

.article-content ul,
.article-content ol {
    margin: 0.6rem 0 1.8rem;
    padding: 1rem 1.25rem 1rem 2.8rem;
    border: 1px solid var(--article-border);
    border-radius: 14px;
    background: var(--article-surface-2);
}

.article-content ul {
    list-style: disc;
}

.article-content ol {
    list-style: decimal;
}

.article-content li {
    margin: 0.55rem 0;
    padding-left: 0.25rem;
    line-height: 1.8;
}

.article-content li::marker {
    color: var(--article-accent);
    font-weight: 800;
}

.article-content li:last-child {
    margin-bottom: 0;
}

.article-content li p {
    margin-bottom: 0.5rem;
}

.article-content li ul,
.article-content li ol {
    margin-top: 0.7rem;
    margin-bottom: 0.7rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    background: transparent;
}

/* Tips, warnings and key takeaways */

.article-content .article-callout {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin: 1.8rem 0;
    padding: 18px;
    border: 1px solid var(--article-border);
    border-radius: 15px;
    background: var(--article-surface-2);
}

.article-content .article-callout-icon {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: var(--article-surface);
    color: var(--article-accent);
    font-size: 1rem;
    font-weight: 850;
}

.article-content .article-callout-body {
    flex: 1;
    min-width: 0;
}

.article-content .article-callout-title {
    display: block;
    margin: 1px 0 6px;
    font-size: 0.98rem;
    font-weight: 800;
}

.article-content .article-callout p {
    margin: 0;
    font-size: 0.97rem;
    line-height: 1.8;
}

.article-content .article-callout-tip {
    border-left: 4px solid var(--article-accent);
}

.article-content .article-callout-warning {
    border-left: 4px solid #d97706;
}

.article-content .article-callout-takeaway {
    border-left: 4px solid #0d9488;
}

/* Quotes */

.article-content .article-quote,
.article-content blockquote {
    margin: 1.8rem 0;
    padding: 1.2rem 1.4rem;
    border-left: 4px solid var(--article-accent);
    border-radius: 0 12px 12px 0;
    background: var(--article-surface-2);
    font-size: 1.05rem;
    font-style: italic;
}

.article-content .article-quote p:last-child,
.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Images and captions */

.article-content .article-inline-figure,
.article-content figure {
    margin: 2rem 0;
}

.article-content .article-inline-figure img,
.article-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.8rem auto;
    border: 1px solid var(--article-border);
    border-radius: 15px;
}

.article-content figcaption {
    margin-top: 0.7rem;
    color: var(--muted, #667085);
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: center;
}

/* Tables */

.article-content .article-table-wrap {
    width: 100%;
    margin: 1.5rem 0 2rem;
    overflow-x: auto;
    border: 1px solid var(--article-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.article-content table {
    width: 100%;
    min-width: 420px;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.94rem;
}

.article-content th,
.article-content td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--article-border);
    text-align: left;
    vertical-align: top;
}

.article-content th {
    background: var(--article-surface-2);
    color: var(--article-text);
    font-weight: 750;
}

.article-content tr:nth-child(even) td {
    background: var(--article-surface-2);
}

.article-content tr:last-child td {
    border-bottom: 0;
}

/* Code */

.article-content code {
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--article-border);
    border-radius: 5px;
    background: var(--article-surface-2);
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

.article-content pre {
    max-width: 100%;
    margin: 1.5rem 0;
    padding: 1.2rem;
    overflow-x: auto;
    border: 1px solid var(--article-border);
    border-radius: 12px;
    background: var(--article-surface-2);
}

.article-content pre code {
    padding: 0;
    border: 0;
    background: transparent;
}

/* Separators */

.article-content .article-divider,
.article-content hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid var(--article-border);
}

/* =========================================
   RELATED ARTICLES
   ========================================= */

.related-articles {
    position: sticky;
    top: 24px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 20px);
    background: var(--surface, #ffffff);
}

.related-header {
    margin-bottom: 18px;
}

.related-label {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--primary, #4f46e5);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.related-header h2 {
    margin: 0 0 8px;
    color: var(--text, #101828);
    font-size: 1.35rem;
    line-height: 1.35;
}

.related-header p {
    margin: 0;
    color: var(--muted, #667085);
    font-size: 0.92rem;
    line-height: 1.7;
}

.related-list {
    display: grid;
    gap: 18px;
}

.related-card {
    display: block;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 13px;
    background: var(--surface, #ffffff);
    color: inherit;
    text-decoration: none;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}

.related-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary, #4f46e5);
}

.related-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface2, #f1f4f9);
}

.related-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-body {
    padding: 13px;
}

.related-body .badge {
    display: inline-flex;
    margin-bottom: 9px;
}

.related-body h3 {
    margin: 0 0 10px;
    color: var(--text, #101828);
    font-size: 1rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.related-meta {
    color: var(--muted, #667085);
    font-size: 0.82rem;
    line-height: 1.6;
}

.related-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--border, #e5e7eb);
    color: var(--primary, #4f46e5);
    font-size: 0.94rem;
    font-weight: 750;
    text-decoration: none;
}

.related-more span {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.related-more:hover span {
    transform: translateX(4px);
}

/* =========================================
   LOADING / NOT FOUND
   ========================================= */

.article-loading,
.article-not-found {
    margin: 45px 0;
    padding: 35px 22px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 20px);
    background: var(--surface, #ffffff);
    color: var(--text, #101828);
    text-align: center;
}

.article-not-found h1 {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.article-not-found p {
    margin: 0 0 22px;
    color: var(--muted, #667085);
    line-height: 1.7;
}

.article-not-found-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface2, #f1f4f9);
    color: var(--primary, #4f46e5);
    font-size: 1.5rem;
    font-weight: 800;
}

.article-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 10px;
    background: var(--primary, #4f46e5);
    color: #ffffff;
    font-weight: 750;
    text-decoration: none;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 960px) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 36px;
    }

    .related-articles {
        position: static;
    }

    .related-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .article-layout {
        gap: 28px;
        margin-top: 18px;
        margin-bottom: 45px;
    }

    .article-header h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        letter-spacing: -0.035em;
    }

    .article-header .lead {
        font-size: 1rem;
        line-height: 1.75;
    }

    .article-meta {
        gap: 7px 10px;
        font-size: 0.82rem;
    }

    .article-meta span + span::before {
        margin-right: 10px;
    }

    .article-hero {
        margin: 22px 0 26px;
        border-radius: 14px;
    }

    .article-content {
        font-size: 1rem;
        line-height: 1.85;
    }

    .article-content h2 {
        margin-top: 2.3rem;
        padding-left: 0.75rem;
    }

    .article-content h3 {
        margin-top: 1.6rem;
    }

    .article-content ul,
    .article-content ol {
        padding: 0.9rem 0.9rem 0.9rem 2.2rem;
        border-radius: 11px;
    }

    .article-content .article-callout {
        gap: 10px;
        padding: 14px;
    }

    .article-content .article-callout-icon {
        flex-basis: 30px;
        width: 30px;
        height: 30px;
    }

    .article-content th,
    .article-content td {
        padding: 0.65rem;
    }

    .related-articles {
        padding: 14px;
    }

    .related-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .article-content a,
    .related-card,
    .related-more span {
        transition: none;
    }

    .related-card:hover {
        transform: none;
    }
}

/* Important text highlighting */
.article-content mark {
    padding: 0.08em 0.24em;
    border-radius: 4px;
    background: #fff0a8;
    color: #332600;
    font-weight: 650;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Dark-theme highlight */
[data-theme='dark'] .article-content mark {
    background: #59491b;
    color: #fff1b8;
}

/* Highlighted text remains readable on smaller screens */
.article-content strong mark,
.article-content mark strong {
    font-weight: 800;
}
