/* outils-maths : complements a app.css (design repris de /Calcul-mental/) */

/* ---------- fil d'Ariane ---------- */
.fil { margin: 0 0 14px; }
.fil ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: .86rem; line-height: 1.5;
}
.fil li { display: flex; align-items: center; gap: 6px; }
.fil li + li::before { content: "\203A"; opacity: .55; }
.fil a { color: inherit; opacity: .8; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.35); }
.fil a:hover { opacity: 1; }
.fil [aria-current] { opacity: .7; }

/* ---------- chapeau et cours rediges ---------- */
.outil-intro {
  max-width: 72ch; margin: 0 0 18px;
  font-size: 1.06rem; line-height: 1.75;
}
.outil-cours { max-width: 72ch; }
.outil-cours h2 {
  margin: 26px 0 8px; font-size: 1.18rem; line-height: 1.3;
}
.outil-cours h2:first-child { margin-top: 6px; }
.outil-cours p { margin: 0 0 12px; line-height: 1.75; }
.outil-cours strong { font-weight: 700; }

/* ---------- zone reprenant l'outil d'origine ---------- */
.outil-page { padding-top: 8px; }
.outil-page img { max-width: 100%; height: auto; }
.outil-page table { max-width: 100%; }
.outil-figure + .outil-figure {
  margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(15,23,42,.12);
}
.outil-figure-titre {
  margin: 0 0 14px; font-size: 1.12rem; line-height: 1.35;
}
/* les figures d'origine debordent parfois sur petit ecran */
.outil-page canvas,
.outil-page .jxgbox,
.outil-page iframe { max-width: 100%; }
@media (max-width: 680px) {
  .outil-page .jxgbox { width: 100% !important; height: 62vw !important; }
  .outil-page iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; }
}

