* {
    box-sizing: border-box;
}

/* ======================================== MATHJAX ======================= */ 

.MathJax { 
    font-size: 1.15rem !important; 
}

mjx-container {
    font-size: 1.05em;
}

mjx-container[display="true"] {
    margin: 0.8rem 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #0B3861;
    margin: 0;
    padding: 0;
    position: relative;
    min-height: 100vh;
}

.header {
    position: sticky;
    display: flex;
    height: 60px;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    align-items: center;
    padding: 1rem 2rem;
    top: 0;
    z-index: 10;
    background-color: rgba(11, 56, 97, 0.9);
    backdrop-filter: blur(4px);
}

.logo {
    font-weight: 600;
    color: #f0f0f0;
}

/* Bouton hamburger caché en PC */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 4px;
    background-color: #fff;
    border-radius: 2px;
}

.nav ul {
    display: flex;
    list-style-type: none;
    color: #f0f0f0;
    font-size: 1em;
    gap: 1rem;
    transition: all 0.25s ease;
}

.nav.active ul {
    transform: translateY(0);
    opacity: 1;
}

.nav ul li a {
    position: relative;
    text-decoration: none;
    color: #f0f0f0;
    border-radius: 5px;
    padding: 0.5rem 1rem;
}

.nav ul li a::after {
    content: "";
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #00CCCC;
    transition: width 0.3s;
}

.nav ul li a:hover { /* tous liens lors du survol dans la balise nav */
    color: #f19c65; /* couleur de fond */
}

.nav ul li a:hover::after {
    width: 100%;
}

.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1; /* Derrière le contenu */
}

/* Un atome entier */
.atom {
  position: absolute;
}

/* Noyau */
.nucleus {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background-color: #d3d3d3; /* gris clair */
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Orbite */
.orbit {
  position: absolute;
  border: 1px solid rgba(200, 200, 200, 0.3);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* Électron */
.electron {
  position: absolute;
  width: 6px;
  height: 6px;
  background-color: rgba(255, 80, 80, 0.9); /* rouge doux */
  border-radius: 50%;
}

.container {
    width: 90%;
    max-width: 1050px;
    margin: 30px auto 60px auto;
    padding: 30px 45px 45px 45px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    line-height: 1.6;
}

.container .title {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 18px;
    border-bottom: 1px solid #d8e1e8;
}

.container .title h1 {
    margin: 0;
    color: #0B3861;
    font-size: 1.8rem;
    line-height: 1.3;
    font-weight: 600;
}

.container .title h4 {
    margin: 10px 0 0 0;
    color: #6d7b86;
    font-size: 0.9rem;
    font-weight: normal;
}

/* ============================
   INTRODUCTION
   ============================= */

.container .intro {
    margin-bottom: 35px;
    padding: 18px 22px;
    text-align: justify;
    background-color: #f4f7f9;
    border-left: 4px solid #f19c65;
    border-radius: 6px;
}

.container .intro p {
    margin: 0;
}

.container p {
    color: #263746;
    text-align: justify;
    font-size: 0.96rem;
    margin: 0 0 14px 0;
}

.container strong {
    color: #0B3861;
}

.container h2 {
    margin-top: 40px;
    margin-bottom: 18px;

    color: #0B3861;
    font-size: 1.4rem;
    font-weight: 600;

    padding-bottom: 6px;
    border-bottom: 2px solid #f19c65;
}

.container h3 {
    margin-top: 28px;
    margin-bottom: 12px;

    color: #174f73;
    font-size: 1.1rem;
    font-weight: 600;
}

.ecc-calculation {
    margin: 20px auto;
    padding: 12px 20px;
    text-align: center;
    background-color: #f8fafb;
    border-left: 3px solid #0B3861;
    border-radius: 4px;
}

.code-block {
    margin: 25px 0;
    padding: 0;
    background-color: #17212b;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.15);
}

.code-block pre {
    margin: 0;
    padding: 20px;
    color: #e6edf3;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: left;
    overflow-x: auto;
}

.code-block code {
    font-family: inherit;
}

.image-block {
    margin: 35px auto 15px auto;
    text-align: center;
}

.image-block img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;

    border-radius: 8px;

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.image-block figcaption {
    margin-top: 10px;
    color: #687782;
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.4;
}


.button {
    border: none;
    border-radius: 5px;
    color: white;
    text-align: center;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.button-retour {
    text-align: center;
    margin-top: 2rem;
}

.button-retour a {
    display: inline-block;
    color: #004466;
    border: 1px solid #004466;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.button-retour a:hover {
    background-color: #004466;
    color: white;
}

.footer {
    height: 100%;
    margin: 0;
    display: flex;
    background-color: #0B3861;
    color: white;
    padding: 2rem 1rem;
    margin-top: 4rem;
}

.footer-container {
    margin: 0 auto;
    text-align: center;
}

.footer a {
    color: white;
}

.footer a:hover {
    color: #ffcc70;
}

.footer-links {
    margin-top: 1rem;
}

.footer-links a {
    margin: 0 10px;
    color: white;
    text-decoration: none;
}

.footer-links a:hover{
    text-decoration: underline;
}

@media screen and (max-width: 768px){

    .menu-toggle {
        display: flex;
    }
    .menu-toggle.open span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .menu-toggle.open span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.open span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    .menu-toggle span {
        transition: all 0.3s ease;
    }

    body {
        overflow-x: hidden;
    }

    .header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: auto;
    }
    
    .logo {
        font-size: 1.1rem;
    }

    .nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
        background: rgba(11, 56, 97, 0.95);
        padding: 1rem;
        margin: 0;
        text-align: left;
        position: absolute;
        top: 60px;
        left: 0;
        z-index: 1000;
    }

    .nav.active ul {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }
    .nav ul li {
        margin: 0.5rem 0;
        text-align: left;
    }
    .nav ul li a {
        color: #fff;
        display: block;
        width: 100%;
    }

    pre, mjx-container {
        max-width: 100%;
        overflow-x: auto;
    }

    .container {
        padding: 1.5rem 1rem;
        margin: 0.5rem;
    }

    .container .title h1 {
        font-size: 1.55rem;
    }

    .container h2 {
        font-size: 1.3rem;
        margin-top: 35px;
    }

    .container h3 {
        font-size: 1.1rem;
    }

    .container p {
        font-size: 0.94rem;
    }

    .ecc-formula {
        padding: 12px 10px;
    }


    .image-block { 
        margin-top: 30px; 
    } 
    
    .image-block figcaption { 
        font-size: 0.78rem; 
    }

    .button-retour {
        margin-top: 2rem;
        padding: 0 1rem;
    }
    
}