html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

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

:root {
    --project-inline-media-max-width: 360px;
    --project-inline-media-max-width-nas: 620px;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0f1117;
    color: #ffffff;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* GLOBAL AMBIENT GLOW */

body.home-page,
body.project-page {
    position: relative;
    isolation: isolate;
}

body.home-page::before,
body.home-page::after,
body.project-page::before,
body.project-page::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

body.home-page::before {
    background:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.17), transparent 34%),
        radial-gradient(circle at 86% 18%, rgba(139, 92, 246, 0.13), transparent 32%);
}

body.home-page::after {
    background:
        radial-gradient(circle at 20% 76%, rgba(59, 130, 246, 0.11), transparent 30%),
        radial-gradient(circle at 82% 84%, rgba(139, 92, 246, 0.1), transparent 28%);
}

body.project-page::before {
    background:
        radial-gradient(circle at 12% 24%, rgba(59, 130, 246, 0.2), transparent 34%),
        radial-gradient(circle at 88% 36%, rgba(139, 92, 246, 0.15), transparent 30%);
}

body.project-page::after {
    background:
        radial-gradient(circle at 16% 76%, rgba(59, 130, 246, 0.12), transparent 32%),
        radial-gradient(circle at 84% 82%, rgba(139, 92, 246, 0.12), transparent 28%);
}

#about::after,
#projects::after,
#contact::after {
    content: "";
    position: absolute;
    width: min(42vw, 520px);
    height: min(42vw, 520px);
    border-radius: 999px;
    filter: blur(70px);
    pointer-events: none;
    z-index: -1;
}

#about::after {
    top: -35%;
    right: -10%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0));
}

#projects::after {
    top: -28%;
    left: -14%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0));
}

#contact::after {
    bottom: -42%;
    right: -8%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.14), rgba(59, 130, 246, 0));
}

.project-page .project-hero-video,
.project-page .project-hero-intro,
.project-page .project-gallery {
    position: relative;
    overflow: hidden;
}

.project-page .project-layout {
    position: relative;
}

.project-page .project-hero-intro::after,
.project-page .project-layout::before,
.project-page .project-gallery::before {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(65px);
    pointer-events: none;
    z-index: -1;
}

.project-page .project-hero-intro::after {
    width: min(40vw, 500px);
    height: min(40vw, 500px);
    top: -78%;
    right: -24%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0));
}

.project-page .project-layout::before {
    width: min(46vw, 560px);
    height: min(46vw, 560px);
    top: 14%;
    left: -22%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.16), rgba(139, 92, 246, 0));
}

.project-page .project-gallery::before {
    width: min(50vw, 620px);
    height: min(50vw, 620px);
    bottom: -44%;
    right: -12%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0));
}

/* HERO */

header {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 30% 30%, #1a1d29, #0f1117);
    text-align: center;
    animation: fadeIn 1.5s ease-in-out;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    font-size: 1.2rem;
    color: #9ca3af;
}

/* HOME LAYOUT TUNING */

body > header {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    height: clamp(520px, 74vh, 760px);
    min-height: 0;
    justify-content: flex-start;
    padding-top: clamp(120px, 19vh, 210px);
    padding-bottom: clamp(42px, 7vh, 86px);
}

body > header::before,
body > header::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(60px);
    z-index: -1;
    pointer-events: none;
}

body > header::before {
    width: min(42vw, 560px);
    height: min(42vw, 560px);
    top: -18%;
    left: -8%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0));
}

body > header::after {
    width: min(36vw, 460px);
    height: min(36vw, 460px);
    right: -10%;
    bottom: -16%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0));
}

.hero-actions {
    margin-top: 26px;
    display: flex;
    gap: 12px;
}

.hero-btn {
    display: inline-block;
    text-decoration: none;
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.hero-btn:hover {
    transform: translateY(-1px);
}

.hero-btn-primary {
    color: #ffffff;
    border: 1px solid rgba(115, 136, 255, 0.65);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(139, 92, 246, 0.9));
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.28);
}

.hero-btn-primary:hover {
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

.hero-btn-secondary {
    color: #dbe2ef;
    border: 1px solid rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.08);
}

