/* ══════════════════════════════════════════════════════════════
   FIXEO CHAPTER 3 — Mon problème, c'est ça.
   Namespace: fc3-*  (scoped to #services)
   Version: fc3-v3a

   Question answered: "Can FIXEO solve MY problem?"
   Approach: situations, not professions.
   Philosophy: users should feel guided, never filtering.

   Preserves all JS:
   - .chip[data-category] → initCategoryChips() in main.js
   - #services-city-filter → city filtering JS
   - .service-chip.active → active state management
   - .category-chips → JS mutation target

   Dependencies: fixeo-network-v1.css (service-chip base styles)
══════════════════════════════════════════════════════════════ */

/* ── SECTION WRAPPER ─────────────────────────────────────────── */
#services.fc3-chapter {
  padding: clamp(64px, 8vw, 112px) 0 clamp(56px, 7vw, 96px);
  background: var(--fds-surface-bg, #05070f);
  position: relative;
}

/* Suppress svc-city-wrap pill injected by services-premium.js
   (we replace it with our contextual fc3-city-bar) */
#services.fc3-chapter .svc-city-wrap {
  display: none !important;
}

/* Card entrance animation */
@keyframes fc3-card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chip panel expand */
@keyframes fc3-chips-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── PART 1 — HEADER ─────────────────────────────────────────── */
.fc3-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto clamp(36px, 5vw, 56px);
  padding: 0 16px;
}

.fc3-eyebrow {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(72, 100, 255, 0.72);
  margin-bottom: 16px;
}

.fc3-title {
  font-size: clamp(1.75rem, 3.8vw, 2.8rem);
  font-weight: 700;
  line-height: 1.22;
  color: #f0f4ff;
  letter-spacing: -0.022em;
  margin: 0 0 16px;
}

.fc3-br-title { display: none; }

.fc3-subtitle {
  font-size: clamp(0.90rem, 1.5vw, 1.02rem);
  color: rgba(200, 212, 255, 0.55);
  line-height: 1.65;
  margin: 0;
}

.fc3-br-desktop { display: inline; }

/* ── CITY CONTEXT BAR ────────────────────────────────────────── */
/* Minimal, centered, almost invisible. Never looks like a filter. */

.fc3-city-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

/* ── STATE A: city detected ──────────────────────────────────── */
/* Hidden by default; CSS reveals when #services has data-fc3-city-known */
.fc3-city-detected {
  display: none;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: rgba(200, 212, 255, 0.65);
}

/* Revealed by JS via data attribute — beats fixeo-network-v1.css !important */
#services.fc3-chapter[data-fc3-city-known] .fc3-city-detected {
  display: flex !important;
  animation: fc3-city-appear 0.30s ease both;
}

@keyframes fc3-city-appear {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.fc3-city-pin {
  font-size: 0.80rem;
  opacity: 0.70;
}

.fc3-city-detected-name {
  font-weight: 600;
  color: rgba(220, 228, 255, 0.88);
}

.fc3-city-detected-label {
  color: rgba(200, 212, 255, 0.38);
  font-size: 0.78rem;
}

.fc3-city-change-btn {
  background: none;
  border: none;
  padding: 2px 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(72, 100, 255, 0.65);
  cursor: pointer;
  border-radius: 5px;
  transition: color 0.15s ease;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(72, 100, 255, 0.30);
}

.fc3-city-change-btn:hover {
  color: rgba(72, 100, 255, 0.95);
  text-decoration-color: rgba(72, 100, 255, 0.65);
}

/* ── STATE B: city unknown ───────────────────────────────────── */
/* Hidden when city is known */
#services.fc3-chapter[data-fc3-city-known] .fc3-city-unknown {
  display: none !important;
}

.fc3-city-unknown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* "📍 Choisir une ville" — the primary touch target */
.fc3-city-choose-btn {
  background: none;
  border: none;
  padding: 5px 10px;
  font-size: 0.80rem;
  font-weight: 500;
  color: rgba(200, 212, 255, 0.38);
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.18s ease, background 0.18s ease;
  letter-spacing: 0.01em;
}

.fc3-city-choose-btn:hover {
  color: rgba(200, 212, 255, 0.70);
  background: rgba(72, 100, 255, 0.04);
}

.fc3-city-choose-btn[aria-expanded="true"] {
  color: rgba(200, 212, 255, 0.75);
}

/* City chips panel — hidden until choose-btn expands it */
/* Override fixeo-network-v1.css: #services #city-quick-chips { display:flex !important } */
#services.fc3-chapter #city-quick-chips {
  display: none !important;
}

#services.fc3-chapter[data-fc3-chips-open] #city-quick-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 6px !important;
  animation: fc3-chips-reveal 0.22s ease both !important;
}

/* ── SITUATION CARDS GRID ────────────────────────────────────── */
/* Beats fixeo-network-v1.css !important rules via class+ID specificity */

