:root {
    --primary: #E11D48;
    --primary-soft: #FB7185;
    --accent: #2563EB;
    --bg-light: #FFF1F2;
    --text-main: #2D0B14;
    --text-muted: #5D2D38;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px 0 rgba(225, 29, 72, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Vibrant background effect */
.vibrant-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(251, 113, 133, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(37, 99, 235, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #FFF1F2 0%, #FFE4E6 100%);
    animation: bgMovement 15s infinite alternate ease-in-out;
    filter: blur(80px);
}

@keyframes bgMovement {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.1) translate(-2%, -2%);
    }
}

/* Spinner Styles */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 5rem 0;
    width: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(225, 29, 72, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-container p {
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.05em;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.frosted-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

/* Header & Nav */
.glass-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 80px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-family: 'Newsreader', serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.brand span {
    color: var(--accent);
}

.search-wrapper {
    position: relative;
    width: 350px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    color: var(--text-muted);
}

#searchInput {
    width: 100%;
    padding: 12px 12px 12px 42px;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#searchInput:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 6px rgba(225, 29, 72, 0.08);
    width: 400px;
}

@media (max-width: 768px) {
    #searchInput:focus {
        width: 100%;
    }
}

/* Content & Grid */
.content {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem;
    min-height: 60vh;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}

/* Article Cards */
.article-card {
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 30px 60px rgba(225, 29, 72, 0.12);
    background: rgba(255, 255, 255, 0.9);
}

.article-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-title {
    font-family: 'Newsreader', serif;
    font-size: 1.6rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-main);
}

.article-summary {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.95rem;
}

/* Skeleton/Loading */
.skeleton-card {
    height: 350px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    100% {
        transform: translateX(100%);
    }
}

/* Helpers */
.hidden {
    display: none !important;
}

.error-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 4rem 0;
}

.error-card {
    max-width: 500px;
    padding: 3rem;
    border-radius: 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cta-button {
    background: var(--primary);
    color: white;
    padding: 12px 32px;
    border-radius: 99px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background: #BE123C;
    transform: scale(1.05);
}

.footer {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .search-wrapper {
        width: 200px;
    }

    .brand {
        font-size: 1.8rem;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 0 1rem;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
    transition: opacity 0.3s ease;
}

.modal-content {
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    border-radius: 32px;
    position: relative;
    padding: 3rem;
    overflow-y: auto;
    animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.2s ease;
    z-index: 10;
}

.close-btn:hover {
    background: white;
    transform: rotate(90deg);
}

.close-btn svg {
    width: 24px;
    height: 24px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-divider {
    height: 1px;
    background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
    opacity: 0.3;
}

.article-summary-full {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.text-content {
    white-space: pre-wrap;
}

/* Modal helper */
.modal-overlay.hidden {
    display: none;
}

body.modal-open {
    overflow: hidden;
}