/* Page vitrine de ziffly.ch. La couleur d'accent est réservée aux décisions
   humaines du cycle, aux boutons et au focus. */
:root {
  color-scheme: light dark;
  --fond: #f6f7f7;
  --texte: #15191c;
  --attenue: #4d565d;
  --filet: #d5dadd;
  --accent: #0b5a6a;
  --sur-accent: #ffffff;
  --mesure: 42rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121517;
    --texte: #e9ebed;
    --attenue: #a5aeb5;
    --filet: #30373c;
    --accent: #62c3d4;
    --sur-accent: #0b1a1e;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 70rem;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 2.5rem) clamp(3rem, 6vw, 4.5rem);
  background: var(--fond);
  color: var(--texte);
  font-size: 1.0625rem;
  line-height: 1.55;
}

p { margin: 0; }

h1, h2 { margin: 0; font-size: 1rem; line-height: 1.3; font-weight: 650; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* En-tête : la phrase qui dit tout, alignée à gauche, sans décor. */
.tete h1 { margin-bottom: 1.25rem; }

.accroche {
  max-width: 24em;
  font-size: clamp(1.55rem, 3.7vw, 2.5rem);
  line-height: 1.18;
  font-weight: 550;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.soutien {
  margin-top: 1.25rem;
  max-width: var(--mesure);
  color: var(--attenue);
  font-size: 1.125rem;
}

/* Sections : titre dans une colonne, contenu dans l'autre. */
section {
  display: grid;
  grid-template-columns: 13rem minmax(0, var(--mesure));
  column-gap: clamp(2rem, 5vw, 4.5rem);
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--filet);
}

section.large { display: block; }

section.large h2 { margin-bottom: 2rem; }

dl { margin: 0; }

dl > div + div { margin-top: 1.25rem; }

dt { font-weight: 600; }

dd { margin: 0.1rem 0 0; color: var(--attenue); }

.intro { margin-bottom: 1.5rem; }

/* Le cycle : le schéma est la liste elle-même. */
.cycle {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cycle li { position: relative; padding-top: 1.9rem; }

.cycle strong { display: block; font-weight: 600; line-height: 1.25; hyphens: manual; }

.cycle span { display: block; margin-top: 0.4rem; color: var(--attenue); font-size: 0.875rem; line-height: 1.42; }

/* Repère de l'étape : rond pour l'agent et les automatismes, losange pour moi. */
.cycle li::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--attenue);
  border-radius: 50%;
  background: var(--fond);
}

.cycle .humain::before,
.losange {
  border: 0;
  border-radius: 0;
  background: var(--accent);
  transform: rotate(45deg);
}

.cycle .humain::before { top: 0.17rem; width: 0.85rem; height: 0.85rem; }

.cycle .humain strong { color: var(--accent); }

/* Le trait qui mène à l'étape suivante, terminé par une pointe. */
.cycle li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 0.58rem;
  left: 1.2rem;
  right: -0.6rem;
  height: 0;
  border-top: 2px solid var(--filet);
}

.cycle li:not(:last-child) strong::before {
  content: "";
  position: absolute;
  top: 0.36rem;
  right: -0.57rem;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--attenue);
  border-right: 2px solid var(--attenue);
  transform: rotate(45deg);
}

.losange {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin: 0 0.3rem 0.05rem 0.1rem;
}

.note {
  margin-top: 2rem;
  max-width: var(--mesure);
  color: var(--attenue);
  font-size: 0.9375rem;
}

/* Mini-jeu */
.consigne { margin-top: 0.5rem; color: var(--attenue); font-size: 0.9375rem; }

button {
  margin-top: 1.25rem;
  padding: 0.55rem 1.3rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--sur-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 140ms cubic-bezier(.2, .8, .2, 1);
}

button:hover { opacity: 0.86; }

button:disabled { opacity: 0.6; cursor: progress; }

[hidden] { display: none !important; }

#jeu { margin-top: 1.25rem; }

#jeu-toile {
  display: block;
  width: 100%;
  height: 190px;
  border: 1px solid var(--filet);
  border-radius: 6px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.jeu-bas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  min-height: 2.75rem;
  margin-top: 0.75rem;
}

.jeu-bas p { color: var(--attenue); font-size: 0.9375rem; }

.jeu-bas button { margin-top: 0; }

/* Écrans moyens : le titre passe au-dessus, le cycle reste à l'horizontale. */
@media (max-width: 64rem) {
  section { display: block; }
  section > h2 { margin-bottom: 1.25rem; }
  .cycle { column-gap: 0.8rem; }
  .cycle span { font-size: 0.8125rem; }
  .cycle li:not(:last-child)::after { right: -0.42rem; }
  .cycle li:not(:last-child) strong::before { right: -0.39rem; }
}

/* Téléphone et tablette : le cycle se lit de haut en bas. */
@media (max-width: 52rem) {
  .cycle { display: block; }

  .cycle li {
    padding: 0 0 1.35rem 1.9rem;
  }

  .cycle li:last-child { padding-bottom: 0; }

  .cycle span { margin-top: 0.15rem; font-size: 0.9375rem; }

  .cycle li::before { top: 0.35rem; }

  .cycle .humain::before { top: 0.27rem; }

  .cycle li:not(:last-child)::after {
    top: 1.35rem;
    bottom: 0.3rem;
    left: 0.34rem;
    right: auto;
    height: auto;
    border-top: 0;
    border-left: 2px solid var(--filet);
  }

  .cycle li:not(:last-child) strong::before {
    top: auto;
    right: auto;
    bottom: 0.25rem;
    left: 0.19rem;
    transform: rotate(135deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
