/* ═══════════════════════════════════════════════════════════════
   Coloring Gallery v3.1 — Kadence Compatible
═══════════════════════════════════════════════════════════════ */

/* ── Reset scope ───────────────────────────────────────────── */
.cg-gallery-wrap *,
.cg-home-wrap *,
.cg-popup-overlay * {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════
   HOME GRID
═══════════════════════════════════════════════════════════════ */
.cg-home-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px;
}
.cg-home-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 22px !important;
}

.cg-post-card {
    display: block;
    text-decoration: none !important;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    background: #fff;
    transition: box-shadow .2s, transform .15s;
    color: inherit;
}
.cg-post-card:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    transform: translateY(-3px);
}
.cg-post-thumb {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f5f5f5;
}
.cg-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s;
}
.cg-post-card:hover .cg-post-thumb img { transform: scale(1.06); }
.cg-post-no-img {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
}
.cg-post-count {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,.55); color: #fff;
    font-size: .72rem; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    backdrop-filter: blur(4px);
}
.cg-post-info { padding: 12px 14px 14px; }
.cg-post-info h2 {
    font-size: .92rem; font-weight: 700;
    color: #111; margin: 0 0 5px; line-height: 1.35;
}
.cg-post-info p {
    font-size: .78rem; color: #888; margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   STAR RATING
═══════════════════════════════════════════════════════════════ */
.cg-rating-wrap {
    display: flex; align-items: center;
    gap: 12px; padding: 14px 0 10px; flex-wrap: wrap;
}
.cg-stars { display: flex; gap: 3px; }
.cg-star {
    background: none; border: none; padding: 2px;
    cursor: pointer; transition: transform .12s; line-height: 0;
}
.cg-star:hover { transform: scale(1.2); }
.cg-rating-wrap.voted .cg-star { cursor: default; }
.cg-rating-wrap.voted .cg-star:hover { transform: none; }
.cg-rating-info { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.cg-rating-avg  { font-weight: 800; font-size: 1.1rem; color: #f59e0b; }
.cg-rating-count { color: #aaa; }
.cg-rating-hint { color: #2980b9; font-size: .78rem; font-style: italic; }
.cg-rating-wrap.voted .cg-rating-hint { color: #27ae60; }

/* ═══════════════════════════════════════════════════════════════
   GALLERY GRID
═══════════════════════════════════════════════════════════════ */
.cg-gallery {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 18px !important;
    padding: 10px 0 20px !important;
    list-style: none !important;
    margin: 0 !important;
}

/* ── Info card ────────────────────────────────────────────── */
.cg-info-card {
    position: relative;
    border-radius: 12px; overflow: hidden;
    border: 1px solid #dde8f5; background: #fff;
    padding: 20px 18px;
    display: flex; flex-direction: column; gap: 14px;
    align-self: start;
}
.cg-info-card-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #eaf3ff 0%, #f7fbff 60%, #fff 100%);
    z-index: 0;
}
.cg-info-title {
    position: relative;
    font-size: .8rem; font-weight: 800;
    color: #1a4a8a; text-transform: uppercase; letter-spacing: .1em;
    margin: 0; padding-bottom: 12px;
    border-bottom: 2px solid #d0e4f7;
    display: flex; align-items: center; gap: 6px;
}
.cg-info-list {
    position: relative;
    list-style: none !important;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
}
.cg-info-list li {
    display: flex; align-items: flex-start;
    gap: 8px; font-size: .82rem; line-height: 1.4;
    list-style: none !important;
}
.cg-info-lbl { font-weight: 700; color: #6b8cae; min-width: 78px; flex-shrink: 0; }
.cg-info-val { color: #222; }
.cg-info-link { color: #2980b9; text-decoration: none; }
.cg-info-link:hover { text-decoration: underline; }
.cg-badge {
    display: inline-block; padding: 2px 9px;
    border-radius: 5px; font-size: .7rem; font-weight: 700; margin-right: 4px;
}
.cg-badge-pdf  { background: #111; color: #fff !important; }
.cg-badge-jpg  { background: #27ae60; color: #fff !important; }
.cg-badge-free { background: #2980b9; color: #fff !important; }

/* ── Image cards ──────────────────────────────────────────── */
.cg-card {
    border-radius: 12px; overflow: hidden;
    border: 1px solid #e8e8e8; background: #fff;
    transition: box-shadow .2s, transform .15s;
    list-style: none !important;
}
.cg-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.11); transform: translateY(-2px); }
.cg-card-img-wrap {
    position: relative; aspect-ratio: 1/1;
    overflow: hidden; background: #f7f7f7; cursor: pointer;
}
.cg-card-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform .35s;
    margin: 0 !important; /* Kadence sometimes adds margin to imgs */
}
.cg-card:hover .cg-card-img-wrap img { transform: scale(1.05); }
.cg-card-hover {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 55%);
    display: flex; align-items: flex-end;
    padding: 10px 9px; opacity: 0; transition: opacity .25s;
}
.cg-card:hover .cg-card-hover { opacity: 1; }
.cg-card-hover span {
    color: #fff; font-size: .8rem; font-weight: 600;
    line-height: 1.3; text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.cg-card-actions {
    display: flex; align-items: center;
    justify-content: space-around;
    padding: 9px 5px;
    border-top: 1px solid #f0f0f0; gap: 2px;
    background: #fff;
}
.cg-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px; border: none !important;
    background: transparent !important; color: #999;
    cursor: pointer; transition: color .15s, background .15s;
    text-decoration: none !important;
    padding: 0; flex-shrink: 0;
    box-shadow: none !important;
    line-height: 1;
}
.cg-action:hover { color: #2c3e50 !important; background: #f0f4f8 !important; }
.cg-action:focus { outline: none; }
.cg-action-disabled { color: #ddd !important; cursor: default; pointer-events: none; }
.cg-fav-btn.is-fav { color: #e74c3c !important; }
.cg-action svg[viewBox="0 0 36 20"] { width: 38px !important; height: 22px !important; }

/* ── Gallery pagination ───────────────────────────────────── */
.cg-gal-nav { display: flex; align-items: center; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.cg-gp-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 8px;
    border: 1.5px solid #ddd !important; background: #fff !important;
    color: #555 !important; font-size: .88rem; font-weight: 700;
    text-decoration: none !important; transition: all .15s;
    box-shadow: none !important;
}
.cg-gp-btn:hover  { border-color: #2c3e50 !important; color: #2c3e50 !important; }
.cg-gp-btn.active { background: #2c3e50 !important; border-color: #2c3e50 !important; color: #fff !important; }

/* ── Home pagination ──────────────────────────────────────── */
.cg-pagination { margin: 36px auto 20px; display: flex; justify-content: center; }
.cg-pagination .page-numbers { display: flex; list-style: none; margin: 0; padding: 0; gap: 6px; flex-wrap: wrap; justify-content: center; }
.cg-pagination .page-numbers a,
.cg-pagination .page-numbers span {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 8px 14px; border-radius: 8px;
    border: 1.5px solid #ddd; background: #fff; color: #333;
    font-size: .88rem; font-weight: 600;
    text-decoration: none !important; transition: all .15s;
}
.cg-pagination .page-numbers a:hover { border-color: #2c3e50; color: #2c3e50; background: #f0f4f8; }
.cg-pagination .page-numbers .current { background: #2c3e50; border-color: #2c3e50; color: #fff; }
.cg-pagination .page-numbers .dots    { border: none; background: transparent; color: #aaa; padding: 8px 4px; }

/* ═══════════════════════════════════════════════════════════════
   EMBEDDED COLORIZER
═══════════════════════════════════════════════════════════════ */
.cg-col-embed {
    margin-top: 40px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    position: relative;
}

.cg-col-embed-header {
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 100%);
    padding: 10px 16px;
    display: flex; align-items: center;
    gap: 10px; flex-wrap: wrap;
}
.cg-col-embed-title {
    color: #fff; font-size: .95rem; font-weight: 700;
    margin: 0; display: flex; align-items: center; gap: 7px; flex-shrink: 0;
}
.cg-col-embed-title svg { opacity: .9; }
.cg-col-current-img {
    color: rgba(255,255,255,.75); font-size: .75rem; font-style: italic;
    max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1;
}

/* ── Toolbar row ──────────────────────────────────────────── */
.cg-col-toolbar-row {
    background: #f4f6f9;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 14px;
    display: flex; align-items: center;
    gap: 4px; flex-wrap: wrap;
}
.cg-col-tool-group {
    display: flex; align-items: center; gap: 3px; flex-shrink: 0;
}
.cg-col-tb-sep {
    width: 1px; height: 28px;
    background: #d0d0d0; margin: 0 4px; flex-shrink: 0;
}
.cg-col-tb-sep-grow { flex: 1; width: auto; background: transparent; }

/* Toolbar buttons (second row — dark bg gone, now on light) */
.cg-col-toolbar-row .cg-col-tb {
    min-width: auto; height: 34px; padding: 0 10px;
    border-radius: 7px;
    border: 1.5px solid #d0d0d0 !important;
    background: #fff !important; color: #333 !important;
    font-size: .75rem; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 5px; cursor: pointer; transition: all .15s;
    box-shadow: none !important;
}
.cg-col-toolbar-row .cg-col-tb:hover { border-color: #1565c0 !important; color: #1565c0 !important; background: #f0f6ff !important; }
.cg-col-toolbar-row .cg-col-tb.active { background: #1565c0 !important; border-color: #1565c0 !important; color: #fff !important; }
.cg-col-toolbar-row .cg-col-green  { border-color: #27ae60 !important; color: #27ae60 !important; }
.cg-col-toolbar-row .cg-col-green:hover { background: #27ae60 !important; color: #fff !important; border-color: #27ae60 !important; }
.cg-col-toolbar-row .cg-col-blue   { border-color: #1565c0 !important; color: #1565c0 !important; }
.cg-col-toolbar-row .cg-col-blue:hover  { background: #1565c0 !important; color: #fff !important; }

/* Size group */
.cg-col-size-group { gap: 5px; }
.cg-col-size-label { font-size: .72rem; font-weight: 700; color: #888; white-space: nowrap; }
.cg-col-size-btn {
    width: 26px; height: 26px; border-radius: 6px;
    border: 1.5px solid #d0d0d0 !important; background: #fff !important;
    color: #555 !important; font-size: 1rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; line-height: 1; box-shadow: none !important;
}
.cg-col-size-btn:hover { border-color: #1565c0 !important; color: #1565c0 !important; }
.cg-col-size-track {
    position: relative; display: flex; align-items: center;
}
.cg-col-size-range { width: 80px; accent-color: #1565c0; cursor: pointer; }
.cg-col-size-bubble {
    position: absolute; top: -26px; left: 0;
    background: #1565c0; color: #fff;
    font-size: .68rem; font-weight: 700;
    padding: 2px 5px; border-radius: 4px;
    pointer-events: none; white-space: nowrap;
    opacity: 0; transition: opacity .15s;
}
.cg-col-size-range:hover ~ .cg-col-size-bubble,
.cg-col-size-range:active ~ .cg-col-size-bubble { opacity: 1; }
.cg-col-size-val {
    font-size: .78rem; font-weight: 700; color: #1565c0;
    min-width: 36px; text-align: right; white-space: nowrap;
}
.cg-col-size-val small { font-size: .65rem; color: #aaa; }

/* Zoom */
.cg-col-zoom-val {
    font-size: .78rem; font-weight: 700; color: #555;
    min-width: 40px; text-align: center; white-space: nowrap;
}

/* ── Colorizer body ───────────────────────────────────────── */
.cg-col-embed-body {
    display: flex;
    /* Responsive height: min 340px mobile, ideal 55vh, max 680px desktop */
    height: clamp(340px, 55vh, 680px);
}

.cg-col-palette-panel {
    width: 106px; flex-shrink: 0;
    border-right: 1px solid #eee;
    padding: 10px 8px;
    display: flex; flex-direction: column; gap: 10px;
    background: #fafafa;
    overflow-y: auto;
}
.cg-col-active-color { position: relative; cursor: pointer; }
.cg-col-active-swatch {
    width: 100%; aspect-ratio: 1/1;
    border-radius: 10px; border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    background: #e74c3c; transition: transform .15s;
}
.cg-col-active-swatch:hover { transform: scale(1.04); }
.cg-col-active-label { font-size: .65rem; color: #aaa; text-align: center; display: block; margin-top: 2px; }
.cg-col-color-input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

.cg-col-swatches { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; }
.cg-col-sw {
    aspect-ratio: 1/1; border-radius: 5px;
    border: 2px solid transparent !important; padding: 0; cursor: pointer;
    transition: transform .12s, border-color .12s;
    box-shadow: none !important;
}
.cg-col-sw:hover  { transform: scale(1.15); border-color: rgba(0,0,0,.25) !important; }
.cg-col-sw.active { border-color: #2c3e50 !important; transform: scale(1.1); }

/* ── Canvas area ──────────────────────────────────────────── */
.cg-col-canvas-wrap {
    flex: 1; overflow: hidden; position: relative;
    background: repeating-conic-gradient(#e0e0e0 0% 25%, #ececec 0% 50%) 0 0 / 20px 20px;
    min-width: 0;
}
.cg-col-canvas-viewport {
    width: 100%; height: 100%;
    overflow: hidden; position: relative;
    /* Canvas overflows here, clipped by overflow:hidden */
}
.cg-col-canvas {
    display: block; background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    touch-action: none;
    /* Real size = natural image size; zoom/pan via CSS transform */
    transform-origin: 0 0;
    will-change: transform;
    position: absolute; top: 0; left: 0;
    /* cursor set by JS */
}
.cg-col-canvas-msg {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px; color: #bbb; text-align: center;
    pointer-events: none; padding: 20px;
    z-index: 1;
}
.cg-col-canvas-msg svg { opacity: .3; }
.cg-col-canvas-msg p   { font-size: .9rem; margin: 0; line-height: 1.5; }
.cg-col-canvas-msg strong { color: #1565c0; opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   POPUP
═══════════════════════════════════════════════════════════════ */
#cg-popup {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.82) !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .25s;
    backdrop-filter: blur(4px);
}
#cg-popup.active {
    opacity: 1 !important;
    pointer-events: all !important;
}
.cg-popup-box {
    position: relative;
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 900px; max-height: 90vh;
    overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.cg-popup-close {
    position: absolute; top: 12px; right: 12px; z-index: 10;
    width: 36px; height: 36px; border-radius: 50%;
    border: none !important; background: rgba(0,0,0,.12) !important;
    color: #333 !important;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .15s;
    box-shadow: none !important;
}
.cg-popup-close:hover { background: rgba(0,0,0,.22) !important; }
.cg-popup-img-wrap {
    flex: 1; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 24px 0; min-height: 0;
}
.cg-popup-img-wrap img {
    max-width: 100%; max-height: 60vh;
    object-fit: contain; border-radius: 8px; display: block;
    margin: 0 !important; /* Kadence reset */
}
.cg-popup-meta { padding: 16px 24px 20px; text-align: center; flex-shrink: 0; }
.cg-popup-meta h2 { font-size: 1rem; font-weight: 700; color: #111; margin: 0 0 14px; }
.cg-popup-btns {
    display: flex; align-items: center;
    justify-content: center; gap: 10px; flex-wrap: wrap;
}
.cg-pp-btn {
    display: inline-flex !important; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: 8px;
    font-size: .86rem; font-weight: 600; cursor: pointer;
    border: none !important; font-family: inherit;
    text-decoration: none !important;
    transition: opacity .18s, transform .12s;
    box-shadow: none !important;
}
.cg-pp-btn:hover { opacity: .87; transform: translateY(-1px); }
.cg-pp-btn-dl    { background: #27ae60 !important; color: #fff !important; }
.cg-pp-btn-print { background: #fff !important; color: #111 !important; border: 2px solid #333 !important; }
.cg-pp-btn-pdf   { background: #111 !important; color: #fff !important; }
.cg-pp-btn-color { background: #1565c0 !important; color: #fff !important; }

/* ═══════════════════════════════════════════════════════════════
   FAVORITES
═══════════════════════════════════════════════════════════════ */
.cg-fav-loading { min-height: 80px; }
.cg-fav-loading::before {
    content: 'A carregar favoritos...';
    display: block; padding: 40px; color: #aaa; text-align: center; grid-column: 1/-1;
}
.cg-fav-empty { grid-column: 1/-1; text-align: center; padding: 48px 24px; color: #aaa; font-size: 1rem; }

/* ── Spinner ──────────────────────────────────────────────── */
.cg-spinner-wrap { display: flex; justify-content: center; padding: 20px; }
.cg-spinner {
    width: 32px; height: 32px;
    border: 3px solid #eee; border-top-color: #1565c0;
    border-radius: 50%;
    animation: cg-spin .7s linear infinite;
}
@keyframes cg-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .cg-home-grid { grid-template-columns: repeat(3,1fr) !important; }
    .cg-gallery   { grid-template-columns: repeat(3,1fr) !important; }
}
@media (max-width: 768px) {
    /* Colorizer: vertical layout on mobile */
    .cg-col-embed-body {
        flex-direction: column;
        height: auto !important; /* let content define height */
    }
    .cg-col-palette-panel {
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid #eee;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 8px 10px;
        gap: 6px;
    }
    .cg-col-active-color  { width: 48px; flex-shrink: 0; }
    .cg-col-active-label  { display: none; }
    .cg-col-swatches      { grid-template-columns: repeat(10,1fr); flex: 1; min-width: 0; }
    /* Canvas viewport: fixed height on mobile */
    .cg-col-canvas-wrap   { min-height: 0; }
    .cg-col-canvas-viewport {
        height: clamp(300px, 60vw, 480px) !important;
        width: 100%;
    }
    /* Toolbar: wrap compactly on mobile */
    .cg-col-toolbar-row   { gap: 3px; padding: 6px 8px; }
    .cg-col-toolbar-row .cg-col-tb { padding: 0 7px; font-size: .7rem; height: 30px; }
    .cg-col-size-range    { width: 60px; }
    .cg-col-tb-sep        { display: none; }
}
@media (max-width: 680px) {
    .cg-home-grid { grid-template-columns: repeat(2,1fr) !important; gap: 14px !important; }
    .cg-gallery   { grid-template-columns: repeat(2,1fr) !important; gap: 12px !important; }
    .cg-info-card { grid-column: span 2; }
    .cg-popup-box { border-radius: 12px; max-height: 96vh; }
    .cg-popup-img-wrap { padding: 16px 12px 0; }
    .cg-popup-meta { padding: 12px; }
    .cg-col-embed-header { gap: 8px; padding: 10px 12px; }
    .cg-col-swatches      { grid-template-columns: repeat(8,1fr); }
}
@media (max-width: 400px) {
    .cg-home-grid { grid-template-columns: repeat(2,1fr) !important; gap: 10px !important; }
    .cg-gallery   { grid-template-columns: repeat(2,1fr) !important; gap: 10px !important; }
    .cg-col-swatches { grid-template-columns: repeat(6,1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   INTRO BLOCK
═══════════════════════════════════════════════════════════════ */
.cg-intro {
    margin: 0 0 28px;
    font-size: 1rem;
    line-height: 1.75;
    color: #333;
}
.cg-intro p {
    margin: 0 0 14px;
}
.cg-intro p:last-child { margin-bottom: 0; }

/* ═══════════════════════════════════════════════════════════════
   FAVORITES BUTTON (star rating row)
═══════════════════════════════════════════════════════════════ */
.cg-rating-spacer { flex: 1; }
.cg-fav-page-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 22px;
    background: #fff; color: #e74c3c !important;
    border: 2px solid #e74c3c; font-size: .82rem; font-weight: 700;
    text-decoration: none !important;
    transition: background .18s, color .18s;
    white-space: nowrap; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(231,76,60,.15);
}
.cg-fav-page-btn:hover {
    background: #e74c3c !important;
    color: #fff !important;
}
.cg-fav-page-btn svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   RELATED POSTS GRID
═══════════════════════════════════════════════════════════════ */
.cg-related-section {
    margin-top: 52px;
    padding-top: 32px;
    border-top: 2px solid #f0f0f0;
}
.cg-related-title {
    font-size: 1.25rem; font-weight: 800; color: #1a1a1a;
    margin: 0 0 22px;
    display: flex; align-items: center; gap: 9px;
}
.cg-related-title svg { color: #1565c0; flex-shrink: 0; }

.cg-related-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 18px !important;
}

.cg-rel-card {
    display: block; text-decoration: none !important;
    border-radius: 12px; overflow: hidden;
    border: 1px solid #e8e8e8; background: #fff;
    transition: box-shadow .2s, transform .15s; color: inherit;
}
.cg-rel-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.11); transform: translateY(-2px); }

.cg-rel-thumb {
    position: relative; aspect-ratio: 4/3;
    overflow: hidden; background: #f7f7f7;
}
.cg-rel-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform .35s;
    margin: 0 !important;
}
.cg-rel-card:hover .cg-rel-thumb img { transform: scale(1.05); }
.cg-rel-no-img {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center; font-size: 2.5rem;
}
.cg-rel-count {
    position: absolute; bottom: 7px; right: 7px;
    background: rgba(0,0,0,.55); color: #fff;
    font-size: .7rem; font-weight: 700;
    padding: 3px 8px; border-radius: 18px;
}
.cg-rel-info { padding: 10px 12px 12px; }
.cg-rel-info h3 {
    font-size: .85rem; font-weight: 700;
    color: #111; margin: 0; line-height: 1.35;
}

@media (max-width: 768px) {
    .cg-related-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
}

/* ═══════════════════════════════════════════════════════════════
   HOME SHORTCODE — [cg_home]
═══════════════════════════════════════════════════════════════ */

/* Hero */
.cg-home-hero {
    background: linear-gradient(135deg, #1a237e 0%, #1565c0 50%, #0288d1 100%);
    padding: 56px 24px 48px;
    text-align: center;
    margin-bottom: 0;
}
.cg-home-hero-inner { max-width: 720px; margin: 0 auto; }
.cg-home-hero-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 900; color: #fff;
    margin: 0 0 12px; line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.cg-home-hero-sub {
    font-size: 1.1rem; color: rgba(255,255,255,.9);
    margin: 0 0 22px; line-height: 1.6;
}
.cg-home-hero-sub strong { color: #fff; font-weight: 800; }

.cg-home-hero-tags {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 8px; margin-bottom: 24px;
}
.cg-hero-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 16px; border-radius: 22px;
    background: rgba(255,255,255,.15);
    color: #fff !important; font-size: .85rem; font-weight: 700;
    text-decoration: none !important;
    border: 1.5px solid rgba(255,255,255,.3);
    transition: background .18s;
}
.cg-hero-tag:hover { background: rgba(255,255,255,.3) !important; }

/* Search bar in hero */
.cg-home-hero-search { max-width: 480px; margin: 0 auto; }
.cg-home-hero-search form {
    display: flex; align-items: center;
    background: #fff; border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.cg-hero-search-input {
    flex: 1; border: none !important; outline: none;
    padding: 14px 20px; font-size: .95rem;
    background: transparent; color: #333;
}
.cg-hero-search-btn {
    padding: 10px 20px; background: #1565c0 !important;
    border: none !important; cursor: pointer; color: #fff !important;
    display: flex; align-items: center; justify-content: center;
    transition: background .18s; border-radius: 0 50px 50px 0;
    box-shadow: none !important;
}
.cg-hero-search-btn:hover { background: #0d47a1 !important; }

/* Wrap */
.cg-home-sc-wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px 48px; }

/* Section headers */
.cg-home-section { margin-bottom: 44px; padding-top: 16px; }
.cg-home-section-title {
    font-size: 1.3rem; font-weight: 800; color: #1a1a1a;
    margin: 0 0 18px; padding-bottom: 12px;
    border-bottom: 3px solid #f0f0f0;
    display: flex; align-items: center; gap: 9px;
}
.cg-sec-icon { font-size: 1.3rem; line-height: 1; }
.cg-sec-count {
    margin-left: auto;
    background: #f0f4f8; color: #555;
    font-size: .75rem; font-weight: 700;
    padding: 3px 10px; border-radius: 14px;
}

/* Grid */
.cg-home-sc-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
}

/* Card */
.cg-home-card {
    display: block; text-decoration: none !important;
    border-radius: 14px; overflow: hidden;
    border: 1px solid #e8e8e8; background: #fff;
    transition: box-shadow .2s, transform .15s; color: inherit;
}
.cg-home-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.12); transform: translateY(-3px); }

.cg-home-card-thumb {
    position: relative; aspect-ratio: 4/3;
    overflow: hidden; background: #f5f5f5;
}
.cg-home-card-thumb img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform .35s; margin: 0 !important;
}
.cg-home-card:hover .cg-home-card-thumb img { transform: scale(1.06); }
.cg-home-card-nothumb {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center; font-size: 3rem;
}
.cg-home-card-count {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,.6); color: #fff;
    font-size: .7rem; font-weight: 700;
    padding: 3px 8px; border-radius: 18px;
    display: flex; align-items: center; gap: 4px;
}
.cg-home-card-body { padding: 12px 14px 14px; }
.cg-home-card-title {
    font-size: .9rem; font-weight: 700;
    color: #111; margin: 0 0 4px; line-height: 1.35;
}
.cg-home-card-label {
    font-size: .75rem; color: #1565c0;
    margin: 0; font-style: italic; line-height: 1.3;
}

/* Pagination */
.cg-home-sc-pag {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 6px; margin: 36px 0 24px;
}
.cg-pag-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 10px;
    border: 1.5px solid #ddd !important; background: #fff !important;
    color: #555 !important; font-size: .9rem; font-weight: 700;
    text-decoration: none !important; transition: all .15s;
    box-shadow: none !important;
}
.cg-pag-btn:hover  { border-color: #1565c0 !important; color: #1565c0 !important; }
.cg-pag-btn.active { background: #1565c0 !important; border-color: #1565c0 !important; color: #fff !important; }

/* SEO text footer */
.cg-home-seo-text {
    margin-top: 44px; padding: 32px;
    background: #f7faff; border-radius: 14px;
    border: 1px solid #dde8f5;
}
.cg-home-seo-text h2 {
    font-size: 1.2rem; font-weight: 800; color: #1a237e;
    margin: 0 0 14px;
}
.cg-home-seo-text p {
    font-size: .9rem; color: #444; line-height: 1.75; margin: 0 0 10px;
}
.cg-home-seo-text p:last-child { margin-bottom: 0; }
.cg-home-seo-text strong { color: #1565c0; }

/* ── Responsive home shortcode ─────────────────────────────── */
@media (max-width: 1024px) {
    .cg-home-sc-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .cg-related-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 680px) {
    .cg-home-hero { padding: 40px 16px 32px; }
    .cg-home-sc-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .cg-related-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .cg-home-section-title { font-size: 1.1rem; }
    .cg-home-seo-text { padding: 20px; }
    .cg-rating-wrap { gap: 8px; }
    .cg-fav-page-btn { padding: 7px 12px; font-size: .78rem; }
}
