/* =========================================================
   BANGOUA-IT
   Espace NSI
   ========================================================= */


/* =========================================================
   1. THÈMES PAR NIVEAU
   ========================================================= */

.theme-premiere {
  --accent: #0ea5e9;
}

.theme-terminale {
  --accent: #10b981;
}


/* =========================================================
   2. PAGE D'ENTRÉE NSI
   ========================================================= */

.nsi-home-hero {
  padding: 2.4rem 0 2.2rem;

  background:
    radial-gradient(
      circle at 80% 20%,
      rgba(14, 165, 233, .16),
      transparent 30%
    ),
    linear-gradient(
      135deg,
      #071525,
      #0d2238
    );

  color: #fff;
}

.nsi-home-eyebrow {
  display: block;

  margin-bottom: .45rem;

  color: #38bdf8;

  font-size: .78rem;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: .08em;
}

.nsi-home-hero h1 {
  margin: 0;

  color: #fff;

  font-size:
    clamp(
      2.2rem,
      1.75rem + 1.3vw,
      3.1rem
    );

  line-height: 1.05;
}

.nsi-home-hero h1 span {
  display: block;

  margin-top: .35rem;

  color: #bae6fd;

  font-size: .45em;
  font-weight: 500;
}

.nsi-home-lead {
  max-width: 760px;

  margin: 1rem 0 0;

  color: #dbeafe;

  font-size: 1.05rem;
  line-height: 1.6;
}


/* =========================================================
   3. CONTENU DE L'ACCUEIL NSI
   ========================================================= */

.nsi-home-content {
  padding-top: 2.3rem;
  padding-bottom: 3rem;
}

.nsi-home-heading {
  margin-bottom: 1.6rem;
}

.nsi-home-kicker {
  display: block;

  margin-bottom: .3rem;

  color: #0284c7;

  font-size: .78rem;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: .08em;
}

.nsi-home-heading h2 {
  margin: 0 0 .65rem;

  color: #0f172a;

  font-size:
    clamp(
      1.6rem,
      1.4rem + .6vw,
      2rem
    );
}

.nsi-home-heading p {
  max-width: 760px;

  margin: 0;

  color: #64748b;

  line-height: 1.6;
}


/* =========================================================
   4. CARTES PREMIÈRE / TERMINALE
   ========================================================= */

.nsi-levels {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 1.2rem;
}

.nsi-level-card {
  display: flex;
  flex-direction: column;

  min-height: 100%;

  padding: 1.5rem;

  border: 1px solid #dbe5ef;
  border-radius: 18px;

  background: #fff;

  box-shadow:
    0 10px 30px rgba(15, 23, 42, .06);
}

.nsi-level-card.premiere {
  border-top: 4px solid #2563eb;
}

.nsi-level-card.terminale {
  border-top: 4px solid #10b981;
}

.nsi-level-header {
  margin-bottom: 1rem;
}

.nsi-level-badge {
  display: inline-block;

  margin-bottom: .7rem;

  padding: .35rem .65rem;

  border-radius: 999px;

  font-size: .76rem;
  font-weight: 800;
}

.nsi-level-card.premiere .nsi-level-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.nsi-level-card.terminale .nsi-level-badge {
  background: #d1fae5;
  color: #047857;
}

.nsi-level-card h3 {
  margin: 0 0 .55rem;

  color: #0f172a;

  font-size: 1.25rem;
}

.nsi-level-card p {
  margin: 0;

  color: #64748b;

  line-height: 1.6;
}

.nsi-level-topics {
  flex: 1;

  margin: .4rem 0 1.2rem;
  padding-left: 1.1rem;

  color: #475569;

  line-height: 1.75;
}

.nsi-level-link {
  align-self: flex-start;

  font-weight: 700;
  text-decoration: none;
}

.nsi-level-card.premiere .nsi-level-link {
  color: #2563eb;
}

.nsi-level-card.terminale .nsi-level-link {
  color: #059669;
}

.nsi-level-link:hover {
  text-decoration: underline;
}


/* =========================================================
   5. NAVIGATION ENTRE PREMIÈRE ET TERMINALE
   ========================================================= */

.level-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;

  margin-top: 12px;
}

.level-tabs .btn {
  border-color: var(--accent);
}

.level-tabs .btn.active {
  background: var(--accent);
  color: #fff;
}

.theme-premiere .level-tabs .btn {
  border-color: #93c5fd;
  color: #1e3a8a;
}

.theme-terminale .level-tabs .btn {
  border-color: #86efac;
  color: #065f46;
}

.theme-premiere .level-tabs .btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.theme-terminale .level-tabs .btn.active {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}


