/* =========================================================================
   CV NEXT — Blog (server-rendered) stylesheet.
   Self-contained so the blog renders correctly whether the backend runs alone
   (local dev) or in the prod image. The :root tokens below are a deliberate copy
   of frontend/src/index.css — keep the two in sync if the brand palette changes.
   Aesthetic: bone paper, ink, one signal red. Fraunces / Hanken / IBM Plex Mono.
   ========================================================================= */

:root {
    --paper: #ece4d6;
    --paper-2: #e4dac8;
    --paper-3: #f3ede1;
    --ink: #1a1714;
    --ink-soft: #4a4338;
    --ink-mute: #837866;
    --ink-faint: #a89c87;

    --signal: #d8381a;
    --signal-deep: #b32c12;
    --ochre: #b07d1d;
    --blue-ink: #284b8c;

    --rule: rgba(26, 23, 20, 0.16);
    --rule-strong: rgba(26, 23, 20, 0.32);
    --rule-faint: rgba(26, 23, 20, 0.08);

    --display: 'Fraunces', 'Times New Roman', serif;
    --body: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
    --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--paper);
}

body.bl {
    margin: 0;
    min-height: 100svh;
    color: var(--ink);
    font-family: var(--body);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(216, 56, 26, 0.05), transparent 60%),
        radial-gradient(100% 70% at 0% 100%, rgba(40, 75, 140, 0.045), transparent 55%),
        var(--paper);
}

::selection {
    background: var(--signal);
    color: var(--paper-3);
}

a {
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Masthead ---------------------------------------------------------- */
.bl-mast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.4rem 1.6rem;
    border-bottom: 1px solid var(--rule);
}

.bl-mast__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.bl-mast__mark {
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border: 1.4px solid var(--ink);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.bl-mast__name {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.bl-mast__nav {
    display: flex;
    gap: 1.2rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.bl-mast__nav a {
    color: var(--ink-mute);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.bl-mast__nav a:hover {
    color: var(--signal);
}

/* ---- Layout ------------------------------------------------------------ */
.bl-wrap {
    max-width: 56rem;
    margin: 0 auto;
    padding: 2.6rem 1.6rem 4rem;
}

.bl-kicker {
    margin: 0 0 0.6rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--signal);
}

.bl-hero {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 2rem;
}

.bl-hero--center {
    text-align: center;
    border-bottom: 0;
}

.bl-hero__title {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.04;
    letter-spacing: -0.01em;
}

.bl-hero__lede {
    margin: 1rem 0 0;
    max-width: 40rem;
    color: var(--ink-soft);
    font-size: 1.05rem;
    line-height: 1.6;
}

/* ---- Tag cloud + tags -------------------------------------------------- */
.bl-tagcloud,
.bl-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 2rem;
    padding: 0;
}

.bl-tags {
    margin: 0.8rem 0 0;
}

.bl-tagcloud a,
.bl-tags a {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: var(--paper-3);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-mute);
    text-decoration: none;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.bl-tagcloud a:hover,
.bl-tags a:hover {
    border-color: var(--signal);
    color: var(--signal);
}

/* ---- Post list --------------------------------------------------------- */
.bl-list {
    display: grid;
    gap: 2.2rem;
}

.bl-card {
    padding-bottom: 2.2rem;
    border-bottom: 1px solid var(--rule-faint);
}

.bl-card:last-child {
    border-bottom: 0;
}

.bl-card__link {
    text-decoration: none;
}

.bl-card__title {
    margin: 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.12;
    transition: color 0.2s var(--ease);
}

.bl-card__link:hover .bl-card__title {
    color: var(--signal);
}

.bl-card__excerpt {
    margin: 0.7rem 0 0;
    color: var(--ink-soft);
    line-height: 1.6;
}

.bl-card__meta,
.bl-post__meta {
    margin-top: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--ink-mute);
}

.bl-dot {
    color: var(--ink-faint);
}

.bl-empty {
    color: var(--ink-mute);
    font-family: var(--mono);
    font-size: 0.85rem;
}

/* ---- Pager ------------------------------------------------------------- */
.bl-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.78rem;
}

.bl-pager__link {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1.4px solid var(--signal);
    padding-bottom: 1px;
}

