/**
 * <sis-user-home> — v1
 *
 * Accueil utilisateur connecté de l'app mobile UTTOP Maker Space.
 * Direction éditoriale technique française reconduite (cohérence Sprint 1 + sis-auth-code) :
 *   - eyebrow mono vert sapin (compl-1) + dash
 *   - titres serif éditorial (Iowan/Palatino)
 *   - détails mono ingé
 *   - coins techniques compl-1 sur certaines cards
 *   - grille blueprint compl-5 très subtile en background
 *   - couleurs zones strictes via --zone-* tokens
 *
 * Light DOM — préfixe `.suh-` (sis-user-home).
 */

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

  display: block;
  min-height: 100vh;
  background: var(--color-bg-soft);
  position: relative;
  font-family: var(--suh-body);
  color: var(--color-text);
  padding-bottom: 88px; /* place pour bottom-nav */
}

/* Grille blueprint subtile */
sis-user-home::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--suh-blueprint) 1px, transparent 1px),
    linear-gradient(to bottom, var(--suh-blueprint) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at top, black 30%, transparent 80%);
          mask-image: radial-gradient(ellipse at top, black 30%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

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

/* ============================================================================
   Top bar sticky
   ============================================================================ */
.suh-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);
}

.suh-topbar__avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: var(--avatar-color, var(--uttop-compl-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--suh-serif);
  font-size: 1.2rem;
  font-weight: var(--font-weight-bold);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 1px var(--color-border);
}

.suh-topbar__greeting {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
  flex: 1;
}
.suh-topbar__hello {
  font-family: var(--suh-serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suh-topbar__role {
  font-family: var(--suh-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--uttop-compl-1);
  margin-top: 2px;
}

.suh-topbar__bell {
  position: relative;
  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);
}
.suh-topbar__bell:hover { background: var(--color-bg-soft); }
.suh-topbar__bell svg { width: 20px; height: 20px; }
.suh-topbar__bell-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger);
  border: 2px solid var(--color-bg);
}

/* Bandeau hors-ligne */
.suh-offline {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: rgba(245, 216, 54, 0.18);
  color: #856704;
  font-family: var(--suh-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  border-top: 1px solid rgba(245, 216, 54, 0.4);
  border-bottom: 1px solid rgba(245, 216, 54, 0.4);
}
.suh-offline.is-visible { display: flex; }
.suh-offline::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c19400;
}

/* ============================================================================
   Sections + eyebrow
   ============================================================================ */
.suh-section {
  padding: var(--space-lg) var(--space-md) 0;
}

.suh-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--suh-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);
}
.suh-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

.suh-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.suh-section__head .suh-eyebrow { margin-bottom: 0; }

.suh-link-more {
  font-family: var(--suh-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--uttop-principale);
  background: 0;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.suh-link-more:hover { color: #003958; }

/* ============================================================================
   Card prochaine réservation
   ============================================================================ */
.suh-reservation {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--zone-color, var(--uttop-principale));
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.suh-reservation::before,
.suh-reservation::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--zone-color, var(--uttop-principale));
  opacity: 0.6;
}
.suh-reservation::before { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.suh-reservation::after { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }

.suh-reservation__zone-tag {
  display: inline-block;
  font-family: var(--suh-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--zone-color, var(--uttop-principale));
  background: var(--zone-bg, rgba(0, 80, 120, 0.08));
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-sm);
  font-weight: var(--font-weight-semibold);
}

.suh-reservation__time {
  font-family: var(--suh-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--color-text-soft);
  margin-bottom: 2px;
}
.suh-reservation__time strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.suh-reservation__poste {
  font-family: var(--suh-serif);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.15;
  margin: var(--space-sm) 0 4px;
}
.suh-reservation__zone {
  font-family: var(--suh-body);
  font-size: 0.85rem;
  color: var(--color-text-soft);
  margin-bottom: var(--space-md);
}

