/**
 * PlayAwale — Les règles du jeu
 * -----------------------------------------------------------------------------
 * Une page qui s'apprend de haut en bas : la vidéo en tête sur la page française,
 * quatre vignettes pour l'essentiel, cinq chapitres numérotés illustrés par les
 * vrais plateaux du jeu, puis les cartes des IA.
 *
 * ELLE REPREND LE SITE
 * Cartes de sable et titres gravés du compte ; plateau, thème et graines du jeu ;
 * pastilles et graines ambrées des boutons. Seul ce qui n'existe nulle part
 * ailleurs est dessiné ici.
 *
 * @package   PlayAwale
 * @version   2.0
 * @author    Nicolas Lion — Développeur web — https://nlion.fr
 * @copyright 2026 Nicolas Lion
 */

.rules-page .account-block {
  width: min(94vw, 820px);
}

.rules-page .rules-block--wide {
  width: min(94vw, 1120px);
}

.rules-page .account-block__text,
.rules-steps {
  text-align: left;
}


/* =============================================================================
   L'EN-TÊTE ET LA VIDÉO
   ============================================================================= */

.rules-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);

  width: min(94vw, 820px);
}

.rules-hero__lead {
  max-width: 40rem;
  margin: 0;
}

.rules-video-card {
  width: 100%;
  padding: var(--space-sm);

  background-color: var(--color-surface);
  background-image: var(--gradient-surface-raised);
  border-radius: var(--radius-lg, var(--radius-md));
  box-shadow: var(--shadow-raised);
}

.rules-video {
  position: relative;

  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;

  overflow: hidden;
  background-color: var(--color-brand-dark);
  border-radius: var(--radius-md);
}

.rules-video__facade,
.rules-video__frame {
  position: absolute;
  inset: 0;

  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
}

.rules-video__facade {
  cursor: pointer;
  background: none;
}

.rules-video__facade:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: -6px;
}

.rules-video__thumb,
.rules-video__thumb img {
  position: absolute;
  inset: 0;

  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rules-video__thumb img {
  transition: transform var(--duration-slow) ease;
}

.rules-video__facade:hover .rules-video__thumb img,
.rules-video__facade:focus-visible .rules-video__thumb img {
  transform: scale(1.03);
}

/* Un voile léger, pour que le bouton de lecture se lise sur n'importe quelle
   image, sans assombrir la miniature. */
.rules-video__shade {
  position: absolute;
  inset: 0;

  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.28) 75%);
}

.rules-video__play {
  position: absolute;
  left: 50%;
  top: 50%;

  display: grid;
  place-items: center;

  width: clamp(3.5rem, 12vw, 5rem);
  height: clamp(3.5rem, 12vw, 5rem);

  color: var(--color-brand-dark);

  background-color: var(--color-brand-amber);
  background-image: var(--gradient-amber-raised);
  border-radius: var(--radius-full);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), var(--shadow-raised-amber);

  transform: translate(-50%, -50%);
  transition: transform var(--duration-fast) ease;
}

.rules-video__facade:hover .rules-video__play,
.rules-video__facade:focus-visible .rules-video__play {
  transform: translate(-50%, -50%) scale(1.08);
}

.rules-video__play-icon {
  width: 45%;
  height: 45%;
  margin-left: 8%;
}

.rules-video__below {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-md);

  padding: var(--space-sm) var(--space-xs) var(--space-xs);
}

.rules-video__title {
  margin: 0;

  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  font-weight: 400;
  text-align: left;
}

.rules-video__youtube {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);

  padding: var(--space-xs) var(--space-md);

  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;

  background-color: var(--color-sand-100);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-raised);
}

.rules-video__youtube:hover,
.rules-video__youtube:focus-visible {
  background-color: var(--color-brand-amber-light);
  box-shadow: var(--shadow-raised-hover);
}

.rules-video__youtube:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.rules-video__youtube-icon {
  width: 12px;
  height: 12px;
}

/* L'avertissement : un fond ambré pâle et sa pastille, sans liseré. */
.rules-video__privacy {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);

  margin: var(--space-xs) 0 0;
  padding: var(--space-sm) var(--space-md);

  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
  text-align: left;
  color: var(--color-text);

  background-color: var(--color-brand-amber-light);
  border-radius: var(--radius-md);
}

.rules-video__privacy-icon {
  display: grid;
  place-items: center;
  flex: none;

  width: 1.4rem;
  height: 1.4rem;

  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--color-brand-dark);

  background-color: var(--color-brand-amber);
  border-radius: var(--radius-full);
}


/* --- L'essentiel ----------------------------------------------------------- */

.rules-essentials {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: var(--space-sm);

  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-essential {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);

  padding: var(--space-md) var(--space-sm);

  text-align: center;

  background-color: var(--color-surface);
  background-image: var(--gradient-surface-raised);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.rules-essential__figure {
  display: grid;
  place-items: center;

  min-width: 3.2rem;
  height: 3.2rem;
  padding: 0 var(--space-xs);

  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-brand-dark);

  background-color: var(--color-brand-amber);
  background-image: var(--gradient-amber-raised);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-raised-amber);
}

