/* Shared editorial rules for Inferencia modules M01-M07. */

body.inferencia-module,
.rs-lesson-page-wrap {
  --rs-flow-bg-subtle: #f8fafc;
  --rs-flow-border-light: #e2e8f0;
  --rs-flow-text-main: #0f172a;
  --rs-flow-text-secondary: #334155;
  --rs-flow-accent-primary: #2563eb;
}

[data-bs-theme="dark"] body.inferencia-module,
[data-bs-theme="dark"] .rs-lesson-page-wrap {
  --rs-flow-bg-subtle: #1e293b;
  --rs-flow-border-light: #334155;
  --rs-flow-text-main: #f8fafc;
  --rs-flow-text-secondary: #cbd5e1;
  --rs-flow-accent-primary: #3b82f6;
}

/* Shared module kicker: M01 is the visual reference for Inferencia. */
.inference-module-kicker {
  margin: 0 0 0.65rem;
  color: #2563eb;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0;
  text-align: left;
  text-transform: uppercase;
}

.inference-module-kicker > p {
  width: 100%;
  max-width: none;
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-transform: inherit;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-sequence-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0 3.5rem 0;
  align-items: stretch;
  width: 100%;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-flow-step {
  min-width: 0;
  height: 100%;
  align-self: stretch;
  padding: 1.25rem;
  background: var(--rs-flow-bg-subtle);
  border: 1px solid var(--rs-flow-border-light);
  border-radius: 10px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-flow-step-num,
:where(body.inferencia-module, .rs-lesson-page-wrap) .m01-flow-step-num {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--rs-flow-accent-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-flow-step > h3,
:where(body.inferencia-module, .rs-lesson-page-wrap) .m01-flow-step > h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.2rem 0;
  color: var(--rs-flow-text-main);
  text-align: left;
  text-wrap: balance;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-flow-step p,
:where(body.inferencia-module, .rs-lesson-page-wrap) .m01-flow-step p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--rs-flow-text-secondary);
  margin: 0;
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-module-lead,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-module-lead p,
:where(body.inferencia-module, .rs-lesson-page-wrap) .inference-endmatter__content > p {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-lesson-section p,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-lesson-section li > p,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-lesson-section li.rs-narrative-item,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-lesson-section blockquote,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-lesson-section blockquote p,
:where(body.inferencia-module, .rs-lesson-page-wrap)
  .rs-lesson-section
  :is(
    .rs-callout-warning,
    .rs-callout-info,
    .rs-callout-note,
    .rs-callout-tip,
    .rs-callout-important,
    .callout,
    .callout-body
  )
  p {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-lesson-section :is(h1, h2, h3, h4, h5, h6) {
  text-align: left;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap)
  :is(.rs-module-lead, .rs-lesson-section, .rs-code-tabs)
  :is(h1, h2, h3, h4, h5, h6) {
  text-align: left;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-note--m01-blue {
  background: rgba(37, 99, 235, 0.06);
  border-left: 3px solid #2563eb;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-warning--m01-amber {
  background: rgba(217, 119, 6, 0.08);
  border-left: 3px solid #d97706;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.2rem 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-warning--m02-magenta {
  background: rgba(217, 6, 206, 0.08);
  border-left: 3px solid #d90688;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.2rem 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-warning--m02-violet {
  background: rgba(179, 5, 218, 0.08);
  border-left: 3px solid #d90688;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.2rem 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-warning--m03-cyan-deep {
  background: rgba(4, 50, 255, 0.08);
  border-left: 3px solid #06d9bd;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.2rem 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-warning--m03-cyan {
  background: rgba(5, 44, 218, 0.08);
  border-left: 3px solid #06d9bd;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.2rem 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-callout-warning--m03-blue {
  background: rgba(4, 255, 242, 0.08);
  border-left: 3px solid #0645d9;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.2rem 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure {
  margin: 0;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1rem, 3vw, 3rem);
  width: 100%;
  padding: 0 0 clamp(0.8rem, 1.5vw, 1.1rem);
  border-bottom: 1px solid rgba(91, 112, 148, 0.2);
  background: transparent;
  cursor: pointer;
  list-style: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary::-webkit-details-marker {
  display: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary::marker {
  content: "";
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3f8cff, #6760ed);
  transition: width 200ms ease;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:hover::after,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:focus-visible::after,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure[open] .rs-example-disclosure__summary::after {
  width: 100%;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:focus-visible {
  outline: 2px solid rgba(55, 108, 224, 0.5);
  outline-offset: 6px;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__heading {
  color: var(--module-heading, #182238);
  font-size: var(--module-h2-size, clamp(1.55rem, 2.5vw, 2rem));
  font-weight: 730;
  line-height: 1.2;
  letter-spacing: -0.025em;
  transition: color 170ms ease, text-shadow 170ms ease;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__action {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  color: #336edc;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  transition: color 170ms ease, text-shadow 170ms ease;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__hide {
  display: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure[open] .rs-example-disclosure__show {
  display: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure[open] .rs-example-disclosure__hide {
  display: inline;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__chevron {
  display: inline-block;
  color: #5964e8;
  font-size: 1rem;
  line-height: 1;
  transform-origin: center;
  transition: transform 190ms ease, color 170ms ease, text-shadow 170ms ease;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure[open] .rs-example-disclosure__chevron {
  transform: rotate(180deg);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:hover .rs-example-disclosure__heading,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:focus-visible .rs-example-disclosure__heading {
  color: #245fcf;
  text-shadow: 0 0 18px rgba(61, 102, 226, 0.15);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:hover .rs-example-disclosure__action,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary:focus-visible .rs-example-disclosure__action {
  color: #5b55e8;
  text-shadow: 0 0 14px rgba(75, 91, 230, 0.24);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__content {
  padding-top: clamp(1.35rem, 2.4vw, 2rem);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__content p {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__content :is(pre, code, table, th, td, .math, .MathJax, mjx-container) {
  text-align: initial;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure[open] .rs-example-disclosure__content {
  animation: rs-example-reveal 180ms ease-out;
}

@keyframes rs-example-reveal {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__summary::after,
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__heading,
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__action,
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure__chevron {
    transition: none;
  }

  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-example-disclosure[open] .rs-example-disclosure__content {
    animation: none;
  }
}

:where(body.inferencia-module, .rs-lesson-page-wrap)
  .rs-lesson-section
  :is(
    .navbar,
    .course-nav,
    .rs-lesson-footer-nav,
    .lab-fullscreen-launcher,
    .interactive-lab,
    .rs-visual-lab,
    .sourceCode,
    .cell,
    .math,
    .MathJax,
    mjx-container,
    pre,
    code,
    table,
    th,
    td,
    figure,
    figcaption,
    .figure-caption,
    .legend,
    .control-group,
    .lab-controls,
    [id$="-lab-root"],
    [class*="-lab-surface"],
    [class*="-lab-sidebar"],
    [class*="-lab-main"],
    [class*="-lab-layout"],
    [class*="-lab-control"],
    [class*="-lab-header"],
    [class*="-lab-title"]
  ),
:where(body.inferencia-module, .rs-lesson-page-wrap)
  .rs-lesson-section
  :is(
    .navbar,
    .course-nav,
    .rs-lesson-footer-nav,
    .lab-fullscreen-launcher,
    .interactive-lab,
    .rs-visual-lab,
    .sourceCode,
    .cell,
    .math,
    .MathJax,
    mjx-container,
    pre,
    code,
    table,
    th,
    td,
    figure,
    figcaption,
    .figure-caption,
    .legend,
    .control-group,
    .lab-controls,
    [id$="-lab-root"],
    [class*="-lab-surface"],
    [class*="-lab-sidebar"],
    [class*="-lab-main"],
    [class*="-lab-layout"],
    [class*="-lab-control"],
    [class*="-lab-header"],
    [class*="-lab-title"]
  )
  p {
  text-align: left;
  text-justify: auto;
  text-align-last: auto;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap)
  :is(
    .rs-lesson-section,
    .inference-endmatter__content,
    .rs-example-disclosure__content,
    .rs-flow-step,
    .m01-flow-step,
    .m02-flow-step,
    .m03-flow-step,
    .m04-flow-step,
    .m05-flow-step,
    .m06-flow-step,
    .m07-flow-step,
    .rs-callout-warning,
    .rs-callout-info,
    .rs-callout-note,
    .rs-callout-tip,
    .rs-callout-important,
    .callout,
    .callout-body
  )
  .math.display,
:where(body.inferencia-module, .rs-lesson-page-wrap)
  :is(
    .rs-lesson-section,
    .inference-endmatter__content,
    .rs-example-disclosure__content,
    .rs-flow-step,
    .m01-flow-step,
    .m02-flow-step,
    .m03-flow-step,
    .m04-flow-step,
    .m05-flow-step,
    .m06-flow-step,
    .m07-flow-step,
    .rs-callout-warning,
    .rs-callout-info,
    .rs-callout-note,
    .rs-callout-tip,
    .rs-callout-important,
    .callout,
    .callout-body
  )
  mjx-container[display="true"],
:where(body.inferencia-module, .rs-lesson-page-wrap)
  :is(
    .rs-lesson-section,
    .inference-endmatter__content,
    .rs-example-disclosure__content,
    .rs-flow-step,
    .m01-flow-step,
    .m02-flow-step,
    .m03-flow-step,
    .m04-flow-step,
    .m05-flow-step,
    .m06-flow-step,
    .m07-flow-step,
    .rs-callout-warning,
    .rs-callout-info,
    .rs-callout-note,
    .rs-callout-tip,
    .rs-callout-important,
    .callout,
    .callout-body
  )
  .katex-display {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-block: clamp(1rem, 2vw, 1.5rem);
  margin-inline: auto;
  text-align: center;
  text-align-last: auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .math.display,
:where(body.inferencia-module, .rs-lesson-page-wrap) mjx-container[display="true"],
:where(body.inferencia-module, .rs-lesson-page-wrap) .katex-display,
.inference-endmatter .math.display,
.inference-endmatter mjx-container[display="true"],
.inference-endmatter .katex-display {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-block: clamp(1rem, 2vw, 1.5rem);
  margin-inline: auto;
  text-align: center;
  text-align-last: auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  hyphens: none;
  -webkit-hyphens: none;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs {
  margin-top: 1.25rem;
  margin-bottom: 2rem;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs > .nav-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(91, 112, 148, 0.2);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs .nav-tabs .nav-link {
  padding: 0.7rem 1.15rem;
  color: rgba(63, 82, 116, 0.78);
  font-size: 0.9rem;
  font-weight: 680;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: color 170ms ease, border-color 170ms ease, text-shadow 170ms ease;
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs .nav-tabs .nav-link.active {
  color: #2563eb;
  background: transparent;
  border-bottom-color: #5b63ed;
  text-shadow: 0 0 16px rgba(70, 101, 235, 0.16);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs .nav-tabs .nav-link:hover,
:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs .nav-tabs .nav-link:focus-visible {
  color: #315fd0;
  border-bottom-color: rgba(75, 102, 230, 0.48);
}

:where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs .tab-content {
  padding-top: 1rem;
}

@media (max-width: 980px) {
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-sequence-flow {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs > .nav-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  :where(body.inferencia-module, .rs-lesson-page-wrap) .rs-code-tabs .nav-tabs .nav-link {
    white-space: nowrap;
  }
}
