:root {
  --navy: #0B2447;
  --teal: #1B6B82;
  --cyan: #1CC8D8;
  --blue: #2F5FE3;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --text: #0B2447;
  --muted: #4B6178;
  --line: #D6E6EE;
  --grad: linear-gradient(135deg, #1B6B82, #1CC8D8 60%, #2F5FE3);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.65;
}

h1, h2, h3, h4 {
  font-family: Sora, Inter, sans-serif;
  margin: 0;
  line-height: 1.15;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 22px;
}

/* Header & Navigation */
header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  z-index: 10;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  font-family: Sora;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: .02em;
  text-decoration: none;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  height: 46px;
  max-width: 250px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.02);
}

.brand span.badge-fsan {
  font-size: 0.72rem;
  font-weight: 600;
  background: #e9f2f8;
  color: var(--teal);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: normal;
}

.links {
  display: flex;
  gap: 20px;
  align-items: center;
  overflow-x: auto;
}

.links a, .links button {
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s ease;
}

.links a:hover, .links button:hover {
  color: var(--text);
}

.links a.active {
  color: var(--blue);
  font-weight: 600;
}

.links .nav-profile-avatar,
.links .nav-profile-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 28px;
}

.links .nav-profile-avatar {
  object-fit: cover;
}

.links .nav-profile-avatar-initials {
  display: inline-grid;
  place-items: center;
  background: var(--cyan);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
}

.links .nav-profile-avatar-initials[hidden] {
  display: none;
}

.links a#profile-link {
  align-items: center;
  gap: 7px;
}

.links .cta {
  background: var(--navy);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.links .cta:hover {
  background: var(--teal);
  transform: translateY(-1px);
}

.links button.cta {
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

/* Hero */
.hero {
  padding: 84px 0 72px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -140px;
  top: -60px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  border: 70px solid transparent;
  border-top-color: var(--cyan);
  border-right-color: var(--blue);
  opacity: .25;
  transform: rotate(20deg);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(3.5rem, 12vw, 8rem);
  font-weight: 800;
  letter-spacing: -.02em;
}

.hero .sub {
  font-family: Sora;
  font-weight: 600;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--teal);
  margin: 6px 0 0;
}

.hero .where {
  color: var(--muted);
  margin: 4px 0 28px;
  border-left: 3px solid var(--blue);
  padding-left: 12px;
}

.hero p.lead {
  max-width: 60ch;
  font-size: 1.1rem;
}

/* Buttons */
.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn.primary {
  background: var(--grad);
  color: #fff;
}

.btn.primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(27, 107, 130, 0.25);
}

.btn.ghost {
  border-color: var(--teal);
  color: var(--teal);
}

.btn.ghost:hover {
  background: var(--teal);
  color: #fff;
}

/* Sections */
section {
  padding: 68px 0;
}

section h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 10px;
}

section h2::after {
  content: "";
  display: block;
  width: 64px;
  height: 5px;
  border-radius: 3px;
  background: var(--grad);
  margin-top: 12px;
}

.intro {
  color: var(--muted);
  max-width: 62ch;
  margin: 16px 0 34px;
}

/* Masters cards on home */
.masters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.master {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--teal);
  border-radius: 14px;
  padding: 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.master:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(11, 36, 71, 0.06);
}

.master:nth-child(2) {
  border-left-color: var(--blue);
}

.master b {
  font-family: Sora;
  font-size: 1.5rem;
  display: block;
  margin-bottom: 4px;
}

/* Objectif box */
.objectif {
  margin-top: 34px;
  background: linear-gradient(135deg, #1B6B82, #2F5FE3);
  color: #fff;
  border-radius: 18px;
  padding: 30px;
}

.objectif h3 {
  font-size: 1.3rem;
  margin-bottom: 14px;
}

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

.tags span {
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .6);
  color: #fff;
  font-weight: 500;
  font-size: 0.9rem;
}

/* Grid & Persons */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.person {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  width: 100%;
}

.avatar {
  flex: 0 0 200px;
  min-height: 170px;
  background: var(--grad);
  display: grid;
  place-items: center;
  font-family: Sora;
  font-weight: 800;
  font-size: 3rem;
  color: #fff;
  overflow: hidden;
}

.avatar.has-image {
  background: transparent;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.person .body {
  padding: 24px 30px;
  flex: 1;
  align-self: center;
  min-width: 0;
}

.person h3 {
  font-size: 1.15rem;
}

.role {
  color: var(--teal);
  font-weight: 600;
  font-size: .95rem;
  margin: 2px 0 8px;
}

.person p {
  margin: 0;
  color: var(--muted);
  font-size: .93rem;
}

.person a {
  display: inline-block;
  margin-top: 10px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--blue);
}

.person a:hover {
  text-decoration: underline;
}

.alt {
  background: #fbfdff;
  border-block: 1px solid var(--line);
}

/* Project Cards on Home */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.project {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(11, 36, 71, 0.08);
}

.thumb {
  height: 180px;
  background: linear-gradient(135deg, var(--navy), var(--teal) 55%, var(--cyan));
  display: grid;
  place-items: center;
  color: #fff;
  font-family: Sora;
  font-weight: 600;
  font-size: 1.1rem;
  object-fit: cover;
  width: 100%;
}

.project .body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.project h3 {
  font-size: 1.2rem;
}

.project p {
  margin: 0;
  color: var(--muted);
}

.project .tags span {
  background: #eef6f9;
  color: var(--teal);
  border: 1px solid var(--line);
  font-size: .8rem;
  padding: 3px 12px;
  border-radius: 999px;
}

.project .team {
  font-size: .88rem;
  color: var(--muted);
  margin-top: auto;
}