#about,
#projects,
#contact,
#cv {
    position: relative;
    overflow: clip;
    scroll-margin-top: 104px; /* Compense la navbar fixe sur les ancres */
}

#about,
#projects,
#cv,
.contact {
    padding: clamp(56px, 8vh, 90px) 10%;
    min-height: auto;
    background: linear-gradient(180deg, rgba(11, 17, 34, 0.26), rgba(11, 17, 34, 0));
}

#about {
    padding-top: clamp(34px, 5vh, 56px);
}

#cv {
    padding-top: clamp(40px, 6vh, 64px);
    padding-bottom: clamp(28px, 4vh, 44px);
}

#contact {
    padding-top: clamp(40px, 6vh, 64px);
}

#projects::before,
#contact::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0), rgba(59, 130, 246, 0.4), rgba(139, 92, 246, 0.4), rgba(139, 92, 246, 0));
    opacity: 0.6;
}

/* SECTIONS */

section {
    padding: 120px 10%;
    min-height: 60vh;
}

h2 {
    font-size: 2rem;
    margin-bottom: 40px;
}

/* PROJECT GRID */

.projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-height: 200px;
    display: flex;
    align-items: center;
    background: #1a1d29;
    padding: 30px;
    padding-right: clamp(170px, 38%, 240px);
    border-radius: 12px;
    transition: 0.3s ease;
    cursor: pointer;
    border: 1px solid #222638;
}

.card:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.home-project-content {
    position: relative;
    z-index: 2;
}

.card h3 {
    margin: 0 0 10px;
    line-height: 1.28;
}

.card p {
    margin: 0;
}

.home-project-art {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(96px, 30%, 176px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(112, 169, 255, 0.82), rgba(179, 145, 255, 0.78));
    border: 1px solid rgba(150, 165, 255, 0.66);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 12px 22px rgba(45, 38, 102, 0.3);
    pointer-events: none;
    z-index: 1;
}

.home-project-art img {
    display: block;
    width: 100%;
    max-height: 130px;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(6, 8, 13, 0.46));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.card:hover {
    transform: translateY(-10px);
    border-color: #3b82f6;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
}

.card:hover .home-project-art img {
    transform: translateY(-3px) scale(1.03);
    filter: drop-shadow(0 16px 26px rgba(6, 8, 13, 0.55));
}

/* CONTACT */

.contact a {
    color: #3b82f6;
    text-decoration: none;
}

.cv-link {
    color: #3b82f6;
    text-decoration: underline;
    text-underline-offset: 2px;
}

