/*
 * Contenu des ressources rédigées : sections, vidéo, étapes, blocs de prompt, boutons de copie.
 * Jetons, coquille, titres et pied de page vivent dans `ressource-shell.css`, chargé avant
 * cette feuille par `RessourceSurInscriptionLayout` / `RessourceAccesLibreLayout`.
 */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.step:last-child {
  margin-bottom: 0;
}

.step-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  isolation: isolate;
}

.step-marker::before {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: var(--r-dm);
  background: var(--orange);
  transform: rotate(45deg);
  z-index: -1;
}

.step-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.step-body h3:not(.step-title) {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.step-text {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.step-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.step-list li + li {
  margin-top: 8px;
}

.step-list strong {
  color: var(--ink);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-link:hover {
  background: var(--ink-2);
}

.btn-link .arrow {
  font-size: 16px;
}

.prompt-block {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  margin-top: 12px;
  margin-bottom: 0;
}

.prompt-block--main {
  border-color: rgba(37, 55, 136, 0.25);
  box-shadow: 0 2px 12px rgba(14, 20, 48, 0.04);
}

.prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.prompt-head h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.btn-copy {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-copy:hover {
  background: var(--blue-soft);
  border-color: rgba(37, 55, 136, 0.28);
}

.btn-copy:focus-visible {
  outline: 2px solid rgba(37, 55, 136, 0.35);
  outline-offset: 2px;
}

.btn-copy--primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.btn-copy--primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

.btn-copy.is-copied {
  background: rgba(37, 55, 136, 0.12);
  border-color: rgba(37, 55, 136, 0.3);
  color: var(--blue);
}

.btn-copy--primary.is-copied {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.code-wrap {
  position: relative;
}

.code-wrap.is-collapsed .code-block {
  max-height: 320px;
  overflow: hidden;
}

.code-wrap.is-collapsed::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  height: 72px;
  background: linear-gradient(to bottom, transparent, var(--ink));
  pointer-events: none;
  border-radius: 0 0 10px 10px;
}

.code-block {
  margin: 0;
  padding: 16px;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  overflow-x: auto;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.btn-expand {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-expand:hover {
  background: var(--blue-soft);
  border-color: rgba(37, 55, 136, 0.28);
  color: var(--ink);
}

.btn-expand:focus-visible {
  outline: 2px solid rgba(37, 55, 136, 0.35);
  outline-offset: 2px;
}

button.btn-copy:disabled,
button.btn-expand:disabled {
  opacity: 1;
  cursor: progress;
}

button.btn-copy.btn-copy--primary:disabled {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

button.btn-expand:disabled {
  color: var(--muted);
  background: var(--paper);
  border-color: var(--line);
}

@media (max-width: 560px) {
  .step {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .step-marker {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .step-marker::before {
    width: 22px;
    height: 22px;
  }

  .prompt-head {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-copy {
    width: 100%;
  }

  .btn-link {
    width: 100%;
    justify-content: center;
  }
}

/* --- Ressources générées depuis les collections MDX --- */

/* Numérotation automatique des étapes : le marqueur n'est plus écrit à la main. */
.steps {
  counter-reset: step;
}

.step {
  counter-increment: step;
}

.step-marker::after {
  content: counter(step);
}

/* Le corps d'une étape est rédigé en Markdown : mêmes styles que .step-text / .step-list. */
.step-body > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.step-body > ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.step-body > ul li + li {
  margin-top: 8px;
}

.step-body > ul strong {
  color: var(--ink);
}

.step-body > p:last-child,
.step-body > ul:last-child {
  margin-bottom: 0;
}

/* --- Sections de ressource (titre h2 + corps) --- */

.rl-section + .rl-section {
  margin-top: 2.4em;
}

.rl-section-title {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

.rl-section-body > p {
  margin: 0 0 1.15em;
}

.rl-section-body > p:last-child {
  margin-bottom: 0;
}

/* --- Lecteur YouTube (iframe natif, ou placeholder) --- */

.rl-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.rl-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.rl-video--pending {
  display: grid;
  place-items: center;
}

.rl-video--pending p {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}
