/* SmartTutorials Courses: uses the theme's colour presets, with fallbacks for other themes. */
:root {
	--stc-ink: var(--wp--preset--color--ink, #111827);
	--stc-soft: var(--wp--preset--color--ink-soft, #4b5563);
	--stc-brand: var(--wp--preset--color--brand, #c2410c);
	--stc-brand-dark: var(--wp--preset--color--brand-dark, #9a3412);
	--stc-accent: var(--wp--preset--color--accent, #f97316);
	--stc-sand: var(--wp--preset--color--accent-soft, #fef3c7);
	--stc-paper: var(--wp--preset--color--cream, #faf7f2);
	--stc-base: var(--wp--preset--color--base, #ffffff);
	--stc-line: var(--wp--preset--color--line, #e7e0d4);
	--stc-ok: #15803d;
	--stc-ok-bg: #dcfce7;
	--stc-err: #b91c1c;
	--stc-err-bg: #fee2e2;
	--stc-code-bg: #111827;
	--stc-code-fg: #f3f4f6;
	--stc-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	--stc-radius: 10px;
}

/* ---------- layout ---------- */
.stc-layout {
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: clamp(1.5rem, 4vw, 3.5rem);
	align-items: start;
}
.stc-layout__side {
	position: sticky;
	top: 1.5rem;
	max-height: calc(100vh - 3rem);
	overflow: auto;
}
@media (max-width: 900px) {
	.stc-layout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
	.stc-layout__side { position: static; max-height: none; overflow: visible; }
}

/* ---------- shared bits ---------- */
.stc-btn {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .55rem 1rem;
	border: 1px solid transparent;
	border-radius: 8px;
	font: inherit;
	font-size: .95rem;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	background: var(--stc-base);
	color: var(--stc-ink);
}
.stc-btn:focus-visible { outline: 3px solid var(--stc-accent); outline-offset: 2px; }
.stc-btn--primary { background: var(--stc-brand); color: #fff; }
.stc-btn--primary:hover { background: var(--stc-brand-dark); color: #fff; }
.stc-btn--run { background: var(--stc-accent); color: var(--stc-ink); }
.stc-btn--run:hover { background: #fb923c; }
.stc-btn--run[disabled] { opacity: .7; cursor: progress; }
.stc-btn--ghost { background: transparent; border-color: #374151; color: #e5e7eb; font-weight: 600; }
.stc-btn--ghost:hover { border-color: #9ca3af; color: #fff; }
.stc-stepper .stc-btn--ghost { color: var(--stc-ink); border-color: var(--stc-line); }
.stc-stepper .stc-btn--ghost:hover { color: var(--stc-ink); border-color: var(--stc-accent); }

.stc-progress {
	display: block;
	position: relative;
	height: 8px;
	border-radius: 99px;
	background: var(--stc-line);
	overflow: hidden;
}
.stc-progress__bar {
	display: block;
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: var(--stc-accent);
	transition: width .4s ease;
}
.stc-progress-wrap { display: grid; gap: .35rem; }
.stc-progress-wrap[hidden] { display: none; }
.stc-progress__label { font-size: .85rem; color: var(--stc-soft); }
.stc-badge {
	font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
	padding: .1rem .45rem; border-radius: 4px; background: var(--stc-sand); color: var(--stc-brand-dark);
}

/* ---------- lesson header ---------- */
.stc-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; font-size: .9rem; font-weight: 600; color: var(--stc-soft); }
.stc-meta a { color: var(--stc-brand); text-decoration: none; }
.stc-meta a:hover { text-decoration: underline; }

/* ---------- sidebar lesson list ---------- */
.stc-nav { font-size: .95rem; }
.stc-nav__details > summary { list-style: none; cursor: default; }
.stc-nav__details > summary::-webkit-details-marker { display: none; }
.stc-nav__summary { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .75rem; }
.stc-nav__course { font-weight: 700; font-size: 1.05rem; color: var(--stc-ink); text-decoration: none; }
.stc-nav__toggle { display: none; }
.stc-nav .stc-progress-wrap { margin-bottom: 1rem; }
.stc-nav__module { margin: 1rem 0 .35rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--stc-soft); }
.stc-nav__list, .stc-lessons { list-style: none; margin: 0; padding: 0; }
.stc-nav__soon, .stc-module__soon { margin: .2rem 0 .5rem; font-size: .9rem; color: var(--stc-soft); font-style: italic; }
.stc-lesson > a {
	display: flex; align-items: center; gap: .6rem;
	padding: .45rem .6rem; border-radius: 8px;
	color: var(--stc-ink); text-decoration: none; line-height: 1.35;
}
.stc-lesson > a:hover { background: var(--stc-paper); }
.stc-lesson.is-current > a { background: var(--stc-sand); font-weight: 700; }
.stc-lesson__tick {
	flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
	border: 2px solid var(--stc-line); background: var(--stc-base);
}
.stc-lesson.is-done .stc-lesson__tick {
	border-color: var(--stc-ok); background: var(--stc-ok)
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
@media (max-width: 900px) {
	.stc-nav { border: 1px solid var(--stc-line); border-radius: var(--stc-radius); padding: .75rem 1rem; background: var(--stc-base); }
	.stc-nav__details > summary { cursor: pointer; margin-bottom: 0; }
	.stc-nav__details[open] > summary { margin-bottom: .75rem; }
	.stc-nav__toggle { display: inline; font-weight: 700; color: var(--stc-brand); }
	.stc-nav__toggle::after { content: " ▾"; }
	.stc-nav__details[open] .stc-nav__toggle::after { content: " ▴"; }
}

/* ---------- course page ---------- */
.stc-hero { margin-bottom: 2rem; }
.stc-hero__text { max-width: 760px; }
.stc-outline__head { display: grid; gap: 1rem; justify-items: start; margin-bottom: 2rem; }
.stc-outline__facts { margin: 0; font-weight: 600; color: var(--stc-soft); }
.stc-outline__start { font-size: 1.05rem; padding: .8rem 1.4rem; }
.stc-outline .stc-progress-wrap { width: min(420px, 100%); }
.stc-modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; max-width: 860px; }
.stc-module { border: 1px solid var(--stc-line); border-radius: var(--stc-radius); padding: 1.25rem 1.25rem .75rem; background: var(--stc-base); }
.stc-module__title { display: flex; align-items: center; gap: .75rem; margin: 0 0 .35rem; font-size: 1.25rem; }
.stc-module__num {
	display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
	background: var(--stc-ink); color: #fff; font-size: .95rem;
}
.stc-module__summary { margin: 0 0 .75rem; color: var(--stc-soft); }
.stc-lesson__num { flex: 0 0 auto; min-width: 2.2rem; font-weight: 700; color: var(--stc-soft); font-variant-numeric: tabular-nums; }
.stc-lesson__title { flex: 1 1 auto; }
.stc-lesson__min { flex: 0 0 auto; font-size: .85rem; color: var(--stc-soft); }

/* ---------- course list ---------- */
.stc-course-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.stc-course-card {
	display: flex; flex-direction: column; overflow: hidden;
	border: 1px solid var(--stc-line); border-radius: var(--stc-radius);
	background: var(--stc-base); color: var(--stc-ink); text-decoration: none;
	transition: transform .15s ease, box-shadow .15s ease;
}
.stc-course-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(17, 24, 39, .1); }
.stc-course-card__img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.stc-course-card__body { display: grid; gap: .5rem; padding: 1.1rem 1.2rem 1.25rem; }
.stc-course-card__title { font-size: 1.3rem; font-weight: 700; }
.stc-course-card__desc { color: var(--stc-soft); }
.stc-course-card__meta { font-size: .85rem; font-weight: 600; color: var(--stc-soft); }
.stc-course-card .stc-progress { display: none; }
.stc-course-card.has-progress .stc-progress { display: block; }
.stc-empty { color: var(--stc-soft); }

/* ---------- code ---------- */
.stc-code { margin: 1.5rem 0; border-radius: var(--stc-radius); overflow: hidden; background: var(--stc-code-bg); color: var(--stc-code-fg); }
.stc-code__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem .75rem; border-bottom: 1px solid #1f2937; }
.stc-code__title { font-family: var(--stc-mono); font-size: .85rem; color: #9ca3af; }
.stc-code__actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.stc-code__actions .stc-btn { padding: .4rem .75rem; font-size: .85rem; }
.stc-code pre, .stc-code__editor {
	margin: 0; padding: 1rem 1.1rem; border: 0;
	font-family: var(--stc-mono); font-size: .92rem; line-height: 1.55; tab-size: 4;
	background: transparent; color: inherit; white-space: pre; overflow-x: auto;
}
.stc-code__editor { display: block; width: 100%; resize: vertical; outline: none; min-height: 80px; }
.stc-code__editor:focus { box-shadow: inset 0 0 0 2px var(--stc-accent); }
.stc-code__out { border-top: 1px solid #1f2937; padding: .25rem 0 .5rem; font-size: .92rem; }
.stc-code__out pre { padding-top: .5rem; padding-bottom: .5rem; }
.stc-code__out.is-busy { padding: .9rem 1.1rem; color: #9ca3af; }
.stc-code__out.is-ok { background: #052e16; }
.stc-code__out.is-err { background: #3b0a0a; }
.stc-code__out.is-err:not(:has(pre)) { padding: .9rem 1.1rem; }
.stc-code__win, .stc-code__errhead { margin: .6rem 1.1rem 0; font-weight: 700; }
.stc-code__win { color: #86efac; }
.stc-code__errhead { color: #fca5a5; }
.stc-code__warn { color: #fcd34d; }
.stc-code__expected { border-top: 1px solid #1f2937; padding: .5rem 1.1rem; }
.stc-code__expected summary { cursor: pointer; font-size: .85rem; color: #9ca3af; }
.stc-code__expected pre { padding: .5rem 0; }

/* ---------- cards: predict, fix the bug, quick check ---------- */
.stc-card { margin: 1.75rem 0; padding: 1.25rem 1.25rem 1.1rem; border: 1px solid var(--stc-line); border-left: 5px solid var(--stc-accent); border-radius: var(--stc-radius); background: var(--stc-paper); }
.stc-card__kicker { margin: 0 0 .35rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--stc-brand); }
.stc-card__q { margin: 0 0 .75rem; font-weight: 700; font-size: 1.05rem; }
.stc-card > .stc-code__static, .stc-reveal .stc-code__static {
	margin: 0 0 1rem; padding: 1rem 1.1rem; border-radius: 8px;
	background: var(--stc-code-bg); color: var(--stc-code-fg);
	font-family: var(--stc-mono); font-size: .92rem; line-height: 1.55; overflow-x: auto;
}
.stc-card .stc-code { margin: 0 0 1rem; }
.stc-choices { border: 0; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.stc-choices legend { padding: 0; }
.stc-choice {
	display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .75rem;
	border: 1px solid var(--stc-line); border-radius: 8px; background: var(--stc-base); cursor: pointer;
}
.stc-choice:hover { border-color: var(--stc-accent); }
.stc-choice input { margin-top: .25rem; accent-color: var(--stc-brand); }
.stc-choice__text { font-family: var(--stc-mono); font-size: .92rem; white-space: pre-wrap; }
.stc-quiz .stc-choice__text { font-family: inherit; font-size: 1rem; }
.stc-choice.is-right { border-color: var(--stc-ok); background: var(--stc-ok-bg); }
.stc-choice.is-wrong { border-color: var(--stc-err); background: var(--stc-err-bg); }
.stc-feedback { margin: .75rem 0; padding: .65rem .8rem; border-radius: 8px; background: var(--stc-base); border: 1px solid var(--stc-line); }
.stc-feedback.is-ok { background: var(--stc-ok-bg); border-color: var(--stc-ok); }
.stc-feedback.is-err { background: var(--stc-err-bg); border-color: var(--stc-err); }
.stc-feedback__verdict { font-weight: 700; }
.stc-reveal { margin-top: .75rem; }
.stc-reveal summary { cursor: pointer; font-weight: 700; color: var(--stc-brand); }
.stc-reveal pre { margin: .6rem 0; padding: .75rem 1rem; border-radius: 8px; background: var(--stc-base); border: 1px solid var(--stc-line); font-family: var(--stc-mono); font-size: .9rem; overflow-x: auto; }
.stc-fixbug__label { margin: .25rem 0 .35rem; font-size: .85rem; font-weight: 700; color: var(--stc-soft); }
.stc-error { margin: 0 0 .75rem; padding: .85rem 1rem; border-radius: 8px; background: #1c1917; color: #fecaca; font-family: var(--stc-mono); font-size: .85rem; line-height: 1.5; overflow-x: auto; white-space: pre; }
.stc-quiz__list { margin: 0 0 1rem; padding-left: 1.25rem; display: grid; gap: 1rem; }
.stc-quiz__score { margin: .75rem 0 0; font-weight: 700; }

/* ---------- step-through ---------- */
.stc-stepper { margin: 1.75rem 0; padding: 1rem; border: 1px solid var(--stc-line); border-radius: var(--stc-radius); background: var(--stc-base); }
.stc-stepper__frame img { display: block; width: 100%; height: auto; border-radius: 8px; }
.stc-stepper__frame figcaption { margin: .6rem 0 0; color: var(--stc-soft); }
.stc-stepper__frame figcaption strong { color: var(--stc-ink); margin-right: .35rem; }
.stc-stepper:not(.is-js) .stc-stepper__frame + .stc-stepper__frame { margin-top: 1.25rem; }
.stc-stepper__controls { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .9rem; }
.stc-stepper__controls[hidden] { display: none; }
.stc-stepper__dots { display: flex; gap: .4rem; }
.stc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--stc-line); }
.stc-dot.is-on { background: var(--stc-accent); }
.stc-stepper [disabled] { opacity: .4; cursor: default; }

/* ---------- pager ---------- */
.stc-pager { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--stc-line); display: grid; gap: 1.25rem; }
.stc-pager__done { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.stc-pager__note { margin: 0; font-weight: 600; color: var(--stc-ok); }
.stc-when-done { display: none; }
.stc-pager.is-done [data-stc-complete] { background: var(--stc-ok); }
.stc-pager.is-done .stc-when-todo { display: none; }
.stc-pager.is-done .stc-when-done { display: inline; }
.stc-pager__links { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stc-pager__link { display: grid; gap: .2rem; padding: .9rem 1rem; border: 1px solid var(--stc-line); border-radius: var(--stc-radius); color: var(--stc-ink); text-decoration: none; }
.stc-pager__link:hover, .stc-pager__link:focus-visible { border-color: var(--stc-accent); }
.stc-pager__link--next { text-align: right; }
.stc-pager__dir { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--stc-soft); }
.stc-pager__title { font-weight: 700; }
@media (max-width: 600px) {
	.stc-pager__links { grid-template-columns: 1fr; }
	.stc-pager__link--next { text-align: left; }
}

/* ---------- lesson content: readable code inside normal paragraphs ---------- */
.stc-content :where(p, li) code { font-family: var(--stc-mono); font-size: .9em; padding: .1em .35em; border-radius: 4px; background: var(--stc-sand); }
.stc-content .stc-recap { padding: 1.1rem 1.25rem; border-radius: var(--stc-radius); background: var(--stc-ink); color: #f9fafb; }
.stc-content .stc-recap :where(h2, h3) { color: #fff; margin-top: 0; }
.stc-content .stc-recap code { background: #374151; color: #fde68a; }
.stc-content .stc-project { padding: 1.1rem 1.25rem; border-radius: var(--stc-radius); border: 2px dashed var(--stc-accent); background: var(--stc-base); }

.screen-reader-text:not(:focus) {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important;
}
