/* Design Update - Al Arabiya News Portal Style (Clean V2) */

:root {
    /* Keep base ARWriter palette from screen.css */
    --color-accent: #d32f2f;
    /* Urgent Red */

    /* Compatibility aliases for this stylesheet */
    --color-text-main: var(--color-text);
    --color-text-muted: var(--color-text-tertiary);

    /* Layout */
    --container-width: 1240px;
    --header-height: 70px;

    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius-sm: 2px;
    --radius-md: 4px;
}

/* 1. Reset & Typography */
body {
    font-family: 'Almarai', sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial !important;
    background-color: var(--color-bg) !important;
    color: var(--color-text-main) !important;
    font-size: 16px;
    line-height: 1.6;
    /* Optimal reading height */
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Almarai', sans-serif !important;
    color: var(--color-text-main);
    line-height: 1.3;
    /* Tighter for headings */
    font-weight: 800;
    margin-top: 0;
}

a {
    color: var(--color-text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary);
}

/* 2. Hide Old Elements */
.hero,
.hero-content,
.hero-inner,
.featured-header {
    display: none !important;
}

.featured-section {
    padding-top: 30px;
    padding-bottom: 50px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}

.gh-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* 3. News Portal Grid Layout */
.news-portal-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

@media (min-width: 900px) {
    .news-portal-grid {
        display: grid;
        grid-template-columns: 2fr 1fr;
        /* 66% Main, 33% Side */
        gap: 40px;
        align-items: start;
    }
}

/* 4. Main Story Column */
.news-lead-card {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-lead-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.news-lead-image {
    display: block;
    width: 100%;
    aspect-ratio: 16/9;
}

.news-lead-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-lead-content {
    padding: 20px 0;
}

.news-lead-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.news-tag {
    display: inline-block;
    background: var(--color-primary);
    color: var(--color-text-inverted);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.news-lead-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 12px;
}

.news-lead-title a {
    color: var(--color-text-main);
}

.news-lead-title a:hover {
    color: var(--color-primary);
}

.news-lead-excerpt {
    font-size: 17px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 0;
}

/* 5. Side Column (Stacked Stories) */
.news-side-column {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.news-side-header {
    border-bottom: 2px solid var(--color-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.news-side-heading {
    color: var(--color-primary);
    font-size: 18px;
    margin: 0;
    text-transform: uppercase;
}

.news-side-card {
    display: flex;
    flex-direction: row;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.2s ease;
}

.news-side-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-side-card:first-child {
    padding-top: 0;
}


.news-side-card:hover .news-side-title a {
    color: var(--color-primary);
}

.news-side-image {
    width: 90px;
    height: 65px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.news-side-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-side-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.news-side-meta {
    font-size: 11px;
    color: var(--color-accent);
    /* Use accent for tags in sidebar */
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.news-side-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

/* 6. Standard Posts Feed (Below Featured) */
.posts-feed,
.news-feed-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 40px !important;
    padding: 60px 0 !important;
}

.post-card {
    border: none;
    background: var(--color-surface);
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.post-card:hover {
    transform: translateY(-3px);
}

.post-card-image {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 15px;
}

.post-card-content {
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.post-card-tag {
    color: var(--color-primary);
    font-weight: 700;
}

.post-card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.post-card-excerpt {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 7. Section Headers */
.section-header {
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 30px;
    position: relative;
}

.section-title {
    background: var(--color-bg);
    color: var(--color-primary);
    padding-right: 20px;
    /* Arabic R-L */
    display: inline-block;
    font-size: 24px;
    font-weight: 800;
    border-bottom: 3px solid var(--color-primary);
    margin-bottom: -2px;
    /* Pull down to cover border */
}

/* 8. Header Navigation override */
.site-header {
    background: var(--color-surface) !important;
    border-bottom: 4px solid var(--color-primary) !important;
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
}

.nav-link {
    color: var(--color-text-main) !important;
    font-weight: 700 !important;
    font-size: 15px;
    padding: 0 15px;
}

.nav-link:hover {
    color: var(--color-primary) !important;
}

/* 9. Dark mode inherits base theme tokens from screen.css */

/* 10. Dark mode readability guard (prevents low-contrast text on cards) */
html[data-theme="dark"] .site-header,
html.theme-dark .site-header {
    background: #111113 !important;
    border-bottom-color: var(--color-primary) !important;
}

html[data-theme="dark"] .nav-link,
html.theme-dark .nav-link {
    color: #f5f5f7 !important;
}

html[data-theme="dark"] .posts-title,
html.theme-dark .posts-title,
html[data-theme="dark"] .post-card-title,
html.theme-dark .post-card-title,
html[data-theme="dark"] .post-card-title a,
html.theme-dark .post-card-title a,
html[data-theme="dark"] .news-lead-title,
html.theme-dark .news-lead-title,
html[data-theme="dark"] .news-lead-title a,
html.theme-dark .news-lead-title a,
html[data-theme="dark"] .news-side-title,
html.theme-dark .news-side-title,
html[data-theme="dark"] .news-side-title a,
html.theme-dark .news-side-title a {
    color: #f5f5f7 !important;
}

html[data-theme="dark"] .post-card-excerpt,
html.theme-dark .post-card-excerpt,
html[data-theme="dark"] .news-lead-excerpt,
html.theme-dark .news-lead-excerpt {
    color: #c7c7cc !important;
}

html[data-theme="dark"] .post-card-meta,
html.theme-dark .post-card-meta,
html[data-theme="dark"] .post-card-date,
html.theme-dark .post-card-date,
html[data-theme="dark"] .reading-time,
html.theme-dark .reading-time {
    color: #a1a1a6 !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .post-card,
html.theme-dark .post-card,
html[data-theme="dark"] .news-lead-card,
html.theme-dark .news-lead-card,
html[data-theme="dark"] .news-side-column,
html.theme-dark .news-side-column {
    background: #1c1c1e !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}
