/* Colectibondi Digital v0.7.7 — scoped special pages only.
   The magazine masthead, advertisements and blue rule are never hidden. */
body.cbdhs-special-no-ticker .cb-ticker,
body.cbdhs-special-no-ticker .td_block_trending_now,
body.cbdhs-special-no-ticker .td-trending-now-wrapper,
body.cbdhs-special-no-ticker .td-trending-now-wrap,
body.cbdhs-special-no-ticker .tdb_header_trending,
body.cbdhs-special-no-ticker .tdb-trending-now-wrapper,
body.cbdhs-special-no-ticker .tdb_block_trending_now { display:none !important; }

/* White content surface. The decorative texture stays outside the section. */
body.cbdhs-special-white-canvas .cbdhs-special-surface {
    box-sizing:border-box;
    width:100%; max-width:1380px; min-width:0;
    margin:0 auto 22px;
    padding:clamp(18px, 2.8vw, 36px);
    background:#fff; border:1px solid #e3e9ef;
    border-radius:22px;
}
body.cbdhs-special-white-canvas .cbdhs-special-surface > :first-child {max-width:100%;}
body.cbdhs-special-white-canvas .cbdhs-special-surface :is(img,svg,iframe,video) {max-width:100%;}
body.cbdhs-special-white-canvas .cbdhs-special-surface :is(.cbg-grid,.cbg-single-grid,.cbg-category-grid,.cbg-search,.cbg-main-panel,.cbg-side-panel) {min-width:0;}
/* Keep Guide search positioned relative to the hero when using the original layout. */
body.cbdhs-special-white-canvas .cbdhs-special-surface .cbg-search-panel {margin-top:0;}
/* When no Digital header is active, show original Guide inside a white shell. */
body.cbdhs-special-white-canvas:not(.cbdhs-has-header) main.cbg-page-wrap {background:#fff;border-radius:22px;}

/* Native sections generated by Hub or standalone special plugins. */
body.cbdhs-special-white-canvas :is(main.cbl-places-index,main.cbm-wrap,main.cbhub-efem-page) {
    box-sizing:border-box; max-width:1380px; min-width:0;
    margin-inline:auto; background:#fff;
    border:1px solid #e3e9ef; border-radius:22px;
    padding:clamp(18px, 2.8vw, 36px);
}
/* WordPress / Newspaper page builders: white behind all blocks, not one card at a time. */
body.cbdhs-special-white-canvas :is(.td-main-content-wrap,.tdc-content-wrap,.cb-site-main) {background:#fff;}
body.cbdhs-special-white-canvas .cb-site-main .cb-page-wrap {background:#fff;}
body.cbdhs-special-white-canvas .td-page-content,
body.cbdhs-special-white-canvas .td-post-content {min-width:0;}
body.cbdhs-special-white-canvas :is(.td-main-content-wrap,.tdc-content-wrap) :is(img,iframe,video) {max-width:100%;}
body.cbdhs-special-white-canvas :is(.cbdhs-special-surface,.cbl-places-index,.cbm-wrap) table {max-width:100%;}
@media(max-width:782px) {
    body.cbdhs-special-white-canvas .cbdhs-special-surface,
    body.cbdhs-special-white-canvas :is(main.cbl-places-index,main.cbm-wrap,main.cbhub-efem-page) {
        margin-bottom:14px; padding:15px; border-radius:15px;
    }
    body.cbdhs-special-white-canvas .cbdhs-special-surface :is(.cbg-category-grid,.cbg-grid,.cbg-single-grid) {min-width:0;}
}

/* v0.7.6: ONE structural rhythm for archive, special CPT and regular Page templates.
   Publisher navbar, ad widgets and footer remain untouched. */
body.cbdhs-special-page { --cbdhs-layout-width: 1380px; --cbdhs-layout-gap: 16px; }
body.cbdhs-special-page .cbdhs-hero {
    box-sizing:border-box; width:100%; max-width:var(--cbdhs-layout-width);
    margin:0 auto var(--cbdhs-layout-gap);
}
body.cbdhs-special-white-canvas .cbdhs-special-surface {
    max-width:var(--cbdhs-layout-width);
    margin:0 auto 24px;
    padding:clamp(18px,2.8vw,36px);
}
/* Native plugin-generated pages have no the_content() for a shortcode or editor to wrap.
   Give each template's original <main> the same white outer canvas. */
body.cbdhs-special-white-canvas :is(
    main.cbl-places-index, main.cbl-place-wrap,
    main.cbm-wrap, main.cbr-index, main.cbr-wrap,
    main.cbhub-efem-page, main.cbg-page-wrap,
    main.cbem-specials-archive-page, main.cbem-special-page,
    main.cbem-case-single-page, main.cbem-miniatura-page,
    main.cbar-wrap
) {
    box-sizing:border-box;
    width:100%; max-width:var(--cbdhs-layout-width); min-width:0;
    margin-left:auto; margin-right:auto;
    background-color:#fff;
    border:1px solid #e3e9ef;
    border-radius:22px;
    padding:clamp(18px,2.8vw,36px);
}
/* When the Guide archive/single has an approved Digital header, the PHP wrapper
   already owns its white surface. Do not put the hero inside a second white card. */
body.cbdhs-special-white-canvas.cbdhs-has-header main.cbg-page-wrap {
    background:transparent; border:0; border-radius:0; padding:0;
}
/* The theme or Newspaper content template can surround third-party shortcodes.
   Do not give every tiny card a separate white background; preserve one continuous canvas. */
body.cbdhs-special-white-canvas :is(.td-main-content-wrap,.tdc-content-wrap,.cb-site-main) {
    box-sizing:border-box; min-width:0;
}
body.cbdhs-special-white-canvas :is(.td-post-content,.td-page-content,.cb-entry-content) {
    min-width:0; overflow-wrap:anywhere;
}
body.cbdhs-special-white-canvas :is(
    .cbdhs-special-surface,main.cbl-places-index,main.cbl-place-wrap,
    main.cbm-wrap,main.cbr-index,main.cbr-wrap,main.cbg-page-wrap,
    main.cbem-special-page,main.cbem-specials-archive-page
) :is(img,iframe,svg,video,canvas) { max-width:100%; }
/* Avoid changing page-wide advertising and global headers; constrain only special content. */
@media (max-width:782px) {
    body.cbdhs-special-page { --cbdhs-layout-gap:12px; }
    body.cbdhs-special-white-canvas :is(
        main.cbl-places-index,main.cbl-place-wrap,main.cbm-wrap,
        main.cbr-index,main.cbr-wrap,main.cbhub-efem-page,
        main.cbg-page-wrap,main.cbem-specials-archive-page,
        main.cbem-special-page,main.cbem-case-single-page,
        main.cbem-miniatura-page,main.cbar-wrap
    ) { padding:15px; border-radius:15px; }
    body.cbdhs-special-white-canvas.cbdhs-has-header main.cbg-page-wrap { padding:0; }
}

/* v0.7.7 — Tight editorial transition: blue brand rule → special hero.
   Keep every real ad, logo, menu and article unchanged. */
body.cbdhs-special-no-ticker .cb-site-header,
body.cbdhs-special-no-ticker .td-header-wrap {
    margin-bottom:0 !important;
    padding-bottom:0 !important;
}
/* The standalone theme always puts the ticker in an otherwise empty
   cb-container. Modern browsers can drop the empty block before first paint. */
body.cbdhs-special-no-ticker .cb-site-header > .cb-container:has(> .cb-ticker) {
    display:none !important;
}
/* Other supported themes leave empty layout wrappers around the hidden ticker.
   The small optional script marks a wrapper ONLY when it has no other children. */
body.cbdhs-special-no-ticker .cbdhs-empty-ticker-row {
    display:none !important;
    min-height:0 !important;
    height:0 !important;
    margin:0 !important;
    padding:0 !important;
}
body.cbdhs-special-page .cb-site-main,
body.cbdhs-special-page #content { margin-top:0 !important; padding-top:0 !important; }
body.cbdhs-special-page main.cbg-page-wrap,
body.cbdhs-special-page main.cbl-places-index,
body.cbdhs-special-page main.cbm-wrap,
body.cbdhs-special-page main.cbr-index { margin-top:0 !important; }
/* A small intentional gap (not a blank advertising-sized row). */
body.cbdhs-special-page main.cbg-page-wrap { padding-top:10px !important; }
body.cbdhs-special-page.cbdhs-has-header main.cbg-page-wrap { padding-top:8px !important; }
body.cbdhs-special-page main.cbg-page-wrap > :is(.cbdhs-hero,.cbg-hero):first-child {
    margin-top:0 !important;
}
@media (max-width:782px) {
    body.cbdhs-special-page main.cbg-page-wrap,
    body.cbdhs-special-page.cbdhs-has-header main.cbg-page-wrap { padding-top:6px !important; }
}


/* v0.7.8 — SAME editorial measure as the original Colectibondi masthead.
   Theme uses --cb-site-width:1180px and .cb-container at 1180 / 16px gutters.
   Guide used 1240px plus another Digital 1380px canvas, making the special
   visibly wider than the logo/blue line on desktop and on simulated mobile. */
body.cbdhs-special-page {
    --cbdhs-layout-width: min(var(--cb-site-width, 1180px), 1180px);
}
/* Guide templates are sometimes outside the theme's .cb-container.
   Apply the theme's own horizontal measure once, at the actual main wrapper.
   Avoid double horizontal padding from the original Guide stylesheet. */
body.cbdhs-special-page main.cbg-page-wrap {
    box-sizing: border-box !important;
    width: min(calc(100% - 48px), var(--cbdhs-layout-width)) !important;
    max-width: var(--cbdhs-layout-width) !important;
    min-width: 0 !important;
    padding: 8px 0 40px !important;
    margin: 0 auto !important;
}
/* The banner and all blocks MUST respect exactly the same wrapper width.
   No viewport-width / negative margin breakout. */
body.cbdhs-special-page main.cbg-page-wrap > :is(.cbdhs-hero,.cbg-hero,.cbdhs-special-surface),
body.cbdhs-special-page main.cbg-page-wrap > .cbdhs-special-surface :is(.cbg-search-panel,.cbg-categories,.cbg-directory,.cbg-single-grid) {
    box-sizing:border-box;
    width:100%;
    max-width:100%;
    min-width:0;
}
body.cbdhs-special-page main.cbg-page-wrap > :is(.cbdhs-hero,.cbg-hero) {
    margin-left:0 !important;
    margin-right:0 !important;
}
body.cbdhs-special-white-canvas main.cbg-page-wrap > .cbdhs-special-surface {
    box-sizing:border-box;
    margin: 0 0 22px !important;
    padding: clamp(14px, 2vw, 26px) !important;
}
/* Guide cards / search / filters previously had minimum content widths that
   could stretch flexible rows wider than their grid cell. Only address the
   known inner wrappers; tables keep their own scrolling behaviour. */
body.cbdhs-special-page main.cbg-page-wrap :is(
    .cbg-grid,.cbg-category-grid,.cbg-related-grid,.cbg-single-grid,
    .cbg-directory-head,.cbg-card,.cbg-card-main,.cbg-card-content,
    .cbg-search-panel,.cbg-search,.cbg-filters,.cbg-main-panel,.cbg-side-panel
) { min-width:0; max-width:100%; box-sizing:border-box; }
body.cbdhs-special-page main.cbg-page-wrap :is(.cbg-grid,.cbg-category-grid,.cbg-related-grid) {
    grid-template-columns:repeat(3,minmax(0,1fr));
}
body.cbdhs-special-page main.cbg-page-wrap .cbg-category-grid {
    grid-template-columns:repeat(4,minmax(0,1fr));
}
body.cbdhs-special-page main.cbg-page-wrap .cbg-related-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
}
body.cbdhs-special-page main.cbg-page-wrap .cbg-search input,
body.cbdhs-special-page main.cbg-page-wrap .cbg-filters select {
    min-width:0;
    max-width:100%;
    box-sizing:border-box;
}
body.cbdhs-special-page main.cbg-page-wrap :is(.cbg-card-content,.cbg-card-content h3,.cbg-category-card,.cbg-data-box) {
    overflow-wrap:anywhere;
}
/* Other plugin-created specials use the same masthead measure; do not touch
   global WordPress templates or third-party advertising. */
body.cbdhs-special-white-canvas :is(
    main.cbl-places-index, main.cbl-place-wrap, main.cbm-wrap,
    main.cbr-index, main.cbr-wrap, main.cbhub-efem-page,
    main.cbem-specials-archive-page, main.cbem-special-page,
    main.cbem-case-single-page, main.cbem-miniatura-page, main.cbar-wrap
) { max-width:var(--cbdhs-layout-width); }
@media(max-width:980px) {
    body.cbdhs-special-page main.cbg-page-wrap {
        width:calc(100% - 32px) !important;
    }
    body.cbdhs-special-page main.cbg-page-wrap .cbg-grid,
    body.cbdhs-special-page main.cbg-page-wrap .cbg-category-grid,
    body.cbdhs-special-page main.cbg-page-wrap .cbg-related-grid {
        grid-template-columns:repeat(2,minmax(0,1fr));
    }
    body.cbdhs-special-page main.cbg-page-wrap .cbg-single-grid {grid-template-columns:minmax(0,1fr);}
}
@media(max-width:600px) {
    body.cbdhs-special-page main.cbg-page-wrap {
        padding:6px 0 28px !important;
    }
    body.cbdhs-special-white-canvas main.cbg-page-wrap > .cbdhs-special-surface {
        padding:13px !important;
        border-radius:15px;
    }
    body.cbdhs-special-page main.cbg-page-wrap .cbg-grid,
    body.cbdhs-special-page main.cbg-page-wrap .cbg-category-grid,
    body.cbdhs-special-page main.cbg-page-wrap .cbg-related-grid {
        grid-template-columns:minmax(0,1fr);
    }
    body.cbdhs-special-page main.cbg-page-wrap :is(.cbg-search,.cbg-filters) {
        width:100%;
        min-width:0;
    }
}


/* v0.7.10 — Center the Guide search panel under the shared hero.
   The original Guide gave it 34/20/10px side margins, while Digital
   also makes it width:100%.  Together they shift the panel right and
   can push its right edge outside the white editorial shell.
   Scope to the actual Guide archive with an active Digital header;
   do not change single company profiles or the native Guide without it. */
body.cbdhs-special-page.cbdhs-has-header main.cbg-page-wrap > .cbdhs-special-surface > .cbg-search-panel {
    box-sizing: border-box !important;
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin-inline: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0;
    inset-inline: auto;
    transform: none;
}
body.cbdhs-special-page.cbdhs-has-header main.cbg-page-wrap > .cbdhs-special-surface > .cbg-search-panel .cbg-search {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
body.cbdhs-special-page.cbdhs-has-header main.cbg-page-wrap > .cbdhs-special-surface > .cbg-search-panel .cbg-search input {
    min-width: 0;
    box-sizing: border-box;
}
