/*
 * racingtips skin for blocks that come from the gg parent theme.
 *
 * GG and RT share token NAMES (--vc-color-*), but not their meaning: GG is light-only (neutral-5 is
 * white, neutral-0 black), RT is dark-first with a light mode that inverts its neutral scale, and
 * GG's brand dark is blue where RT's is near-black. Every new GG block is wrapped in .rt-gg-block
 * (inc/rt-gg-blocks.php); inside it, each GG token is pointed at the RT colour that plays the same
 * role. RT's values are taken from --rt-* aliases computed on <html>, so they follow the RT light/
 * dark switch and never reference themselves.
 */

:root,
[data-theme] {
    --rt-n0: var(--vc-color-neutral-0);
    --rt-n1: var(--vc-color-neutral-1);
    --rt-n2: var(--vc-color-neutral-2);
    --rt-n3: var(--vc-color-neutral-3);
    --rt-n4: var(--vc-color-neutral-4);
    --rt-n5: var(--vc-color-neutral-5);
    --rt-n6: var(--vc-color-neutral-6);
    --rt-n7: var(--vc-color-neutral-7);
    --rt-n8: var(--vc-color-neutral-8);
    --rt-n9: var(--vc-color-neutral-9);
    --rt-n10: var(--vc-color-neutral-10);
    --rt-accent: var(--vc-color-primary-0);
    --rt-accent-2: var(--vc-color-primary-1);
    --rt-accent-soft: var(--vc-color-primary-2);
    --rt-brand: var(--vc-color-primary-two-0);
    --rt-brand-2: var(--vc-color-primary-two-1);
    --rt-line: var(--vc-color-primary-two-2);
    --rt-bg: var(--vc-body-bg);
    --rt-text: var(--vc-body-color);
    --rt-panel: var(--vc-background-0);
    --rt-panel-2: var(--vc-background-1);
}

.rt-gg-block {
    /* GG neutral scale (white … black) → RT scale by distance from the page background */
    --vc-color-neutral-0: var(--rt-n10); /* strongest text */
    --vc-color-neutral-1: var(--rt-n7); /* body text */
    --vc-color-neutral-9: var(--rt-n6);
    --vc-color-neutral-12: var(--rt-n8);
    --vc-color-neutral-14: var(--rt-n7);
    --vc-color-neutral-8: var(--rt-n5); /* secondary text */
    --vc-color-neutral-15: var(--rt-n5);
    --vc-color-neutral-2: var(--rt-n4); /* muted text */
    --vc-color-neutral-10: var(--rt-n4);
    --vc-color-neutral-6: var(--rt-n4);
    --vc-color-neutral-7: var(--rt-n3); /* borders */
    --vc-color-neutral-3: var(--rt-n1); /* subtle panels */
    --vc-color-neutral-4: var(--rt-n1);
    --vc-color-neutral-5: var(--rt-bg); /* card / page surface */

    /* GG blues → RT greys/black; GG orange CTA → RT yellow */
    --vc-color-primary-two-0: var(--rt-brand);
    --vc-color-primary-two-1: var(--rt-brand-2);
    --vc-color-primary-two-2: var(--rt-line);
    --vc-color-primary-two-3: var(--rt-line);
    --vc-color-primary-two-4: var(--rt-n1);
    --vc-color-primary-two-6: var(--rt-n1);
    --vc-color-primary-0: var(--rt-accent);
    --vc-color-primary-1: var(--rt-accent-2);
    --vc-color-primary-2: var(--rt-accent-soft);

    --vc-background-0: var(--rt-bg);
    --vc-background-1: var(--rt-panel);
    --vc-background-2: var(--rt-n1);
    --vc-background-3: var(--rt-panel-2);
    --vc-body-bg: var(--rt-bg);
    --vc-body-color: var(--rt-text);
    --vc-color-error-1: #e07a70;
    --vc-color-shadow: color-mix(in srgb, var(--rt-bg) 70%, transparent);

    color: var(--rt-text);
}

