:root {
    --bg-color: #f4f4f4;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --accent: #000000;
    --line-color: rgba(0, 0, 0, 0.1);
    --sidebar-width: 280px;
    --font-serif: "Georgia", "Times New Roman", serif;
    --font-sans: "Helvetica Neue", "Arial", sans-serif;
    --transition-speed: 0.6s;
}

[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --text-primary: #e0e0e0;
    --text-secondary: #aaaaaa;
    --accent: #ffffff;
    --line-color: rgba(255, 255, 255, 0.1);
}


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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow: hidden;
    transition: background-color var(--transition-speed) cubic-bezier(0.22, 1, 0.36, 1),
                color var(--transition-speed) ease;
    animation: pageFadeIn 1s ease-out;
}

@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

main a {
    color: #0056b3; 
    text-decoration: underline;
    text-underline-offset: 3px;
}

:root[data-theme="dark"] main a {
    color: #64b5f6;
    text-decoration-color: rgba(100, 181, 246, 0.4);
}

:root[data-theme="dark"] main a:hover {
    color: #9be7ff;
}

.layout {
    display: flex;
    height: 100vh;
}

#background-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.sidebar {
    width: var(--sidebar-width);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid transparent;
    z-index: 10;
}

.identity h1 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.logo-link {
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo-link:hover { opacity: 0.6; }

nav ul { list-style: none; margin-top: 2rem; }
nav li { margin-bottom: 0.8rem; }

nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: color 0.3s ease;
    position: relative;
}

nav a:hover, nav a.active {
    color: var(--text-primary);
}

nav a.active::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--text-primary);
    border-radius: 50%;
}

.controls {
    margin-top: auto;
    padding-top: 2rem;
}

.secret-dot {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    color: var(--text-secondary) !important;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.9s ease;
}

.secret-dot:hover {
    opacity: 0.8;
}

#theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    width: 22px; height: 22px;
    position: relative;
    padding: 0;
    transition: color 0.3s ease;
}

#theme-toggle:hover { color: var(--text-secondary); }

#theme-toggle .icon {
    position: absolute;
    top: 0; left: 0;
    width: 70%; height: 70%;
    transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.4s ease;
}

.sun-icon { opacity: 0; transform: rotate(90deg) scale(0.5); }
.moon-icon { opacity: 1; transform: rotate(0) scale(1); }

:root[data-theme="dark"] .sun-icon { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="dark"] .moon-icon { opacity: 0; transform: rotate(-90deg) scale(0.5); }

main {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding: 4rem 6rem;
    scroll-behavior: smooth;
}

.section {
    position: absolute;
    top: 4rem; left: 6rem; right: 6rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    max-width: 700px;
}

.section.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#home {
    max-width: 1050px;
}

/* Experience Wide Layout */
.experience-wide {
    max-width: none;
    right: 6rem;
}

/* Art and Writing Wide Layout */
#art, #writing {
    max-width: none;
    right: auto;
}

.experience-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: stretch;
}

.experience-col {
    display: flex;
    flex-direction: column;
    min-height: 40vh;
}

.experience-col .subsection-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.experience-col .edu-block {
    flex: 1;
}

.experience-col .edu-header {
    margin-bottom: 0;
}

.experience-col .school {
    margin: 1px 0 3px 0;
    line-height: 1.2;
}

.experience-col .narrative {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.2;
}