footer {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

/* ANIMATION */

.fade-element {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-element.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

section:nth-of-type(1) .fade-element { transition-delay: 0.1s; }
section:nth-of-type(2) .fade-element { transition-delay: 0.2s; }
section:nth-of-type(3) .fade-element { transition-delay: 0.3s; }

/* NAVBAR */

.navbar {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    padding: 14px 5%;
    z-index: 1000;
    transition: padding 0.3s ease;
}

.nav-container {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 10px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(
        135deg,
        rgba(12, 17, 31, 0.74),
        rgba(12, 17, 31, 0.44)
    );
    box-shadow:
        0 14px 40px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.navbar.scrolled .nav-container {
    background: linear-gradient(
        135deg,
        rgba(10, 14, 27, 0.9),
        rgba(10, 14, 27, 0.68)
    );
    border-color: rgba(139, 92, 246, 0.28);
    box-shadow:
        0 18px 44px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.logo {
    font-weight: 600;
    font-size: clamp(1.05rem, 1.25vw, 1.2rem);
    text-decoration: none;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: clamp(16px, 2.4vw, 30px);
    align-items: center;
}

.lang-switch-wrapper {
    display: inline-flex;
    align-items: center;
}

.lang-switch {
    --lang-pad: 3px;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 0;
    padding: var(--lang-pad);
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(59, 130, 246, 0.08);
    overflow: hidden;
}

.lang-switch::before {
    content: "";
    position: absolute;
    top: var(--lang-pad);
    bottom: var(--lang-pad);
    left: var(--lang-pad);
    width: calc(50% - var(--lang-pad));
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(13, 63, 126, 0.94) 0%,
        rgba(13, 63, 126, 0.94) 33.333%,
        rgba(224, 232, 242, 0.9) 33.333%,
        rgba(224, 232, 242, 0.9) 66.666%,
        rgba(197, 53, 49, 0.92) 66.666%,
        rgba(197, 53, 49, 0.92) 100%
    );
    box-shadow: 0 8px 18px rgba(9, 45, 92, 0.24);
    transform: translateX(0);
    transition: transform 0.26s cubic-bezier(0.32, 1, 0.68, 1), background 0.24s ease, box-shadow 0.24s ease;
}

.lang-switch[data-active-lang="en"]::before {
    transform: translateX(100%);
    background:
        linear-gradient(
            0deg,
            transparent 0%,
            transparent 38%,
            rgba(177, 39, 40, 0.95) 38%,
            rgba(177, 39, 40, 0.95) 62%,
            transparent 62%,
            transparent 100%
        ),
        linear-gradient(
            90deg,
            transparent 0%,
            transparent 42%,
            rgba(177, 39, 40, 0.95) 42%,
            rgba(177, 39, 40, 0.95) 58%,
            transparent 58%,
            transparent 100%
        ),
        linear-gradient(135deg, rgba(221, 228, 238, 0.9), rgba(205, 214, 228, 0.9));
    box-shadow: 0 8px 18px rgba(70, 24, 28, 0.24);
}

.lang-btn {
    position: relative;
    z-index: 1;
    min-width: 40px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.lang-btn:hover {
    color: #ffffff;
}

.lang-btn.is-active {
    color: #ffffff;
    background: transparent;
    text-shadow: 0 1px 1px rgba(15, 23, 42, 0.25);
}

.lang-switch[data-active-lang="fr"] .lang-btn[data-lang="fr"].is-active {
    color: #0b1324;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.24);
}

.lang-switch[data-active-lang="en"] .lang-btn[data-lang="en"].is-active {
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.34);
}

[data-i18n] {
    transition: opacity 0.16s ease, filter 0.16s ease;
}

body.language-switching [data-i18n] {
    opacity: 0.62;
    filter: blur(0.25px);
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 2px;
    text-decoration: none;
    color: #eef2ff;
    font-weight: 500;
    font-size: 0.96rem;
    transition: color 0.25s ease;
}

.nav-links a:hover {
    color: #9ac0ff;
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.06);
    color: #ffffff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.25s ease, background 0.25s ease;
}

.nav-toggle:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.5);
}

