/* XPROGENCY Styling */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=Inter:wght@400;500;600;700&family=Jost:wght@700;800&family=Poppins:wght@500;600&family=Space+Grotesk:wght@600;700;800&display=swap');

.xp-portfolio {
  --c-primary: #1FEFDC;
  --filter-active-bg: var(--c-primary);
  --filter-active-color: #0A0A0A;
  --bg: #08090A;
  --bg-elev: #101213;
  --bg-elev-2: #17191B;
  --border: #232628;
  --text-primary: #F4F6F5;
  --text-secondary: #9CA3A1;
  --text-muted: #5F6664;
  --radius: 16px;
  
  position: relative; display: block; background: var(--bg);
  font-family: 'Inter', sans-serif; color: var(--text-primary);
  padding: 80px 0; line-height: 1.6; overflow: hidden;
}

.xp-portfolio * { box-sizing: border-box; margin: 0; padding: 0; }

.xp-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

.xp-head-wrapper { 
  display: flex; align-items: stretch; gap: 20px; margin-bottom: 36px;
  padding: 16px;
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.xp-head-wrapper:hover .xp-anchor-icon {
  transform: translateY(-3px);
  border-color: var(--c-primary);
  box-shadow: 0 0 24px rgba(31, 239, 220, 0.4);
}

.xp-head-wrapper:hover .xp-anchor-icon svg {
  transform: scale(1.15);
}

.xp-head-wrapper:hover .xp-anchor-line {
  background: linear-gradient(180deg, rgba(31, 239, 220, 0.8) 0%, rgba(31, 239, 220, 0.05) 100%);
  box-shadow: 0 0 12px rgba(31, 239, 220, 0.5);
}


.xp-service-anchor { display: flex; flex-direction: column; align-items: center; }
.xp-anchor-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: var(--c-primary); font-size: 22px;
  transition: all 0.3s ease;
}
.xp-anchor-icon svg { width: 1em; height: 1em; fill: currentColor; transition: transform 0.3s ease; }
.xp-anchor-line { 
  flex: 1; width: 2px; margin-top: 10px; 
  background: linear-gradient(180deg, var(--c-primary) 0%, transparent 100%); 
  opacity: 0.5;
  transition: all 0.3s ease;
}

.xp-head { display: flex; flex-direction: column; justify-content: center; gap: 8px; flex: 1; }
.xp-heading { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(28px, 3.5vw, 38px); line-height: 1.2; color: #fff; }
.xp-heading span { color: var(--c-primary); }
.xp-head-desc { color: var(--text-secondary); font-size: 15px; max-width: 640px; }

.xp-filters-wrap { display: flex; margin-bottom: 36px; }
.xp-filters { display: inline-flex; gap: 8px; padding: 6px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.xp-filter-btn { border: 1px solid transparent; background: transparent; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary); padding: 9px 18px; border-radius: 9px; white-space: nowrap; transition: all .25s ease; outline: none; }
.xp-filter-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }
.xp-filter-btn.active { background: var(--filter-active-bg); color: var(--filter-active-color); border-color: var(--filter-active-bg); font-weight: 700; }
.xp-filter-btn.btn-identity-highlight { background: #fff !important; color: #000 !important; font-weight: 700; }

.xp-content { transition: opacity .2s ease; position: relative; }
.xp-fading { opacity: 0; }

/* Grid */
.xp-flat-grid { column-count: 4; column-gap: 18px; }
.xp-item { break-inside: avoid; margin-bottom: 18px; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--border); background: var(--bg-elev-2); cursor: pointer; transition: all .3s ease; opacity: 1; transform: translateY(0); }
.xp-item.item-hidden { display: none !important; }
.xp-item:hover { transform: translateY(-3px); border-color: var(--item-brand-color, var(--c-primary)); box-shadow: 0 10px 24px rgba(0,0,0,0.4); }
.xp-img-wrap { position: relative; width: 100%; overflow: hidden; }
.xp-item img { width: 100%; display: block; height: auto; transition: transform .5s ease; }
.xp-item:hover img { transform: scale(1.05); }

