/* Ancienne palette par défaut retirée : elle réapparaissait sans préférence enregistrée. */
:root{
    --main-link: #ff8000;
    --main-link-hover: #ff9e3a;
    --main-link-visited: #ff8000;
    --main-link-footer: #6b3a10;

    --main-background: #EEE6D8;
    --main-second: #f8d5a2;
    --main-third: #daa23a;
    --main-fourth: #d5823f;
    --main-fifth: #93441A;

    --text-light: #f7ead6;
    --text-dark: #2c2a2a;
}
/* Theme-specific variable overrides applied via attributes on <html> */
:root[data-theme="blue"][data-variant="dark"]{
    --main-background: #0f172a;
    --main-second: #132650;
    --text-dark: #e6f0ff;
    --main-link: #7fbcff;
    --main-link-hover: #9ed0ff;
    --main-link-visited: #7fbcff;
    --main-link-footer: #dff6ff; /* brighter for contrast on dark footer */
    --text-light: #bfe8ff;
    --main-third: #2a9df4;
    --main-fourth: #1b6fb3;
    --main-fifth: #103a66;
}
:root[data-theme="blue"][data-variant="light"]{
    --main-background: #eaf6ff;
    --main-second: #9fe2fd;
    --text-dark: #05203a;
    --main-link: #1a73e8;
    --main-link-hover: #155bb5;
    --main-link-visited: #1a73e8;
    --main-link-footer: #06314f; /* darker for contrast on lighter footer */
    --text-light: #cfe9ff;
    --main-third: #7fbcff;
    --main-fourth: #53a0f2;
    --main-fifth: #1a5893ff;
}
:root[data-theme="green"][data-variant="dark"]{
    --main-background: #062117;
    --main-second: #0a4733;
    --text-dark: #e8fff2;
    --main-link: #81e79a;
    --main-link-hover: #5fe07a;
    --main-link-visited: #81e79a;
    --main-link-footer: #dcffec; /* light footer link for dark variant */
    --text-light: #bff5db;
    --main-third: #2ecc71;
    --main-fourth: #27ae60;
    --main-fifth: #145a2e;
}
:root[data-theme="green"][data-variant="light"]{
    --main-background: #e8f8f0;
    --main-second: #a2f2ce;
    --text-dark: #08331a;
    --main-link: #278b2e;
    --main-link-hover: #174b18;
    --main-link-visited: #006607;
    --main-link-footer: #062915; /* darker green for contrast */
    --text-light: #dff6ea;
    --main-third: #2ecc71;
    --main-fourth: #27ae60;
    --main-fifth: #145a2e;
}
:root[data-theme="brown"][data-variant="dark"]{
    --main-background: #2b1f17;
    --main-second: #4b3627;
    --text-dark: #f5e9df;
    --main-link: #ffb870;
    --main-link-hover: #ffc98f;
    --main-link-visited: #ffb870;
    --main-link-footer: #fff0d9; /* pale link for dark brown footer */
    --text-light: #fee8c9;
    --main-third: #d4a24a;
    --main-fourth: #b66d32;
    --main-fifth: #7a3b12;
}
:root[data-theme="brown"][data-variant="light"]{
    --main-background: #EEE6D8;
    --main-second: #f8d5a2;
    --text-dark: #2c2a2a;
    --main-link: #ff8000;
    --main-link-hover: #ff9e3a;
    --main-link-visited: #ff8000;
    --main-link-footer: #6b3a10; /* stronger dark contrast on light brown footer */
    --text-light: #f7ead6;
    --main-third: #daa23a;
    --main-fourth: #d5823f;
    --main-fifth: #93441A;
}
body{
    background:  var(--main-background);
    font-size: medium;
    font-family:Verdana, Geneva, Tahoma, sans-serif;
    color: var(--text-dark);
}
/* Typing effect */
.type-text.typing::after,
.type-text-hover.typing::after{
    content: "|";
    margin-left: .25rem;
    animation: blink 1s step-end infinite;
}
@keyframes blink{50%{opacity:0}}

