/* ==========================================================
   AAP · Blog
   Complementa campanya.css — reutilitza les seves variables
   (--ink, --muted, --line, --soft, --blue, --blue-dark, --red)
   i els tokens de marca (--font-display, --font-body,
   --circuit-gradient). Indicacions completes a
   docs/identitat-de-marca.md — llegeix-lo abans de tocar colors
   o tipografia aqui.
   ========================================================== */

.container-narrow {
    max-width: 720px;
}

/* ---------- Portada i capçaleres de llistat ---------- */

.blog-hero {
    background: var(--soft);
    border-bottom: 1px solid var(--line);
    padding: 64px 0 48px;
    margin-bottom: 40px;
}

.blog-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    font-weight: 700;
    color: var(--red);
    margin-bottom: 12px;
}

.blog-hero h1 {
    font-size: clamp(1.9rem, 4.5vw, 2.8rem);
    line-height: 1.15;
    max-width: 18ch;
    text-wrap: balance;
}

.blog-hero h1.blog-title-single-line {
    max-width: none;
    white-space: nowrap;
}

.blog-lead {
    margin-top: 16px;
    max-width: 60ch;
    font-size: 1.08rem;
    color: var(--muted);
}

.blog-lead-home {
    max-width: 68ch;
}

/* ---------- Filtre per pilars ---------- */

.temes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.tema {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 14px;
    text-decoration: none;
    color: var(--muted);
    background: var(--white);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.tema:hover {
    border-color: var(--blue);
    color: var(--blue-dark);
}

.tema.actiu {
    background: var(--circuit-gradient);
    border-color: transparent;
    color: var(--white);
}

/* ---------- Graella d'articles ---------- */

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    cursor: pointer;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.post-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.post-card-img {
    display: block;
    width: calc(100% + 48px);
    margin: -24px -24px 4px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
}

.post-card-tag {
    position: relative;
    z-index: 2;
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--blue-dark);
    background: var(--soft);
    border-radius: 999px;
    padding: 4px 10px;
    text-decoration: none;
}

.post-card h2 {
    font-size: 1.22rem;
    line-height: 1.3;
    text-wrap: balance;
}

.post-card h2 a {
    text-decoration: none;
    color: var(--ink);
}

.post-card h2 a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.post-card h2 a:hover {
    color: var(--blue-dark);
}

.post-card-excerpt {
    color: var(--muted);
    font-size: 0.95rem;
    flex-grow: 1;
}

.post-card-meta {
    font-size: 0.82rem;
    color: var(--muted);
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.buit {
    color: var(--muted);
    padding: 48px 0 64px;
    text-align: center;
}

/* ---------- Paginació ---------- */

.paginacio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 0 56px;
    flex-wrap: wrap;
}

.pag-link {
    text-decoration: none;
    color: var(--blue-dark);
    font-weight: 600;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 18px;
}

.pag-link:hover {
    border-color: var(--blue);
}

.pag-estat {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------- Article ---------- */

.post {
    padding: 40px 0 24px;
}

.molles {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 24px;
}

.molles a {
    color: var(--muted);
    text-decoration: none;
}

.molles a:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

.post-header h1 {
    font-size: clamp(1.8rem, 4.5vw, 2.6rem);
    line-height: 1.18;
    text-wrap: balance;
    margin-bottom: 14px;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.post-entradeta {
    margin-top: 20px;
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--muted);
    border-left: 3px solid var(--red);
    padding-left: 18px;
}

.post-cover {
    margin: 32px 0;
}

.post-cover img {
    width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid var(--line);
}

/* Vídeo de l'article (fet amb l'avatar a XXSAS): ocupa el lloc de la portada */
.post-video {
    margin: 32px 0;
}

.post-video video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--ink);
}

.post-video.vertical video {
    max-width: 360px;
    margin: 0 auto;
}

/* Cos de l'article: serif per a lectura llarga */
.post-body {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: 1.09rem;
    line-height: 1.75;
    margin-top: 32px;
}

.post-body > * + * {
    margin-top: 1.15em;
}

.post-body h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.25;
    margin-top: 2.2em;
    padding-top: 0.4em;
    border-top: 1px solid var(--line);
    text-wrap: balance;
}

.post-body h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.2rem;
    margin-top: 1.9em;
    text-wrap: balance;
}

