/* Sarafanovo course components. Load after the Publishes theme styles.
 * Content selectors are scoped to .sf-course. The one :has() rule below owns
 * only the native heading of a post that contains .sf-course.
 * Font comes from the parent Onest theme.
 * Diagram semantics belong to the SVG assets: no fill/stroke/filter overrides.
 */
.publishes__post:has(.sf-course) .publishes__post-header h1 { overflow-wrap: anywhere; }
.sf-course {
  --sf-course-accent: #6e187d;
  --sf-course-accent-dark: #451054;
  --sf-course-yellow: #ffc400;
  --sf-course-ink: #231b26;
  --sf-course-muted: #6c6370;
  --sf-course-line: #e8e2ea;
  --sf-course-soft: #faf7fb;
  --sf-course-lilac: #f4ecf8;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  color: var(--sf-course-ink);
  font-family: inherit;
  font-size: inherit;
  line-height: 1.72;
  overflow-wrap: anywhere;
}
.sf-course *, .sf-course *::before, .sf-course *::after { box-sizing: border-box; }
.sf-course .wrap { width: auto; min-width: 0; max-width: 100%; margin: 0; padding: 0; }
.sf-course h2, .sf-course h3, .sf-course h4 {
  color: var(--sf-course-ink);
  font-family: inherit;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  scroll-margin-top: 96px;
}
.sf-course h2 { margin: 2.1em 0 .8em; font-size: clamp(23px, 2.4vw, 30px); }
.sf-course h3 { margin: 1.6em 0 .65em; font-size: 1.16em; }
.sf-course h4 { margin: 1.3em 0 .6em; font-size: 1em; }
.sf-course p { margin: 0 0 1.15em; }
.sf-course .subtitle { margin: 0 0 1.4em; color: var(--sf-course-muted); font-size: 1.13em; line-height: 1.55; }
.sf-course b, .sf-course strong { font-weight: 700; }
.sf-course a { color: var(--sf-course-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; overflow-wrap: anywhere; }
.sf-course a:hover { color: var(--sf-course-accent-dark); text-decoration-thickness: 2px; }
.sf-course a:focus-visible { outline: 3px solid var(--sf-course-accent); outline-offset: 4px; border-radius: 2px; }
.sf-course .course-term-link { text-decoration-style: dotted; text-underline-offset: .22em; }
.sf-course .term { color: var(--sf-course-accent-dark); font-weight: 700; }
.sf-course ul, .sf-course ol { margin: 0 0 1.25em; padding-left: 1.5em; }
.sf-course li { padding-left: .15em; }
.sf-course li + li { margin-top: .5em; }
.sf-course li > ul, .sf-course li > ol { margin-top: .55em; margin-bottom: .55em; }
.sf-course li > p:first-child { margin-top: .4em; }
.sf-course .num { color: var(--sf-course-accent-dark); font-variant-numeric: tabular-nums; font-weight: 700; }

.sf-course .box, .sf-course .check {
  min-width: 0;
  margin: 1.8em 0;
  padding: clamp(16px, 2.5vw, 24px);
  border: 1px solid var(--sf-course-line);
  border-radius: 12px;
  background: var(--sf-course-soft);
}
.sf-course .box { border-left: 4px solid var(--sf-course-accent); }
.sf-course .box.rule { background: var(--sf-course-lilac); }
.sf-course .box.tip { background: #fffaf0; border-left-color: var(--sf-course-yellow); }
.sf-course .box.warn { background: #fffaf0; border-left-color: var(--sf-course-accent-dark); }
.sf-course .lbl { display: block; margin-bottom: .55em; color: var(--sf-course-accent-dark); font-size: .85em; font-weight: 700; letter-spacing: .025em; }
.sf-course .box > :first-child, .sf-course .check > :first-child { margin-top: 0; }
.sf-course .box > :last-child, .sf-course .check > :last-child { margin-bottom: 0; }
.sf-course .box h2, .sf-course .check h2 { font-size: 1.4em; }
.sf-course .check { border-top: 3px solid var(--sf-course-accent); background: #fff; }
.sf-course .check > ol { padding-left: 1.4em; }
.sf-course .check > ol > li + li { margin-top: 1.3em; }
.sf-course .course-answer { margin: .5em 0 1.2em; padding: .8em 1em; border-left: 3px solid var(--sf-course-yellow); background: var(--sf-course-soft); }
.sf-course .course-answer > :last-child { margin-bottom: 0; }

.sf-course figure { min-width: 0; max-width: 100%; margin: 1.8em 0; padding: 0; }
.sf-course img { display: block; max-width: 100%; height: auto; margin: 0 auto; object-fit: contain; }
.sf-course .course-diagram-link { display: block; width: fit-content; max-width: 100%; margin: 0 auto; padding: 0; border: 1px solid var(--sf-course-line); border-radius: 8px; background: #fff; cursor: zoom-in; }
.sf-course .course-diagram-link:hover { border-color: var(--sf-course-accent); }
.sf-course .course-diagram-link img { border: 0; border-radius: 7px; }
.sf-course figcaption { margin-top: .8em; color: var(--sf-course-muted); font-family: inherit; font-size: .87em; line-height: 1.6; overflow-wrap: anywhere; }
.sf-course .course-diagram-hint { display: block; margin-top: .45em; font-size: .87em; color: var(--sf-course-muted); }

/* Native fragments contain real tables without requiring an extra wrapper.
 * A wide table scrolls inside its own box; the page never needs horizontal scroll.
 */
.sf-course table { display: block; width: 100%; max-width: 100%; margin: 1.6em 0; overflow-x: auto; border: 1px solid var(--sf-course-line); border-collapse: collapse; border-spacing: 0; background: #fff; font-family: inherit; font-size: .92em; line-height: 1.55; text-align: left; -webkit-overflow-scrolling: touch; }
.sf-course caption { padding: .8em; text-align: left; color: var(--sf-course-muted); font-weight: 500; }
.sf-course th, .sf-course td { min-width: 7.5rem; max-width: 28rem; padding: .75em .85em; border: 1px solid var(--sf-course-line); vertical-align: top; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.sf-course th { background: var(--sf-course-lilac); color: var(--sf-course-accent-dark); font-weight: 700; }
.sf-course td > :last-child, .sf-course th > :last-child { margin-bottom: 0; }
.sf-course .table-scroll, .sf-course .table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; margin: 1.6em 0; }
.sf-course .table-scroll table, .sf-course .table-wrap table { margin: 0; }
.sf-course table:focus-visible, .sf-course .table-scroll:focus-visible, .sf-course .table-wrap:focus-visible { outline: 3px solid var(--sf-course-accent); outline-offset: 3px; }

.sf-course dl { margin: 1.4em 0; }
.sf-course dt { margin: 1.1em 0 .3em; color: var(--sf-course-accent-dark); font-weight: 700; }
.sf-course dd { margin: 0 0 1em; }
.sf-course .gloss { padding: 0; }
.sf-course .gloss dt { padding-top: .85em; border-top: 1px solid var(--sf-course-line); }
.sf-course .gloss dt:first-child { padding-top: 0; border-top: 0; }
.sf-course pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.sf-course code { font-size: .92em; overflow-wrap: anywhere; }
.sf-course .sources { margin-top: 2.5em; padding-top: 1.4em; border-top: 1px solid var(--sf-course-line); color: var(--sf-course-muted); font-size: .9em; line-height: 1.65; }
.sf-course .sources h2, .sf-course .sources h3 { margin-top: 0; font-size: 1.15em; }
.sf-course .course-related { margin-top: 2.5em; padding-top: 1.5em; border-top: 2px solid var(--sf-course-yellow); }
.sf-course .course-related h2 { margin-top: 0; font-size: 1.4em; }
.sf-course .pager, .sf-course.course-navigation { display: flex; flex-wrap: wrap; gap: .5em 1.5em; min-width: 0; margin-top: 2em; padding-top: 1.1em; border-top: 1px solid var(--sf-course-line); font-size: .93em; }
.sf-course.course-navigation p { flex: 1 1 14rem; min-width: 0; margin: 0; }
.sf-course .pager a, .sf-course.course-navigation a { display: inline-block; min-height: 44px; padding: .55em 0; }
.sf-course [id] { scroll-margin-top: 96px; }

@media (max-width: 480px) {
  .sf-course { line-height: 1.68; }
  .sf-course h2 { font-size: 1.45em; }
  .sf-course .subtitle { font-size: 1.06em; }
  .sf-course .box, .sf-course .check { padding: 16px 14px; border-radius: 8px; }
  .sf-course th, .sf-course td { padding: .65em .7em; }
  .sf-course .course-answer { padding: .7em .8em; }
}

@media print {
  .sf-course .box, .sf-course .check, .sf-course figure { break-inside: avoid; }
  .sf-course table { display: table; overflow: visible; font-size: .85em; }
  .sf-course th, .sf-course td { min-width: 0; }
  .sf-course .course-diagram-link { border: 0; }
}
