/**
 * News Dynamic Layout - Configurable Digital Newspaper Design
 * Based on ADN layout but with CSS variables for dynamic branding
 */

/* CSS Variables for Dynamic Branding - set by template */
:root {
    --brand-header-color: #3d4460; /* Default fallback */
    --brand-attribution-text-color: #ffffff; /* Default fallback */
    --brand-logo-height: 5.556vh; /* Default fallback */
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    overflow: hidden;
    background: #000;
}

/* Main Container */
.digital-news-paper {
    position: absolute;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Header Container */
.header-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 11.574vh; /* ~125px at 1080p */
    z-index: 10;
}

.header-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--brand-header-color); /* Dynamic brand color */
    z-index: 1;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Brand Logo */
.brand-logo-container {
    position: absolute;
    top: 50%;
    left: 2.604vw; /* ~50px at 1920p */
    transform: translateY(-50%);
    z-index: 3;
}

.brand-logo {
    height: var(--brand-logo-height); /* Dynamic logo height */
    width: auto;
    max-width: 23.438vw; /* ~450px at 1920p */
    object-fit: contain;
}

/* Attribution */
.attribution {
    position: absolute;
    top: 50%;
    right: 2.604vw; /* ~50px at 1920p */
    transform: translateY(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 1.042vw; /* ~20px at 1920p */
}

.provided-by {
    color: var(--brand-attribution-text-color); /* Dynamic text color */
    font-size: 2.083vw; /* ~40px at 1920p */
    font-weight: 300;
    font-family: 'Nunito Sans', sans-serif;
}

/* Main Content Container */
.content-container {
    position: absolute;
    top: 11.574vh; /* Start after header */
    left: 0;
    width: 100%;
    height: 88.426vh; /* Remaining height */
    z-index: 1;
}

/* Background Image (Blurred) */
.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(5px);
    z-index: 1;
}

/* Content Overlay */
.content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
    z-index: 2;
}

/* Featured Image */
.featured-image-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.featured-image-container::after {
    content: ' ';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: rgba(0, 0, 0, 0.3);
}

.featured-image {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Headline Section */
.headline-section {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 4;
}

.headline-background {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.85), #000);
    padding: 2.5vh 2.604vw; /* ~20px vertical, ~50px horizontal at reference sizes */
}

/* Headlines and Text */
.headline-wrapper {
    margin-bottom: 0.741vh; /* ~8px at 1080p */
}

.headline {
    color: #fff;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 3vw; /* ~55px at 1920p */
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.8);
    margin: 0;
}

.teaser-wrapper {
    margin-bottom: 0;
}

.teaser {
    color: #fff;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 2vw; /* ~35px at 1920p */
    font-weight: 400;
    line-height: 1.4;
    text-shadow: 2px 3px 3px rgba(0, 0, 0, 0.5);
    margin: 0;
}

/* Article Meta Information */
.article-meta {
    margin-top: 1.5625vw;
    display: flex;
    gap: 2.083vw;
    flex-wrap: wrap;
    font-family: 'Nunito Sans', sans-serif;
    font-size: clamp(0.75rem, 1.302vw, 1rem);
    color: rgba(255, 255, 255, 0.85);
}

.article-meta .author {
    font-size: 1.2vw;
    font-weight: 500;
    color: #ffffff;
}

.article-meta .publish-date {
    font-size: 1.2vw;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
}

.article-meta .author::before {
    content: '✍️ ';
    margin-right: 0.5rem;
}

.article-meta .publish-date::before {
    content: '📅 ';
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 1440px) {
    .headline {
        font-size: 3.819vw; /* Scale up for smaller screens */
    }

    .teaser {
        font-size: 2.431vw;
    }

    .provided-by {
        font-size: 2.778vw;
    }
}

@media (max-width: 1024px) {
    .headline {
        font-size: 4.688vw;
    }

    .teaser {
        font-size: 2.93vw;
    }

    .provided-by {
        font-size: 3.125vw;
    }

    .attribution {
        gap: 1.563vw;
    }
}

@media (max-width: 768px) {
    .headline {
        font-size: 6.25vw;
    }

    .teaser {
        font-size: 3.906vw;
    }

    .provided-by {
        font-size: 4.167vw;
    }

    .attribution {
        flex-direction: column;
        gap: 0.521vw;
    }

    .headline-background {
        padding: 2.604vh 5.208vw;
    }

    /* Responsive article meta for mobile */
    .article-meta {
        margin-top: 2.5vh;
        gap: 3.125vw;
        font-size: clamp(0.7rem, 1.5vw, 0.9rem);
        flex-direction: column;
        align-items: flex-start;
    }

    .article-meta .author::before,
    .article-meta .publish-date::before {
        margin-right: 0.3rem;
    }
}

/* Animation and Transitions */
.news-dynamic-item-container {
    transition: opacity 0.5s ease-in-out;
}

.featured-image {
    transition: transform 0.3s ease;
}

.featured-image:hover {
    transform: scale(1.02);
}

/* Loading State - News Dynamic Specific */
.news-dynamic-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    font-family: 'Nunito Sans', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Spinner Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    position: relative;
    animation: pulse 1s linear infinite;
}

.loader:after {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: scaleUp 1s linear infinite;
}

@keyframes scaleUp {
    0% { transform: translate(-50%, -50%) scale(0) }
    60%, 100% { transform: translate(-50%, -50%) scale(1)}
}

@keyframes pulse {
    0%, 60%, 100%{ transform: scale(1) }
    80% { transform: scale(1.2)}
}

/* High DPI Display Optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .brand-logo,
    .featured-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles (if needed) */
@media print {
    .digital-news-paper {
        background: white !important;
    }

    .headline,
    .teaser,
    .provided-by {
        color: black !important;
        text-shadow: none !important;
    }

    .background-image,
    .content-overlay {
        display: none !important;
    }
}