/* ============================================================
   maximekwk.fr — portfolio infrastructure
   Écrit à la main. Une seule feuille, aucun JavaScript.

   Parti pris : la retenue. Une colonne, des filets d'un pixel
   plutôt que des ombres, un seul accent employé avec parcimonie,
   et rien qui bouge sans raison. Le contenu est le seul décor.
   ============================================================ */

:root {
    --bg:      #08090A;
    --surface: #0D0F11;
    --raised:  #111417;
    --line:    #191C20;
    --line-2:  #262A30;
    --text:    #98A0A8;
    --dim:     #666E76;
    --head:    #F0F2F4;
    --accent:  #8A9DFF;
    --live:    #3FB950;

    --measure: 46rem;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
    background: var(--bg);
    scroll-behavior: smooth;
    scroll-padding-top: 4.5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.95rem;
    line-height: 1.68;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
code {
    font-family: var(--mono);
    font-size: 0.86em;
    color: var(--head);
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.05em 0.35em;
}

::selection { background: var(--accent); color: var(--bg); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
    position: absolute;
    left: -9999px;
    top: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    color: var(--head);
    font-family: var(--mono);
    font-size: 0.78rem;
    z-index: 60;
}
.skip:focus { left: 0.75rem; }

.wrap {
    width: 100%;
    max-width: var(--measure);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* ---------------- Barre ---------------- */

.bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(8, 9, 10, 0.78);
    -webkit-backdrop-filter: blur(12px) saturate(1.5);
    backdrop-filter: blur(12px) saturate(1.5);
    border-bottom: 1px solid var(--line);
}

.bar-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 3.1rem;
}

.mark {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--head);
    border: 1px solid var(--line-2);
    border-radius: 5px;
    padding: 0.16rem 0.42rem;
    transition: border-color 0.16s var(--ease);
}
.mark:hover { border-color: var(--dim); }

.nav {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    font-size: 0.82rem;
}

.nav a { color: var(--dim); transition: color 0.16s var(--ease); }
.nav a:hover { color: var(--head); }

.nav-cta {
    color: var(--head) !important;
    border: 1px solid var(--line-2);
    border-radius: 5px;
    padding: 0.2rem 0.6rem;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.nav-cta:hover { background: var(--raised); border-color: var(--dim); }

/* ---------------- Hero ---------------- */

.hero { padding: 5rem 1.5rem 4rem; }

.avail {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--mono);
    font-size: 0.73rem;
    color: var(--dim);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    margin-bottom: 1.9rem;
}

.led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.14);
    flex-shrink: 0;
}

h1 {
    font-size: clamp(2rem, 5.6vw, 2.7rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.035em;
    color: var(--head);
    margin-bottom: 1.1rem;
}

.lede {
    font-size: 1.04rem;
    line-height: 1.64;
    max-width: 34rem;
    margin-bottom: 2rem;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.1rem;
    font-family: var(--mono);
    font-size: 0.78rem;
}

.links a {
    color: var(--head);
    border-bottom: 1px solid var(--line-2);
    padding-bottom: 1px;
    transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.links a:hover { color: var(--accent); border-color: var(--accent); }

/* Le fait est assez parlant pour ne pas avoir besoin d'être crié. */
.selfhost {
    font-family: var(--mono);
    font-size: 0.76rem;
    line-height: 1.66;
    color: var(--dim);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 2px solid var(--live);
    border-radius: 0 7px 7px 0;
    padding: 0.85rem 1rem;
    margin-top: 2.5rem;
}

.selfhost a {
    color: var(--head);
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
}
.selfhost a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- Sections ---------------- */

.sec { padding-block: 3.5rem; border-top: 1px solid var(--line); }

.head { margin-bottom: 2.25rem; }

.kicker {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--dim);
    margin-bottom: 0.55rem;
}

h2 {
    font-size: 1.32rem;
    font-weight: 600;
    letter-spacing: -0.026em;
    color: var(--head);
    line-height: 1.25;
}

.sub { font-size: 0.88rem; color: var(--dim); margin-top: 0.45rem; }

/* ---------------- Réalisations ---------------- */

.cases { display: flex; flex-direction: column; gap: 2.5rem; }
.cases-tight { gap: 2rem; }

/* Le résultat d'abord : c'est la première chose qu'on cherche,
   autant la mettre là où le regard tombe. */
.outcome {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--head);
    font-weight: 500;
    border-left: 2px solid var(--accent);
    padding-left: 0.9rem;
    margin-bottom: 0.9rem;
}

