.tg-item.ataa1-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    max-width: 320px;
}

.tg-thumb-link {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.tg-thumb-link img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    transition: transform 0.22s ease;
}

.tg-thumb-link:hover img {
    transform: scale(1.02);
}

.tg-item-title {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.38;
    font-weight: 600;
    color: #101828;
}

.tg-item-title a {
    color: inherit;
    text-decoration: none;
}

.tg-item-title a:hover {
    color: #c45500;
}

.tg-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.94rem;
    line-height: 1.1;
    color: #0f172a;
}

.tg-rating-score {
    font-weight: 700;
}

.tg-stars {
    letter-spacing: 0.02em;
    color: #f59e0b;
    font-size: 0.92rem;
}

.tg-rating-count {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.tg-rating-count:hover {
    color: #c45500;
}

.tg-price {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    color: #111111;
    line-height: 1;
}

.tg-price-whole {
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: -0.04em;
}

.tg-price-decimal,
.tg-price-currency {
    font-size: 1rem;
    font-weight: 600;
    transform: translateY(0.22rem);
}

.tg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tg-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    line-height: 1.2;
    font-weight: 700;
    color: #111827;
    background: #ffd814;
    text-decoration: none;
}

.tg-link:hover {
    background: #f7ca00;
    color: #111827;
}

@media (max-width: 560px) {
    .tg-item.ataa1-card {
        max-width: 100%;
    }
}

/* Disabled state: product has no affiliate link yet */
.ataa1-card--no-link {
    opacity: 0.65;
}

.ataa1-card--no-link .tg-thumb-link,
.ataa1-card--no-link .tg-item-title a,
.ataa1-card--no-link .tg-rating-count {
    pointer-events: none;
    cursor: not-allowed;
}

.ataa1-card--no-link .tg-link--disabled {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
    user-select: none;
}

/* ── Block editor wrapper ───────────────────── */
.ataa1-block-editor-wrapper {
    position: relative;
    display: block;
    max-width: 100%;
}

/* Desactivar links dentro del editor */
.ataa1-block-editor-wrapper .tg-item a,
.ataa1-block-editor-wrapper .ataa1-card a {
    pointer-events: none;
    cursor: default;
}

/* Overlay de hover */
.ataa1-block-preview {
    position: relative;
    display: block;
}

.ataa1-block-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: auto;
    cursor: pointer;
}

.ataa1-block-editor-wrapper:hover .ataa1-block-preview-overlay {
    opacity: 1;
}

/* Controles inline cuando el bloque está seleccionado */
.ataa1-block-inline-controls {
    margin-top: 10px;
    padding: 12px 14px;
    background: #f6f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-width: 340px;
}

.ataa1-block-inline-controls .components-select-control {
    margin: 0;
}

/* ── Store page: hide header, reset margins ──── */
body:has(.ataa1-store-layout) .wp-site-blocks > header,
body:has(.ataa1-store-layout) .wp-block-template-part { display: none !important; }
body:has(.ataa1-store-layout)                          { margin-top: 0 !important; }
body:has(.ataa1-store-layout) main,
body:has(.ataa1-store-layout) .wp-block-post-content,
body:has(.ataa1-store-layout) .entry-content.wp-block-post-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
body:has(.ataa1-store-layout) .wp-block-post-title { display: none !important; }

/* ── Store page layout ───────────────────────── */
.tg-page { color: #101828; margin-top: 0 !important; }
.tg-page.alignwide { max-width: 1380px; margin-left: auto !important; margin-right: auto !important; }
.tg-page a { text-decoration: none !important; }

.tg-shell { display: grid; gap: 28px; padding: 0 6px 36px; }

.tg-hero  {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(140px, 24vw, 280px);
    gap: 28px;
    align-items: stretch;
}
.tg-brand { display: grid; gap: 14px; align-content: start; width: 100%; }

.tg-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 156px;
    gap: 16px;
    justify-content: flex-end;
    align-items: stretch;
    align-self: stretch;
    height: 100%;
}

.tg-cat-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-height: 180px;
    border-radius: 28px;
    overflow: hidden;
    background: transparent;
}

.tg-cat-card img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}

.tg-support-card { display: grid; gap: 14px; }

.tg-pill,
.tg-box-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    text-decoration: none;
}

.tg-pill { min-height: 66px; }

.tg-pill img,
.tg-box-link img {
    width: 100%;
    max-width: 140px;
    height: auto;
    display: block;
    object-fit: contain;
}

.tg-title {
    margin: 0 !important;
    font-size: clamp(3.2rem, 6vw, 5.8rem) !important;
    line-height: 0.9 !important;
    letter-spacing: -0.06em !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    color: #f26a21 !important;
    text-shadow: -2px -2px 0 #111, 2px -2px 0 #111, -2px 2px 0 #111, 2px 2px 0 #111 !important;
}
.tg-subtitle {
    margin: 0 !important;
    font-size: clamp(1.25rem, 2vw, 2rem) !important;
    font-style: italic !important;
    font-weight: 700 !important;
    line-height: 1.18 !important;
    color: #18181b !important;
}
.tg-affiliate {
    margin: 0 !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    color: #475467 !important;
}

.tg-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}
.tg-gallery .tg-item { max-width: none; }

/* WordPress 6.3+ native grid adds is-layout-grid — ensure our gap wins */
.tg-gallery.is-layout-grid { gap: 22px; }

/* Editor: if Gutenberg auto-wraps cards in a Row group during drag,
   make that wrapper transparent to the grid so its children
   participate as direct grid items. */
.tg-gallery > .wp-block-group.is-layout-flex {
    display: contents;
}

/* Force all editor wrappers inside gallery cells to fill width */
.tg-gallery .wp-block {
    max-width: 100% !important;
    width: 100%;
    min-width: 0;
}
.tg-gallery .ataa1-block-editor-wrapper,
.tg-gallery .ataa1-block-preview,
.tg-gallery .wp-block-server-side-render {
    width: 100%;
    min-width: 0;
}

@media (max-width: 1080px) {
    .tg-hero { grid-template-columns: minmax(0, 1fr) clamp(120px, 26vw, 220px); }
    .tg-side { grid-template-columns: minmax(0, 1fr) 132px; }
}

@media (max-width: 640px)  {
    .tg-shell { gap: 16px; padding-top: 2px; }
    .tg-hero { grid-template-columns: 1fr; gap: 16px; }
    .tg-cat-card { border-radius: 20px; max-height: 110px; }
    .tg-side {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        justify-content: start;
        max-width: 230px;
    }
    .tg-support-card { gap: 10px; align-content: center; }
    .tg-pill { min-height: auto; }
    .tg-pill img,
    .tg-box-link img { max-width: 118px; }
}
