/* ==========================================================================
   Portail Numérique — Lycée Jean Moulin
   Thème global. Se superpose à Bootstrap 5 : on ne remplace pas la grille,
   on redéfinit surfaces, typographie et composants.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --jm-navy: #111751;
  --jm-navy-soft: #1d2673;
  --jm-accent: #3c59e7;
  --jm-accent-soft: #eef1fe;

  --jm-bg: #f4f4f6;
  --jm-surface: #ffffff;
  --jm-surface-alt: #fafafb;

  --jm-text: #14161c;
  --jm-muted: rgba(20, 22, 28, 0.6);
  --jm-faint: rgba(20, 22, 28, 0.42);
  --jm-border: rgba(17, 23, 81, 0.1);

  --jm-success: #059d79;
  --jm-warning: #d98216;
  --jm-danger: #d71302;

  --jm-radius-sm: 0.75rem;
  --jm-radius: 1.25rem;
  --jm-radius-lg: 1.75rem;

  --jm-shadow: 0 1px 2px rgba(17, 23, 81, 0.04), 0 8px 24px -12px rgba(17, 23, 81, 0.14);
  --jm-shadow-lift: 0 2px 4px rgba(17, 23, 81, 0.05), 0 18px 42px -18px rgba(17, 23, 81, 0.24);

  --jm-nav-h: 4.25rem;
}

/* --------------------------------------------------------------- Base --- */

html {
  scroll-behavior: smooth;
  /* Compense la navbar collante lors des sauts vers une ancre. */
  scroll-padding-top: calc(var(--jm-nav-h) + 1.5rem);
}

body {
  background-color: var(--jm-bg);
  color: var(--jm-text);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6,
.jm-display {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--jm-text);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-top: 0;
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); letter-spacing: -0.03em; }
h3 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); }
h4 { font-size: 1.125rem; }

a { color: var(--jm-accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--jm-navy); }

::selection { background: var(--jm-navy); color: #fff; }

:focus-visible {
  outline: 2px solid var(--jm-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.jm-muted { color: var(--jm-muted); }
.jm-lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--jm-muted); line-height: 1.65; }

/* Libellé de section : petites capitales espacées, façon éditorial. */
.jm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--jm-faint);
  margin-bottom: 0.85rem;
}
.jm-eyebrow::before {
  content: '';
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.jm-section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.jm-section-head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3rem); }

/* ------------------------------------------------------------- Navbar --- */

.jm-nav {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--jm-nav-h);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--jm-border);
}

.jm-nav .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--jm-text);
  padding: 0;
}
.jm-nav .navbar-brand:hover { color: var(--jm-navy); }

.jm-brand-mark {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.7rem;
  background: var(--jm-navy);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.jm-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.jm-brand-text small {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--jm-faint);
  letter-spacing: 0.01em;
}

.jm-nav .nav-link {
  color: var(--jm-muted);
  font-size: 0.93rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  transition: color 0.18s ease, background-color 0.18s ease;
}
.jm-nav .nav-link:hover { color: var(--jm-text); background: rgba(17, 23, 81, 0.05); }
.jm-nav .nav-link.active { color: var(--jm-navy); background: var(--jm-accent-soft); font-weight: 600; }

.jm-nav .navbar-toggler {
  border: 1px solid var(--jm-border);
  border-radius: 0.7rem;
  padding: 0.4rem 0.55rem;
  background: var(--jm-surface);
}
.jm-nav .navbar-toggler:focus { box-shadow: none; }
.jm-nav .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%2314161c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (max-width: 991.98px) {
  .jm-nav .navbar-collapse {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--jm-surface);
    border: 1px solid var(--jm-border);
    border-radius: var(--jm-radius);
    box-shadow: var(--jm-shadow);
  }
  .jm-nav .nav-link { padding: 0.6rem 0.85rem; }
}

