/**
 * Path colour + typography roles for nav redesign.
 * Body/paragraph text stays neutral; path colour is chrome-only.
 */

/* —— data-path sets active path tokens (body or scoped chrome) —— */
[data-path="start"] {
  --path: var(--path-start);
  --path-soft: var(--path-start-soft);
  --path-ink: var(--path-start-ink);
}
[data-path="data"] {
  --path: var(--path-data);
  --path-soft: var(--path-data-soft);
  --path-ink: var(--path-data-ink);
}
[data-path="ml"] {
  --path: var(--path-ml);
  --path-soft: var(--path-ml-soft);
  --path-ink: var(--path-ml-ink);
}
[data-path="work"] {
  --path: var(--path-work);
  --path-soft: var(--path-work-soft);
  --path-ink: var(--path-work-ink);
}
[data-path="apps"] {
  --path: var(--path-apps);
  --path-soft: var(--path-apps-soft);
  --path-ink: var(--path-apps-ink);
}
[data-path="eng"] {
  --path: var(--path-eng);
  --path-soft: var(--path-eng-soft);
  --path-ink: var(--path-eng-ink);
}
[data-path="auto"] {
  --path: var(--path-auto);
  --path-soft: var(--path-auto-soft);
  --path-ink: var(--path-auto-ink);
}

/* LMS chrome: map legacy learn-accent → path tokens (position/progress) */
body[data-path] {
  --learn-accent: var(--path-ink);
  --learn-accent-soft: var(--path-soft);
  --learn-accent-dark: var(--path-ink);
}

/* —— Typography roles —— */
html,
body,
button,
input,
select,
textarea,
.ls-sidebar,
.ls-pager,
.ls-breadcrumb,
.pr-topbar,
.nav,
.btn {
  font-family: var(--font-body);
}

h1,
.ls-path-band-title,
.course-part-title,
.learn-module-title,
.intro-course-title,
.pr-lesson > h1:first-child,
.content-panel > h1:first-of-type,
.learn-reader-content > h1:first-of-type {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--bs-h1-size, clamp(2.5rem, 5vw, 4rem));
  line-height: 1.12;
}