#services.fc3-chapter .fc3-situations {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 14px !important;
  max-width: 900px !important;
  margin: 0 auto clamp(28px, 4vw, 44px) !important;
  flex-wrap: unset !important;
  justify-content: unset !important;
  padding: 0 !important;
}

/* Single card */
#services.fc3-chapter .fc3-card,
#services.fc3-chapter .fc3-card.chip.service-chip {
  appearance: none;
  -webkit-appearance: none;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 10px !important;
  border: 1px solid rgba(72, 100, 255, 0.12) !important;
  background: rgba(72, 100, 255, 0.04) !important;
  border-radius: 14px !important;
  padding: 18px 16px 16px !important;
  cursor: pointer !important;
  text-align: left !important;
  position: relative !important;
  width: 100% !important;
  min-height: 96px !important;
  white-space: normal !important;
  line-height: 1.4 !important;
  color: rgba(220, 228, 255, 0.88) !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  box-shadow: none !important;
  overflow: hidden !important;
  transition:
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  animation: fc3-card-enter 0.45s ease both !important;
}

/* Staggered entrance — 13 main + 3 specialized = 16 cards max */
#services.fc3-chapter .fc3-card:nth-child(1)  { animation-delay: 0.00s !important; }
#services.fc3-chapter .fc3-card:nth-child(2)  { animation-delay: 0.04s !important; }
#services.fc3-chapter .fc3-card:nth-child(3)  { animation-delay: 0.08s !important; }
#services.fc3-chapter .fc3-card:nth-child(4)  { animation-delay: 0.12s !important; }
#services.fc3-chapter .fc3-card:nth-child(5)  { animation-delay: 0.16s !important; }
#services.fc3-chapter .fc3-card:nth-child(6)  { animation-delay: 0.20s !important; }
#services.fc3-chapter .fc3-card:nth-child(7)  { animation-delay: 0.24s !important; }
#services.fc3-chapter .fc3-card:nth-child(8)  { animation-delay: 0.28s !important; }
#services.fc3-chapter .fc3-card:nth-child(9)  { animation-delay: 0.32s !important; }
#services.fc3-chapter .fc3-card:nth-child(10) { animation-delay: 0.36s !important; }
#services.fc3-chapter .fc3-card:nth-child(11) { animation-delay: 0.40s !important; }
#services.fc3-chapter .fc3-card:nth-child(12) { animation-delay: 0.44s !important; }
#services.fc3-chapter .fc3-card:nth-child(13) { animation-delay: 0.48s !important; }

/* Hover — lift + soft indigo glow */
#services.fc3-chapter .fc3-card:hover,
#services.fc3-chapter .fc3-card.chip.service-chip:hover {
  background: rgba(72, 100, 255, 0.08) !important;
  border-color: rgba(72, 100, 255, 0.28) !important;
  box-shadow:
    0 4px 20px rgba(72, 100, 255, 0.10),
    0 1px 4px rgba(0, 0, 0, 0.18) !important;
  transform: translateY(-3px) !important;
  color: rgba(230, 236, 255, 0.96) !important;
}

/* Press */
#services.fc3-chapter .fc3-card:active {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(72, 100, 255, 0.08) !important;
}

/* Active (selected) */
#services.fc3-chapter .fc3-card.active,
#services.fc3-chapter .fc3-card[aria-pressed="true"],
#services.fc3-chapter .fc3-card.chip.service-chip.active {
  background: rgba(72, 100, 255, 0.11) !important;
  border-color: rgba(72, 100, 255, 0.52) !important;
  box-shadow:
    0 0 0 3px rgba(72, 100, 255, 0.10),
    0 4px 20px rgba(72, 100, 255, 0.12) !important;
  color: #ffffff !important;
}

/* Active shimmer overlay */
#services.fc3-chapter .fc3-card.active::before,
#services.fc3-chapter .fc3-card[aria-pressed="true"]::before {
  content: '';
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(
    135deg,
    rgba(72, 100, 255, 0.06) 0%,
    transparent 60%
  ) !important;
  border-radius: inherit !important;
  pointer-events: none !important;
}

/* Focus ring */
#services.fc3-chapter .fc3-card:focus-visible {
  outline: 2px solid rgba(72, 100, 255, 0.60) !important;
  outline-offset: 2px !important;
}

/* ── CARD INTERNALS ──────────────────────────────────────────── */
.fc3-card-icon {
  font-size: 1.45rem;
  line-height: 1;
  display: block;
  width: 1.6rem;
  flex-shrink: 0;
}

/* "All" star — slightly different weight */
.fc3-card[data-category="all"] .fc3-card-icon {
  font-size: 1.10rem !important;
  color: rgba(72, 100, 255, 0.55);
}

.fc3-card-label {
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  color: rgba(220, 228, 255, 0.88) !important;
  line-height: 1.40 !important;
  display: block !important;
  flex: 1;
}

