Apply visual identity: palette B, Atkinson/JetBrains fonts, split CSS, syntax-highlighted editor, owl icon

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-16 14:53:50 +02:00
parent 6e63a51a1b
commit 6b4b89a742
27 changed files with 994 additions and 255 deletions
+159 -225
View File
@@ -1,57 +1,10 @@
/* Styles de l'application : jetons de thème, clair/sombre, taille réglable, focus visible. */
:root {
--bg: #ffffff;
--surface: #f4f6fa;
--text: #1b1f27;
--muted: #4a5365;
--border: #b8c0cf;
--accent: #1d4ed8;
--accent-text: #ffffff;
--ok: #146c2e;
--ko: #a31515;
--focus: #b45309;
/* Réglable par SettingsPanel : html { font-size: calc(var(--font-scale) * 100%) } */
--font-scale: 1;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #12151c;
--surface: #1c212c;
--text: #eceff5;
--muted: #b3bccd;
--border: #4a5365;
--accent: #8ab4ff;
--accent-text: #0b1020;
--ok: #6ee08a;
--ko: #ff8a8a;
--focus: #ffcc66;
}
}
:root[data-theme="dark"] {
--bg: #12151c;
--surface: #1c212c;
--text: #eceff5;
--muted: #b3bccd;
--border: #4a5365;
--accent: #8ab4ff;
--accent-text: #0b1020;
--ok: #6ee08a;
--ko: #ff8a8a;
--focus: #ffcc66;
}
html {
font-size: calc(var(--font-scale) * 100%);
}
/* Base : corps de page, focus, boutons, en-tête, notebook, tiroirs, toasts, réglages. */
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
font-family: var(--font-ui);
line-height: 1.55;
}
@@ -60,26 +13,33 @@ body {
outline-offset: 2px;
}
.notebook {
max-width: 48rem;
margin: 0 auto;
padding: 1rem;
/* L'attribut hidden doit toujours l'emporter sur les règles display des composants. */
[hidden] {
display: none !important;
}
.notebook-status {
color: var(--muted);
min-height: 1.5em;
code,
pre {
font-family: var(--font-code);
/* Pas de ligatures : un débutant doit voir exactement les caractères tapés (>= et non ≥). */
font-variant-ligatures: none;
}
.explain,
.cell {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 0.5rem;
padding: 1rem;
margin: 1rem 0;
.skip-link {
position: absolute;
left: -9999px;
}
.skip-link:focus {
left: 1rem;
top: 1rem;
padding: 0.5rem 1rem;
background: var(--bg);
color: var(--text);
z-index: 30;
}
/* Boutons */
.btn {
min-height: 2.75rem; /* cible tactile confortable (WCAG 2.5.8) */
padding: 0.4rem 1rem;
@@ -102,167 +62,6 @@ body {
cursor: not-allowed;
}
.cell-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0.5rem 0;
}
.code-editor {
width: 100%;
box-sizing: border-box;
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
font-size: 1rem;
padding: 0.75rem;
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 0.375rem;
tab-size: 4;
}
.cell-shortcut {
margin: 0.25rem 0;
color: var(--muted);
font-size: 0.875rem;
}
.cell-output {
min-height: 1.5rem;
margin: 0.5rem 0;
padding: 0.5rem 0.75rem;
background: var(--bg);
border-left: 4px solid var(--border);
white-space: pre-wrap;
}
.feedback-ok {
color: var(--ok);
font-weight: 600;
}
.feedback-ko,
.error-title {
color: var(--ko);
font-weight: 600;
}
.hint-list {
flex-basis: 100%;
margin: 0;
}
.toast-region {
position: fixed;
right: 1rem;
bottom: 1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
max-width: calc(100vw - 2rem);
}
.toast {
display: flex;
gap: 0.75rem;
align-items: center;
padding: 0.75rem 1rem;
background: var(--surface);
color: var(--text);
border: 2px solid var(--accent);
border-radius: 0.5rem;
}
.level-list {
list-style: none;
padding: 0;
}
.level-button {
display: flex;
justify-content: space-between;
width: 100%;
margin: 0.25rem 0;
padding: 0.5rem 0.75rem;
background: var(--surface);
color: var(--text);
border: 1px solid var(--border);
border-radius: 0.375rem;
font: inherit;
cursor: pointer;
}
.level-button.is-current {
border-width: 3px;
border-color: var(--accent);
}
.setting {
display: grid;
grid-template-columns: 8rem 1fr;
gap: 0.75rem;
align-items: center;
margin: 0.75rem 0;
}
.setting select,
.setting input[type="range"] {
width: 100%;
min-height: 2.5rem;
font: inherit;
}
.setting input[type="checkbox"] {
width: 1.5rem;
height: 1.5rem;
justify-self: start;
}
.setting > .btn:only-child {
grid-column: 1 / -1;
}
@media (prefers-reduced-motion: reduce) {
* {
animation: none !important;
transition: none !important;
}
}
.skip-link {
position: absolute;
left: -9999px;
}
.skip-link:focus {
left: 1rem;
top: 1rem;
padding: 0.5rem 1rem;
background: var(--bg);
color: var(--text);
z-index: 10;
}
.explain > :first-child,
.cell > :first-child {
margin-top: 0;
}
.level-button {
flex-wrap: wrap;
gap: 0.25rem 0.75rem;
text-align: left;
}
.level-title {
flex: 1 1 8rem;
}
.level-state {
white-space: nowrap;
}
/* En-tête : accès aux niveaux (gauche), niveau courant avec navigation (centre), réglages (droite). */
.app-header {
display: grid;
@@ -281,6 +80,18 @@ body {
min-width: 0;
}
.brand {
display: flex;
align-items: center;
gap: 0.5rem;
}
.brand img {
width: 2rem;
height: 2rem;
border-radius: 0.5rem;
}
.app-heading h1 {
margin: 0;
font-size: 1.25rem;
@@ -306,6 +117,59 @@ body {
white-space: nowrap;
}
/* Notebook */
.notebook {
max-width: 48rem;
margin: 0 auto;
padding: 1rem;
}
.notebook-status {
color: var(--muted);
min-height: 1.5em;
}
.explain {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 0.5rem;
padding: 1rem;
margin: 1rem 0;
}
.explain > :first-child {
margin-top: 0;
}
.explain code {
background: var(--code);
padding: 0.05rem 0.3rem;
border-radius: 0.25rem;
}
/* Notifications */
.toast-region {
position: fixed;
right: 1rem;
bottom: 1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
max-width: calc(100vw - 2rem);
z-index: 40;
}
.toast {
display: flex;
gap: 0.75rem;
align-items: center;
padding: 0.75rem 1rem;
background: var(--surface);
color: var(--text);
border: 2px solid var(--accent);
border-radius: 0.5rem;
}
/* Tiroirs coulissants. Fermés : visibility:hidden (hors navigation clavier), ouverts : glissent. */
.drawer-overlay {
position: fixed;
@@ -375,6 +239,7 @@ body {
padding: 1rem;
}
/* Progression */
.progress-bar {
width: 100%;
height: 1rem;
@@ -383,7 +248,69 @@ body {
.progress-count {
margin: 0 0 0.25rem;
font-weight: 600;
font-weight: 700;
}
.level-list {
list-style: none;
padding: 0;
}
.level-button {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 0.25rem 0.75rem;
width: 100%;
margin: 0.25rem 0;
padding: 0.5rem 0.75rem;
background: var(--surface);
color: var(--text);
border: 1px solid var(--border);
border-radius: 0.375rem;
font: inherit;
text-align: left;
cursor: pointer;
}
.level-button.is-current {
border-width: 3px;
border-color: var(--accent);
}
.level-title {
flex: 1 1 8rem;
}
.level-state {
white-space: nowrap;
}
/* Réglages */
.setting {
display: grid;
grid-template-columns: 8rem 1fr;
gap: 0.75rem;
align-items: center;
margin: 0.75rem 0;
}
.setting select,
.setting input[type="range"] {
width: 100%;
min-height: 2.5rem;
font: inherit;
}
.setting input[type="checkbox"] {
width: 1.5rem;
height: 1.5rem;
justify-self: start;
accent-color: var(--accent);
}
.setting > .btn:only-child {
grid-column: 1 / -1;
}
@media (max-width: 40rem) {
@@ -396,3 +323,10 @@ body {
grid-row: 2;
}
}
@media (prefers-reduced-motion: reduce) {
* {
animation: none !important;
transition: none !important;
}
}
+154
View File
@@ -0,0 +1,154 @@
/* Cellules de code : éditeur coloré, actions, sortie, retours de validation, indices, saisie. */
.cell {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 0.5rem;
padding: 1rem;
margin: 1rem 0;
}
.cell > :first-child {
margin-top: 0;
}
.cell-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0.5rem 0;
}
.cell-shortcut {
margin: 0.25rem 0;
color: var(--muted);
font-size: 0.875rem;
}
/* Éditeur : un <textarea> réel (clavier, lecteurs d'écran) dont le texte est rendu transparent, au-dessus
d'un <pre> qui affiche le même code coloré. Même police, mêmes marges et même retour à la ligne. */
.code-editor-wrap {
position: relative;
background: var(--code);
border: 1px solid var(--border);
border-radius: 0.375rem;
overflow: hidden;
}
.code-editor-wrap:focus-within {
border-color: var(--accent);
box-shadow: 0 0 0 2px var(--accent);
}
.code-highlight,
.code-editor {
margin: 0;
padding: 0.75rem;
box-sizing: border-box;
width: 100%;
font-family: var(--font-code);
font-size: 1rem;
line-height: 1.5;
tab-size: 4;
white-space: pre;
overflow: auto;
border: 0;
letter-spacing: 0;
word-spacing: 0;
font-variant-ligatures: none;
}
.code-highlight {
position: absolute;
inset: 0;
color: var(--text);
pointer-events: none;
overflow: hidden;
}
.code-editor {
position: relative;
display: block;
resize: none;
background: transparent;
color: transparent;
caret-color: var(--text);
outline: none;
}
.code-editor::selection {
background: color-mix(in srgb, var(--accent) 35%, transparent);
}
.tok-keyword {
color: var(--tok-keyword);
font-weight: 700;
}
.tok-string {
color: var(--tok-string);
}
.tok-number {
color: var(--tok-number);
}
.tok-comment {
color: var(--tok-comment);
font-style: italic;
}
.tok-builtin {
color: var(--tok-builtin);
}
.tok-def {
color: var(--tok-def);
font-weight: 700;
}
.cell-output {
min-height: 1.5rem;
margin: 0.5rem 0;
padding: 0.5rem 0.75rem;
background: var(--bg);
border-left: 4px solid var(--border);
white-space: pre-wrap;
}
.feedback-ok {
color: var(--ok);
font-weight: 700;
}
.feedback-ko,
.error-title {
color: var(--ko);
font-weight: 700;
}
.hint-list {
flex-basis: 100%;
margin: 0;
}
.cell-input {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
margin: 0.5rem 0;
}
.cell-input-field {
flex: 1 1 12rem;
min-height: 2.5rem;
padding: 0.25rem 0.5rem;
font-family: var(--font-code);
font-variant-ligatures: none;
font-size: 1rem;
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 0.375rem;
}
+106
View File
@@ -0,0 +1,106 @@
/* Identité visuelle : palette « Forêt & Corail », typographie Atkinson Hyperlegible + JetBrains Mono.
Jetons de couleur clair/sombre (rapports de contraste vérifiés par tests/js/theme-contrast.test.mjs),
polices auto-hébergées (COEP : aucune ressource cross-origin), taille de texte réglable. */
@font-face {
font-family: "Atkinson Hyperlegible";
src: url("../assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
font-weight: 400;
font-display: swap;
}
@font-face {
font-family: "Atkinson Hyperlegible";
src: url("../assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
font-weight: 700;
font-display: swap;
}
@font-face {
font-family: "JetBrains Mono";
src: url("../assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
font-weight: 400;
font-display: swap;
}
@font-face {
font-family: "JetBrains Mono";
src: url("../assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
font-weight: 700;
font-display: swap;
}
:root {
--font-ui: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--font-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
/* Réglable par SettingsPanel : html { font-size: calc(var(--font-scale) * 100%) } */
--font-scale: 1;
/* Clair */
--bg: #ffffff;
--surface: #f3f7f6;
--code: #ebf2f0;
--text: #16231f;
--muted: #475b55;
--border: #b4c4bf;
--accent: #0f766e;
--accent-text: #ffffff;
--hl: #c2410c; /* corail : XP, focus */
--focus: #c2410c;
--ok: #166534;
--ko: #b42318;
--tok-keyword: #9a3412;
--tok-string: #166534;
--tok-number: #1d4ed8;
--tok-comment: #4f625c;
--tok-builtin: #0f766e;
--tok-def: #6d28d9;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #0f1715;
--surface: #18231f;
--code: #121c19;
--text: #e8f1ee;
--muted: #a9bdb6;
--border: #41544e;
--accent: #5eead4;
--accent-text: #04201c;
--hl: #fdba74;
--focus: #fdba74;
--ok: #86efac;
--ko: #fda4af;
--tok-keyword: #fdba74;
--tok-string: #86efac;
--tok-number: #93c5fd;
--tok-comment: #9db0a9;
--tok-builtin: #5eead4;
--tok-def: #c4b5fd;
}
}
:root[data-theme="dark"] {
--bg: #0f1715;
--surface: #18231f;
--code: #121c19;
--text: #e8f1ee;
--muted: #a9bdb6;
--border: #41544e;
--accent: #5eead4;
--accent-text: #04201c;
--hl: #fdba74;
--focus: #fdba74;
--ok: #86efac;
--ko: #fda4af;
--tok-keyword: #fdba74;
--tok-string: #86efac;
--tok-number: #93c5fd;
--tok-comment: #9db0a9;
--tok-builtin: #5eead4;
--tok-def: #c4b5fd;
}
html {
font-size: calc(var(--font-scale) * 100%);
}