/**
 * Qing Blog List widget styles.
 *
 * Three parts, one widget: the category filter row, the post grid (with an
 * optional lead card spanning the row), and the pager. Ported from the static
 * journal page (.blogFilter / .blogGrid / .postCard / .blogPager) with the
 * classes namespaced to .qing-blogList. Every measurement below is the value
 * the static page uses.
 *
 * They live together because the pager cannot be a separate widget: it needs
 * the total page count, and only the thing that ran the query knows it.
 *
 * SPECIFICITY. Every rule is scoped under .qing-blogList so it reaches
 * (0,2,x). Elementor's frontend.css loads after this file and carries element
 * resets at (0,1,1):
 *
 *     .elementor img { height: auto; max-width: 100%; border-radius: 0; ... }
 *     .elementor a   { text-decoration: none; box-shadow: none; }
 *
 * A single-class rule like `.qing-blogList__img { height: 100% }` is (0,1,0)
 * and loses, which stops the cards cropping to their ratio and is what made
 * the grid disagree with the static page. The same trap already cost the
 * Story widget its image height; see the note in qing-contact-split.css.
 *
 * The pager markup comes from paginate_links(), so those rules follow that
 * output rather than the static page's hand-written one: WordPress emits
 * <a class="page-numbers"> for other pages but <span class="page-numbers
 * current"> for the active one, which is why one rule dresses
 * `.qing-blogList__page > *` instead of a link class.
 *
 * Control-driven values are read from CSS custom properties, declared here as
 * the standalone defaults so an untouched control falls back to the static
 * page value rather than to nothing.
 */

.qing-blogList {
    /* ---- Defaults, overridden by the controls ---- */
    --qing-bl-gold: #b3946f;
    --qing-bl-ink: #2f2b28;
    --qing-bl-muted: #7a736c;
    --qing-bl-line: #eae5df;
    --qing-bl-bg-alt: #faf7f3;
    --qing-bl-radius: 4px;
    --qing-bl-display: Georgia, "Songti SC", "SimSun", serif;

    --qing-bl-cols: 3;
    --qing-bl-row-gap: 40px;
    --qing-bl-col-gap: 30px;

    --qing-bl-card-ratio: 3 / 2;
    --qing-bl-lead-ratio: 16 / 10;
    --qing-bl-lead-cols: 1.15fr 1fr;

    --qing-bl-filter-gap: 10px;
    --qing-bl-filter-pad: 28px;

    --qing-bl-page-size: 38px;
    --qing-bl-page-gap: 6px;
    --qing-bl-page-radius: 4px;

    box-sizing: border-box;
}

.qing-blogList *,
.qing-blogList *::before,
.qing-blogList *::after {
    box-sizing: inherit;
}

/* =========================================================
   Filter

   Source: .blogFilter / .blogFilter__item. A row of links rather than a
   select: with a handful of categories the choices are worth showing
   outright, and each one stays a shareable URL.
   ========================================================= */
.qing-blogList .qing-blogList__filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--qing-bl-filter-gap);
    padding-block: var(--qing-bl-filter-pad);
}

.qing-blogList .qing-blogList__filterItem {
    padding: 8px 18px;
    border: 1px solid var(--qing-bl-line);
    border-radius: 999px;
    color: var(--qing-bl-muted);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.qing-blogList .qing-blogList__filterItem:hover,
.qing-blogList .qing-blogList__filterItem:focus-visible {
    border-color: var(--qing-bl-gold);
    color: var(--qing-bl-gold);
}

.qing-blogList .qing-blogList__filterItem.is-active {
    border-color: var(--qing-bl-ink);
    background-color: var(--qing-bl-ink);
    color: #fff;
}

/* Square variant, for pages where the pill reads too soft. */
.qing-blogList .qing-blogList__filter--square .qing-blogList__filterItem {
    border-radius: var(--qing-bl-radius);
}

/* =========================================================
   Grid

   Source: .blogGrid -- three columns, 40px row gap, 30px column gap.
   ========================================================= */
.qing-blogList .qing-blogList__grid {
    display: grid;
    /* minmax(0, 1fr) rather than 1fr: a long unbreakable title should not be
       able to force a column wider than its share. */
    grid-template-columns: repeat(var(--qing-bl-cols), minmax(0, 1fr));
    row-gap: var(--qing-bl-row-gap);
    column-gap: var(--qing-bl-col-gap);
}

/* ---- Card ----
   Source: .postCard. The whole card is deliberately not one link: the title
   and the image are separate targets, which keeps the category chip legible
   as its own thing. */
.qing-blogList .qing-blogList__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.qing-blogList .qing-blogList__media {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--qing-bl-radius);
    /* Fixed ratio so a mixed bag of upload sizes still lines up in a row. */
    aspect-ratio: var(--qing-bl-card-ratio);
    background-color: var(--qing-bl-bg-alt);
}