/* =========================================================
   6. PROGRESSION PREMIÈRE
   ========================================================= */

.steps-cards {
  display: grid;

  gap: 16px;

  grid-template-columns:
    repeat(auto-fit, minmax(260px, 1fr));
}


/*
 * Chaque carte représente une rubrique complète.
 * Toute la carte est cliquable.
 */

.step-card {
  display: block;

  padding: 16px;

  background: var(--card);

  border: 1px solid var(--border);
  border-radius: 16px;

  box-shadow: var(--shadow);

  color: inherit;
  text-decoration: none;

  transition:
    transform .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

.step-card:hover {
  transform: translateY(-2px);

  border-color: #93c5fd;

  box-shadow:
    0 12px 30px rgba(15, 23, 42, .10);
}

.step-card:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.step-title {
  margin: 0 0 .6rem;

  color: #2563eb;

  font-size: 1rem;
  font-weight: 700;
}

.step-desc {
  margin: 0;

  color: var(--muted);

  line-height: 1.6;
}


/* =========================================================
   7. PROGRESSION TERMINALE
   ========================================================= */

.timeline {
  position: relative;

  margin-left: 6px;
  padding-left: 22px;

  border-left: 3px solid var(--accent);
}


/*
 * Chaque étape de la timeline est entièrement cliquable.
 */

.timeline .tl-item {
  position: relative;

  display: block;

  margin: 12px 0;
  padding: 12px 14px;

  border: 1px solid transparent;
  border-radius: 12px;

  color: inherit;
  text-decoration: none;

  transition:
    background .18s ease,
    border-color .18s ease,
    transform .18s ease;
}

.timeline .tl-item::before {
  content: '';

  position: absolute;

  left: -30px;
  top: 18px;

  width: 12px;
  height: 12px;

  border-radius: 999px;

  background: var(--accent);

  box-shadow:
    0 0 0 3px rgba(16, 185, 129, .18);
}

.timeline .tl-item:hover {
  transform: translateX(3px);

  border-color: #bbf7d0;

  background: #f2fbf5;
}

.timeline .tl-item:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 3px;
}

.tl-title {
  margin: 0 0 .3rem;

  color: #16a34a;

  font-size: 1rem;
  font-weight: 700;
}

.tl-desc {
  margin: 0;

  color: var(--muted);

  line-height: 1.55;
}


/* =========================================================
   8. TITRES DES PAGES DE COURS
   ========================================================= */

/*
 * Ces règles sont encore conservées ici pour le moment.
 * Elles seront réexaminées lors du nettoyage de lesson.css.
 */


/* Première */

body.nsi-premiere .page-title,
body.nsi-premiere .hero h1 {
  margin-bottom: 40px;

  color: #000099;

  font-size: 2rem;
  font-weight: 700;

  text-align: center;
  text-transform: uppercase;

  text-shadow: 4px 4px 4px #aaa;
}


/* Terminale */

.level-terminale .page-header h1,
.level-terminale .prose h1 {
  color: #137b3f;

  text-transform: none;

  text-shadow:
    3px 3px 8px rgba(0, 0, 0, .18);
}


/* =========================================================
   9. IMAGES RESPONSIVES
   ========================================================= */

img {
  max-width: 100%;
  height: auto;

  display: block;
}


/* =========================================================
   10. TABLEAUX RESPONSIVES
   ========================================================= */

table {
  width: 100%;

  border-collapse: collapse;

  display: block;

  overflow-x: auto;

  -webkit-overflow-scrolling: touch;
}

table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

table tbody tr:hover {
  background-color: #f1f5f9;
}

table th,
table td {
  padding: .45rem .6rem;
}


/* =========================================================
   11. BLOCS D'ARBORESCENCE
   ========================================================= */

.tree-block {
  max-height: 520px;

  overflow: auto;

  margin: 0;
  padding: 12px 14px;

  border: 1px solid #d8dde3;
  border-radius: 14px;

  background: #fff;

  white-space: pre;

  line-height: 1.45;

  tab-size: 4;

  letter-spacing: 0 !important;
  word-spacing: 0 !important;

  font-variant-ligatures: none !important;

  font-feature-settings:
    "liga" 0,
    "calt" 0 !important;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace !important;

  font-size: 14px;
}

.tree-block code {
  font-family: inherit;
}


/* =========================================================
   12. UTILITAIRES
   ========================================================= */

.w-70 {
  width: 70%;
}

.w-60 {
  width: 60%;
}

.w-40 {
  width: 40%;
}

.w-30 {
  width: 30%;
}


/* =========================================================
   13. RESPONSIVE
   ========================================================= */

