/**
 * <sis-habilitation-badges> — v1
 *
 * Détail des habilitations + parcours utilisateur + projets perso.
 * Direction éditoriale technique française reconduite.
 *
 * Light DOM — préfixe `.shb-` (sis-habilitation-badges).
 */

sis-habilitation-badges {
  --shb-serif: "Iowan Old Style", "Palatino", "Hoefler Text", "Times New Roman", Georgia, serif;
  --shb-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --shb-body: var(--font-family-base);
  --shb-blueprint: rgba(88, 109, 221, 0.04);

  display: block;
  min-height: 100vh;
  background: var(--color-bg);
  position: relative;
  font-family: var(--shb-body);
  color: var(--color-text);
  padding-bottom: var(--space-xl);
}

sis-habilitation-badges::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--shb-blueprint) 1px, transparent 1px),
    linear-gradient(to bottom, var(--shb-blueprint) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at top right, black 25%, transparent 75%);
          mask-image: radial-gradient(ellipse at top right, black 25%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.shb-shell { position: relative; z-index: 1; }

/* ============================================================================
   Top bar
   ============================================================================ */
.shb-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: max(env(safe-area-inset-top, 0), var(--space-sm)) var(--space-md) var(--space-sm);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.shb-back {
  background: 0;
  border: 1px solid var(--color-border);
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  transition: background var(--transition-fast);
}
.shb-back:hover { background: var(--color-bg-soft); }
.shb-back svg { width: 18px; height: 18px; }
.shb-topbar__title {
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--uttop-compl-1);
  font-weight: var(--font-weight-semibold);
  flex: 1;
}

/* ============================================================================
   Identité (profil grand format)
   ============================================================================ */
.shb-identity {
  padding: var(--space-xl) var(--space-md) var(--space-md);
  text-align: center;
  position: relative;
}

.shb-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--avatar-color, var(--uttop-compl-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--shb-serif);
  font-size: 2.4rem;
  font-weight: var(--font-weight-bold);
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.18);
  margin: 0 auto var(--space-md);
  border: 4px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-border), 0 8px 24px rgba(0,0,0,0.06);
}

.shb-name {
  font-family: var(--shb-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text);
  margin: 0;
  line-height: 1.15;
}
.shb-name__highlight {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.shb-name__highlight::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 0.08em;
  height: 0.28em;
  background: var(--uttop-compl-3);
  z-index: -1;
  transform: skew(-12deg);
  opacity: 0.78;
}

.shb-role {
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--uttop-compl-1);
  font-weight: var(--font-weight-semibold);
  margin-top: var(--space-xs);
}
.shb-meta {
  font-family: var(--shb-body);
  font-size: 0.85rem;
  color: var(--color-text-soft);
  margin-top: var(--space-sm);
}
.shb-meta__sep { margin: 0 var(--space-xs); color: var(--color-border); }

/* Stats résumé */
.shb-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}
.shb-stat { text-align: center; }
.shb-stat__num {
  font-family: var(--shb-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1;
}
.shb-stat__label {
  font-family: var(--shb-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  margin-top: 4px;
}

/* ============================================================================
   Sections + eyebrow
   ============================================================================ */
.shb-section {
  padding: var(--space-lg) var(--space-md) 0;
}
.shb-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--uttop-compl-1);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-md);
}
.shb-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}
.shb-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.shb-section__head .shb-eyebrow { margin-bottom: 0; }
.shb-section__count {
  font-family: var(--shb-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--color-text-soft);
}

/* ============================================================================
   Liste badges validés (grille)
   ============================================================================ */
.shb-badges {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}
@media (min-width: 480px) {
  .shb-badges { grid-template-columns: 1fr 1fr; }
}

.shb-badge {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--badge-color, var(--uttop-compl-1));
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}
.shb-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.shb-badge__check {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--badge-color, var(--uttop-compl-1));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.shb-badge__body {
  flex: 1;
  min-width: 0;
}
.shb-badge__name {
  font-family: var(--shb-serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.15;
  margin: 0;
}
.shb-badge__zone {
  font-family: var(--shb-body);
  font-size: 0.78rem;
  color: var(--color-text-soft);
  margin-top: 2px;
}
.shb-badge__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--color-text-soft);
}
.shb-badge__meta strong {
  color: var(--badge-color, var(--uttop-compl-1));
  font-weight: var(--font-weight-semibold);
}

/* État vide */
.shb-empty {
  background: var(--color-bg-soft);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}
.shb-empty__text {
  font-family: var(--shb-serif);
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}
.shb-empty__hint {
  font-family: var(--shb-body);
  font-size: 0.82rem;
  color: var(--color-text-soft);
}

/* ============================================================================
   Habilitations à débloquer
   ============================================================================ */
