/* ==========================================================================
   Bastide Royale de Réalmont — ajustements propres à WordPress
   styles.css est la feuille de la maquette, reprise telle quelle ; ce fichier
   ne fait que raccorder les blocs natifs à ses classes.
   ========================================================================== */

/* ---------- Ossature ---------- */
/* L'en-tête doit rester « sticky » par rapport à la page, pas à son conteneur de partie de modèle */
.wp-site-blocks > .wp-block-template-part { display: contents; }
.wp-site-blocks > * + * { margin-block-start: 0; }

/* Les composants de la maquette gèrent leurs espacements avec gap : on retire
   la marge ajoutée par WordPress entre blocs à l'intérieur de ces composants. */
:where(.etape, .bloc, .occitan__corps, .duo__txt, .fiche__corps, .quiz__corps, .encart, .saistu, .feuillet, .pied__in, .pied__liens, .jeu-page__in, .hero__texte) > * { margin-block: 0; }
.etape-page .etape :where(.wp-block-group, .wp-block-buttons) > * { margin-block: 0; }
/* Les blocs de la page deviennent les enfants directs de l'article : le gap de .etape les espace */
.etape > .wp-block-post-content { display: contents; }
.etape > .wp-block-post-content > * { margin-block: 0; }

/* ---------- Pages simples (mentions légales…) ---------- */
.legal .wp-block-post-content > * + * { margin-block-start: 16px; }
.legal .wp-block-post-title { font-family: var(--f-titre); font-weight: 400; font-size: 40px; line-height: 44px; }
@media (min-width: 960px) { .legal .wp-block-post-title { font-size: 64px; line-height: 1; } }

/* ---------- Images ---------- */
.wp-block-image { margin: 0; }
.logo-partenaire.wp-block-image a { display: contents; }

/* ---------- Boutons ---------- */
.wp-block-button__link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 24px; text-decoration: none;
}
.is-style-contour .wp-block-button__link { background: transparent; color: var(--bleu); border: 2px solid var(--bleu); }
.is-style-contour .wp-block-button__link:hover { background: var(--bleu); color: var(--sur-bleu); }