/* Avatar utilisateur connecté */
.jm-avatar {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  background: var(--jm-accent-soft);
  color: var(--jm-navy);
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ------------------------------------------------------------ Boutons --- */

.jm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.7rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease,
              color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.jm-btn:active { transform: translateY(1px); }

.jm-btn-primary { background: var(--jm-navy); color: #fff; }
.jm-btn-primary:hover { background: var(--jm-navy-soft); color: #fff; box-shadow: var(--jm-shadow-lift); }

.jm-btn-ghost {
  background: var(--jm-surface);
  color: var(--jm-text);
  border-color: var(--jm-border);
}
.jm-btn-ghost:hover { background: var(--jm-surface-alt); color: var(--jm-navy); border-color: rgba(17, 23, 81, 0.2); }

.jm-btn-light { background: #fff; color: var(--jm-navy); }
.jm-btn-light:hover { background: rgba(255, 255, 255, 0.88); color: var(--jm-navy); }

.jm-btn-sm { padding: 0.45rem 1.1rem; font-size: 0.87rem; }

/* Variante « pilule + pastille fléchée », signature du design de référence. */
.jm-btn-arrow { padding-inline-end: 0.4rem; }
.jm-btn-arrow .jm-btn-dot {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: transform 0.2s ease;
}
.jm-btn-arrow:hover .jm-btn-dot { transform: translateX(2px); }
.jm-btn-ghost.jm-btn-arrow .jm-btn-dot { background: rgba(17, 23, 81, 0.07); }

/* Lien fléché discret */
.jm-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--jm-navy);
}
.jm-link svg { transition: transform 0.2s ease; }
.jm-link:hover { color: var(--jm-accent); }
.jm-link:hover svg { transform: translateX(3px); }

/* -------------------------------------------------------------- Cards --- */

.jm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.75rem;
  background: var(--jm-surface);
  border: 1px solid var(--jm-border);
  border-radius: var(--jm-radius);
  box-shadow: var(--jm-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.jm-card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--jm-shadow-lift);
  border-color: rgba(17, 23, 81, 0.18);
}

.jm-card h3 { margin-bottom: 0.5rem; font-size: 1.15rem; }
.jm-card p { color: var(--jm-muted); font-size: 0.94rem; margin-bottom: 1.25rem; }
.jm-card .jm-card-foot { margin-top: auto; }

.jm-card-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.15rem;
  border-radius: 0.9rem;
  background: var(--jm-accent-soft);
  color: var(--jm-navy);
  font-size: 1.35rem;
  flex-shrink: 0;
}

/* Logo d'outil : image détourée sur fond neutre */
.jm-tool-logo {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.15rem;
  padding: 0.5rem;
  border-radius: 0.9rem;
  background: var(--jm-surface-alt);
  border: 1px solid var(--jm-border);
  flex-shrink: 0;
}
.jm-tool-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Rend toute la carte cliquable sans imbriquer de liens. */
.jm-stretch::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* --------------------------------------------------------------- Hero --- */

.jm-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5rem);
}

/* Halo diffus + grille de points : profondeur sans image de fond. */
.jm-hero::before {
  content: '';
  position: absolute;
  top: -35%;
  left: 50%;
  width: min(60rem, 120%);
  height: 40rem;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(60, 89, 231, 0.13), transparent 62%);
  pointer-events: none;
}
.jm-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(17, 23, 81, 0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 65% 55% at 50% 0%, #000, transparent 72%);
  mask-image: radial-gradient(ellipse 65% 55% at 50% 0%, #000, transparent 72%);
  opacity: 0.5;
  pointer-events: none;
}
.jm-hero > * { position: relative; z-index: 1; }

.jm-hero h1 { margin-bottom: 1.25rem; }
.jm-hero .jm-lead { max-width: 38rem; }

.jm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem 0.35rem 0.7rem;
  margin-bottom: 1.5rem;
  background: var(--jm-surface);
  border: 1px solid var(--jm-border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--jm-muted);
}
.jm-badge .jm-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--jm-success);
}

/* -------------------------------------------------------- Panneau sombre --- */

.jm-panel-dark {
  background: var(--jm-navy);
  color: #fff;
  border-radius: var(--jm-radius-lg);
  padding: clamp(2rem, 5vw, 3.5rem);
}
.jm-panel-dark h1, .jm-panel-dark h2, .jm-panel-dark h3, .jm-panel-dark h4 { color: #fff; }
.jm-panel-dark p { color: rgba(255, 255, 255, 0.66); }
.jm-panel-dark a { color: rgba(255, 255, 255, 0.75); }
.jm-panel-dark a:hover { color: #fff; }

/* ------------------------------------------------------------- Footer --- */

.jm-footer { padding: 0 0 1.5rem; margin-top: auto; }

.jm-footer-inner {
  position: relative;
  overflow: hidden;
  background: var(--jm-navy);
  color: #fff;
  border-radius: var(--jm-radius-lg);
  padding: clamp(2.25rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 3.5rem) 0;
}

.jm-footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.jm-footer-top p { max-width: 24rem; color: rgba(255, 255, 255, 0.6); font-size: 0.94rem; margin: 0; }

.jm-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.02em;
}
.jm-footer-brand .jm-brand-mark { background: rgba(255, 255, 255, 0.14); }

.jm-footer-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  padding: 2.5rem 0;
}
@media (min-width: 768px) { .jm-footer-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.jm-footer-cols h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1rem;
  font-weight: 500;
}
.jm-footer-cols ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.jm-footer-cols a { font-size: 0.9rem; color: rgba(255, 255, 255, 0.58); }
.jm-footer-cols a:hover { color: #fff; }

.jm-footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.jm-footer-bottom p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}