@media (max-width: 760px) {

  /*
   * Sur téléphone, les deux cartes de choix du niveau
   * passent l'une sous l'autre.
   */

  .nsi-levels {
    grid-template-columns: 1fr;
  }


  /*
   * La progression Première passe naturellement
   * sur une seule colonne lorsque l'espace devient
   * insuffisant grâce à auto-fit/minmax.
   */

  .step-card {
    padding: 14px;
  }


  /*
   * Timeline Terminale légèrement plus compacte.
   */

  .timeline {
    padding-left: 18px;
  }

  .timeline .tl-item {
    padding: 10px 12px;
  }

  .timeline .tl-item::before {
    left: -26px;
  }

}

/* =========================================================
   ACCUEIL DES RUBRIQUES NSI
   ========================================================= */

.rubrique-header {
  padding-top: 32px;
  padding-bottom: 24px;
}

.rubrique-header h1 {
  margin: 0;
  color: #0000a0;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.15;
  font-weight: 800;

  /* Neutralise les anciens effets éventuels */
  text-transform: none;
  letter-spacing: normal;
  text-shadow: none;
}


/* Grille de la rubrique */

.rubrique-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: start;
}


/* Bloc principal : contenu */

.rubrique-grid > .sidebar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow:
    0 12px 32px rgba(16, 24, 40, .06),
    0 1px 2px rgba(16, 24, 40, .04);
}


/* Présentation */

.rubrique-grid > article {
  min-width: 0;
}


/* Carte objectifs / présentation à droite */

.rubrique-grid > .objectifs {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 26px;
  box-shadow:
    0 12px 32px rgba(16, 24, 40, .06),
    0 1px 2px rgba(16, 24, 40, .04);
}


/* Responsive */

@media (max-width: 960px) {

  .rubrique-grid {
    grid-template-columns: 1fr;
  }

}

/* =========================================================
   ACCUEIL DES RUBRIQUES NSI
   ========================================================= */


/* =========================================================
   1. EN-TÊTE
   ========================================================= */

.rubrique-header{
  padding-top:2rem;
  padding-bottom:1.5rem;
}

.rubrique-header h1{
  margin:0;

  color:#0b1596;

  font-size:clamp(
    2rem,
    1.7rem + 1vw,
    2.65rem
  );

  line-height:1.15;
  font-weight:800;

  text-transform:none;
  letter-spacing:normal;
  text-shadow:none;
}


/* =========================================================
   2. PAGE
   ========================================================= */

.rubrique-page{
  padding-top:.35rem;
  padding-bottom:3rem;
}


/* =========================================================
   3. GRILLE PRINCIPALE
   ========================================================= */

.rubrique-grid{
  display:grid;

  grid-template-columns:
    280px minmax(0,1fr) 320px;

  gap:1.4rem;

  align-items:start;
}


/* =========================================================
   4. CARTES
   ========================================================= */

.rubrique-card{
  min-width:0;

  background:#fff;

  border:1px solid #dbe5ef;
  border-radius:18px;

  box-shadow:
    0 10px 30px rgba(15,23,42,.06),
    0 1px 2px rgba(15,23,42,.03);
}


/* =========================================================
   5. CARTE CONTENU
   ========================================================= */

.rubrique-content{
  padding:1.45rem 1.25rem;
}

.rubrique-content > h2{
  margin:0 0 1.15rem;

  color:#0b1596;

  font-size:1.15rem;
  font-weight:800;

  text-align:center;
}


/* =========================================================
   6. NAVIGATION DES COURS
   ========================================================= */

.rubrique-toc{
  display:flex;
  flex-direction:column;

  gap:.15rem;
}


.rubrique-link,
.rubrique-accordion summary{
  display:block;

  padding:.55rem .45rem;

  border-radius:8px;

  color:#0b1596;

  font-size:.93rem;
  font-weight:700;
  line-height:1.45;

  text-decoration:none;

  cursor:pointer;
}


.rubrique-link::before{
  content:"›";

  display:inline-block;

  margin-right:.55rem;

  color:#2563eb;

  font-weight:800;
}


.rubrique-link:hover,
.rubrique-accordion summary:hover{
  background:#eff6ff;
}


/* =========================================================
   7. ACCORDÉONS
   ========================================================= */

.rubrique-accordion{
  margin:0;

  border:0;
}


.rubrique-accordion summary{
  list-style:none;
}


.rubrique-accordion summary::-webkit-details-marker{
  display:none;
}


.rubrique-accordion summary::before{
  content:"›";

  display:inline-block;

  margin-right:.55rem;

  color:#2563eb;

  font-weight:800;

  transition:transform .15s ease;
}