.xp-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; background: linear-gradient(180deg, transparent 40%, rgba(4,8,9,0.95) 100%); opacity: 0; transition: opacity .3s ease; }
.xp-item:hover .xp-overlay { opacity: 1; }
.xp-cat { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; color: var(--item-brand-color, var(--c-primary)); }
.xp-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13.5px; color: #fff; }
.xp-item-brand { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Load More */
.xp-load-more-container {
    display: flex; justify-content: center; align-items: center; width: 100%; margin: 10px auto 0 auto; position: relative; z-index: 10;
}

.grid-fade-overlay {
  background: linear-gradient(180deg, transparent 0%, #08090a 100%); 
  height: 120px; 
  margin-top: -100px; 
  pointer-events: none;
  width: 100%;
  position: absolute;
  bottom: 100%;
  left: 0;
}

.xp-load-more-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; background: rgba(31, 239, 220, 0.1); border: 1px solid var(--c-primary);
  color: var(--c-primary); font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px;
  border-radius: 8px; cursor: pointer; transition: all 0.3s ease;
}
.xp-load-more-btn:hover { background: var(--c-primary); color: #08090a; box-shadow: 0 0 15px rgba(31, 239, 220, 0.4); }

/* Brands Layout */
.brand-clusters-container { display: none; }
.brand-clusters-container.active { display: block; }
.xp-brand { position: relative; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); padding: 28px; margin-bottom: 24px; transition: all .3s; }
.xp-brand.brand-hidden { display: none !important; }

/* Dynamic Brand Colors applied via var(--brand-color) in JS */
.xp-brand:hover { transform: translateY(-3px); border-color: var(--brand-color); box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 0 20px var(--brand-glow-color, rgba(31, 239, 220, 0.25)); }
.xp-brand .xp-item:hover { transform: translateY(-3px); border-color: var(--brand-color) !important; box-shadow: 0 10px 24px var(--brand-glow-color, rgba(31, 239, 220, 0.3)) !important; }
.xp-brand .xp-cat { color: var(--brand-color); }

.xp-brand-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.xp-brand-id { display: flex; align-items: center; gap: 14px; }
.xp-brand-mark-wrap { position: relative; width: 48px; height: 48px; border-radius: 12px; background: var(--brand-bg, rgba(31, 239, 220, 0.1)); border: 1px solid var(--brand-color); overflow: hidden; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease;}
.xp-brand-mark-wrap:hover { transform: scale(1.08); box-shadow: 0 0 16px var(--brand-color); }
.xp-brand-mark-wrap img { width: 100%; height: 100%; object-fit: cover; }
.xp-brand-mark { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; color: var(--brand-color); }
.xp-brand-name { font-family: 'Jost', sans-serif; font-weight: 800; font-size: 19px; text-transform: uppercase; color: #fff; transition: color 0.3s ease; }
.xp-brand:hover .xp-brand-name { color: var(--brand-color); }
.xp-brand-meta { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }
.xp-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.xp-legend-tag { font-size: 10.5px; font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--border); background: var(--bg-elev-2); padding: 4px 10px; border-radius: 100px; }

/* Responsive Grid for Brand Clusters */
.xp-asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; width: 100%; }

/* Modal */
.xp-modal-backdrop { position: fixed; inset: 0; z-index: 99999; background: rgba(4,6,7,0.85); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.xp-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.xp-modal { max-width: 860px; width: 100%; max-height: 88vh; overflow: visible; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: 1fr 1fr; transform: translateY(20px); transition: transform .3s ease; }
.xp-modal-backdrop.open .xp-modal { transform: translateY(0); }
.xp-modal-img { border-radius: var(--radius) 0 0 var(--radius); overflow: hidden;}
.xp-modal-img img { width: 100%; height: 100%; object-fit: cover; min-height: 320px; display: block; }
.xp-modal-body { padding: 32px; position: relative; display: flex; flex-direction: column; justify-content: center;}
.xp-modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elev-2); color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.xp-modal-close:hover { border-color: var(--c-primary); color: var(--c-primary); transform: rotate(90deg); }
.xp-modal-brand { font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase; color: var(--c-primary); margin-bottom: 8px; }
.xp-modal-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; margin-bottom: 12px; color: #fff; }
.xp-modal-desc { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; margin-bottom: 20px; }
.xp-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 18px; border-top: 1px solid var(--border); }
.xp-modal-grid h5 { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.xp-modal-grid p { font-size: 12.5px; color: #fff; }

@media(max-width: 992px) { 
  .xp-flat-grid { column-count: 3; } 
}
@media(max-width: 768px) {
  .xp-portfolio { padding: 40px 0; }
  .xp-head-wrapper { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
  .xp-service-anchor { flex-direction: row; align-items: center; gap: 12px; width: 100%; }
  .xp-anchor-line { width: 100%; height: 2px; margin: 0; background: linear-gradient(90deg, var(--c-primary) 0%, transparent 100%); }
  .xp-filters { flex-wrap: wrap; width: 100%; }
  .xp-filter-btn { flex: 1 1 calc(33.333% - 6px); text-align: center; }
  .xp-flat-grid { column-count: 2; }
  .xp-modal { grid-template-columns: 1fr; overflow-y: auto;}
  .xp-modal-img { border-radius: var(--radius) var(--radius) 0 0;}
  .xp-legend { display: none; }
}
@media(max-width: 480px) {
  .xp-filter-btn { flex: 1 1 calc(50% - 6px); }
  .xp-flat-grid { column-count: 1; }
}