@import url("./base.css");

/* ==========================================================
   Pages d'articles
   Les classes utilisées dans "outils redaction" sont conservées :
   img-article, encadre-bleu, encadre-orange, etape, console,
   objectif, sommaire, side-panel
   ========================================================== */

main .wrap {
  max-width: 46rem;
}

main a { color: var(--accent); }
main a:hover { color: var(--accent-hover); }

/* ---------- En-tête de l'article ---------- */

.article-head {
  padding: 4.5rem 0 2.5rem;
}
.article-head time {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 1rem;
}
.article-head time::before {
  content: "";
  width: 1.5rem;
  height: 2px;
  background: var(--accent);
}
.article-head h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
}

/* ---------- Objectif de lecture ---------- */

.objectif {
  position: relative;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.25rem 1.5rem;
  margin: 0 0 2rem;
}
.objectif .label,
.sommaire .label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.objectif p { margin: 0; }
.objectif p + p { margin-top: 0; }

/* ---------- Sommaire ---------- */

.sommaire {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 0 0 3rem;
}
.sommaire .label { color: var(--muted); }
.sommaire ol {
  list-style: none;
  counter-reset: som;
  margin: 0;
  padding: 0;
}
.sommaire li {
  counter-increment: som;
  border-top: 1px solid var(--line);
}
.sommaire li:first-child { border-top: none; }
.sommaire a {
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.55rem 0;
  color: var(--ink);
  text-decoration: none;
}
.sommaire a::before {
  content: counter(som, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}
.sommaire a:hover { color: var(--accent); }
.sommaire a:hover::before { color: var(--accent); }

/* ---------- Corps de l'article ---------- */

article h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.85rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 3.5rem 0 1rem;
  scroll-margin-top: 6rem;
}
article h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 3.5rem 0 1.1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 6rem;
}
article > h3:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
article h4 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 2rem 0 0.6rem;
  scroll-margin-top: 6rem;
}
article p {
  margin: 0 0 1.15rem;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
article p strong { color: var(--ink); font-weight: 600; }

article ol,
article ul {
  margin: 0 0 1.5rem;
  padding-left: 1.4rem;
}
article li { margin-bottom: 0.45rem; padding-left: 0.25rem; }
article li::marker {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent);
}

article img.img-article {
  display: block;
  width: 100%;
  max-width: 36rem;
  height: auto;
  margin: 1.75rem auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Étapes (projets) ---------- */

.etape {
  position: relative;
  margin: 0 0 1.25rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.etape:last-child { margin-bottom: 0; }
.etape h4 {
  margin: 0 0 0.75rem;
  font-size: 1.12rem;
}
.etape img.img-article {
  margin: 1rem auto;
  box-shadow: none;
}
.etape p:last-child { margin-bottom: 0; }

/* ---------- Encadré bleu (à retenir) ---------- */

.encadre-bleu {
  position: relative;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.4rem 1.1rem 3.25rem;
  margin: 1.75rem 0;
}
.encadre-bleu::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  top: 1.3rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.encadre-bleu p { text-align: left; }
.encadre-bleu p:last-child { margin-bottom: 0; }

/* ---------- Encadré orange (tableaux) ---------- */

.encadre-orange {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin: 1.75rem 0;
  overflow-x: auto;
}
.encadre-orange table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
.encadre-orange caption {
  text-align: left;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--orange);
  margin-bottom: 0.75rem;
}
.encadre-orange th,
.encadre-orange td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.encadre-orange th {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  background: var(--orange-soft);
}
.encadre-orange td { font-variant-numeric: tabular-nums; }
.encadre-orange tr:last-child td { border-bottom: none; }

/* ---------- Bloc de code ---------- */

pre.console {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  padding: 2.75rem 1.25rem 1.25rem;
  margin: 1.75rem 0;
  max-height: 40rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.65;
  tab-size: 2;
}
pre.console::before {
  content: "";
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 1.1rem 0 0 #f59e0b, 2.2rem 0 0 #22c55e;
}
pre.console code.hljs {
  background: transparent;
  color: inherit;
  padding: 0;
  font-family: inherit;
  overflow: visible;
}

/* ---------- Pied de page ---------- */

footer { text-align: center; }

/* ---------- Panneaux latéraux (grands écrans) ---------- */

.side-panel {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 13rem;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.88rem;
  z-index: 20;
}
.side-panel .side-label {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
  color: var(--muted);
}
.side-panel ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.9rem;
  border-left: 1px solid var(--line);
  counter-reset: mini;
}
.side-panel li { counter-increment: mini; }
.side-panel a,
.side-panel button {
  display: block;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  font: inherit;
  text-align: left;
  padding: 0.35rem 0;
  line-height: 1.4;
  cursor: pointer;
}
.side-panel ol a::before {
  content: counter(mini, decimal-leading-zero) "  ";
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: pre;
}
.side-panel a:hover,
.side-panel button:hover { color: var(--accent); }
.side-right button {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.side-right button:hover { border-color: var(--accent); }

.side-left,
.side-right {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.side-left.visible,
.side-right.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-left { left: calc(50% - 23rem - 3.5rem - 13rem); }
.side-right {
  right: calc(50% - 23rem - 3.5rem - 13rem);
  align-items: flex-start;
}

@media (min-width: 86rem) {
  .side-panel { display: flex; }
}

@media (max-width: 34rem) {
  .encadre-orange { padding: 0.85rem; }
  .etape { padding: 1.1rem; }
  .encadre-bleu { padding-left: 2.9rem; }
  .encadre-bleu::before { left: 0.9rem; }
  article p { text-align: left; }
}
