/*
=====================================
 Feuille de styles DDQ - Démocratie Directe Québec
 (Styles personnalisés, tout le reste via Tailwind)
=====================================
 Ce fichier ne conserve que :
 - Les resets de base non couverts par Tailwind Preflight
 - Les animations complexes (ex : slogan animé)
 - Les styles de pseudo-éléments spécifiques (ex : soulignement de titre)
 - Les motifs de fond personnalisés (ex : fleur de lys)
 - Les ajustements précis pour les conteneurs de graphiques
 - Quelques exemples pour composants réutilisables

 Toute la mise en page, la couleur, la typographie, l'espacement, etc. doivent être gérés par les classes utilitaires Tailwind directement dans le HTML.
=====================================
*/

/* Variables de couleurs principales (à idéalement placer dans tailwind.config.js) */
:root {
    --quebec-blue: #0055A4;
    --quebec-light-blue: #00B3F1;
    --quebec-dark-blue: #283881;
    --quebec-white: #ffffff;
    --quebec-gray: #f5f5f5; /* Base background */
    --quebec-dark-gray: #555555; /* Base text color */
}

/* Réinitialisation de base (reset) */
* {
    -webkit-font-smoothing: antialiased; /* Lissage police (optionnel) */
    -moz-osx-font-smoothing: grayscale; /* Lissage police (optionnel) */
    box-sizing: border-box; /* Géré aussi par Tailwind Preflight */
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; /* Empêche le scroll horizontal */
}

/* --- Styles conservés car difficiles à faire uniquement avec Tailwind --- */


/* Empêche la barre de navigation de masquer les sous-menus déroulants */
nav {
    overflow: visible !important;
}

/* Étend la zone de survol pour éviter les décrochages entre bouton et sous-menu */
.relative.group {
    padding-bottom: 12px;  /* Provide buffer under button */
}

/* Permet aux sous-menus de dépasser du conteneur nav si besoin */
nav, .nav-container {
    overflow: visible !important;
}

@media (max-width: 767px) {
  #menu-close {
    display: block !important;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #0055A4;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    z-index: 100000;
    cursor: pointer;
  }
}

/* Motif de fond fleur de lys (arrière-plan décoratif personnalisé) */
.fleur-de-lys-bg {
    background-color: var(--quebec-gray); /* Fallback color */
    /* Updated SVG with fill attribute for better control if needed */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="%230055A4" opacity="0.05"><text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-size="24">⚜</text></svg>');
    background-repeat: repeat;
}

/* Animation complexe pour le slogan animé (voir index.html) */
.animated-slogan {
    position: relative;
    /* Hauteur/largeur/max-width à gérer avec Tailwind dans le HTML */
    overflow: hidden;
}

.slogan-text {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    /* line-height doit correspondre à la hauteur du parent (à régler dans le HTML avec Tailwind) */
    text-align: center;
    /* État initial avant l’animation */
    transform: translateX(100%);
    animation: slogan-slide 25s infinite linear; /* Linear pour une boucle continue fluide */
    opacity: 0;
    white-space: nowrap; /* Empêche le retour à la ligne pendant l’animation */
}

/* Décale le démarrage de chaque texte pour l’effet d’enchaînement */
.slogan-text:nth-child(1) { animation-delay: 0s; }
.slogan-text:nth-child(2) { animation-delay: 5s; }
.slogan-text:nth-child(3) { animation-delay: 10s; }
.slogan-text:nth-child(4) { animation-delay: 15s; }
.slogan-text:nth-child(5) { animation-delay: 20s; }

@keyframes slogan-slide {
    0% { transform: translateX(100%); opacity: 0; } /* Débute hors écran à droite */
    2% { transform: translateX(0); opacity: 1; }    /* Arrive à l’écran */
    18% { transform: translateX(0); opacity: 1; }   /* Reste visible */
    20% { transform: translateX(-100%); opacity: 0;} /* Sort à gauche */
    100% { transform: translateX(-100%); opacity: 0;}/* Reste hors écran à gauche */
}