/* Skills */
.skills{margin:1.5em 0;padding:1em;border:2px solid var(--main-fifth);background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.02))}
.skills h3{margin:0 0 .5em;color:var(--text-dark)}
.skill{margin:0.5em 0}
.skill-name{font-weight:bold;margin-bottom:.25em}
.skill-bar{background:linear-gradient(90deg, rgba(0,0,0,0.03), var(--main-background));height:14px;border:1px solid var(--main-fifth);border-radius:12px;overflow:hidden}
.skill-progress{height:100%;width:0;background:linear-gradient(90deg,var(--main-second),var(--main-third),var(--main-fourth),var(--main-fifth));transition:width 1s ease;box-shadow:0 4px 12px rgba(0,0,0,0.06) inset}
.skill-competencies{margin-top:0.4em;padding-left:1em;font-size:0.9em;display:flex;flex-direction:row;gap:0.2em}
.skill-competencies label{display:flex;align-items:center;gap:0.4em;cursor:pointer}
.skill-competencies label a{color:var(--main-link);text-decoration:none;transition:all 0.2s ease}
.skill-competencies label a:hover{color:var(--main-link-hover);text-decoration:underline}
.skill-competencies input[type="checkbox"]{cursor:default;width:18px;height:18px;margin-right:0.2em;flex-shrink:0;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-color:var(--main-background);border:2px solid var(--main-third);border-radius:3px;position:relative;transition:all 0.2s ease}
.skill-competencies input[type="checkbox"]:checked{background-color:var(--main-third);border-color:var(--main-fourth)}
.skill-competencies input[type="checkbox"]:checked::after{content:'✓';position:absolute;top:-2px;left:2px;color:var(--text-light);font-weight:bold;font-size:14px}

/* Logiciels connus */
.software-showcase{margin:2rem auto}
.software-showcase>h2{margin-top:0;color:var(--text-dark)}
.software-intro{margin-bottom:1.5rem}
.software-category{margin-top:1.75rem}
.software-category h3{
    margin:0 0 .8rem;
    padding-bottom:.4rem;
    border-bottom:1px solid var(--main-fourth);
    color:var(--text-dark);
}
.software-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
    gap:1rem;
}
.software-card{
    display:flex;
    min-width:0;
    flex-direction:column;
    align-items:flex-start;
    gap:.55rem;
    padding:1rem;
    border:1px solid var(--main-fourth);
    border-radius:12px;
    background:linear-gradient(135deg,var(--main-second),var(--main-background));
    color:var(--text-dark);
    text-decoration:none;
    box-shadow:0 6px 16px rgba(0,0,0,.1);
    transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;
}
.software-card:visited{color:var(--text-dark)}
.software-card:hover,.software-card:focus-visible{
    color:var(--text-dark);
    text-decoration:none;
    transform:translateY(-3px);
    border-color:var(--main-fourth);
    box-shadow:0 10px 22px rgba(0,0,0,.16);
}
.software-logo{
    display:grid;
    width:52px;
    height:52px;
    place-items:center;
    border-radius:12px;
    background:rgba(255,255,255,.75);
    color:var(--main-fifth);
}
.software-logo img{
    width:36px;
    height:36px;
    object-fit:contain;
}
.software-fallback{
    font-weight:800;
    font-size:.95rem;
}
.software-name{
    font-weight:700;
    font-size:1.05rem;
}
.software-description{
    font-size:.9rem;
    line-height:1.5;
}