@media (max-width: 1000px) {
    .experience-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

h2 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

h3 {
    font-family: var(--font-sans);
    font-weight: 500;
    margin-top: 1.5rem;
    font-size: 1.1rem;
}

p {
    margin-bottom: 1.2rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 65ch;
}

.edu-block {
    margin-bottom: 25px;
    max-width: 800px;
}

.experience-col .edu-block {
    margin-bottom: 0px;
    padding-bottom: 8px;
}

.edu-header {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.edu-header h3 {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
    color: var(--text-primary);
}

.edu-header .period {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.05em;
}

.school {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-primary); 
    margin: 4px 0 12px 0;
}

.edu-details {
    margin-left: 0;
    position: relative;
}

.degree {
    font-family: var(--font-serif);
    font-style: normal;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 1.05rem;
    line-height: 1.4;
    transition: opacity 0.3s ease;
}

.narrative {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.skills {
    font-family: var(--font-sans);
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9rem;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.edu-block:hover .skills {
    opacity: 1;
}

.edu-block:hover .degree {
    opacity: 0;
}

.btn-elegant {
    display: inline-block;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    text-decoration: none;
    border-radius: 2px;
    transition: all 0.3s ease;

    /* Mode Clair par défaut */
    background-color: transparent; 
    color: var(--text-primary); 
    border: 1px solid var(--line-color);
    font-weight: 400;
}

[data-theme="dark"] a.btn-elegant {
    background-color: #ffffff;
    color: #000000 !important; /* Force le noir par-dessus le bleu */
    border-color: #ffffff;
    font-weight: 500;
}

.btn-elegant:hover {
    transform: translateY(-2px);
    background-color: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
}

[data-theme="dark"] a.btn-elegant:hover {
    background-color: #e0e0e0;
    color: #000000 !important;
}

.writing-block { margin-bottom: 2.5rem; }

.subsection-title {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--line-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.blog-list { list-style: none; padding: 0; }

.blog-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--line-color);
    padding: 1rem 0;
    transition: padding-left 0.3s ease;
}

.blog-list li:hover { padding-left: 10px; }

.blog-list a {
    text-decoration: none;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.blog-list .date {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.gallery-container {
    margin-top: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.frame {
    position: relative;
    width: 100%;
    height:55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    background-color: transparent;
}

.frame img {
    max-height: 100%; max-width: 100%;
    width: auto; height: auto;
    display: block;
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,0.3);
}

.frame img.fade-out { opacity: 0; }

.art-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-primary) !important;
    cursor: pointer;
    padding: 40px 20px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.frame:hover .art-nav { opacity: 1; }
.art-nav:hover { transform: translateY(-50%) scale(1.2); }
.prev { left: 5%; }
.next { right: 5%; }

.art-info {
    width: 100%; max-width: 600px;
    display: flex; align-items: flex-start;
    border-top: 1px solid var(--line-color);
    padding-top: 1rem;
}

.art-counter {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 2rem;
    min-width: 50px;
}

.art-text h3 {
    margin-top: 0; margin-bottom: 0.5rem;
    font-family: var(--font-serif);
    font-size: 1.1rem;
}

.art-text p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.date {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.prose p {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.2;
}

.git-status-section {
    opacity: 0.6;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-family: "Courier New", monospace;
}

#scroll-top-btn {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 50px; height: 50px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: var(--bg-color);
    border: none; cursor: pointer;
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#scroll-top-btn.visible {
    opacity: 1; pointer-events: auto; transform: translateY(0);
}

#scroll-top-btn:hover { transform: translateY(-5px); }

.hidden { display: none; }
.nav-back {
    background: none; border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    cursor: pointer;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    padding: 0;
}
.nav-back:hover { color: var(--text-primary); text-decoration: underline; }
.typst-container {
    width: 100%; max-width: 850px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.35);
    padding: 2rem;
    border-radius: 2px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: filter 0.3s ease;
}
#typst-viewer { width: 100%; height: auto; min-height: 500px; display: block; }
:root[data-theme="dark"] .typst-container { filter: brightness(0.9); }

.pdf-download-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}
.pdf-download-btn {
    display: inline-block;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    text-decoration: none;
    border-radius: 2px;
    transition: all 0.3s ease;

    /* Mode Clair par défaut */
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--line-color);
    font-weight: 400;
}

[data-theme="dark"] .pdf-download-btn {
    background-color: #ffffff;
    color: #000000 !important;
    border-color: #ffffff;
    font-weight: 500;
}

.pdf-download-btn:hover {
    transform: translateY(-2px);
    background-color: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
}

[data-theme="dark"] .pdf-download-btn:hover {
    background-color: #e0e0e0;
    color: #000000 !important;
}


/* Home Layout */
.home-layout {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
}

.home-content {
    flex: 1;
    min-width: 0;
}

.manifesto-visual {
    width: clamp(250px, 40%, 450px);
    flex-shrink: 0;
    opacity: 1;
    padding-top: 4rem;
    margin-left: -2rem;
}

.manifesto-visual img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

@media (max-width: 1000px) {
    .home-layout {
        flex-direction: column;
    }
    .manifesto-visual {
        display: none;
    }
}

/* Mini Timeline - Manifesto */
.timeline-mini {
    margin-top: 3rem;
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 540px;
    position: relative;
    margin-bottom: 3rem;
}

.timeline-mini::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--line-color);
}

.timeline-line {
    font-family: var(--font-serif);
    cursor: pointer;
}

.timeline-line .age {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}

.timeline-line .moment {
    position: absolute;
    top: 4.5rem;
    left: 0;
    right: 0;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
}

.timeline-line:hover .moment {
    opacity: 1;
}

.timeline-line:hover .age {
    opacity: 0.5;
}

/* Memento Mori - Secret Page */
.memento-section {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    background-color: transparent;
    z-index: 50;
}