/* ---------- Héros d'étape ---------- */
/* Motif des îlots (remplace le SVG décoratif de la maquette) */
.etape-hero::before {
  content: ""; position: absolute; right: -36px; top: -24px; width: 180px; height: 170px; pointer-events: none;
  transform: rotate(-18deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38' height='30'%3E%3Crect width='32' height='24' rx='5' fill='%23b47d86'/%3E%3C/svg%3E");
}
.etape-hero > * { position: relative; }
.etape-hero .wp-block-image { margin: 0; }
.etape-hero__media .wp-element-caption {
  position: absolute; right: 10px; bottom: 18px; max-width: 170px; margin: 0; text-align: right;
  font-family: var(--f-main); font-size: 20px; line-height: 22px; color: var(--encre-douce);
  padding: 4px 8px; border-radius: 10px; background: rgba(251, 239, 227, .88);
}
/* Icône de lieu du badge (le texte reste éditable) */
.badge-lieu::before {
  content: ""; flex: 0 0 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Mobile : un seul chapô dans la page, affiché sous l'illustration comme dans la maquette */
@media (max-width: 959px) {
  .etape-hero__txt { display: contents; }
  /* position: relative garde titre et badge au-dessus du motif d'îlots (le conteneur est aplati) */
  .etape .etape-hero__txt > * { position: relative; margin: 0 var(--gutter); }
  .etape-hero .disque-titre { order: 1; margin-top: 32px; }
  .etape-hero .badge-lieu { order: 2; margin-top: 18px; }
  .etape-hero__media { order: 3; }
  .etape-hero .chapo { order: 4; display: block; margin-top: 32px; font-size: 17px; line-height: 27px; }
}
@media (min-width: 960px) { .etape-hero::before { display: none; } }

/* ---------- Bandeau occitan ---------- */
.occitan__nom::before { content: ""; flex: 0 0 28px; height: 28px; background: url(../img/croix-occitane.svg) center / contain no-repeat; }
@media (min-width: 960px) { .occitan__nom::before { flex-basis: 34px; height: 34px; } }

/* ---------- Composants d'étape en blocs natifs ---------- */
/* Chapô avec source (étape 3) : la source est en italique dans le même paragraphe */
.chapo em { display: block; margin-top: 6px; font-size: 13px; line-height: 18px; color: var(--encre-douce); font-style: normal; }
.legende--hero { margin-top: 8px; }

/* Notes : troisième ligne explicative */
.note > p:last-child:not(.main):not(.etiquette) { font-size: 14px; line-height: 20px; color: var(--encre-douce); }

/* Fiches : l'image est un bloc Image */
.fiche .wp-block-image { margin: 0; }
.fiche .fiche__img img { width: 100%; height: 100%; }
@media (min-width: 960px) {
  .occitan--long .fiche .fiche__img img { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
}

/* Duo image + texte */
.duo__media.wp-block-image { margin: 0; }
.duo__media .wp-element-caption { margin: 8px 0 0; font-size: 14px; line-height: 20px; color: var(--encre-douce); background: var(--creme); }
.illu.wp-block-image img { border-radius: 0; }

/* Citation sur feuillet : bloc Citation */
.citation-feuillet.wp-block-quote { margin: 0 var(--gutter); border: 0; }
.citation-feuillet.wp-block-quote p { font-family: var(--f-main); font-size: 23px; line-height: 28px; color: var(--bleu); }
.citation-feuillet.wp-block-quote p::before { content: "« "; }
.citation-feuillet.wp-block-quote p::after { content: " »"; }
.citation-feuillet.wp-block-quote cite { font-size: 14px; line-height: 20px; color: var(--encre-douce); font-style: normal; }
@media (min-width: 960px) {
  .citation-feuillet.wp-block-quote { margin: 0; }
  .citation-feuillet.wp-block-quote p { font-size: 26px; line-height: 32px; }
}

/* Page de carnet : bloc Image avec légende */
.carnet.wp-block-image { margin: 0 var(--gutter); }
.carnet .wp-element-caption { margin: 0; font-family: var(--f-main); text-align: left; }
@media (min-width: 960px) { .carnet.wp-block-image { margin: 0; display: flex; } }

/* Ligne de temps : liste numérotée, date en gras */
.quinconce.wp-block-list li { font-family: var(--f-main); font-size: 20px; line-height: 24px; color: var(--encre-douce); }
.quinconce.wp-block-list li > strong:first-child {
  align-self: flex-start; padding: 0 6px; border-radius: var(--r-pill); font-weight: 700;
  background: linear-gradient(transparent 55%, var(--turquoise) 55%);
  font-size: 32px; line-height: 34px; color: var(--bleu);
}
@media (min-width: 640px) {
  .quinconce.wp-block-list li:nth-child(odd) > strong:first-child { align-self: flex-end; }
  .quinconce.wp-block-list li { max-width: none; }
}
@media (min-width: 960px) {
  .quinconce.wp-block-list li { font-size: 21px; line-height: 25px; }
  .quinconce.wp-block-list li > strong:first-child { font-size: 36px; line-height: 38px; padding: 0 8px; }
}

/* Les deux éléments d'une bastide : numéro par compteur CSS */
.elements.wp-block-list { counter-reset: element; }
/* En bloc : le texte en gras reste dans la phrase (pas d'élément flex séparé) */
.elements.wp-block-list li { counter-increment: element; display: block; position: relative; padding-left: 66px; min-height: 68px; }
.elements.wp-block-list li::before {
  content: counter(element); position: absolute; left: 16px; top: 16px; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  background: var(--bleu); color: var(--sur-bleu); font-family: var(--f-titre); font-size: 18px;
}

/* Grand chiffre (coudée) */
.mesure > p { margin: 0; }

/* Portraits */
.portraits .wp-block-image { margin: 0; background: #fff; border-radius: 20px; overflow: hidden; aspect-ratio: 1; padding: 12px; }
.portraits .wp-block-image img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }

/* Frères Guérin de Bouscal */
.bouscal .wp-block-group > * { margin: 0; }

/* Carte à points (étape 5) : positions en classes, numéros éditables */
.carte-points .wp-block-image { margin: 0; }
.carte-points p.pin {
  position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; display: grid; place-items: center;
  border-radius: var(--r-pill); background: var(--rouge-gorge); color: var(--encre);
  font-size: 14px; font-weight: 600; box-shadow: 0 2px 6px rgba(31, 26, 26, .25);
}
.pin--lieu-1 { left: 31%; top: 50%; }
.pin--lieu-2 { left: 33%; top: 29%; }
.pin--lieu-3 { left: 65%; top: 51%; }
.pin--lieu-4 { left: 59%; top: 61%; }
.pin--lieu-5 { left: 66%; top: 73%; }
.pin--lieu-6 { left: 46%; top: 73%; }
.legende-points.wp-block-list { counter-reset: lieu; }
.legende-points.wp-block-list li { counter-increment: lieu; }
.legende-points.wp-block-list li::before {
  content: counter(lieu); flex: 0 0 26px; height: 26px; border-radius: var(--r-pill); background: var(--rouge-gorge);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

/* Bouton d'appel dans l'introduction du jeu (étape 1) */
.quiz--intro .wp-block-buttons { margin-top: 4px; }

/* ---------- Accueil ---------- */
/* #contenu : doit l'emporter sur la marge entre blocs que WordPress ajoute (:root :where(.is-layout-flow) > *) */
#contenu :where(.hero, .jeu, .parcours, .frise, .infos, .jeu-page) :where(.wp-block-group, .wp-block-buttons) > * { margin-block: 0; }
.hero::before {
  content: ""; position: absolute; right: -40px; top: -18px; width: 220px; height: 200px; pointer-events: none; transform: rotate(-18deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38' height='30'%3E%3Crect width='32' height='24' rx='5' fill='%23b47d86'/%3E%3C/svg%3E");
}
.hero::after {
  content: ""; position: absolute; left: -60px; top: 150px; width: 520px; height: 420px; background: var(--sable); pointer-events: none;
  border-radius: 48% 52% 40% 60% / 30% 34% 66% 70%;
}
.hero > * { position: relative; z-index: 1; }
@media (min-width: 960px) {
  .hero::before { right: -80px; top: -60px; width: 420px; height: 360px; }
  .hero::after { left: -120px; top: 220px; width: 900px; height: 520px; border-radius: 48% 52% 40% 60% / 34% 40% 60% 66%; }
}
.hero__ctas.wp-block-buttons { display: flex; flex-direction: column; gap: 10px; }
.hero__ctas .wp-block-button__link { width: 100%; }
@media (min-width: 960px) {
  .hero__ctas.wp-block-buttons { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .hero__ctas .wp-block-button__link { width: auto; min-height: 54px; padding: 0 26px; }
}
.btn-fleche .wp-block-button__link::after { content: "→"; font-size: 18px; }
.chiffres > .wp-block-group > p { margin: 0; }

/* Bouton encre et pierrots en blocs Image */
.is-style-encre .wp-block-button__link { background: var(--encre); color: var(--creme); min-height: 48px; }
.is-style-encre .wp-block-button__link:hover { background: #000; color: var(--creme); }
.pierrot-bulle > .wp-block-image { flex: 0 0 auto; width: 112px; margin: 0; }
.pierrot-bulle > .wp-block-image img { width: 100%; height: auto; }
.jeu__pierrot.wp-block-image { margin: 0; }
.jeu__pierrot img { width: 100%; height: auto; }
@media (min-width: 960px) { .jeu__pierrot.wp-block-image { margin: -70px 0 -40px; } }
.jeu__lettres .wp-block-buttons { align-self: flex-start; }

.parcours__tete > p { margin: 0; }
.frise__occitan::before { content: ""; width: 30px; height: 30px; background: url(../img/croix-occitane.svg) center / contain no-repeat; }

/* ---------- Page du jeu ---------- */
.jeu-page::before { content: ""; position: absolute; left: -80px; right: -80px; bottom: -120px; height: 520px; background: var(--creme); border-radius: 50% 50% 0 0 / 34% 40% 0 0; }
.jeu-page__compte { font-size: 16px; line-height: 25px; margin-top: -14px !important; }
@media (min-width: 960px) { .jeu-page__compte { font-size: 19px; line-height: 30px; } }
.jeu-page__prochaines { margin-top: auto; display: flex; flex-direction: column; gap: 16px; }
.jeu-page__prochaines > div:not([hidden]), .jeu-complet.is-visible { display: flex; flex-direction: column; gap: 16px; }
.jeu-page__prochaines .bulle, .jeu-complet .bulle { margin-bottom: 70px; }
.jeu-page__prochaines .pierrot-bulle > img { width: 130px; }
.jeu-complet { display: none; }
.jeu-page__bas { margin-top: 0; }
.jeu-page__bas .wp-block-button__link, .jeu-page__prochaines .btn { width: 100%; }
.jeu-page__reset.wp-block-buttons { justify-content: center; }
.jeu-page__reset .wp-block-button__link { width: auto !important; min-height: 44px; padding: 0 12px; background: none; color: var(--encre-douce); text-decoration: underline; font-size: 14px; font-weight: 400; }
.jeu-page__reset .wp-block-button__link:hover { background: none; color: var(--encre); }
@media (min-width: 960px) {
  .jeu-page__bas .wp-block-button__link, .jeu-page__prochaines .btn { width: auto; align-self: flex-start; }
  .jeu-page__prochaines .pierrot-bulle > img, .jeu-complet .pierrot-bulle > .wp-block-image { width: 170px; }
}

/* ---------- Mentions légales ---------- */
.legal .wp-block-post-content > * + * { margin-block-start: 28px; }
.legal section > * { margin: 0; }

/* ---------- Onglets des époques (bloc Boutons + groupes) ---------- */
.onglets.wp-block-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 24px; background: var(--sable); }
.onglets .wp-block-button { width: 100%; }
/* En bloc (pas en flex) : un exposant « XVe » ne doit pas devenir un élément séparé */
.onglets .wp-block-button__link {
  display: block; width: 100%; min-height: 44px; text-align: center; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--encre);
  font-family: var(--f-texte); font-size: 14px; font-weight: 600; padding: 13px 10px; line-height: 1.15; cursor: pointer;
}
.onglets .wp-block-button__link:hover { background: rgba(255, 255, 255, .5); color: var(--encre); }
.onglets .wp-block-button__link[aria-selected="true"] { background: var(--bleu); color: var(--sur-bleu); }
.epoque .wp-block-image { margin: 0; }
@media (min-width: 960px) {
  .onglets.wp-block-buttons { display: flex; flex-direction: column; gap: 6px; padding: 0; background: none; border-radius: 0; }
  .onglets .wp-block-button__link { min-height: 50px; padding: 15px 18px; font-size: 16px; line-height: 20px; background: var(--sable); text-align: left; }
  .onglets .wp-block-button__link::after { content: "→"; float: right; }
}

/* ---------- Question de Pierrot ----------
   Les réponses sont des boutons natifs ; la bonne porte le style
   « Bonne réponse » ; la lettre est le premier texte en gras (la pastille). */
.quiz__pierrot .wp-block-image { margin: 0; flex: 0 0 auto; }
.reponses.wp-block-buttons { display: flex; flex-direction: column; gap: 10px; }
.reponses .wp-block-button { width: 100%; }
.reponses .wp-block-button__link {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 56px; padding: 6px 14px 6px 6px;
  border: 2px solid transparent; border-radius: var(--r-pill); background: var(--papier); color: var(--encre);
  font-family: var(--f-texte); font-size: 16px; font-weight: 400; line-height: 20px; text-align: left; cursor: pointer;
}
.reponses .wp-block-button__link:hover { border-color: var(--trait); background: var(--papier); color: var(--encre); }
.reponses .wp-block-button__link > strong:first-child {
  flex: 0 0 44px; height: 44px; border-radius: var(--r-pill); background: var(--mauve);
  display: grid; place-items: center; font-weight: 600; font-size: 15px; color: var(--encre);
}
.reponses .wp-block-button__link.is-juste { border-color: var(--bleu); }
.reponses .wp-block-button__link.is-juste > strong:first-child { background: var(--rouge-gorge); }
.reponses .wp-block-button__link.is-faux { opacity: .55; text-decoration: line-through; }
.quiz__bravo, .quiz__rate { display: none; }
.quiz__bravo.is-visible { display: flex; }
.quiz__rate.is-visible { display: block; }
.quiz__bravo > * { margin: 0; }
.quiz__bravo .lettre-gagnee:empty { display: none; }
@media (min-width: 960px) {
  .reponses.wp-block-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
  .reponses .wp-block-button__link { min-height: 64px; padding: 8px 16px 8px 8px; }
  .reponses .wp-block-button__link > strong:first-child { flex-basis: 46px; height: 46px; }
}

/* ---------- Styles de groupe ---------- */
.wp-block-group.is-style-saistu { margin: 0 var(--gutter); padding: 24px 26px; background: var(--sable); border-radius: 46% 54% 40% 60% / 22% 26% 74% 78%; }
.wp-block-group.is-style-saistu p { font-family: var(--f-main); font-size: 21px; line-height: 25px; }
.wp-block-group.is-style-feuillet { background: var(--papier); border-radius: var(--r-lg); box-shadow: var(--ombre-feuillet); padding: 26px 22px; }
.wp-block-group.is-style-encart { padding: 22px 20px; border-radius: 28px; background: var(--sable); }
.wp-block-group.is-style-occitan { position: relative; padding: 30px var(--gutter) 34px; background: var(--sable); border-radius: 40% 60% 46% 54% / 4% 3% 5% 4%; }
.is-style-manuscrit { font-family: var(--f-main); font-size: 22px; line-height: 26px; }
@media (min-width: 960px) {
  .wp-block-group.is-style-saistu { margin: 0; padding: 32px 44px; max-width: 640px; }
  .wp-block-group.is-style-saistu p { font-size: 23px; line-height: 27px; }
  .wp-block-group.is-style-feuillet { padding: 36px 40px; transform: rotate(-1deg); }
  .wp-block-group.is-style-encart { padding: 32px; background: var(--papier); }
  .wp-block-group.is-style-occitan { padding: 36px 40px; border-radius: 46% 54% 40% 60% / 18% 22% 78% 82%; }
}