/* Responsive nav */
nav{display:flex;gap:0.5rem;justify-content:center}
nav>a{width:auto;flex:1;min-width:90px}
@media(max-width:700px){
    nav{flex-direction:column}
    nav>a{width:100%}
    .software-showcase{margin:1.5rem .5rem}
}
/*------------------------Menu-----------------------------------------------------*/
nav>a{
    text-align: center;
    padding: 1em 0;
    margin:0;
    background: linear-gradient(90deg,var(--main-third),var(--main-fourth)) !important;
    color: var(--text-light) !important;
    font-weight: bold;
    box-sizing: border-box;
    border: 3px solid rgba(255,255,255,0.06) !important;
}
nav>a:hover{
    background: linear-gradient(90deg,var(--main-second),var(--main-third)) !important;
    border-color: rgba(0,0,0,0.12) !important;
    color: var(--text-dark) !important;
    transform: translateY(-3px);
    text-decoration: none;
}
.separation{
    padding: 3em;
}

/*--------------------------contents-------------------------------*/ 
#notesBrevet, #notesBac{
    border: none;
    background-color: var(--text-light);
}
#notesBrevet>button, #notesBac>button{
    max-width: 90vw;
    max-height: 30vh;
}
#notesBrevet>img, #notesBac>img{
    max-width: 90vw;
    max-height: 70vh;
}
pre{
    background-color: var(--main-background) !important;
    border: 3px solid var(--main-fifth);
    width: fit-content;
    box-shadow: inset 2px 2px 5px var(--main-fifth), inset -2px -2px 5px var(--main-fifth);
}
a{
    text-decoration: none;
    color: var(--main-link);
}
a:hover, a:visited:hover{
    color: var(--main-link-hover);
    text-decoration:underline;
}
a:visited{
    color: var(--main-link-visited);
}


/*---------------------footer-------------------------*/
footer{
    background-color: var(--main-fourth);
    display: flex;
    margin-top: 3em;
}
footer a, footer a:visited{
    color: var(--main-link-footer);
}
footer>.contact{
    flex: 1;
}
footer>.contact>.contact-item>p{
    display: none;
    margin: 0 .4em;
}
footer>.contact>.contact-item>a:hover{
    color: var(--main-background);
}
footer>.contact>.contact-item>a:hover + p,
footer>.contact>.contact-item>a:focus-visible + p{
    display: inline;
    color: var(--main-link-footer);
}
footer>.param{
    flex: 1;
}
/* Theme grid in footer to save space */
.theme-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(90px,1fr));gap:.4rem;align-items:center}

/* small responsive tweak */
@media(max-width:600px){
    .theme-grid{grid-template-columns:repeat(3,1fr)}
}

/*-----------------------------Animations-------------------------------------*/
/* Removed neon and multicolor animations and variables */

/* subtle transition when switching variant to improve UX */
html[data-variant="light"], html[data-variant="dark"]{
    transition: color .25s ease, background-color .25s ease, box-shadow .25s ease, border-color .25s ease;
}

/* Cards for formations page */
.card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;margin:1rem 0}
.card-link{color:inherit;text-decoration:none}
.card{perspective:1000px}
.card-inner{position:relative;width:100%;height:140px;transition:transform .6s;transform-style:preserve-3d;border-radius:12px}
.card-front,.card-back{position:absolute;inset:0;border-radius:12px;backface-visibility:hidden;display:flex;align-items:center;justify-content:center;padding:1rem;box-shadow:0 8px 20px rgba(0,0,0,0.12)}
.card-front{background:linear-gradient(90deg,var(--main-third),var(--main-fourth));color:var(--text-light);font-weight:700}
.card-front .card-title{padding:0 0.5rem;text-align:center}
.card-back{background:linear-gradient(135deg,var(--main-second),var(--main-background));color:var(--text-dark);transform:rotateY(180deg);border:2px solid rgba(0,0,0,0.04);font-size:0.95rem}
.card:hover .card-inner,.card:focus .card-inner{transform:rotateY(180deg)}

