/* ==========================================================================
   Blog — elenco articoli
   Impaginato a due colonne: a sinistra una barra fissa con testata e filtri,
   a destra un flusso editoriale. Niente griglia di schede tutte uguali: il
   primo articolo apre in grande, gli altri sono righe separate da un filetto.
   Token identici a it.simonerenzi.com.
   ========================================================================== */

@font-face {
    font-family: Inter; font-style: normal; font-weight: 300 900; font-display: swap;
    src: url(/fonts/inter-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: Inter; font-style: normal; font-weight: 300 900; font-display: swap;
    src: url(/fonts/inter-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --bg: #ffffff;
    --bg-alt: #f5f5f7;
    --bg-dark: #1d1d1f;
    --text: #1d1d1f;
    --text-2: #6e6e73;
    --accent: #0071e3;
    /* inchiostro per testo piccolo su fondo tenue: #0071e3 si ferma a 4.15:1 */
    --accent-ink: #0058b0;
    --border: rgba(0, 0, 0, 0.10);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --s-xs: 4px; --s-sm: 8px; --s-md: 16px; --s-lg: 24px;
    --s-xl: 32px; --s-2xl: 48px; --s-3xl: 64px; --s-4xl: 96px;

    --rail: 300px;      /* barra di sinistra */
    --gutter: 72px;     /* respiro fra barra e flusso */
    --w: 1240px;
    --nav-h: 68px;

    --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 9999px;
    --sh-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --sh-md: 0 4px 16px rgba(0,0,0,.08);
    --sh-lg: 0 10px 34px rgba(0,0,0,.13);
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --dur: 0.35s;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.125em; flex: none; }

/* --- Navigazione: pillola scura flottante, come sul CV ------------------- */
.nav {
    position: fixed; top: 14px; left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    width: calc(100% - 28px); max-width: var(--w);
}
.nav-inner {
    display: flex; align-items: center; gap: var(--s-lg);
    background: rgba(29, 29, 31, 0.94);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-radius: var(--r-full);
    padding: 10px 12px 10px 22px;
    box-shadow: var(--sh-md);
}
.nav-brand { font-weight: 700; color: #fff; letter-spacing: -0.02em; white-space: nowrap; }
.nav-brand span { color: #6ea8fe; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-link {
    color: rgba(255,255,255,0.82);
    font-size: 0.875rem; font-weight: 500;
    padding: 8px 14px; border-radius: var(--r-full);
    white-space: nowrap;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-langs {
    display: flex; align-items: center; gap: 4px;
    margin-left: var(--s-sm); padding-left: var(--s-sm);
    border-left: 1px solid rgba(255,255,255,0.16);
}
.nav-lang { font-size: 1rem; line-height: 1; padding: 6px; border-radius: var(--r-full); opacity: .45; transition: opacity var(--dur) var(--ease); }
.nav-lang.on, .nav-lang:hover { opacity: 1; }
.burger { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.burger span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; }
.burger span + span { margin-top: 4px; }

/* --- Impianto a due colonne ---------------------------------------------- */
.shell {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: var(--gutter);
    max-width: var(--w);
    margin: 0 auto;
    padding: calc(var(--nav-h) + var(--s-3xl)) var(--s-lg) var(--s-4xl);
}

/* --- Barra di sinistra: resta ferma mentre scorre il flusso -------------- */
.rail {
    position: sticky;
    top: calc(var(--nav-h) + var(--s-lg));
    align-self: start;
}
.eyebrow {
    font-size: 0.75rem; font-weight: 600;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-2);
}
.rail h1 {
    font-size: clamp(2.4rem, 1.9rem + 1.6vw, 3.4rem);
    font-weight: 900; letter-spacing: -0.045em; line-height: 1.02;
    /* i discendenti non devono essere tagliati */
    padding-bottom: 0.08em;
    margin: var(--s-md) 0 var(--s-md);
}
.lede { font-size: 0.9375rem; color: var(--text-2); line-height: 1.6; }

.filters {
    display: flex; flex-direction: column;
    margin-top: var(--s-2xl);
    border-top: 1px solid var(--border);
    padding-top: var(--s-md);
}
.filter {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-sm);
    padding: 9px 0;
    font-size: 0.9375rem; color: var(--text-2);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: color var(--dur) var(--ease), padding-left var(--dur) var(--ease);
}
.filter:last-child { border-bottom: 0; }
.filter:hover { color: var(--text); padding-left: 6px; }
.filter.on { color: var(--text); font-weight: 600; }
.filter .n { font-size: 0.75rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.filter.on .n { color: var(--accent-ink); }

/* --- Flusso degli articoli ----------------------------------------------- */
.stream { min-width: 0; }

.meta {
    display: flex; align-items: center; flex-wrap: wrap;
    column-gap: var(--s-sm); row-gap: var(--s-xs);
    font-size: 0.75rem; color: var(--text-2);
}
.meta > * { white-space: nowrap; }
.meta .cat { font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

/* Primo articolo: apre in grande, immagine sopra e testo sotto. */
.lead { margin-bottom: var(--s-2xl); }
.lead-shot {
    display: block; position: relative; overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: var(--r-xl);
    background: var(--bg-alt);
    box-shadow: var(--sh-lg);
    margin-bottom: var(--s-lg);
}
.lead-shot i {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    transition: transform 0.9s var(--ease);
}
.lead:hover .lead-shot i { transform: scale(1.03); }
.lead h2 {
    font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.6rem);
    font-weight: 700; letter-spacing: -0.032em; line-height: 1.12;
    padding-bottom: 0.05em;
    margin: var(--s-sm) 0 var(--s-md);
}
.lead p { font-size: 1.0625rem; color: var(--text-2); max-width: 62ch; }

/* Gli altri: righe, non schede. Il filetto le separa, niente cornici. */
.row {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    column-gap: var(--s-xl);
    align-items: start;
    padding: var(--s-xl) 0;
    border-top: 1px solid var(--border);
}
.row-shot {
    display: block; position: relative; overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--r-lg);
    background: var(--bg-alt);
}
.row-shot i {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    transition: transform 0.9s var(--ease);
}
.row:hover .row-shot i { transform: scale(1.05); }
.row h2 {
    font-size: 1.3rem; font-weight: 600;
    letter-spacing: -0.022em; line-height: 1.3;
    padding-bottom: 0.04em;
    margin: var(--s-sm) 0;
    transition: color var(--dur) var(--ease);
}
.row:hover h2 { color: var(--accent-ink); }
.row p { font-size: 0.9375rem; color: var(--text-2); max-width: 62ch; }

.more {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: var(--s-md);
    color: var(--accent-ink); font-weight: 500; font-size: 0.9375rem;
}
.more svg { transition: transform var(--dur) var(--ease); }
.lead:hover .more svg, .more:hover svg { transform: translateX(4px); }

/* --- Stato vuoto e paginazione ------------------------------------------- */
.empty { padding: var(--s-3xl) 0; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 1.5rem; font-weight: 600; margin-bottom: var(--s-sm); }
.pager {
    display: flex; gap: var(--s-sm);
    margin-top: var(--s-2xl);
    padding-top: var(--s-xl);
    border-top: 1px solid var(--border);
}
.pager a {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-full); border: 1px solid var(--border);
    font-size: 0.875rem; font-weight: 500;
    transition: all var(--dur) var(--ease);
}
.pager a:hover { border-color: rgba(0,0,0,.25); }
.pager a.on { background: var(--bg-dark); border-color: var(--bg-dark); color: #fff; }

/* --- Piè di pagina ------------------------------------------------------- */
.foot {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: var(--s-2xl) var(--s-lg);
    text-align: center;
    color: var(--text-2); font-size: 0.875rem;
}

/* --- Adattamento ---------------------------------------------------------- */
@media (max-width: 1080px) {
    :root { --rail: 260px; --gutter: 48px; }
}
@media (max-width: 900px) {
    /* Sotto questa soglia la barra non sta più a fianco: diventa testata. */
    .shell { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-2xl); }
    .rail { position: static; }
    .rail h1 { font-size: clamp(2.6rem, 2rem + 3vw, 3.6rem); }
    .lede { max-width: 60ch; }
    .filters {
        flex-direction: row; flex-wrap: wrap; gap: var(--s-sm);
        border-top: 0; padding-top: 0; margin-top: var(--s-lg);
    }
    .filter {
        border-bottom: 0; padding: 8px 16px;
        border: 1px solid var(--border); border-radius: var(--r-full);
        font-size: 0.875rem;
    }
    .filter:hover { padding-left: 16px; border-color: rgba(0,0,0,.25); }
    .filter.on { background: var(--bg-dark); border-color: var(--bg-dark); color: #fff; }
    .filter.on .n { color: rgba(255,255,255,.6); }
}
@media (max-width: 760px) {
    .burger { display: block; }
    .nav-links {
        position: absolute; top: calc(100% + 8px); left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: rgba(29,29,31,0.96);
        -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
        border-radius: var(--r-lg); padding: var(--s-sm);
        box-shadow: var(--sh-lg);
        display: none;
    }
    .nav.open .nav-links { display: flex; }
    .nav-langs { border-left: 0; border-top: 1px solid rgba(255,255,255,.16); margin: 4px 0 0; padding: 8px 0 0; justify-content: center; }
    /* Righe impilate: la miniatura passa sopra al testo. */
    .row { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-md); }
    .row-shot { aspect-ratio: 16 / 9; }
}

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