/**
 * Home Page Styles - أنماط الصفحة الرئيسية
 * RTL-First Design for Arabic News Theme
 * 
 * @package jory-news-theme
 */

/* =========================================
   CSS Variables
   ========================================= */
:root {
    --home-primary: #1e3a5f;
    --home-secondary: #e53e3e;
    --home-accent: #3b82f6;
    --home-text: #1e293b;
    --home-text-muted: #64748b;
    --home-bg: #f8fafc;
    --home-card-bg: #ffffff;
    --home-border: #e2e8f0;
    --home-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --home-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --home-radius: 12px;
    --home-radius-sm: 8px;
    --home-transition: 0.3s ease;
    --home-gap: 24px;
}

/* =========================================
   Base Layout
   ========================================= */
.front-page-main {
    background: var(--home-bg);
    padding: 0;
}

.homepage-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.home-section {
    margin-bottom: 48px;
}

/* =========================================
   Section Header
   ========================================= */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--home-primary);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--home-primary);
    margin: 0;
}

.section-title svg {
    fill: var(--home-secondary);
}

.section-title--trending svg {
    fill: #f59e0b;
}

.section-title--picks svg {
    fill: #8b5cf6;
}

.section-title--video svg {
    fill: #ef4444;
}

.section-more-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--home-accent);
    text-decoration: none;
    transition: var(--home-transition);
}

.section-more-link:hover {
    color: var(--home-primary);
    transform: translateX(-4px);
}

/* =========================================
   Hero Section
   ========================================= */
.hero-section {
    margin-bottom: 32px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--home-gap);
}

.hero-main-card {
    position: relative;
    border-radius: var(--home-radius);
    overflow: hidden;
    background: var(--home-card-bg);
    box-shadow: var(--home-shadow-lg);
}

.hero-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.hero-card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.hero-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hero-main-card:hover .hero-card-image img {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
}

.hero-card-content {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 32px;
    color: #fff;
}

.hero-category {
    display: inline-block;
    padding: 6px 14px;
    background: var(--home-secondary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 12px;
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 12px;
    color: #fff;
}

.hero-excerpt {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 16px;
    line-height: 1.6;
}

.hero-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hero-meta svg {
    fill: currentColor;
}

/* Hero Side Cards */
.hero-side-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero-side-card {
    position: relative;
    border-radius: var(--home-radius-sm);
    overflow: hidden;
    background: var(--home-card-bg);
    box-shadow: var(--home-shadow);
    transition: var(--home-transition);
}

.hero-side-card:hover {
    box-shadow: var(--home-shadow-lg);
    transform: translateY(-2px);
}

.hero-side-image {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.hero-side-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.hero-side-card:hover .hero-side-image img {
    transform: scale(1.05);
}

.hero-side-content {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 16px;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
}

.hero-category-small {
    display: inline-block;
    padding: 3px 8px;
    background: var(--home-secondary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 3px;
    margin-bottom: 6px;
}

.hero-side-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 6px;
    color: #fff;
}

.hero-side-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* =========================================
   Breaking News
   ========================================= */
.breaking-section {
    margin-bottom: 32px;
}

.breaking-container {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-radius: var(--home-radius-sm);
    overflow: hidden;
    box-shadow: var(--home-shadow);
}

.breaking-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

.breaking-label svg {
    fill: #fff;
}

.breaking-ticker-wrapper {
    flex: 1;
    overflow: hidden;
    padding: 0 20px;
}

.breaking-ticker {
    display: flex;
    gap: 40px;
    animation: ticker-scroll linear infinite;
    white-space: nowrap;
}

@keyframes ticker-scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(50%);
    }
}

[dir="rtl"] .breaking-ticker {
    animation-name: ticker-scroll-rtl;
}

@keyframes ticker-scroll-rtl {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

.breaking-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--home-transition);
}

.breaking-item:hover {
    opacity: 0.85;
}

.breaking-dot {
    width: 6px;
    height: 6px;
    background: #fbbf24;
    border-radius: 50%;
    flex-shrink: 0;
}

/* =========================================
   Latest News Grid
   ========================================= */
.latest-grid {
    display: grid;
    gap: var(--home-gap);
}

.latest-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.latest-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.latest-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.news-card {
    background: var(--home-card-bg);
    border-radius: var(--home-radius);
    overflow: hidden;
    box-shadow: var(--home-shadow);
    transition: var(--home-transition);
}

