/*
 * BlackMesa Labs — one stylesheet, no build step.
 *
 * Two families with a job each. A serif carries what is written — titles,
 * standfirsts — and a neo-grotesque carries everything the interface says about
 * the text: dates, labels, navigation. The eye separates the two before reading
 * a word. IBM Plex Mono is reserved for anything that came out of a machine —
 * commands, versions, code — so monospace itself tells the reader this was not
 * written for them.
 *
 * The serif is set at 400 because that is the only weight it has, and that
 * turns out to be the point: a heading that does not shout sits better on a
 * cream ground than a bold one.
 *
 * Colour carries meaning: teal is the accent, amber marks what went wrong or is
 * unfinished. Nothing is coloured for decoration.
 */

:root {
    --paper:   #faf7f1;
    --surface: #f5f1e9;
    --ink:     #14181a;
    --muted:   #6b6558;
    --accent:  #0d6b63;
    --blue:    #1c3f8c;   /* survol des titres, uniquement */
    --warn:    #9c5510;
    --rule:    #e2ddd1;
    --chip:    #efe9dd;
    /* Surlignage du gras : un lavis posé sous la ligne. En clair il s'agit
       d'assombrir à peine le papier ; en sombre, surtout pas d'éclaircir le
       fond sous un texte déjà clair — le bandeau doit rester plus sombre que
       le texte, sinon le contraste s'effondre là où on voulait insister. */
    --mark:    rgba(13, 107, 99, .14);

    --serif:   "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
    --body:    "Archivo", "Helvetica Neue", Arial, sans-serif;
    --mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --wrap: 44rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:   #15130e;
        --surface: #1d1a14;
        --ink:     #ece7dc;
        --muted:   #9d9687;
        --accent:  #56b9ac;
        --blue:    #8aa8f2;
        --warn:    #dd9750;
        --rule:    #2e2a22;
        --chip:    #241f18;
        --mark:    rgba(86, 185, 172, .22);
    }
}

:root[data-theme="dark"] {
    --paper:   #15130e;
    --surface: #1d1a14;
    --ink:     #ece7dc;
    --muted:   #9d9687;
    --accent:  #56b9ac;
    --blue:    #8aa8f2;
    --warn:    #dd9750;
    --rule:    #2e2a22;
    --chip:    #241f18;
    --mark:    rgba(86, 185, 172, .22);
}

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 1.0625rem;
    line-height: 1.68;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding-inline: clamp(1rem, 5vw, 2rem);
}

a { color: inherit; }

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

/* ---------------------------------------------------------------- masthead */

.masthead { border-bottom: 1px solid var(--rule); }

.masthead-in {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem 1rem;
    flex-wrap: wrap;          /* le bandeau se replie plutôt que de déborder */
    padding-block: 1.1rem;
}

.masthead-nav {
    display: flex;
    align-items: baseline;
    gap: .55rem;
}

.lang {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .1em;
    color: var(--muted);
    text-decoration: none;
}
.lang:hover { color: var(--ink); }
.lang.is-current { color: var(--ink); font-weight: 500; }

/* Une langue dans laquelle l'article n'existe pas : affichée, mais inerte —
   plus honnête que de la masquer ou de renvoyer vers une page absente. */
.lang.is-missing { opacity: .35; cursor: default; }

.masthead-nav .feed { padding-left: .55rem; border-left: 1px solid var(--rule); }

.wordmark {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -.01em;
    text-decoration: none;
}

.feed {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
}
.feed:hover { color: var(--accent); }

/* ---------------------------------------------------------------- listing */

main.wrap { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

/* C'est le <h1> de la page d'accueil — les moteurs ont besoin qu'il en soit un —
   mais il se lit comme un chapeau. D'où la graisse normale, explicite : sans elle,
   le navigateur applique le gras des titres. */
.tagline {
    font-family: var(--serif);
    font-size: clamp(1.2rem, 2.6vw, 1.5rem);
    font-weight: 400;
    line-height: 1.45;
    color: var(--muted);
    font-style: italic;
    margin: 0 0 3rem;
    max-width: 34ch;
}

.posts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
}

.post-item { border-top: 1px solid var(--rule); }
.post-item:last-child { border-bottom: 1px solid var(--rule); }

.post-link {
    display: block;
    padding-block: 1.7rem;
    text-decoration: none;
}
/* Le survol d'un titre est la seule chose qui passe au bleu : il ne concurrence
   donc pas le sarcelle, qui reste la couleur des liens de texte. */
.post-link:hover .post-title,
.post-link:focus-visible .post-title { color: var(--blue); }

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .5rem;
    font-family: var(--display);
    font-weight: 600;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

