/*
 * CASE STUDIES INDEX — SOVEREIGN INDUSTRIAL v2.2
 * Refined for Container Precision, Typographic Integrity, and High-Fidelity Modules.
 */

:root {
  /* Core Palette */
  --sovereign-dark:      #02040A;
  --sovereign-dark-soft: #0A0F1E;
  --sovereign-accent:    #3B82F6;
  --sovereign-accent-2:  #22D3EE;
  --sovereign-success:   #10B981;
  --sovereign-bg:        #F8FAFC;
  --sovereign-surface:   #FFFFFF;
  --sovereign-border:    #E2E8F0;
  --sovereign-text-h:    #0F172A;
  --sovereign-text-b:    #334155;
  --sovereign-text-m:    #64748B;

  /* Typography Stacks */
  --f-display: 'Sora', system-ui, sans-serif;
  --f-body:    'Inter', system-ui, sans-serif;
  --f-mono:    'JetBrains Mono', monospace;

  /* Shadows */
  --shadow-elite: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ═══════════════════════════════════════════════════
   1. LAYOUT CONTAINER — THE SOVEREIGN GRID
   ═══════════════════════════════════════════════════ */
.csi-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px; /* Force breathing room from sides */
}

@media (max-width: 640px) {
  .csi-container { padding: 0 20px; }
}

/* ═══════════════════════════════════════════════════
   2. HERO — COMMAND CENTER
   ═══════════════════════════════════════════════════ */
.csi-hero {
  position: relative;
  background: var(--sovereign-dark);
  padding: 180px 0 100px;
  overflow: hidden;
  text-align: center;
}

.csi-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(circle at 50% 50%, black, transparent 85%);
}

.csi-hero__inner {
  position: relative;
  z-index: 10;
}

.csi-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 100px;
  margin-bottom: 40px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 800;
  color: var(--sovereign-accent-2);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.csi-eyebrow-dot {
  width: 8px;
  height: 8px;
  background: var(--sovereign-accent-2);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--sovereign-accent-2);
}

.csi-title {
  font-family: var(--f-display);
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1.0;
  letter-spacing: -0.05em;
  margin-bottom: 32px;
}

.csi-title em {
  font-style: normal;
  color: var(--sovereign-accent);
}

.csi-subtitle {
  font-family: var(--f-body);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: #94A3B8;
  line-height: 1.7;
  max-width: 820px;
  margin: 0 auto 60px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* ═══════════════════════════════════════════════════
   3. CATALOG SECTION
   ═══════════════════════════════════════════════════ */
.csi-catalog {
  background: var(--sovereign-bg);
  padding: 100px 0 140px;
}

.csi-catalog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 64px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--sovereign-border);
}

.csi-catalog__title {
  font-family: var(--f-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--sovereign-text-h);
  letter-spacing: -0.03em;
  margin: 0;
}

.csi-catalog__meta {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--sovereign-text-m);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Grid layout with strict gaps */
.csi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 40px;
}

@media (max-width: 400px) {
  .csi-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   4. CARD: INDUSTRIAL ARCHITECTURE MODULE
   ═══════════════════════════════════════════════════ */
.csi-card {
  display: flex;
  flex-direction: column;
  background: var(--sovereign-surface);
  border: 1px solid var(--sovereign-border);
  border-radius: 24px;
  overflow: hidden;
  text-decoration: none;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-elite);
}

.csi-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
  border-color: var(--sovereign-accent);
}

/* Image container */
.csi-card__media {
  position: relative;
  height: 260px;
  overflow: hidden;
  background: var(--sovereign-dark);
}

.csi-card__img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.8s ease;
  opacity: 0.9;
}

.csi-card:hover .csi-card__img {
  transform: scale(1.05);
  opacity: 1;
}

/* Gradient overlay for text protection */
.csi-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(2,4,10,0.1) 0%, rgba(2,4,10,0.8) 100%);
}

/* Top Badge: Category */
.csi-card__cat {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 10;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 800;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ── REFINED KPI BOX: No more cutting! ── */
.csi-card__kpi-box {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px; /* Fix: Match both sides to force wrapping */
  z-index: 10;
  padding: 12px 16px;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.csi-card__kpi-text {
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--sovereign-accent);
  line-height: 1.4;
  text-align: center;
  margin: 0;
}

/* ── Content Area ── */
.csi-card__content {
  padding: 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.csi-card__title {
  font-family: var(--f-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--sovereign-text-h);
  line-height: 1.25;
  margin-bottom: 20px;
  letter-spacing: -0.03em;
}

.csi-card__desc {
  font-family: var(--f-body);
  font-size: 1rem;
  color: var(--sovereign-text-m);
  line-height: 1.7;
  margin-bottom: 32px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Footer Stats ── */
.csi-card__footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--sovereign-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.csi-card__stack {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.csi-card__pill {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--sovereign-text-b);
  background: #F1F5F9;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
}

.csi-card__arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #F8FAFC;
  border: 1px solid var(--sovereign-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sovereign-accent);
  transition: all 0.3s ease;
}

.csi-card:hover .csi-card__arrow {
  background: var(--sovereign-accent);
  color: #FFFFFF;
  transform: translateX(5px);
}

/* ═══════════════════════════════════════════════════
   5. BOTTOM CTA — SOVEREIGN CLOSING
   ═══════════════════════════════════════════════════ */
.csi-cta {
  background: var(--sovereign-dark);
  padding: 120px 0;
  text-align: center;
}

.csi-cta__h {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  color: #FFFFFF;
  margin-bottom: 24px;
  letter-spacing: -0.04em;
}

.csi-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--sovereign-accent);
  color: #FFFFFF;
  padding: 20px 48px;
  border-radius: 100px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

.csi-cta__btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.5);
}