.shb-unlocks {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.shb-unlock {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  position: relative;
}
.shb-unlock__icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-bg-soft);
  border: 1.5px dashed var(--unlock-color, var(--color-text-soft));
  color: var(--unlock-color, var(--color-text-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.shb-unlock__body { flex: 1; min-width: 0; }
.shb-unlock__name {
  font-family: var(--shb-serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.15;
}
.shb-unlock__desc {
  font-family: var(--shb-body);
  font-size: 0.8rem;
  color: var(--color-text-soft);
  margin-top: 2px;
}
.shb-unlock__cta {
  font-family: var(--shb-body);
  font-size: 0.82rem;
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background: var(--unlock-color, var(--uttop-principale));
  border: 0;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  min-height: var(--touch-target-min);
  cursor: pointer;
  white-space: nowrap;
  transition: filter var(--transition-fast);
}
.shb-unlock__cta:hover { filter: brightness(0.92); }

/* ============================================================================
   Mon parcours (timeline verticale)
   ============================================================================ */
.shb-timeline {
  position: relative;
  padding-left: 28px;
}
.shb-timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom,
    var(--uttop-compl-1) 0%,
    var(--uttop-compl-1) 60%,
    var(--color-border) 100%);
}

.shb-step {
  position: relative;
  padding-bottom: var(--space-md);
}
.shb-step:last-child { padding-bottom: 0; }
.shb-step::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--step-color, var(--uttop-compl-1));
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--step-color, var(--uttop-compl-1));
}
.shb-step.is-future::before {
  background: var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-text-soft);
}
.shb-step__date {
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}
.shb-step__title {
  font-family: var(--shb-serif);
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.2;
  margin-top: 2px;
}
.shb-step__sub {
  font-family: var(--shb-body);
  font-size: 0.78rem;
  color: var(--color-text-soft);
  margin-top: 2px;
}
.shb-step.is-future .shb-step__title { color: var(--color-text-soft); font-style: italic; }

/* ============================================================================
   Mes projets
   ============================================================================ */
.shb-projects {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.shb-project {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.shb-project:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.shb-project__role {
  flex: 0 0 36px;
  font-family: var(--shb-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: var(--font-weight-bold);
  text-align: center;
  padding: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--role-color, var(--uttop-principale));
  background: var(--role-bg, rgba(0,80,120,0.08));
  white-space: nowrap;
}
.shb-project__body { flex: 1; min-width: 0; }
.shb-project__title {
  font-family: var(--shb-serif);
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shb-project__status {
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-text-soft);
  margin-top: 2px;
}
.shb-project__arrow {
  color: var(--color-text-soft);
  font-family: var(--shb-mono);
  font-size: 1.1rem;
}

/* ============================================================================
   Pied de page : déconnexion
   ============================================================================ */
.shb-foot {
  padding: var(--space-xl) var(--space-md) 0;
  text-align: center;
}
.shb-signout {
  font-family: var(--shb-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  background: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.shb-signout:hover {
  color: var(--color-danger);
  border-color: rgba(220, 38, 38, 0.4);
}

/* ============================================================================
   Animations reveal
   ============================================================================ */
.shb-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.shb-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .shb-reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================================================
   Modal détail habilitation (v2)
   ============================================================================ */
.shb-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: var(--color-overlay);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}
.shb-modal.is-open { display: flex; }
@media (min-width: 480px) { .shb-modal { align-items: center; } }

.shb-modal__sheet {
  background: var(--color-bg);
  width: 100%;
  max-width: 440px;
  border-radius: 24px 24px 0 0;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0));
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: shb-sheet-up 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (min-width: 480px) { .shb-modal__sheet { border-radius: var(--radius-xl); } }
.shb-modal__handle {
  width: 40px; height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  margin: 0 auto var(--space-md);
}
@media (min-width: 480px) { .shb-modal__handle { display: none; } }
.shb-modal__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: var(--touch-target-min);
  height: var(--touch-target-min);
  cursor: pointer;
  color: var(--color-text-soft);
  font-size: 1rem;
}
.shb-modal__close:hover { background: var(--color-bg-soft); }
.shb-modal__icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-sm);
}
.shb-modal__eyebrow {
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-xs);
}
.shb-modal__title {
  font-family: var(--shb-serif);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}
.shb-modal__rows { display: flex; flex-direction: column; gap: var(--space-sm); }
.shb-modal__row {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px dashed var(--color-border);
}
.shb-modal__row:last-child { border-bottom: 0; padding-bottom: 0; }
.shb-modal__label {
  font-family: var(--shb-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  flex: 0 0 72px;
  padding-top: 2px;
}
.shb-modal__value {
  flex: 1;
  font-family: var(--shb-body);
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.4;
}
.shb-modal__chip {
  display: inline-block;
  font-family: var(--shb-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  margin: 1px 2px 1px 0;
}
@keyframes shb-sheet-up {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .shb-modal__sheet { animation: none; }
}
