/* =============================================================
   Dotika · Formation MLOps — course site styles
   Built on colors_and_type.css (UI scale). Scrollytelling layout.
   ============================================================= */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  font-feature-settings: var(--font-features);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--dot-red); text-decoration: none; }
a:hover { opacity: .85; }
img { max-width: 100%; }

/* ---- language toggle: html[lang] drives visibility ---- */
html[lang="fr"] .L.en { display: none !important; }
html[lang="en"] .L.fr { display: none !important; }

/* =============================================================
   TOP BAR
   ============================================================= */
#bar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,251,247,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 13px 28px;
  display: flex; align-items: center; gap: 18px;
}
#bar .brand { font-weight: 800; font-size: 18px; letter-spacing: var(--ls-h); color: var(--ink); }
#bar .brand img { height: 20px; vertical-align: middle; transform: translateY(-1px); }
#bar .crumb { font-family: var(--mono); font-size: 12.5px; letter-spacing: var(--ls-mono); color: var(--muted); }
#bar .sp { flex: 1; }
#bar .navlink {
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r); padding: 7px 13px;
}
#bar .navlink:hover { border-color: var(--dot-red); color: var(--dot-red); opacity: 1; }
.langtog { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.langtog button {
  background: var(--paper); border: none; padding: 7px 14px; cursor: pointer;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .06em;
}
.langtog button.on { background: var(--dot-red); color: #fff; }

/* ---- chapter progress line under the bar ---- */
#chapProg { position: fixed; top: 0; left: 0; height: 3px; background: var(--dot-red); width: 0; z-index: 60; transition: width .1s linear; }

/* =============================================================
   COVER (dark, dots background)
   ============================================================= */
.cover {
  position: relative; overflow: hidden;
  background: var(--ink-bg); color: var(--on-ink);
  min-height: 78vh;
  display: flex; align-items: center;
}
.cover canvas.dots { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover .inner { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; padding: 90px 28px; width: 100%; }
.cover .eyebrow { color: var(--on-ink-muted); }
.cover h1 {
  font-size: clamp(46px, 7vw, 84px); line-height: var(--lh-display);
  letter-spacing: var(--ls-tight); font-weight: 700; color: var(--on-ink); margin: 16px 0 0;
}
.cover .sub { font-size: clamp(19px, 2.2vw, 24px); line-height: 1.4; color: var(--on-ink-2); max-width: 760px; margin-top: 26px; font-weight: 400; }
.cover .sub .it { color: var(--on-ink); }
.cover .meta { margin-top: 40px; font-family: var(--mono); font-size: 13px; letter-spacing: var(--ls-mono); color: var(--on-ink-muted); }
.cover .meta b { color: var(--on-ink); font-weight: 600; }

/* ---- cover CTAs ---- */
.cover .ctas { margin-top: 44px; display: flex; gap: 14px; flex-wrap: wrap; }
.cta {
  display: inline-block; font-family: var(--sans); font-weight: 800; font-size: 16px;
  letter-spacing: var(--ls-snug); background: var(--dot-red); color: #fff;
  border-radius: var(--r-md); padding: 14px 26px; transition: .15s;
}
.cta:hover { background: var(--dot-red-hover); opacity: 1; transform: translateY(-1px); }
.cta.ghost { background: transparent; color: var(--on-ink); border: 1px solid rgba(255,251,247,.4); font-weight: 600; }
.cta.ghost:hover { border-color: var(--on-ink); background: transparent; }

/* =============================================================
   GENERIC SECTIONS
   ============================================================= */
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 28px; }
section.band { padding: 90px 0; }
section.band.tint { background: var(--paper); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
section.band.dark { background: var(--ink-bg); color: var(--on-ink); }

.eyebrow { font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: var(--ls-eyebrow); text-transform: uppercase; color: var(--muted); }
.band.dark .eyebrow { color: var(--on-ink-muted); }
h2.sec {
  font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: var(--ls-h);
  line-height: var(--lh-title); margin: 12px 0 0;
}
.band.dark h2.sec { color: var(--on-ink); }
.leadp { font-size: 20px; line-height: 1.5; color: var(--ink-2); max-width: 780px; margin-top: 18px; }
.band.dark .leadp { color: var(--on-ink-2); }
.it { font-family: var(--serif); font-style: italic; font-weight: 500; }

/* prose */
.prose { max-width: 720px; }
.prose p { margin: .9em 0; font-size: 17.5px; color: var(--ink-2); }
.prose strong { color: var(--ink); }
.prose h3 { font-size: 22px; font-weight: 800; letter-spacing: var(--ls-snug); margin: 2em 0 .4em; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--line-soft); padding: .12em .4em; border-radius: var(--r-sm); }
.prose blockquote {
  margin: 1.4em 0; padding: .8em 1.2em; border-left: 3px solid var(--dot-red);
  background: var(--paper); border-radius: 0 var(--r) var(--r) 0; color: var(--ink-2);
}
.prose pre {
  background: var(--ink-bg); color: var(--on-ink); border-radius: var(--r-md);
  padding: 18px 20px; overflow: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; color: inherit; }

/* key takeaway card */
.takeaway {
  margin: 1.6em 0; border: 1px solid var(--line); border-left: 4px solid var(--dot-red);
  background: var(--paper); border-radius: var(--r-md); padding: 18px 22px;
}
.takeaway .k { font-family: var(--mono); font-size: 11px; letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--dot-red); font-weight: 600; }
.takeaway p { margin: .5em 0 0; font-size: 17px; }

/* =============================================================
   SCROLLYTELLING
   ============================================================= */
.scrolly { position: relative; background: var(--ink-bg); color: var(--on-ink); }
.scrolly .graphic {
  position: sticky; top: 0; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.scrolly .graphic .map-holder { width: min(96vw, 1500px); }
.scrolly .steps { position: relative; z-index: 2; max-width: 460px; margin-left: clamp(28px, 6vw, 110px); padding: 10vh 0 20vh; }
.scrolly .step {
  min-height: 78vh; display: flex; flex-direction: column; justify-content: center;
  opacity: .25; transition: opacity .4s ease;
  pointer-events: none;
}
.scrolly .step.active { opacity: 1; pointer-events: auto; }
.scrolly .step .card {
  background: rgba(15,16,21,.82); backdrop-filter: blur(6px);
  border: 1px solid var(--line-on-ink); border-radius: var(--r-lg);
  padding: 26px 28px;
}
.scrolly .step .k { font-family: var(--mono); font-size: 11.5px; letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--dot-red); font-weight: 600; }
.scrolly .step h3 { font-size: 24px; font-weight: 800; color: var(--on-ink); letter-spacing: var(--ls-snug); margin: 10px 0 0; line-height: 1.15; }
.scrolly .step p { font-size: 16.5px; line-height: 1.55; color: var(--on-ink-2); margin: 12px 0 0; }
.scrolly .step p b { color: var(--on-ink); }
.scrolly .step .it { color: var(--on-ink); }

/* On narrow screens: graphic becomes a top sticky band, steps below */
@media (max-width: 900px) {
  .scrolly .graphic { height: 52vh; }
  .scrolly .steps { max-width: none; margin: 0; padding: 4vh 20px 12vh; }
  .scrolly .step { min-height: 60vh; }
}

/* =============================================================
   CHAPTER HUB CARDS (index)
   ============================================================= */
.chapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 44px; }
a.chap {
  display: block; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 22px 24px; color: var(--ink); transition: .13s;
  position: relative;
}
a.chap:hover { border-color: var(--dot-red); box-shadow: var(--sh-lift); opacity: 1; transform: translateY(-2px); }
a.chap.locked { pointer-events: none; }
a.chap.locked .t, a.chap.locked .d { opacity: .45; }
a.chap .num { font-family: var(--sans); font-weight: 800; font-size: 26px; color: var(--dot-red); font-feature-settings: var(--font-features-num); }
a.chap.bonus .num { color: var(--muted); }
a.chap .t { font-size: 19px; font-weight: 800; letter-spacing: var(--ls-snug); margin-top: 8px; line-height: 1.2; }
a.chap .d { font-size: 13.5px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
a.chap .meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 14px; letter-spacing: var(--ls-mono); }
a.chap .meta .lab { color: var(--dot-red); font-weight: 600; }
a.chap .soon {
  position: absolute; top: 18px; right: 18px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 10px;
}

/* =============================================================
   FOOTER
   ============================================================= */
footer.site {
  border-top: 1px solid var(--line); margin-top: 90px; padding: 34px 0 50px;
  font-family: var(--mono); font-size: 12.5px; color: var(--muted); letter-spacing: var(--ls-mono);
}
footer.site .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
footer.site img { height: 18px; }
footer.site .sp { flex: 1; }

/* =============================================================
   CHAPTER NAV (prev / next)
   ============================================================= */
.chapnav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 70px; }
.chapnav a {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 22px;
  color: var(--ink); background: var(--paper); transition: .13s;
}
.chapnav a:hover { border-color: var(--dot-red); opacity: 1; }
.chapnav a .k { font-family: var(--mono); font-size: 11px; letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--muted); }
.chapnav a .t { font-weight: 800; font-size: 17px; margin-top: 6px; }
.chapnav a.next { text-align: right; }
.chapnav a.disabled { pointer-events: none; opacity: .45; }