.suh-reservation__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.suh-reservation__scan {
  flex: 1;
  font-family: var(--suh-body);
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background: var(--zone-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;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: filter var(--transition-fast);
}
.suh-reservation__scan:hover { filter: brightness(0.92); }
.suh-reservation__scan svg { width: 18px; height: 18px; }

.suh-reservation__cancel {
  font-family: var(--suh-body);
  font-size: 0.85rem;
  color: var(--color-text-soft);
  background: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  min-height: var(--touch-target-min);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.suh-reservation__cancel:hover { background: var(--color-bg-soft); }

/* État pas de réservation */
.suh-no-reservation {
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}
.suh-no-reservation__text {
  font-family: var(--suh-serif);
  font-size: 1.05rem;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}
.suh-no-reservation__hint {
  font-family: var(--suh-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  margin-bottom: var(--space-md);
}
.suh-no-reservation__btn {
  font-family: var(--suh-body);
  font-size: 0.9rem;
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background: var(--uttop-principale);
  border: 0;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  min-height: var(--touch-target-min);
  cursor: pointer;
}

/* ============================================================================
   Habilitations (badges horizontaux)
   ============================================================================ */
.suh-habs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.suh-hab {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.suh-hab:hover { transform: translateY(-1px); }
.suh-hab.is-validated {
  border-color: var(--hab-color, var(--uttop-compl-1));
  background: linear-gradient(180deg, var(--hab-color-soft, rgba(18, 154, 126, 0.06)) 0%, var(--color-bg) 100%);
}
.suh-hab.is-locked {
  opacity: 0.75;
  background: var(--color-bg-soft);
}

.suh-hab__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: var(--font-weight-bold);
}
.suh-hab.is-validated .suh-hab__check {
  background: var(--hab-color, var(--uttop-compl-1));
  color: #fff;
}
.suh-hab.is-locked .suh-hab__check {
  background: var(--color-border);
  color: var(--color-text-soft);
}

.suh-hab__name {
  font-family: var(--suh-body);
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  line-height: 1.2;
  margin-top: 2px;
}
.suh-hab__status {
  font-family: var(--suh-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}
.suh-hab.is-validated .suh-hab__status { color: var(--hab-color, var(--uttop-compl-1)); }

.suh-habs__more {
  margin-top: var(--space-sm);
  width: 100%;
  font-family: var(--suh-body);
  font-size: 0.85rem;
  color: var(--uttop-principale);
  background: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  cursor: pointer;
  text-align: center;
  transition: background var(--transition-fast);
}
.suh-habs__more:hover { background: var(--color-bg-soft); }

/* ============================================================================
   Activité maker space ("le moment")
   ============================================================================ */
.suh-activity {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.suh-activity__pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--uttop-compl-2);
  flex: 0 0 12px;
  position: relative;
}
.suh-activity__pulse::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--uttop-compl-2);
  opacity: 0.4;
  animation: suh-pulse 2s ease-out infinite;
}
.suh-activity__stats {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: var(--space-md);
  align-items: center;
}
.suh-activity__sep {
  background: var(--color-border);
  height: 28px;
}
.suh-activity__stat-num {
  font-family: var(--suh-serif);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text);
  font-weight: 400;
}
.suh-activity__stat-label {
  font-family: var(--suh-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  margin-top: 2px;
  line-height: 1.2;
}
.suh-activity__arrow {
  background: 0;
  border: 0;
  color: var(--uttop-principale);
  cursor: pointer;
  padding: var(--space-xs);
  font-family: var(--suh-mono);
  font-size: 1.2rem;
}

/* ============================================================================
   Carousel projets
   ============================================================================ */
.suh-projects__rail {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 4px var(--space-md) var(--space-md) 0;
  margin: 0 calc(-1 * var(--space-md));
  padding-left: var(--space-md);
  scrollbar-width: none;
}
.suh-projects__rail::-webkit-scrollbar { display: none; }

.suh-project {
  flex: 0 0 80%;
  scroll-snap-align: start;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  min-height: 180px;
}
.suh-project:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
@media (min-width: 480px) {
  .suh-project { flex-basis: 65%; }
}

.suh-project__tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.suh-project__tag {
  font-family: var(--suh-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--tag-color, rgba(0, 80, 120, 0.1));
  color: var(--tag-text, var(--uttop-principale));
  font-weight: var(--font-weight-semibold);
}

.suh-project__title {
  font-family: var(--suh-serif);
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--color-text);
  margin: 0;
}

.suh-project__desc {
  font-family: var(--suh-body);
  font-size: 0.82rem;
  color: var(--color-text-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.suh-project__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}
.suh-project__contribs {
  display: flex;
  align-items: center;
}
.suh-project__contrib {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c, var(--uttop-compl-2));
  border: 2px solid var(--color-bg);
  margin-left: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--suh-mono);
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  color: #fff;
}
.suh-project__contrib:first-child { margin-left: 0; }
.suh-project__contrib--more {
  background: var(--color-text-soft);
}
.suh-project__votes {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--suh-mono);
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-soft);
}

.suh-project__badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-family: var(--suh-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--uttop-compl-3);
  color: #4a3700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-bold);
}

/* ============================================================================
   Bottom nav (fixe, 5 entrées dont FAB scanner central)
   ============================================================================ */
.suh-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 1fr 1fr 76px 1fr 1fr;
  align-items: center;
  padding: var(--space-xs) 0 max(env(safe-area-inset-bottom, 0), var(--space-xs));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}
@media (min-width: 480px) {
  .suh-nav { max-width: 480px; margin: 0 auto; right: auto; left: 50%; transform: translateX(-50%); }
}
/* En cadre demo desktop, on contraint la nav à la frame */
.demo-frame .suh-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: none;
  transform: none;
}

.suh-nav__item {
  background: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) 0;
  cursor: pointer;
  color: var(--color-text-soft);
  font-family: var(--suh-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--transition-fast);
  min-height: var(--touch-target-min);
}
.suh-nav__item svg {
  width: 22px;
  height: 22px;
}
.suh-nav__item.is-active {
  color: var(--uttop-principale);
}
.suh-nav__item.is-active .suh-nav__item-label {
  font-weight: var(--font-weight-bold);
}
.suh-nav__item:hover:not(.is-active) {
  color: var(--color-text);
}

/* FAB scanner central */
.suh-nav__fab-wrap {
  display: flex;
  justify-content: center;
  position: relative;
}
.suh-nav__fab {
  background: var(--uttop-principale);
  border: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 80, 120, 0.35);
  position: absolute;
  top: -24px;
  transition: transform var(--transition-fast), background var(--transition-fast);
}
.suh-nav__fab:hover { background: #003958; transform: scale(1.05); }
.suh-nav__fab:active { transform: scale(0.95); }
.suh-nav__fab svg { width: 26px; height: 26px; }
.suh-nav__fab-label {
  position: absolute;
  bottom: -2px;
  font-family: var(--suh-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--uttop-principale);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}

/* ============================================================================
   Animations
   ============================================================================ */
.suh-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);
}
.suh-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@keyframes suh-pulse {
  0% { opacity: 0.5; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(2); }
}

@media (prefers-reduced-motion: reduce) {
  .suh-reveal { opacity: 1; transform: none; transition: none; }
  .suh-activity__pulse::before { animation: none; opacity: 0; }
}