.section-card{
    max-width: 980px;
    margin: 2rem auto;
    padding: 1.5rem;
    border: 1px solid var(--main-fourth);
    border-radius: 16px;
    background: linear-gradient(135deg, var(--main-second), var(--main-background));
    box-shadow: 0 12px 30px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.35);
    color: var(--text-dark);
    line-height: 1.7;
}
.section-card h4{
    margin-top: 0;
    color: var(--text-dark);
}
.project-section{
    scroll-margin-top: 1rem;
}
.back-to-top{
    display: block;
    width: fit-content;
    margin: .75rem auto 2rem;
    color: var(--main-link);
    font-size: .9rem;
}
.back-to-top:hover{
    color: var(--main-link-hover);
}

@media(max-width:700px){
    .card-inner{height:120px}
    .section-card{margin: 1.5rem .5rem;padding: 1rem}
}

/* Popover / modal styling for popovertarget/popover elements */
button[popovertarget], .theme-btn{
    appearance:none;
    cursor:pointer;
    padding:.5rem .7rem;
    border-radius:10px;
    border:0;
    background:linear-gradient(90deg,var(--main-third),var(--main-fourth));
    color:var(--text-light);
    font-weight:700;
    box-shadow:0 6px 18px rgba(0,0,0,0.12);
    transition:transform .2s ease, box-shadow .2s ease;
}
button[popovertarget]:hover, .theme-btn:hover{transform:translateY(-4px);box-shadow:0 10px 30px rgba(0,0,0,0.18)}
button[popovertarget]:active, .theme-btn:active{transform:translateY(0)}
button[popovertarget]:focus, .theme-btn:focus{outline:3px solid rgba(0,0,0,0.08)}

/* Default hidden; visible when given .show or [open] or :target for flexibility */
[popover]{
    display:none;
}
[popover].show,[popover][open], [popover]:target{
    display:flex;
    flex-direction:column;
    justify-content:flex-start;
    align-items:center;
    position:fixed;
    left:50%;top:2rem;bottom:2rem;transform:translateX(-50%);
    z-index:1200;
    width:90vw;
    max-width:1000px;
    max-height:calc(100vh - 4rem);
    overflow:hidden;
    padding:1.5rem;
    box-sizing:border-box;
    border-radius:14px;
    background:linear-gradient(180deg, var(--main-background), color-mix(in srgb, var(--main-background) 92%, black 2%));
    color:var(--text-dark);
    border:2px solid var(--main-fourth);
    box-shadow:0 28px 70px rgba(0,0,0,0.35);
}

[popover] img{
    flex:1 1 auto;
    min-height:0;
    width:100%;
    height:auto;
    max-height:calc(100% - 4.5rem);
    object-fit:contain;
    display:block;
    margin:0 0 1rem;
    border-radius:10px;
    border:1px solid rgba(0,0,0,0.08);
    cursor:zoom-in;
    transition:transform .25s ease;
}
[popover] img:hover{transform:scale(1.02)}
[popover] img:active{transform:scale(1.05)}
[popover] p{margin:0 0 .75rem;color:var(--text-dark);line-height:1.6}

/* Make close buttons inside popovers match theme buttons */
[popover] button[popovertarget]{
    display:inline-block;
    margin-top:auto;
}

