/* ===== RESPONSIVE ENHANCEMENTS ===== */

/* Extra Large Devices (1400px and up) */
@media screen and (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .hero__content {
    gap: 4rem;
  }
  
  .featured__container {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .trending__card {
    min-width: 320px;
  }
}

/* Large Devices (992px to 1199px) */
@media screen and (min-width: 992px) and (max-width: 1199px) {
  .container {
    max-width: 960px;
  }
  
  .nav__list {
    gap: 1.5rem;
  }
  
  .search__input {
    width: 200px;
  }
  
  .featured__container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .latest__grid {
    grid-template-columns: 1.8fr 1fr;
  }
}

/* Medium Devices (768px to 991px) */
@media screen and (min-width: 768px) and (max-width: 991px) {
  .container {
    max-width: 720px;
  }
  
  .hero {
    height: 70vh;
  }
  
  .hero__content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  
  .hero__data h1 {
    font-size: 2rem;
  }
  
  .featured__container {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .trending__container {
    gap: 1.5rem;
  }
  
  .trending__card {
    min-width: 240px;
  }
  
  .latest__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .latest__card {
    grid-template-columns: 180px 1fr;
  }
  
  .sidebar {
    order: -1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .sidebar__widget {
    margin-bottom: 0;
  }
}

/* Small Devices (576px to 767px) */
@media screen and (min-width: 576px) and (max-width: 767px) {
  .container {
    max-width: 540px;
  }
  
  .nav__actions {
    flex-direction: row;
    gap: 0.75rem;
  }
  
  .search__input {
    width: 180px;
  }
  
  .hero {
    height: 60vh;
    padding: 1rem 0;
  }
  
  .hero__data h1 {
    font-size: 1.75rem;
  }
  
  .hero__data p {
    font-size: var(--normal-font-size);
  }
  
  .featured__container {
    grid-template-columns: 1fr;
  }
  
  .trending__card {
    min-width: 200px;
  }
  
  .latest__card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .latest__image {
    height: 180px;
  }
  
  .sidebar {
    display: block;
  }
  
  .footer__container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Extra Small Devices (up to 575px) */
@media screen and (max-width: 575px) {
  .container {
    margin-left: var(--mb-1);
    margin-right: var(--mb-1);
  }
  
  .section {
    padding: 3rem 0 1.5rem;
  }
  
  .section__title {
    font-size: var(--h3-font-size);
    margin-bottom: var(--mb-2);
  }
  
  .nav {
    height: calc(var(--header-height) + 0.5rem);
    padding: 0.5rem 0;
  }
  
  .nav__logo {
    font-size: var(--normal-font-size);
  }
  
  .nav__logo i {
    font-size: 1.25rem;
  }
  
  .nav__actions {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
  }
  
  .search__container {
    order: 2;
    width: 100%;
  }
  
  .search__input {
    width: 100%;
    font-size: var(--smaller-font-size);
  }
  
  .theme__toggle {
    font-size: 1rem;
  }
  
  .nav__toggle {
    font-size: 1.25rem;
  }
  
  .hero {
    height: 50vh;
    min-height: 400px;
  }
  
  .hero__data h1 {
    font-size: var(--h2-font-size);
    line-height: 1.3;
  }
  
  .hero__data p {
    font-size: var(--small-font-size);
  }
  
  .hero__button {
    padding: 0.75rem 1.5rem;
    font-size: var(--small-font-size);
  }
  
  .featured__card,
  .trending__card,
  .latest__card {
    margin-bottom: var(--mb-1);
  }
  
  .featured__content,
  .trending__content,
  .latest__content {
    padding: 1rem;
  }
  
  .featured__title,
  .trending__title,
  .latest__title {
    font-size: var(--normal-font-size);
  }
  
  .trending__container {
    gap: 1rem;
  }
  
  .trending__card {
    min-width: 180px;
  }
  
  .trending__image {
    height: 120px;
  }
  
  .latest__container {
    gap: 1.5rem;
  }
  
  .load-more__btn {
    padding: 0.75rem 1.5rem;
    font-size: var(--small-font-size);
  }
  
  .sidebar__widget {
    padding: 1rem;
  }
  
  .widget__title {
    font-size: var(--normal-font-size);
  }
  
  .newsletter__form {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .newsletter__input,
  .newsletter__btn {
    width: 100%;
  }
  
  .footer {
    padding: 2rem 0 1rem;
  }
  
  .footer__container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }
  
  .footer__social {
    justify-content: center;
  }
  
  .footer__copyright {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .footer__legal {
    justify-content: center;
  }
}

/* Ultra Small Devices (up to 350px) */
@media screen and (max-width: 350px) {
  :root {
    --biggest-font-size: 1.5rem;
    --h1-font-size: 1.25rem;
    --h2-font-size: 1.125rem;
    --h3-font-size: 1rem;
    --normal-font-size: 0.875rem;
    --small-font-size: 0.75rem;
    --smaller-font-size: 0.688rem;
  }
  
  .container {
    margin-left: var(--mb-0-75);
    margin-right: var(--mb-0-75);
  }
  
  .nav__logo span {
    display: none;
  }
  
  .search__input {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
  }
  
  .hero__data h1 {
    font-size: var(--h1-font-size);
  }
  
  .hero__button {
    padding: 0.6rem 1.2rem;
  }
  
  .trending__card {
    min-width: 160px;
  }
  
  .trending__image {
    height: 100px;
  }
  
  .sidebar__widget {
    padding: 0.75rem;
  }
  
  .recommended__post {
    flex-direction: column;
    text-align: center;
  }
  
  .recommended__image {
    width: 80px;
    height: 80px;
    align-self: center;
  }
  
  .footer__social-link {
    width: 35px;
    height: 35px;
    font-size: 0.875rem;
  }
}

/* Landscape Orientation for Mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .hero {
    height: 100vh;
    min-height: auto;
  }
  
  .hero__data h1 {
    font-size: var(--h2-font-size);
  }
  
  .hero__data p {
    font-size: var(--small-font-size);
    margin-bottom: var(--mb-1);
  }
  
  .section {
    padding: 2rem 0 1rem;
  }
}

/* High DPI Displays */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
  .hero__image img,
  .featured__image img,
  .trending__image img,
  .latest__image img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Print Styles */
@media print {
  .header,
  .nav__toggle,
  .nav__close,
  .theme__toggle,
  .search__container,
  .hero__button,
  .load-more__btn,
  .newsletter__widget,
  .footer__social {
    display: none !important;
  }
  
  .hero {
    height: auto;
    background: white;
    color: black;
  }
  
  .hero__content {
    grid-template-columns: 1fr;
  }
  
  .section {
    page-break-inside: avoid;
  }
  
  .featured__card,
  .latest__card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .loading__spinner {
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000080;
    --secondary-color: #008000;
    --accent-color: #ff0000;
    --text-color: #000000;
    --border-color: #000000;
    --shadow-color: rgba(0, 0, 0, 0.5);
  }
  
  .featured__card,
  .trending__card,
  .latest__card,
  .sidebar__widget {
    border: 2px solid var(--border-color);
  }
}

/* Focus Styles for Better Accessibility */
.nav__link:focus,
.search__input:focus,
.theme__toggle:focus,
.nav__toggle:focus,
.hero__button:focus,
.load-more__btn:focus,
.newsletter__btn:focus,
.footer__link:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Smooth Scrolling Enhancement */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
  
  .trending__container {
    scroll-behavior: smooth;
  }
}