.news-card:hover {
    box-shadow: var(--home-shadow-lg);
    transform: translateY(-4px);
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.news-card:hover .card-image img {
    transform: scale(1.05);
}

.card-category {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    background: var(--home-secondary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.card-content {
    padding: 16px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 10px;
    color: var(--home-text);
    transition: var(--home-transition);
}

.news-card:hover .card-title {
    color: var(--home-primary);
}

.card-excerpt {
    font-size: 0.9rem;
    color: var(--home-text-muted);
    margin: 0 0 12px;
    line-height: 1.6;
}

.card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--home-text-muted);
}

.section-footer {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--home-primary);
    color: #fff;
    border: none;
    border-radius: var(--home-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--home-transition);
}

.load-more-btn:hover {
    background: var(--home-accent);
    transform: translateY(-2px);
}

/* =========================================
   Category Blocks
   ========================================= */
.cat-blocks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--home-gap);
}

.cat-block {
    background: var(--home-card-bg);
    border-radius: var(--home-radius);
    padding: 20px;
    box-shadow: var(--home-shadow);
}

.cat-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--home-primary);
}

.cat-block-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.cat-block-title a {
    color: var(--home-primary);
    text-decoration: none;
}

.cat-block-count {
    font-size: 0.8rem;
    color: var(--home-text-muted);
}

.cat-main-post {
    margin-bottom: 16px;
}

.cat-post-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.cat-post-image {
    aspect-ratio: 16/9;
    border-radius: var(--home-radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
}

.cat-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.cat-main-post:hover .cat-post-image img {
    transform: scale(1.05);
}

.cat-post-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--home-text);
    transition: var(--home-transition);
}

.cat-main-post:hover .cat-post-title {
    color: var(--home-primary);
}

.cat-post-date {
    font-size: 0.8rem;
    color: var(--home-text-muted);
}

.cat-sub-post {
    padding: 10px 0;
    border-top: 1px solid var(--home-border);
}

.cat-sub-post .cat-post-link {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.cat-sub-image {
    width: 70px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.cat-sub-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cat-sub-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--home-text);
    line-height: 1.4;
}

.cat-sub-date {
    font-size: 0.75rem;
    color: var(--home-text-muted);
}

.cat-block-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding: 10px;
    background: var(--home-bg);
    border-radius: var(--home-radius-sm);
    color: var(--home-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--home-transition);
}

.cat-block-more:hover {
    background: var(--home-primary);
    color: #fff;
}

/* =========================================
   Trending Section
   ========================================= */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--home-card-bg);
    border-radius: var(--home-radius);
    padding: 20px;
    box-shadow: var(--home-shadow);
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: var(--home-radius-sm);
    background: var(--home-bg);
    transition: var(--home-transition);
}

.trending-item:hover {
    background: #fff;
    box-shadow: var(--home-shadow);
}

.trending-rank {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--home-primary);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.trending-item:nth-child(1) .trending-rank {
    background: #f59e0b;
}

.trending-item:nth-child(2) .trending-rank {
    background: #94a3b8;
}

.trending-item:nth-child(3) .trending-rank {
    background: #cd7f32;
}

.trending-link {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.trending-image {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.trending-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trending-content {
    flex: 1;
}

.trending-category {
    display: inline-block;
    padding: 2px 8px;
    background: var(--home-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 3px;
    margin-bottom: 6px;
}

.trending-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--home-text);
    line-height: 1.4;
}

.trending-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--home-text-muted);
}

.trending-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* =========================================
   Editor's Picks
   ========================================= */
.picks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--home-gap);
}

.picks-card {
    background: var(--home-card-bg);
    border-radius: var(--home-radius);
    overflow: hidden;
    box-shadow: var(--home-shadow);
    transition: var(--home-transition);
}

.picks-card:hover {
    box-shadow: var(--home-shadow-lg);
    transform: translateY(-4px);
}

.picks-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.picks-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.picks-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.picks-card:hover .picks-image img {
    transform: scale(1.05);
}

.picks-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
}

.picks-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #8b5cf6;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
}

.picks-badge svg {
    fill: #fff;
}

.picks-content {
    padding: 16px;
}

