/* Sujets du bac NSI (bac-nsi.html, générée par scripts/build-bac.js).
   Même coque que les hubs (css/hub.css : bandeau d'encre, étiquettes, boutons) ; les composants propres à la page sont préfixés .bc-.
   Identité inchangée : encre, crème, un seul accent rouge ; le reste ne sert qu'à lire (étiquettes d'état en teintes douces). */

.hb--bac .bc-head {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.95fr);
}

.hb--bac .hb-h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 5.6vw, 4.6rem);
  line-height: 1.02;
  overflow-wrap: normal;
  text-wrap: balance;
}

.hb--bac .hb-lead {
  max-width: 38rem;
}

/* Quatre chiffres seulement : la grille des hubs en prévoit cinq. */
.hb--bac .bc-stats {
  grid-template-columns: repeat(4, minmax(0, auto));
  gap: 1.2rem clamp(1.4rem, 2.6vw, 2.4rem);
}

/* « 3 h 30 » est plus large que les autres chiffres : il ne doit pas toucher le filet de la colonne suivante. */
.hb--bac .bc-stats > div {
  padding-right: 0.3rem;
}

.hb--bac .bc-stats dd {
  font-size: clamp(1.6rem, 2.7vw, 2.2rem);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  /* hub.css passe le bandeau sur une colonne ici ; sans cette règle, la deuxième colonne de .bc-head ci-dessus resterait. */
  .hb--bac .bc-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .hb--bac .bc-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .hb--bac .bc-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- sections ---------- */

.bc-section {
  padding-top: clamp(2.2rem, 4.8vw, 3.4rem);
  padding-bottom: clamp(0.4rem, 1.5vw, 1rem);
}

.bc-section + .bc-section {
  margin-top: clamp(1rem, 2.5vw, 1.6rem);
  border-top: 1px solid var(--hb-line-2);
}

.bc-last {
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

.bc-section > .hb-label {
  margin-bottom: 0.9rem;
}

.bc-lead {
  max-width: 47rem;
  margin: 0 0 1.6rem;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.65;
  color: var(--hb-ink-2);
}

.bc-note {
  max-width: 47rem;
  margin: 1.1rem 0 0;
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--hb-ink-2);
}

.bc-h3 {
  margin: 2.4rem 0 0.7rem;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hb-ink);
}

/* .hb a (hub.css) a un sélecteur plus précis qu'une simple classe : on préfixe pour passer devant. */
.hb--bac .bc-note a,
.hb--bac .bc-resources a,
.hb--bac .bc-links a,
.hb--bac .bc-pdf {
  color: var(--hb-accent-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(168, 42, 22, 0.4);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.hb--bac .bc-note a:hover,
.hb--bac .bc-resources a:hover,
.hb--bac .bc-links a:hover,
.hb--bac .bc-pdf:hover {
  text-decoration-color: currentColor;
}

/* ---------- format de l'épreuve ---------- */

.bc-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1.2rem;
  padding: 0;
  list-style: none;
}

.bc-card {
  padding: 1.25rem 1.2rem 1.4rem;
  border: 1px solid var(--hb-line);
  border-radius: 12px;
  background: var(--hb-card);
  box-shadow: 0 8px 24px -22px rgba(20, 20, 26, 0.55);
}

.bc-card__k {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hb-ink-3);
}

.bc-card__big {
  margin: 0.55rem 0 0.65rem;
  font-size: clamp(1.7rem, 2.6vw, 2.2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--hb-ink);
}

.bc-card__t {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--hb-ink-2);
}

@media (max-width: 1000px) {
  .bc-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .bc-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Les trois étapes du format : un fil vertical, la dernière (la session en cours) en encre pleine. */
.bc-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--hb-line-2);
}

.bc-steps li {
  position: relative;
  max-width: 52rem;
  padding: 0.45rem 0 1rem 1.5rem;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--hb-ink-2);
}

.bc-steps li::before {
  content: "";
  position: absolute;
  top: 0.95rem;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--hb-ink-3);
  border-radius: 50%;
  background: var(--hb-cream);
}

.bc-steps li:last-child::before {
  border-color: var(--hb-ink);
  background: var(--hb-ink);
}

.bc-steps b {
  color: var(--hb-ink);
}

/* ---------- les sujets, année par année ---------- */

.bc-years {
  border-top: 2px solid var(--hb-ink);
}

.bc-year {
  border-bottom: 1px solid var(--hb-line-2);
}

.bc-year > summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0.4rem;
  list-style: none;
  cursor: pointer;
  transition: background 0.18s ease;
}

.bc-year > summary::-webkit-details-marker {
  display: none;
}

.bc-year > summary:hover {
  background: var(--hb-card);
}