/* Optional horror H1 — ai6 only (title-horror is the marker class) */
body[data-lesson-id="ai6"] .pr-lesson > h1:first-child,
body[data-lesson-id="ai6"] .learn-reader-content > h1:first-of-type,
body[data-lesson-id="ai6"] .content-panel > h1:first-of-type,
.pr-lesson > h1.title-horror,
.learn-reader-content > h1.title-horror,
.content-panel > h1.title-horror {
  font-family: var(--font-horror);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Celebrate headline — capstone / completion emphasis */
.title-celebrate,
.pr-lesson > h1.title-celebrate,
.learn-reader-content > h1.title-celebrate,
.content-panel > h1.title-celebrate {
  font-family: var(--font-play);
  font-weight: 700;
  letter-spacing: 0.01em;
}

code,
pre,
.mono,
kbd {
  font-family: var(--mono);
}

/* —— Path chrome —— */
.ls-path-band {
  background: var(--path-soft);
  border-bottom: 3px solid var(--path);
  padding: 0.65rem 1.25rem;
  color: var(--path-ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
}

.ls-badge {
  background: var(--path-soft) !important;
  color: var(--path-ink) !important;
}

.ls-sidebar-item.is-current {
  background: var(--path-soft) !important;
  color: var(--path-ink) !important;
  box-shadow: inset 3px 0 0 var(--path-ink) !important;
}

.ls-breadcrumb [aria-current="page"] {
  color: var(--path-ink);
  font-weight: 700;
}

.ls-sidebar-done,
.course-tile-status.is-done,
.mark-complete-btn.mc-completed {
  color: var(--status-done) !important;
}

.ls-complete-btn.mc-completed,
.mark-complete-btn.ls-complete-btn.mc-completed {
  background: var(--status-done) !important;
  border-color: var(--status-done) !important;
  color: #fff !important;
}

/* Progress fills use ink (not base) so UI contrast holds on soft tints */
.ls-sidebar-prog-bar,
.learn-progress-fill,
[data-course-progress],
.course-progress-fill {
  background: var(--path-ink) !important;
}

body[data-path] .learn-progress-fill {
  background: var(--path-ink) !important;
  background-image: none !important;
}

.course-part-tiles,
.intro-course-card,
.course-card {
  border-top: 3px solid var(--path, var(--path-data));
}

.course-part-tiles[data-path="start"],
.intro-course-card[data-path="start"],
[data-path="start"] .course-part-tiles {
  border-top-color: var(--path-start);
}
.course-part-tiles[data-path="data"],
.intro-course-card[data-path="data"] {
  border-top-color: var(--path-data);
}
.course-part-tiles[data-path="ml"],
.intro-course-card[data-path="ml"] {
  border-top-color: var(--path-ml);
}
.course-part-tiles[data-path="work"],
.intro-course-card[data-path="work"] {
  border-top-color: var(--path-work);
}
.course-part-tiles[data-path="apps"],
.intro-course-card[data-path="apps"] {
  border-top-color: var(--path-apps);
}
.course-part-tiles[data-path="eng"],
.intro-course-card[data-path="eng"] {
  border-top-color: var(--path-eng);
}
.course-part-tiles[data-path="auto"],
.intro-course-card[data-path="auto"] {
  border-top-color: var(--path-auto);
}

.course-part-num {
  color: var(--path-ink);
}

/* LMS position markers: ink on soft, ink inset (never base for text/icons) */
body[data-path] .learn-rail-item.active,
body[data-path] .learn-chapter-card.is-active,
body[data-path] .learn-lesson-row.is-current,
body[data-path] .course-part-tiles .is-active {
  color: var(--path-ink);
  background: var(--path-soft);
}

body[data-path] .learn-progress-fill {
  background: var(--path) !important;
  background-image: none !important;
}

/* —— Callout roles —— */
.callout-note,
blockquote.callout-note,
blockquote.callout-tip {
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.2vw, 1.45rem);
  line-height: 1.35;
  max-width: 42rem;
  background: #fffbeb;
  border-left: 4px solid #d97706;
  border-radius: 0 12px 12px 0;
  padding: 0.85rem 1.1rem;
  margin: 1.25rem 0;
  color: #78350f;
  box-shadow: 2px 4px 10px rgba(120, 53, 15, 0.1);
}

/* Sticky-note tilt — off by default (no motion), on only when the OS permits. */
@media (prefers-reduced-motion: no-preference) {
  .callout-note,
  blockquote.callout-note,
  blockquote.callout-tip {
    transform: rotate(-0.5deg);
  }
}

.callout-note p,
blockquote.callout-note p,
blockquote.callout-tip p {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.callout-fun,
blockquote.callout-fun,
.quiz-result-banner,
.course-complete-card,
.path-complete-card {
  font-family: var(--font-play);
  font-weight: 600;
  font-size: 1.05rem;
  background: #ecfdf5;
  border-left: 4px solid var(--status-done-icon);
  border-radius: 0 12px 12px 0;
  padding: 0.85rem 1.1rem;
  margin: 1.25rem 0;
  color: var(--status-done);
}

.callout-fun p,
blockquote.callout-fun p {
  font-family: inherit;
  color: inherit;
}

/* Expected output / result — neutral, body font */
.callout-output,
blockquote.callout-output,
blockquote.callout-result {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.95rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #64748b;
  border-radius: 0 10px 10px 0;
  padding: 0.75rem 1rem 0.85rem;
  margin: 1.25rem 0;
  color: var(--color-body, #334155);
}

.callout-output::before,
blockquote.callout-output::before,
blockquote.callout-result::before {
  content: "Expected result";
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.4rem;
}

.callout-output p,
blockquote.callout-output p,
blockquote.callout-result p {
  font-family: inherit;
  margin: 0.25rem 0 0;
  color: inherit;
}

/* Important / critical — path-ink border, body font */
.callout-important,
blockquote.callout-important,
blockquote.callout-warning {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.95rem;
  background: var(--path-soft, #e5effa);
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 0 12px 12px 0;
  padding: 0.85rem 1.1rem;
  margin: 1.25rem 0;
  color: var(--color-body, #334155);
}

.callout-important > strong:first-child,
blockquote.callout-important > p > strong:first-child,
blockquote.callout-warning > p > strong:first-child {
  font-family: var(--font-body);
  font-weight: 700;
  display: block;
  margin-bottom: 0.35rem;
  color: var(--path-ink, #256abe);
}

.callout-important p,
blockquote.callout-important p,
blockquote.callout-warning p {
  font-family: inherit;
  color: inherit;
}

.callout-mistake,
blockquote.callout-mistake {
  font-family: var(--font-body);
  font-weight: 500;
  background: var(--color-warning-bg, #fff1f2);
  border-left: 4px solid var(--status-warn);
  border-radius: 0 12px 12px 0;
  padding: 0.85rem 1.1rem;
  margin: 1.25rem 0;
  color: var(--color-warning-text, #9f1239);
}

.callout-mistake p,
blockquote.callout-mistake p {
  font-family: var(--font-body);
  font-weight: 500;
  color: inherit;
}

.callout-mistake > strong:first-child,
blockquote.callout-mistake > p > strong:first-child {
  font-family: var(--font-horror);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: #9f1239;
  display: block;
  margin-bottom: 0.35rem;
}

.callout-mistake > strong:first-child::before,
blockquote.callout-mistake > p > strong:first-child::before {
  content: "\2715 ";
  color: #9f1239;
  font-weight: 400;
}

/* Elegant pull-quote / aphorism — Playfair italic */
.callout-quote,
blockquote.callout-quote {
  font-family: var(--font-quote);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.5;
  max-width: 44rem;
  background: linear-gradient(180deg, #fdfbf7, #f8f5ef);
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 0 14px 14px 0;
  padding: 1.1rem 1.3rem 1.1rem 3rem;
  margin: 1.5rem 0;
  color: var(--color-body, #334155);
  position: relative;
}

.callout-quote::before {
  content: "\201C";
  position: absolute;
  left: 0.7rem;
  top: 0.35rem;
  font-family: Georgia, serif;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--path-ink, #256abe);
  opacity: 0.85;
}

.callout-quote p,
blockquote.callout-quote p {
  font-family: inherit;
  font-style: inherit;
  font-size: inherit;
  color: inherit;
  margin: 0;
}

/* Story / analogy — Special Elite typewriter label, neutral body */
.callout-story,
blockquote.callout-story {
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.6;
  background: #fafaf6;
  border: 1px solid #e5e0d4;
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 6px;
  padding: 1rem 1.15rem 0.95rem;
  margin: 1.5rem 0;
  color: var(--color-body, #334155);
}

.callout-story::before {
  content: "A story from the field";
  display: block;
  font-family: var(--font-typewriter);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--path-ink, #256abe);
  margin-bottom: 0.4rem;
}

.callout-story p,
blockquote.callout-story p {
  font-family: inherit;
  color: inherit;
  margin: 0.35rem 0 0;
}

/* Definition — Bricolage small-caps label, neutral body */
.callout-definition,
blockquote.callout-definition {
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.6;
  background: var(--path-soft, #f1f5f9);
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.15rem 0.95rem;
  margin: 1.5rem 0;
  color: var(--color-body, #334155);
}

.callout-definition::before {
  content: "In plain words";
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--path-ink, #256abe);
  margin-bottom: 0.4rem;
}

.callout-definition p,
blockquote.callout-definition p {
  font-family: inherit;
  color: inherit;
  margin: 0.35rem 0 0;
}

/* —— Structural sections (renderer-wrapped callout cards) —— */
/* Suppress the eyebrow ::before label; the heading itself is the label. */
.callout-definition.ls-structural::before,
.callout-mistake.ls-structural::before,
.callout-output.ls-structural::before,
.callout-quote.ls-structural::before,
.callout-important.ls-structural::before,
.ls-opener.ls-structural::before {
  content: none;
}
.callout-definition.ls-structural,
.callout-mistake.ls-structural,
.callout-output.ls-structural,
.callout-quote.ls-structural,
.callout-important.ls-structural,
.ls-opener.ls-structural {
  margin: 1.5rem 0;
}
.callout-definition.ls-structural > h2:first-child,
.callout-mistake.ls-structural > h2:first-child,
.callout-output.ls-structural > h2:first-child,
.callout-quote.ls-structural > h2:first-child,
.callout-important.ls-structural > h2:first-child,
.ls-opener.ls-structural > h2:first-child {
  margin-top: 0;
}

/* Lesson opener — plain orientation under the title */
.ls-opener.ls-structural {
  font-family: var(--font-body);
  background: var(--path-soft, #f1f5f9);
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.15rem 0.95rem;
  margin: 1.25rem 0 1.5rem;
  color: var(--color-body, #334155);
  max-width: 44rem;
}
.ls-opener.ls-structural > h2:first-child {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--path-ink, #256abe);
  border-bottom: none;
  background: none;
  padding-bottom: 0;
  margin-bottom: 0.65rem;
}
.ls-opener.ls-structural p {
  font-family: var(--font-body);
  margin: 0.35rem 0;
  line-height: 1.55;
}

/* Quiz / exercise / test-yourself headings — path colour (font set by role class). */
.ls-exercise-head {
  color: var(--path-ink, #256abe);
}

/* —— Structural decorative heading roles (never on p/code/table) —— */
.ls-hand-head,
.practice-section > h2.ls-hand-head {
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  letter-spacing: 0.01em;
  color: var(--path-ink, #256abe);
}

.ls-play-head,
.checklist-section > h2.ls-play-head,
.title-celebrate.ls-play-head {
  font-family: var(--font-play);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--path-ink, #256abe);
}

/* Ordinary Common mistakes — bold condensed display in red (no Creepster). */
.ls-mistake-head,
.callout-mistake.ls-structural > h2.ls-mistake-head,
.callout-mistake.ls-structural > h3.ls-mistake-head {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: condensed;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  letter-spacing: 0.01em;
  color: #9f1239; /* ~7:1 on cream */
}

/* Creepster: only on allowlisted risk/failure lessons. */
.ls-creep-head,
.callout-mistake.ls-structural > h2.ls-creep-head,
.callout-mistake.ls-structural > h3.ls-creep-head,
.title-horror.ls-creep-head {
  font-family: var(--font-horror);
  font-weight: 400;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  letter-spacing: 0.04em;
  color: #9f1239; /* ~7:1 on #f6f4ef / white */
}

.callout-mistake > strong:first-child,
blockquote.callout-mistake > p > strong:first-child {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: #9f1239;
}

body[data-creepster="1"] .callout-mistake > strong:first-child,
body[data-creepster="1"] blockquote.callout-mistake > p > strong:first-child {
  font-family: var(--font-horror);
  font-weight: 400;
  letter-spacing: 0.03em;
}

/* Checklist watch-out mark — display glyph (no Creepster family). */
.checklist-section > h2.ls-play-head::before {
  content: "\26A0\00A0";
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85em;
  color: #9f1239;
  speak: never;
}

.ls-type-head,
.ls-closing > h2.ls-type-head,
.ls-commands > h2.ls-type-head {
  font-family: var(--font-typewriter);
  font-weight: 400;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  letter-spacing: 0.02em;
  color: var(--path-ink, #256abe);
}

/* Closing / commands cards: body text stays Atkinson; only the heading is typewriter. */
.ls-closing.ls-structural,
.ls-commands.ls-structural {
  font-family: var(--font-body);
  background: #fafaf6;
  border: 1px solid #e5e0d4;
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 6px;
  padding: 1rem 1.15rem 0.95rem;
  margin: 1.5rem 0;
  color: var(--color-body, #334155);
}
.ls-closing.ls-structural > h2:first-child,
.ls-commands.ls-structural > h2:first-child {
  margin-top: 0;
}
.ls-closing.ls-structural p,
.ls-commands.ls-structural p,
.ls-closing.ls-structural li,
.ls-commands.ls-structural li {
  font-family: var(--font-body);
}

/* Suppress legacy quote styling on closing (Playfair reserved for hooks / [!quote]). */
.callout-quote.ls-structural > h2:first-child {
  font-family: var(--font-typewriter);
  font-style: normal;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}
.callout-quote.ls-structural p {
  font-family: var(--font-body);
  font-style: normal;
  font-size: inherit;
}

/* Opening-hook pull-quote — only where the lesson has one. */
.ls-hook {
  font-family: var(--font-quote);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  color: var(--color-body, #334155);
  background: linear-gradient(180deg, #fdfbf7, #f8f5ef);
  border-left: 4px solid var(--path-ink, #256abe);
  border-radius: 0 14px 14px 0;
  padding: 1rem 1.3rem 1rem 3rem;
  margin: 1.5rem 0;
  max-width: 44rem;
  position: relative;
}
.ls-hook::before {
  content: "\201C";
  position: absolute;
  left: 0.7rem;
  top: 0.35rem;
  font-family: Georgia, serif;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--path-ink, #256abe);
  opacity: 0.85;
}
.ls-hook p,
.ls-hook b,
.ls-hook strong {
  font-family: inherit;
  font-style: inherit;
  font-size: inherit;
  color: inherit;
  margin: 0;
}

/* —— Path chrome accents (expressive layer) —— */

/* Lesson H2 accent: short path-ink underline under every learner heading */
body[data-path] .learn-reader-content h2,
body[data-path] .pr-lesson h2,
body[data-path] .content-panel h2 {
  border-bottom: 2px solid transparent;
  background-image: linear-gradient(var(--path-ink, var(--path-data-ink)), var(--path-ink, var(--path-data-ink)));
  background-repeat: no-repeat;
  background-size: 3.25rem 2px;
  background-position: 0 100%;
  padding-bottom: 0.35rem;
}

/* Dark code blocks get a path-colour top edge */
body[data-path] .learn-reader-content pre,
body[data-path] .content-panel pre {
  border-top: 3px solid var(--path-ink, var(--path-data-ink));
}

/* Sidebar header accent */
body[data-path] .ls-sidebar-head {
  border-bottom: 2px solid var(--path-ink, var(--path-data-ink));
  padding-bottom: 0.5rem;
}

/* Practice / exercise boxes follow the path accent */
body[data-path] .learn-reader-content .practice-section {
  border-color: color-mix(in srgb, var(--path-ink, var(--path-data-ink)) 40%, transparent);
}
body[data-path] .learn-reader-content .practice-section h2::before {
  background: var(--path-ink, var(--path-data-ink));
}

/* Lesson finish / footer strip top edge */
body[data-path] .ls-finish {
  border-top: 3px solid var(--path-ink, var(--path-data-ink));
}

/* Lesson N of M badge already uses soft/ink; keep icons + course numbers on ink */
body[data-path] .course-part-num,
body[data-path] .learn-resource-doc-icon,
body[data-path] .learn-tab-label {
  color: var(--path-ink, var(--path-data-ink));
}

/* Never animate text */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