.picks-category {
    display: inline-block;
    padding: 3px 8px;
    background: var(--home-bg);
    color: var(--home-primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    margin-bottom: 8px;
}

.picks-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--home-text);
    line-height: 1.5;
}

.picks-excerpt {
    font-size: 0.85rem;
    color: var(--home-text-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

.picks-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--home-text-muted);
}

.picks-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.picks-author img {
    border-radius: 50%;
}

/* =========================================
   Video Section
   ========================================= */
.video-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--home-gap);
}

.video-card {
    background: var(--home-card-bg);
    border-radius: var(--home-radius);
    overflow: hidden;
    box-shadow: var(--home-shadow);
    transition: var(--home-transition);
}

.video-card:hover {
    box-shadow: var(--home-shadow-lg);
}

.video-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.video-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    transition: var(--home-transition);
}

.video-card:hover .video-overlay {
    background: rgba(0, 0, 0, 0.1);
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transition: var(--home-transition);
}

.video-play-btn svg {
    fill: var(--home-secondary);
    margin-right: -4px;
}

.video-card:hover .video-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    background: #fff;
}

.video-content {
    padding: 14px;
}

.video-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--home-text);
}

.video-date {
    font-size: 0.8rem;
    color: var(--home-text-muted);
}

/* =========================================
   Newsletter Section
   ========================================= */
.newsletter-section {
    background: linear-gradient(135deg, var(--home-primary), #0f172a);
    border-radius: var(--home-radius);
    padding: 48px;
    margin-bottom: 48px;
}

.newsletter-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
}

.newsletter-content {
    flex: 1;
}

.newsletter-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
}

.newsletter-title svg {
    fill: #fff;
}

.newsletter-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.newsletter-form-wrapper {
    flex: 1;
    max-width: 450px;
}

.newsletter-form .newsletter-input-group {
    display: flex;
    gap: 12px;
}

.newsletter-form input[type="email"] {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--home-radius-sm);
    font-size: 1rem;
    direction: rtl;
}

.newsletter-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--home-secondary);
    color: #fff;
    border: none;
    border-radius: var(--home-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--home-transition);
    white-space: nowrap;
}

.newsletter-submit:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.newsletter-privacy {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 12px 0 0;
    text-align: center;
}

/* =========================================
   Responsive Design
   ========================================= */
@media (max-width: 1200px) {

    .picks-grid,
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .latest-grid.cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-side-cards {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .cat-blocks-grid {
        grid-template-columns: 1fr;
    }

    .picks-grid,
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .latest-grid.cols-3,
    .latest-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .newsletter-container {
        flex-direction: column;
        text-align: center;
    }

    .newsletter-form-wrapper {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --home-gap: 16px;
    }

    .homepage-container {
        padding: 0 16px;
    }

    .home-section {
        margin-bottom: 32px;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .hero-side-cards {
        grid-template-columns: 1fr;
    }

    .latest-grid.cols-2,
    .latest-grid.cols-3,
    .latest-grid.cols-4 {
        grid-template-columns: 1fr;
    }

    .picks-grid,
    .video-grid {
        grid-template-columns: 1fr;
    }

    .newsletter-section {
        padding: 32px 20px;
    }

    .newsletter-form .newsletter-input-group {
        flex-direction: column;
    }

    .breaking-container {
        flex-direction: column;
    }

    .breaking-label {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-card-content {
        padding: 20px;
    }

    .hero-title {
        font-size: 1.2rem;
    }

    .hero-excerpt {
        display: none;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* =========================================
   Placeholders
   ========================================= */
.hero-placeholder,
.card-placeholder,
.picks-placeholder,
.video-placeholder,
.cat-placeholder,
.trending-placeholder,
.hero-placeholder-small {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   Dark Mode Support
   ========================================= */
.dark-mode {
    --home-text: #e2e8f0;
    --home-text-muted: #94a3b8;
    --home-bg: #0f172a;
    --home-card-bg: #1e293b;
    --home-border: #334155;
}

.dark-mode .section-header {
    border-bottom-color: var(--home-accent);
}

.dark-mode .cat-block-more {
    background: #1e293b;
}

.dark-mode .cat-block-more:hover {
    background: var(--home-accent);
}

.dark-mode .trending-item {
    background: #1e293b;
}

.dark-mode .trending-item:hover {
    background: #334155;
}

/* =========================================
   Screen Reader & Accessibility
   ========================================= */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}