/* ============================================================================
   editor-components.css: styles for components added with the online editor
   ----------------------------------------------------------------------------
   The online editor links this file from a lesson the first time content is
   added, moved or rearranged in it. Most rules use :where() so that they have
   no specificity, and a lesson's own styles take precedence. The callout
   colours, R code and slide parts carry a little more weight, as noted below.
   ============================================================================ */

/* Figures: image, caption and source line. */
:where(figure.lesson-figure) { margin: 18px auto; max-width: 760px; text-align: center; }
:where(figure.lesson-figure.w-small) { max-width: 360px; }
:where(figure.lesson-figure.w-medium) { max-width: 560px; }
:where(figure.lesson-figure.w-large) { max-width: 760px; }
:where(figure.lesson-figure.w-full) { max-width: none; }
:where(figure.lesson-figure img) { display: block; width: 100%; height: auto; border: 1px solid var(--grey, #E8ECEE); border-radius: 8px; }
:where(figure.lesson-figure figcaption) { font-size: 12.5px; color: var(--text-light, #5F6B6D); margin-top: 6px; line-height: 1.5; }
:where(.figure-source) { display: block; margin-top: 3px; font-size: 12px; color: #6b7280; }

/* A note or source line under a table. */
:where(p.table-note) { font-size: 12px; color: #6b7280; margin: 6px 2px 16px; line-height: 1.5; }

/* Key figures, for lessons whose own styles do not include them. */
:where(.key-figure) { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--grey, #E8ECEE); align-items: baseline; }
:where(.key-figure-name) { font-weight: 700; color: var(--dark-teal, #065C50); flex: 0 0 200px; }
:where(.key-figure-dates) { color: var(--text-light, #5F6B6D); flex: 0 0 110px; font-size: 13.5px; }
:where(.key-figure-contrib) { flex: 1 1 200px; font-size: 14px; }

/* Course boxes, for lessons whose own styles do not include them. */
:where(.methods-box) { background: linear-gradient(135deg, #F0EFFE 0%, #E8E7FA 100%); border: 1px solid #C7C3F5; border-left: 5px solid #5B4FCF; border-radius: 10px; padding: 22px 26px; margin: 32px 0; }
:where(.methods-box h4) { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #3D2E9E; }
:where(.methods-box h5) { margin: 0 0 14px; font-size: 18px; font-weight: 700; color: #1F1454; line-height: 1.35; }
:where(.methods-box p) { margin: 0 0 10px; font-size: 14.5px; line-height: 1.75; color: #2A1F5C; }
:where(.today-box) { background: #FFFBEA; border: 1px solid #F5E6A8; border-left: 5px solid #B8860B; border-radius: 10px; padding: 18px 22px; margin: 28px 0; }
:where(.today-box h4) { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #7A5A00; }
:where(.today-box p) { margin: 0 0 8px; font-size: 14.5px; line-height: 1.7; color: #3A2E00; }
:where(.task-card) { background: linear-gradient(135deg, #fffbf0 0%, #fff5d9 100%); border-radius: var(--radius, 10px); padding: 22px 24px; margin: 20px 0; border-left: 4px solid #c97a30; box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, .06)); }
:where(.task-card .task-title) { font-weight: 700; color: #8a4a14; margin-bottom: 8px; font-size: 15px; }
:where(.task-card ol, .task-card ul) { margin-left: 22px; }
:where(.task-card li) { margin-bottom: 6px; font-size: 14.5px; color: #4a3a20; }
:where(.memo-card) { background: #f5f0ff; border: 1px solid #d4bfff; border-radius: var(--radius, 10px); padding: 20px 24px; margin: 20px 0; box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, .06)); }
:where(.memo-card .memo-title) { font-weight: 700; color: #6B21A8; font-size: 14.5px; margin-bottom: 6px; letter-spacing: 0.3px; text-transform: uppercase; }
:where(.memo-card .memo-meta) { font-size: 12px; color: #888; margin-bottom: 10px; }
:where(.memo-card p) { font-size: 14.5px; margin-bottom: 10px; }
:where(.transcript-excerpt) { background: #FAFAF9; border-left: 4px solid var(--dark-teal, #065C50); border-radius: 0 8px 8px 0; padding: 14px 18px; margin: 16px 0; font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; color: #1F2937; white-space: pre-wrap; }
:where(.transcript-excerpt .speaker) { font-weight: 700; color: var(--accent-dark, #A3002A); }
:where(.transcript-excerpt .annot) { color: #7C3AED; font-style: italic; }
:where(.citations) { background: var(--grey, #E8ECEE); border-radius: var(--radius, 10px); padding: 24px; margin: 32px 0; font-size: 13px; line-height: 1.8; }
:where(.citations h3) { color: var(--text, #2D3436); margin-top: 0; }
:where(.ca-transcript) { background: #1F1B16; color: #F5E9DA; border-radius: 8px; padding: 16px 18px; margin: 16px 0; font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-x: auto; }
:where(.ca-transcript .ca-speaker) { color: #FCA5A5; font-weight: 700; }
:where(.ca-transcript .ca-notation) { color: #93C5FD; }
:where(.ca-transcript .ca-emphasis) { text-decoration: underline; color: #FDE68A; }
:where(.diagram-box) { background: #f8fafc; border: 2px solid var(--grey, #E8ECEE); border-radius: var(--radius, 10px); padding: 24px; margin: 24px 0; text-align: center; }
:where(.diagram-box svg) { max-width: 100%; height: auto; }
:where(.glossary-section-title) { font-size: 12px; font-weight: 700; color: var(--text-light, #5F6B6D); text-transform: uppercase; letter-spacing: 0.8px; margin: 28px 0 10px; padding-top: 12px; border-top: 1px solid var(--grey, #E8ECEE); }

/* Blue, purple and grey callouts. These rules carry the weight of one class,
   so they replace a lesson's default callout colour and give way to a
   lesson's own colour rules. */
:where(.info-box).blue { background: var(--light-blue, #EFF6FF); border-color: var(--blue, #3B82F6); }
:where(.info-box).purple { background: var(--light-purple, #F3E8FF); border-color: var(--purple, #A855F7); }
:where(.info-box).grey { background: #F3F4F6; border-color: #9CA3AF; }

/* R code and console output outside the R example boxes. */
.r-snippet { margin: 10px 0 12px; }
.r-snippet pre { background: #1F1B16; color: #F5E9DA; border-radius: 8px; padding: 12px 14px; margin: 8px 0 6px; overflow-x: auto; font-family: 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 12.5px; line-height: 1.55; white-space: pre; }
.r-snippet pre code { font-family: inherit; color: inherit; background: none; padding: 0; }
.r-snippet .r-comment { color: #FDBA74; font-style: italic; }
.r-snippet .r-keyword { color: #FCA5A5; font-weight: 600; }
.r-snippet .r-string { color: #86EFAC; }
.r-snippet .r-fn { color: #93C5FD; }
.r-snippet .r-num { color: #FCD34D; }
.r-snippet .r-output { background: #FFFBF5; color: #44403C; border: 1px dashed #FED7AA; border-radius: 8px; padding: 10px 14px; margin: 4px 0 8px; font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; white-space: pre; overflow-x: auto; }
.r-snippet .r-output-label { font-size: 10.5px; color: #C2410C; font-weight: 700; letter-spacing: 0.5px; margin: 6px 0 2px; text-transform: uppercase; }

/* Parts added to slides in the editor: text boxes, speech bubbles, shapes,
   lines, arrows and pictures. Each is placed in percent of the slide, and its
   colours are set on the element with --sl-fill and --sl-line. */
.av-slide .sl-item { box-sizing: border-box; }
.av-slide .sl-text { padding: 4px 6px; background: var(--sl-fill, transparent); }
.av-slide .sl-text p, .av-slide .sl-bubble p { margin: 0 0 6px; }
.av-slide .sl-text p:last-child, .av-slide .sl-bubble p:last-child { margin-bottom: 0; }
.av-slide .sl-shape { border: 2px solid var(--sl-line, #0B7B6B); background: var(--sl-fill, #E6F3F0); }
.av-slide .sl-shape.sl-round { border-radius: 16px; }
.av-slide .sl-shape.sl-ellipse { border-radius: 50%; }
.av-slide .sl-line { height: 18px; color: var(--sl-line, #0B7B6B); }
.av-slide .sl-line::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px solid currentColor; transform: translateY(-50%); }
.av-slide .sl-line.sl-arrow::before { right: 10px; }
.av-slide .sl-line.sl-arrow::after { content: ''; position: absolute; right: 0; top: 50%; transform: translateY(-50%); border-left: 14px solid currentColor; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.av-slide .sl-bubble { background: var(--sl-fill, #FFFFFF); border: 2px solid var(--sl-line, #0B7B6B); border-radius: 16px; padding: 12px 16px; }
.av-slide .sl-bubble p, .av-slide.divider .sl-bubble p { color: #1B2826; }
.av-slide .sl-bubble::after { content: ''; position: absolute; width: 16px; height: 16px; background: var(--sl-fill, #FFFFFF); transform: rotate(45deg); }
.av-slide .sl-bubble.tail-bl::after { left: 28px; bottom: -10px; border-right: 2px solid var(--sl-line, #0B7B6B); border-bottom: 2px solid var(--sl-line, #0B7B6B); }
.av-slide .sl-bubble.tail-br::after { right: 28px; bottom: -10px; border-right: 2px solid var(--sl-line, #0B7B6B); border-bottom: 2px solid var(--sl-line, #0B7B6B); }
.av-slide .sl-bubble.tail-t::after { left: 28px; top: -10px; border-left: 2px solid var(--sl-line, #0B7B6B); border-top: 2px solid var(--sl-line, #0B7B6B); }
.av-slide .sl-bubble.tail-l::after { left: -10px; top: calc(50% - 8px); border-left: 2px solid var(--sl-line, #0B7B6B); border-bottom: 2px solid var(--sl-line, #0B7B6B); }
.av-slide .sl-bubble.tail-r::after { right: -10px; top: calc(50% - 8px); border-right: 2px solid var(--sl-line, #0B7B6B); border-top: 2px solid var(--sl-line, #0B7B6B); }
.av-slide img.sl-pic { display: block; height: auto; max-width: none; border-radius: 6px; }