/* ----------------------------------------------- Formulaires & modales --- */

.jm-form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--jm-text);
}

.form-control, .form-select {
  padding: 0.65rem 0.95rem;
  background: var(--jm-surface);
  border: 1px solid var(--jm-border);
  border-radius: var(--jm-radius-sm);
  font-size: 0.95rem;
  color: var(--jm-text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--jm-accent);
  box-shadow: 0 0 0 3px rgba(60, 89, 231, 0.14);
}
.form-control::placeholder { color: var(--jm-faint); }

.modal-content {
  border: none;
  border-radius: var(--jm-radius);
  box-shadow: 0 24px 64px -20px rgba(17, 23, 81, 0.35);
  overflow: hidden;
}
.modal-header { border-bottom: 1px solid var(--jm-border); padding: 1.25rem 1.5rem; }
.modal-header .modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--jm-border); padding: 1rem 1.5rem; gap: 0.5rem; }

.offcanvas { border: none; }
.offcanvas-header { border-bottom: 1px solid var(--jm-border); padding: 1.25rem 1.5rem; }
.offcanvas-body { padding: 1.5rem; }

.toast {
  border: 1px solid var(--jm-border);
  border-radius: var(--jm-radius-sm);
  box-shadow: var(--jm-shadow-lift);
}

/* -------------------------------------------------------- Contenu long --- */

/* Habille du HTML rédigé à la main (F.A.Q., actualités) sans avoir à
   annoter chaque balise : on stylise depuis le conteneur. */
.jm-prose { font-size: 0.97rem; color: var(--jm-muted); line-height: 1.7; }

.jm-prose h2 {
  margin: 0 0 0.35rem;
  color: var(--jm-text);
  font-size: clamp(1.45rem, 2.6vw, 1.8rem);
}

.jm-prose h3 {
  margin: 2rem 0 0.5rem;
  color: var(--jm-text);
  font-size: 1.22rem;
}

/* La F.A.Q. utilise les h3 comme véritables sections : on les sépare
   visuellement. Les actualités s'en servent comme sous-titres d'article,
   d'où le fait que la règle soit portée par une classe et non par .jm-prose. */
.jm-prose-sections h3 {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--jm-border);
  font-size: 1.4rem;
}
.jm-prose-sections > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Séparation entre articles successifs (page Actualités). */
.jm-prose article.blog-post { padding-top: 2.75rem; margin-top: 2.75rem; border-top: 1px solid var(--jm-border); }
.jm-prose article.blog-post:first-of-type { padding-top: 0; margin-top: 0; border-top: 0; }
/* Les <hr> du contenu hérité faisaient ce travail : ils font doublon. */
.jm-prose article.blog-post + hr, .jm-prose hr { display: none; }

.jm-prose h4 {
  margin: 1.85rem 0 0.45rem;
  color: var(--jm-text);
  font-size: 1.03rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.jm-prose p { margin-bottom: 1rem; }
.jm-prose ul, .jm-prose ol { margin: 0 0 1rem; padding-inline-start: 1.3rem; }
.jm-prose li { margin-bottom: 0.35rem; }
.jm-prose strong { color: var(--jm-text); font-weight: 600; }

.jm-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.75rem 0 1.25rem;
  border: 1px solid var(--jm-border);
  border-radius: var(--jm-radius-sm);
}

.jm-prose iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0.75rem 0 1.25rem;
  border: 0;
  border-radius: var(--jm-radius-sm);
}

.jm-prose .blog-post-meta {
  margin: -0.2rem 0 1.35rem;
  font-size: 0.8rem;
  color: var(--jm-faint);
}

/* Les anciens contenus enchaînent les <br> pour aérer : on neutralise les
   sauts consécutifs, l'espacement est désormais porté par les marges. */
.jm-prose br + br { display: none; }

/* Sommaire collant */
.jm-toc { position: sticky; top: calc(var(--jm-nav-h) + 1.5rem); }
.jm-toc a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 0.55rem;
  font-size: 0.88rem;
  color: var(--jm-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.jm-toc a:hover { background: rgba(17, 23, 81, 0.05); color: var(--jm-text); }
.jm-toc a.active { background: var(--jm-accent-soft); color: var(--jm-navy); font-weight: 600; }
.jm-toc ul { list-style: none; margin: 0; padding: 0; }

/* ------------------------------------------------------------- Utilitaires --- */

.jm-page { display: flex; flex-direction: column; min-height: 100vh; }
.jm-page > main { flex: 1; }

.jm-divider { height: 1px; background: var(--jm-border); border: 0; margin: 0; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