.case h3 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.014em;
    color: var(--head);
    margin-bottom: 0.4rem;
}

.ctx { font-size: 0.9rem; margin-bottom: 0.85rem; }

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-family: var(--mono);
    font-size: 0.69rem;
}

.tags li {
    color: var(--dim);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0.12rem 0.45rem;
}

/* Le repli natif remplace la modale : pas une ligne de script,
   et ça reste navigable au clavier et indexable. */
details { margin-top: 0.9rem; }

summary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--dim);
    cursor: pointer;
    list-style: none;
    transition: color 0.16s var(--ease);
    user-select: none;
}

summary::-webkit-details-marker { display: none; }

summary::before {
    content: '+';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    line-height: 0.95rem;
    text-align: center;
    border: 1px solid var(--line-2);
    border-radius: 3px;
    font-size: 0.8rem;
}

details[open] summary::before { content: '−'; }
summary:hover { color: var(--head); }

.detail {
    margin-top: 0.9rem;
    padding: 0.95rem 1.05rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 0.88rem;
}

.detail p + p { margin-top: 0.75rem; }
.detail strong { color: var(--head); font-weight: 600; }

/* ---------------- Services ---------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr));
    gap: 0.7rem;
}

.svc {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.95rem 1.05rem;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.svc:hover { border-color: var(--line-2); background: var(--raised); }

.svc-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.4rem;
}

.svc h3 { font-size: 0.9rem; font-weight: 600; color: var(--head); letter-spacing: -0.01em; }
.svc p { font-size: 0.84rem; line-height: 1.58; }

.pill {
    font-family: var(--mono);
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.pill.on { color: var(--live); }

.pill.on::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 0.35rem;
    vertical-align: 1px;
}

/* ---------------- Schéma ---------------- */

/* La colonne de texte est calibrée pour la lecture ; un schéma
   n'a pas la même contrainte. Il déborde donc de la mesure et se
   recentre sur la page, plutôt que d'être comprimé ou tronqué. */
.diagram {
    width: min(56rem, calc(100vw - 3rem));
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 1.1rem;
}

/* Un schéma large déborde : il défile dans sa propre boîte
   plutôt que de casser la largeur de la page. */
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 720px; max-width: 820px; height: auto; margin-inline: auto; }

.d-link { fill: none; stroke: var(--line-2); stroke-width: 1.2; }
.d-vpn { stroke: var(--accent); stroke-dasharray: 4 4; opacity: 0.75; }
.d-box rect { fill: var(--raised); stroke: var(--line-2); stroke-width: 1; }

.d-t text {
    fill: var(--head);
    font-family: var(--sans);
    font-size: 12px;
    text-anchor: middle;
}

.d-t .d-sm { fill: var(--dim); font-size: 10.5px; }

.d-t .d-vl {
    fill: var(--accent);
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
}

.d-tag {
    fill: var(--accent);
    font-family: var(--mono);
    font-size: 9.5px;
    text-anchor: start;
}

figcaption { font-size: 0.84rem; color: var(--dim); margin-top: 1rem; line-height: 1.6; }

/* ---------------- Stack ---------------- */

.stack { display: flex; flex-direction: column; }

.row {
    display: grid;
    grid-template-columns: 10.5rem 1fr;
    gap: 1rem;
    padding-block: 0.72rem;
    border-bottom: 1px solid var(--line);
}
.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; }

.row dt { font-family: var(--mono); font-size: 0.74rem; color: var(--dim); padding-top: 0.12rem; }
.row dd { font-size: 0.87rem; line-height: 1.66; }

