/* =================================================================
   CASE STUDY INDEX (LISTING PAGE ONLY)
   Contains: Grid Layout, Filtering, 2D/3D Cards.
   ================================================================= */

/* --- 1. PERFORMANCE OPTIMIZATION --- */
.ab-case-dossier {
  content-visibility: auto; 
  contain-intrinsic-size: 0 480px; 
}

/* --- 2. CORE LAYOUT --- */
.ab-main-container {
  display: flex;
  flex-direction: column;
  padding-top: 80px; 
  gap: 60px; 
}

.ab-service-hero { margin-bottom: 0 !important; padding-bottom: 40px; }
#motif-canvas { display: none; } 

.ab-dossier-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  margin-top: 0 !important;
  margin-bottom: 120px;
}

/* --- 3. FILTERING LOGIC --- */
.ab-case-dossier.is-hidden { display: none !important; }

.ab-dossier-grid.is-filtered .ab-dossier-featured { 
  grid-column: span 1; 
}
.ab-dossier-grid.is-filtered .ab-dossier-featured .ab-card-inner {
  flex-direction: column;
}
.ab-dossier-grid.is-filtered .ab-dossier-featured .ab-card-front,
.ab-dossier-grid.is-filtered .ab-dossier-featured .ab-card-back {
  width: 100%;
}
.ab-dossier-grid.is-filtered .ab-dossier-featured .ab-dossier-visual {
  border-right: none;
  border-bottom: 1px solid var(--ab-border-soft);
  height: 280px !important; 
}

/* --- 4. DESKTOP CARD --- */
.ab-case-dossier {
  background: transparent;
  display: flex;
  flex-direction: column;
  position: relative;
  contain: layout paint; 
  transition: transform 0.2s ease-out;
}
.ab-case-dossier:hover { transform: translateY(-4px); }

.ab-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  background: var(--ab-bg-elevated);
  border: 1px solid var(--ab-border-soft);
  flex-direction: column; 
  transition: border-color 0.1s linear;
  z-index: 1;
}

.ab-card-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); 
  opacity: 0; 
  transition: opacity 0.2s ease-out; 
  z-index: -1; 
  pointer-events: none;
}

.ab-case-dossier:hover .ab-card-inner::after { opacity: 1; }
.ab-case-dossier:hover .ab-card-inner { border-color: var(--ab-accent); }

.ab-dossier-featured { grid-column: span 2; }
.ab-dossier-featured .ab-card-inner { flex-direction: row; }
.ab-dossier-featured .ab-card-front,
.ab-dossier-featured .ab-card-back { width: 50%; }

/* --- 5. VISUALS --- */
.ab-dossier-visual { 
  width: 100%; height: 280px; 
  overflow: hidden; 
  border-bottom: 1px solid var(--ab-border-soft); 
  position: relative; 
  background: #000; 
}

.ab-dossier-featured .ab-dossier-visual { 
  width: 100%; height: 100%; 
  border-bottom: none; border-right: 1px solid var(--ab-border-soft); 
}

.ab-dossier-visual img { 
  width: 100%; height: 100%; object-fit: cover; 
  opacity: 0.5; 
  transform: translateZ(0);
  will-change: opacity;
  transition: opacity 0.2s ease-out; 
}

.ab-case-dossier:hover .ab-dossier-visual img { opacity: 1; }

