◆ Portail Antalaha

Annuaire › Code ouvert

Baie d'Antalaha : diorama 3D animé jour et nuit

tutorial · Voir le site ↗
Connectez-vous pour copier ce site

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 · 5.1 Ko

/* ==========================================================================
 * css/style.css — Mise en page « Baie d'Antalaha » (mobile d'abord)
 * ========================================================================== */

:root {
  --fond: #0f1b2d;          /* fond sombre : met en valeur le diorama */
  --carte: #ffffff;
  --texte: #12263a;         /* sur fond blanc : contraste élevé */
  --texte-clair: #f1f6fb;   /* sur fond sombre */
  --accent: #0b6e8a;
  --bordure: #c6d6e4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--texte-clair);
  background: var(--fond);
  overflow-x: hidden;       /* jamais de défilement horizontal */
}

.noscript { margin: 0; padding: 12px 16px; background: #fff3cd; color: #5c4400; }

.entete { padding: 14px 16px 6px; max-width: 900px; margin: 0 auto; }
.entete h1 { margin: 0; font-size: 1.4rem; }
.entete p { margin: 4px 0 0; color: #c9d8e6; font-size: 0.95rem; }

main { max-width: 900px; margin: 0 auto; padding: 8px 16px 24px; }

/* ---- LA SCÈNE ----
   Hauteur adaptative : environ 72 % de la largeur, entre 260 et 540 px.
   Le fond (dégradé de ciel) est écrit par main.js ; valeur de secours ici. */
.scene {
  position: relative;
  width: 100%;
  height: clamp(260px, 72vw, 540px);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #3f9be6, #c4e8ff);
  border: 1px solid #2d4560;
}

/* touch-action: none UNIQUEMENT sur le canevas : le doigt tourne le diorama
   au lieu de faire défiler la page. Ailleurs, la page défile normalement. */
.zdog-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.zdog-canvas:active { cursor: grabbing; }

/* Étiquette flottante en haut à gauche : fond sombre pour un contraste constant,
   quelle que soit la couleur du ciel. */
.badge {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(10, 20, 35, 0.78);
  color: #fff;
  pointer-events: none;             /* ne gêne pas le glissement */
}
.badge img { filter: invert(1); }   /* icône noire -> blanche */
.badge-heure { font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-phase { font-size: 0.85rem; opacity: 0.9; }

.fps {
  position: absolute;
  right: 10px; bottom: 8px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(10, 20, 35, 0.7);
  color: #fff;
  font-size: 0.75rem;
  pointer-events: none;
}

/* ---- COMMANDES ---- */
.commandes { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 720px) { .commandes { grid-template-columns: 3fr 2fr; } }

.bloc {
  background: var(--carte);
  color: var(--texte);
  border-radius: 12px;
  padding: 12px 14px 14px;
}
.titre-bloc { display: block; font-weight: 700; color: var(--accent); margin-bottom: 6px; }

input[type="range"] { width: 100%; }

/* Le ruban des 24 h : dégradé nuit → aube → jour → crépuscule → nuit.
   NB : Zdog.Dragger règle lui-même touch-action: none sur l'élément qu'il
   surveille (ici ce petit ruban de 28 px de haut), pour recevoir les glissements. */
.ruban {
  position: relative;
  height: 28px;
  margin-top: 10px;
  border-radius: 8px;
  background: linear-gradient(90deg,
    #050b26 0%, #050b26 20%, #ffb18c 27%, #3f9be6 35%, #3f9be6 66%,
    #ff7f5e 75%, #1f2055 81%, #050b26 88%, #050b26 100%);
  cursor: ew-resize;
}
.ruban-repere {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 2px #12263a;
  pointer-events: none;
}
.ruban-legende {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; color: #3b5268; margin-top: 4px;
}

.rangee { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.bouton {
  font: inherit;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;                 /* cible tactile confortable */
  padding: 8px 14px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}
.bouton:hover { background: #e3f3f8; }
.bouton[aria-pressed="true"] { background: var(--accent); color: #fff; }
.bouton[aria-pressed="true"] img { filter: invert(1); }

.case { display: flex; align-items: center; gap: 10px; min-height: 36px; }
input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; }

button:focus-visible, input:focus-visible {
  outline: 3px solid #ff9f1c;
  outline-offset: 2px;
}

/* ---- PLAN DU CODE ---- */
.plan {
  margin-top: 12px;
  background: #162840;
  border-radius: 12px;
  padding: 4px 16px 12px;
}
.plan h2 { font-size: 1.1rem; }
.plan ol { padding-left: 20px; margin: 0; }
.plan code {
  background: #0b1626;
  color: #9fe3f5;
  padding: 1px 6px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

/* ---- PIED DE PAGE : bande de vagues (SVG libre de droits) ---- */
.pied {
  padding: 18px 16px 52px;
  text-align: center;
  background: #e0f7fa url("../medias/motif-vagues.svg") repeat-x center bottom / auto 40px;
  color: #12263a;
}
.pied p { margin: 0; }