/* height:100% and the radius both have to beat `.elementor img`, which sets
   height:auto and border-radius:0 at the same weight from a later file. */
.qing-blogList .qing-blogList__media .qing-blogList__img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    border-radius: inherit;
    transition: transform 0.5s ease;
}

.qing-blogList .qing-blogList__media:hover .qing-blogList__img {
    transform: scale(1.04);
}

.qing-blogList.qing-blogList--noZoom .qing-blogList__media:hover .qing-blogList__img {
    transform: none;
}

/* Placeholder shown when a post has no featured image, so the row keeps its
   rhythm instead of collapsing one cell. */
.qing-blogList .qing-blogList__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Source: .postCard__cat */
.qing-blogList .qing-blogList__cat {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 5px 12px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.92);
    color: var(--qing-bl-ink);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    line-height: 1.5;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.qing-blogList .qing-blogList__media:hover .qing-blogList__cat {
    background-color: #fff;
    color: var(--qing-bl-gold);
}

/* Source: .postCard__body */
.qing-blogList .qing-blogList__body {
    padding-top: 16px;
}

/* Source: .postCard__meta */
.qing-blogList .qing-blogList__meta {
    display: block;
    margin-bottom: 8px;
    color: var(--qing-bl-muted);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Source: .postCard__title -- serif display face at normal weight. Bolding
   it is the usual way these cards go wrong. */
.qing-blogList .qing-blogList__title {
    margin: 0 0 10px;
    font-family: var(--qing-bl-display);
    font-size: 1.18rem;
    font-weight: 400;
    line-height: 1.4;
}

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

.qing-blogList .qing-blogList__title a:hover,
.qing-blogList .qing-blogList__title a:focus-visible {
    color: var(--qing-bl-gold);
}

/* Source: .postCard__excerpt */
.qing-blogList .qing-blogList__excerpt {
    margin: 0;
    color: var(--qing-bl-muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

/* Clamp is optional: with mixed-length excerpts an unclamped card makes the
   row ragged, but a hard clamp on short ones only wastes the space. */
.qing-blogList.qing-blogList--clamp .qing-blogList__excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--qing-bl-clamp, 3);
    line-clamp: var(--qing-bl-clamp, 3);
    overflow: hidden;
}

/* ---- Lead card ----
   Source: .postCard--lead. Spans the row and lays out side by side, so the
   newest post reads as the lead rather than just the first of nine. */
.qing-blogList .qing-blogList__card--lead {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: var(--qing-bl-lead-cols);
    align-items: center;
    gap: 32px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--qing-bl-line);
}

.qing-blogList .qing-blogList__card--lead .qing-blogList__media {
    aspect-ratio: var(--qing-bl-lead-ratio);
}

.qing-blogList .qing-blogList__card--lead .qing-blogList__body {
    padding-top: 0;
}

.qing-blogList .qing-blogList__card--lead .qing-blogList__title {
    font-size: 1.9rem;
}

.qing-blogList .qing-blogList__card--lead .qing-blogList__excerpt {
    font-size: 1rem;
}

/* Media on the right, text on the left. */
.qing-blogList .qing-blogList__card--leadFlip .qing-blogList__media {
    order: 2;
}

/* =========================================================
   Pager

   Source: .blogPager / .blogPager__link -- 38px boxes, 6px gap. The markup
   is paginate_links() output, so one rule covers the links and the
   current-page span together: WordPress emits an <a> for one and a <span>
   for the other and both need the same box.
   ========================================================= */
.qing-blogList .qing-blogList__pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 48px;
}

