:root {
    --bg: #0e0e10;
    --text: #f2f2f2;
    --accent: #38bdf8;
    --font-main: 'Space Grotesk', sans-serif;
    --base-font-size: 16px;
    --card-radius: 16px;
    --card-border-size: 2px;
    --card-border-gradient: linear-gradient(90deg, var(--accent), #a855f7);
    --panel-bg: #1a1a1d;
    --card-bg: rgba(47, 43, 43, 0.13);
    --shadow: 0 8px 30px rgba(0,0,0,0.35);
    --media-bg: #111;
    --selected-border: var(--accent);
}

html[data-theme="light"] {
    --bg: #f6f7fb;
    --text: #0e0e10;
    --accent: #0284c7;
    --panel-bg: #ffffff;
    --card-bg: rgba(0, 0, 0, 0.04);
    --shadow: 0 8px 30px rgba(0,0,0,0.12);
    --media-bg: #f0f2f6;
    --selected-border: var(--accent);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main), serif;
    position: relative;
}

html {
    font-size: var(--base-font-size);
}

.flag-active{
    border: solid var(--selected-border) 2px;
}

.menu-flags {
    display: grid;
    grid-template-columns: repeat(2, 48px);
    justify-content: space-around;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.menu-flags img,
.menu-flags button {
    width: 48px;
    height: 30px;
}

.menu-flags img {
    border-radius: 5px;
    cursor: pointer;
}

.menu-flags button {
    padding: 0;
    background: none;
    border: 2px solid transparent;
    color: var(--text);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.menu-flags button:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.menu-flags button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.75);
    outline-offset: 2px;
}

.menu-flags button.text-btn-active {
    border-color: var(--selected-border);
}

.menu-flags button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 1.2s ease forwards;
    text-align: center;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
}

.project-page {
    align-items: stretch;
    justify-content: flex-start;
}

.project-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    margin: 1rem auto 30px;
    overflow: hidden;
    padding: 1.5rem 2rem 15px;
}