/* ---------------- Parcours ---------------- */

.tl { display: flex; flex-direction: column; gap: 1.5rem; }
.tl li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; }

.when { font-family: var(--mono); font-size: 0.74rem; color: var(--dim); padding-top: 0.16rem; }

.tl h3 {
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--head);
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
}

.tl p { font-size: 0.87rem; }
.gloss { color: var(--dim); }

/* ---------------- Pied ---------------- */

.foot { padding-block: 3.5rem 4rem; border-top: 1px solid var(--line); }

.foot-lede { font-size: 0.95rem; max-width: 32rem; margin: 0.7rem 0 1.6rem; }

.foot .links { margin-bottom: 2.5rem; }

.colophon {
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.75;
    color: var(--dim);
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.colophon a { color: var(--text); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.colophon a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------- Écrans étroits ---------------- */

@media (max-width: 44rem) {
    .nav a[href="#architecture"],
    .nav a[href="#labo"] { display: none; }
}

@media (max-width: 34rem) {
    .hero { padding-top: 3.25rem; }
    .sec { padding-block: 2.75rem; }
    .nav { gap: 0.85rem; font-size: 0.78rem; }
    .nav a[href="#infra"] { display: none; }

    /* Étiquette au-dessus de la valeur : plus lisible qu'une
       grille à deux colonnes écrasée. */
    .row,
    .tl li { grid-template-columns: 1fr; gap: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ============================================================
   Relevé en direct
   Les chiffres viennent de ma sonde Uptime Kuma, assemblés dans
   la page par nginx (SSI) au moment de la requête. Le navigateur
   ne reçoit que du HTML : ni script, ni requête supplémentaire.
   ============================================================ */

:root { --warn: #D29922; --down: #F85149; }

.live {
    margin-top: 1.4rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 1.05rem 1.15rem 1.15rem;
}

.live-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.live-top h3 {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dim);
}

.live-top a {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text);
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
}
.live-top a:hover { color: var(--accent); border-color: var(--accent); }

.mons { display: flex; flex-direction: column; }

.mon {
    display: grid;
    grid-template-columns: 7.5rem minmax(4rem, 1fr) 3.6rem 3.9rem 6.2rem;
    align-items: center;
    gap: 0.9rem;
    padding-block: 0.66rem;
    border-bottom: 1px solid var(--line);
}
.mon:last-child { border-bottom: 0; }

.mon-name { font-size: 0.87rem; color: var(--head); font-weight: 500; }

/* preserveAspectRatio="none" : les barres s'étirent pour occuper
   la largeur disponible sans qu'on ait à la calculer. */
.spark { display: block; width: 100%; height: 18px; }

.b-up    { fill: var(--live); opacity: 0.55; }
.b-maint { fill: var(--warn); opacity: 0.8; }
.b-down  { fill: var(--down); }

.mon-num {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--head);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mon-ping { color: var(--dim); }

.mon-state {
    font-family: var(--mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: right;
    color: var(--live);
}

.mon-down .mon-state { color: var(--down); }
.mon-down .mon-name  { color: var(--down); }

.mons-foot {
    font-family: var(--mono);
    font-size: 0.7rem;
    line-height: 1.7;
    color: var(--dim);
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
}

.mons-down { border-top: 0; padding-top: 0; color: var(--warn); }

@media (max-width: 40rem) {
    /* Sur mobile la ligne à cinq colonnes ne tient pas : le nom
       et l'état passent au-dessus, la courbe occupe la largeur. */
    .mon {
        grid-template-columns: 1fr auto auto;
        grid-template-areas:
            "name  num  state"
            "spark spark spark";
        gap: 0.4rem 0.7rem;
        padding-block: 0.8rem;
    }
    .mon-name  { grid-area: name; }
    .mon-num   { grid-area: num; }
    .mon-ping  { display: none; }
    .mon-state { grid-area: state; }
    .spark     { grid-area: spark; margin-top: 0.15rem; }
}
