LMS — Course Detail
A polished e-learning course detail page with a gradient preview hero, instructor credit, star rating and enroll CTA. Tabbed overview, curriculum and reviews sections sit beside a sticky buy box with price, countdown and live progress ring. The curriculum is an accordion of modules with checkable lessons that update your completion percentage, plus a study (dark) reading mode, rating distribution bars, learner reviews and a sticky enroll bar on scroll.
MCP
Code
:root {
--brand: #5b5bd6;
--brand-d: #4444c2;
--brand-50: #eeeefc;
--accent: #13b981;
--amber: #f59e0b;
--ink: #1a1a2e;
--ink-2: #44465f;
--muted: #6b6e87;
--bg: #f7f7fb;
--surface: #ffffff;
--line: rgba(26, 26, 46, 0.1);
--ok: #13b981;
--danger: #e05656;
--r-sm: 8px;
--r-md: 14px;
--r-lg: 20px;
--sh-sm: 0 1px 2px rgba(26, 26, 46, 0.06), 0 1px 3px rgba(26, 26, 46, 0.05);
--sh-md: 0 6px 18px rgba(26, 26, 46, 0.08);
--sh-lg: 0 18px 50px rgba(26, 26, 46, 0.14);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0;
font-family: "Inter", system-ui, -apple-system, sans-serif;
font-size: 15px;
line-height: 1.5;
color: var(--ink);
background: var(--bg);
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
body.study {
--bg: #14152a;
--surface: #1d1f3a;
--ink: #f3f4ff;
--ink-2: #c5c7e6;
--muted: #9ea1cb;
--line: rgba(255, 255, 255, 0.12);
--brand-50: rgba(91, 91, 214, 0.18);
--sh-md: 0 6px 18px rgba(0, 0, 0, 0.35);
--sh-lg: 0 18px 50px rgba(0, 0, 0, 0.45);
--sh-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
}
a { color: inherit; }
img { max-width: 100%; }
.wrap { width: min(1120px, 100% - 2.4rem); margin-inline: auto; }
/* ---------- buttons ---------- */
.btn {
font: inherit;
font-weight: 600;
border: 1px solid transparent;
border-radius: var(--r-sm);
padding: 0.62rem 1.05rem;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.45rem;
transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
color: var(--ink);
background: var(--surface);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn--primary {
background: var(--brand);
color: #fff;
box-shadow: 0 6px 16px rgba(91, 91, 214, 0.32);
}
.btn--primary:hover { background: var(--brand-d); box-shadow: 0 8px 22px rgba(68, 68, 194, 0.4); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { background: var(--brand-50); border-color: var(--brand); color: var(--brand); }
.btn--ghost[aria-pressed="true"] { color: var(--danger); border-color: var(--danger); background: rgba(224, 86, 86, 0.08); }
.btn--block { width: 100%; justify-content: center; }
.btn--block + .btn--block { margin-top: 0.55rem; }
/* ---------- topbar ---------- */
.topbar {
position: sticky;
top: 0;
z-index: 40;
background: color-mix(in srgb, var(--surface) 88%, transparent);
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 1.4rem; height: 62px; }
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand__mark {
display: grid; place-items: center;
width: 30px; height: 30px;
border-radius: 9px;
background: linear-gradient(135deg, var(--brand), #8b7bf0);
color: #fff; font-size: 1rem;
}
.brand__name b { color: var(--brand); font-weight: 800; }
.topbar__nav { display: flex; gap: 1.2rem; margin-left: 0.5rem; }
.topbar__nav a { text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 0.92rem; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.topbar__nav a:hover { color: var(--brand); border-color: var(--brand); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; }
.avatar {
display: grid; place-items: center;
width: 36px; height: 36px;
border-radius: 50%;
background: var(--brand-50);
color: var(--brand);
font-weight: 700; font-size: 0.78rem;
flex: none;
}
.avatar--sm { width: 26px; height: 26px; font-size: 0.62rem; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.2rem; box-shadow: var(--sh-sm); }
/* ---------- layout ---------- */
.layout { padding-block: 1.8rem 4rem; }
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.8rem; align-items: center; margin-bottom: 1.6rem; }
.hero__body { min-width: 0; }
.crumbs { font-size: 0.82rem; color: var(--muted); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.9rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.crumbs [aria-current] { color: var(--ink-2); font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.pill {
font-size: 0.74rem; font-weight: 600;
padding: 0.28rem 0.62rem;
border-radius: 999px;
background: var(--surface);
border: 1px solid var(--line);
color: var(--ink-2);
}
.pill--level { background: var(--amber); border-color: transparent; color: #4a2e00; }
.pill--accent { background: rgba(19, 185, 129, 0.14); border-color: transparent; color: #0a7a55; }
body.study .pill--accent { color: #5ee0b3; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 0.7rem; font-weight: 800; }
.hero__lede { color: var(--ink-2); font-size: 1.02rem; margin: 0 0 1.1rem; max-width: 46ch; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 0.9rem 1.4rem; align-items: center; }
.rating { display: flex; align-items: center; gap: 0.4rem; }
.rating__num { font-weight: 800; color: var(--amber); }
.stars { color: var(--amber); letter-spacing: 1px; }
.rating__count, .enrolled-chip { color: var(--muted); font-size: 0.88rem; }
.instructor-chip { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; color: var(--ink-2); }
.enrolled-chip::before { content: "👥 "; }
/* ---------- poster ---------- */
.poster {
margin: 0; position: relative;
border-radius: var(--r-lg);
overflow: hidden;
aspect-ratio: 16 / 10;
box-shadow: var(--sh-lg);
border: 1px solid var(--line);
isolation: isolate;
}
.poster__art { position: absolute; inset: 0; background: #2a2a52; }
.poster__grad {
position: absolute; inset: 0;
background:
radial-gradient(120% 90% at 18% 12%, #8b7bf0 0%, transparent 55%),
radial-gradient(120% 100% at 92% 88%, #13b981 0%, transparent 50%),
linear-gradient(135deg, #4444c2, #2a2a52);
}
.poster__art::after {
content: ""; position: absolute; inset: 0;
background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
background-size: 28px 28px;
}
.poster__play {
position: absolute; inset: 0; margin: auto;
width: 72px; height: 72px;
border-radius: 50%;
border: none; cursor: pointer;
background: rgba(255, 255, 255, 0.94);
display: grid; place-items: center;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
transition: transform 0.16s ease;
}
.poster__play:hover { transform: scale(1.08); }
.poster__play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.poster__playicon { color: var(--brand); font-size: 1.4rem; margin-left: 4px; }
.poster__cap {
position: absolute; left: 12px; bottom: 12px;
background: rgba(0, 0, 0, 0.55); color: #fff;
font-size: 0.74rem; font-weight: 600;
padding: 0.28rem 0.6rem; border-radius: 999px;
}
/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.8rem; align-items: start; }
.col-main { min-width: 0; }
/* ---------- tabs ---------- */
.tabs {
display: flex; gap: 0.3rem;
border-bottom: 1px solid var(--line);
margin-bottom: 1.4rem;
position: sticky; top: 62px; z-index: 20;
background: var(--bg);
}
.tab {
font: inherit; font-weight: 600;
background: none; border: none; cursor: pointer;
padding: 0.8rem 1rem;
color: var(--muted);
border-bottom: 3px solid transparent;
margin-bottom: -1px;
transition: color 0.15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand); border-color: var(--brand); }
.tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -4px; border-radius: var(--r-sm); }
.panel { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; margin: 1.8rem 0 0.9rem; }
.h2:first-child { margin-top: 0; }
.prose { color: var(--ink-2); margin: 0 0 0.9rem; max-width: 64ch; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
/* ---------- learn list ---------- */
.learn {
list-style: none; margin: 0; padding: 0;
display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem 1.4rem;
background: var(--surface);
border: 1px solid var(--line);
border-radius: var(--r-md);
padding: 1.3rem;
}
.learn li { position: relative; padding-left: 1.7rem; color: var(--ink-2); font-size: 0.94rem; }
.learn li::before {
content: "✓"; position: absolute; left: 0; top: 0;
width: 20px; height: 20px; border-radius: 50%;
display: grid; place-items: center;
background: rgba(19, 185, 129, 0.16); color: var(--accent);
font-size: 0.72rem; font-weight: 800;
}
/* ---------- bio ---------- */
.bio { display: flex; gap: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.3rem; box-shadow: var(--sh-sm); }
.bio__name { margin: 0; font-size: 1.1rem; }
.bio__role { margin: 0.15rem 0 0.7rem; color: var(--muted); font-size: 0.9rem; }
.bio__stats { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.8rem; font-size: 0.86rem; color: var(--ink-2); }
.bio__stats b { color: var(--ink); }
/* ---------- syllabus ---------- */
.curriculum__head { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.curriculum__sub { display: flex; gap: 1rem; align-items: center; color: var(--muted); font-size: 0.88rem; }
.link-btn { background: none; border: none; cursor: pointer; font: inherit; font-weight: 600; color: var(--brand); padding: 0; }
.link-btn:hover { text-decoration: underline; }
.syllabus { display: flex; flex-direction: column; gap: 0.7rem; }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-sm); }
.module__head {
width: 100%; text-align: left; cursor: pointer;
font: inherit; background: none; border: none;
display: flex; align-items: center; gap: 0.9rem;
padding: 1rem 1.1rem;
transition: background 0.15s ease;
}
.module__head:hover { background: var(--brand-50); }
.module__head:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; }
.module__chev { color: var(--muted); transition: transform 0.22s ease; font-size: 0.8rem; flex: none; }
.module[aria-expanded="true"] .module__chev { transform: rotate(90deg); color: var(--brand); }
.module__title { font-weight: 600; flex: 1; }
.module__title small { display: block; font-weight: 500; color: var(--muted); font-size: 0.8rem; margin-top: 0.1rem; }
.module__meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.module__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.26s ease; }
.module[aria-expanded="true"] .module__body { grid-template-rows: 1fr; }
.module__inner { overflow: hidden; }
.lessons { list-style: none; margin: 0; padding: 0 0 0.5rem; border-top: 1px solid var(--line); }
.lesson { display: flex; align-items: center; gap: 0.8rem; padding: 0.62rem 1.1rem 0.62rem 1.2rem; font-size: 0.92rem; }
.lesson:hover { background: var(--brand-50); }
.lesson__check {
appearance: none; -webkit-appearance: none;
width: 19px; height: 19px; flex: none;
border: 2px solid var(--line); border-radius: 6px;
cursor: pointer; position: relative; background: var(--surface);
transition: background 0.15s ease, border-color 0.15s ease;
}
.lesson__check:checked { background: var(--accent); border-color: var(--accent); }
.lesson__check:checked::after { content: "✓"; color: #fff; font-size: 0.7rem; font-weight: 800; position: absolute; inset: 0; display: grid; place-items: center; }
.lesson__check:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.lesson__icon { color: var(--muted); font-size: 0.82rem; }
.lesson__name { flex: 1; color: var(--ink-2); }
.lesson__check:checked + .lesson__icon + .lesson__name { color: var(--muted); text-decoration: line-through; }
.lesson__dur { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.lesson__free { font-size: 0.66rem; font-weight: 700; color: var(--brand); border: 1px solid var(--brand); border-radius: 999px; padding: 0.1rem 0.4rem; }
/* ---------- reviews ---------- */
.reviews__summary { display: grid; grid-template-columns: auto 1fr; gap: 1.6rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.3rem; margin-bottom: 1.3rem; }
.reviews__score { text-align: center; }
.reviews__num { display: block; font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--amber); }
.bars { display: flex; flex-direction: column; gap: 0.4rem; }
.barrow { display: grid; grid-template-columns: 42px 1fr 40px; gap: 0.6rem; align-items: center; font-size: 0.82rem; color: var(--muted); }
.barrow .bar { height: 8px; }
.bar { background: var(--line); border-radius: 999px; overflow: hidden; height: 9px; }
.bar__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #8b7bf0); border-radius: 999px; transition: width 0.5s ease; }
.barrow .bar__fill { background: var(--amber); }
.reviews { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.review { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.1rem; box-shadow: var(--sh-sm); }
.review__head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.5rem; }
.review__name { font-weight: 600; }
.review__when { color: var(--muted); font-size: 0.8rem; margin-left: auto; }
.review__stars { color: var(--amber); font-size: 0.85rem; letter-spacing: 1px; }
.review__text { color: var(--ink-2); margin: 0.3rem 0 0; font-size: 0.93rem; }
/* ---------- buybox ---------- */
.col-side { position: sticky; top: 78px; }
.buybox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.3rem; box-shadow: var(--sh-md); }
.buybox__price { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.buybox__now { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.buybox__was { color: var(--muted); text-decoration: line-through; font-weight: 600; }
.buybox__off { color: var(--ok); font-weight: 700; font-size: 0.85rem; }
.buybox__deadline { color: var(--danger); font-size: 0.85rem; margin: 0 0 1rem; }
.guarantee { text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0.9rem 0 0; }
.buybox__h { font-size: 0.95rem; margin: 1.3rem 0 0.6rem; }
.includes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.includes li { display: flex; gap: 0.6rem; color: var(--ink-2); font-size: 0.9rem; }
.includes li span { color: var(--brand); width: 1.1rem; text-align: center; flex: none; }
.progress-block { margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.progress-block__top { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 0.5rem; }
.progress-block__top b { color: var(--accent); }
.progress-block .bar__fill { background: linear-gradient(90deg, var(--accent), #34d399); }
.progress-block .small { display: block; margin-top: 0.45rem; }
/* ---------- sticky bar ---------- */
.stickybar {
position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
background: color-mix(in srgb, var(--surface) 94%, transparent);
backdrop-filter: blur(10px);
border-top: 1px solid var(--line);
box-shadow: 0 -8px 24px rgba(26, 26, 46, 0.1);
transform: translateY(110%);
transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.stickybar.show { transform: none; }
.stickybar__inner { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 0; }
.stickybar__info { display: flex; flex-direction: column; min-width: 0; }
.stickybar__info strong { font-size: 0.95rem; }
.stickybar__info .muted { font-size: 0.82rem; }
.stickybar .btn--primary { margin-left: auto; flex: none; }
/* ---------- toast ---------- */
.toast {
position: fixed; left: 50%; bottom: 84px;
transform: translateX(-50%) translateY(20px);
background: var(--ink); color: #fff;
padding: 0.7rem 1.1rem; border-radius: var(--r-sm);
font-size: 0.9rem; font-weight: 500;
box-shadow: var(--sh-lg);
opacity: 0; pointer-events: none;
transition: opacity 0.22s ease, transform 0.22s ease;
z-index: 60; max-width: calc(100% - 2rem);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
body.study .toast { background: #000; border: 1px solid var(--line); }
/* ---------- responsive ---------- */
@media (max-width: 920px) {
.hero { grid-template-columns: 1fr; }
.grid { grid-template-columns: 1fr; }
.col-side { position: static; }
.buybox { order: -1; }
}
@media (max-width: 620px) {
.learn { grid-template-columns: 1fr; }
.reviews__summary { grid-template-columns: 1fr; gap: 1rem; }
.bio { flex-direction: column; }
}
@media (max-width: 520px) {
body { font-size: 14px; }
.wrap { width: calc(100% - 1.6rem); }
.topbar__nav { display: none; }
.topbar__inner { gap: 0.7rem; }
#themeToggle span + * { display: none; }
.hero__meta { gap: 0.5rem 1rem; }
.tabs { top: 62px; }
.tab { padding: 0.7rem 0.6rem; font-size: 0.9rem; }
.layout { padding-bottom: 6.5rem; }
}
@media (prefers-reduced-motion: reduce) {
* { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}(function () {
"use strict";
/* ---------- toast helper ---------- */
var toastEl = document.getElementById("toast");
var toastTimer;
function toast(msg) {
if (!toastEl) return;
toastEl.textContent = msg;
toastEl.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(function () {
toastEl.classList.remove("show");
}, 2600);
}
/* ---------- data ---------- */
var MODULES = [
{
title: "Foundations of Calm",
sub: "Why restraint beats more features",
lessons: [
{ name: "Welcome & how this course works", dur: "4:12", free: true, done: true },
{ name: "The attention budget", dur: "11:38", done: true },
{ name: "Loud, quiet, and invisible", dur: "9:05", done: true },
{ name: "Reading a noisy interface", dur: "13:20" }
]
},
{
title: "Visual Hierarchy",
sub: "Guiding the eye on purpose",
lessons: [
{ name: "Contrast as a tool, not a default", dur: "10:44", done: true },
{ name: "Building a type scale", dur: "15:02" },
{ name: "Weight, size, and position", dur: "12:18" },
{ name: "Workshop: redesign a dashboard header", dur: "18:50" }
]
},
{
title: "Spacing & Rhythm",
sub: "Space is a feature",
lessons: [
{ name: "The 4-point grid in practice", dur: "9:33", done: true },
{ name: "Vertical rhythm & density", dur: "11:27" },
{ name: "Grouping with whitespace", dur: "8:14" }
]
},
{
title: "Color & Restraint",
sub: "Fewer colors, more meaning",
lessons: [
{ name: "Choosing a calm palette", dur: "12:55", done: true },
{ name: "Semantic color systems", dur: "14:09" },
{ name: "Accessible contrast without harshness", dur: "10:41" },
{ name: "Designing a study (dark) mode", dur: "16:22", free: true }
]
},
{
title: "States People Trust",
sub: "Empty, loading, error, success",
lessons: [
{ name: "Progress that feels honest", dur: "13:48", done: true },
{ name: "Empty states that teach", dur: "9:51" },
{ name: "Graceful error recovery", dur: "12:07" },
{ name: "Skeletons vs spinners", dur: "7:39" }
]
},
{
title: "Components & Systems",
sub: "From principle to reusable parts",
lessons: [
{ name: "Tokenizing calm decisions", dur: "15:14" },
{ name: "Documenting intent, not just code", dur: "11:02" },
{ name: "Auditing a component for noise", dur: "13:36" }
]
},
{
title: "The Restraint Audit",
sub: "Removing before adding",
lessons: [
{ name: "Running a subtraction pass", dur: "12:48" },
{ name: "Defending a deletion", dur: "9:17" },
{ name: "Workshop: cut 30% of a screen", dur: "21:05" }
]
},
{
title: "Capstone Case Study",
sub: "Build your portfolio piece",
lessons: [
{ name: "Choosing your screen", dur: "6:44" },
{ name: "Critique & iteration", dur: "17:29" },
{ name: "Writing the case study", dur: "14:50" },
{ name: "Final review & certificate", dur: "8:33", free: true }
]
}
];
var REVIEWS = [
{ name: "Marcus Bell", initials: "MB", stars: 5, when: "2 weeks ago", text: "The restraint audit alone paid for the course. I cut a settings screen in half and stakeholders loved it. Elena's critiques are direct and genuinely useful." },
{ name: "Aisha Khan", initials: "AK", stars: 5, when: "1 month ago", text: "Finally a course about decisions, not just tools. The module on honest progress states changed how I think about loading screens." },
{ name: "Tomás Rivera", initials: "TR", stars: 4, when: "1 month ago", text: "Strong material and great pacing. I'd have liked one more Figma walkthrough, but the principles transfer to any tool I use." },
{ name: "Hana Okafor", initials: "HO", stars: 5, when: "2 months ago", text: "My capstone case study landed me two interviews. The structure for writing rationale is something I now use at work every week." }
];
var RATING_DIST = [
{ stars: 5, pct: 74 },
{ stars: 4, pct: 19 },
{ stars: 3, pct: 5 },
{ stars: 2, pct: 1 },
{ stars: 1, pct: 1 }
];
var TOTAL_LESSONS = MODULES.reduce(function (n, m) { return n + m.lessons.length; }, 0);
function starString(n) {
return "★★★★★".slice(0, n) + "☆☆☆☆☆".slice(0, 5 - n);
}
function esc(s) {
return String(s).replace(/[&<>"]/g, function (c) {
return { "&": "&", "<": "<", ">": ">", '"': """ }[c];
});
}
/* ---------- render syllabus ---------- */
var syllabus = document.getElementById("syllabus");
MODULES.forEach(function (mod, i) {
var moduleMins = mod.lessons.reduce(function (sum, l) {
var p = l.dur.split(":");
return sum + parseInt(p[0], 10) + parseInt(p[1], 10) / 60;
}, 0);
var sec = document.createElement("section");
sec.className = "module";
sec.setAttribute("aria-expanded", i === 0 ? "true" : "false");
var lessonsHtml = mod.lessons.map(function (l, j) {
var id = "l" + i + "-" + j;
return (
'<li class="lesson">' +
'<input class="lesson__check" type="checkbox" id="' + id + '"' + (l.done ? " checked" : "") +
' aria-label="Mark ' + esc(l.name) + ' complete">' +
'<span class="lesson__icon" aria-hidden="true">▶</span>' +
'<label class="lesson__name" for="' + id + '">' + esc(l.name) + "</label>" +
(l.free ? '<span class="lesson__free">Preview</span>' : "") +
'<span class="lesson__dur">' + l.dur + "</span>" +
"</li>"
);
}).join("");
sec.innerHTML =
'<button class="module__head" type="button" aria-expanded="' + (i === 0 ? "true" : "false") + '">' +
'<span class="module__chev" aria-hidden="true">▶</span>' +
'<span class="module__title">Module ' + (i + 1) + " · " + esc(mod.title) +
"<small>" + esc(mod.sub) + "</small></span>" +
'<span class="module__meta">' + mod.lessons.length + " lessons · " + Math.round(moduleMins) + " min</span>" +
"</button>" +
'<div class="module__body"><div class="module__inner"><ul class="lessons">' + lessonsHtml + "</ul></div></div>";
syllabus.appendChild(sec);
});
/* ---------- accordion ---------- */
syllabus.addEventListener("click", function (e) {
var head = e.target.closest(".module__head");
if (!head) return;
var mod = head.closest(".module");
var open = mod.getAttribute("aria-expanded") === "true";
mod.setAttribute("aria-expanded", String(!open));
head.setAttribute("aria-expanded", String(!open));
});
/* ---------- expand / collapse all ---------- */
var toggleAll = document.getElementById("toggleAll");
toggleAll.addEventListener("click", function () {
var expand = toggleAll.getAttribute("aria-expanded") !== "true";
syllabus.querySelectorAll(".module").forEach(function (m) {
m.setAttribute("aria-expanded", String(expand));
m.querySelector(".module__head").setAttribute("aria-expanded", String(expand));
});
toggleAll.setAttribute("aria-expanded", String(expand));
toggleAll.textContent = expand ? "Collapse all" : "Expand all";
});
/* ---------- progress (lesson check-offs) ---------- */
var progFill = document.getElementById("progFill");
var progPct = document.getElementById("progPct");
function refreshProgress() {
var done = syllabus.querySelectorAll(".lesson__check:checked").length;
var pct = Math.round((done / TOTAL_LESSONS) * 100);
progFill.style.width = pct + "%";
progPct.textContent = pct + "%";
var bar = progFill.parentElement;
bar.setAttribute("aria-valuenow", String(pct));
var label = bar.parentElement.querySelector(".small");
if (label) label.textContent = done + " of " + TOTAL_LESSONS + " lessons complete";
}
syllabus.addEventListener("change", function (e) {
if (!e.target.classList.contains("lesson__check")) return;
refreshProgress();
if (e.target.checked) toast("Lesson marked complete ✓");
});
refreshProgress();
/* ---------- tabs ---------- */
var tabs = Array.prototype.slice.call(document.querySelectorAll(".tab"));
function selectTab(tab) {
tabs.forEach(function (t) {
var on = t === tab;
t.setAttribute("aria-selected", String(on));
t.tabIndex = on ? 0 : -1;
var panel = document.getElementById(t.getAttribute("aria-controls"));
panel.hidden = !on;
});
}
tabs.forEach(function (tab, i) {
tab.addEventListener("click", function () { selectTab(tab); });
tab.addEventListener("keydown", function (e) {
var next;
if (e.key === "ArrowRight") next = tabs[(i + 1) % tabs.length];
else if (e.key === "ArrowLeft") next = tabs[(i - 1 + tabs.length) % tabs.length];
if (next) { e.preventDefault(); next.focus(); selectTab(next); }
});
});
/* ---------- render reviews ---------- */
var reviewList = document.getElementById("reviewList");
reviewList.innerHTML = REVIEWS.map(function (r) {
return (
'<li class="review">' +
'<div class="review__head">' +
'<span class="avatar avatar--sm" aria-hidden="true">' + esc(r.initials) + "</span>" +
'<span class="review__name">' + esc(r.name) + "</span>" +
'<span class="review__stars" aria-label="' + r.stars + ' out of 5">' + starString(r.stars) + "</span>" +
'<span class="review__when">' + esc(r.when) + "</span>" +
"</div>" +
'<p class="review__text">' + esc(r.text) + "</p>" +
"</li>"
);
}).join("");
/* ---------- render rating bars ---------- */
var ratingBars = document.getElementById("ratingBars");
ratingBars.innerHTML = RATING_DIST.map(function (d) {
return (
'<div class="barrow">' +
"<span>" + d.stars + " ★</span>" +
'<span class="bar"><span class="bar__fill" style="width:0"></span></span>' +
"<span>" + d.pct + "%</span>" +
"</div>"
);
}).join("");
// animate bars into view
requestAnimationFrame(function () {
var fills = ratingBars.querySelectorAll(".bar__fill");
RATING_DIST.forEach(function (d, i) { fills[i].style.width = d.pct + "%"; });
});
/* ---------- enroll / wishlist / preview ---------- */
var enrolled = false;
function enroll() {
enrolled = true;
toast("You're enrolled — first lesson unlocked! 🎉");
document.getElementById("enrollMain").textContent = "Go to course";
document.getElementById("enrollSticky").textContent = "Continue";
}
document.getElementById("enrollMain").addEventListener("click", enroll);
document.getElementById("enrollSticky").addEventListener("click", function () {
if (enrolled) { toast("Resuming where you left off…"); selectTab(tabs[1]); }
else enroll();
});
var wishBtn = document.getElementById("wishlistBtn");
wishBtn.addEventListener("click", function () {
var on = wishBtn.getAttribute("aria-pressed") !== "true";
wishBtn.setAttribute("aria-pressed", String(on));
wishBtn.innerHTML = on ? "♥ Saved" : "♡ Save for later";
toast(on ? "Added to your saved courses" : "Removed from saved courses");
});
document.getElementById("previewBtn").addEventListener("click", function () {
toast("Playing course preview · 2:14 ▶");
});
/* ---------- sticky enroll bar ---------- */
var stickybar = document.getElementById("stickybar");
var buybox = document.getElementById("buybox");
if ("IntersectionObserver" in window && buybox) {
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
var show = !entry.isIntersecting;
stickybar.classList.toggle("show", show);
stickybar.setAttribute("aria-hidden", String(!show));
});
}, { rootMargin: "-120px 0px 0px 0px" });
io.observe(buybox);
}
/* ---------- study (dark) mode ---------- */
var themeToggle = document.getElementById("themeToggle");
themeToggle.addEventListener("click", function () {
var on = document.body.classList.toggle("study");
themeToggle.setAttribute("aria-pressed", String(on));
toast(on ? "Study mode on — easy on the eyes 🌙" : "Light mode on ☀");
});
/* ---------- countdown timer ---------- */
var deadline = document.getElementById("deadline");
var remaining = 2 * 3600 + 11 * 60 + 48; // 02:11:48
function tick() {
if (remaining <= 0) { deadline.innerHTML = "⏳ Sale ended"; return; }
remaining--;
var h = Math.floor(remaining / 3600);
var m = Math.floor((remaining % 3600) / 60);
var s = remaining % 60;
var pad = function (n) { return String(n).padStart(2, "0"); };
deadline.innerHTML = "⏳ Sale ends in <b>" + pad(h) + ":" + pad(m) + ":" + pad(s) + "</b>";
}
setInterval(tick, 1000);
})();<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Designing Calm Interfaces — Course Detail</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header class="topbar">
<div class="wrap topbar__inner">
<a class="brand" href="#" aria-label="Lumen Academy home">
<span class="brand__mark" aria-hidden="true">◐</span>
<span class="brand__name">Lumen<b>Academy</b></span>
</a>
<nav class="topbar__nav" aria-label="Primary">
<a href="#">Explore</a>
<a href="#">My Learning</a>
<a href="#">Pricing</a>
</nav>
<div class="topbar__right">
<button class="btn btn--ghost" id="themeToggle" type="button" aria-pressed="false">
<span aria-hidden="true">☾</span> Study mode
</button>
<span class="avatar" title="Priya Raman" aria-hidden="true">PR</span>
</div>
</div>
</header>
<main class="wrap layout">
<!-- ============ HERO ============ -->
<section class="hero" aria-labelledby="courseTitle">
<div class="hero__body">
<nav class="crumbs" aria-label="Breadcrumb">
<a href="#">Design</a><span aria-hidden="true">/</span>
<a href="#">UX Foundations</a><span aria-hidden="true">/</span>
<span aria-current="page">Calm Interfaces</span>
</nav>
<div class="pills">
<span class="pill pill--level">Intermediate</span>
<span class="pill">8 modules</span>
<span class="pill">12h 40m</span>
<span class="pill pill--accent">Certificate</span>
</div>
<h1 id="courseTitle">Designing Calm Interfaces: Focus, Rhythm & Restraint</h1>
<p class="hero__lede">
Learn a repeatable system for interfaces that feel quiet and confident — pacing
attention, reducing noise, and earning trust through deliberate restraint.
</p>
<div class="hero__meta">
<div class="rating" aria-label="Rated 4.8 out of 5 from 3,294 learners">
<span class="rating__num">4.8</span>
<span class="stars" aria-hidden="true">★★★★★</span>
<span class="rating__count">(3,294)</span>
</div>
<div class="instructor-chip">
<span class="avatar avatar--sm" aria-hidden="true">EM</span>
<span>Created by <b>Elena Marchetti</b></span>
</div>
<div class="enrolled-chip">12,480 enrolled</div>
</div>
</div>
<figure class="poster" role="group" aria-label="Course preview">
<div class="poster__art" aria-hidden="true">
<span class="poster__grad"></span>
</div>
<button class="poster__play" type="button" id="previewBtn" aria-label="Play 2 minute preview">
<span class="poster__playicon" aria-hidden="true">►</span>
</button>
<figcaption class="poster__cap">Preview · 2:14</figcaption>
</figure>
</section>
<!-- ============ TABS + CONTENT ============ -->
<div class="grid">
<div class="col-main">
<div class="tabs" role="tablist" aria-label="Course sections">
<button class="tab" role="tab" id="tab-overview" aria-controls="panel-overview" aria-selected="true">Overview</button>
<button class="tab" role="tab" id="tab-curriculum" aria-controls="panel-curriculum" aria-selected="false" tabindex="-1">Curriculum</button>
<button class="tab" role="tab" id="tab-reviews" aria-controls="panel-reviews" aria-selected="false" tabindex="-1">Reviews</button>
</div>
<!-- OVERVIEW -->
<section class="panel" id="panel-overview" role="tabpanel" aria-labelledby="tab-overview" tabindex="0">
<h2 class="h2">What you'll learn</h2>
<ul class="learn">
<li>Build a visual hierarchy that guides the eye without shouting.</li>
<li>Choose type scales and spacing rhythms that feel intentional.</li>
<li>Design progress, empty, and loading states people actually trust.</li>
<li>Run restraint audits to remove noise before you ship.</li>
<li>Translate calm principles into a reusable component system.</li>
<li>Defend design decisions with clear, evidence-led rationale.</li>
</ul>
<h2 class="h2">About this course</h2>
<p class="prose">
Most interfaces fail not because they lack features, but because they ask for
too much attention at once. Over eight modules you'll develop a system for
pacing attention — deciding what should be loud, what should whisper, and what
should disappear entirely.
</p>
<p class="prose">
Each module pairs short, practical lessons with a hands-on critique. You'll
redesign three real product screens and finish with a portfolio-ready case study.
</p>
<h2 class="h2">Meet your instructor</h2>
<article class="bio">
<span class="avatar avatar--lg" aria-hidden="true">EM</span>
<div class="bio__body">
<h3 class="bio__name">Elena Marchetti</h3>
<p class="bio__role">Principal Product Designer · ex-Northwind, ex-Tessera</p>
<div class="bio__stats">
<span><b>4.9</b> instructor rating</span>
<span><b>41,902</b> learners</span>
<span><b>6</b> courses</span>
</div>
<p class="prose">
Elena has spent twelve years building design systems for fintech and health
products. She teaches the same restraint-first method her teams use to ship
calm, dependable software at scale.
</p>
</div>
</article>
</section>
<!-- CURRICULUM -->
<section class="panel" id="panel-curriculum" role="tabpanel" aria-labelledby="tab-curriculum" tabindex="0" hidden>
<div class="curriculum__head">
<h2 class="h2">Curriculum</h2>
<div class="curriculum__sub">
<span>8 modules · 46 lessons · 12h 40m</span>
<button class="link-btn" id="toggleAll" type="button" aria-expanded="false">Expand all</button>
</div>
</div>
<div class="syllabus" id="syllabus"><!-- modules injected by script --></div>
</section>
<!-- REVIEWS -->
<section class="panel" id="panel-reviews" role="tabpanel" aria-labelledby="tab-reviews" tabindex="0" hidden>
<h2 class="h2">Learner reviews</h2>
<div class="reviews__summary">
<div class="reviews__score">
<span class="reviews__num">4.8</span>
<span class="stars" aria-hidden="true">★★★★★</span>
<span class="muted">3,294 ratings</span>
</div>
<div class="bars" id="ratingBars"><!-- bars injected --></div>
</div>
<ul class="reviews" id="reviewList"><!-- reviews injected --></ul>
</section>
</div>
<!-- ============ SIDEBAR CARD ============ -->
<aside class="col-side">
<div class="buybox" id="buybox">
<div class="buybox__price">
<span class="buybox__now">$74</span>
<span class="buybox__was">$129</span>
<span class="buybox__off">43% off</span>
</div>
<p class="buybox__deadline" id="deadline">⏳ Sale ends in <b>02:11:48</b></p>
<button class="btn btn--primary btn--block" id="enrollMain" type="button">Enroll now</button>
<button class="btn btn--ghost btn--block" id="wishlistBtn" type="button" aria-pressed="false">♡ Save for later</button>
<p class="guarantee">30-day money-back guarantee</p>
<h3 class="buybox__h">This course includes</h3>
<ul class="includes">
<li><span aria-hidden="true">▶</span> 12.7 hours on-demand video</li>
<li><span aria-hidden="true">⤓</span> 24 downloadable resources</li>
<li><span aria-hidden="true">∞</span> Full lifetime access</li>
<li><span aria-hidden="true">▰</span> Mobile and desktop</li>
<li><span aria-hidden="true">✓</span> Certificate of completion</li>
</ul>
<div class="progress-block" aria-label="Your progress">
<div class="progress-block__top">
<span>Your progress</span><b id="progPct">18%</b>
</div>
<div class="bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="18">
<span class="bar__fill" id="progFill" style="width:18%"></span>
</div>
<span class="muted small">8 of 46 lessons complete</span>
</div>
</div>
</aside>
</div>
</main>
<!-- ============ STICKY ENROLL BAR ============ -->
<div class="stickybar" id="stickybar" aria-hidden="true">
<div class="wrap stickybar__inner">
<div class="stickybar__info">
<strong>Designing Calm Interfaces</strong>
<span class="muted">$74 · 4.8 ★ · 12h 40m</span>
</div>
<button class="btn btn--primary" id="enrollSticky" type="button">Enroll now</button>
</div>
</div>
<div class="toast" id="toast" role="status" aria-live="polite"></div>
<script src="script.js"></script>
</body>
</html>Course Detail
A full course landing page for an online learning platform. The hero pairs the course title, difficulty pills, star rating and instructor credit with a gradient video-preview poster and a play button. A sticky sidebar buy box carries the discounted price, a live sale countdown, enroll and save actions, an includes list and a progress block that tracks your completion.
The body is organized into three tabs — Overview, Curriculum and Reviews — switchable by click or arrow keys. Curriculum is an accordion of eight modules; each expands to reveal lessons with durations and a checkbox. Ticking lessons recalculates the progress percentage and animates the progress bar in real time, and an “Expand all” control opens every module at once. Reviews shows a rating distribution with animated bars and a list of learner testimonials.
Everything is vanilla JS: an IntersectionObserver reveals a sticky enroll bar once the buy box scrolls away, a toast helper confirms actions, and a study (dark) reading mode swaps the calm light theme for a low-glare palette. The layout is responsive down to ~360px and the interactive elements are keyboard-usable with appropriate ARIA.
Illustrative UI only — fictional courses, not a real learning platform.