/**
 * Nexus Theme — Responsive Stylesheet
 * Mobile-first breakpoint system
 *
 * Breakpoints:
 * xxl: 1400px
 * xl:  1200px
 * lg:  992px
 * md:  768px
 * sm:  576px
 * xs:  480px
 * xxs: 360px
 *
 * @package Nexus
 * @version 1.0.0
 */

/* =============================================================================
   XXL — 1400px and below
   ============================================================================= */

@media (max-width: 1400px) {
  .container {
    max-width: 1200px;
    padding-left: var(--nexus-space-6);
    padding-right: var(--nexus-space-6);
  }

  .nexus-grid-5 {
    grid-template-columns: repeat(4, 1fr);
  }

  .footer-widgets.cols-4 {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }

  .pricing-card.is-featured {
    transform: translateY(-6px);
  }
}

/* =============================================================================
   XL — 1200px and below
   ============================================================================= */

@media (max-width: 1200px) {
  :root {
    --nexus-container-xl: 100%;
    --nexus-sidebar-width: 300px;
  }

  .container {
    padding-left: var(--nexus-space-5);
    padding-right: var(--nexus-space-5);
  }

  .nexus-grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }

  .nexus-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }

  .nexus-stats-row {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--nexus-space-6);
  }

  .hero-title {
    font-size: clamp(var(--nexus-text-3xl), 5vw, var(--nexus-text-5xl));
  }

  .footer-widgets.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--nexus-space-8);
  }

  .with-sidebar {
    grid-template-columns: 1fr 280px;
    gap: var(--nexus-space-8);
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--nexus-space-8);
  }
}

/* =============================================================================
   LG — 992px and below
   ============================================================================= */

@media (max-width: 992px) {
  /* Header */
  .primary-nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .header-cta .btn {
    display: none;
  }

  /* Sections */
  .section-padding {
    padding-top: var(--nexus-space-16);
    padding-bottom: var(--nexus-space-16);
  }

  .section-padding-lg {
    padding-top: var(--nexus-space-20);
    padding-bottom: var(--nexus-space-20);
  }

  /* Grids */
  .nexus-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .nexus-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Stats */
  .nexus-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--nexus-space-6);
  }

  .stat-item + .stat-item:nth-child(3) {
    border-left: none;
  }

  .stat-item:nth-child(3),
  .stat-item:nth-child(4) {
    padding-top: var(--nexus-space-6);
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .stat-item:nth-child(2) {
    border-left: 1px solid rgba(255,255,255,0.1);
  }

  .stat-item:nth-child(4) {
    border-left: 1px solid rgba(255,255,255,0.1);
  }

  /* Sidebar */
  .with-sidebar {
    grid-template-columns: 1fr;
  }

  .site-sidebar {
    order: 2;
  }

  /* Portfolio */
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Blog */
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Pricing */
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }

  .pricing-card.is-featured {
    transform: none;
    order: -1;
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--nexus-space-8);
  }

  /* Footer */
  .footer-widgets.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-widgets.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Page header */
  .nexus-page-header {
    padding: var(--nexus-space-16) 0 var(--nexus-space-12);
  }

  /* Hero */
  .nexus-hero {
    min-height: 90vh;
  }

  .hero-title {
    font-size: clamp(var(--nexus-text-2xl), 5vw, var(--nexus-text-4xl));
  }
}

/* =============================================================================
   MD — 768px and below
   ============================================================================= */

