/* tutoriel.css — single-column tutorial: prose, inline TOC, custom blocks. */

.tut { padding-top: 1.5rem; position: relative; }

/* ---- Right-margin TOC (sticky), like a docs sidebar ----------------- */
.tut-toc {
  position: absolute; top: 0; left: 100%; height: 100%;
  margin-left: 2rem; width: 11rem;
}
.toc-rail { position: sticky; top: 6rem; }
.toc-title { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; color: var(--fg-faint); margin-bottom: .7rem; }
.toc { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--border); }
.toc li { margin: 0; }
.toc a { display: block; padding: .28rem 0 .28rem .9rem; margin-left: -1px; border-left: 1px solid transparent; color: var(--fg-muted); font-size: .88rem; line-height: 1.35; }
.toc a:hover { color: var(--fg); text-decoration: none; border-left-color: var(--border-strong); }
.toc a.is-current { color: var(--fg); border-left-color: var(--fg); }
.toc-h3 a { padding-left: 1.7rem; font-size: .84rem; }

/* Hide the margin TOC when there isn't room for it beside the column. */
@media (max-width: 1140px) { .tut-toc { display: none; } }

/* ---- Header ---------------------------------------------------------- */
.tut-breadcrumb { margin-bottom: 1.25rem; font-size: .9rem; }
.tut-breadcrumb a { color: var(--fg-muted); }
.tut-header { margin-bottom: 2rem; }
.tut-badge {
  display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: .2rem .6rem; border-radius: 999px; margin-bottom: .8rem;
  border: 1px solid var(--border-strong);
}
.tut-badge.node-milestone { color: var(--node-milestone); border-color: color-mix(in srgb, var(--node-milestone) 50%, transparent); }
.tut-badge.node-section   { color: var(--node-section);   border-color: color-mix(in srgb, var(--node-section) 50%, transparent); }
.tut-badge.node-step      { color: var(--node-step);      border-color: color-mix(in srgb, var(--node-step) 50%, transparent); }
.tut-title { margin: 0 0 .4rem; }
.tut-subtitle { font-size: 1.2rem; color: var(--fg-muted); font-style: italic; }
.tut-empty { color: var(--fg-muted); }

/* ---- Prose ----------------------------------------------------------- */
.prose { font-size: 1.02rem; }
.prose > * + * { margin-top: 1.15rem; }
.prose p { color: var(--fg); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: .35rem; }
.prose-heading { scroll-margin-top: 90px; margin-top: 2.4rem; }
.prose-heading .anchor {
  opacity: 0; margin-left: .4rem; color: var(--fg-faint); text-decoration: none; font-weight: 400;
}
.prose-heading:hover .anchor { opacity: 1; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: .2rem 0 .2rem 1.2rem;
  color: var(--fg-muted); font-style: italic;
}
.prose img { border-radius: var(--radius-sm); }

/* ---- Inline & block code -------------------------------------------- */
.prose code:not(.hljs) {
  background: var(--bg-elev-2); padding: .12em .4em; border-radius: 5px;
  font-size: .9em; border: 1px solid var(--border);
}
.tut-body pre {
  position: relative; background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; overflow: auto; font-size: .9rem; line-height: 1.6;
}
.tut-body pre code { background: none; border: 0; padding: 0; }
.code-copy {
  position: absolute; top: .55rem; right: .55rem; font-size: .72rem; font-weight: 600;
  padding: .25rem .6rem; border-radius: 6px; background: var(--bg-elev-2);
  border: 1px solid var(--border-strong); color: var(--fg-muted); opacity: 0; transition: opacity .15s, color .15s;
}
.tut-body pre:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--fg); }
.code-copy.is-copied { color: var(--node-step); }

/* ---- Callouts: one flat colour, no border --------------------------- */
.callout {
  border: 0; border-radius: var(--radius-sm);
  padding: 1rem 1.15rem; background: var(--callout-info-bg);
}
.callout-head { display: flex; align-items: center; gap: .55rem; font-weight: 700; margin-bottom: .35rem; }
.callout-icon { font-size: 1.1rem; }
.callout-body > * + * { margin-top: .6rem; }
.callout-body { color: var(--fg); }
.callout-info      { background: var(--callout-info-bg); }
.callout-astuce    { background: var(--callout-astuce-bg); }
.callout-attention { background: var(--callout-attention-bg); }
.callout-piege     { background: var(--callout-piege-bg); }
.callout-note      { background: var(--callout-note-bg); }
.callout-info      .callout-title { color: var(--callout-info-bd); }
.callout-astuce    .callout-title { color: var(--callout-astuce-bd); }
.callout-attention .callout-title { color: var(--callout-attention-bd); }
.callout-piege     .callout-title { color: var(--callout-piege-bd); }
.callout-note      .callout-title { color: var(--fg); }

