@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500&family=Roboto:wght@500&display=swap");

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

:root {
    --primary-text-color: #183b56;
    --secondary-text-color: #577592;
    --accent-color: #2294ed;
    --accent-color-dark: #1d69a3;
    --nav-bg: #ffffff;
    --search-bg: #f0f4ff;
}

body {
    font-family: "Poppins", sans-serif;
    color: var(--primary-text-color);
    background-color: #f9faff;
    scroll-behavior: smooth;
}

p {
    font-family: "Roboto", sans-serif;
    color: var(--secondary-text-color);
    line-height: 1.6rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

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

ul {
    list-style: none;
}

.flex {
    display: flex;
    align-items: center;
}

.container {
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 10px;
}

/* Navbar */
nav {
    background-color: #021349;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    position: fixed;
    top: 0;
    width: 100%;
    color: #f9faff;
    z-index: 100;
    padding: 12px 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

nav.scrolled {
    background: #011030;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    max-width: 1180px;
    margin: auto;
}

.company-logo img {
    width: 110px;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.company-logo img:hover {
    transform: scale(1.05);
}

.nav-links ul {
    display: flex;
    gap: 20px;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item:hover {
    background-color: var(--accent-color);
    color: #fff;
    transform: translateY(-2px);
}

.nav-item.active {
    background-color: var(--accent-color-dark);
    color: #fff;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    transition: transform 0.3s ease;
}

.hamburger span {
    width: 26px;
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Search bar */
.search-container {
    margin-top: 110px;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    animation: fadeIn 0.6s ease;
}

.news-input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #cfd8e7;
    background-color: var(--search-bg);
    transition: all 0.3s ease;
}

.news-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(34,148,237,0.3);
}

.search-button {
    padding: 10px 22px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-button:hover {
    background-color: var(--accent-color-dark);
    transform: scale(1.05);
}

/* Cards Container */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    padding: 0 20px;
    align-items: stretch; /* makes all grid items same height */
}

/* Card */
.card {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* keeps content aligned */
    width: 100%;
    max-width: 360px;
    min-height: 420px;   /* 👈 fixed height for uniform look */
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    background-color: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.card-header img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card:hover .card-header img {
    transform: scale(1.08);
}

.card-content {
    flex: 1;  /* makes text area grow evenly */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
}

.news-source {
    margin: 8px 0;
    color: var(--secondary-text-color);
    font-size: 14px;
}

/* Mobile menu dropdown */
@media screen and (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        width: 50%;
        background-color: var(--nav-bg);
        padding: 20px;
        border-radius: 12px 0 0 12px;
        box-shadow: -4px 0 12px rgba(0,0,0,0.15);
        position: absolute;
        top: 70px;
        right: 0;
        left: auto;
        z-index: 200;
        color: black;
        transform: translateX(100%);
        opacity: 0;
        transition: all 0.4s ease;
    }

    .nav-links.active {
        display: flex;
        transform: translateX(0);
        opacity: 1;
    }

    .nav-links ul {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        width: 100%;
    }

    .nav-item {
        padding: 12px;
        font-size: 16px;
        transition: background 0.3s ease;
    }

    /* Hamburger */
    .hamburger {
        display: flex;
        flex-direction: column;
        cursor: pointer;
        gap: 5px;
        z-index: 300;
    }

    /* X Animation */
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* Search bar stacked */
    .search-container {
        margin-top: 100px;
        flex-direction: column;
        align-items: center;
    }

    .news-input, .search-button {
        width: 100%;
        max-width: 500px;
    }

    /* Cards full width */
    .card {
        width: 100%;
    }
}

/* 🔥 Animations */
@keyframes fadeIn {
    from {opacity: 0; transform: translateY(10px);}
    to {opacity: 1; transform: translateY(0);}
}