@media (max-width: 768px) {
  /* Base */
  html {
    font-size: 15px;
  }

  :root {
    --nexus-header-height: 70px;
  }

  /* Container */
  .container {
    padding-left: var(--nexus-space-4);
    padding-right: var(--nexus-space-4);
  }

  /* Sections */
  .section-padding {
    padding-top: var(--nexus-space-12);
    padding-bottom: var(--nexus-space-12);
  }

  .section-header {
    margin-bottom: var(--nexus-space-10);
  }

  /* Grids */
  .nexus-grid-2,
  .nexus-grid-3,
  .nexus-grid-4 {
    grid-template-columns: 1fr;
  }

  /* Stats */
  .nexus-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hero */
  .nexus-hero {
    min-height: 85vh;
  }

  .hero-title {
    font-size: clamp(var(--nexus-text-2xl), 7vw, var(--nexus-text-3xl));
  }

  .hero-description {
    font-size: var(--nexus-text-base);
  }

  .hero-cta {
    flex-direction: column;
    gap: var(--nexus-space-3);
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }

  /* Portfolio */
  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  /* Blog */
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-list .card-blog {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer-widgets.cols-4,
  .footer-widgets.cols-3,
  .footer-widgets.cols-2 {
    grid-template-columns: 1fr;
  }

  .footer-bottom-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-bottom-links {
    justify-content: center;
  }

  /* Pricing */
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  /* Contact form row */
  .form-row,
  .comment-form .form-row {
    grid-template-columns: 1fr;
  }

  /* Author box */
  .author-box {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  /* Comment list */
  .children {
    padding-left: var(--nexus-space-4);
  }

  /* Back to top */
  .back-to-top {
    bottom: var(--nexus-space-5);
    right: var(--nexus-space-5);
    width: 40px;
    height: 40px;
  }

  /* Cookie */
  .nexus-cookie-notice {
    flex-direction: column;
    left: var(--nexus-space-4);
    right: var(--nexus-space-4);
    bottom: var(--nexus-space-4);
  }

  /* Page header */
  .nexus-page-header {
    padding: var(--nexus-space-12) 0 var(--nexus-space-8);
  }

  .page-header-title {
    font-size: clamp(var(--nexus-text-xl), 5vw, var(--nexus-text-2xl));
  }

  /* Timeline */
  .timeline-horizontal {
    flex-direction: column;
  }

  .timeline-horizontal::before {
    display: none;
  }

  .timeline-h-item {
    padding: 0 0 var(--nexus-space-4) var(--nexus-space-8);
    text-align: left;
    min-width: auto;
  }

  .timeline-h-dot {
    left: 0;
    top: 4px;
    transform: none;
  }

  /* Section header */
  .section-eyebrow::before,
  .section-eyebrow::after {
    width: 20px;
  }

  /* WooCommerce */
  .woocommerce .products.columns-3,
  .woocommerce .products.columns-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================================================
   SM — 576px and below
   ============================================================================= */

@media (max-width: 576px) {
  html {
    font-size: 14px;
  }

  /* Sections */
  .section-padding {
    padding-top: var(--nexus-space-10);
    padding-bottom: var(--nexus-space-10);
  }

  .section-padding-sm {
    padding-top: var(--nexus-space-8);
    padding-bottom: var(--nexus-space-8);
  }

  /* Stats */
  .nexus-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--nexus-space-4);
  }

  .stat-item + .stat-item {
    border-left: none;
    padding-left: 0;
  }

  .stat-item:nth-child(even) {
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: var(--nexus-space-4);
  }

  /* Hero */
  .hero-eyebrow {
    font-size: 10px;
    padding: var(--nexus-space-1) var(--nexus-space-3);
  }

  .hero-particle:nth-child(1) {
    width: 180px;
    height: 180px;
  }

  .hero-particle:nth-child(4) {
    display: none;
  }

  /* Buttons */
  .btn-xl {
    padding: var(--nexus-space-4) var(--nexus-space-6);
    font-size: var(--nexus-text-base);
  }

  /* CTA */
  .cta-buttons {
    flex-direction: column;
  }

  .cta-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  /* Error 404 */
  .error-404-code {
    font-size: 5rem;
  }

  /* Pagination */
  .pagination-list {
    gap: var(--nexus-space-1);
  }

  .pagination-item a,
  .pagination-item span {
    min-width: 36px;
    height: 36px;
    font-size: var(--nexus-text-sm);
  }

  /* Single post */
  .single-post-hero {
    height: 300px;
  }

  /* Comments */
  .comment {
    grid-template-columns: 40px 1fr;
    gap: var(--nexus-space-3);
  }

  .comment-avatar img {
    width: 40px;
    height: 40px;
  }

  /* Portfolio filters */
  .portfolio-filters {
    gap: var(--nexus-space-2);
  }

  .filter-btn {
    font-size: var(--nexus-text-xs);
    padding: var(--nexus-space-1) var(--nexus-space-3);
  }

  /* WooCommerce */
  .woocommerce .products.columns-2,
  .woocommerce .products.columns-3,
  .woocommerce .products.columns-4 {
    grid-template-columns: 1fr;
  }

  /* Card paddings */
  .card-service {
    padding: var(--nexus-space-6);
  }

  .card-testimonial {
    padding: var(--nexus-space-6);
  }

  /* Footer */
  .footer-social {
    justify-content: center;
  }

  .footer-main {
    padding: var(--nexus-space-12) 0 var(--nexus-space-8);
  }
}

/* =============================================================================
   XS — 480px and below
   ============================================================================= */

@media (max-width: 480px) {
  /* Typography */
  :root {
    --nexus-header-height: 64px;
  }

  .section-title {
    font-size: var(--nexus-text-2xl);
  }

  /* Hero */
  .nexus-hero {
    min-height: 100svh;
  }

  .hero-title {
    font-size: var(--nexus-text-2xl);
    margin-bottom: var(--nexus-space-4);
  }

  .hero-scroll-indicator {
    display: none;
  }

  /* Header */
  .site-header {
    height: 64px;
  }

  .site-header.is-scrolled {
    height: 56px;
  }

  .mobile-nav-wrap {
    padding-top: calc(64px + var(--nexus-space-4));
  }

  .custom-logo {
    height: 32px;
  }

  /* Eyebrow */
  .section-eyebrow::before,
  .section-eyebrow::after {
    width: 15px;
  }

  /* Stats */
  .nexus-stats-section {
    padding: var(--nexus-space-12) 0;
  }

  /* Testimonial */
  .card-testimonial::before {
    font-size: 50px;
    top: var(--nexus-space-3);
    right: var(--nexus-space-4);
  }

  /* Portfolio card */
  .portfolio-filters {
    justify-content: flex-start;
  }

  /* Blog card */
  .blog-card-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--nexus-space-1);
  }

  /* Table responsive */
  .table-responsive table {
    font-size: var(--nexus-text-xs);
  }

  table th,
  table td {
    padding: var(--nexus-space-2) var(--nexus-space-3);
  }

  /* FAQ */
  .faq-question {
    padding: var(--nexus-space-4);
    font-size: var(--nexus-text-sm);
  }

  .faq-answer-inner {
    padding: 0 var(--nexus-space-4) var(--nexus-space-4);
  }
}

