Annuaire › Code ouvert
Code publié par son auteur, en lecture seule. « Copier dans mon espace » crée un nouveau site à vous (non publié) que vous pouvez modifier librement.
css/style.css · 4.1 Ko
/* ==========================================================================
css/style.css — Apparence du calculateur de prix de vanille
Approche « mobile d'abord » : le style de base vise un petit écran
(360 px), puis une @media (min-width) agrandit pour les grands écrans.
========================================================================== */
/* Variables CSS : on change une couleur ici, elle change partout. */
:root {
--vert: #1f5a41; /* vert profond (contraste élevé sur blanc) */
--vert-clair: #e6f3ea;
--creme: #fbf7ee;
--encre: #22281f;
--gris: #4d5549;
--rouge: #a3231a;
--bord: #b9c4b0;
--rayon: 12px;
}
* { box-sizing: border-box; }
/* IMPORTANT avec Alpine : les éléments portant x-cloak restent cachés
tant qu'Alpine n'a pas démarré (évite d'afficher des blocs x-show un
instant). Alpine retire l'attribut x-cloak au démarrage. */
[x-cloak] { display: none !important; }
body {
margin: 0;
font-family: system-ui, "Segoe UI", Roboto, sans-serif;
background: var(--creme);
color: var(--encre);
line-height: 1.5;
}
/* Bandeau d'en-tête avec une illustration en arrière-plan */
.entete {
background: linear-gradient(rgba(31,90,65,.85), rgba(31,90,65,.85)),
url("../medias/antalaha-vanille-paysage.svg") center / cover;
color: #fff;
padding: 28px 16px;
}
.entete h1 { margin: 0 0 6px; font-size: 1.6rem; }
.entete p { margin: 0; max-width: 40rem; }
main { max-width: 960px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.carte {
background: #fff;
border: 1px solid var(--bord);
border-radius: var(--rayon);
padding: 16px;
min-width: 0; /* évite qu'un enfant trop large crée un scroll horizontal */
}
.carte h2 { margin: 0 0 12px; font-size: 1.2rem; color: var(--vert); }
/* Champs de formulaire */
.champ { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type="number"], select {
width: 100%;
font: inherit;
padding: 10px;
border: 2px solid var(--bord);
border-radius: 8px;
background: #fff;
color: var(--encre);
}
/* Le focus visible aide la navigation au clavier : ne le supprimez jamais */
input:focus-visible, select:focus-visible, button:focus-visible {
outline: 3px solid #b36b00;
outline-offset: 2px;
}
.invalide { border-color: var(--rouge) !important; }
.erreur { color: var(--rouge); font-weight: 600; margin: 4px 0 0; }
.aide { color: var(--gris); font-size: .9rem; margin: 4px 0 0; }
.case { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.case input { width: 22px; height: 22px; accent-color: var(--vert); flex: none; }
.case label { margin: 0; font-weight: 500; }
.rangee { display: flex; gap: 8px; }
.rangee input { flex: 1; min-width: 0; }
button {
font: inherit; cursor: pointer; border: 2px solid var(--vert); border-radius: 8px;
padding: 10px 14px; background: var(--vert); color: #fff; font-weight: 600;
}
button:hover { background: #17452f; }
button.secondaire { background: #fff; color: var(--vert); }
button.secondaire:hover { background: var(--vert-clair); }
/* Tableau du récapitulatif */
dl { margin: 0; }
.ligne { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--bord); }
.ligne dt { color: var(--gris); }
.ligne dd { margin: 0; font-weight: 600; text-align: right; }
.ligne.remise dd { color: var(--vert); }
.total {
margin-top: 12px; padding: 14px; border-radius: 10px;
background: var(--vert); color: #fff;
display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
font-size: 1.1rem; flex-wrap: wrap;
}
.total strong { font-size: 1.5rem; overflow-wrap: anywhere; }
.bandeau { background: var(--vert-clair); border-left: 5px solid var(--vert); padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; }
.icone { width: 20px; height: 20px; vertical-align: -4px; }
footer { text-align: center; color: var(--gris); padding: 16px; font-size: .9rem; }
/* À partir de 800 px : deux colonnes (formulaire à gauche, résultat à droite) */
@media (min-width: 800px) {
main { grid-template-columns: 1fr 1fr; align-items: start; }
.entete { padding: 40px 24px; }
}