/* --- 6. CONTENT --- */
.ab-dossier-content { padding: 40px; display: flex; flex-direction: column; flex: 1; z-index: 2; background: var(--ab-bg-elevated); }
.ab-case-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ab-case-index { font-family: "Plus Jakarta Sans", sans-serif; font-size: 11px; letter-spacing: 0.2em; font-weight: 700; color: var(--ab-accent); }
.ab-case-date { font-family: "Plus Jakarta Sans", sans-serif; font-size: 10px; font-weight: 700; color: var(--ab-text-subtle); letter-spacing: 0.05em; }
.ab-dossier-content h3 { font-size: 24px; text-transform: uppercase; color: #fff; margin-bottom: 16px; }
.ab-case-summary { font-size: 16px; color: #fff; margin-bottom: 24px; line-height: 1.5; }

/* --- NEW: STATS STYLES --- */
.ab-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.ab-stat-badge {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ab-accent);
  background: rgba(27, 138, 255, 0.1);
  padding: 6px 10px;
  border: 1px solid rgba(27, 138, 255, 0.2);
  border-radius: 2px;
}

.ab-technical-spec { background: rgba(255, 255, 255, 0.02); border-left: 1px solid rgba(27, 138, 255, 0.3); padding: 20px; margin-bottom: 32px; display: flex; flex-direction: column; gap: 16px; }
.ab-spec-item { font-size: 14px; line-height: 1.6; color: var(--ab-text-subtle); }
.ab-spec-item strong { color: #fff; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; display: block; margin-bottom: 4px; }

.ab-case-link { margin-top: auto; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.ab-link-icon { color: var(--ab-accent); font-size: 18px; transition: transform 0.3s ease; }
.ab-case-link:hover .ab-link-icon { transform: translateX(5px); }

.ab-mobile-front-content { display: none; }
.ab-mobile-hint { display: none; }
.ab-desktop-content-header { display: block; }
.ab-card-front, .ab-card-back { width: 100%; display: flex; flex-direction: column; } 

/* --- 7. CONTROLS --- */
.ab-dossier-controls { display: flex; justify-content: space-between; align-items: flex-start; padding: 32px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin: 0 !important; }
.ab-filter-wrapper { position: relative; width: 100%; }
.ab-filter-toggle { background: transparent; border: none; cursor: pointer; display: flex; align-items: center; gap: 12px; color: #fff; padding: 0; }
.ab-control-label { font-family: "Plus Jakarta Sans", sans-serif; font-size: 11px; color: var(--ab-text-subtle); text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; margin: 0; }
.ab-active-filter-label { font-family: "Plus Jakarta Sans", sans-serif; font-size: 11px; text-transform: uppercase; color: var(--ab-accent); letter-spacing: 0.1em; font-weight: 700; }
.ab-filter-icon { font-size: 16px; color: var(--ab-accent); transition: transform 0.3s ease; }
.ab-filter-toggle.is-active .ab-filter-icon { transform: rotate(45deg); }
.ab-filter-expandable { position: relative; top: 0; left: 0; width: 100%; max-height: 0; overflow: hidden; opacity: 0; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.ab-filter-expandable.is-open { max-height: 500px; opacity: 1; padding: 24px 0 24px 20px; margin-top: 10px; border-left: 1px solid rgba(255, 255, 255, 0.1); }
.ab-filter-buttons { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.ab-filter-btn { background: transparent; border: none; color: var(--ab-text-subtle); padding: 10px 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; cursor: pointer; text-align: left; border-left: 2px solid transparent; transition: all 0.2s ease; }
.ab-filter-btn.active { color: #fff; padding-left: 12px; border-left-color: var(--ab-accent); background: rgba(27, 138, 255, 0.05); }
.ab-filter-footer { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 16px; width: 240px; }
.ab-filter-apply-btn { width: 100%; background: var(--ab-accent); color: #000; border: none; padding: 10px; font-weight: 700; text-transform: uppercase; cursor: pointer; }
.ab-sort-group { display: flex; align-items: center; gap: 12px; }
.ab-sort-select { background: #000; border: 1px solid rgba(255, 255, 255, 0.1); color: #fff; padding: 10px 40px 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; -webkit-appearance: none; -moz-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; cursor: pointer; }

/* --- 8. MOBILE ENGINE --- */
@media (max-width: 1024px) {
  .ab-main-container { padding-top: 48px; gap: 48px; }
  .ab-dossier-grid { grid-template-columns: 1fr; gap: 32px; }
  .ab-dossier-featured { grid-column: auto; flex-direction: column; }
  .ab-case-dossier { height: 480px; cursor: pointer; perspective: 1200px; contain: none; }
  .ab-card-inner { flex-direction: column; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1); }
  .ab-card-inner::after { display: none; }
  .ab-dossier-grid.is-blurring .ab-case-dossier:not(.is-flipped) { filter: blur(8px); opacity: 0.3; }
  .ab-card-front, .ab-card-back { position: absolute; top: 0; left: 0; width: 100% !important; height: 100%; backface-visibility: hidden; }
  .ab-card-back { transform: rotateY(180deg) translateZ(1px); background: #080808; border: 1px solid var(--ab-accent); }
  .ab-case-dossier.is-flipped .ab-card-inner { transform: rotateY(180deg); }
  .ab-desktop-content-header { display: none; } 
  .ab-dossier-content { padding: 30px; z-index: auto; background: transparent; }
  .ab-card-front { background: #000; transform: translateZ(1px); }
  .ab-dossier-visual { width: 100%; height: 100%; border: none; position: absolute; top: 0; left: 0; z-index: 1; }
  .ab-dossier-visual::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 40%; background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 100%); z-index: 2; }
  .ab-dossier-visual::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 60%; background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 40%, transparent 100%); z-index: 2; }
  .ab-mobile-front-content { display: flex; flex-direction: column; justify-content: flex-end; position: relative; z-index: 3; height: 100%; padding: 30px; }
  .ab-mobile-front-content .ab-case-meta { position: absolute; top: 30px; left: 30px; right: 30px; margin-bottom: 0; z-index: 4; opacity: 1; }
  .ab-mobile-front-content h3 { font-size: 28px; line-height: 1.1; margin-bottom: 12px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
  .ab-mobile-hint { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; margin-top: 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ab-accent); padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.2); }
  .ab-back-hint { margin-top: auto; border-top-color: rgba(255,255,255,0.1); }
  .ab-dossier-controls { flex-direction: column; align-items: flex-start; gap: 24px; padding: 24px 0; }
  .ab-filter-toggle .ab-control-label, .ab-sort-group .ab-control-label { min-width: 130px; text-align: left; }
  .ab-filter-expandable.is-open { padding: 16px 0 0 20px; margin-top: 8px; margin-bottom: 0; }
  .ab-sort-group { width: 100%; justify-content: flex-start; gap: 16px; }
  .ab-sort-select { min-width: 160px; width: auto; }
}