.nav-toggle span {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #ffffff;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle span:nth-child(1) { transform: translateY(-6px); }
.nav-toggle span:nth-child(2) { transform: translateY(0); }
.nav-toggle span:nth-child(3) { transform: translateY(6px); }

.navbar.menu-open .nav-toggle span:nth-child(1) { transform: rotate(45deg); }
.navbar.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.navbar.menu-open .nav-toggle span:nth-child(3) { transform: rotate(-45deg); }


/* PROJECT HERO */

.project-hero {
    position: relative;
    height: 80vh;
    overflow: hidden;
}

.project-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-hero .overlay {
    position: absolute;
    bottom: 20%;
    left: 10%;
    color: white;
}

/* PROJECT SECTIONS */

.project-section,
.project-image,
.project-video,
.project-buttons {
    padding: 120px 10%;
}

.project-image img {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.featured-project {
    border: 1px solid #3b82f6;
    background: linear-gradient(145deg, #1a1d29, #151822);
}

.featured-project:hover {
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.25);
}

/* SPLIT LAYOUT */

.project-split {
    display: flex;
    gap: 60px;
    padding: 120px 10%;
    align-items: center;
}

.project-split .text {
    flex: 1;
}

.project-split .image {
    flex: 1;
}

.project-split img {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* VIDEO */

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.video-wrapper iframe {
    position: absolute;
    width: 100%;
    height: 100%;
}

.project-hero-video {
    position: relative;
    height: 85vh;
    overflow: hidden;
}

.project-hero-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-hero-video .overlay {
    position: absolute;
    bottom: 20%;
    left: 10%;
    color: white;
}

/* BUTTONS */

.btn-primary,
.btn-secondary {
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    margin-right: 20px;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    color: white;
}

.btn-secondary {
    border: 1px solid #3b82f6;
    color: #3b82f6;
}

/* HERO VIDEO */

.project-hero-video {
    position: relative;
    height: 85vh;
    overflow: hidden;
}

.project-hero-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-hero-video .overlay {
    position: absolute;
    bottom: 20%;
    left: 10%;
    color: white;
}

/* CONTAINER */

.project-container {
    max-width: 1100px;
    margin: auto;
}

.project-section {
    padding: 120px 10%;
}

.tech-section {
    background: #131722;
}

.project-block {
    margin-bottom: 60px;
}

.project-block h3 {
    margin-bottom: 15px;
}

/* GALLERY */

.project-gallery {
    padding: 120px 10%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.niryo-demo-gallery {
    padding: 110px 6%;
}

.niryo-demo-gallery .project-container {
    max-width: 1460px;
}

.niryo-demo-gallery .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
}

@media (max-width: 900px) {
    .niryo-demo-gallery .gallery-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.gallery-item video {
    width: 100%;
    border-radius: 15px;
}

.gallery-item iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 15px;
    background: #070b14;
}

.gallery-item a {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #dbe2ef;
    text-decoration: none;
    background: rgba(59, 130, 246, 0.08);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.gallery-item a:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.7);
}

.gallery-item p {
    margin-top: 10px;
    color: #9ca3af;
}

.youtube-playlist-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 600;
}

.youtube-playlist-link svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.youtube-playlist-link:hover {
    color: #ff4f4f;
}


.mode-toggle {
    position: relative;
    display: flex;
    width: 420px;
    margin: 60px auto;
    background: #1a1d29;
    border-radius: 50px;
    padding: 5px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    z-index: 2;
}

.toggle-slider {
    position: absolute;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 50px;
    transition: transform 0.3s ease;
    z-index: 1;
}

.toggle-btn.active {
    color: white;
}

.project-layout {
    display: flex;
    gap: 60px;
    padding: 0 10%;
}

.project-content {
    flex: 3;
}

.project-sidebar {
    flex: 1;
    position: sticky;
    top: 120px;
    height: fit-content;
}

.hidden {
    display: none;
}

/* Mobile */
@media (max-width: 1000px) {
    .project-layout {
        flex-direction: column;
    }

    .project-sidebar {
        display: none;
    }
}

/* ========================= */
/* TOGGLE PREMIUM ADVANCED */
/* ========================= */

.mode-toggle {
    position: relative;
    display: flex;
    align-items: center;
    width: 460px;
    margin: 80px auto;

    padding: 6px;
    border-radius: 60px;

    background: linear-gradient(
        145deg,
        rgba(255,255,255,0.06),
        rgba(255,255,255,0.02)
    );

    border: 1px solid rgba(139, 92, 246, 0.15);

    box-shadow:
        inset 0 0 20px rgba(139, 92, 246, 0.05),
        0 10px 30px rgba(0,0,0,0.5);

    backdrop-filter: blur(12px);

    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: 14px 0;
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: 
        color 0.3s ease,
        transform 0.15s ease;
}

.toggle-btn:active {
    transform: scale(0.97);
}

.toggle-btn.active {
    color: #ffffff;
}

.toggle-slider {
    position: absolute;
    top: 6px;
    left: 6px;
    width: calc(50% - 6px);
    height: calc(100% - 12px);

    border-radius: 50px;

    background: linear-gradient(
        90deg,
        #3b82f6,
        #8b5cf6
    );

    box-shadow:
        0 0 20px rgba(139, 92, 246, 0.4),
        0 0 40px rgba(59, 130, 246, 0.2),
        0 5px 15px rgba(0,0,0,0.5);

    transition: 
        transform 0.35s cubic-bezier(.4,0,.2,1),
        box-shadow 0.3s ease;
    z-index: 1;
}

/* l�ger glow suppl�mentaire quand actif */
.mode-toggle:hover .toggle-slider {
    box-shadow:
        0 0 25px rgba(139, 92, 246, 0.6),
        0 0 50px rgba(59, 130, 246, 0.25),
        0 8px 20px rgba(0,0,0,0.6);
}

.toggle-slider::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.2),
        rgba(255,255,255,0)
    );
    opacity: 0.4;
}