.bl-pager__link:hover {
    color: var(--signal);
}

.bl-pager__pos {
    color: var(--ink-mute);
    letter-spacing: 0.08em;
}

/* ---- Single post ------------------------------------------------------- */
.bl-post__head {
    padding-bottom: 1.6rem;
    margin-bottom: 1.8rem;
    border-bottom: 1px solid var(--rule);
}

.bl-post__title {
    margin: 0.4rem 0 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.bl-post__cover {
    margin: 0 0 2rem;
}

.bl-post__cover img {
    width: 100%;
    height: auto;
    border: 1px solid var(--rule);
    border-radius: 2px;
}

.bl-post__foot {
    margin-top: 3rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.78rem;
}

.bl-post__foot a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1.4px solid var(--signal);
}

/* ---- Prose (the rendered article body) --------------------------------- */
.bl-prose {
    font-size: 1.08rem;
    line-height: 1.72;
    color: var(--ink);
    max-width: 40rem;
}

.bl-prose > * + * {
    margin-top: 1.2rem;
}

.bl-prose h2,
.bl-prose h3,
.bl-prose h4 {
    font-family: var(--display);
    font-weight: 600;
    line-height: 1.2;
    margin-top: 2.4rem;
}

.bl-prose h2 {
    font-size: 1.7rem;
}

.bl-prose h3 {
    font-size: 1.35rem;
}

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

.bl-prose strong {
    font-weight: 700;
}

.bl-prose ul,
.bl-prose ol {
    padding-left: 1.4rem;
}

.bl-prose li + li {
    margin-top: 0.35rem;
}

.bl-prose blockquote {
    margin: 1.6rem 0;
    padding: 0.4rem 0 0.4rem 1.2rem;
    border-left: 3px solid var(--signal);
    color: var(--ink-soft);
    font-style: italic;
}

.bl-prose img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--rule);
    border-radius: 2px;
}

.bl-prose figure {
    margin: 1.6rem 0;
}

.bl-prose figcaption {
    margin-top: 0.5rem;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-mute);
}

.bl-prose hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 2.4rem 0;
}

.bl-prose code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: var(--paper-2);
    border: 1px solid var(--rule-faint);
    border-radius: 2px;
    padding: 0.1rem 0.3rem;
}

.bl-prose pre {
    overflow-x: auto;
    background: #211d18;
    color: #e9e0cf;
    border-radius: 2px;
    border: 1px solid var(--ink);
    box-shadow: 5px 5px 0 var(--rule);
    padding: 1rem 1.1rem;
    line-height: 1.55;
}

.bl-prose pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.84rem;
    color: inherit;
}

.bl-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.bl-prose th,
.bl-prose td {
    border: 1px solid var(--rule);
    padding: 0.5rem 0.7rem;
    text-align: left;
}

.bl-prose th {
    background: var(--paper-2);
    font-family: var(--mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- highlight.js theme (dossier palette, dark code surface) ------------ */
.hljs-comment,
.hljs-quote {
    color: #9b9180;
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in,
.hljs-name {
    color: #ff7a5c;
}

.hljs-string,
.hljs-attr,
.hljs-template-variable,
.hljs-addition {
    color: #d8b86a;
}

.hljs-number,
.hljs-literal,
.hljs-type {
    color: #8fb3e0;
}

.hljs-title,
.hljs-section,
.hljs-function .hljs-title {
    color: #f3ede1;
    font-weight: 600;
}

.hljs-attribute,
.hljs-variable,
.hljs-meta {
    color: #c9a8e0;
}

.hljs-deletion {
    color: #ff7a5c;
}

/* ---- Footer ------------------------------------------------------------ */
.bl-foot {
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.8rem 1.6rem 2.6rem;
    border-top: 1px solid var(--rule);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1.2rem;
    font-size: 0.8rem;
    color: var(--ink-mute);
}

.bl-foot__mono {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.bl-foot a {
    color: var(--ink-mute);
    text-decoration: none;
    border-bottom: 1px solid var(--signal);
}

@media (max-width: 600px) {
    .bl-wrap {
        padding: 2rem 1.2rem 3rem;
    }

    .bl-mast {
        padding: 1.1rem 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
