/* R for Psychological Research: course pages for the MC³ Lab site.
   Layout: the site header, then a two-column course shell on wide screens
   (lesson list | reading column of about 68 characters), one column on phones.
   Light only, matching the rest of the MC³ Lab site. */
:root {
  --paper: #FAF8EF;
  --ink: #0B1320;
  --text: #2B3542;
  --muted: #5A6573;
  --line: #E8E2D2;
  --card: #FFFFFF;
  --slate: #394D5F;
  --link: #2D5878;
  --green: #2F5A4F;
  --rust: #9A3A1E;
  --gold: #F2C14E;
  --cream: #FEF9E6;
  --mist: #EEF2F5;
  --tip-bg: #E7EFEA;
  --err-bg: #F8E9E3;
  --on-dark: #FFFFFF;
  --foot-text: #DCE3EA;
  --code-bg: #15212D;
  --code-bar: #1E2D3B;
  --code-fg: #EDE9DD;
  --code-dim: #AFC0CF;
  --code-line: #4A5D70;
  --o-msg: #6B5E45;
  --o-warn: #8A5300;
  --f-display: 'Zilla Slab', Georgia, serif;
  --f-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.6; }
a { color: var(--link); }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
img { max-width: 100%; }
code, pre, kbd, .file { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }

/* ---------- site header (same as the other MC³ Lab pages) ---------- */
.site-head { border-bottom: 1px solid var(--line); }
.site-head-in { max-width: 1200px; margin: 0 auto; padding: 14px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 46px; height: 48px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--f-display); font-size: 26px; font-weight: 700; }
.brand-sub { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; font-weight: 600; font-size: 16px; }
.site-nav a { position: relative; isolation: isolate; color: var(--ink); text-decoration: none; transition: background-color .15s ease, color .15s ease; }
.site-nav a:not(.nav-join)::before { content: ""; position: absolute; inset: -7px -12px; border-radius: 999px; border: 1.5px solid transparent; z-index: -1; transition: border-color .15s ease; }
.site-nav a:not(.nav-join):focus-visible::before { border-color: var(--ink); }
.nav-join { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--ink); }
@media (hover: hover) {
  .site-nav a:not(.nav-join):hover::before { border-color: var(--ink); }
  .site-nav .nav-join:hover { background: var(--ink); color: var(--on-dark); }
}

/* ---------- footer ---------- */
.site-foot { background: var(--ink); color: var(--foot-text); margin-top: 96px; }
.site-foot-in { max-width: 1200px; margin: 0 auto; padding: 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; font-size: 15px; }
.foot-l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.foot-l img { flex: 0 0 auto; width: 38px; height: 40px; object-fit: contain; }
.site-foot a { color: var(--on-dark); font-weight: 600; }

