:root {
    --blue: #74a8ff;
    --accent: #3b82f6;
    --muted: #777;
}

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

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    color: #333;
    background: linear-gradient(135deg, #74ebd5, #acb6e5);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

/* ---------- Mise en page : menu à gauche + contenu ---------- */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 650px) minmax(0, 1fr);
    column-gap: 24px;
    align-items: start;
    width: 100%;
}

.container {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: 650px;
    background: #fff;
    border-radius: 18px;
    padding: 40px 40px 10px 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .15);
}

/* ---------- Menu latéral (ordinateur) ---------- */
.sidebar {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    width: 250px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 18px 12px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, .15);
}
.sidebar ul { list-style: none; }
.sidebar a {
    display: block;
    padding: 10px 14px;
    margin-bottom: 4px;
    color: #333;
    text-decoration: none;
    border-radius: 10px;
    box-shadow: inset 4px 0 0 transparent;
    transition: background .2s, box-shadow .2s, color .2s;
}
.sidebar a:hover, .sidebar a:focus-visible {
    background: #eef7ff;
    outline: none;
}
.sidebar a.active {
    background: linear-gradient(135deg, rgba(116, 235, 213, .3), rgba(116, 168, 255, .3));
    box-shadow: inset 4px 0 0 var(--blue);
    color: #123c8a;
}
.side-home {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}
.side-home svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.side-title {
    margin: 16px 14px 8px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.side-name { display: block; font-weight: 600; line-height: 1.3; }
.side-desc {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar a.active .side-desc { color: #4a6aa8; }
.sidebar a.active .side-name { font-weight: 700; }

.side-hint {
    margin: 14px 14px 2px;
    font-size: .75rem;
    line-height: 1.7;
    color: var(--muted);
}
kbd {
    display: inline-block;
    min-width: 1.4em;
    padding: 0 .3em;
    text-align: center;
    font: inherit;
    font-size: .9em;
    color: #555;
    background: #f3f6fb;
    border: 1px solid #d9e0ec;
    border-bottom-width: 2px;
    border-radius: 4px;
}

/* ---------- Bouton Menu Mobile & Overlay ---------- */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    color: #333;
    border: 1px solid #d9e0ec;
    border-radius: 999px;
    font-weight: 600;
    font-size: .85rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: pointer;
}
.mobile-menu-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.mobile-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.mobile-overlay-content {
    background: #fff;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.mobile-overlay.open .mobile-overlay-content {
    transform: translateY(0);
}
.mobile-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 12px;
    font-weight: bold;
    font-size: 1.1rem;
}
.mobile-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}
.mobile-overlay nav {
    overflow-y: auto;
}
.mobile-overlay ul { list-style: none; }
.mobile-overlay a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 6px;
    color: #333;
    text-decoration: none;
    border-radius: 10px;
    background: #f8f9fb;
}
.mobile-overlay a.active {
    background: #eef7ff;
    color: #123c8a;
    font-weight: bold;
}
.mobile-home {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    background: #f3f6fb !important;
    margin-bottom: 10px !important;
}
.mobile-home svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* ---------- Footer ultra-discret ---------- */
.site-footer {
    margin-top: 10px;
    margin-bottom: 0;
    padding-top: 6px;
    padding-bottom: 2px;
    border-top: 1px solid #eee;
    text-align: center;
    font-size: .58rem;
    line-height: 1.2;
    color: rgba(35, 45, 80, .45);
}

/* ---------- Lien « aller au contenu » (clavier) ---------- */
.skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 10;
    padding: 8px 16px;
    color: #fff;
    background: #1f2328;
    border-radius: 999px;
    text-decoration: none;
    transition: top .2s;
}
.skip:focus { top: 12px; }
.container:focus { outline: none; }

h1 {
    color: var(--accent);
    text-align: center;
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 10px;
}

.subtitle { text-align: center; color: #666; margin-bottom: 35px; }

/* ---------- Frise chronologique ---------- */
.timeline {
    --date-w: 5.4rem;
    --g: 18px;
    list-style: none;
}

.timeline li {
    position: relative;
    display: flex;
    align-items: center;
    gap: calc(var(--g) * 2);
    padding: 9px 0;
}

.timeline li::before {
    content: "";
    position: absolute;
    left: calc(var(--date-w) + var(--g));
    top: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--blue);
    transform: translate(-50%, -50%);
    z-index: 1;
}