/* Style spécifique pour l’intro du logo (utilisé sur index.html) */
.logo-intro {
    font-size: 6rem; /* Plus grand que la plupart des utilitaires Tailwind */
    display: inline-block; /* Peut aussi être géré par flex/grid dans le HTML */
    color: var(--quebec-blue); /* Peut être remplacé par text-quebec-blue de Tailwind */
    margin-bottom: 1rem; /* Peut être remplacé par mb-4 de Tailwind */
    line-height: 1; /* Pour un interlignage serré */
}
@media (max-width: 600px) {
    .logo-intro {
        font-size: 3.5rem; /* Tailwind: text-4xl sm:text-6xl */
    }
}

/* Conteneur de graphique : gère la taille et la réactivité du canvas (complément à Tailwind) */
.chart-container {
    position: relative;
    margin: auto;
    /* Exemples de hauteur : privilégier les utilitaires h-64, h-56, etc. dans le HTML avec Tailwind */
    /* height: 250px; */ /* Exemple, à activer si besoin */
    min-height: 180px; /* Hauteur minimale pour éviter que le graphique soit trop petit */
    max-height: 350px; /* Hauteur maximale si besoin */
    width: 100%;
    overflow: hidden; /* Évite que le graphique déborde du conteneur */
}
/* Le canvas du graphique doit bien se redimensionner dans son conteneur */
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}
/* Classe spécifique pour la hauteur des graphiques de la page Énergie */
.chart-energie {
    max-width: 400px; /* Peut être remplacé par max-w-md de Tailwind */
    max-height: 260px; /* Peut être remplacé par max-h-[260px] de Tailwind */
    width: 100%; /* Peut être remplacé par w-full de Tailwind */
    height: 220px; /* Peut être remplacé par h-56 de Tailwind */
    margin: 0 auto 1.5rem auto; /* Peut être remplacé par mx-auto mb-6 de Tailwind */
    display: block; /* Peut être remplacé par block de Tailwind */
}


/* Soulignement personnalisé pour les titres de section (peut aussi se faire via Tailwind config) */
/* À appliquer sur <h2 class="section-title"> */
.section-title {
    position: relative;
    display: inline-block; /* Le soulignement ne prend que la largeur du texte */
    padding-bottom: 0.5rem; /* Laisse la place pour le trait */
    /* margin-bottom à gérer avec Tailwind */
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0; /* Position at the bottom of the padding */
    left: 0;
    width: 60%; /* Ajuster selon le rendu souhaité */
    height: 3px;
    background-color: var(--quebec-light-blue);
    /* Pour centrer le trait, décommentez si besoin : */
    /* left: 50%; */
    /* transform: translateX(-50%); */
}

/* Styles spécifiques pour des composants réutilisables non faisables uniquement avec Tailwind */
/* Exemple : .btn-quebec (gardé à titre de démonstration, à remplacer si possible) */
.btn-quebec {
    display: inline-flex; /* Use flex for icon alignment */
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem; /* Tailwind: py-3 px-6 */
    border-radius: 6px; /* Tailwind: rounded-md */
    font-weight: 600; /* Tailwind: font-semibold */
    color: var(--quebec-white); /* Tailwind: text-white */
    background-color: var(--quebec-blue); /* Tailwind: bg-quebec-blue */
    transition: all 0.3s ease;
    border: none;
    text-align: center;
    cursor: pointer;
}

.btn-quebec:hover {
    background-color: var(--quebec-dark-blue); /* Tailwind: hover:bg-quebec-dark-blue */
    transform: scale(1.05); /* Tailwind: hover:scale-105 */
}

/* Specific table styling if needed beyond basic Tailwind */
/* Example for tables used across multiple pages */
.quebec-table {
    width: 100%; /* Tailwind: w-full */
    border-collapse: collapse; /* Tailwind: border-collapse */
    margin-bottom: 1rem; /* Tailwind: mb-4 */
}

.quebec-table th,
.quebec-table td {
    border: 1px solid #e2e8f0; /* Tailwind: border border-gray-200 */
    padding: 0.5rem 1rem; /* Tailwind: py-2 px-4 */
    text-align: left; /* Tailwind: text-left */
}

