/*
  Analyse Énergie Québec - Infrastructures et Gouvernance
  Stylesheet
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap');

:root {
  --primary-color: #0A1F3B; /* Deep dark blue */
  --secondary-color: #4A6B8D; /* Muted blue */
  --accent-color: #8FAEC2; /* Soft institutional blue */
  --bg-color: #FFFFFF;
  --bg-alt-color: #F5F5F5;
  --text-color: #333333;
  --text-muted: #6c757d;
  --text-light: #FFFFFF;
  --border-color: #dee2e6;
  --font-family: 'Noto Sans', sans-serif;
  --header-height: 80px;
  --section-padding: clamp(4rem, 8vw, 6rem);
}

/* 1. Global Reset & Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); }
h2 { font-size: clamp(2rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
p { margin-bottom: 1.5rem; max-width: 75ch; }
a { color: var(--secondary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover, a:focus { color: var(--primary-color); text-decoration: underline; }
img, iframe { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: var(--section-padding) 0;
}

.section-alt {
  background-color: var(--bg-alt-color);
}

.text-center {
  text-align: center;
}
.text-center p {
    margin-left: auto;
    margin-right: auto;
}

/* 2. Header & Navigation */
.main-header {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.main-header.scrolled {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  flex-shrink: 0;
}
.logo:hover {
  text-decoration: none;
  color: var(--secondary-color);
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-weight: 400;
  font-size: 1rem;
  color: var(--primary-color);
  text-decoration: none;
  position: relative;
  padding: 0.5rem 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}
.nav-links a.active {
    font-weight: 700;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

.menu-toggle .hamburger {
  width: 25px;
  height: 2px;
  background: var(--primary-color);
  display: block;
  position: relative;
  transition: transform 0.3s ease;
}

.menu-toggle .hamburger::before,
.menu-toggle .hamburger::after {
  content: '';
  width: 25px;
  height: 2px;
  background: var(--primary-color);
  position: absolute;
  left: 0;
  transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
}

.menu-toggle .hamburger::before {
  top: -8px;
}

.menu-toggle .hamburger::after {
  bottom: -8px;
}

.menu-open .menu-toggle .hamburger {
    background: transparent;
}
.menu-open .menu-toggle .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}
.menu-open .menu-toggle .hamburger::after {
    transform: rotate(-45deg);
    bottom: 0;
}


/* 3. Hero Section */
.hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--text-light);
  background-size: cover;
  background-position: center;
  filter: grayscale(80%) sepia(20%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 31, 59, 0.9) 0%, rgba(10, 31, 59, 0.4) 60%, rgba(10, 31, 59, 0.1) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: var(--section-padding) 0;
}

.hero h1 {
  color: var(--text-light);
  max-width: 900px;
}
.hero p {
  color: var(--accent-color);
  font-size: 1.2rem;
  max-width: 70ch;
  margin-top: 1rem;
}


/* 4. Home Page Blocks */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.analysis-card {
  background-color: var(--bg-color);
  padding: 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.analysis-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--secondary-color);
}

.analysis-card h3 {
  margin-bottom: 1rem;
}

.analysis-card p {
  flex-grow: 1;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.analysis-card .card-link {
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

.analysis-card .card-link:hover {
  text-decoration: underline;
}

/* 5. Article Pages */
.article-content {
  max-width: 800px;
  margin: 0 auto;
}

.article-content p, .article-content li {
  font-size: 1.1rem;
  line-height: 1.8;
}

.article-content ul, .article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.article-content li {
    margin-bottom: 0.75rem;
}

.article-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--secondary-color);
}
.article-content .callout {
    background-color: var(--bg-alt-color);
    border-left: 5px solid var(--secondary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}
.callout p { margin-bottom: 0; }

/* 6. Diagram (secteurs-cles) */
.structural-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem 0;
    font-family: var(--font-family);
    text-align: center;
}

