separation du css et du html

This commit is contained in:
serveur
2026-10-17 23:14:07 +02:00
parent 24f42133ad
commit a54031e313
6 changed files with 620 additions and 450 deletions
+438
View File
@@ -0,0 +1,438 @@
/* =====================================================================
Calcul des épices : feuille de style unique pour toutes les pages
1. Variables et base
2. En-tête et menu
3. Composants communs (cartes, champs, boutons)
4. Page « Calculateur » (index.html)
5. Page « To-do » (todo.html)
6. Grands écrans
7. Impression
===================================================================== */
/* ---------- 1. Variables et base ---------- */
:root {
--bg: #f6f1ea;
--card: #ffffff;
--ink: #2b2420;
--muted: #7a6e65;
--line: #e6ddd2;
--accent: #8c2f2f;
--accent-dark: #742626;
--accent-soft: #f7e8e5;
--ok: #2f6b4f;
--warn: #b35a00;
--warn-soft: #fff1e0;
--radius: 16px;
--shadow: 0 1px 2px rgba(43, 36, 32, 0.06), 0 6px 18px rgba(43, 36, 32, 0.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body {
margin: 0;
background: var(--bg);
color: var(--ink);
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
line-height: 1.35;
padding-bottom: env(safe-area-inset-bottom);
}
.wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px 40px; }
/* ---------- 2. En-tête et menu (toutes les pages) ---------- */
.topbar {
position: sticky;
top: 0;
z-index: 10;
background: var(--accent);
color: #fff;
padding: calc(8px + env(safe-area-inset-top)) 16px 0;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.topbar-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: 40px;
}
.topbar h1 {
margin: 0;
font-family: Georgia, "Times New Roman", serif;
font-size: 1.15rem;
font-weight: 700;
}
.menu { display: flex; gap: 4px; margin: 2px -6px 0; }
.menu a {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
min-height: 42px;
padding: 0 14px;
color: rgba(255, 255, 255, 0.78);
text-decoration: none;
font-weight: 600;
font-size: 0.95rem;
border-bottom: 3px solid transparent;
}
.menu a:active { background: rgba(255, 255, 255, 0.12); }
.menu a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
@media (min-width: 600px) {
.menu a { flex: 0 0 auto; padding: 0 22px; }
}
/* ---------- 3. Composants communs ---------- */
.card {
background: var(--card);
border-radius: var(--radius);
box-shadow: var(--shadow);
padding: 16px;
margin-bottom: 14px;
}
.card h2 {
margin: 0 0 12px;
font-size: 0.78rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--muted);
}
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 5px; }
/* 16px minimum : évite le zoom automatique d'iOS au focus */
input[type="text"], input[type="number"] {
width: 100%;
height: 48px;
font: inherit;
font-size: 1.1rem;
font-variant-numeric: tabular-nums;
padding: 0 12px;
border: 1.5px solid var(--line);
border-radius: 12px;
background: #fffdfa;
color: var(--ink);
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(140, 47, 47, 0.18); }
.btn {
font: inherit;
font-weight: 700;
min-height: 52px;
padding: 0 18px;
border-radius: 14px;
border: 1.5px solid var(--line);
background: var(--card);
color: var(--ink);
cursor: pointer;
}
.btn:active { transform: scale(0.99); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
/* ---------- 4. Page « Calculateur » ---------- */
/* Récapitulatif dans la barre du haut */
.summary { display: flex; gap: 16px; text-align: right; }
.summary .lbl { display: block; font-size: 0.68rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.06em; }
.summary b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
/* Rendement */
.yield { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yield .field { grid-column: 1 / -1; }
.stat { background: #fbf7f1; border-radius: 12px; padding: 10px 12px; }
.stat .label { font-size: 0.75rem; color: var(--muted); }
.stat .value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.big .value { color: var(--accent); }
/* Réglages repliables */
details.card { padding: 0; }
details summary {
list-style: none;
display: flex;
align-items: center;
justify-content: space-between;
min-height: 52px;
padding: 0 16px;
font-weight: 600;
cursor: pointer;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "▾"; color: var(--muted); transition: transform 0.15s; }
details[open] summary::after { transform: rotate(180deg); }
details .settings { padding: 0 16px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
details .hint { grid-column: 1 / -1; margin: 0; font-size: 0.8rem; color: var(--muted); }
/* Interrupteurs (couenne, filtre) */
.switch {
position: relative;
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 44px;
padding: 0 14px 0 10px;
border: 1.5px solid var(--line);
border-radius: 999px;
background: #fff;
font-weight: 600;
font-size: 0.92rem;
cursor: pointer;
user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: #d9cfc3; position: relative; transition: background 0.15s; flex: none; }
.switch .track::after {
content: "";
position: absolute;
top: 2px; left: 2px;
width: 18px; height: 18px;
border-radius: 50%;
background: #fff;
transition: transform 0.15s;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.switch:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(140, 47, 47, 0.25); }
.filterbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; flex-wrap: wrap; }
.count { font-size: 0.9rem; color: var(--muted); }
.count b { color: var(--accent); }
/* Cartes bassines */
.bassines { display: grid; gap: 12px; }
.bassine {
background: var(--card);
border-radius: var(--radius);
box-shadow: var(--shadow);
border: 2px solid transparent;
padding: 14px;
}
.bassine.filled { border-color: var(--accent); background: #fffaf9; }
.bassine.warn { border-color: var(--warn); background: var(--warn-soft); }
.b-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.b-name { font-weight: 700; font-size: 1.05rem; }
.b-tare { font-size: 0.8rem; color: var(--muted); }
.b-input label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.input-wrap { position: relative; }
.input-wrap input { height: 56px; font-size: 1.5rem; font-weight: 600; padding-right: 52px; }
.clear {
position: absolute;
right: 6px; top: 6px;
width: 44px; height: 44px;
border: none;
border-radius: 10px;
background: transparent;
color: var(--muted);
font-size: 1.1rem;
cursor: pointer;
}
.clear:active { background: var(--line); }
.input-wrap input:placeholder-shown + .clear { display: none; }
.b-results { margin-top: 12px; }
.b-net { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.b-net .lbl { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.b-net .val { font-size: 1.7rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.b-net .unit { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-left: 3px; }
.warn .b-net .val { color: var(--warn); }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tile { grid-column: span 2; background: #fbf7f1; border-radius: 10px; padding: 8px 6px; text-align: center; }
.tile:nth-child(n+4) { grid-column: span 3; }
.tile .t-lbl { display: block; font-size: 0.7rem; color: var(--muted); }
.tile .t-val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1rem; }
.b-warn { margin: 10px 0 0; font-size: 0.85rem; color: var(--warn); font-weight: 600; }
/* Totaux */
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.totals .stat:first-child { grid-column: 1 / -1; background: var(--accent-soft); }
.totals .unit { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
/* Boutons du bas de page */
.actions { display: grid; gap: 10px; }
/* ---------- 5. Page « To-do » ---------- */
/* Statut de connexion (barre du haut) */
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; opacity: 0.95; }
.live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #7be0a8; }
.live.off::before { background: #ffc266; }
/* Ajout d'une tâche */
.add { display: flex; gap: 10px; margin-bottom: 14px; }
.add input {
flex: 1;
min-width: 0;
height: 56px;
padding: 0 14px;
border-radius: 14px;
background: var(--card);
box-shadow: var(--shadow);
}
.add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(140, 47, 47, 0.18); }
.add .btn.primary { min-height: 56px; }
.info { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; font-size: 0.9rem; color: var(--muted); }
.info b { color: var(--accent); }
/* Liste */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item {
display: flex;
align-items: center;
background: var(--card);
border-radius: 14px;
box-shadow: var(--shadow);
border: 2px solid transparent;
}
.item.flash { animation: flash 1.8s ease-out; }
@keyframes flash {
0% { background: #fde9c4; border-color: var(--warn); }
100% { background: var(--card); border-color: transparent; }
}
/* Poignée de réorganisation */
.grip {
flex: none;
width: 46px;
height: 56px;
margin-left: 2px;
padding: 0;
border: none;
border-radius: 12px;
background: transparent;
color: #b5a99b;
cursor: grab;
touch-action: none; /* le doigt déplace la tâche au lieu de faire défiler la page */
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
.grip::before {
content: "";
display: block;
width: 18px;
height: 12px;
margin: auto;
background: repeating-linear-gradient(to bottom, currentColor 0 2px, transparent 2px 5px);
}
.grip:active, .grip:focus-visible { color: var(--accent); background: var(--accent-soft); outline: none; }
.item.dragging {
position: relative;
z-index: 5;
border-color: var(--accent);
box-shadow: 0 10px 28px rgba(43, 36, 32, 0.28);
will-change: transform;
}
body.glisse { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.check {
position: relative;
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 14px;
min-height: 60px;
padding: 8px 6px 8px 4px;
cursor: pointer;
}
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.box {
flex: none;
width: 30px;
height: 30px;
border-radius: 9px;
border: 2px solid #cfc3b5;
background: #fffdfa;
display: grid;
place-items: center;
transition: background 0.12s, border-color 0.12s;
}
.box::after {
content: "";
width: 7px;
height: 14px;
border: solid #fff;
border-width: 0 3px 3px 0;
transform: translateY(-1px) rotate(45deg) scale(0);
transition: transform 0.12s;
}
.check input:checked + .box { background: var(--ok); border-color: var(--ok); }
.check input:checked + .box::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(140, 47, 47, 0.25); }
.txt { font-size: 1.05rem; overflow-wrap: anywhere; }
.item.done .txt { color: var(--muted); text-decoration: line-through; }
.del {
flex: none;
width: 52px;
height: 52px;
margin-right: 4px;
border: none;
border-radius: 12px;
background: transparent;
color: var(--muted);
font-size: 1.1rem;
cursor: pointer;
}
.del:active { background: var(--line); }
.vide { text-align: center; color: var(--muted); padding: 36px 12px; }
.erreur {
margin: 0 0 12px;
padding: 10px 14px;
border-radius: 12px;
background: var(--warn-soft);
color: var(--warn);
font-weight: 600;
font-size: 0.9rem;
}
.todo-actions { margin-top: 16px; display: grid; }
/* ---------- 6. Grands écrans ---------- */
@media (min-width: 900px) {
.wrap-large { max-width: 1000px; } /* page Calculateur : deux colonnes de bassines */
.bassines { grid-template-columns: 1fr 1fr; }
.actions { grid-template-columns: 1fr 1fr; }
}
/* ---------- 7. Impression ---------- */
@media print {
body { background: #fff; }
.topbar, .no-print, .clear { display: none !important; }
.card, .bassine { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
.bassine:not(.filled) { display: none; } /* on n'imprime que les bassines pesées */
.bassines { grid-template-columns: 1fr 1fr; }
input { border: none; background: none; }
details { display: none; }
}