/* ---------- cartes de la page d'accueil du dossier ---------- */
.outil-grille {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.outil-carte {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(15,23,42,.12); border-radius: 14px;
  background: #fff; color: inherit; text-decoration: none;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
  transition: transform .16s, box-shadow .16s, border-color .16s;
  border-top: 4px solid var(--accent, #1D4ED8);
}
.outil-carte:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(15,23,42,.12);
  border-color: rgba(15,23,42,.2);
}
.outil-carte:focus-visible { outline: 3px solid #93C5FD; outline-offset: 3px; }
.outil-carte h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.outil-carte p { margin: 0; font-size: .92rem; line-height: 1.6; opacity: .82; }
.outil-lire {
  margin-top: auto; padding-top: 6px;
  font-size: .85rem; font-weight: 700; color: var(--accent, #1D4ED8);
}
.outil-lire::after { content: " \2192"; }

/* ---------- frise d'histoire pre-rendue en HTML ---------- */
.frise-statique {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin-top: 8px;
}
.frise-item {
  display: flex; flex-direction: column;
  border: 1px solid rgba(15,23,42,.12); border-radius: 14px;
  background: #fff; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.frise-date {
  padding: 8px 14px;
  font-weight: 700; font-size: .84rem; letter-spacing: .04em; text-transform: uppercase;
  background: #0f2545; color: #fff;
}
.frise-corps { padding: 14px 16px 16px; }
.frise-corps img {
  width: 100%; height: 190px; object-fit: cover;
  border-radius: 10px; margin-bottom: 12px; background: #eef2f7;
}
.frise-corps h3 { margin: 0 0 6px; font-size: 1.06rem; line-height: 1.3; }
.frise-corps p { margin: 0 0 10px; font-size: .94rem; line-height: 1.65; opacity: .85; }
.frise-apports { margin: 0; padding-left: 18px; font-size: .9rem; line-height: 1.6; }
.frise-apports li { margin-bottom: 3px; }

/* ---------- menu vertical de rappel vers le reste du site ---------- */
.outil-ailleurs {
  margin-top: 30px; padding: 16px 18px;
  border: 1px solid rgba(15,23,42,.12); border-radius: 14px; background: #f8fafc;
}
.outil-ailleurs h2 { margin: 0 0 10px; font-size: 1.05rem; }
.outil-ailleurs ul {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 8px 10px;
}
.outil-ailleurs a {
  display: inline-block; padding: 6px 12px;
  border: 1px solid rgba(15,23,42,.14); border-radius: 999px;
  font-size: .9rem; text-decoration: none; color: inherit; background: #fff;
}
.outil-ailleurs a:hover { border-color: #1D4ED8; color: #1D4ED8; }

@media print {
  .fil, .outil-ailleurs, .cycles-raccourcis { display: none !important; }
}

/* ---------- emplacements publicitaires ---------- */
.section-pub { padding: 18px 0 0; }
.pub-rectangle { margin: 0 auto; max-width: 970px; }

/* quand Google ne sert pas d'annonce, l'emplacement se replie au lieu de
   laisser un grand vide blanc (methode recommandee par AdSense) */
ins.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }
.section-pub:has(ins[data-ad-status="unfilled"]) { padding: 0; }
#pub:has(ins[data-ad-status="unfilled"]) { display: none !important; }

/* le texte SEO coule autour du carre 336x280 */
.outil-texte {
  display: flow-root;          /* contient le float sans rogner */
  max-width: 980px;
}
.outil-texte .outil-intro,
.outil-texte .outil-cours { max-width: none; }

/* sous 760 px, le carre passe en pleine largeur plutot que de comprimer le texte */
@media (max-width: 760px) {
  #pub {
    float: none !important;
    margin: 0 auto 18px !important;
    max-width: 100% !important;
    display: flex;
    justify-content: center;
  }
  #pub .adsbygoogle { max-width: 100%; }
}

@media print {
  #pub, .pub-rectangle, .section-pub { display: none !important; }
}

/* ---------- chronologie pre-rendue (frise venue de maths-college) ---------- */
.chrono-chapeau {
  max-width: 72ch; margin: 0 0 16px;
  font-size: .97rem; line-height: 1.7; opacity: .85;
}
.chrono {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: grid; gap: 0 34px;
  grid-template-columns: 1fr;
}
/* deux colonnes sur grand ecran : 76 reperes empiles font une page interminable */
@media (min-width: 1040px) {
  .chrono { grid-template-columns: 1fr 1fr; }
}
.chrono-item {
  display: grid; grid-template-columns: 132px 1fr; gap: 14px;
  align-content: start;
  padding: 13px 0;
  border-top: 1px solid rgba(15,23,42,.10);
}
.chrono-date {
  font-weight: 700; font-size: .88rem; line-height: 1.5;
  color: #1D4ED8; padding-top: 2px;
}
.chrono-corps h3 { margin: 0 0 4px; font-size: 1.02rem; line-height: 1.35; }
.chrono-corps p { margin: 0; font-size: .94rem; line-height: 1.7; opacity: .85; }

@media (max-width: 620px) {
  .chrono-item { grid-template-columns: 1fr; gap: 4px; }
  .chrono-date { padding-top: 0; }
}

/* ---------- frise interactive en iframe ---------- */
.frise-embed { margin: 6px 0 4px; }
.frise-embed iframe {
  display: block; width: 100%; height: 650px;
  border: 1px solid rgba(15,23,42,.12); border-radius: 14px; background: #fff;
}
@media (max-width: 620px) {
  .frise-embed iframe { height: 520px; }
}
@media print {
  .frise-embed { display: none !important; }
}

/* ---------- bouton de retour en haut de page ---------- */
#haut-de-page {
  position: fixed; right: 18px; bottom: 18px; z-index: 800;
  width: 48px; height: 48px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: #1D4ED8; color: #fff;
  box-shadow: 0 6px 20px rgba(15,23,42,.30);
  opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity .22s, transform .22s, background .18s;
  -webkit-tap-highlight-color: transparent;
}
#haut-de-page[hidden] { display: none; }
#haut-de-page.visible { opacity: 1; transform: none; pointer-events: auto; }
#haut-de-page:hover { background: #1E3A8A; }
#haut-de-page:focus-visible { outline: 3px solid #93C5FD; outline-offset: 3px; }
#haut-de-page svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
@media (max-width: 600px) {
  #haut-de-page { right: 14px; bottom: 14px; width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { #haut-de-page { transition: none; } }
@media print { #haut-de-page { display: none !important; } }