.post-body h4 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.02rem;
    margin-top: 1.6em;
    color: var(--muted);
}

.post-body a {
    color: var(--blue-dark);
    text-underline-offset: 3px;
}

/* Èmfasi dins del text */
.post-body strong {
    font-weight: 700;
    color: var(--ink);
}

.post-body em {
    font-style: italic;
}

.post-body u {
    text-decoration: none;
    background-image: linear-gradient(var(--blue), var(--blue));
    background-repeat: no-repeat;
    background-size: 100% 2px;
    background-position: 0 100%;
    padding-bottom: 1px;
}

.post-body mark {
    background: linear-gradient(180deg, transparent 58%, rgba(236, 74, 125, 0.30) 58%);
    color: inherit;
    padding: 0 0.12em;
    border-radius: 2px;
}

.post-body ul,
.post-body ol {
    padding-left: 1.4em;
}

.post-body li + li {
    margin-top: 0.5em;
}

.post-body blockquote {
    border-left: 3px solid var(--blue);
    background: var(--soft);
    padding: 16px 22px;
    border-radius: 0 10px 10px 0;
    color: var(--ink);
    font-style: italic;
}

.post-body blockquote p + p {
    margin-top: 0.8em;
}

.post-body code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.88em;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 6px;
}

.post-body hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2.4em 0;
}

.post-body img {
    width: 100%;
    height: auto;
    border-radius: 12px;
}

/* ---------- Conversa i propostes ---------- */

.post-conversa,
.blog-topic-request {
    margin-top: 48px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
    padding: 28px;
}

.post-conversa {
    box-shadow: 0 18px 40px rgba(31, 47, 63, 0.06);
}

.post-conversa-head h2,
.topic-request-copy h2 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    line-height: 1.2;
    text-wrap: balance;
}

.post-conversa-head p:not(.blog-eyebrow),
.topic-request-copy p:not(.blog-eyebrow) {
    margin-top: 10px;
    color: var(--muted);
}

.post-comment-form,
.blog-topic-form {
    margin-top: 22px;
}

.blog-form-grid,
.blog-topic-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.blog-form-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.blog-form-full,
.blog-topic-form button {
    grid-column: 1 / -1;
}

.blog-form-row label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--ink);
}

.blog-form-row input,
.blog-form-row textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--white);
}

.blog-form-row textarea {
    min-height: 132px;
    resize: vertical;
}

.blog-form-row input:focus,
.blog-form-row textarea:focus {
    outline: 3px solid rgba(52, 152, 219, 0.18);
    border-color: var(--blue);
}

.post-comment-form .btn,
.blog-topic-form .btn {
    margin-top: 18px;
    justify-self: start;
}

.blog-topic-request {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 28px;
    align-items: start;
    background: var(--soft);
    margin-bottom: 56px;
}

.blog-topic-form {
    margin-top: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Peu d'article ---------- */

.post-autor {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 48px;
    padding: 22px;
    background: var(--soft);
    border-radius: 14px;
}

.post-autor img {
    border-radius: 10px;
    flex-shrink: 0;
}

.post-autor p {
    margin: 0;
}

.post-autor .small {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 4px;
}

.relacionats {
    margin-top: 48px;
    border-top: 1px solid var(--line);
    padding-top: 24px;
}

.relacionats h2 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 14px;
}

.relacionats ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.relacionats li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.relacionats a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

.relacionats a:hover {
    color: var(--blue-dark);
}

.relacionats .small {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ---------- Crida final ---------- */

.blog-cta {
    background: var(--soft);
    border-top: 1px solid var(--line);
    margin-top: 64px;
    padding: 56px 0;
    text-align: center;
}

.blog-cta h2 {
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    text-wrap: balance;
}

.blog-cta p {
    max-width: 52ch;
    margin: 14px auto 0;
    color: var(--muted);
}

.blog-cta .btn {
    margin-top: 22px;
}

@media (prefers-reduced-motion: reduce) {
    .post-card {
        transition: none;
    }
}

@media (max-width: 760px) {
    .blog-hero h1.blog-title-single-line {
        white-space: normal;
    }

    .blog-form-grid,
    .blog-topic-form,
    .blog-topic-request {
        grid-template-columns: 1fr;
    }

    .post-conversa,
    .blog-topic-request {
        padding: 22px;
    }

    .blog-topic-request {
        gap: 20px;
    }
}