/* ========================= */
/* SIDEBAR PREMIUM */
/* ========================= */

/* ========================= */
/* PROJECT LAYOUT CLEAN */
/* ========================= */

.project-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: clamp(44px, 5vw, 84px);
    padding: 0 5% 0 9%;
    position: relative;
}

.project-layout.mode-switching .project-sidebar {
    opacity: 0.55;
    transform: translateX(6px);
}

.project-content {
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.project-content.mode-transition {
    opacity: 0;
    transform: translateY(12px);
}

.project-sidebar {
    --sidebar-progress-offset: -18px;
    --sidebar-progress-width: 3px;
    position: sticky;
    top: 120px;
    align-self: start;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.25s ease;
    justify-self: end;
}

/* Sidebar projet: normale au chargement, puis fixee via JS apres le bloc de boutons */
.project-page .project-sidebar {
    position: static !important;
    top: auto !important;
    width: 270px;
}

.project-page .project-sidebar.sidebar-pinned {
    position: fixed !important;
    top: var(--sidebar-pin-top, 120px) !important;
    right: 5% !important;
    width: 270px;
    z-index: 900;
}

.project-page .project-sidebar.sidebar-stopped {
    position: absolute !important;
    top: auto !important;
    right: 5%;
    bottom: 0 !important;
    width: 270px;
    z-index: 900;
}

.project-sidebar:hover {
    opacity: 1;
}

.project-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.sidebar-demo-link {
    display: inline-block;
    margin-top: 18px;
    margin-left: calc(var(--sidebar-progress-offset) + var(--sidebar-progress-width) + 10px);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #dbe2ef;
    font-size: 0.82rem;
    text-decoration: none;
    background: rgba(59, 130, 246, 0.08);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.sidebar-demo-link:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.7);
}

.scroll-top-btn {
    position: fixed;
    top: 84px;
    right: 24px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #dbe2ef;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    background: rgba(59, 130, 246, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.scroll-top-btn:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(139, 92, 246, 0.7);
}

.scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.project-sidebar li {
    margin-bottom: 18px;
    position: relative;
    padding: 2px 0;
}

.project-sidebar a {
    text-decoration: none;
    font-size: 0.9rem;
    color: #9ca3af;
    transition: color 0.25s ease, transform 0.25s ease;
    display: inline-block;
}

.project-sidebar a:hover {
    color: white;
}