.memento-text {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 300;
    font-style: italic;
    color: var(--text-secondary) !important;
    letter-spacing: 0.15em;
    opacity: 0.7;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.memento-text:hover {
    opacity: 1;
}

/* Hide sidebar when memento is active */
body.memento-mode .sidebar {
    opacity: 0;
    pointer-events: none;
}

/* Keep sidebar visible and clickable on contact (but not memento) */
body.memento-mode:has(#contact.active) .sidebar {
    opacity: 1;
    pointer-events: auto;
    z-index: 100;
}

body.memento-mode main {
    padding: 0;
}


/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.3s ease;
    z-index: 100;
    padding: 0;
    font-weight: 400;
}

.sound-toggle:hover {
    opacity: 1;
}

/* Timer Styles */
.memento-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.memento-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.timer-display {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 8rem;
    font-variant-numeric: tabular-nums;
    min-width: 100px;
    transition: opacity 0.3s ease;
}

.timer-controls {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.timer-btn {
    padding: 6px 16px;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 400;
    opacity: 0.7;
}

.timer-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

.timer-btn-primary {
    color: var(--text-secondary);
    opacity: 0.7;
}

.timer-btn-primary:hover {
    opacity: 1;
}

.timer-btn-primary.paused {
    opacity: 0.5;
}

.timer-add-time {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.8rem;
}

.timer-add-btn {
    padding: 5px 12px;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 400;
    opacity: 0.6;
}

.timer-add-btn:hover {
    opacity: 1;
}

[data-theme="dark"] .timer-btn,
[data-theme="dark"] .timer-add-btn {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Contact Link - Mini */
.contact-link-wrapper {
    display: flex;
    justify-content: space-evenly;
    margin-top: 4.0rem;
    max-width: 540px;
}

.contact-link {
    text-decoration: underline;
    text-underline-offset: 3px;
    color: var(--text-secondary) !important;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.contact-link:hover {
    opacity: 1;
    color: var(--text-secondary) !important;
}

/* Contact Section - Memento Style */
.contact-section {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    background-color: transparent;
    z-index: 50;
}

.contact-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.contact-text {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 300;
    font-style: italic;
    color: var(--text-secondary) !important;
    letter-spacing: 0.05em;
    opacity: 0.7;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.contact-text:hover {
    opacity: 1;
}

.contact-home {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    color: var(--text-secondary) !important;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    margin-top: 2rem;
    cursor: pointer;
}

.contact-home:hover {
    opacity: 0.9;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    margin-top: 1.5rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line-color);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.project-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
}

.project-image {
    width: 100%;
    height: 350px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.05);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-name {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0 0 0.3rem 0;
    color: var(--text-primary);
}

.project-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 0.7rem 0;
    font-weight: 400;
}

.project-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
    line-height: 1.4;
    flex: 1;
}

.project-links {
    display: flex;
    gap: 0.7rem;
    margin-top: auto;
}

.project-link {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--line-color);
    border-radius: 2px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.project-link:hover {
    background-color: var(--text-primary);
    color: var(--bg-color);
}

#projects {
    max-width: none;
    right: 6rem;
}

@media (max-width: 768px) {
    .layout { flex-direction: column; height: 100vh; overflow: hidden; }

    .sidebar {
        width: 100%; height: auto;
        padding: 1rem 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--line-color);
        background-color: var(--bg-color);
        z-index: 100;
    }

    .identity { margin-bottom: 1rem; }
    
    nav { width: 100%; overflow-x: auto; padding-bottom: 5px; }
    nav ul { display: flex; gap: 20px; margin-top: 0.5rem; white-space: nowrap; }
    nav li { margin-bottom: 0; }
    nav a { font-size: 0.9rem; }
    nav a.active::before { left: 50%; top: 100%; transform: translateX(-50%); margin-top: 5px; }

    .controls {
        position: absolute; top: 1.5rem; right: 1.5rem;
        margin-top: 0; padding-top: 0;
    }
    #theme-toggle { width: 32px; height: 32px; }

    main { padding: 1.5rem; width: 100%; height: 100%; }
    
    .section { top: 1.5rem; left: 1.5rem; right: 1.5rem; width: auto; }
    
    h2 { font-size: 1.8rem; }
    p { font-size: 1rem; }

    .frame { height: 50vh; }
    .art-nav { opacity: 1; padding: 15px; background: rgba(125, 125, 125, 0.1); border-radius: 50%; }
    .prev { left: 0; }
    .next { right: 0; }

    #scroll-top-btn { bottom: 1.5rem; right: 1.5rem; width: 45px; height: 45px; }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}