/* ============================================
   PROJECTS PAGE - Desktop Styles
   ============================================

   Professional portfolio page with filtering,
   grid layout, and smooth animations.

   Responsive styles are in responsive/ directory
   ============================================ */

  .projects-page {
    background: var(--bg);
    width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    --projects-header-offset: clamp(88px, 12vw, 140px);
    padding-bottom: clamp(5rem, 10vw, 8rem);
  }

    /* ============================================
       REVEAL CONTAINER - Overlay Animation
       ============================================ */

  .projects-reveal-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
  }

    .projects-reveal-container.is-revealing {
      position: relative;
    }

    /* ============================================
       FILTER NAVIGATION - ENHANCED
       ============================================ */

    .projects-filters {
      position: relative;
      top: 0;
      left: 0;
      right: 0;
      z-index: 20;
      background: var(--bg);
      padding: clamp(3rem, 6vw, 4.5rem) 0;
      transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
      opacity: 1;
      visibility: visible;
      transform: translateY(0) scale(1);
      will-change: opacity, transform;
      min-height: auto;
      display: block;
    }

    /* Fullscreen mode - initial state */
    .projects-filters.is-visible.is-fullscreen {
      opacity: 1;
      visibility: visible;
      transform: translateY(0) scale(1);
      position: relative;
      top: 0;
      left: 0;
      right: 0;
      min-height: auto;
      display: block;
    }

    /* Sidebar mode - when grid is shown */
    .projects-filters.is-sidebar {
      position: fixed;
      top: calc(var(--projects-header-offset) + env(safe-area-inset-top));
      left: 0;
      width: 280px;
      height: calc(100vh - var(--projects-header-offset) - env(safe-area-inset-top));
      min-height: calc(100vh - var(--projects-header-offset) - env(safe-area-inset-top));
      max-height: calc(100vh - var(--projects-header-offset) - env(safe-area-inset-top));
      padding: clamp(2rem, 4vw, 3rem) 0 clamp(1rem, 2vw, 1.5rem);
      background: #f7f9ff;
      backdrop-filter: blur(12px);
      border-right: 1px solid rgba(26, 67, 191, 0.2);
      border-bottom: none;
      overflow-y: auto;
      overflow-x: hidden;
      transform: translateX(0);
      opacity: 1;
      visibility: visible;
      z-index: 25;
      transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                  transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      /* Ensure smooth scrolling and proper touch behavior */
      -webkit-overflow-scrolling: touch;
      scrollbar-width: thin;
      scrollbar-color: rgba(26, 67, 191, 0.35) transparent;
      /* Ensure sidebar is always interactive */
      pointer-events: auto;
    }

    /* Custom scrollbar for sidebar */
    .projects-filters.is-sidebar::-webkit-scrollbar {
      width: 6px;
    }

    .projects-filters.is-sidebar::-webkit-scrollbar-track {
      background: transparent;
    }

    .projects-filters.is-sidebar::-webkit-scrollbar-thumb {
      background: rgba(26, 67, 191, 0.35);
      border-radius: 3px;
    }

    .projects-filters.is-sidebar::-webkit-scrollbar-thumb:hover {
      background: rgba(26, 67, 191, 0.55);
    }

    /* Hide sidebar on scroll down */
    .projects-filters.is-sidebar.is-hidden {
      transform: translateX(-100%);
      opacity: 0;
      visibility: hidden;
      /* Disable pointer events when hidden */
      pointer-events: none;
      transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    }

    .projects-filters.scrolled {
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .projects-filters-inner {
      max-width: var(--maxw);
      margin: 0 auto;
      padding: 0 clamp(2rem, 4vw, 3rem);
      width: 100%;
    }

    /* Adjust inner for sidebar mode */
    .projects-filters.is-sidebar .projects-filters-inner {
      max-width: 100%;
      padding: 0 clamp(1.25rem, 2vw, 1.5rem);
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
    }

    .projects-filters-header {
      text-align: center;
      margin-bottom: 3rem;
      animation: projectsFadeInUp 0.6s ease-out 0.2s both;
    }

    /* Adjust header for sidebar mode */
    .projects-filters.is-sidebar .projects-filters-header {
      margin-bottom: 2rem;
      padding-bottom: 1.5rem;
      border-bottom: 1px solid rgba(26, 67, 191, 0.16);
    }

    .projects-filters.is-sidebar .projects-filters-title {
      font-size: clamp(1.25rem, 2vw, 1.5rem);
      margin-bottom: 0.5rem;
      color: #1f2b4a;
      background: none;
      -webkit-text-fill-color: #1f2b4a;
    }

    .projects-filters.is-sidebar .projects-filters-subtitle {
      font-size: clamp(0.75rem, 1.2vw, 0.875rem);
      color: var(--dark-alt);
    }

    .projects-filters-title {
      font-size: clamp(2rem, 4vw, 3rem);
      font-weight: 900;
      color: #1f2b4a;
      margin: 0 0 0.75rem;
      letter-spacing: -0.02em;
      background: none;
      -webkit-text-fill-color: #1f2b4a;
    }

    .projects-filters-subtitle {
      font-size: clamp(1rem, 1.5vw, 1.125rem);
      color: #52627e;
      margin: 0;
      font-weight: 300;
    }

    .projects-filters-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 1.25rem;
      max-width: 1200px;
      margin: 0 auto;
    }

    /* Adjust grid for sidebar mode */
    .projects-filters.is-sidebar .projects-filters-grid {
      grid-template-columns: 1fr;
      gap: 0.875rem;
      max-width: 100%;
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      padding-bottom: 1rem;
      /* Ensure all buttons are accessible */
      min-height: 0;
    }

    .projects-filter-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      padding: 0.5rem 1.5rem;
      border-radius: 20px;
      border: 1px solid rgba(26, 67, 191, 0.14);
      background: #ffffff;
      color: #1f2b4a;
      font-size: 0.9375rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
      text-align: center;
      opacity: 0;
      transform: translateY(20px) scale(0.95);
      animation: projectsFilterReveal 0.6s ease-out forwards;
    }

    /* Adjust button for sidebar mode */
    .projects-filters.is-sidebar .projects-filter-btn {
      flex-direction: row;
      justify-content: flex-start;
      gap: 0.875rem;
      padding: 0.875rem 1rem;
      text-align: left;
      font-size: 0.875rem;
      width: 100%;
      min-height: 56px;
      background: #ffffff;
      border-color: rgba(26, 67, 191, 0.14);
      color: #1f2b4a;
      box-shadow: 0 8px 18px rgba(15, 27, 61, 0.06);
      /* Ensure buttons are clickable */
      pointer-events: auto;
      touch-action: manipulation;
      -webkit-tap-highlight-color: rgba(26, 67, 191, 0.2);
      position: relative;
      z-index: 1;
    }

    .projects-filter-btn:nth-child(1) { animation-delay: 0.1s; }
    .projects-filter-btn:nth-child(2) { animation-delay: 0.15s; }
    .projects-filter-btn:nth-child(3) { animation-delay: 0.2s; }
    .projects-filter-btn:nth-child(4) { animation-delay: 0.25s; }
    .projects-filter-btn:nth-child(5) { animation-delay: 0.3s; }
    .projects-filter-btn:nth-child(6) { animation-delay: 0.35s; }
    .projects-filter-btn:nth-child(7) { animation-delay: 0.4s; }
    .projects-filter-btn:nth-child(8) { animation-delay: 0.45s; }
    .projects-filter-btn:nth-child(9) { animation-delay: 0.5s; }
    .projects-filter-btn:nth-child(10) { animation-delay: 0.55s; }
    .projects-filter-btn:nth-child(11) { animation-delay: 0.6s; }

    .projects-filter-btn::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(26, 67, 191, 0.12) 0%, rgba(26, 67, 191, 0.06) 100%);
      opacity: 0;
      transition: opacity 0.4s ease;
    }

    .projects-filter-btn::after {
      content: '';
      position: absolute;
      inset: -2px;
      background: linear-gradient(135deg, rgba(26, 67, 191, 0.25), rgba(26, 67, 191, 0.12));
      border-radius: 20px;
      z-index: -1;
      opacity: 0;
      filter: blur(15px);
      transition: opacity 0.4s ease;
    }

    .projects-filter-btn:hover {
      border-color: var(--brand-blue)!important;
      color: var(--brand-blue)!important;
      transform: translateY(-8px) scale(1.02);
      box-shadow:
        0 10px 26px rgba(26, 67, 191, 0.18),
        0 0 0 1px rgba(26, 67, 191, 0.18);
      background: rgba(26, 67, 191, 0.08);
    }

    .projects-filter-btn:hover::before {
      opacity: 1;
    }

    .projects-filter-btn:hover::after {
      opacity: 0.6;
    }

    .projects-filter-btn.is-active {
      background: linear-gradient(135deg, rgba(26, 67, 191, 0.18) 0%, rgba(26, 67, 191, 0.08) 100%);
      border-color: rgba(26, 67, 191, 0.5);
      color: #14317a;
      box-shadow:
        0 10px 30px rgba(26, 67, 191, 0.2),
        0 0 0 1px rgba(26, 67, 191, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
      transform: translateY(-4px) scale(1.01);
    }

    .projects-filter-btn.is-active::before {
      opacity: 1;
    }

    .projects-filter-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 48px;
      height: 48px;
      border-radius: 12px;
      background: rgba(26, 67, 191, 0.1);
      border: 1px solid rgba(26, 67, 191, 0.2);
      transition: all 0.4s ease;
      position: relative;
      z-index: 1;
      flex-shrink: 0;
    }

    /* Adjust icon for sidebar mode */
    .projects-filters.is-sidebar .projects-filter-icon {
      width: 40px;
      height: 40px;
    }

    .projects-filter-btn:hover .projects-filter-icon {
      background: rgba(26, 67, 191, 0.18);
      border-color: rgba(26, 67, 191, 0.4);
      transform: scale(1.1) rotate(5deg);
    }

    .projects-filter-btn.is-active .projects-filter-icon {
      background: linear-gradient(135deg, rgba(26, 67, 191, 0.25), rgba(26, 67, 191, 0.12));
      border-color: rgba(26, 67, 191, 0.45);
      box-shadow: 0 4px 12px rgba(26, 67, 191, 0.25);
    }

    .projects-filter-icon svg {
      width: 24px;
      height: 24px;
      stroke: currentColor;
      transition: transform 0.3s ease;
    }

    .projects-filter-btn:hover .projects-filter-icon svg {
      transform: scale(1.1);
    }

    .projects-filter-text {
      position: relative;
      z-index: 1;
      line-height: 1.4;
    }

    @keyframes projectsReveal {
      from {
        opacity: 0;
        transform: translateY(30px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes projectsFilterReveal {
      from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    /* ============================================
       PROJECTS GRID
       ============================================ */

  .projects-grid-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: clamp(4rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem);
    padding-top: 0;
    background: var(--bg);
    min-height: 100vh;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
                position 0s linear 0.8s;
    opacity: 0;
    visibility: hidden;
    transform: translateY(50px) scale(0.98);
    will-change: opacity, transform;
    z-index: 15;
  }

  .projects-grid-section.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    position: relative;
    padding-top: clamp(4rem, 8vw, 6rem);
    padding-bottom: clamp(8rem, 12vw, 10rem);
    margin-bottom: clamp(3rem, 6vw, 5rem);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s,
                visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
  }

  .projects-grid-section::after {
    content: '';
    display: block;
    height: clamp(4rem, 8vw, 6rem);
  }

    .projects-grid-container {
      max-width: var(--maxw);
      margin: 0 auto;
    }

    /* ============================================
       PROJECTS GRID HEADER
       ============================================ */

  /* ID-based selector for maximum specificity - prevents overrides */
  #projects-grid-header {
    text-align: center;
    margin-bottom: clamp(2.5rem, 5vw, 4rem);
    padding-bottom: clamp(1.5rem, 3vw, 2rem);
    border-bottom: 1px solid rgba(255, 121, 24, 0.2);
    animation: projectsFadeInUp 0.6s ease-out 0.3s both;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    position: relative;
    z-index: 1;
  }

  /* Class-based fallback for compatibility */
  .projects-grid-header {
    text-align: center;
    margin-bottom: clamp(2.5rem, 5vw, 4rem);
    padding-bottom: clamp(1.5rem, 3vw, 2rem);
    border-bottom: 1px solid rgba(255, 121, 24, 0.2);
    animation: projectsFadeInUp 0.6s ease-out 0.3s both;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    position: relative;
    z-index: 1;
  }

    /* Hide header initially when grid section is not active */
    .projects-grid-section:not(.is-visible):not(.is-active) #projects-grid-header,
    .projects-grid-section:not(.is-visible):not(.is-active) .projects-grid-header {
      display: none !important;
      opacity: 0 !important;
      visibility: hidden !important;
    }

    /* Show header when grid section is visible and active - ID-based with highest priority */
    /* Multiple selectors to ensure it shows in all cases */
    .projects-grid-section.is-visible #projects-grid-header,
    .projects-grid-section.is-active #projects-grid-header,
    .projects-grid-section.is-visible.is-active #projects-grid-header,
    .projects-grid-section[style*="display: block"] #projects-grid-header,
    #projects-grid-header.is-visible,
    .projects-grid-container:has(.projects-grid-section.is-visible) #projects-grid-header,
    .projects-grid-container:has(.projects-grid-section.is-active) #projects-grid-header {
      display: block !important;
      opacity: 1 !important;
      visibility: visible !important;
      position: relative !important;
      z-index: 1 !important;
    }

    /* Class-based fallback */
    .projects-grid-section.is-visible .projects-grid-header,
    .projects-grid-section.is-active .projects-grid-header,
    .projects-grid-section.is-visible.is-active .projects-grid-header,
    .projects-grid-section[style*="display: block"] .projects-grid-header,
    .projects-grid-header.is-visible,
    .projects-grid-container:has(.projects-grid-section.is-visible) .projects-grid-header,
    .projects-grid-container:has(.projects-grid-section.is-active) .projects-grid-header {
      display: block !important;
      opacity: 1 !important;
      visibility: visible !important;
      position: relative !important;
      z-index: 1 !important;
    }

    /* ID-based selector for title - maximum specificity */
    /* Using dark blue color for visibility on red/light backgrounds */
    #projects-grid-title {
      font-size: clamp(2rem, 4vw, 3rem) !important;
      font-weight: 900 !important;
      color: var(--dark-soft) !important;
      margin: 0 0 0.75rem !important;
      letter-spacing: -0.02em !important;
      display: block !important;
      visibility: visible !important;
      opacity: 1 !important;
      /* Remove gradient text technique - use solid dark color for reliability */
      background: none !important;
      -webkit-background-clip: unset !important;
      -webkit-text-fill-color: var(--dark-soft) !important;
      background-clip: unset !important;
    }

    .projects-grid-title {
      font-size: clamp(2rem, 4vw, 3rem);
      font-weight: 900;
      color: var(--dark-soft);
      margin: 0 0 0.75rem;
      letter-spacing: -0.02em;
      /* Use solid dark blue color instead of white for better visibility on red/light backgrounds */
      background: none;
      -webkit-background-clip: unset;
      -webkit-text-fill-color: var(--dark-soft);
      background-clip: unset;
    }

    /* ID-based selector for subtitle - maximum specificity */
    /* Using dark color to match title and work on red/light backgrounds */
    #projects-grid-subtitle {
      font-size: clamp(1rem, 1.5vw, 1.125rem) !important;
      color: rgba(15, 23, 42, 0.8) !important;
      margin: 0 !important;
      font-weight: 300 !important;
      display: block !important;
      visibility: visible !important;
      opacity: 1 !important;
    }

    .projects-grid-subtitle {
      font-size: clamp(1rem, 1.5vw, 1.125rem);
      color: rgba(15, 23, 42, 0.8);
      margin: 0;
      font-weight: 300;
    }

  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2rem;
    list-style: none;
    padding: 0 0 clamp(6rem, 10vw, 8rem) 0;
    margin: 0 0 clamp(2rem, 4vw, 3rem) 0;
  }

  .projects-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  }

    .projects-item[data-animate].is-visible {
      opacity: 1;
      transform: translateY(0);
    }

    .projects-item.hidden {
      display: none;
    }

    .projects-item-inner {
      background: var(--card);
      border-radius: var(--radius-lg);
      overflow: hidden;
      border: 1px solid var(--stroke);
      transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      height: 100%;
      display: flex;
      flex-direction: column;
      box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    }

    .projects-item-inner:hover {
      transform: translateY(-8px);
      box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
      border-color: var(--brand-2);
    }

    .projects-item-media {
      position: relative;
      width: 100%;
      padding-top: 75%; /* 4:3 aspect ratio */
      overflow: hidden;
      background: var(--dark-light);
      /* Note: Using dark-light for filter section background */
      cursor: pointer;
    }

    .projects-item-media img {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
      cursor: pointer;
    }

    .projects-item-inner:hover .projects-item-media img {
      transform: scale(1.1);
    }

    .projects-item-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(2, 6, 23, 0.3) 50%,
        rgba(2, 6, 23, 0.95) 100%
      );
      opacity: 0;
      transition: opacity 0.4s ease;
      display: flex;
      align-items: flex-end;
      padding: 2rem;
      z-index: 2;
    }

    .projects-item-inner:hover .projects-item-overlay {
      opacity: 1;
    }

    .projects-item-content {
      width: 100%;
      transform: translateY(20px);
      transition: transform 0.4s ease;
    }

    .projects-item-inner:hover .projects-item-content {
      transform: translateY(0);
    }

    .projects-item-category {
      display: inline-block;
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--brand-2);
      margin-bottom: 0.75rem;
      padding: 0.375rem 0.875rem;
      background: rgba(255, 121, 24, 0.15);
      border-radius: 50px;
    }

    .projects-item-title {
      font-size: clamp(1.25rem, 2vw, 1.5rem);
      font-weight: 800;
      color: var(--text-white);
      margin: 0 0 0.75rem;
      line-height: 1.3;
    }

    .projects-item-description {
      font-size: 0.9375rem;
      color: rgba(255, 255, 255, 0.9);
      line-height: 1.6;
      margin: 0 0 1.25rem;
    }

    .projects-item-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.75rem 1.5rem;
      background: var(--gradient-orange);
      color: var(--text-white);
      border: none;
      border-radius: 50px;
      font-size: 0.9375rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 4px 16px rgba(255, 121, 24, 0.3);
      position: relative;
      overflow: hidden;
    }

    .projects-item-btn::before {
      content: '';
      position: absolute;
      inset: 0;
      background: var(--gradient-orange-reverse);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .projects-item-btn:hover {
      transform: translateX(4px);
      box-shadow: 0 6px 24px rgba(255, 121, 24, 0.4);
      color: var(--bg);
    }

    .projects-item-btn:hover::before {
      opacity: 1;
    }

    .projects-item-btn span,
    .projects-item-btn svg {
      position: relative;
      z-index: 1;
      transition: transform 0.3s ease;
    }

    .projects-item-btn:hover svg {
      transform: translateX(4px);
    }

    .projects-item-btn:active {
      transform: translateX(2px) scale(0.98);
    }

    .projects-item-footer {
      padding: 1.25rem 1.5rem;
      border-top: 1px solid var(--stroke);
      background: var(--bg);
    }

    .projects-item-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.875rem;
      color: var(--muted);
    }

    .projects-item-location,
    .projects-item-year {
      font-weight: 500;
    }

    /* ============================================
       EMPTY STATE
       ============================================ */

    .projects-empty {
      display: none;
      text-align: center;
      padding: 4rem 2rem;
      grid-column: 1 / -1;
    }

    .projects-empty.is-visible {
      display: block;
    }

    .projects-empty-text {
      font-size: 1.125rem;
      color: var(--muted);
      margin: 0;
    }

    /* ============================================
       LOAD MORE
       ============================================ */

    .projects-load-more {
      margin-top: 3rem;
      text-align: center;
    }

    .projects-load-more-btn {
      padding: 1rem 2.5rem;
      background: var(--bg);
      border: 2px solid var(--brand-2);
      color: var(--brand-2);
      border-radius: 50px;
      font-size: 1rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .projects-load-more-btn:hover {
      background: var(--brand-2);
      color: var(--text-white);
      transform: translateY(-2px);
      box-shadow: 0 6px 24px rgba(255, 121, 24, 0.3);
    }

    /* ============================================
       PROJECT IMAGE MODAL
       ============================================ */

  .projects-image-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: clamp(1rem, 3vw, 2rem);
    pointer-events: none;
  }

  .projects-image-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .projects-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(12px);
    cursor: pointer;
  }

  .projects-modal-content {
    position: relative;
    width: 100%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
  }

  .projects-image-modal[aria-hidden="false"] .projects-modal-content {
    transform: scale(1) translateY(0);
  }

  .projects-modal-close {
    position: absolute;
    top: clamp(1rem, 2vw, 1.5rem);
    right: clamp(1rem, 2vw, 1.5rem);
    width: clamp(44px, 4vw, 48px);
    height: clamp(44px, 4vw, 48px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
  }

  .projects-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
  }

  .projects-modal-close:active {
    transform: rotate(90deg) scale(0.95);
  }

  .projects-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(48px, 5vw, 56px);
    height: clamp(48px, 5vw, 56px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
  }

  .projects-modal-prev {
    left: clamp(1rem, 3vw, 2rem);
  }

  .projects-modal-next {
    right: clamp(1rem, 3vw, 2rem);
  }

  .projects-modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
  }

  .projects-modal-nav:active {
    transform: translateY(-50%) scale(0.95);
  }

  .projects-modal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
  }

  .projects-modal-image-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }

  .projects-modal-image {
    width: 100%;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .projects-modal-image.loaded {
    opacity: 1;
  }

  .projects-modal-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }

  .projects-modal-loader.hidden {
    opacity: 0;
    pointer-events: none;
  }

  .projects-modal-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--text-white);
    border-radius: 50%;
    animation: projectsModalSpinner 0.8s linear infinite;
  }

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

  .projects-modal-info {
    margin-top: clamp(1.5rem, 3vw, 2rem);
    text-align: center;
    color: var(--text-white);
  }

  .projects-modal-counter {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
    letter-spacing: 0.05em;
  }

  .projects-modal-title {
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 700;
    color: var(--text-white);
    margin: 0;
    line-height: 1.3;
  }

  /* Modal animations */
  @keyframes projectsModalFadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes projectsModalSlideUp {
    from {
      transform: scale(0.9) translateY(20px);
    }
    to {
      transform: scale(1) translateY(0);
    }
  }

  .projects-image-modal[aria-hidden="false"] .projects-modal-content {
    animation: projectsModalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Touch/swipe indicators for mobile */
  @media (max-width: 968px) {
    .projects-modal-nav {
      width: 44px;
      height: 44px;
    }

    .projects-modal-prev {
      left: 0.75rem;
    }

    .projects-modal-next {
      right: 0.75rem;
    }

    .projects-modal-close {
      top: 0.75rem;
      right: 0.75rem;
      width: 40px;
      height: 40px;
    }

    .projects-modal-image-wrapper {
      max-height: 75vh;
    }

    .projects-modal-image {
      max-height: 75vh;
    }
  }

  /* Keyboard navigation hint */
  .projects-modal-content:focus {
    outline: none;
  }

    /* ============================================
       ANIMATIONS
       ============================================ */

    @keyframes projectsFadeInUp {
      from {
        opacity: 0;
        transform: translateY(30px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* ============================================
       ACCESSIBILITY
       ============================================ */

    @media (prefers-reduced-motion: reduce) {
      .projects-item,
      .projects-item-inner,
      .projects-item-media img,
      .projects-item-overlay,
      .projects-item-content,
      .projects-filter-btn,
      .projects-item-btn,
      .projects-image-modal,
      .projects-modal-content,
      .projects-modal-image {
        transition: none !important;
        animation: none !important;
      }

      .projects-item {
        opacity: 1;
        transform: none;
      }

      .projects-image-modal[aria-hidden="false"] .projects-modal-content {
        transform: scale(1) translateY(0) !important;
      }
    }

    .projects-filter-btn:focus,
    .projects-item-btn:focus,
    .projects-modal-close:focus,
    .projects-modal-nav:focus {
      outline: 3px solid rgba(26, 67, 191, 0.45);
      outline-offset: 4px;
    }

    /* ============================================
       RESPONSIVE STYLES
       ============================================ */

    @media (max-width: 968px) {
      /* Sidebar becomes overlay on mobile/tablet */
      .projects-filters.is-sidebar {
        width: 100%;
        max-width: 320px;
        top: var(--projects-header-offset) !important;
        height: calc(100vh - var(--projects-header-offset)) !important;
        max-height: calc(100vh - var(--projects-header-offset)) !important;
        transform: translateX(0);
        box-shadow: 8px 0 28px rgba(26, 67, 191, 0.18);
        /*background: #f7f9ff !important;*/
        /* Ensure sidebar is visible and interactive */
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 26 !important;
        position: fixed !important;
      }

      .projects-filters.is-sidebar.is-visible {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 26 !important;
      }

      .projects-filters.is-sidebar.is-hidden {
        transform: translateX(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        /* Keep interactive when hidden so it can be shown again */
        pointer-events: none !important;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease !important;
      }

      /* When visible and not hidden, show with full opacity */
      .projects-filters.is-sidebar.is-visible:not(.is-hidden) {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: #f7f9ff !important;
        pointer-events: auto !important;
      }

      /* Ensure buttons are always clickable and visible */
      .projects-filters.is-sidebar .projects-filter-btn {
        pointer-events: auto !important;
        opacity: 1 !important;
        cursor: pointer !important;
        background: #ffffff !important;
        color: #1f2b4a !important;
        border-color: rgba(26, 67, 191, 0.16) !important;
        position: relative !important;
        z-index: 27 !important;
        -webkit-tap-highlight-color: rgba(26, 67, 191, 0.25) !important;
      }

      .projects-filters.is-sidebar .projects-filter-btn:hover,
      .projects-filters.is-sidebar .projects-filter-btn:active,
      .projects-filters.is-sidebar .projects-filter-btn:focus {
        background: rgba(26, 67, 191, 0.12) !important;
        color: #14317a !important;
        outline: 2px solid rgba(26, 67, 191, 0.45) !important;
        outline-offset: 2px !important;
      }

      .projects-filters.is-sidebar .projects-filter-btn.is-active {
        background: linear-gradient(135deg, rgba(26, 67, 191, 0.2) 0%, rgba(26, 67, 191, 0.1) 100%) !important;
        border-color: rgba(26, 67, 191, 0.55) !important;
        color: #14317a !important;
      }

      /* Ensure filter grid is clickable */
      .projects-filters.is-sidebar .projects-filters-grid {
        pointer-events: auto !important;
        position: relative;
        z-index: 27 !important;
      }

      /* Ensure filter inner container is clickable */
      .projects-filters.is-sidebar .projects-filters-inner {
        pointer-events: auto !important;
        position: relative;
        z-index: 27 !important;
      }

    /* Grid takes full width on mobile */
    .projects-grid-section.is-visible.is-active {
      left: 0;
      padding-left: clamp(1.5rem, 3vw, 2rem);
      padding-right: clamp(1.5rem, 3vw, 2rem);
      padding-top: clamp(2.5rem, 5vw, 3.5rem);
      padding-bottom: clamp(6rem, 10vw, 8rem);
      margin-bottom: clamp(4rem, 8vw, 6rem);
    }

    /* Grid header adjustments for tablet - ID-based */
    #projects-grid-header {
      margin-bottom: clamp(2rem, 4vw, 2.5rem) !important;
      padding-bottom: clamp(1.25rem, 2.5vw, 1.75rem) !important;
      display: block !important;
      opacity: 1 !important;
      visibility: visible !important;
    }

    .projects-grid-header {
      margin-bottom: clamp(2rem, 4vw, 2.5rem);
      padding-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
    }

    /* Ensure grid has bottom spacing on tablet */
    .projects-grid {
      padding-bottom: clamp(3rem, 6vw, 5rem) !important;
      margin-bottom: clamp(2rem, 4vw, 3rem) !important;
    }

      .projects-grid-title {
        font-size: clamp(1.75rem, 4.5vw, 2.5rem);
      }

      .projects-grid-subtitle {
        font-size: clamp(0.9375rem, 2vw, 1.0625rem);
      }

      /* Add overlay backdrop for mobile sidebar */
      .projects-filters.is-sidebar::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        /*background: rgba(0, 0, 0, 0.5);*/
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 24;
        pointer-events: none;
      }

      .projects-filters.is-sidebar.is-visible::after {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
      }
    }

    @media (max-width: 640px) {
      /* Ensure filters are visible on mobile */
      .projects-filters {
        position: relative !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        min-height: auto !important;
      }

      /* Fullscreen filter nav adjustments - ensure all buttons are visible */
      .projects-filters.is-fullscreen {
        padding: clamp(2.5rem, 5vw, 3.5rem) 0 clamp(2rem, 4vw, 3rem);
        min-height: auto;
        display: block;
        overflow-y: visible;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        position: relative !important;
      }

      .projects-filters.is-fullscreen .projects-filters-inner {
        width: 100%;
        max-width: 100%;
        padding: 0 clamp(1rem, 3vw, 1.5rem) clamp(2rem, 4vw, 3rem);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        min-height: auto;
        height: auto;
        flex: none;
        /* Ensure inner container doesn't constrain grid */
        overflow: visible;
      }

      .projects-filters.is-fullscreen .projects-filters-header {
        margin-bottom: clamp(1.5rem, 3vw, 2rem);
        flex-shrink: 0;
        padding-top: clamp(1rem, 2vw, 1.5rem);
      }

      .projects-filters.is-fullscreen .projects-filters-grid {
        grid-template-columns: 1fr;
        gap: clamp(0.75rem, 1.5vw, 1rem);
        padding: 0;
        width: 100%;
        max-width: 100%;
        flex: none;
        display: grid;
        align-content: start;
        overflow-y: visible;
        overflow-x: hidden;
        margin-bottom: clamp(1.5rem, 3vw, 2rem);
        /* Ensure all buttons are visible - no height constraints */
        min-height: auto;
        height: auto;
        max-height: none;
        /* Allow grid to grow naturally */
        grid-auto-rows: auto;
        /* Force all buttons to be visible */
        visibility: visible;
        opacity: 1;
      }

      /* Ensure ALL filter buttons are visible in fullscreen mode */
      .projects-filters.is-fullscreen .projects-filter-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1 !important;
      }

      .projects-filters.is-fullscreen .projects-filter-btn {
        padding: clamp(1.125rem, 2.5vw, 1.375rem) clamp(1rem, 2.5vw, 1.25rem);
        font-size: clamp(0.875rem, 2vw, 0.9375rem);
        min-height: 56px;
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: clamp(0.75rem, 2vw, 1rem);
      }

      .projects-filters.is-fullscreen .projects-filter-icon {
        width: clamp(40px, 5vw, 44px);
        height: clamp(40px, 5vw, 44px);
        flex-shrink: 0;
      }

      .projects-filters.is-fullscreen .projects-filter-icon svg {
        width: clamp(20px, 2.5vw, 22px);
        height: clamp(20px, 2.5vw, 22px);
      }

      .projects-filters.is-fullscreen .projects-filter-text {
        font-size: clamp(0.875rem, 2vw, 0.9375rem);
        line-height: 1.4;
        text-align: left;
      }

      /* Sidebar adjustments */
      .projects-filters.is-sidebar {
        max-width: 280px;
        top: var(--projects-header-offset) !important;
        height: calc(100vh - var(--projects-header-offset)) !important;
        max-height: calc(100vh - var(--projects-header-offset)) !important;
        padding-bottom: clamp(1.5rem, 3vw, 2rem);
      background: #f7f9ff !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
      }

      .projects-filters.is-sidebar .projects-filters-inner {
        padding-bottom: 1rem;
      }

      .projects-filters.is-sidebar .projects-filters-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
        flex-shrink: 0;
      }

      .projects-filters.is-sidebar .projects-filters-title {
        font-size: 1.125rem;
      color: #1f2b4a !important;
      background: none !important;
      -webkit-text-fill-color: #1f2b4a !important;
      }

      .projects-filters.is-sidebar .projects-filters-subtitle {
        font-size: 0.75rem;
      color: #52627e !important;
      }

      .projects-filters.is-sidebar .projects-filters-grid {
        gap: 0.75rem;
        padding-bottom: 2rem;
        /* Ensure all buttons are visible and clickable */
        min-height: auto;
        max-height: none;
      }

      .projects-filters.is-sidebar .projects-filter-btn {
        padding: 0.875rem 0.75rem;
        font-size: 0.8125rem;
        min-height: 52px;
        /* Ensure proper touch targets and visibility */
        touch-action: manipulation;
      -webkit-tap-highlight-color: rgba(26, 67, 191, 0.2);
        pointer-events: auto !important;
        opacity: 1 !important;
        cursor: pointer !important;
      background: #ffffff !important;
      color: #1f2b4a !important;
      border-color: rgba(26, 67, 191, 0.16) !important;
      }

      .projects-filters.is-sidebar .projects-filter-btn:hover {
      background: rgba(26, 67, 191, 0.12) !important;
      color: #14317a !important;
      }

      .projects-filters.is-sidebar .projects-filter-btn.is-active {
      background: linear-gradient(135deg, rgba(26, 67, 191, 0.2) 0%, rgba(26, 67, 191, 0.1) 100%) !important;
      border-color: rgba(26, 67, 191, 0.55) !important;
      color: #14317a !important;
      }

      /* ============================================
         PROJECTS GRID SECTION - MOBILE HEIGHT FIX
         ============================================ */

      /* Completely override desktop height and positioning on mobile - specific selector */
      .projects-page .projects-grid-section {
        /* Remove ALL height constraints from desktop */
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
        /* Remove absolute positioning - force normal flow */
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        /* Remove transforms that might affect layout */
        transform: none !important;
      }

    /* Override all visible/active states - specific selector to avoid conflicts */
    .projects-page .projects-grid-section.is-visible,
    .projects-page .projects-grid-section.is-active,
    .projects-page .projects-grid-section.is-visible.is-active {
      /* Remove ALL height constraints */
      min-height: auto !important;
      height: auto !important;
      max-height: none !important;
      /* Force normal positioning */
      position: relative !important;
      top: auto !important;
      left: auto !important;
      right: auto !important;
      bottom: auto !important;
      /* STANDARDIZED: Consistent bottom spacing to prevent footer overlap */
      padding-top: clamp(2rem, 4vw, 3rem) !important;
      padding-left: clamp(1rem, 2vw, 1.5rem) !important;
      padding-right: clamp(1rem, 2vw, 1.5rem) !important;
      padding-bottom: clamp(4rem, 8vw, 5.5rem) !important;
      margin-bottom: 0 !important;
      /* Ensure content stays within section - prevent overlap */
      overflow: visible !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
      /* Critical: Lower z-index to ensure footer stays on top */
      z-index: 1 !important;
      /* Remove transforms */
      transform: none !important;
    }

      /* Projects grid container spacing - specific selector */
      .projects-page .projects-grid-container {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
        position: relative !important;
        overflow: visible !important;
        /* Lower z-index to ensure footer stays on top */
        z-index: 1 !important;
      }

    /* Grid header adjustments - ID-based for mobile */
    .projects-page #projects-grid-header {
      margin-bottom: clamp(1.5rem, 3vw, 2rem) !important;
      padding-bottom: clamp(1rem, 2vw, 1.5rem) !important;
      display: block !important;
      opacity: 1 !important;
      visibility: visible !important;
    }

    .projects-page .projects-grid-header {
      margin-bottom: clamp(1.5rem, 3vw, 2rem) !important;
      padding-bottom: clamp(1rem, 2vw, 1.5rem) !important;
    }

    /* Projects grid - STANDARDIZED: spacing handled by section and last item */
    .projects-page .projects-grid {
      padding-bottom: clamp(4rem, 8vw, 6rem) !important;
      margin-bottom: 0 !important;
      /* Ensure grid content stays within container */
      position: relative !important;
      overflow: visible !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
      /* Lower z-index to ensure footer stays on top */
      z-index: 1 !important;
    }

    /* Ensure project items don't overlap footer */
    .projects-page .projects-item {
      position: relative !important;
      z-index: 1 !important;
      margin-bottom: 1.25rem !important;
    }

    /* STANDARDIZED: Last project item - consistent spacing for ALL services and breakpoints */
    .projects-page .projects-item:last-child,
    .projects-page .projects-grid .projects-item:last-child,
    .projects-page .projects-grid-section .projects-item:last-child {
      margin-bottom: clamp(2.5rem, 5vw, 3.5rem) !important;
      padding-bottom: 0 !important;
    }

      /* Override reveal container and page wrapper heights */
      .projects-reveal-container {
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
      }

      .projects-page {
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
      }

      .projects-grid-title {
        font-size: clamp(1.5rem, 4vw, 2rem);
      }

      .projects-grid-subtitle {
        font-size: clamp(0.875rem, 2vw, 1rem);
      }
    }