.diagram-level {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.diagram-box {
    background-color: var(--bg-alt-color);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    min-width: 250px;
}
.diagram-box strong {
    color: var(--primary-color);
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.diagram-box span { color: var(--text-muted); }

.diagram-connector {
    width: 2px;
    height: 40px;
    background-color: var(--accent-color);
}

/* 7. Contact Page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.contact-form .form-group {
  margin-bottom: 1.5rem;
}

.contact-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(74, 107, 141, 0.2);
}

.contact-form textarea {
  resize: vertical;
  min-height: 150px;
}

.btn-submit {
  display: inline-block;
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 0.9rem 2rem;
  border: none;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-size: 1rem;
}

.btn-submit:hover {
  background-color: var(--secondary-color);
  color: var(--text-light);
  text-decoration: none;
}

.contact-info-block {
    background: var(--bg-alt-color);
    padding: 2.5rem;
    border-radius: 8px;
}
.contact-info-block h3 { margin-top: 0; }
.contact-info-block p { font-size: 1rem; margin-bottom: 1rem;}
.contact-info-block p strong { display: block; color: var(--primary-color); }
.contact-info-block a { word-break: break-all; }

.form-warning {
    background-color: #fff9e6;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* 8. Map */
.map-container {
  width: 100%;
  height: 450px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-top: 3rem;
}

.map-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}
/* 9. Footer */
.main-footer {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 4rem 0 2rem;
}
.main-footer a { color: var(--accent-color); }
.main-footer a:hover { color: var(--text-light); }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  border-bottom: 1px solid var(--secondary-color);
  padding-bottom: 3rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

.footer-col p, .footer-col ul {
  font-size: 0.95rem;
  color: var(--accent-color);
  margin-bottom: 0;
}
.footer-col ul {
  list-style-type: none;
}
.footer-col li {
  margin-bottom: 0.75rem;
}

.footer-bottom {
  text-align: center;
  font-size: 0.9rem;
  color: var(--accent-color);
}
.footer-bottom p {
  margin-bottom: 0;
}

/* 10. Cookie Banner */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(10, 31, 59, 0.95);
  color: var(--text-light);
  padding: 1.5rem;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  backdrop-filter: blur(5px);
}

#cookie-banner-text {
  max-width: 600px;
  font-size: 0.9rem;
}
#cookie-banner-text a {
    color: var(--accent-color);
    text-decoration: underline;
}

.cookie-buttons {
  display: flex;
  gap: 1rem;
}
.cookie-btn {
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}
#accept-cookies {
    background-color: var(--accent-color);
    color: var(--primary-color);
}
#accept-cookies:hover {
    background-color: #fff;
}

#decline-cookies {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}
#decline-cookies:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

/* 11. Thank You & 404 Pages */
.fullscreen-section {
    min-height: calc(80vh - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.fullscreen-section .icon {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}
.fullscreen-section .icon svg {
    width: 40px;
    height: 40px;
    color: white;
}
.fullscreen-section h1 { font-size: clamp(2.5rem, 6vw, 4rem); }
.fullscreen-section p { font-size: 1.2rem; color: var(--text-muted); max-width: 60ch; }
.btn-home {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 0.9rem 2rem;
    border-radius: 5px;
    font-weight: 700;
    transition: background-color 0.3s ease;
    margin-top: 1rem;
}
.btn-home:hover {
    background-color: var(--secondary-color);
    color: var(--text-light);
    text-decoration: none;
}
.error-code {
    font-size: 10rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1;
}

/* 12. Helper classes (scroll animation) */
.fade-in-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* 13. Back to Top Button */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background-color 0.3s;
  z-index: 999;
}
#back-to-top svg {
    width: 20px;
    height: 20px;
}
#back-to-top:hover {
  background-color: var(--primary-color);
}
#back-to-top.show {
  opacity: 1;
  visibility: visible;
}


/* 14. Responsive Design */
@media (max-width: 992px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 70px;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--primary-color);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    padding-top: var(--header-height);
  }

  .menu-open .nav-links {
    transform: translateX(0);
  }

  .nav-links a {
    font-size: 1.5rem;
    color: var(--text-light);
  }
  .nav-links a::after {
    background-color: var(--text-light);
  }

  .menu-toggle {
    display: block;
  }

  .hero {
    min-height: 70vh;
  }

  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }
  
  .map-container {
    height: 350px;
    border-radius: 8px;
  }
  
  #cookie-banner {
    flex-direction: column;
    text-align: center;
    padding-bottom: 2rem;
  }
}