/* R008 — Relief limité aux cartes de présentation des sept niveaux. */
@media screen {
  #niveaux-parcours > .card,
  .downloads-grid > .download-level-card {
    background-image: linear-gradient(145deg, rgba(255, 255, 255, .65), rgba(255, 255, 255, 0) 60%);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, .95),
      inset 0 -2px 0 rgba(16, 42, 67, .05),
      0 5px 0 rgba(6, 27, 95, .12),
      0 12px 26px rgba(16, 42, 67, .12);
    transform: translateY(0);
    transition: transform .2s ease, box-shadow .2s ease;
  }

  #niveaux-parcours > .card:focus-within,
  .downloads-grid > .download-level-card:focus-within {
    transform: translateY(-4px);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, .95),
      inset 0 -2px 0 rgba(16, 42, 67, .05),
      0 9px 0 rgba(6, 27, 95, .13),
      0 16px 30px rgba(16, 42, 67, .17);
  }
}

@media screen and (hover: hover) and (pointer: fine) {
  #niveaux-parcours > .card:hover,
  .downloads-grid > .download-level-card:hover {
    transform: translateY(-4px);
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, .95),
      inset 0 -2px 0 rgba(16, 42, 67, .05),
      0 9px 0 rgba(6, 27, 95, .13),
      0 16px 30px rgba(16, 42, 67, .17);
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  #niveaux-parcours > .card,
  #niveaux-parcours > .card:hover,
  #niveaux-parcours > .card:focus-within,
  .downloads-grid > .download-level-card,
  .downloads-grid > .download-level-card:hover,
  .downloads-grid > .download-level-card:focus-within {
    transform: none;
    transition: none;
  }
}

/* R015 : présentation centrée et boutons alignés des cartouches de niveaux. */
@media screen {
  #niveaux-parcours > .card {
    text-align: center;
  }
  #niveaux-parcours > .card > h3 > .level-card-number,
  #niveaux-parcours > .card > h3 > .level-card-name {
    display: block;
  }
  #niveaux-parcours > .card > h3 > .level-card-name {
    margin-top: .4rem;
    font-size: 1.1rem;
    line-height: 1.35;
  }
  #niveaux-parcours > .card > .btn {
    margin-left: 0;
    margin-right: 0;
  }

  /* Les quatre rangées partagées alignent titre, description, bouton et supports. */
  @supports (grid-template-rows: subgrid) {
    #niveaux-parcours > .card {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: subgrid;
      grid-row: span 4;
      row-gap: 0;
    }
    #niveaux-parcours > .card > h3 {
      grid-row: 1;
      align-self: start;
    }
    #niveaux-parcours > .card > p:first-of-type {
      grid-row: 2;
      align-self: start;
      margin-top: 0;
    }
    #niveaux-parcours > .card > .btn {
      grid-row: 3;
      align-self: start;
      justify-self: center;
    }
    #niveaux-parcours > .card > .btn + p {
      grid-row: 4;
      align-self: start;
    }
  }
}

/* R016 : même hauteur et texte centré, même si un libellé occupe deux lignes. */
@media screen {
  @supports (grid-template-rows: subgrid) {
    .cards-centrees > .card > .btn {
      align-self: stretch;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}

/* R018 : titres, descriptions et boutons partagent leurs rangées entre voisins. */
@media screen {
  @supports (grid-template-rows: subgrid) {
    body main .cards.cartouches-boutons-alignes > .card {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: subgrid;
      grid-row: span 3;
      row-gap: 0;
      align-items: start;
    }
    body main .cards.cartouches-boutons-alignes > .card > h3 {
      grid-row: 1;
    }
    body main .cards.cartouches-boutons-alignes > .card > p {
      grid-row: 2;
    }
    body main .cards.cartouches-boutons-alignes > .card > .btn {
      grid-row: 3;
      align-self: stretch;
      justify-self: center;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-left: 0;
      margin-right: 0;
    }
  }
}

/* R019 : largeur commune des boutons à l'intérieur des colonnes de cartouches. */
@media screen {
  body main .cards > .card > a.btn,
  body main .downloads-grid > .download-level-card > .download-actions > a.btn {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    justify-self: stretch;
    margin-left: 0;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
