@import url("https://fonts.googleapis.com/css2?family=Poppins&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;
}

body {
  font-family: "Poppins", sans-serif;
  color: var(--primary-text-color);
}

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

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

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

.container {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 20px;
  overflow: hidden;
}

/* Navigation Styles */
nav {
  background-color: #f3faff;
  box-shadow: 0 0 4px #bbd0e2;
  position: fixed;
  top: 0;
  z-index: 99;
  left: 0;
  right: 0;
}

.main-nav {
  justify-content: space-between;
  padding-block: 8px;
  position: relative;
}

.Rajiv-News {
  display: flex;
  align-items: center;
  gap: 8px;
}

.Rajiv-News img {
  width: 40px;
  height: 40px;
  object-fit: cover;
}

.Rajiv-News h5 {
  color: black;
  white-space: nowrap;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: var(--primary-text-color);
  z-index: 100;
  outline: none; /* Remove focus outline */
}

.hamburger:focus {
  outline: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

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

.hover-link {
  cursor: pointer;
  transition: color 0.2s ease;
}

.hover-link:hover {
  color: var(--secondary-text-color);
}

.hover-link:active {
  color: red;
}

.nav-items.active {
  color: var(--accent-color);
}

/* Search Bar */
.search-bar {
  height: 32px;
  gap: 8px;
}

.news-input {
  width: 200px;
  height: 100%;
  padding-inline: 12px;
  border-radius: 4px;
  border: 2px solid #bbd0e2;
  font-family: "Roboto", sans-serif;
}

.search-button {
  background-color: var(--accent-color);
  color: white;
  padding: 8px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  transition: background-color 0.2s ease;
}

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

/* Main Content */
main {
  padding-block: 20px;
  margin-top: 80px;
}

.cards-container {
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 20px;
  align-items: start;
}

/* Card Styles */
.card {
  width: 360px;
  min-height: 400px;
  box-shadow: 0 0 4px #d4ecff;
  border-radius: 4px;
  cursor: pointer;
  background-color: #fff;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 1px 1px 8px #d4ecff;
  background-color: #f9fdff;
  transform: translateY(-2px);
}

.card-header img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-content {
  padding: 12px;
}

.card-content h3 {
  margin-bottom: 8px;
  font-size: 1.2rem;
  color: var(--primary-text-color);
}

.news-source {
  margin-block: 12px;
  color: var(--secondary-text-color);
  font-size: 0.9rem;
}

/* Responsive Designs */
@media screen and (max-width: 1200px) {
  .container {
    max-width: 980px;
  }

  .cards-container {
    gap: 20px;
    justify-content: center;
  }

  .card {
    width: calc(33.33% - 20px);
    min-width: 300px;
  }
}

@media screen and (max-width: 1199px) {
  .container {
    max-width: 768px;
  }

  .nav-links {
    gap: 16px;
  }

  .card {
    width: calc(50% - 20px);
    min-width: 280px;
  }
}

@media screen and (max-width: 767px) {
  .hamburger {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background-color: #f3faff;
    flex-direction: column;
    padding: 80px 20px 20px;
    transition: left 0.3s ease;
    z-index: 90;
  }

  .nav-links.active {
    left: 0;
  }

  .nav-links ul {
    flex-direction: column;
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
  }

  .nav-links ul li {
    padding: 12px 0;
    font-size: 1.2rem;
    width: 100%;
    border-bottom: 1px solid #e0e0e0;
  }

  .search-bar {
    flex-direction: column;
    width: 100%;
    height: auto;
    gap: 12px;
  }

  .news-input {
    width: 100%;
    height: 40px;
  }

  .search-button {
    width: 100%;
    height: 40px;
  }

  .card {
    width: 100%;
    min-width: auto;
  }

  main {
    margin-top: 70px;
  }
}

@media screen and (max-width: 479px) {
  .Rajiv-News h5 {
    font-size: 0.9rem;
  }

  .card-header img {
    height: 160px;
  }

  .card {
    min-height: 350px;
  }

  .card-content h3 {
    font-size: 1.1rem;
  }

  .news-source {
    font-size: 0.8rem;
  }

  .container {
    padding-inline: 12px;
  }
}

/* Utility Classes for Focus States */
button:focus,
input:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 1px;
}

.hover-link:focus {
  color: var(--accent-color);
  outline: none;
}

/* Additional Accessibility */
@media (prefers-reduced-motion: reduce) {
  .card,
  .nav-links,
  .hover-link,
  .search-button {
    transition: none;
  }
}
