/**
 * Qing Category Featured widget.
 *
 * Centred heading with a rule either side, then a grid of product cards.
 */

.qing-catFeatured {
    width: 100%;
}

/* ============================================================
 * Heading
 * ============================================================ */

/* The rules are pseudo-elements on a flex row: each one takes the free space
   left over by the heading, so they stay symmetrical whatever the text length
   without needing a fixed width. */
.qing-catFeatured__head {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
}

.qing-catFeatured__head::before,
.qing-catFeatured__head::after {
    content: "";
    flex: 1 1 0;
    height: 1px;
    background-color: #e5e0d8;
}

.qing-catFeatured__title {
    margin: 0;
    /* flex-shrink 0 keeps a long heading from being squeezed by the rules. */
    flex: 0 1 auto;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #2f2b28;
}

/* ============================================================
 * Grid
 * ============================================================ */
.qing-catFeatured__grid {
    display: grid;
    /* Overwritten by the Columns control; this is the desktop fallback. */
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
}

.qing-catFeatured__card {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ============================================================
 * Card
 * ============================================================ */

/* The media box owns the height so every card lines up regardless of image
   proportions; the image fills it via object-fit below. */
.qing-catFeatured__media {
    position: relative;
    display: block;
    height: 130px;
    overflow: hidden;
    border-radius: 10px;
    /* Shows through for products with no featured image. */
    background-color: #a9a9a9;
}

/* Selector carries two classes on purpose: style.css sets a global
   `img { height: auto }`, and a single class ties with it on specificity,
   which would leave the image at its natural height inside a fixed-height box. */
.qing-catFeatured__media .qing-catFeatured__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay sits between the image and the text so the product name stays
   readable over light photos. pointer-events:none keeps the card clickable. */
.qing-catFeatured__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

/* 缩放只在 --zoom 变体下生效，由「Zoom On Hover」开关控制。
   transition 也放在同一个变体里，关掉开关后不留过渡副作用。 */
.qing-catFeatured--zoom .qing-catFeatured__img {
    transition: transform 0.4s ease;
}

.qing-catFeatured--zoom .qing-catFeatured__card:hover .qing-catFeatured__img {
    transform: scale(1.04);
}

/* ---------- Badge ----------
   左侧内缩一点并带圆角，右侧是斜切的缺角丝带尾。
   不贴左边缘：贴边会被卡片自身的 border-radius 切掉一角。
   z-index 2 让它压在遮罩伪元素之上。 */
.qing-catFeatured__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: inline-block;
    padding: 4px 16px 4px 10px;
    border-radius: 3px;
    background: #c9a227;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    /* 右侧缺角。clip-path 单个元素完成，不加额外标记，
       也会自动跟随背景色。 */
    clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%);
}

/* 直角变体：去掉缺角和圆角，回到纯矩形。 */
.qing-catFeatured--badgeRect .qing-catFeatured__badge {
    padding-right: 10px;
    border-radius: 0;
    clip-path: none;
}

/* ---------- Product name ---------- */
.qing-catFeatured__name {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    width: calc(100% - 20px);
    text-align: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

/* 贴底摆放。top/transform 都要复位，否则会和居中定位叠加。 */
.qing-catFeatured--nameBottom .qing-catFeatured__name {
    top: auto;
    bottom: 10px;
    transform: translateX(-50%);
}

/* ============================================================
 * Editor hint
 *
 * Editor-only: the front end renders nothing when the category has no
 * heading or products, but a blank block in the editor looks broken.
 * ============================================================ */
.qing-catFeatured__hint {
    padding: 18px 20px;
    border: 1px dashed #c9c2b6;
    border-radius: 6px;
    background-color: #faf8f5;
    color: #6d6660;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}