/* RT typography everywhere inside GG blocks (GG uses Helvetica / Archivo in places) */
.rt-gg-block,
.rt-gg-block * {
    font-family: Poppins, 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* RT buttons: yellow CTA with dark label, as on the rest of the site */
.rt-gg-block .vc-btn--primary,
.rt-gg-block .vc-bookmaker-btn {
    background-color: var(--rt-accent);
    border-color: var(--rt-accent);
    color: #070709; /* dark label on yellow in both modes, like RT's own CTAs */
}

.rt-gg-block .vc-btn--primary:hover,
.rt-gg-block .vc-bookmaker-btn:hover {
    background-color: var(--rt-accent-2);
    border-color: var(--rt-accent-2);
}

.rt-gg-block a:not([class]) {
    color: var(--rt-accent);
}

/* Side dock (GG Tips chat trigger) lives outside blocks */
.vc-side-dock {
    --vc-side-dock-bg: var(--rt-brand);
    --vc-side-dock-line: var(--rt-line);
}

.vc-side-dock .vc-side-dock__btn {
    color: var(--rt-accent);
}

/*
 * GG uses primary-two-0 as its "ink" colour (headings, values, tabs) as well as for dark fills.
 * RT's brand token is near-black in dark mode, which made that text invisible, so point it at the
 * RT text colour, and in dark mode use GG's own dark palette (the same greys as RT dark), since
 * GG's [data-theme=dark] rules (scoped by scope-gg-css.js) are written against those values.
 */
.rt-gg-block {
    --vc-color-primary-two-0: var(--rt-text);
}

[data-theme=dark] .rt-gg-block {
    --vc-color-primary-two-0: #f0f0f0;
    --vc-color-primary-two-1: #8c8c8c;
    --vc-color-primary-two-2: #535358;
    --vc-color-primary-two-3: #595959;
    --vc-color-primary-two-4: #535358;
    --vc-color-primary-two-6: #202024;
    --vc-color-neutral-0: #fff;
    --vc-color-neutral-1: #f5f5f5;
    --vc-color-neutral-2: #747474;
    --vc-color-neutral-3: #535358;
    --vc-color-neutral-4: #f5f5f5;
    --vc-color-neutral-5: #fff;
    --vc-color-neutral-6: #bfbfbf;
    --vc-color-neutral-7: #bfbfbf;
    --vc-color-neutral-8: #707070;
    --vc-color-neutral-9: #262626;
    --vc-color-neutral-10: #707070;
    --vc-background-0: #202024;
    --vc-background-1: #535358;
    --vc-background-2: #202024;
    --vc-background-3: #35353a;
    --vc-color-shadow: rgba(0, 0, 0, .7);
}

/* RT light mode: yellow text is unreadable on white, so links and accents use RT's darker gold
   (RT's own light-mode links do the same). Buttons keep the bright yellow via --rt-accent. */
[data-theme=light] .rt-gg-block {
    --vc-color-primary-0: var(--rt-accent-2);
}

[data-theme=light] .rt-gg-block a:not([class]) {
    color: var(--rt-accent-2);
}

/* GG stats tables hard-code GG blue (#1d4380) on their header row: RT black in light mode,
   RT panel grey in dark mode */
.rt-gg-block .naps__head,
.rt-gg-block .course-distance-winners__head,
.rt-gg-block .first-time-stats__head,
.rt-gg-block .longest-travellers__head {
    background: #070709;
    color: #f0f0f0;
}

[data-theme=dark] .rt-gg-block .naps__head,
[data-theme=dark] .rt-gg-block .course-distance-winners__head,
[data-theme=dark] .rt-gg-block .first-time-stats__head,
[data-theme=dark] .rt-gg-block .longest-travellers__head {
    background: #202024;
}

.rt-gg-block .toplist-casino__name,
.rt-gg-block .toplist-casino__offer-title,
.rt-gg-block .toplist-casino__meta-value,
.rt-gg-block .toplist-casino__score-value {
    color: var(--vc-color-primary-two-0);
}

/* Racecard "GG Edge" view: the Racing Tips Score box is black with white figures in both modes */
.rt-gg-block .vc-rc-smart .vc-rc-smart__tile--score .vc-rc-smart__tile-value {
    background-color: #000;
    color: #fff;
}

[data-theme=dark] .rt-gg-block .vc-rc-smart .vc-rc-smart__tile--score .vc-rc-smart__tile-value {
    box-shadow: inset 0 0 0 1px #35353a;
}

/*
 * Footer gambling logos: WordPress 6.7+ gives lazy images sizes="auto", which reserves a
 * 3000x1500 box until the file loads, so a slow or missing logo blew the footer up to ~3,500px.
 * Keep every logo at the row height.
 */
.vc-footer__gambling img {
    height: 36px;
    width: auto;
    max-width: 100%;
    contain-intrinsic-size: auto 36px;
}

/* No Sports Widgets plugin on RT yet (see inc/rt-price-boosts.php): hide the boosts tab and toggles */
.rt-no-price-boosts #tab-price-boosts,
.rt-no-price-boosts #panel-price-boosts,
.rt-no-price-boosts .gg-boosts-acc__trigger,
.rt-no-price-boosts .gg-boosts-acc__target,
.rt-no-price-boosts .profile__boosts {
    display: none !important;
}

/* "View Course": RT's main.css sizes the old accordion-js panel to height 0; GG's panel opens with
   grid rows (0fr → 1fr), so let it take its own height */
.rt-gg-block .vc-race-course-details__accordion-target.gg-accordion__target {
    height: auto;
}
