/*
Theme Name: CGRET
Description: Un thème from scratch pour CGRET !
Requires at least: WordPress 5.0
Version: 1.0
*/

/* Styles d'impression : Masquage des éléments d'action et gestion des sauts de page */
@page {
  size: portrait;
  margin: 0.8cm;
}

@page print-list-landscape {
  size: landscape;
  margin: 0.8cm;
}

body.print-list-only {
  page: print-list-landscape;
}

@media print {
  /* Réduction des marges globales du conteneur à l'impression */
  .container,
  article,
  .activity-details-panel,
  .activity-registrations-panel,
  .tab-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Réduction globale de la taille du texte à l'impression */
  html, body {
    font-size: 10.5pt !important;
    line-height: 1.35 !important;
  }

  /* Titres réduits à l'impression */
  h1, h1.wp-block-heading, .h1, :where(.activite) h1.wp-block-heading {
    font-size: 18pt !important;
    line-height: 1.2 !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  h2, h2.wp-block-heading, .h2, :where(.activite) :where(h2.wp-block-heading) {
    font-size: 14pt !important;
    line-height: 1.25 !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.35rem !important;
  }

  h3, h3.wp-block-heading, .h3 {
    font-size: 12pt !important;
    line-height: 1.3 !important;
    margin-top: 0.35rem !important;
    margin-bottom: 0.25rem !important;
  }

  h4, h5, h6 {
    font-size: 11pt !important;
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
  }

  .activity-header {
    padding-top: 0 !important;
  }

  .activity-header .date {
    font-size: 11pt !important;
  }

  /* Réduction de la taille de police du chapeau/résumé (excerpt) à l'impression */
  .activity-summary,
  .activity-summary *,
  .post__excerpt,
  .entry-summary {
    font-size: 11pt !important;
    line-height: 1.35 !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
  }

  /* Réduction de la taille des images à l'impression */
  img, figure img, .wp-block-image img, .post__content img {
    max-height: 200px !important;
    width: auto !important;
    object-fit: contain !important;
  }

  /* Réduction de l'image bannière/hero d'activité */
  .activity-hero-image .grid,
  .activity-hero-image .h-\[300px\],
  .activity-hero-image > div {
    height: 150px !important;
  }

  .no-print,
  .wp-block-group:has(.registration-shortcode-wrapper),
  .wp-block-group:has(.no-print),
  button,
  .btn,
  a.btn,
  .join,
  details.dropdown,
  dialog.modal {
    display: none !important;
  }
  .cgret-trombinoscope .grid > *,
  .cgret-trombinoscope a,
  .cgret-trombinoscope .card,
  tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* Protection globale PEQ : annule tout texte blanc hérité d'un bloc parent (ex: .bg-cgret-dark-green) */
.registration-shortcode-wrapper,
.registration-shortcode-wrapper p,
.registration-shortcode-wrapper li,
.registration-shortcode-wrapper td,
.registration-shortcode-wrapper th,
.registration-shortcode-wrapper label,
.registration-shortcode-wrapper span:not(.btn):not(.badge):not(.text-green-600):not(.text-red-600):not(.text-orange-600),
#peq-container,
#peq-container p,
#peq-container li,
#peq-container td,
#peq-container th,
#peq-container label,
#peq-container span:not(.btn):not(.badge):not(.text-green-600):not(.text-red-600):not(.text-orange-600),
div.tarifs,
div.tarifs p,
div.tarifs li,
div.tarifs td,
div.tarifs th,
div.tarifs label,
div.tarifs span:not(.btn):not(.badge):not(.text-green-600):not(.text-red-600):not(.text-orange-600) {
  color: var(--color-base-content-var, #2d3748) !important;
}

.registration-shortcode-wrapper strong,
.registration-shortcode-wrapper b,
#peq-container strong,
#peq-container b,
div.tarifs strong,
div.tarifs b {
  color: #111827 !important;
}

.registration-shortcode-wrapper a:not(.btn),
#peq-container a:not(.btn),
div.tarifs a:not(.btn) {
  color: #1d4ed8 !important;
}

.explanation p {
  color: #374151 !important;
}

/* Protection des dialogues et modals (ex: modal de confirmation d'inscription PEQ) */
dialog,
.modal,
.modal-box,
.modal-box :is(h1, h2, h3, h4, h5, h6, p, span, div, label, strong) {
  color: var(--color-base-content-var, #2d3748);
}

.modal-box :is(h1, h2, h3, h4, h5, h6) {
  color: #111827 !important;
}

.modal-box p {
  color: #374151 !important;
}

.modal-box #modal-payment-notice {
  color: #6b7280 !important;
}

/* Fonds clairs (Bleu Clair & Gris Clair) -> Titres en SOMBRE (Bleu CGRET) */
.bloc.has-background.has-cgret-light-blue-background-color :is(h1, h2, h3, h4, h5, h6),
.bloc.has-background.bg-cgret-light-blue :is(h1, h2, h3, h4, h5, h6),
.bloc.has-background.has-cgret-light-gray-background-color :is(h1, h2, h3, h4, h5, h6),
.bloc.has-background.bg-cgret-light-gray :is(h1, h2, h3, h4, h5, h6),
.editor-styles-wrapper :is(.has-cgret-light-blue-background-color, .has-cgret-light-gray-background-color, .bg-cgret-light-blue, .bg-cgret-light-gray) :is(h1, h2, h3, h4, h5, h6, .wp-block-heading),
:is(.has-cgret-light-blue-background-color, .has-cgret-light-gray-background-color, .bg-cgret-light-blue, .bg-cgret-light-gray) :is(h1, h2, h3, h4, h5, h6, .wp-block-heading) {
  color: var(--cgret-blue, #0072b2) !important;
}

/* Fonds foncés Gutenberg et Tailwind -> Textes et titres en BLANC (#ffffff) */
:is(
  .has-cgret-pink-background-color, .bg-cgret-pink,
  .has-cgret-blue-background-color, .bg-cgret-blue,
  .has-cgret-green-background-color, .bg-cgret-green,
  .has-cgret-dark-green-background-color, .bg-cgret-dark-green,
  .has-cgret-orange-background-color, .bg-cgret-orange
) :is(h1, h2, h3, h4, h5, h6, p, li, strong, .wp-block-heading):not(.modal-box *):not(.tarifs *):not(#peq-container *):not(.registration-shortcode-wrapper *):not(.explanation *) {
  color: #ffffff !important;
}

.editor-styles-wrapper :is(
  .has-cgret-pink-background-color, .bg-cgret-pink,
  .has-cgret-blue-background-color, .bg-cgret-blue,
  .has-cgret-green-background-color, .bg-cgret-green,
  .has-cgret-dark-green-background-color, .bg-cgret-dark-green,
  .has-cgret-orange-background-color, .bg-cgret-orange
) :is(h1, h2, h3, h4, h5, h6, p, li, strong, .wp-block-heading) {
  color: #ffffff !important;
}