.timeline li::after {
    content: "";
    position: absolute;
    left: calc(var(--date-w) + var(--g));
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--blue);
    transform: translateX(-50%);
}
.timeline li:first-child::after { top: 50%; }
.timeline li:last-child::after { bottom: 50%; }
.timeline li:only-child::after { display: none; }

.timeline time {
    flex: 0 0 var(--date-w);
    text-align: right;
    font-size: .9rem;
    line-height: 1.3;
    color: var(--muted);
}

.timeline a {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 14px 18px;
    color: #333;
    text-decoration: none;
    background: #f8f9fb;
    border: 1px solid #e4e4e4;
    border-radius: 12px;
    transition: .25s;
}
.timeline a:hover, .timeline a:focus-visible {
    background: #eef7ff;
    border-color: #74ebd5;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
    outline: none;
}
.timeline strong { display: block; font-size: 1.1rem; }
.timeline span { display: block; margin-top: 2px; color: var(--muted); font-size: .9rem; }

/* ---------- Page d'un projet & Style des Liens (Discret / Moins voyant) ---------- */
.content p, .content ul, .content ol { margin-bottom: 1rem; }
.content ul, .content ol { padding-left: 1.5rem; }
.content li { margin-bottom: .35rem; }
.content h2 {
    font-size: 1.1rem;
    color: #222;
    margin: 1.6rem 0 .5rem;
    padding-left: 10px;
    border-left: 4px solid var(--blue);
}

.content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(59, 130, 246, 0.35);
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.content a:hover, .content a:focus-visible {
    color: var(--accent);
    text-decoration-color: var(--accent);
    outline: none;
}

.content code {
    padding: .1em .4em;
    background: #eef1f6;
    border-radius: 5px;
    font-family: Consolas, Menlo, monospace;
    font-size: .9em;
}
.content pre {
    overflow-x: auto;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #1a1a2e;
    color: #fff;
    border-radius: 8px;
    font-size: .9rem;
}
.content pre code { padding: 0; background: none; }
.content img, .content video, .content iframe,
.project-image {
    display: block;
    max-width: 100%;
    margin: 1rem 0;
    border-radius: 10px;
}

/* ---------- Boutons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.btn {
    --c1: #555;
    --c2: #333;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 999px;
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    text-decoration: none;
    background: linear-gradient(135deg, var(--c1), var(--c2));
    box-shadow: 0 4px 14px color-mix(in srgb, var(--c2) 35%, transparent);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s ease;
}
.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.07);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--c2) 40%, transparent);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.btn-site:hover svg { transform: translate(2px, -2px); }
.btn-download:hover svg { transform: translateY(2px); }

.btn-site     { --c1: #14a99a; --c2: #0b7f78; }
.btn-download { --c1: #4da3ff; --c2: #0069d9; }
.btn-github   { --c1: #4a4f57; --c2: #1f2328; }

/* ==========================================================
   AFFICHAGE RESPONSIVE (Breakpoint à 650px)
   ========================================================== */

/* MODE 2 : Intermédiaire (651px à 1200px) -> Sans menu latéral, avec dégradé bleu et contenu centré */
@media (max-width: 1200px) and (min-width: 651px) {
    .layout { display: block; max-width: 650px; margin: 0 auto; }
    .container { max-width: 650px; margin: 0 auto; border-radius: 18px; }
    .sidebar { display: none; }
    .mobile-menu-btn { display: inline-flex; }
}

/* MODE 3 : Petit appareil (<= 650px) -> Garde le dégradé bleu en fond, supprime les marges latérales */
@media (max-width: 650px) {
    body {
        padding: 0;
    }
    .layout { display: block; width: 100%; margin: 0; }
    .container {
        max-width: 100%;
        width: 100%;
        border-radius: 0 0 18px 18px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, .1);
        padding: 20px 16px 10px 16px;
    }
    .sidebar { display: none; }
    .mobile-menu-btn { display: inline-flex; }
}

@media (max-width: 600px) {
    .container { padding: 16px 14px 6px 14px; }
    h1 { font-size: 1.3rem; }
    .timeline { --date-w: 4.4rem; --g: 14px; }
    .timeline time { font-size: .8rem; }
    .timeline a { padding: 12px 14px; }
    .timeline strong { font-size: 1rem; }
    .timeline span { font-size: .8rem; }
    .buttons { flex-direction: column; }
    .btn { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .btn:hover { transform: none; }
}