/* ==========================================================================
   Croix Blanche de l'Aisne — suivi des projets web
   Reprend la charte de croix-blanche02.fr (Site Web/assets/css/style.css)
   ========================================================================== */

:root {
  --navy-900: #061a3a;
  --navy: #0b2c63;
  --blue: #1f5bb8;
  --sky: #eaf1fb;
  --red: #d7141f;
  --red-600: #b50f18;
  --yellow: #f2c230;
  --green: #138a4b;
  --green-bg: #e8f7ee;
  --orange: #c26a00;
  --orange-bg: #fff4e0;

  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f8fc;
  --white: #ffffff;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / .06), 0 2px 8px rgb(15 23 42 / .05);
  --shadow: 0 10px 30px -12px rgb(11 44 99 / .25);

  --container: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 76px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.65;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--navy); }
h1, h2, h3 { color: var(--ink); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 800; }
h2 { font-size: 1.5rem; }
p { margin: 0 0 1em; }
svg { flex-shrink: 0; }
.muted { color: var(--muted); font-weight: 500; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; color: #fff; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.section { padding-block: clamp(48px, 7vw, 88px); }
.section--tight { padding-block: clamp(32px, 5vw, 56px); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--red); margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 28px; height: 3px; border-radius: 3px; background: currentColor; }

/* ---------- Boutons ---------- */
.btn {
  --b: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; border: 2px solid var(--b);
  background: var(--b); color: #fff;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:hover { color: #fff; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--red { --b: var(--red); }
.btn--red:hover { background: var(--red-600); border-color: var(--red-600); }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: var(--navy); }
.btn--sm { min-height: 40px; padding: 8px 16px; font-size: .92rem; }
.btn--block { width: 100%; }
.btn-text { background: none; border: 0; padding: 4px 0; font: inherit; font-size: .88rem; font-weight: 600; color: var(--red-600); cursor: pointer; }
.btn-text:hover { text-decoration: underline; }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; color: var(--navy); }
.link-arrow svg { width: 18px; height: 18px; transition: transform .2s ease; }
.link-arrow:hover svg { transform: translateX(4px); }
.link-arrow--back:hover svg { transform: translateX(-4px); }

/* ---------- En-tête ---------- */
.tricolor { height: 4px; background: linear-gradient(90deg, var(--navy) 0 33.3%, #fff 33.3% 66.6%, var(--red) 66.6%); }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgb(255 255 255 / .92);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); margin-right: auto; min-width: 0; }
.brand img { width: 50px; height: 50px; }
.brand-name { display: block; font-weight: 800; font-size: 1.05rem; line-height: 1.1; letter-spacing: -.01em; }
.brand-sub { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn) {
  padding: 10px 14px; border-radius: 999px; font-weight: 600; font-size: .98rem;
  color: var(--ink); text-decoration: none; transition: background .2s ease, color .2s ease;
}
.nav a:not(.btn):hover, .nav a[aria-current="page"]:not(.btn) { background: var(--sky); color: var(--navy); }
.nav .btn { margin-left: 8px; }
@media (max-width: 720px) {
  .nav a:not(.btn) { display: none; }
  .brand img { width: 42px; height: 42px; }
  .brand-name { font-size: .95rem; }
}

/* ---------- Bandeau de page ---------- */
.page-hero {
  position: relative; isolation: isolate; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 400px at 85% -10%, rgb(31 91 184 / .55), transparent 60%), var(--navy-900);
  padding-block: clamp(56px, 8vw, 96px) clamp(48px, 6vw, 72px);
}
.page-hero::after {
  content: ""; position: absolute; right: -80px; bottom: -120px; width: 380px; height: 380px; z-index: -1;
  background:
    linear-gradient(var(--red), var(--red)) center / 34% 100% no-repeat,
    linear-gradient(var(--red), var(--red)) center / 100% 34% no-repeat;
  opacity: .12; transform: rotate(-12deg); border-radius: 20px;
}
.page-hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 14px; }
.page-hero p { color: rgb(255 255 255 / .82); font-size: 1.2rem; max-width: 60ch; margin: 0; }
.page-hero .eyebrow { color: #ff8a90; }
.page-hero--compact { padding-block: clamp(40px, 6vw, 64px); }
.page-hero--compact h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }

/* Chiffres clés */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: clamp(32px, 5vw, 48px) 0 0; max-width: 760px; }
.kpis > div { background: rgb(255 255 255 / .07); border: 1px solid rgb(255 255 255 / .12); border-radius: var(--radius); padding: 18px 20px; }
.kpis dt { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgb(255 255 255 / .65); }
.kpis dd { margin: 6px 0 0; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.kpis dd small { font-size: .55em; margin-left: 2px; color: rgb(255 255 255 / .7); }
.kpis__date { font-size: clamp(1.15rem, 2.4vw, 1.5rem) !important; padding-top: 6px; }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr; } }

/* ---------- Mise en page ---------- */
.status-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 960px) { .status-layout { grid-template-columns: 1fr; } }
.projects { display: grid; gap: 24px; }
.empty { background: #fff; border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Carte projet ---------- */
.project { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 3.5vw, 34px); box-shadow: var(--shadow-sm); scroll-margin-top: calc(var(--header-h) + 20px); }
.project__head { display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; }
.project__head h2 { margin: 12px 0 6px; font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
.project__desc { color: var(--muted); margin: 0; }

.ring {
  --p: 0; --size: 96px;
  width: var(--size); height: var(--size); border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--red) calc(var(--p) * 1%), var(--sky) 0);
  display: grid; place-items: center;
}
.ring span {
  width: calc(var(--size) - 18px); height: calc(var(--size) - 18px); border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; gap: 1px;
  font-weight: 800; font-size: 1.5rem; color: var(--navy); font-variant-numeric: tabular-nums;
}
.ring small { font-size: .55em; }
@media (max-width: 520px) { .ring { --size: 76px; } .ring span { font-size: 1.15rem; } }

.bar { height: 8px; border-radius: 99px; background: var(--sky); overflow: hidden; margin: 22px 0 16px; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy), var(--blue) 60%, var(--red)); }
.bar--sm { height: 6px; margin: 10px 0 6px; }

.meta { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: .95rem; align-items: center; }
.meta strong { color: var(--ink); font-weight: 600; margin-right: 4px; }