.project-card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: var(--card-border-size);
    border-radius: var(--card-radius);
    background: var(--card-border-gradient);
    border: var(--card-border-size) solid transparent;
    background:
            linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
            var(--card-border-gradient) border-box;

    -webkit-mask-image:
            linear-gradient(0deg, #000 0%, #000 100%),
            linear-gradient(0deg, #000 0%, #000 100%);
    -webkit-mask-clip: content-box, border-box;
    -webkit-mask-composite: xor;

    /* Fallbacks standards (aident aussi l'analyse CSS de l'IDE) */
    mask-image:
            linear-gradient(0deg, #000 0%, #000 100%),
            linear-gradient(0deg, #000 0%, #000 100%);
    mask-clip: content-box, border-box;
    mask-composite: exclude;

    z-index: -1;
}

.project-content {
    text-align: left;
}

h1 {
    margin-top: 3rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 0.5rem;
}

p {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-top: 1.2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    text-align: justify;
    text-align-last: center;
}

.subtitle {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

a:hover,
a:visited {
    color: #ffffff;
}

html[data-theme="light"] a:visited {
    color: #1f2937;
}

html[data-theme="light"] a:hover {
    color: var(--accent);
}

.menu-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    z-index: 999;
}

.menu-toggle:hover {
    background: var(--accent);
    color: var(--bg);
}

.side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: var(--panel-bg);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: right 0.4s ease-in-out;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.side-menu.open {
    right: 0;
}

/* Suppression des styles menu-header ajoutés */

.side-menu h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.side-menu ul {
    list-style: none;
}

.side-menu li {
    margin: 0.5rem 0;
}

.side-menu li ul {
    margin-left: 1rem;
}

.side-menu a {
    text-decoration: none;
    color: var(--text);
    font-size: 1rem;
}

.side-menu a.active {
    background-color: #007acc;
    color: white;
    font-weight: bold;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.e-card {
    animation: fadeIn 1.2s ease forwards;
    box-shadow: 0px 8px 28px -9px rgba(0,0,0,0.45);
    position: relative;
    z-index: 0;
    overflow: hidden;
    width: 100%;
    max-width: 360px;
    height: auto;
    min-height: 240px;
    padding: 1rem;
    border-radius: var(--card-radius);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.e-card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: var(--card-border-size);
    border-radius: var(--card-radius);
    background: var(--card-border-gradient);
    border: var(--card-border-size) solid transparent;
    background:
            linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
            var(--card-border-gradient) border-box;

    -webkit-mask-image:
            linear-gradient(0deg, #000 0%, #000 100%),
            linear-gradient(0deg, #000 0%, #000 100%);
    -webkit-mask-clip: content-box, border-box;
    -webkit-mask-composite: xor;

    /* Fallbacks standards (aident aussi l'analyse CSS de l'IDE) */
    mask-image:
            linear-gradient(0deg, #000 0%, #000 100%),
            linear-gradient(0deg, #000 0%, #000 100%);
    mask-clip: content-box, border-box;
    mask-composite: exclude;

    z-index: -1;
}

.e-card > * {
    position: relative;
    z-index: 1;
}

.logo {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 90px;
    height: auto;
}

.icon {
    width: 3em;
}

.infotop {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.name {
    font-size: 0.9rem;
    font-weight: 400;
    position: relative;
    top: 0;
    margin-left: 5px;
    margin-right: 5px;
    line-height: 1.35;
}

.listCard {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    max-width: 1200px;
    gap: 40px;
    margin-bottom: 40px;
    padding: 0 1rem;
}

.listCard-title {
    grid-column: 1 / -1;
    text-align: center;
    margin: 0 30px;
}

.listCardFlex {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.carousel {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 30px auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    background: var(--media-bg);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-track img {
    width: 100%;
    height: auto;
    max-height: 500px;
    flex-shrink: 0;
    object-fit: contain;
    background: var(--media-bg);
    cursor: pointer;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.4rem 0.9rem;
    border-radius: 50%;
    z-index: 2;
}

.carousel-btn:hover {
    background: rgba(0,0,0,0.8);
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

.dataSource {
    display: flex;
    margin-top: 15px;
}

.project-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

video {
    height: auto;
    max-height: 600px;
    width: 100%;
    max-width: 900px;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    padding: 2rem;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255,255,255,0.3);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

.skill-section {
    grid-column: 1 / -1;
    text-align: center;
    margin: 40px 0 10px;
}

.skill-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.skill-divider {
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: var(--card-border-gradient);
    opacity: 0.95;
}

@media (max-width: 1024px) {
    .container {
        padding: 2rem 1.5rem;
    }

    p {
        max-width: 700px;
    }

    .project-card {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .listCard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: center;
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }

    h1 {
        margin-top: 1.5rem;
    }
}

@media (max-width: 768px) {
    p {
        font-size: 1.15rem;
    }

    .project-image video {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
        display: block;
        margin: 0 auto;
    }

    body {
        overflow-x: hidden;
    }

    .container {
        padding: 2.5rem 1rem 1.5rem;
        text-align: left;
    }

    p {
        margin-left: 0;
        margin-right: 0;
        font-size: 1rem;
    }

    .project-content {
        text-align: left;
    }

    .side-menu {
        width: 80%;
        max-width: none;
    }

    .listCard {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 0 1.2rem;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .e-card {
        max-width: 100%;
        height: auto;
        min-height: 220px;
    }

    :root {
        --card-border-size: 1px;
    }

    .carousel {
        margin: 20px auto;
    }

    .carousel-track img {
        max-height: 320px;
    }

    .carousel-btn {
        font-size: 1.4rem;
        padding: 0.3rem 0.7rem;
    }

    .project-image video {
        width: 100%;
        height: auto;
        max-height: 70vh;
        object-fit: contain;
        background: var(--media-bg);
        display: block;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .menu-toggle {
        top: 1rem;
        right: 1rem;
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .e-card {
        height: auto;
        min-height: 210px;
    }

    .infotop {
        font-size: 1rem;
        top: auto;
    }

    .name {
        font-size: 0.85rem;
    }

    .carousel-track img {
        max-height: 260px;
    }
}

.menu-flags button.theme-btn {
    border-radius: 5px;
}

.menu-flags button.theme-btn.theme-dark {
    background: #0e0e10;
    border-color: rgba(255, 255, 255, 0.25);
}

.menu-flags button.theme-btn.theme-light {
    background: #ffffff;
    color: #0e0e10;
    border-color: rgba(0, 0, 0, 0.25);
}

.menu-flags button.theme-btn.text-btn-active {
    border-color: var(--selected-border);
}

body.overflow-y-auto {
    overflow-y: auto;
}

body.overflow-y-hidden {
    overflow-y: hidden;
}

.homepage-fullheight {
    height: 100%;
    display: flex;
    align-items: center;
}

.dataviz-streams-margin {
    margin-bottom: 5px;
}

.lightbox-hint-margin {
    margin-left: 5px;
}