.rules-essential__text {
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-text);
}


/* =============================================================================
   LES CHAPITRES
   ============================================================================= */

.rules-block__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

/* Le numéro du chapitre dans une graine ambrée, comme les étapes. */
.rules-block__number {
  display: grid;
  place-items: center;
  flex: none;

  width: 2.2rem;
  height: 2.2rem;

  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-brand-dark);

  background-color: var(--color-brand-amber);
  background-image: var(--gradient-amber-raised);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-raised-amber);
}

.rules-steps {
  display: grid;
  gap: var(--space-sm);

  margin: var(--space-sm) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: etape;
}

.rules-step {
  position: relative;

  min-height: 1.8rem;
  padding-left: calc(1.8rem + var(--space-sm));

  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);

  counter-increment: etape;
}

.rules-step::before {
  content: counter(etape);

  position: absolute;
  left: 0;
  top: 0;

  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;

  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--color-brand-cream);

  background-color: var(--color-brand-dark);
  border-radius: var(--radius-full);
}

.rules-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--space-sm);

  margin-top: var(--space-sm);
  text-align: left;
}

/* Une carte de sable, relevée par son ombre ; le titre porte une graine ambrée
   plutôt qu'un liseré de couleur. */
.rules-card {
  padding: var(--space-md);

  background-color: var(--color-surface);
  background-image: var(--gradient-surface-raised);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.rules-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);

  margin: 0 0 var(--space-xs);

  font-family: var(--font-display);
  font-size: var(--font-size-base);
  font-weight: 400;
}

.rules-card__title::before {
  content: '';
  flex: none;

  width: 0.8rem;
  height: 0.8rem;

  background-color: var(--color-brand-amber);
  background-image: var(--gradient-amber-raised);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-raised-amber);
}

.rules-card--win .rules-card__title::before {
  background-color: var(--color-verdict-best);
  background-image: none;
}

.rules-card__text {
  margin: 0;

  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
  color: var(--color-text);
}


/* =============================================================================
   LES PLATEAUX
   -----------------------------------------------------------------------------
   Le plateau du jeu, dimensionné sur la largeur de son cadre et non de la
   fenêtre : un plateau de six trous tient en 7,33 fois la taille d'un trou.
   ============================================================================= */

.rules-demo {
  container-type: inline-size;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);

  margin: var(--space-md) 0 0;
  padding: var(--space-md) var(--space-sm);

  background-color: var(--color-sand-100);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.rules-demo__board {
  --hole-size: min(72px, calc((100cqi - 4px) / 7.33333));
}

/* Le trou joué et le coup permis : leurs anneaux sont plus épais qu'en partie,
   où ils ne font qu'annoncer un coup. Ici, c'est eux qu'on vient regarder —
   comme sur la page d'analyse. */
.rules-demo__board .hole.is-chosen,
.rules-demo__board .hole.is-candidate {
  outline-width: calc(var(--hole-size) * 0.07);
}

/* Les trous pris restent marqués sur la position d'arrivée : un anneau vert,
   de la même épaisseur. */
.rules-demo__board .hole.rules-demo__taken {
  outline: calc(var(--hole-size) * 0.07) solid var(--color-verdict-best);
  outline-offset: calc(var(--hole-size) * -0.02);
}

.rules-demo__side {
  margin: 0;

  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.rules-demo__caption {
  max-width: 36rem;
  margin-top: var(--space-xs);

  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: var(--line-height-base);
  text-align: center;
  color: var(--color-text);
}

.rules-demo__play {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);

  margin-top: var(--space-xs);
  padding: var(--space-xs) var(--space-lg);

  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-brand-dark);

  background-color: var(--color-brand-amber);
  background-image: var(--gradient-amber-raised);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-raised-amber);
  cursor: pointer;
}

.rules-demo__play:hover,
.rules-demo__play:focus-visible {
  transform: translateY(-2px);
}

.rules-demo__play:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.rules-demo__play:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.rules-demo__play-icon {
  width: 14px;
  height: 14px;
}


/* L'invitation à jouer, au pied de la dernière règle. */
.rules-cta {
  display: flex;
  justify-content: center;

  margin: var(--space-md) 0 0;
}


/* =============================================================================
   PETITS ÉCRANS ET MOUVEMENT RÉDUIT
   ============================================================================= */

@media (max-width: 40rem) {

  .rules-page .account-block {
    padding: var(--space-md);
  }

  .rules-video__below {
    justify-content: center;
  }

  .rules-video__title {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {

  .rules-video__thumb img,
  .rules-video__play {
    transition: none;
  }

  .rules-demo__play:hover,
  .rules-demo__play:focus-visible {
    transform: none;
  }
}