.rubrique-accordion[open] summary::before{
  transform:rotate(90deg);
}


/* =========================================================
   8. SOUS-MENU
   ========================================================= */

.rubrique-submenu{
  display:flex;
  flex-direction:column;

  margin:.1rem 0 .35rem 1.35rem;
}


.rubrique-submenu a,
.rubrique-submenu span{
  padding:.38rem .55rem;

  border-radius:7px;

  color:#334155;

  font-size:.88rem;
  line-height:1.35;

  text-decoration:none;
}


.rubrique-submenu a:hover{
  background:#f1f5f9;

  color:#2563eb;
}


/* =========================================================
   9. ÉLÉMENTS NON DISPONIBLES
   ========================================================= */

.rubrique-disabled{
  color:#64748b !important;

  cursor:default;
}


.rubrique-disabled:hover{
  background:transparent !important;
}


/* =========================================================
   10. BOUTON RETOUR
   ========================================================= */

.rubrique-back{
  margin-top:1.25rem;
}


/* =========================================================
   11. CARTE PRÉSENTATION
   ========================================================= */

.rubrique-presentation{
  padding:1.65rem 1.8rem;

  background:#f8fafc;
}


.rubrique-presentation > h2{
  margin:0 0 1rem;

  color:#0b1596;

  font-size:1.35rem;
  font-weight:800;

  text-shadow:
    1px 1px 1px rgba(15,23,42,.20);
}


.rubrique-presentation p{
  margin:0 0 1rem;

  color:#334155;

  line-height:1.7;
}


.rubrique-presentation p:last-child{
  margin-bottom:0;
}


/* =========================================================
   12. CARTE OBJECTIFS
   ========================================================= */

.rubrique-objectives-card{
  padding:1.65rem 1.55rem;

  background:#f5f8ff;

  border-color:#93c5fd;
  border-left:4px solid #93c5fd;
}


.rubrique-objectives-card > h2{
  margin:0 0 1rem;

  color:#0b1596;

  font-size:1.25rem;
  font-weight:800;

  text-shadow:
    1px 1px 1px rgba(15,23,42,.22);
}


.rubrique-objectives-card ul{
  margin:0;

  padding-left:1.25rem;
}


.rubrique-objectives-card li{
  margin-bottom:.6rem;

  color:#334155;

  line-height:1.55;
}


.rubrique-objectives-card li::marker{
  color:#2563eb;
}


.rubrique-objectives-card li:last-child{
  margin-bottom:0;
}


.rubrique-muted{
  color:#64748b;

  line-height:1.6;
}


/* =========================================================
   13. BADGE DU NIVEAU
   ========================================================= */

.rubrique-level{
  margin:1.4rem 0 0;
}


/* =========================================================
   14. TERMINALE
   ========================================================= */

body.theme-terminale .rubrique-header h1{
  color:#137b3f;
}


body.theme-terminale .rubrique-content > h2,
body.theme-terminale .rubrique-presentation > h2,
body.theme-terminale .rubrique-objectives-card > h2{
  color:#137b3f;
}


body.theme-terminale .rubrique-link,
body.theme-terminale .rubrique-accordion summary{
  color:#137b3f;
}


body.theme-terminale .rubrique-link::before,
body.theme-terminale .rubrique-accordion summary::before{
  color:#16a34a;
}


body.theme-terminale .rubrique-link:hover,
body.theme-terminale .rubrique-accordion summary:hover{
  background:#ecfdf5;
}


body.theme-terminale .rubrique-objectives-card{
  background:#f4fbf6;

  border-color:#86efac;
  border-left-color:#86efac;
}


body.theme-terminale .rubrique-objectives-card li::marker{
  color:#16a34a;
}


/* =========================================================
   15. RESPONSIVE — TABLETTE
   ========================================================= */

@media (max-width:1100px){

  .rubrique-grid{
    grid-template-columns:
      250px minmax(0,1fr);
  }

  .rubrique-objectives-card{
    grid-column:1 / -1;
  }

}


/* =========================================================
   16. RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width:760px){

  .rubrique-grid{
    grid-template-columns:1fr;
  }

  .rubrique-content,
  .rubrique-presentation,
  .rubrique-objectives-card{
    grid-column:auto;
  }

  .rubrique-presentation{
    order:-1;
  }

}


/* =========================================================
   17. TRÈS PETITS ÉCRANS
   ========================================================= */

@media (max-width:520px){

  .rubrique-header{
    padding-top:1.4rem;
    padding-bottom:1rem;
  }

  .rubrique-content,
  .rubrique-presentation,
  .rubrique-objectives-card{
    padding:1.2rem;
  }

}