.project .team a {
  color: var(--blue);
  font-weight: 600;
}

.project .team a:hover {
  text-decoration: underline;
}

/* Learn Banner */
.learn {
  background: linear-gradient(135deg, #1B6B82, #2F5FE3);
  color: #fff;
  border-radius: 22px;
  padding: 48px 34px;
  position: relative;
  overflow: hidden;
}

.learn::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -110px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 44px solid transparent;
  border-top-color: var(--cyan);
  border-left-color: var(--blue);
  opacity: .5;
}

.learn h2::after {
  background: #fff;
}

.learn p {
  max-width: 56ch;
  color: #fff;
  position: relative;
  z-index: 1;
  font-size: 1.05rem;
}

.learn .btn {
  background: #fff;
  color: #0B2447;
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.learn .btn:hover {
  background: #f0f7fb;
  transform: translateY(-1px);
}

/* Footer */
footer {
  padding: 34px 0 44px;
  color: var(--muted);
  font-size: .92rem;
  border-top: 1px solid var(--line);
  background: #fdfefe;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Animation */
.hero .in {
  animation: rise .8s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero .in {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 720px) {
  .links a:not(.cta) {
    display: inline-block;
  }
  nav {
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  .avatar {
    flex: 0 0 100px;
    font-size: 1.8rem;
    min-height: 140px;
  }
  .person .body {
    padding: 16px 18px;
  }
  .hero h1 {
    font-size: 3.2rem;
  }
}

/* Carrousel d'Annonces sous forme de Slides (Accueil) */
.annonces-slider-section {
  padding: 45px 0 30px;
  background: linear-gradient(180deg, #f3f7fb 0%, #eaf2f8 100%);
  border-bottom: 1px solid var(--line);
}

.slider-header-intro {
  text-align: center;
  margin-bottom: 24px;
}

.slider-badge-title {
  display: inline-block;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.slider-wrapper {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(11, 36, 71, 0.08);
  background: #fff;
  border: 1px solid rgba(27, 107, 130, 0.18);
}

.slides-track {
  display: flex;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  width: 100%;
}

.slide-item {
  min-width: 100%;
  padding: 42px 52px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbfe 100%);
}

.slide-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.slide-tag {
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.slide-tag.urgent {
  background: linear-gradient(90deg, #e67e22, #d35400);
}

.slide-tag.green {
  background: #1e824c;
}

.slide-date {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.slide-title {
  font-family: Sora, Inter, sans-serif;
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  color: var(--navy);
  margin: 0 0 12px;
  line-height: 1.3;
}

.slide-desc {
  color: #4b6178;
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 72ch;
}

.slide-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Slider Controls */
.slider-arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(11, 36, 71, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all 0.2s ease;
}

.slider-arrow-btn:hover {
  background: var(--teal);
  transform: translateY(-50%) scale(1.08);
}

.slider-arrow-btn.prev {
  left: 12px;
}

.slider-arrow-btn.next {
  right: 12px;
}

.slider-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 16px;
  background: #f7fbfe;
  border-top: 1px solid #eef4f9;
}

.slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbdceb;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 0;
}

.slider-dot.active {
  background: var(--teal);
  width: 28px;
}

@media (max-width: 650px) {
  .slide-item {
    padding: 30px 22px;
  }
  .slider-arrow-btn {
    display: none;
  }
}

/* Modales universelles personnalisées CIAA (remplace les alert et confirm natifs sur toutes les pages) */
.ciaa-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 36, 71, 0.65);
  backdrop-filter: blur(5px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ciaa-dialog-box {
  background: #ffffff;
  border-radius: 18px;
  width: min(100%, 460px);
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(11, 36, 71, 0.25);
  border: 1px solid #dce8f2;
  position: relative;
}

.ciaa-dialog-top-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.ciaa-dialog-top-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ciaa-dialog-icon-wrapper {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: #eaf4fb;
  color: var(--teal);
}

.ciaa-dialog-icon-wrapper.success {
  background: #eafaf1;
  color: #27ae60;
  font-size: 2rem;
  font-weight: 800;
}

.ciaa-dialog-icon-wrapper.error {
  background: #fdedec;
  color: #e74c3c;
  font-size: 1.8rem;
  font-weight: 800;
}

.ciaa-dialog-icon-wrapper.confirm {
  background: #fff8e6;
  color: #d97706;
}

.ciaa-dialog-title {
  margin: 0 0 8px;
  color: var(--navy);
  font-family: Sora, Inter, sans-serif;
  font-size: 1.25rem;
}

.ciaa-dialog-message {
  margin: 0 0 22px;
  color: #4b6178;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ciaa-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.ciaa-dialog-btn {
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.ciaa-dialog-btn.primary {
  background: var(--navy);
  color: #fff;
}

.ciaa-dialog-btn.primary:hover {
  background: var(--teal);
}

.ciaa-dialog-btn.primary.success {
  background: #16a34a;
  color: #fff;
}

.ciaa-dialog-btn.primary.success:hover {
  background: #15803d;
}

.ciaa-dialog-btn.primary.danger {
  background: #e74c3c;
  color: #fff;
}

.ciaa-dialog-btn.primary.danger:hover {
  background: #c0392b;
}

.ciaa-dialog-btn.secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.ciaa-dialog-btn.secondary:hover {
  background: #e2e8f0;
}

/* Badge Indicateur de Sensibilité Backend Supabase */
.backend-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  user-select: none;
}

.backend-status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.backend-status-pill.online {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.backend-status-pill.online .dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse-dot-pub 2s infinite;
}

.backend-status-pill.offline {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.backend-status-pill.offline .dot {
  background: #f59e0b;
}

@keyframes pulse-dot-pub {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