.bc-year > summary:focus-visible {
  outline: 2px solid var(--hb-accent-deep);
  outline-offset: 2px;
  border-radius: 6px;
}

.bc-year__n {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--hb-ink);
}

.bc-year__d {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--hb-ink-2);
}

.bc-year > summary::after {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  margin: -0.2rem 0.2rem 0 0.3rem;
  border-right: 2px solid var(--hb-ink);
  border-bottom: 2px solid var(--hb-ink);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.bc-year[open] > summary::after {
  margin-top: 0.25rem;
  transform: rotate(-135deg);
}

.bc-year__body {
  padding: 0.2rem 0.4rem 1.7rem;
}

.bc-kind {
  margin: 1.3rem 0 0.5rem;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hb-ink-2);
}

.bc-year__body > .bc-kind:first-child {
  margin-top: 0.3rem;
}

.bc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.bc-table th,
.bc-table td {
  padding: 0.6rem 0.6rem 0.6rem 0;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--hb-line);
}

.bc-table thead th {
  border-top: 0;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hb-ink-3);
}

.bc-table tbody th {
  width: 15rem;
  font-weight: 700;
  color: var(--hb-ink);
}

.bc-subject {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 1.3rem 0.15rem 0;
  white-space: nowrap;
}

.hb--bac .bc-alt {
  color: var(--hb-ink-2);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(74, 74, 82, 0.4);
  text-underline-offset: 0.18em;
}

.hb--bac .bc-alt:hover {
  color: var(--hb-ink);
  text-decoration-color: currentColor;
}

@media (max-width: 560px) {
  .bc-table tbody th {
    width: 7.5rem;
  }

  .bc-subject {
    margin-right: 0.9rem;
  }
}

/* ---------- sources et pratique ---------- */

.bc-resources {
  display: grid;
  max-width: 52rem;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--hb-ink);
}

.bc-resources li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2rem 1.5rem;
  padding: 0.85rem 0.2rem;
  border-bottom: 1px solid var(--hb-line-2);
  font-size: 0.97rem;
}

.bc-resources span {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--hb-ink-2);
}

/* ---------- ce qui revient, et où le travailler ---------- */

.bc-themes {
  width: 100%;
  border-collapse: collapse;
}

.bc-themes th,
.bc-themes td {
  padding: 1.05rem 1rem 1.2rem 0;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--hb-line-2);
}

.bc-themes thead th {
  padding-top: 0.5rem;
  padding-bottom: 0.7rem;
  border-top: 2px solid var(--hb-ink);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hb-ink-3);
}

.bc-themes tbody th {
  width: 17rem;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--hb-ink);
}

.bc-freq {
  width: 11.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--hb-ink-2);
  white-space: nowrap;
}

.bc-squares {
  display: inline-flex;
  gap: 3px;
  margin-right: 0.6rem;
  vertical-align: -1px;
}

.bc-squares i {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 2px;
  background: var(--hb-line-2);
}

.bc-squares i.is-on {
  background: var(--hb-ink);
}

.bc-site p {
  max-width: 44rem;
  margin: 0.5rem 0 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--hb-ink-2);
}

.bc-status {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.bc-status--cours {
  background: var(--hb-ink);
  color: var(--hb-on-ink);
}

.bc-status--partiel {
  border-color: #d9c79d;
  background: var(--hb-amber-soft);
  color: #71420c;
}

.bc-status--absent {
  border-color: #edb3a8;
  background: var(--hb-accent-soft);
  color: #842516;
}

.bc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.3rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.93rem;
}

.bc-links li {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

/* Sur téléphone, chaque thème devient une fiche : la table de trois colonnes ne tient pas. Les rôles ARIA gardent le sens de
   tableau, que display: block ferait perdre à certains lecteurs d'écran. */
@media (max-width: 760px) {
  .bc-themes,
  .bc-themes tbody,
  .bc-themes tr,
  .bc-themes th,
  .bc-themes td {
    display: block;
    width: auto;
  }

  .bc-themes thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .bc-themes tr {
    padding: 1.1rem 0 1.25rem;
    border-top: 1px solid var(--hb-line-2);
  }

  .bc-themes tbody tr:first-child {
    border-top: 2px solid var(--hb-ink);
  }

  .bc-themes th,
  .bc-themes td {
    padding: 0;
    border: 0;
  }

  .bc-themes tbody th {
    width: auto;
  }

  .bc-freq {
    width: auto;
    margin: 0.4rem 0 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bc-year > summary,
  .bc-year > summary::after {
    transition: none;
  }
}

/* Chiffres alignés sur une même ligne : les légendes (une ou deux lignes) ont toutes la même hauteur. */
.hb--bac .bc-stats dt {
  min-height: 2.5em;
}
