/* Course / chapter-based tutorial layout. Scoped to .dp-course; loaded only on course lessons. */
.dp-course {
  --dpc-ink: #1C1B1F;
  --dpc-muted: #49454F;
  --dpc-line: #E6DDD7;
  --dpc-soft: #F8F2EE;
  --dpc-accent: #CA4B00;
  --dpc-accent-dark: #B84624;
  --dpc-top: 7.5rem; /* sticky sidebar offset: ~120px, clear of the global header (4rem / 5rem) */
}

/* ---------- Layout ---------- */
.dp-course__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding-top: 1.5rem;
  padding-bottom: 4rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .dp-course__layout { grid-template-columns: 19rem minmax(0, 1fr); gap: 3rem; padding-top: 2rem; }
}
.dp-course__main { min-width: 0; width: 100%; max-width: 64rem; }

/* ---------- Navigation (desktop: sticky column) ---------- */
.dp-course__nav {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--dpc-line);
  border-radius: 14px;
  overflow: hidden;
}
@media (min-width: 1024px) {
  /* The sidebar stays put under the header; only the chapter list scrolls, so every chapter stays reachable. */
  .dp-course__nav {
    position: sticky;
    top: var(--dpc-top);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--dpc-top) - 1.25rem);
    overflow: hidden;
  }
  .dp-course__nav-head { flex: none; }
  .dp-course__tree {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}
.dp-course__nav-head { position: relative; padding: 1rem 1rem .85rem; background: var(--dpc-soft); border-bottom: 1px solid var(--dpc-line); }
.dp-course__nav-title {
  display: block;
  padding-right: 2.5rem;
  font: 800 .8125rem/1.3 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dpc-accent);
  text-decoration: none;
}
.dp-course__progress-text { margin: .4rem 0 0; font-size: .8125rem; color: var(--dpc-muted); }
.dp-course__bar { height: 4px; margin-top: .5rem; border-radius: 4px; background: #E6DDD7; overflow: hidden; }
.dp-course__bar span { display: block; height: 100%; background: var(--dpc-accent); border-radius: 4px; }
.dp-course__close { display: none; }

.dp-course__tree { padding: .5rem .5rem 1rem; }
.dp-course__home,
.dp-course__chapter ol a {
  display: block;
  padding: .4rem .65rem;
  border-radius: 8px;
  font-size: .875rem;
  line-height: 1.35;
  color: var(--dpc-ink);
  text-decoration: none;
}
.dp-course__home { font-weight: 700; margin-bottom: .25rem; }
.dp-course__home:hover,
.dp-course__chapter ol a:hover { background: var(--dpc-soft); color: var(--dpc-accent-dark); }
.dp-course__home.is-active,
.dp-course__chapter ol a.is-active {
  background: #FCEDE6;
  color: var(--dpc-accent-dark);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--dpc-accent);
}
.dp-course__home:focus-visible,
.dp-course__chapter ol a:focus-visible,
.dp-course__chapter summary:focus-visible,
.dp-course__toggle:focus-visible,
.dp-course__close:focus-visible,
.dp-course__pager-link:focus-visible { outline: 2px solid var(--dpc-accent); outline-offset: 2px; }