.qing-blogList .qing-blogList__pageCount {
    color: var(--qing-bl-muted);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

.qing-blogList .qing-blogList__pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--qing-bl-page-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.qing-blogList .qing-blogList__page {
    margin: 0;
    padding: 0;
    list-style: none;
}

.qing-blogList .qing-blogList__page > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    min-width: var(--qing-bl-page-size);
    height: var(--qing-bl-page-size);
    padding-inline: 10px;
    border: 1px solid var(--qing-bl-line);
    border-radius: var(--qing-bl-page-radius);
    background-color: #fff;
    color: var(--qing-bl-ink);
    font-size: 0.88rem;
    line-height: 1;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.qing-blogList .qing-blogList__page > a:hover,
.qing-blogList .qing-blogList__page > a:focus-visible {
    border-color: var(--qing-bl-gold);
    color: var(--qing-bl-gold);
}

.qing-blogList .qing-blogList__page > .current {
    border-color: var(--qing-bl-ink);
    background-color: var(--qing-bl-ink);
    color: #fff;
}

/* Source: .blogPager__gap -- the break between number ranges. Not
   interactive, so it gets no box. */
.qing-blogList .qing-blogList__page > .dots {
    min-width: 24px;
    padding-inline: 4px;
    border-color: transparent;
    background-color: transparent;
    color: var(--qing-bl-muted);
}

/* ---- Arrows ----
   Sized in em so an uploaded icon tracks the link text. Clicks belong to the
   link, not the icon. */
.qing-blogList .qing-blogList__arrow {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15em;
    height: 1.15em;
    pointer-events: none;
}

.qing-blogList .qing-blogList__arrow svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* An uploaded SVG may carry its own fill; this keeps it tracking the link
   colour on hover the way the built-in chevron does. `none` is left alone so
   a stroked icon is not filled in. */
.qing-blogList .qing-blogList__arrow svg [fill]:not([fill="none"]) {
    fill: currentColor;
}

.qing-blogList .qing-blogList__arrow i {
    font-size: 1.05em;
    line-height: 1;
}

/* Optional text beside the arrow. The box widens to fit it, so a "Previous"
   link stops being square while the numbers stay square. */
.qing-blogList .qing-blogList__arrowLabel {
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ---- Arrows-only mode ----
   The number links are still generated so the markup stays the same; they
   are just hidden. `.dots` goes too, otherwise an ellipsis floats between
   the two arrows with nothing between them. */
.qing-blogList .qing-blogList__pagination--arrowsOnly .qing-blogList__page > .page-numbers:not(.prev):not(.next) {
    display: none;
}

/* Screen-reader-only label on the arrows. Same technique WordPress uses, so
   the class name is kept even though this file could invent its own. */
.qing-blogList .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

/* =========================================================
   Empty state
   ========================================================= */
.qing-blogList .qing-blogList__empty {
    margin: 0;
    padding: 60px 0;
    color: var(--qing-bl-muted);
    text-align: center;
}

/* =========================================================
   Responsive

   1023px / 640px to match the source, not Elementor's 1024/767.
   ========================================================= */
@media (max-width: 1023px) {

    /* Class doubled: the Columns control writes --qing-bl-cols inline on the
       wrapper, and an inline custom property beats one set in a media query
       here. Overriding grid-template-columns directly sidesteps that. */
    .qing-blogList.qing-blogList .qing-blogList__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* The lead card stacks: side by side at tablet width leaves the headline
       in a column too narrow to read as a lead. */
    .qing-blogList.qing-blogList .qing-blogList__card--lead {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .qing-blogList.qing-blogList .qing-blogList__card--lead .qing-blogList__title {
        font-size: 1.5rem;
    }

    /* Order only means something while they sit side by side. */
    .qing-blogList.qing-blogList .qing-blogList__card--leadFlip .qing-blogList__media {
        order: 0;
    }
}

@media (max-width: 640px) {

    .qing-blogList.qing-blogList .qing-blogList__grid {
        grid-template-columns: 1fr;
        row-gap: 30px;
    }

    .qing-blogList.qing-blogList .qing-blogList__pagination {
        margin-top: 34px;
    }
}

@media (max-width: 480px) {

    /* Phones: keep the row to the arrows plus the current page, so a long
       pagination list does not wrap into several lines. */
    .qing-blogList.qing-blogList .qing-blogList__page > .page-numbers:not(.prev):not(.next):not(.current) {
        display: none;
    }
}

/* The zoom is decorative. */
@media (prefers-reduced-motion: reduce) {

    .qing-blogList .qing-blogList__img {
        transition-duration: 0.01ms;
    }

    .qing-blogList .qing-blogList__media:hover .qing-blogList__img {
        transform: none;
    }
}