/* =============================================================================
   XXS — 360px and below
   ============================================================================= */

@media (max-width: 360px) {
  html {
    font-size: 13px;
  }

  .container {
    padding-left: var(--nexus-space-3);
    padding-right: var(--nexus-space-3);
  }

  .hero-title {
    font-size: var(--nexus-text-xl);
  }

  .nexus-stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .stat-item + .stat-item {
    border-left: none;
    padding-left: 0;
  }

  .site-name-link {
    font-size: var(--nexus-text-lg);
  }

  .btn {
    padding: var(--nexus-space-2) var(--nexus-space-4);
  }

  .btn-lg {
    padding: var(--nexus-space-3) var(--nexus-space-5);
    font-size: var(--nexus-text-base);
  }

  .blog-card-body {
    padding: var(--nexus-space-4);
  }

  .card-service {
    padding: var(--nexus-space-5);
  }
}

/* =============================================================================
   PRINT
   ============================================================================= */

@media print {
  .site-header,
  .menu-toggle,
  .back-to-top,
  .nexus-cookie-notice,
  .nexus-preloader,
  .nexus-scroll-progress,
  .site-footer,
  .nexus-share,
  .nexus-related-posts,
  .comments-section,
  .site-sidebar {
    display: none !important;
  }

  .page-wrapper {
    padding-top: 0;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #444;
  }

  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  .with-sidebar {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   HIGH CONTRAST / ACCESSIBILITY
   ============================================================================= */

@media (prefers-contrast: high) {
  :root {
    --nexus-border: #767676;
    --nexus-text: #000000;
    --nexus-text-light: #333333;
    --nexus-text-muted: #555555;
  }

  .btn-primary {
    background-color: #000080;
    border-color: #000080;
  }

  .nav-link::after {
    height: 3px;
  }

  input,
  textarea,
  select {
    border-width: 2px;
  }
}

/* =============================================================================
   LANDSCAPE PHONES
   ============================================================================= */

@media (max-width: 768px) and (orientation: landscape) {
  .nexus-hero {
    min-height: 100vh;
  }

  .hero-title {
    font-size: var(--nexus-text-xl);
  }

  .hero-cta {
    flex-direction: row;
  }

  .hero-cta .btn {
    width: auto;
  }
}

/* =============================================================================
   HOVER MEDIA QUERY (touch device optimization)
   ============================================================================= */

@media (hover: none) {
  .card-hover:hover,
  .card-blog:hover,
  .card-service:hover,
  .card-team:hover,
  .card-testimonial:hover,
  .card-portfolio:hover {
    transform: none;
  }

  .portfolio-overlay {
    opacity: 1;
    background: linear-gradient(to bottom, transparent 50%, rgba(45,174,67,0.85) 100%);
  }

  .nav-link:hover::after {
    transform: translateX(-50%) scaleX(0);
  }
}

/* =============================================================================
   DARK MODE RESPONSIVE
   ============================================================================= */

@media (prefers-color-scheme: dark) {
  @media (max-width: 992px) {
    .mobile-nav-wrap {
      background-color: #1F2937;
    }

    .mobile-menu a {
      color: #F3F4F6;
    }

    .mobile-menu li {
      border-color: #374151;
    }
  }
}