/* Pastilles de statut */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--planifie { background: var(--sky); color: var(--blue); }
.pill--en_cours { background: #fdecee; color: var(--red); }
.pill--en_cours::before { animation: pulse 1.6s ease-in-out infinite; }
.pill--en_pause { background: var(--orange-bg); color: var(--orange); }
.pill--termine { background: var(--green-bg); color: var(--green); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Étapes ---------- */
.steps { list-style: none; padding: 0; margin: 24px 0 0; border-top: 1px solid var(--line); padding-top: 24px; }
.step { position: relative; display: flex; gap: 16px; padding-bottom: 22px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--line); }
.step--termine:not(:last-child)::before { background: var(--navy); }
.step__dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  border: 2.5px solid var(--line); background: #fff; color: #fff; position: relative; z-index: 1;
}
.step__dot svg { width: 15px; height: 15px; }
.step--termine .step__dot { background: var(--navy); border-color: var(--navy); }
.step--en_cours .step__dot { border-color: var(--red); box-shadow: 0 0 0 5px rgb(215 20 31 / .12); }
.step--en_cours .step__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.step--bloque .step__dot { background: var(--orange); border-color: var(--orange); }
.step__body { min-width: 0; padding-top: 1px; }
.step__title { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.step__title strong { color: var(--ink); }
.step--a_faire .step__title strong { color: var(--muted); font-weight: 600; }
.step__body p { margin: 4px 0 0; font-size: .95rem; color: var(--muted); }
.step__body time { display: block; margin-top: 4px; font-size: .85rem; color: var(--muted); }

.tag { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; }
.tag--a_faire { background: var(--bg); color: var(--muted); }
.tag--en_cours { background: #fdecee; color: var(--red); }
.tag--termine { background: var(--green-bg); color: var(--green); }
.tag--bloque, .tag--retard { background: var(--orange-bg); color: var(--orange); }

/* ---------- Journal ---------- */
.journal { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); position: sticky; top: calc(var(--header-h) + 24px); }
@media (max-width: 960px) { .journal { position: static; } }
.journal__title { font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; color: var(--navy); margin-bottom: 18px; }
.journal ul, .admin-journal { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.entry { padding-left: 14px; border-left: 3px solid var(--blue); }
.entry--livraison { border-color: var(--green); }
.entry--alerte { border-color: var(--red); }
.entry time { font-size: .8rem; color: var(--muted); font-weight: 600; }
.entry__projet { display: block; font-size: .85rem; font-weight: 700; color: var(--ink); }
.entry p { margin: 2px 0 0; font-size: .95rem; }

/* ---------- Administration ---------- */
.admin-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 30px); box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.admin-grid .panel { margin-bottom: 0; }
.panel h2 { font-size: 1.25rem; }
.panel--login { max-width: 420px; margin-inline: auto; }
.panel--danger { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; border-color: #f5c2c6; }
.panel--danger p { margin: 0; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; color: var(--ink); font-size: .95rem; margin-bottom: 6px; }
.field .req { color: var(--red); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; } }
input[type="text"], input[type="url"], input[type="date"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgb(31 91 184 / .15); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.alert { border-radius: 12px; padding: 12px 16px; font-weight: 600; margin-bottom: 18px; }
.alert--ok { background: var(--green-bg); color: #116b3a; }
.alert--error { background: #fdecee; color: var(--red-600); }

.admin-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.admin-list li { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; transition: border-color .2s ease; }
.admin-list li:hover { border-color: var(--blue); }
.admin-list a { display: flex; justify-content: space-between; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); }
.admin-list small { color: var(--muted); }
.admin-journal { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.admin-journal form { margin-top: 2px; }

.etapes-admin { display: grid; gap: 10px; }
.etape-form {
  display: grid; grid-template-columns: 70px minmax(0, 2fr) 150px 170px; gap: 10px; align-items: center;
  padding: 12px; border-radius: 14px; background: var(--bg);
}
.etape-form--new { background: #fff; border: 1.5px dashed var(--line); }
.etape-form input, .etape-form select { padding: 9px 12px; font-size: .95rem; }
.etape-form__desc { grid-column: 2 / 4; }
.etape-form__btns { display: flex; gap: 14px; align-items: center; }
@media (max-width: 860px) {
  .etape-form { grid-template-columns: 70px 1fr; }
  .etape-form__desc, .etape-form__btns { grid-column: 1 / -1; }
}

/* ---------- Pied de page ---------- */
.site-footer { background: var(--navy-900); color: rgb(255 255 255 / .55); }
.footer-bottom { padding-block: 24px; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-size: .88rem; }
.footer-bottom a { color: rgb(255 255 255 / .75); text-decoration: none; }
.footer-bottom a:hover { color: #fff; text-decoration: underline; }

/* ---------- Écran de chargement ---------- */
.loader { display: none; }
.js .loader {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: radial-gradient(900px 400px at 80% -10%, rgb(31 91 184 / .5), transparent 60%), var(--navy-900);
  transition: opacity .45s ease, visibility .45s;
}
.js .loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader__inner { display: grid; justify-items: center; gap: 22px; }
.loader__ring {
  position: relative; width: 116px; height: 116px; border-radius: 50%;
  display: grid; place-items: center;
}
.loader__ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--red) 0 28%, rgb(255 255 255 / .12) 28%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: loader-spin 1s linear infinite;
}
.loader__ring img { width: 84px; height: 84px; border-radius: 50%; background: #fff; padding: 5px; animation: loader-beat 1.6s ease-in-out infinite; }
.loader__bar { width: 160px; height: 4px; border-radius: 4px; background: rgb(255 255 255 / .12); overflow: hidden; }
.loader__bar span {
  display: block; width: 45%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--navy) 0 33.3%, #fff 33.3% 66.6%, var(--red) 66.6%);
  animation: loader-slide 1.2s ease-in-out infinite;
}
.loader__text { margin: 0; color: rgb(255 255 255 / .75); font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
@keyframes loader-spin { to { transform: rotate(1turn); } }
@keyframes loader-beat { 50% { transform: scale(.94); } }
@keyframes loader-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(240%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