.quebec-table thead th {
    background-color: #f8fafc; /* Tailwind: bg-gray-50 */
    font-weight: 600; /* Tailwind: font-semibold */
    color: var(--quebec-blue); /* Tailwind: text-quebec-blue */
}
/* Header styling specific to some tables */
.table-header {
     background-color: var(--quebec-blue); /* Tailwind: bg-quebec-blue */
     color: var(--quebec-white); /* Tailwind: text-white */
}
.table-header th {
    color: var(--quebec-white); /* Ensure text color overrides base */
}

.table-row:nth-child(even) {
     background-color: #f8fafc; /* Tailwind: even:bg-gray-50 */
}

/* Bullet point styling for specific lists */
.bullet-point::before {
    content: "•";
    color: var(--quebec-blue); /* Or appropriate color */
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}
/* Usage: Add class="bullet-point" to <li> elements */
.custom-list li::before {
    content: "✓"; /* Or any other symbol */
    color: var(--quebec-blue);
    font-weight: bold;
    display: inline-block;
    width: 1.2em;
    margin-left: -1.2em;
}
/* Usage: Add class="custom-list" to <ul> or <ol> */

/* Timeline specific styles (from securite.html / exportation.html) */
.timeline {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 6px;
    background-color: var(--quebec-light-blue);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -3px;
}
.timeline-container {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
}
.timeline-container.left { left: 0; }
.timeline-container.right { left: 50%; }
.timeline-container::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    right: -17px;
    background-color: white;
    border: 4px solid var(--quebec-blue);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}
.timeline-container.right::after { left: -16px; }
.timeline-content {
    padding: 20px 30px;
    background-color: white;
    position: relative;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}
@media screen and (max-width: 768px) {
    .timeline::after { left: 31px; }
    .timeline-container { width: 100%; padding-left: 70px; padding-right: 25px; }
    .timeline-container.left::after, .timeline-container.right::after { left: 15px; }
    .timeline-container.right { left: 0%; }
}

/* Progress Bar styles (exportation.html) */
.progress-container {
    width: 100%;
    background-color: #e5e7eb; /* Tailwind: bg-gray-200 */
    border-radius: 9999px; /* Tailwind: rounded-full */
    height: 1rem; /* Tailwind: h-4 */
    overflow: hidden;
    position: relative;
}
.progress-bar {
    height: 100%;
    background-color: var(--quebec-blue); /* Tailwind: bg-quebec-blue */
    border-radius: 9999px; /* Tailwind: rounded-full */
    transition: width 0.5s ease-in-out;
    position: relative;
}
.progress-bar.gold {
    background-color: #FFD700; /* Example gold color */
}

/* Star Rating (exportation.html) */
.star-rating {
    color: #FFD700; /* Gold color */
    font-size: 1.1rem;
}

/* =============================================
   ANIMATIONS & EFFETS VISUELS DDQ
   ============================================= */

/* --- Scroll Reveal --- */
.reveal, .reveal-left, .reveal-right {
    transition: opacity 0.75s cubic-bezier(0.22,1,0.36,1), transform 0.75s cubic-bezier(0.22,1,0.36,1);
}
.reveal          { opacity: 0; transform: translateY(44px); }
.reveal-left     { opacity: 0; transform: translateX(-50px); }
.reveal-right    { opacity: 0; transform: translateX(50px); }
.reveal.visible,
.reveal-left.visible,
.reveal-right.visible { opacity: 1; transform: none; }

.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.18s; }
.reveal-delay-3 { transition-delay: 0.28s; }
.reveal-delay-4 { transition-delay: 0.38s; }
.reveal-delay-5 { transition-delay: 0.48s; }

/* --- Pulsing CTA --- */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,85,164,0.45); }
    50%       { box-shadow: 0 0 0 14px rgba(0,85,164,0); }
}
.pulse-cta { animation: pulse-glow 2.2s infinite; }

/* --- Card shine on hover --- */
.card-shine { position: relative; overflow: hidden; }
.card-shine::before {
    content: '';
    position: absolute;
    top: -100%; left: -70%;
    width: 45%; height: 300%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.5), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}
