Files
PyQuest/app/css/app.css
T

399 lines
7.1 KiB
CSS

/* 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%);
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
line-height: 1.55;
}
:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 2px;
}
.notebook {
max-width: 48rem;
margin: 0 auto;
padding: 1rem;
}
.notebook-status {
color: var(--muted);
min-height: 1.5em;
}
.explain,
.cell {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 0.5rem;
padding: 1rem;
margin: 1rem 0;
}
.btn {
min-height: 2.75rem; /* cible tactile confortable (WCAG 2.5.8) */
padding: 0.4rem 1rem;
border: 1px solid var(--border);
border-radius: 0.375rem;
background: var(--bg);
color: var(--text);
font: inherit;
cursor: pointer;
}
.btn-primary {
background: var(--accent);
border-color: var(--accent);
color: var(--accent-text);
}
.btn:disabled {
opacity: 0.6;
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;
grid-template-columns: auto 1fr auto;
align-items: center;
gap: 0.75rem;
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--border);
background: var(--surface);
}
.app-heading {
display: flex;
flex-direction: column;
align-items: center;
min-width: 0;
}
.app-heading h1 {
margin: 0;
font-size: 1.25rem;
line-height: 1.2;
}
.level-nav {
display: flex;
align-items: center;
gap: 0.5rem;
max-width: 100%;
}
.level-nav .btn {
min-width: 2.75rem;
padding: 0.2rem 0.6rem;
}
.level-current {
color: var(--muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Tiroirs coulissants. Fermés : visibility:hidden (hors navigation clavier), ouverts : glissent. */
.drawer-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
opacity: 0;
visibility: hidden;
transition: opacity 0.25s ease, visibility 0s linear 0.25s;
z-index: 20;
}
.drawer-overlay.is-open {
opacity: 1;
visibility: visible;
transition: opacity 0.25s ease;
}
.drawer {
position: fixed;
top: 0;
bottom: 0;
width: min(24rem, 92vw);
display: flex;
flex-direction: column;
background: var(--bg);
color: var(--text);
box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.35);
visibility: hidden;
transition: transform 0.25s ease, visibility 0s linear 0.25s;
z-index: 21;
}
.drawer-left {
left: 0;
transform: translateX(-100%);
border-right: 1px solid var(--border);
}
.drawer-right {
right: 0;
transform: translateX(100%);
border-left: 1px solid var(--border);
}
.drawer.is-open {
transform: none;
visibility: visible;
transition: transform 0.25s ease;
}
.drawer-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border);
}
.drawer-title {
margin: 0;
font-size: 1.25rem;
}
.drawer-body {
flex: 1;
overflow-y: auto;
padding: 1rem;
}
.progress-bar {
width: 100%;
height: 1rem;
accent-color: var(--accent);
}
.progress-count {
margin: 0 0 0.25rem;
font-weight: 600;
}
@media (max-width: 40rem) {
.app-header {
grid-template-columns: 1fr 1fr;
}
.app-heading {
grid-column: 1 / -1;
grid-row: 2;
}
}