/* ---- Equations ------------------------------------------------------- */
.equation-block { margin: 1.6rem 0; text-align: center; overflow-x: auto; }
.equation-caption { margin-top: .5rem; font-size: .85rem; color: var(--fg-muted); }
.katex-target { color: var(--fg); }

/* ---- Downloads ------------------------------------------------------- */
.downloads { display: grid; gap: .5rem; margin: 1.4rem 0; }
.dl-card {
  display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: background .15s; color: var(--fg);
}
.dl-card:hover { text-decoration: none; background: var(--bg-elev-2); color: var(--fg); }
.dl-ext {
  font-family: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  background: var(--bg-elev-2); color: var(--fg-muted); padding: .3rem .5rem; border-radius: 4px; min-width: 3rem; text-align: center;
}
.dl-meta { display: flex; flex-direction: column; }
.dl-name { font-weight: 600; }
.dl-sub { font-size: .8rem; color: var(--fg-muted); }
.dl-arrow { margin-left: auto; color: var(--accent); font-size: .85rem; font-weight: 600; }

/* ---- References ------------------------------------------------------ */
.reference-card {
  display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.15rem;
  background: var(--bg-elev); border-left: 3px solid var(--accent-2);
  border-radius: var(--radius-sm); color: var(--fg); margin: 1rem 0;
}
.reference-card:hover { text-decoration: none; background: var(--bg-elev-2); color: var(--fg); }
.ref-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); font-weight: 700; }
.ref-title { font-weight: 600; font-size: 1.05rem; }
.ref-desc { color: var(--fg-muted); font-size: .92rem; }
.ref-foot { display: flex; gap: .8rem; font-size: .8rem; color: var(--fg-faint); margin-top: .2rem; }
.kind-video { border-left-color: var(--accent); } .kind-video .ref-kind { color: var(--accent); }
.kind-tool  { border-left-color: var(--accent-3); } .kind-tool .ref-kind { color: var(--accent-3); }

/* ---- Image dual (dark / light) -------------------------------------- */
.image-dual { margin: 1.6rem 0; }
.image-dual.w-wide { width: min(100%, 920px); margin-inline: calc(50% - min(50%, 460px)); }

/* Padded frame with a Grasshopper-like dot grid behind the image. */
.image-frame {
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg-elev);
  background-image: radial-gradient(var(--grid-dot) 1.3px, transparent 1.3px);
  background-size: 20px 20px;
  background-position: center;
  cursor: zoom-in;
}
.image-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.image-dual img { width: 100%; display: block; }
.image-dual .img-light { display: none; }
.image-dual .img-dark  { display: block; }
[data-theme="light"] .image-dual .img-light { display: block; }
[data-theme="light"] .image-dual .img-dark  { display: none; }
.image-caption { margin-top: .6rem; font-size: .85rem; color: var(--fg-muted); text-align: center; }

/* ---- Lightbox (full-screen image modal) ----------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 2.5rem;
  background: color-mix(in srgb, #000 86%, transparent);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: 95vw; max-height: 92vh; width: auto; height: auto;
  object-fit: contain; border-radius: var(--radius-sm);
}

/* ---- Prev / next ----------------------------------------------------- */
.prevnext {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--border);
}
.pn {
  display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.2rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev);
  color: var(--fg); transition: background .15s;
}
.pn:hover { text-decoration: none; background: var(--bg-elev-2); color: var(--fg); }
.pn-next { text-align: right; }
.pn-dir { font-size: .8rem; color: var(--fg-muted); font-weight: 600; }
.pn-title { font-weight: 600; }
.pn-empty { border: 0; background: none; }

/* ---- Responsive ------------------------------------------------------ */
@media (max-width: 560px) {
  .prevnext { grid-template-columns: 1fr; }
  .pn-empty { display: none; }
}
