/*
 * MageOS Blog — blog page stylesheet.
 *
 * Scoped under `.mageos-blog`. Vanilla CSS (no Less), no JS, no Hyvä twin.
 *
 * REQUIRES blog-cards.css, which owns the design tokens, the base `.mageos-blog`
 * typography and the post-card component. The split lets product pages load the
 * cards alone, without this file's page layout — which assumes the 1-column blog
 * template and fights a product page. blog_default.xml loads blog-cards.css
 * first; do not reintroduce the tokens here or the two copies will drift.
 */

.mageos-blog-container {
    max-width: none;
    width: 100%;
    padding-inline: 0;
    padding-block: 2rem;
}

.hyva-yoga-blog__main .mageos-blog-container {
    padding-block: 0 2rem;
}

/* ---------------- Context headers (category/tag/author/search) ---------------- */

.mageos-blog-context {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--mageos-blog-border);
}

.mageos-blog-context__title {
    font-size: var(--mageos-blog-h1);
    line-height: 1.15;
    margin: 0 0 0.5rem;
}

.mageos-blog-context__description {
    color: var(--mageos-blog-meta);
    font-size: 0.889em;
}

.mageos-blog-context__avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

/*
 * The `.mageos-blog-card` component lives in blog-cards.css, together with the
 * design tokens, so it can be loaded on product pages on its own. That file
 * also carries `.mageos-blog-post__meta`, which the post detail page below
 * shares with the card.
 */

/* ---------------- Post detail ---------------- */

.mageos-blog-post__title {
    font-size: var(--mageos-blog-h1);
    line-height: 1.15;
    margin: 0 0 0.5rem;
}

.mageos-blog-post__content {
    font-family: var(--mageos-blog-font-serif);
    font-size: 1.056em;
    line-height: 1.8;
    /* Contain floats so tags/footer never ride up beside an image */
    overflow: auto;
}

.mageos-blog-post__content > * + * {
    margin-top: 1.25rem;
}

/*
 * Tailwind / Hyvä preflight sets ul/ol { list-style: none }. Restore readable
 * bullets for seeded WP lists (e.g. esperienze-formative).
 * list-style-position: inside — required because this content box uses
 * overflow: auto (float containment), which clips outside markers.
 */
.mageos-blog-post__content ul {
    list-style: disc inside;
    padding-left: 0;
    margin: 0;
}

.mageos-blog-post__content ol {
    list-style: decimal inside;
    padding-left: 0;
    margin: 0;
}

.mageos-blog-post__content li + li {
    margin-top: 0.5rem;
}

.mageos-blog-post__content h2 {
    font-family: var(--mageos-blog-font);
    font-size: 1.263em;
    line-height: 1.25;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.mageos-blog-post__content h3 {
    font-family: var(--mageos-blog-font);
    font-size: 1.053em;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.mageos-blog-post__content blockquote {
    border-left: 3px solid var(--mageos-blog-border);
    padding-left: 1.25rem;
    color: var(--mageos-blog-meta);
    margin-inline: 0;
    font-style: italic;
}

/* Default in-content images: full column, stack above/below text */
.mageos-blog-post__content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin-block: 2rem;
    display: block;
}

/*
 * WordPress-style float wrap (alignleft / alignright on img or figure).
 * Overrides display:block so text can flow beside the picture.
 */
.mageos-blog-post__content img.alignleft,
.mageos-blog-post__content .alignleft {
    float: left;
    display: inline;
    max-width: 42%;
    margin: 0.25rem 1.25rem 1rem 0;
}

.mageos-blog-post__content img.alignright,
.mageos-blog-post__content .alignright {
    float: right;
    display: inline;
    max-width: 42%;
    margin: 0.25rem 0 1rem 1.25rem;
}

.mageos-blog-post__content img.aligncenter,
.mageos-blog-post__content .aligncenter {
    display: block;
    float: none;
    max-width: 100%;
    margin-inline: auto;
}

.mageos-blog-post__content pre {
    background: var(--mageos-blog-chip-bg);
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    font-size: 0.789em;
}

.mageos-blog-post__content code {
    background: var(--mageos-blog-chip-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.789em;
}

.mageos-blog-post__content pre code {
    background: transparent;
    padding: 0;
}

/* ---------------- Post footer: tags + share + related ---------------- */

.mageos-blog-post__footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--mageos-blog-border);
    font-family: var(--mageos-blog-font);
}

.mageos-blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 2rem;
    padding: 0;
    list-style: none;
}

.mageos-blog-chip {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--mageos-blog-chip-bg);
    border-radius: 1rem;
    font-size: var(--mageos-blog-meta-size);
    text-decoration: none;
}

.mageos-blog-chip:hover {
    background: rgba(0, 0, 0, 0.08);
}

.mageos-blog-share {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: baseline;
    font-size: var(--mageos-blog-meta-size);
    margin: 0 0 2rem;
}

.mageos-blog-share__label {
    color: var(--mageos-blog-meta);
}

.mageos-blog-related {
    margin-top: 2rem;
}

.mageos-blog-related__title {
    font-size: 1.111em;
    margin: 0 0 1rem;
}

.mageos-blog-related__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .mageos-blog-related__list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.mageos-blog-related__item a {
    text-decoration: none;
}

.mageos-blog-related__item a:hover .mageos-blog-related__item-title {
    text-decoration: underline;
}

.mageos-blog-related__item-thumb {
    aspect-ratio: 16 / 9;
    width: 100%;
    object-fit: cover;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.mageos-blog-related__item-title {
    font-size: 0.889em;
    margin: 0;
}

/* ---------------- Pagination ---------------- */

.mageos-blog-pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    font-size: var(--mageos-blog-meta-size);
}

.mageos-blog-pagination a,
.mageos-blog-pagination span {
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    text-decoration: none;
}

.mageos-blog-pagination a:hover {
    background: var(--mageos-blog-chip-bg);
}

.mageos-blog-pagination__current {
    background: var(--mageos-blog-chip-bg);
    font-weight: 600;
}

/* ---------------- Empty state ---------------- */

.mageos-blog-empty {
    color: var(--mageos-blog-meta);
    font-style: italic;
    text-align: center;
    padding: 3rem 0;
}

/* ---------------- Narrow-viewport adjustments ---------------- */

@media (max-width: 640px) {
    .mageos-blog-container { padding-inline: 1rem; padding-block: 1.5rem; }
    .mageos-blog-post__content { font-size: 0.944em; }

    /* Narrow screens: no side-by-side wrap — full-width stack */
    .mageos-blog-post__content img.alignleft,
    .mageos-blog-post__content .alignleft,
    .mageos-blog-post__content img.alignright,
    .mageos-blog-post__content .alignright {
        float: none;
        display: block;
        max-width: 100%;
        margin: 1rem 0;
    }
}