.dp-course__chapter { margin-top: .15rem; border-top: 1px solid #F0E8E3; }
.dp-course__chapter:first-of-type { border-top: 0; }
.dp-course__chapter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .65rem;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--dpc-ink);
}
.dp-course__chapter summary::-webkit-details-marker { display: none; }
.dp-course__chapter summary::after {
  content: "";
  flex: none;
  width: .5rem; height: .5rem;
  border-right: 2px solid var(--dpc-muted); border-bottom: 2px solid var(--dpc-muted);
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
.dp-course__chapter[open] > summary::after { transform: rotate(45deg); }
.dp-course__chapter summary:hover { background: var(--dpc-soft); }
.dp-course__chapter.is-current > summary { color: var(--dpc-accent-dark); }
.dp-course__chapter-title { flex: 1; min-width: 0; }
.dp-course__chapter-count { margin-left: auto; font: 500 .6875rem/1 "JetBrains Mono", ui-monospace, monospace; color: var(--dpc-muted); }
.dp-course__chapter ol { list-style: none; margin: 0 0 .35rem .35rem; padding: 0 0 0 .5rem; border-left: 1px solid var(--dpc-line); }
.dp-course__chapter li { margin: 0; }
.dp-course__tag {
  display: inline-block;
  margin-left: .35rem;
  padding: .05rem .4rem;
  border-radius: 999px;
  background: #EFE7E2;
  color: var(--dpc-muted);
  font: 600 .625rem/1.5 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ---------- Phones / tablets: drawer ---------- */
.dp-course__mobilebar { position: sticky; top: 4rem; z-index: 30; background: #FFFBF9; border-bottom: 1px solid var(--dpc-line); }
@media (min-width: 640px) { .dp-course__mobilebar { top: 5rem; } }
@media (min-width: 1024px) { .dp-course__mobilebar { display: none; } }
.dp-course__toggle {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: 3rem;
  padding: .5rem 0;
  background: none;
  border: 0;
  text-align: left;
  font: 700 .9375rem/1.2 Inter, system-ui, sans-serif;
  color: var(--dpc-ink);
  cursor: pointer;
}
.dp-course__toggle .material-symbols-outlined { color: var(--dpc-accent); }
.dp-course__toggle-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-course__toggle-pos { flex: none; font: 500 .75rem/1 "JetBrains Mono", ui-monospace, monospace; color: var(--dpc-muted); }

@media (max-width: 1023px) {
  .dp-course__nav {
    position: fixed;
    z-index: 9980;
    top: 0; bottom: 0; left: 0;
    width: min(22rem, 88vw);
    max-height: none;
    border-radius: 0 14px 14px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .dp-course__nav.is-open { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: 0 10px 40px rgba(28, 27, 31, .25); }
  .dp-course__overlay { position: fixed; z-index: 9970; inset: 0; background: rgba(28, 27, 31, .45); }
  .dp-course__overlay[hidden] { display: none; }
  .dp-course__close {
    position: absolute; top: .55rem; right: .55rem;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.5rem; height: 2.5rem;
    background: #fff; border: 1px solid var(--dpc-line); border-radius: 10px;
    color: var(--dpc-ink); cursor: pointer;
  }
  html.dp-course-lock { overflow: hidden; }
}
@media (min-width: 1024px) { .dp-course__overlay { display: none; } }

/* ---------- Lesson header + pager ---------- */
.dp-course__header { margin-bottom: 1.5rem; }
.dp-course__eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .5rem; font-size: .8125rem; color: var(--dpc-muted); }
.dp-course__eyebrow a { font-weight: 700; color: var(--dpc-accent); text-decoration: none; }
.dp-course__eyebrow a:hover { text-decoration: underline; }
.dp-course__title {
  margin: 0 0 .6rem;
  font: 800 clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem)/1.15 "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  letter-spacing: -.02em;
  color: var(--dpc-ink);
}
.dp-course__meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0 0 1rem; font-size: .8125rem; color: var(--dpc-muted); }
.dp-course__pager { display: flex; justify-content: space-between; gap: .75rem; }
.dp-course__pager-link {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 2.75rem;
  padding: .5rem .9rem;
  background: #fff;
  border: 1px solid var(--dpc-line);
  border-radius: 10px;
  color: var(--dpc-ink);
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.dp-course__pager-link:hover { border-color: var(--dpc-accent); background: #FFFBF9; }
.dp-course__pager-link--next { margin-left: auto; text-align: right; align-items: flex-end; background: var(--dpc-accent); border-color: var(--dpc-accent); color: #fff; }
.dp-course__pager-link--next:hover { background: var(--dpc-accent-dark); border-color: var(--dpc-accent-dark); }
.dp-course__pager-dir { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; font-weight: 700; }
.dp-course__pager-dir .material-symbols-outlined { font-size: 1.1rem; }
.dp-course__pager-title { margin-top: .15rem; font-size: .8125rem; font-weight: 500; opacity: .85; }
.dp-course__pager--titles .dp-course__pager-link { flex: 1 1 0; max-width: 24rem; padding: .75rem 1rem; }
.dp-course__footer { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--dpc-line); }

/* ---------- Lesson content ---------- */
.dp-course__content { font-size: 1.0625rem; line-height: 1.75; }
.dp-course__content > * + * { margin-top: 1.1em; }
.dp-course__content h2 { margin-top: 2em; font-size: 1.5rem; line-height: 1.3; }
.dp-course__content h3 { margin-top: 1.7em; font-size: 1.2rem; line-height: 1.35; }
.dp-course__content :where(table) { display: block; max-width: 100%; overflow-x: auto; }
.dp-course__content .dp-code-editor { margin: 1.25rem 0; }
.dp-course__content :where(code):not(.dp-code-editor *) { padding: .1em .35em; background: var(--dpc-soft); border-radius: 5px; font-size: .9em; }

/* Callouts written with the Group block + class (editor-friendly, no custom block needed) */
.dp-course__content .dp-note,
.dp-course__content .dp-tip,
.dp-course__content .dp-mistake,
.dp-course__content .dp-exercise {
  padding: 1rem 1.15rem;
  border: 1px solid var(--dpc-line);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff;
}
.dp-course__content .dp-note { border-left-color: #2563EB; background: #F5F8FF; }
.dp-course__content .dp-tip { border-left-color: #15803D; background: #F4FBF6; }
.dp-course__content .dp-mistake { border-left-color: #B91C1C; background: #FEF6F6; }
.dp-course__content .dp-exercise { border-left-color: var(--dpc-accent); background: #FFF7F3; }
.dp-course__content .dp-note > :first-child,
.dp-course__content .dp-tip > :first-child,
.dp-course__content .dp-mistake > :first-child,
.dp-course__content .dp-exercise > :first-child { margin-top: 0; }
.dp-course__content .dp-note > :last-child,
.dp-course__content .dp-tip > :last-child,
.dp-course__content .dp-mistake > :last-child,
.dp-course__content .dp-exercise > :last-child { margin-bottom: 0; }
.dp-course__content .wp-block-details { padding: .75rem 1rem; border: 1px solid var(--dpc-line); border-radius: 10px; background: #fff; }
.dp-course__content .wp-block-details summary { cursor: pointer; font-weight: 700; }
.dp-course__content .wp-block-details[open] summary { margin-bottom: .6rem; }

/* ---------- Course home overview ---------- */
.dp-course__overview { margin-top: 2.5rem; }
.dp-course__overview h2 { margin: 0 0 1rem; font: 800 1.5rem/1.3 "Plus Jakarta Sans", Inter, sans-serif; letter-spacing: -.015em; }
.dp-course__overview-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 700px) { .dp-course__overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dp-course__overview-card { padding: 1rem 1.15rem; background: #fff; border: 1px solid var(--dpc-line); border-radius: 12px; }
.dp-course__overview-card h3 { margin: 0 0 .3rem; font: 800 1rem/1.3 "Plus Jakarta Sans", Inter, sans-serif; }
.dp-course__overview-card p { margin: 0 0 .5rem; font-size: .875rem; color: var(--dpc-muted); }
.dp-course__overview-card ul { margin: 0; padding: 0; list-style: none; }
.dp-course__overview-card li { margin: 0; }
.dp-course__overview-card a { display: block; padding: .2rem 0; font-size: .9rem; color: var(--dpc-ink); text-decoration: none; }
.dp-course__overview-card a:hover { color: var(--dpc-accent-dark); text-decoration: underline; }

/* ---------- Try it (real, sandboxed preview of a code example) ---------- */
.dp-tryit__btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem;
  background: var(--dpc-accent); border: 0; border-radius: 6px;
  color: #fff; font: 700 .75rem/1.6 Inter, system-ui, sans-serif; cursor: pointer;
}
.dp-tryit__btn:hover { background: var(--dpc-accent-dark); }
.dp-tryit__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.dp-tryit__panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid #30363d; background: #0d1117; }
.dp-tryit__panel[hidden] { display: none; }
@media (min-width: 760px) { .dp-tryit__panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.dp-tryit__col { display: flex; flex-direction: column; min-width: 0; }
.dp-tryit__col + .dp-tryit__col { border-top: 1px solid #30363d; background: #fff; }
@media (min-width: 760px) { .dp-tryit__col + .dp-tryit__col { border-top: 0; border-left: 1px solid #30363d; } }
.dp-tryit__label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .75rem; background: #161b22; color: #c9d1d9; font: 600 .6875rem/1.4 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; }
.dp-tryit__col + .dp-tryit__col .dp-tryit__label { background: #F8F2EE; color: var(--dpc-muted); }
.dp-tryit__actions { display: flex; gap: .4rem; }
.dp-tryit__run, .dp-tryit__reset { padding: .1rem .55rem; border: 1px solid #484f58; border-radius: 5px; background: transparent; color: #e6edf3; font: 600 .6875rem/1.6 Inter, sans-serif; cursor: pointer; text-transform: none; letter-spacing: 0; }
.dp-tryit__run { background: #238636; border-color: #238636; }
.dp-tryit__panel textarea {
  flex: 1; min-height: 14rem; width: 100%; box-sizing: border-box; padding: .75rem; resize: vertical;
  background: #0d1117; color: #e6edf3; border: 0; outline: 0;
  font: 400 .8125rem/1.6 "JetBrains Mono", ui-monospace, monospace; tab-size: 2; white-space: pre;
}
.dp-tryit__panel textarea:focus-visible { outline: 2px solid var(--dpc-accent); outline-offset: -2px; }
.dp-tryit__panel iframe { flex: 1; width: 100%; max-width: 100%; min-height: 14rem; border: 0; background: #fff; resize: horizontal; overflow: auto; } /* drag the corner to narrow the result and test media queries */
.dp-tryit__panel iframe[data-off] { flex: none; width: 100%; height: 24px; min-height: 0; border: 0; position: absolute; left: 0; bottom: 0; opacity: 0; pointer-events: none; resize: none; } /* JS-only examples run in it but show only the console; kept a real size because browsers throttle tiny frames */
.dp-tryit__col { position: relative; }
.dp-tryit__console { max-height: 14rem; overflow: auto; padding: .5rem .75rem; background: #0d1117; border-top: 1px solid #30363d; color: #e6edf3; font: 400 .8125rem/1.55 "JetBrains Mono", ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
.dp-tryit__console[hidden] { display: none; }
.dp-tryit__console--main { flex: 1; max-height: none; min-height: 14rem; border-top: 0; }
.dp-tryit__console--main:empty::before { content: "No output yet. Add a console.log() line and press Run."; color: #8b949e; }
.dp-tryit__line { padding: .1rem 0; }
.dp-tryit__line.is-error { color: #ff7b72; }
.dp-tryit__line.is-warn { color: #e3b341; }
.dp-tryit__hint { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .75; }

/* ---------- React playground (jsx / tsx Try it, assets/js/react-playground.js) ---------- */
.dp-tryit__copy { padding: .1rem .55rem; border: 1px solid #484f58; border-radius: 5px; background: transparent; color: #e6edf3; font: 600 .6875rem/1.6 Inter, sans-serif; cursor: pointer; text-transform: none; letter-spacing: 0; }
.dp-rpg__editor { position: relative; flex: 1; min-height: 18rem; background: #0d1117; }
.dp-rpg__hl, .dp-tryit__panel .dp-rpg__editor textarea {
  margin: 0; padding: .75rem .75rem 1.5rem; border: 0; box-sizing: border-box;
  font: 400 .8125rem/1.6 "JetBrains Mono", ui-monospace, monospace; tab-size: 2; white-space: pre; letter-spacing: 0; word-spacing: 0;
}
.dp-rpg__hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: #e6edf3; background: transparent; }
.dp-rpg__hl code { font: inherit; color: inherit; background: none; padding: 0; }
.dp-tryit__panel .dp-rpg__editor textarea { position: relative; display: block; width: 100%; height: 100%; min-height: 18rem; overflow: auto; resize: none; background: transparent; color: transparent; caret-color: #e6edf3; }
.dp-rpg__editor textarea::selection { background: rgba(88, 166, 255, .35); color: transparent; }
.dp-rpg__hl .tok-attr-name { color: #79c0ff; } .dp-rpg__hl .tok-attr-value { color: #a5d6ff; } .dp-rpg__hl .tok-tag { color: #7ee787; } .dp-rpg__hl .tok-punctuation { color: #8b949e; }
.dp-rpg iframe { min-height: 18rem; resize: both; }
.dp-rpg .dp-tryit__actions button { white-space: nowrap; }
.dp-rpg__tabs { display: flex; background: #161b22; border-bottom: 1px solid #30363d; }
.dp-rpg__tabs button { flex: 1; padding: .55rem; border: 0; background: transparent; color: #8b949e; font: 600 .75rem/1.4 Inter, system-ui, sans-serif; cursor: pointer; }
.dp-rpg__tabs button[aria-selected="true"] { color: #fff; box-shadow: inset 0 -2px 0 var(--dpc-accent); }
.dp-rpg__tabs button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
@media (min-width: 760px) { .dp-rpg__tabs { display: none; } }
@media (max-width: 759px) {
  .dp-rpg[data-pane="code"] .dp-rpg__preview, .dp-rpg[data-pane="preview"] .dp-rpg__code { display: none; }
}
/* Lesson type label at the top of every React lesson */
.dp-lesson-mode { display: inline-block; margin: 0 0 1.25rem; padding: .25rem .75rem; border: 1px solid var(--dpc-line); border-radius: 999px; background: var(--dpc-soft); color: var(--dpc-muted); font: 500 .8125rem/1.5 Inter, system-ui, sans-serif; }
.dp-lesson-mode strong { color: var(--dpc-accent-dark); }

@media (prefers-reduced-motion: reduce) {
  .dp-course__nav, .dp-course__chapter summary::after, .dp-course__pager-link { transition: none; }
}
