/* ====================================================
   Global Variables & Container
   ==================================================== */
:root {
  --card-border-radius: 1rem;
  --card-padding: 1.5rem;
  --grid-gap: 1.5rem;
  --transition-speed: 0.3s;
  --hover-lift: -5px;
  --content-max-width: 1200px;
  --sidebar-width: 280px;
}

#main {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.main-content {
  width: 90%;
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* ====================================================
     Content Layout - Single Column Cards
     ==================================================== */
#main .view-content,
#main .view-content.row {
  display: grid;
  grid-template-columns: 1fr;
  /* One card per row */
  gap: var(--grid-gap);
  padding: 2rem 0;
}

/* All cards have consistent styling */
#main .view-content>* {
  grid-column: span 1;
}

/* ====================================================
     Card Styling - Expanded for Better Content Visibility
     ==================================================== */
article.node--view-mode-teaser,
article.project-item {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--card-padding);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--card-border-radius);
  background-color: var(--on-surface, #1b1f26);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease,
    border-color var(--transition-speed) ease;
  overflow: hidden;
  cursor: pointer;
  /* Indicate clickable */
}

/* Make entire card clickable */
article.node--view-mode-teaser a.card-link,
article.project-item a.card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  text-indent: -9999px;
  overflow: hidden;
}

/* Ensure other links still work */
article.node--view-mode-teaser .content a,
article.node--view-mode-teaser .field--name-field-module-tags a article.project-item .content a,
article.project-item .field--name-field-module-tags a {
  position: relative;
  z-index: 2;
}

/* Card content structure - horizontal layout for single column */
article.node--view-mode-teaser .content,
article.project-item .content {
  display: grid;
  grid-template-columns: 1fr 2fr;
  /* Image takes 1/3, content takes 2/3 */
  gap: 1.5rem;
  align-items: start;
}

/* Image positioning for horizontal layout */
article.node--view-mode-teaser .field--name-field-image,
article.project-item .field--name-field-image {
  grid-column: 1;
  height: 100%;
  min-height: 180px;
  max-height: 220px;
  border-radius: 0.5rem;
  overflow: hidden;
}

article.node--view-mode-teaser .field--name-field-image img,
article.project-item .field--name-field-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-speed) ease;
}