.card-shine:hover::before { animation: card-sweep 0.55s ease forwards; }
@keyframes card-sweep { 0% { left: -70%; } 100% { left: 130%; } }

/* --- Animated counter --- */
.stat-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* --- Floating fleur-de-lys in header --- */
@keyframes floatUp {
    0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 0; }
    10%  { opacity: 0.55; }
    85%  { opacity: 0.25; }
    100% { transform: translateY(-110px) rotate(25deg) scale(0.65); opacity: 0; }
}
.lis-particle {
    position: absolute;
    pointer-events: none;
    color: rgba(255,255,255,0.35);
    animation: floatUp ease-in-out infinite;
    z-index: 0;
}

/* --- Hero gradient animation --- */
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%       { background-position: 100% 50%; }
}
.hero-animated-bg {
    background: linear-gradient(135deg, #0055A4, #283881, #00B3F1, #0055A4);
    background-size: 300% 300%;
    animation: gradientShift 9s ease infinite;
}

/* --- Sparkle burst on click --- */
.ddq-spark {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: transform 0.55s ease-out, opacity 0.55s ease-out;
}

/* --- New project card badge --- */
.badge-new {
    display: inline-block;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    color: #1a1a1a;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 6px;
    animation: badge-pulse 1.8s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.08); }
}

/* --- Placeholder Form Styles (Tailwind-like) --- */
/* Style these further or use @tailwindcss/forms plugin */

.form-group {
    margin-bottom: 1rem; /* Equivalent to mb-4 */
}

.form-label {
    display: block;
    margin-bottom: 0.5rem; /* Equivalent to mb-2 */
    font-weight: 500; /* Equivalent to font-medium */
    color: var(--quebec-dark-gray);
}

.form-input,
.form-textarea,
.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem; /* Equivalent to px-3 py-2 */
    font-size: 1rem; /* Equivalent to text-base */
    line-height: 1.5; /* Equivalent to leading-normal */
    color: var(--quebec-dark-gray);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da; /* Gray border */
    border-radius: 0.25rem; /* Equivalent to rounded */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none; /* Remove default OS styling */
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    color: var(--quebec-dark-gray);
    background-color: #fff;
    border-color: var(--quebec-light-blue); /* Highlight border on focus */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 179, 241, 0.25); /* Focus ring */
}

.form-textarea {
    min-height: 80px; /* Example height */
    resize: vertical; /* Allow vertical resize */
}

.form-select {
     background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
     background-repeat: no-repeat;
     background-position: right 0.75rem center;
     background-size: 16px 12px;
     padding-right: 2.5rem; /* Make space for arrow */
}

/* ============================================================
   DDQ — Accessibilité, PWA, recherche, partage, progression
   ============================================================ */

/* Skip-link : visible uniquement au focus clavier */
.ddq-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    background: #0055A4;
    color: #fff;
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 6px 0;
}
.ddq-skip-link:focus {
    left: 0;
    outline: 3px solid #00B3F1;
    outline-offset: 2px;
}

/* Focus-visible global cohérent (clavier uniquement) */
:focus-visible {
    outline: 2px solid #00B3F1;
    outline-offset: 2px;
    border-radius: 3px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* Indicateur de progression de lecture */
#ddq-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #0055A4 0%, #00B3F1 100%);
    z-index: 9999;
    opacity: 0;
    transition: width 0.1s linear, opacity 0.2s ease;
    pointer-events: none;
}

/* Contraste renforcé : remplacer les gris trop clairs */
.text-gray-500 { color: #4b5563 !important; } /* aa */
.text-gray-600 { color: #374151 !important; }

/* Boutons de partage social (templates/social-share.php) */
.ddq-social-share {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-left: 4px solid #0055A4;
    border-radius: 6px;
}
.ddq-social-share-label {
    font-weight: 600;
    color: #0055A4;
    margin-right: 0.5rem;
}
.ddq-social-share a,
.ddq-social-share button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.ddq-social-share a:hover,
.ddq-social-share button:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

/* Liste de résultats de recherche : option active au focus */
#ddq-search-results li a:focus {
    background: rgba(0, 179, 241, 0.1);
    outline: none;
}

/* Réduction d'animations si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}