/* pycode.css — toolbar jour/nuit + plein écran pour blocs <pre> Python
   Usage :
   <div class="pycode-wrap">
     <div class="pycode-toolbar">
       <button onclick="pycodeToggleTheme(this)" title="Basculer jour/nuit">🌙</button>
       <button onclick="pycodeFullscreen(this)" title="Plein écran">⛶</button>
     </div>
     <pre>…code…</pre>
   </div>

   Par défaut : thème sombre (cohérent avec le rendu actuel du site).
   Après clic sur 🌙 : passage au thème clair, icône devient ☀️.
*/

.pycode-wrap {
  position: relative;
  margin: 0.5rem 0;
}

.pycode-wrap pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 2.25rem 1.25rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  font-family: 'Courier New', monospace;
  margin: 0;
}

.pycode-wrap pre .keyword { color: #cba6f7; font-weight: 500; }
.pycode-wrap pre .comment { color: #6c7086; font-style: italic; }
.pycode-wrap pre .string  { color: #a6e3a1; }

.pycode-toolbar {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 2;
}

.pycode-toolbar button {
  background: rgba(255, 255, 255, 0.10);
  color: #cdd6f4;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
}

.pycode-toolbar button:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ---- thème clair ---- */
.pycode-wrap.light pre {
  background: #f6f8fa;
  color: #24292f;
  border: 1px solid #e1e4e8;
}

.pycode-wrap.light pre .keyword { color: #d73a49; }
.pycode-wrap.light pre .comment { color: #6a737d; }
.pycode-wrap.light pre .string  { color: #22863a; }

.pycode-wrap.light .pycode-toolbar button {
  background: rgba(0, 0, 0, 0.05);
  color: #24292f;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.pycode-wrap.light .pycode-toolbar button:hover {
  background: rgba(0, 0, 0, 0.12);
}

/* ---- plein écran ---- */
.pycode-wrap.fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  margin: 0;
  padding: 1.5rem;
  background: #1e1e2e;
  display: flex;
  flex-direction: column;
}

.pycode-wrap.fullscreen.light {
  background: #f6f8fa;
}

.pycode-wrap.fullscreen pre {
  flex: 1;
  font-size: clamp(16px, 2.4vw, 28px);
  line-height: 1.7;
  border-radius: 12px;
  padding: 3rem 2rem 2rem;
}

.pycode-wrap.fullscreen .pycode-toolbar {
  top: 14px;
  right: 14px;
}

.pycode-wrap.fullscreen .pycode-toolbar button {
  font-size: 18px;
  padding: 8px 14px;
}

@media (max-width: 600px) {
  .pycode-wrap pre { font-size: 13px; padding-top: 2rem; }
  .pycode-toolbar button { font-size: 13px; padding: 3px 6px; }
}