.draft {
    color: var(--warn);
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: .05rem .35rem;
    letter-spacing: .08em;
}

.post-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.5rem, 3.6vw, 1.95rem);
    line-height: 1.16;
    letter-spacing: -.004em;
    margin: 0;
    text-wrap: balance;
    transition: color .15s;
}

.post-standfirst {
    margin: .6rem 0 0;
    color: var(--muted);
    max-width: 52ch;
}

/* ---------------------------------------------------------------- article */

.post-header { margin-bottom: 2.6rem; }

.post-header h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.2rem, 6.2vw, 3.5rem);
    line-height: 1.06;
    letter-spacing: -.006em;
    margin: .6rem 0 0;
    text-wrap: balance;
}

.standfirst {
    font-family: var(--serif);
    font-size: clamp(1.25rem, 2.7vw, 1.52rem);
    line-height: 1.42;
    color: var(--muted);
    font-style: italic;
    margin: 1rem 0 0;
    max-width: 44ch;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

/* Texte justifié, avec césure : sans elle, une colonne étroite se remplit de
   rivières blanches. Le `lang` de la page permet au navigateur de couper au bon
   endroit — c'est pour ça qu'il est posé sur <html>. Les titres, eux, ne sont
   jamais justifiés : ils se répartissent avec `text-wrap: balance`. */
.prose p,
.prose li {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.prose p { margin: 0 0 1.15rem; }

.prose h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.68rem;
    line-height: 1.22;
    letter-spacing: 0;
    margin: 2.8rem 0 1rem;
    text-wrap: balance;
}
.prose h2::before { content: "—"; color: var(--accent); margin-right: .5rem; font-weight: 500; }

.prose h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.32rem;
    margin: 2rem 0 .8rem;
}

.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.35rem; }
.prose li { margin-bottom: .62rem; }
.prose li::marker { color: var(--muted); }
.prose ol li::marker { font-family: var(--mono); font-size: .85em; }

.prose strong { font-weight: 700; }
.prose p strong {
    font-weight: 500;
    /* Le lavis ne monte qu'au tiers bas de la ligne : assez pour marquer, pas
       assez pour faire un pavé de couleur derrière la phrase. */
    background: linear-gradient(transparent 64%, var(--mark) 64%);
    padding-bottom: .04em;
}
.prose em { font-style: italic; color: var(--muted); }

.prose a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }

.prose code {
    font-family: var(--mono);
    font-size: .855em;
    background: var(--chip);
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: .06em .34em;
    overflow-wrap: anywhere;
}

.prose pre {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: .9rem;
    line-height: 1.55;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.prose blockquote {
    margin: 1.6rem 0;
    padding-left: 1.1rem;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}

.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.4rem; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--rule); }
.prose th { font-family: var(--mono); font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

.prose img { max-width: 100%; height: auto; }

.back {
    margin: 3.5rem 0 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: .78rem;
}
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--accent); }

/* ------------------------------------------------------------- crossover */

/* Un article « pointeur » ne recopie pas le REX : il le présente et y renvoie.
   Le texte intégral reste sur showmetherex.com, qui garde la balise canonique. */
.crossover {
    margin-top: 2.8rem;
    padding: 1.4rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--accent);
    border-radius: 3px;
}

.crossover-label {
    margin: 0 0 .5rem;
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--muted);
}

.crossover-link {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.08rem;
    color: var(--accent);
    text-decoration: none;
}
.crossover-link:hover { text-decoration: underline; text-underline-offset: .2em; }

.crossover-note {
    margin: .6rem 0 0;
    font-size: .92rem;
    color: var(--muted);
}

.elsewhere {
    color: var(--accent);
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: .05rem .35rem;
    letter-spacing: .08em;
}

/* Les tableaux sont le seul bloc qui peut dépasser un écran de téléphone :
   chacun défile dans son propre conteneur, la page ne glisse jamais de côté. */
.scroll { overflow-x: auto; margin: 0 0 1.4rem; }
.scroll table { margin: 0; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 34rem) {
    body { font-size: 1rem; }

    /* Sur une colonne étroite, la justification creuse des trous même avec la
       césure : on repasse en fer à gauche là où elle dessert la lecture. */
    .prose p,
    .prose li { text-align: left; }

    .tagline { margin-bottom: 2rem; }
    .post-link { padding-block: 1.35rem; }
    .crossover { padding: 1.15rem 1.2rem; }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
    border-top: 1px solid var(--rule);
    padding-block: 2rem 3rem;
    font-family: var(--mono);
    font-size: .72rem;
    line-height: 1.7;
    color: var(--muted);
}
.site-footer p { margin: 0 0 .3rem; }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