/* ---------- course shell ---------- */
.course { max-width: 1200px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 56px; align-items: start; }
.course-nav { position: sticky; top: env(safe-area-inset-top, 0px); padding-top: 44px; max-height: 100vh; overflow-y: auto; box-sizing: border-box; padding-bottom: 24px; }
.cn-box > summary { display: none; }
.cn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cn-list a { display: flex; gap: 8px; padding: 7px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 15px; line-height: 1.35; }
.cn-list a:hover { background: var(--mist); color: var(--ink); }
.cn-num { flex: 0 0 20px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.cn-list a.is-active { background: var(--slate); color: var(--on-dark); font-weight: 600; }
.cn-list a.is-active .cn-num { color: var(--foot-text); }
.cn-toc { list-style: none; margin: 6px 0 10px 19px; padding: 0 0 0 8px; border-left: 1.5px solid var(--line); display: flex; flex-direction: column; }
.cn-toc a { font-size: 14px; padding: 4px 10px; color: var(--muted); }
.course-main { min-width: 0; padding-top: 44px; max-width: 760px; }

/* ---------- lesson head ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); font-weight: 600; }
.eyebrow { margin: 18px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
h1 { margin: 0; font-family: var(--f-display); font-size: 52px; line-height: 1.04; font-weight: 700; text-wrap: balance; text-shadow: 3px 3px 0 rgba(11, 19, 32, 0.12); }
.lede { margin: 14px 0 0; font-size: 20px; line-height: 1.5; color: var(--text); max-width: 62ch; }
.lesson-meta { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 20px 40px; padding: 22px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.learn { flex: 1 1 320px; min-width: 0; }
.learn ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.files { flex: 1 1 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-d { font-size: 15px; color: var(--text); }
.meta-label { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.file { display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 13px; border: 1.5px solid var(--ink); border-radius: 999px; font-family: var(--f-mono); font-size: 13.5px; text-decoration: none; color: var(--ink); }
.file:hover { background: var(--ink); color: var(--on-dark); }
.file-k { font-family: var(--f-body); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.file:hover .file-k { color: var(--foot-text); }
.before { flex: 1 1 100%; margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- reading column ---------- */
.prose { overflow-wrap: break-word; }
.prose h2 { margin: 60px 0 12px; font-family: var(--f-display); font-size: 34px; line-height: 1.12; font-weight: 700; text-wrap: balance; scroll-margin-top: 16px; }
.prose h3 { margin: 30px 0 8px; font-size: 20px; line-height: 1.3; font-weight: 700; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; max-width: 68ch; }
.prose li { margin: 3px 0; }
.prose li > p { margin: 0 0 6px; }
.prose code { font-family: var(--f-mono); font-size: 0.86em; background: var(--mist); color: var(--ink); padding: 0.12em 0.38em; border-radius: 5px; overflow-wrap: anywhere; }
.prose pre code { background: none; color: inherit; padding: 0; border-radius: 0; font-size: inherit; overflow-wrap: normal; }
kbd { font-family: var(--f-body); font-size: 0.82em; font-weight: 600; padding: 0.1em 0.5em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--card); color: var(--ink); white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; }
.prose th, .prose td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--paper); }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* ---------- code, output, plots ---------- */
.chunk { margin: 18px 0 24px; display: flex; flex-direction: column; gap: 10px; }
.prose > .code, .reveal-body > .code, .exercise > .code { margin: 16px 0 20px; }
.code { background: var(--code-bg); border-radius: 12px; overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 8px 5px 14px; background: var(--code-bar); color: var(--code-dim); font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.copy { font: inherit; font-size: 11.5px; letter-spacing: 0.04em; color: var(--code-fg); background: transparent; border: 1px solid var(--code-line); border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.copy:hover { background: var(--code-fg); color: var(--code-bg); }
.copy.done { border-color: var(--code-fg); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; color: var(--code-fg); font-family: var(--f-mono); font-size: 14px; line-height: 1.6; tab-size: 2; }
.code .c, .code .c1 { color: #93A4B5; font-style: italic; }
.code .s, .code .s1, .code .s2 { color: #E8C872; }
.code .m, .code .mi, .code .mf { color: #F2A07B; }
.code .kc, .code .kr, .code .k { color: #8DC3E8; }
.code .nf { color: #FFFFFF; font-weight: 600; }
.code .o { color: #A9DCC6; }
.out { background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.out-label { display: block; padding: 7px 14px 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.out pre { margin: 0; padding: 6px 14px 13px; overflow-x: auto; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.5; color: var(--text); }
.o-message { color: var(--o-msg); }
.o-warning { color: var(--o-warn); }
.o-error { color: var(--rust); font-weight: 600; }
figure.plot { margin: 0; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
figure.plot img { display: block; width: 100%; height: auto; }
figure.plot figcaption { padding: 8px 4px 2px; font-size: 14px; color: var(--muted); }

/* ---------- callouts ---------- */
.callout { margin: 22px 0; padding: 16px 20px; border-radius: 14px; background: var(--cream); }
.callout > :last-child { margin-bottom: 0; }
.callout p, .callout ul, .callout ol { max-width: none; }
.callout-label { display: inline-block; margin: 0 0 8px !important; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; background: var(--ink); color: var(--on-dark); }
.callout.tip { background: var(--tip-bg); }
.callout.tip .callout-label { background: var(--green); }
.callout.error, .callout.warn { background: var(--err-bg); }
.callout.error .callout-label, .callout.warn .callout-label { background: var(--rust); }
.callout.plain { background: var(--mist); }
.callout.plain .callout-label { background: var(--slate); }
.callout.note .callout-label { background: var(--gold); color: var(--ink); }
.callout.check { background: var(--card); border: 1px solid var(--line); }
.callout.check .callout-label { background: var(--green); }
.callout .chunk { margin: 12px 0; }

/* ---------- exercises ---------- */
.exercise { margin: 30px 0; padding: 22px 24px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 16px; min-width: 0; }
.exercise > :last-child { margin-bottom: 0; }
.ex-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.ex-num { font-family: var(--f-display); font-size: 21px; font-weight: 700; }
.ex-data { font-size: 14px; color: var(--muted); }
.ex-data a { font-family: var(--f-mono); font-size: 13px; }
.exercise h3 { margin: 6px 0 10px; font-size: 19px; }
.exercise p, .exercise ol, .exercise ul { max-width: none; }
details.reveal { margin-top: 10px; }
details.reveal > summary { display: inline-flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; padding: 7px 16px; border-radius: 999px; border: 1.5px solid var(--ink); font-size: 15px; font-weight: 600; color: var(--ink); background: var(--card); user-select: none; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary::before { content: "+"; font-family: var(--f-mono); font-weight: 600; }
details.reveal[open] > summary::before { content: "−"; }
details.reveal.answer > summary { background: var(--ink); color: var(--on-dark); }
details.reveal[open] .when-closed, details.reveal:not([open]) .when-open { display: none; }
.reveal-body { margin-top: 14px; }
.reveal-body > :last-child { margin-bottom: 0; }
.hint .reveal-body { padding: 12px 16px; background: var(--cream); border-radius: 12px; }

/* ---------- previous / next ---------- */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; }
.pn { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); min-width: 0; }
.pn:hover { border-color: var(--ink); color: var(--ink); }
.pn.next { text-align: right; grid-column: 2; }
.pn-k { font-size: 13px; font-weight: 600; color: var(--muted); }
.pn-t { font-family: var(--f-display); font-size: 20px; font-weight: 700; line-height: 1.2; }

/* ---------- course home ---------- */
.lesson-cards { list-style: none; margin: 20px 0 28px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: none !important; }
.lesson-cards li { margin: 0; }
.lesson-cards a { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 16px; padding: 15px 20px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.lesson-cards a:hover { border-color: var(--ink); color: var(--ink); }
.lc-num { font-family: var(--f-display); font-size: 30px; font-weight: 700; line-height: 1; color: var(--slate); text-align: center; font-variant-numeric: tabular-nums; }
.lc-t { display: block; font-size: 18px; font-weight: 700; line-height: 1.3; }
.lc-s { display: block; margin-top: 2px; font-size: 15px; line-height: 1.45; color: var(--muted); }
.lc-time { font-size: 14px; color: var(--muted); white-space: nowrap; }
.home-hero { padding-bottom: 8px; }
.steps-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 8px; }
.step { padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.step b { display: block; font-family: var(--f-display); font-size: 19px; margin-bottom: 4px; }
.step p { margin: 0; font-size: 15px; color: var(--text); }

/* ---------- RStudio diagram (lesson 1) ---------- */
.rs-mock { margin: 20px 0 24px; border: 1.5px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--card); }
.rs-top { padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--paper); }
.rs-grid { display: grid; grid-template-columns: 1.25fr 1fr; grid-template-rows: auto auto; }
.rs-pane { padding: 14px 16px; min-height: 120px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.rs-pane:nth-child(2n) { border-right: 0; }
.rs-pane:nth-child(n+3) { border-bottom: 0; }
.rs-pane b { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.rs-pane b span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--slate); color: var(--on-dark); font-size: 12px; }
.rs-pane p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--text); max-width: none; }
.rs-pane code { font-size: 12.5px; }

/* ---------- narrower screens ---------- */
@media (max-width: 999px) {
  .course { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .course-nav { position: static; max-height: none; overflow: visible; padding-top: 20px; padding-bottom: 0; }
  .cn-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
  .cn-box > summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; cursor: pointer; font-weight: 700; list-style: none; }
  .cn-box > summary::-webkit-details-marker { display: none; }
  .cn-box > summary::after { content: "+"; font-family: var(--f-mono); font-size: 18px; }
  .cn-box[open] > summary::after { content: "−"; }
  .cn-box[open] > summary { border-bottom: 1px solid var(--line); }
  .cn-list { padding: 8px; }
  .cn-toc { display: none; }
  .course-main { padding-top: 28px; max-width: none; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; line-height: 1.55; }
  .site-head-in, .course, .site-foot-in { padding-left: 16px; padding-right: 16px; }
  .site-head-in { gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .site-nav { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; justify-items: start; align-items: center; gap: 8px 12px; font-size: clamp(14px, 4vw, 15.5px); white-space: nowrap; }
  .nav-join { min-height: 36px; padding: 0 11px; }
  .site-foot { margin-top: 64px; }
  h1 { font-size: 34px; line-height: 1.08; }
  .lede { font-size: 17px; }
  .lesson-meta { padding: 18px; }
  .prose h2 { font-size: 26px; margin-top: 44px; }
  .prose h3 { font-size: 18px; }
  .code pre { font-size: 13px; padding: 12px 14px; }
  .out pre { font-size: 12.5px; }
  .exercise { padding: 18px; }
  .callout { padding: 14px 16px; }
  .prevnext { grid-template-columns: 1fr; }
  .pn.next { grid-column: 1; }
  .lesson-cards a { grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 14px 16px; }
  .lc-num { font-size: 24px; }
  .file-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .steps-row { grid-template-columns: 1fr; }
  .rs-grid { grid-template-columns: 1fr; }
  .rs-pane { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; min-height: 0; }
  .rs-pane:last-child { border-bottom: 0 !important; }
}
@media (max-width: 345px) {
  .site-nav { font-size: 13.5px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- course nav parts, home groups ---------- */
.cn-part { margin: 14px 10px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cn-list > .cn-part:first-of-type { margin-top: 10px; }
.prose h3.lc-part { margin: 28px 0 0; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
.prose h3.lc-part + .lesson-cards { margin-top: 10px; }

/* ---------- diagrams ---------- */
.dg { margin: 22px 0 26px; padding: 20px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 14px; overflow-x: auto; }
.prose .dg-cap { margin: 0; font-size: 14px; color: var(--muted); text-align: center; max-width: 62ch; }
.dg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; }
.dg-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dg-code { font-family: var(--f-mono); font-size: 14px; background: var(--code-bg); color: var(--code-fg); padding: 6px 12px; border-radius: 8px; white-space: nowrap; font-variant-ligatures: none; }
.dg-arrow { display: inline-flex; flex-direction: column; align-items: center; font-size: 22px; line-height: 1; color: var(--muted); }
.dg-arrow b { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; margin-bottom: 2px; color: var(--green); font-family: var(--f-body); }
.dg-obj { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; }
.dg-tag { font-family: var(--f-mono); font-size: 13px; font-weight: 600; background: var(--gold); color: var(--ink); padding: 1px 10px; border-radius: 999px; }
.dg-val { min-width: 56px; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 10px; font-family: var(--f-mono); font-size: 18px; text-align: center; background: var(--cream); box-sizing: border-box; }
.dg-vec { display: inline-flex; }
.dg-vec > span { display: flex; flex-direction: column; align-items: center; }
.dg-cell { width: 46px; padding: 8px 0; border: 2px solid var(--ink); border-left-width: 0; text-align: center; font-family: var(--f-mono); font-size: 16px; background: var(--cream); box-sizing: border-box; }
.dg-vec > span:first-child .dg-cell { border-left-width: 2px; border-radius: 10px 0 0 10px; }
.dg-vec > span:last-child .dg-cell { border-radius: 0 10px 10px 0; }
.dg-cell.hl { background: #FBE3A0; }
.dg-idx { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.dg-fn { padding: 10px 16px; border-radius: 12px; background: var(--slate); color: var(--on-dark); font-family: var(--f-mono); font-weight: 600; font-size: 15px; }
.prose table.dg-t { width: auto; border-collapse: collapse; font-family: var(--f-mono); font-size: 13px; line-height: 1.3; background: var(--card); }
.prose table.dg-t th, .prose table.dg-t td { border: 1px solid #D9D2C0; padding: 5px 10px; text-align: center; white-space: nowrap; }
.prose table.dg-t th { background: var(--paper); color: var(--ink); font-size: 12.5px; letter-spacing: 0; text-transform: none; font-weight: 700; }
.prose table.dg-t tr:last-child td { border-bottom: 1px solid #D9D2C0; }
.prose table.dg-t .hl { background: #FBE3A0; }
.prose table.dg-t .new { background: #D8EADF; }
.prose table.dg-t .dim { color: #BDB6A6; }
.prose table.dg-t .g1 { background: #E3EAF1; } .prose table.dg-t .g2 { background: #FBEBC4; } .prose table.dg-t .g3 { background: #D8EADF; }
.dg-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.dg-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.dg-card { flex: 1 1 200px; max-width: 300px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); box-sizing: border-box; }
.dg-card b { display: block; font-size: 15px; }
.prose .dg-card p { margin: 4px 0 0; font-size: 14px; color: var(--text); max-width: none; }
.dg-card code { font-size: 12.5px; }
.dg-big { font-family: var(--f-display); font-size: 26px; font-weight: 700; line-height: 1; color: var(--slate); }
@media (max-width: 640px) {
  .dg { padding: 16px 12px; }
  .dg-code { white-space: normal; overflow-wrap: anywhere; text-align: center; }
}

/* ---------- section folders ---------- */
.cn-folder-li { list-style: none; }
.cn-folder > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 700; color: var(--ink); }
.cn-folder > summary::-webkit-details-marker { display: none; }
.cn-folder > summary::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease; margin: 0 4px 0 2px; }
.cn-folder[open] > summary::before { transform: rotate(45deg); }
.cn-folder > summary:hover { background: var(--mist); }
.cn-f-t { flex: 1 1 auto; }
.cn-f-n { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cn-sub { list-style: none; margin: 2px 0 6px; padding: 0 0 0 10px; display: flex; flex-direction: column; gap: 2px; }
.lc-folder { margin: 12px 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; }
.lc-folder[open] { border-color: var(--slate); }
.lc-folder > summary { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 18px; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; list-style: none; }
.lc-folder > summary::-webkit-details-marker { display: none; }
.lc-folder > summary::after { content: ""; width: 9px; height: 9px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); transition: transform .15s ease; justify-self: center; margin-top: -4px; }
.lc-folder[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.lcf-n { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--slate); color: var(--on-dark); font-family: var(--f-display); font-size: 22px; font-weight: 700; }
.lcf-t { display: block; font-family: var(--f-display); font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.lcf-s { display: block; margin-top: 2px; font-size: 15px; color: var(--muted); line-height: 1.4; }
.lcf-c { font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.lc-folder .lesson-cards { margin: 0; padding: 0 16px 16px; }
.lc-folder .lesson-cards a { background: var(--paper); }
@media (max-width: 640px) {
  .lc-folder > summary { grid-template-columns: 36px minmax(0, 1fr) 16px; gap: 12px; padding: 14px 16px; }
  .lcf-n { width: 34px; height: 34px; font-size: 19px; }
  .lcf-t { font-size: 19px; }
  .lcf-c { display: none; }
  .lc-folder .lesson-cards { padding: 0 10px 10px; }
}

/* current section in the main menu (Resources), as on the main site */
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; font-weight: 700; }

/* course home: cheat sheet button under the intro */
.hero-links { margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 10px 16px; }
.hero-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 2px solid var(--ink); color: var(--ink); font-weight: 600; text-decoration: none; transition: background-color .15s ease, color .15s ease; }
.hero-btn:hover, .hero-btn:focus-visible { background: var(--ink); color: var(--on-dark); }