/* Timeline experience page */
.timeline{
    position:relative;
    display:grid;
    gap:1.5rem;
    padding:1rem 0;
}
.timeline::before{
    content:'';
    position:absolute;
    top:0;
    bottom:0;
    left:50%;
    width:2px;
    background:rgba(100,100,100,0.18);
    transform:translateX(-50%);
}
.timeline-item{
    position:relative;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
    gap:1.5rem;
    align-items:start;
    opacity:0;
    transform:translateY(24px);
    transition:opacity .35s ease,transform .35s ease;
}
.timeline-item.visible{
    opacity:1;
    transform:translateY(0);
}
.timeline-item:nth-child(odd) .timeline-content{
    grid-column:1 / 2;
    justify-self:end;
}
.timeline-item:nth-child(even) .timeline-content{
    grid-column:3 / 4;
    justify-self:start;
}
.timeline-marker{
    grid-column:2 / 3;
    position:relative;
    display:flex;
    justify-content:center;
    align-items:flex-start;
}
.timeline-dot{
    width:1rem;
    height:1rem;
    border-radius:50%;
    background:var(--main-third);
    box-shadow:0 0 0 10px rgba(255,255,255,0.12);
}
.timeline-content{
    grid-column:1 / 4;
    width:min(540px,calc(50vw - 4rem));
}
.timeline-card{
    position:relative;
    display:flex;
    flex-direction:column;
    gap:1rem;
    background:rgba(255,255,255,0.72);
    backdrop-filter:blur(16px);
    border:1px solid rgba(255,255,255,0.4);
    box-shadow:0 18px 40px rgba(0,0,0,0.08);
    border-radius:16px;
    padding:1.25rem;
    transition:transform .3s ease,border-color .3s ease,box-shadow .3s ease;
}
html[data-variant="dark"] .timeline-card{
    background:rgba(18,28,42,0.84);
    border:1px solid rgba(255,255,255,0.08);
}
.timeline-card:hover{
    transform:translateY(-4px);
    border-color:var(--main-third);
    box-shadow:0 24px 50px rgba(0,0,0,0.16);
}
.timeline-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:1rem;
}
.timeline-header h3{
    margin:0;
    font-size:1.2rem;
}
.timeline-date{
    display:inline-flex;
    align-items:center;
    padding:.25rem .75rem;
    border-radius:999px;
    background:rgba(0,0,0,0.06);
    color:var(--text-dark);
    font-size:.85rem;
}
html[data-variant="dark"] .timeline-date{
    background:rgba(255,255,255,0.08);
    color:var(--text-light);
}
.timeline-summary{
    margin:0;
    color:var(--text-dark);
    line-height:1.6;
}
html[data-variant="dark"] .timeline-summary{
    color:var(--text-light);
}
.timeline-toggle{
    appearance:none;
    border:none;
    background:var(--main-third);
    color:var(--text-light);
    padding:.75rem 1rem;
    border-radius:999px;
    font-weight:700;
    cursor:pointer;
    align-self:flex-start;
    transition:transform .25s ease,box-shadow .25s ease,background .25s ease;
}
.timeline-toggle:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 18px rgba(0,0,0,0.12);
}
.timeline-details{
    max-height:0;
    overflow:hidden;
    opacity:0;
    transition:max-height .35s ease,opacity .35s ease;
}
.timeline-details.open{
    opacity:1;
    max-height:1200px;
}
.timeline-details p,
.timeline-details ul{
    margin:0 0 .75rem;
    color:var(--text-dark);
    line-height:1.6;
}
html[data-variant="dark"] .timeline-details p,
html[data-variant="dark"] .timeline-details ul{
    color:var(--text-light);
}
.timeline-details ul{
    padding-left:1.2rem;
}
.timeline-details a{
    color:var(--main-link);
    text-decoration:none;
    font-weight:700;
}
.timeline-details a:hover{
    text-decoration:underline;
    color:var(--main-link-hover);
}
@media(max-width:900px){
    .timeline::before{left:1rem;}
    .timeline-item{
        grid-template-columns:auto 1fr;
    }
    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content{
        grid-column:2 / 3;
        justify-self:start;
    }
    .timeline-content{
        width:auto;
    }
}
@media(max-width:600px){
    .timeline{
        gap:1rem;
    }
    .timeline-card{
        padding:1rem;
    }
    .timeline-header{
        flex-direction:column;
        align-items:flex-start;
    }
}

/* Backdrop for better readability when popover open (uses sibling overlay element if present) */
.popover-backdrop{position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:1100;display:none}
.popover-backdrop.show{display:block}

@media(max-width:600px){
    [popover].show,[popover][open],[popover]:target{padding:.75rem;border-radius:10px}
}