.project-sidebar a.active {
    color: #ffffff;
    font-weight: 500;
    transform: translateX(5px);
    text-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

/* Barre verticale */

.project-sidebar ul::before {
    content: "";
    position: absolute;
    left: var(--sidebar-progress-offset);
    top: 0;
    width: var(--sidebar-progress-width);
    height: 100%;
    background: rgba(255,255,255,0.08);
}

.progress-indicator {
    position: absolute;
    left: var(--sidebar-progress-offset);
    top: 0;
    width: var(--sidebar-progress-width);
    height: 40px;
    background: linear-gradient(#3b82f6, #8b5cf6);
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.45);
    transition: transform 0.28s ease, height 0.28s ease;
    will-change: transform, height;
}

.project-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.project-content.mode-transition {
    opacity: 0;
    transform: translateY(10px);
}

.project-section {
    position: relative;
    border-left: 2px solid transparent;
    padding-left: 22px;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.project-section.section-active {
    transform: translateX(6px);
    border-left-color: rgba(59, 130, 246, 0.75);
    background: linear-gradient(
        90deg,
        rgba(59, 130, 246, 0.08) 0%,
        rgba(59, 130, 246, 0) 45%
    );
}

/* ========================= */
/* NIRYO CONTENT TYPOGRAPHY */
/* ========================= */

.project-content .project-section {
    padding: 44px 0 44px 22px;
    max-width: 1200px;
    min-height: auto;
    scroll-margin-top: 130px;
}

.project-content .project-section h2 {
    margin-bottom: 20px;
    font-size: clamp(1.7rem, 2.8vw, 2.25rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.project-content .project-section p {
    margin: 0 0 16px;
    color: #dbe2ef;
    font-size: clamp(1rem, 1.2vw, 1.08rem);
    line-height: 1.78;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.project-content .project-section p strong {
    color: #f3f6ff;
}

.project-content .project-section ul {
    margin: 6px 0 20px 1.35rem;
    padding: 0;
}

.project-content .project-section li {
    margin-bottom: 10px;
    color: #dbe2ef;
    line-height: 1.72;
    text-align: justify;
    text-justify: inter-word;
}

.project-content .project-section p + ul {
    margin-top: 8px;
}

.project-content .project-section ul + p {
    margin-top: 18px;
}

.project-inline-media {
    margin: 18px 0 6px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.project-inline-media img {
    display: block;
    width: 100%;
    max-width: var(--project-inline-media-max-width);
    margin: 0 auto;
    height: auto;
    cursor: zoom-in;
}

.project-inline-media video {
    display: block;
    width: 100%;
    max-width: var(--project-inline-media-max-width);
    margin: 0 auto;
    height: auto;
    background: #070b14;
    cursor: zoom-in;
}

.project-inline-media.is-nas img,
.project-inline-media.is-nas video {
    max-width: var(--project-inline-media-max-width-nas);
}

.project-inline-media figcaption {
    margin: 0;
    padding: 8px 12px;
    color: #aeb8cc;
    font-size: 0.84rem;
    line-height: 1.4;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 7, 16, 0.86);
    backdrop-filter: blur(5px);
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox img {
    max-width: min(96vw, 1400px);
    max-height: 92vh;
    border-radius: 12px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}

.image-lightbox video {
    max-width: min(96vw, 1400px);
    max-height: 92vh;
    border-radius: 12px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
    background: #070b14;
}

/* Mobile */
@media (max-width: 1300px) {
    .project-layout {
        grid-template-columns: minmax(0, 1fr) 250px;
        gap: clamp(28px, 3.4vw, 52px);
        padding: 0 4.5% 0 8%;
    }

    .project-content .project-section p,
    .project-content .project-section li {
        text-align: left;
        text-justify: auto;
        hyphens: none;
    }
}

@media (max-width: 1000px) {
    .project-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 0 7%;
    }

    .project-sidebar {
        display: none;
    }

    .project-content .project-section {
        max-width: none;
        padding: 28px 0 28px 18px;
    }

    .project-content .project-section p,
    .project-content .project-section li {
        text-align: left;
    }

    .scroll-top-btn {
        top: 78px;
        right: 12px;
    }
}

/* ========================= */
/* NIRYO HERO TUNING */
/* ========================= */

.project-hero-video {
    padding: 0;
    min-height: auto;
    width: min(1140px, 90vw);
    margin: 110px auto 26px;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #080b13;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
}

.project-hero-video video,
.project-hero-video img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

.project-hero-video::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(
        to top,
        rgba(5, 8, 16, 0.36) 0%,
        rgba(5, 8, 16, 0.14) 36%,
        rgba(5, 8, 16, 0) 70%
    );
}

.project-hero-intro {
    width: min(1140px, 90vw);
    margin: 0 auto 6px;
    padding: 0 6px;
}

.project-hero-intro h1 {
    margin: 0 0 8px;
    font-size: clamp(1.9rem, 3.5vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.012em;
    text-wrap: balance;
}

.project-hero-intro p {
    margin: 0;
    max-width: 900px;
    color: #c9d1e2;
    font-size: clamp(0.98rem, 1.45vw, 1.1rem);
    line-height: 1.46;
}

.project-hero-video .overlay {
    left: clamp(16px, 3.2vw, 42px);
    bottom: clamp(5px, 3vw, 34px);
    right: auto;
    top: auto;
    z-index: 2;
    max-width: min(46vw, 660px);
    padding: 10px 14px;
    border-radius: 10px;
    background: linear-gradient(
        145deg,
        rgba(12, 16, 29, 0.55),
        rgba(12, 16, 29, 0.2)
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
}

.project-hero-video .overlay h1 {
    margin: 0 0 4px;
    font-size: clamp(1.7rem, 3.2vw, 2.9rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
    text-wrap: balance;
    text-shadow: 0 5px 24px rgba(0, 0, 0, 0.5);
}

.project-hero-video .overlay p {
    margin: 0;
    font-size: clamp(0.9rem, 1.35vw, 1.02rem);
    color: #d5d9e4;
    line-height: 1.35;
}

.mode-toggle {
    margin: 22px auto 54px;
}

@media (max-width: 900px) {
    body > header {
        height: auto;
        min-height: 58vh;
        padding-top: 112px;
        padding-bottom: 34px;
    }

    #about,
    #projects,
    .contact {
        padding: 44px 8%;
    }

    #about {
        padding-top: 26px;
    }

    .projects {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .card {
        min-height: 180px;
        padding: 24px;
        padding-right: clamp(142px, 44vw, 208px);
    }

    .home-project-art {
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: clamp(84px, 32vw, 138px);
        padding: 8px;
    }

    .home-project-art img {
        max-height: 106px;
    }

    .hero-actions {
        margin-top: 20px;
        flex-direction: column;
        width: min(320px, 86vw);
        gap: 10px;
    }

    .hero-btn {
        width: 100%;
        text-align: center;
    }

    .project-hero-video {
        width: min(96vw, 1140px);
        margin: 88px auto 18px;
    }

    .project-hero-intro {
        width: min(96vw, 1140px);
        padding: 0 4px;
        margin-bottom: 10px;
    }

    .project-hero-intro h1 {
        font-size: clamp(1.6rem, 7.8vw, 2.3rem);
    }

    .project-hero-intro p {
        font-size: 1rem;
        line-height: 1.45;
    }

    .mode-toggle {
        width: min(94vw, 460px);
        margin: 16px auto 30px;
    }

    .navbar {
        width: 100%;
        max-width: 100vw;
        padding: 8px 2.2%;
    }

    .nav-container {
        width: 100%;
        max-width: 100%;
        padding: 8px 10px;
        border-radius: 14px;
    }

    .nav-toggle {
        display: inline-flex;
        position: relative;
        z-index: 3;
        flex-shrink: 0;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        width: min(290px, calc(100vw - 24px));
        padding: 10px;
        border-radius: 14px;
        border: 1px solid rgba(148, 163, 184, 0.25);
        background: linear-gradient(
            165deg,
            rgba(10, 14, 26, 0.95),
            rgba(10, 14, 26, 0.85)
        );
        box-shadow: 0 18px 34px rgba(0, 0, 0, 0.4);
        display: flex;
        flex-direction: column;
        gap: 4px;
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
        pointer-events: none;
        transition: opacity 0.22s ease, transform 0.22s ease;
    }

    .nav-links li {
        width: 100%;
    }

    .lang-switch-wrapper {
        width: 100%;
    }

    .lang-switch {
        --lang-pad: 4px;
        width: 100%;
        border-radius: 10px;
    }

    .lang-btn {
        flex: 1 1 0;
        min-width: 0;
        height: 32px;
        border-radius: 8px;
        text-align: center;
    }

    .nav-links a {
        display: flex;
        width: 100%;
        height: auto;
        padding: 11px 12px;
        border-radius: 10px;
        color: #e7edf9;
    }

    .nav-links a:hover {
        color: #ffffff;
        background: rgba(59, 130, 246, 0.15);
    }

    .navbar.menu-open .nav-links {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    body.nav-open {
        overflow: hidden;
    }
}

@media (max-width: 560px) {
    .card {
        min-height: 162px;
        padding: 20px;
        padding-right: 126px;
    }

    .card h3 {
        margin-bottom: 8px;
        font-size: 1.12rem;
    }

    .card p {
        font-size: 0.92rem;
        line-height: 1.45;
    }

    .home-project-art {
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: 88px;
        padding: 7px;
    }

    .home-project-art img {
        max-height: 84px;
    }
}