/* Text content positioning */
article.node--view-mode-teaser .text-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Card hover effects */
article.node--view-mode-teaser:hover,
article.project-item:hover {
  transform: translateY(var(--hover-lift));
  border-color: var(--primary, #3498db);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

article.node--view-mode-teaser:hover .field--name-field-image img,
article.project-item:hover .field--name-field-image img {
  transform: scale(1.05);
}

/* Arrow indicator */
article.node--view-mode-teaser::after,
article.project-item::after {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 24px;
  height: 24px;
  content: "";
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="7" y1="12" x2="17" y2="12"/><polyline points="12 7 17 12 12 17"/></svg>');
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.7;
  transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease;
  z-index: 0;
}

article.node--view-mode-teaser:hover::after,
article.project-item:hover::after {
  transform: translateX(6px);
  opacity: 1;
}

/* Card title styling */
article.node--view-mode-teaser h2,
article.node--view-mode-teaser h3,
article.project-item h2,
article.project-item h3 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin-top: 0;
  margin-bottom: 0.5rem;
  transition: color var(--transition-speed) ease;
}

article.node--view-mode-teaser:hover h2,
article.node--view-mode-teaser:hover h3,
article.project-item:hover h2,
article.project-item:hover h3 {
  color: var(--primary, #3498db);
}

/* Card body text - increased visibility */
article.node--view-mode-teaser p,
article.project-item p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
  opacity: 0.9;
  /* Removed line clamping to show full content */
  font-size: 1rem;
}

/* ====================================================
     Tag Styling
     ==================================================== */
.field--name-field-module-tags,
.field--name-field-project-target {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.project-actions {
  align-self: flex-end;
  margin-right: 3rem;
}

.field--name-field-module-tags .field__item,
.field--name-field-project-target .field__item,
.field--name-field-module-tags .field__item,
.article-footer .field__item {
  color: var(--font-color-button, #dcdcdc);
  border-radius: 2rem;
  padding: 0.35rem 0.8rem;
  background-color: rgba(var(--primary-rgb, 52, 152, 219), 0.1);
  border: 1px solid var(--font-color-button, #dcdcdc);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all var(--transition-speed) ease;
  position: relative;
  z-index: 2;
  /* Ensure clickable above card link */
}

/* ====================================================
     Article Footer
     ==================================================== */
.article-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.article-footer.date {
  font-size: 0.875rem;
  opacity: 0.7;
  margin: 0;
}

/* ====================================================
     Filter Sidebar - Enhanced Sticky Behavior
     ==================================================== */
.view.view-blogs,
.view.view-projects,
.view.view-modules {
  display: flex;
  width: 100%;
  gap: 2rem;
  margin-bottom: 3rem;
}

.view.view-blogs .view-filters,
.view.view-projects .view-filters,
.view.view-modules .view-filters {
  width: var(--sidebar-width);
  max-height: fit-content;
  flex-shrink: 0;
  position: sticky;
  margin-top: 2rem;
  padding-top: 2rem;
  overflow-y: auto;
  padding: 1.5rem;
  border-radius: var(--card-border-radius);
  background-color: var(--on-surface, #1b1f26);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  /* Improve sticky behavior */
  will-change: transform;
  z-index: 10;
}

.view.view-blogs .view-content,
.view.view-projects .view-content,
.view.view-modules .view-content {
  width: calc(100% - var(--sidebar-width) - 2rem);
}

/* Filter title */
.view-filters h2,
.view-filters h3 {
  font-size: 1.25rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ====================================================
     Checkbox Styling with Fixed Animations
     ==================================================== */
.form-checkboxes.bef-checkboxes.bef-nested.form--inline ul {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
  margin: 0;
}

.form-checkboxes.bef-checkboxes.bef-nested.form--inline li {
  margin: 0;
}

.js-form-item.js-form-type-checkbox {
  position: relative;
}

.js-form-type-checkbox input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fixed checkbox label - no hover effects */
.js-form-type-checkbox label {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  padding-left: 1.2rem;
  padding-right: 1.2rem;
  border-radius: 2rem;
  background-color: transparent;
  color: var(--font-color-button, #dcdcdc);
  border: 1px solid var(--font-color-button, #dcdcdc);
  cursor: pointer;
  /* Each label has its own transition */
  transition: all var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Animated indicator */
.js-form-type-checkbox label::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border-radius: 50%;
  border: 1px solid var(--font-color-button, #dcdcdc);
  transition: all var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%23d9d9d9" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>');
}

/* Fixed checkbox checked state - only affects the clicked filter */
.js-form-type-checkbox input[type="checkbox"]:checked+label {
  background-color: var(--font-color-button, #dcdcdc);
  color: var(--on-surface, #2a2f36);
  padding-left: 1.2rem;
  padding-right: 1.2rem;
  transform: scale(1.1);
}

.js-form-type-checkbox input[type="checkbox"]:checked+label::before {
  background-color: var(--on-surface, #2a2f36);
  border-color: var(--on-surface, #2a2f36);
  background-size: 12px;
  transform: scale(1.2);
}

/* Focus state for accessibility */
.js-form-type-checkbox input[type="checkbox"]:focus+label {
  outline: 2px solid var(--primary, #3498db);
  outline-offset: 2px;
}


/* ====================================================
     Responsive Adjustments
     ==================================================== */
    @media (max-width: 1024px) {
      :root {
        --card-padding: 1.25rem;
        --grid-gap: 1rem;
        --sidebar-width: 100%;
      }
    
      .main-content {
        width: 95%;
      }
    
      /* Stack layout on mobile */
      .view.view-blogs,
      .view.view-projects,
      .view.view-modules {
        flex-direction: column;
        gap: 1.5rem;
      }
    
      .view.view-blogs .view-filters,
      .view.view-projects .view-filters,
      .view.view-modules .view-filters,
      .view.view-blogs .view-content,
      .view.view-projects .view-content,
      .view.view-modules .view-content {
        width: 100%;
      }
    
      .view.view-blogs .view-filters,
      .view.view-projects .view-filters,
      .view.view-modules .view-filters {
        position: relative;
        top: 0;
        max-height: none;
      }
    
      /* Card layout for mobile */
      article.node--view-mode-teaser .content,
      article.project-item .content {
        grid-template-columns: 1fr;
        /* Stack on mobile */
        gap: 1rem;
      }

      article.node--view-mode-teaser .field--name-field-image,
      article.project-item .field--name-field-image {
        grid-column: 1;
        grid-row: 1;
        min-height: 160px;
      }
    
      article.node--view-mode-teaser .text-content,
      article.project-item .text-content {
        grid-column: 1;
        grid-row: 2;
      }
    
      /* Horizontal scrolling filters on mobile */
      .form-checkboxes.bef-checkboxes.bef-nested.form--inline ul {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        li {
          label {
            margin-top: 0.4rem;
          }
        }
      }
      .form-checkboxes.bef-checkboxes {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
      }
      .form-checkboxes.bef-checkboxes .js-form-item {
        flex: 0 0 auto;
        margin-right: 1rem;
      }
      
      .js-form-type-checkbox label {
        margin-top: 0.4rem;
        white-space: nowrap;
      }
    
      article.node--view-mode-teaser:hover,
      article.project-item:hover {
        transform: translateY(-3px);
      }
    }
/* ====================================================
     Loading Animation
     ==================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#main .view-content>* {
  animation: fadeIn 0.5s ease forwards;
  opacity: 0;
}

#main .view-content>*:nth-child(1) {
  animation-delay: 0.1s;
}

#main .view-content>*:nth-child(2) {
  animation-delay: 0.15s;
}

#main .view-content>*:nth-child(3) {
  animation-delay: 0.2s;
}

#main .view-content>*:nth-child(4) {
  animation-delay: 0.25s;
}

#main .view-content>*:nth-child(5) {
  animation-delay: 0.3s;
}

#main .view-content>*:nth-child(6) {
  animation-delay: 0.35s;
}

#main .view-content>*:nth-child(n+7) {
  animation-delay: 0.4s;
}