#services.fc3-chapter .fc3-card.active .fc3-card-label,
#services.fc3-chapter .fc3-card[aria-pressed="true"] .fc3-card-label {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Urgency badge */
.fc3-card-urgency {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(225, 48, 108, 0.90);
  background: rgba(225, 48, 108, 0.07);
  border: 1px solid rgba(225, 48, 108, 0.16);
  border-radius: 999px;
  padding: 3px 8px;
  line-height: 1;
  align-self: flex-start;
  flex-shrink: 0;
}

/* ── ADDITIONAL NEEDS BLOCK ──────────────────────────────────── */
/* Same card language as situation grid — one continuous experience */

.fc3-specialized-block {
  max-width: 900px;
  margin: 0 auto clamp(28px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.fc3-specialized-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(200, 212, 255, 0.22);
}

/* Specialized grid — 3 cards, same grid as .fc3-situations */
#services.fc3-chapter .fc3-specialized-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 14px !important;
  width: 100% !important;
  max-width: 900px !important;
  flex-wrap: unset !important;
  justify-content: unset !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Specialized cards are visually dimmer — secondary narrative */
#services.fc3-chapter .fc3-specialized-grid .fc3-card,
#services.fc3-chapter .fc3-specialized-grid .fc3-card.chip.service-chip {
  border-color: rgba(72, 100, 255, 0.07) !important;
  background: rgba(72, 100, 255, 0.025) !important;
  opacity: 0.82;
}

#services.fc3-chapter .fc3-specialized-grid .fc3-card:hover,
#services.fc3-chapter .fc3-specialized-grid .fc3-card.chip.service-chip:hover {
  opacity: 1;
}

#services.fc3-chapter .fc3-specialized-grid .fc3-card.active,
#services.fc3-chapter .fc3-specialized-grid .fc3-card[aria-pressed="true"] {
  opacity: 1;
}

/* ── CHAPTER TRANSITION ───────────────────────────────────────── */
.fc3-transition {
  text-align: center;
  padding-top: clamp(8px, 2vw, 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fc3-transition-text {
  font-size: 0.86rem;
  color: rgba(200, 212, 255, 0.38);
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.55;
  margin: 0;
  max-width: 420px;
}

/* Downward arrow */
.fc3-transition-arrow {
  display: block;
  width: 1px;
  height: 32px;
  background: linear-gradient(
    to bottom,
    rgba(72, 100, 255, 0.22),
    transparent
  );
  margin: 0 auto;
  position: relative;
}

.fc3-transition-arrow::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 6px;
  height: 6px;
  border-right: 1px solid rgba(72, 100, 255, 0.30);
  border-bottom: 1px solid rgba(72, 100, 255, 0.30);
  transform: translateX(-50%) rotate(45deg);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */

@media (max-width: 899px) {
  #services.fc3-chapter .fc3-situations,
  #services.fc3-chapter .fc3-specialized-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 640px !important;
    gap: 12px !important;
  }

  .fc3-title {
    font-size: clamp(1.60rem, 4.2vw, 2.2rem);
  }
}

@media (max-width: 679px) {
  #services.fc3-chapter {
    padding: 52px 0 48px;
  }

  .fc3-header {
    padding: 0 20px;
    margin-bottom: 28px;
  }

  .fc3-title {
    font-size: clamp(1.45rem, 6.2vw, 1.80rem);
  }

  .fc3-br-title { display: inline; }

  .fc3-subtitle {
    font-size: 0.88rem;
  }

  .fc3-br-desktop { display: none; }

  #services.fc3-chapter .fc3-situations,
  #services.fc3-chapter .fc3-specialized-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    max-width: 100% !important;
    padding: 0 20px !important;
  }

  .fc3-specialized-block {
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
  }

  #services.fc3-chapter .fc3-card,
  #services.fc3-chapter .fc3-card.chip.service-chip {
    padding: 14px 12px 12px !important;
    border-radius: 12px !important;
    min-height: 88px !important;
    gap: 8px !important;
  }

  .fc3-card-icon { font-size: 1.25rem !important; }
  .fc3-card-label { font-size: 0.82rem !important; }

  .fc3-transition-text {
    font-size: 0.82rem;
    padding: 0 20px;
  }
}

@media (max-width: 374px) {
  #services.fc3-chapter .fc3-situations,
  #services.fc3-chapter .fc3-specialized-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    padding: 0 16px !important;
  }

  #services.fc3-chapter .fc3-card,
  #services.fc3-chapter .fc3-card.chip.service-chip {
    padding: 12px 10px 10px !important;
    min-height: 80px !important;
  }

  .fc3-card-icon { font-size: 1.15rem !important; }
  .fc3-card-label { font-size: 0.78rem !important; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  #services.fc3-chapter .fc3-card,
  #services.fc3-chapter .fc3-card.chip.service-chip {
    animation: none !important;
    transition: background 0.1s ease, border-color 0.1s ease !important;
  }

  #services.fc3-chapter .fc3-card:hover,
  #services.fc3-chapter .fc3-card.chip.service-chip:hover {
    transform: none !important;
  }

  #services.fc3-chapter[data-fc3-chips-open] #city-quick-chips {
    animation: none !important;
  }
}
