/*
 * Banners: ticker, bar, pop-up, slide-in. Every colour comes from the brand tokens (config/static/brand/tokens.css).
 * The five theme blocks below are the ONLY colour combinations editors can choose. banners/themes.py defines the
 * same pairs and banners/tests.py checks both against WCAG AA, so keep the two in step.
 */
:root {
  --rs-ticker-height: 2.75rem;          /* 44px: also the minimum tap target */
  --rs-banner-radius: var(--rs-radius-pill, 999px);
  --rs-banner-card-radius: var(--rs-radius-card, 12px);
  --rs-banner-gap: 1rem;
  --rs-banner-z: 900;                   /* below the cookie banner (1000) */
  --rs-banner-clearance: 0px;           /* set by banners.js to the cookie banner height while it is open */
}

/* ---- themes ---- */
.rs-theme-ink       { --b-bg: var(--rs-brand-ink);       --b-fg: var(--rs-brand-white); --b-cta-bg: var(--rs-brand-tangerine); --b-cta-fg: var(--rs-brand-ink);   --b-focus: var(--rs-brand-canary); --b-dot: var(--rs-brand-tangerine); }
.rs-theme-tangerine { --b-bg: var(--rs-brand-tangerine); --b-fg: var(--rs-brand-footer); --b-cta-bg: var(--rs-brand-footer);   --b-cta-fg: var(--rs-brand-white); --b-focus: var(--rs-brand-footer); --b-dot: var(--rs-brand-footer); }
.rs-theme-ocean     { --b-bg: var(--rs-brand-ocean);     --b-fg: var(--rs-brand-white); --b-cta-bg: var(--rs-brand-canary);    --b-cta-fg: var(--rs-brand-ink);   --b-focus: var(--rs-brand-white);  --b-dot: var(--rs-brand-canary); }
.rs-theme-cream     { --b-bg: var(--rs-brand-cream);     --b-fg: var(--rs-brand-ink);   --b-cta-bg: var(--rs-brand-tangerine); --b-cta-fg: var(--rs-brand-ink);   --b-focus: var(--rs-brand-ink);    --b-dot: var(--rs-brand-tangerine); }
.rs-theme-canary    { --b-bg: var(--rs-brand-canary);    --b-fg: var(--rs-brand-ink);   --b-cta-bg: var(--rs-brand-ink);       --b-cta-fg: var(--rs-brand-white); --b-focus: var(--rs-brand-ink);    --b-dot: var(--rs-brand-ink); }

.rs-ticker, .rs-bar, .rs-popup, .rs-slidein {
  background: var(--b-bg);
  color: var(--b-fg);
  font-family: var(--rs-font, Roboto, Arial, sans-serif);
  font-size: 1rem;
  line-height: var(--rs-leading, 1.48);
}
.rs-ticker a:not(.rs-pill), .rs-bar a:not(.rs-pill), .rs-popup a:not(.rs-pill), .rs-slidein a:not(.rs-pill) { color: inherit; }

/* Focus ring: ink on light backgrounds, canary/white on dark (per theme token) */
.rs-ticker :focus-visible, .rs-bar :focus-visible, .rs-popup :focus-visible, .rs-slidein :focus-visible {
  outline: 3px solid var(--b-focus);
  outline-offset: 2px;
}
.rs-popup:focus-visible { outline: none; }

/* ---- shared bits ---- */
.rs-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px; padding: 0.5rem 1.5rem;
  border: 2px solid var(--b-cta-bg); border-radius: var(--rs-banner-radius);
  background: var(--b-cta-bg); color: var(--b-cta-fg) !important;
  font: inherit; font-size: var(--rs-button-size, 1.2rem); font-weight: 900;  /* large bold: keeps ink-on-tangerine AA */
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.rs-pill:hover { filter: brightness(1.06); }
.rs-pill--ghost { background: transparent; color: var(--b-fg) !important; border-color: var(--b-fg); font-size: 1rem; font-weight: 700; }
.rs-banner__close {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font: inherit; font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.rs-banner__close:hover { background: rgba(127, 127, 127, 0.25); }
.rs-preview-chip {
  display: inline-block; padding: 0 0.6rem; margin-right: 0.5rem; border: 2px solid currentColor;
  border-radius: var(--rs-banner-radius); font-size: 0.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---- ticker: static, wrapped list by default (no script, reduced motion) ---- */
.rs-ticker__bar { display: flex; align-items: stretch; }
.rs-ticker__viewport { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.rs-ticker__inner { display: block; }
.rs-ticker__group { display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0.25rem 1rem; list-style: none; gap: 0 var(--rs-banner-gap); }
.rs-ticker__group--clone { display: none; }
.rs-ticker__item { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 0.5rem; min-height: var(--rs-ticker-height); font-weight: 700; font-size: 1.05rem; }
.rs-ticker__cta { font-weight: 900; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 44px; }
.rs-ticker__dot { display: inline-block; width: 0.55rem; height: 0.55rem; margin-left: 0.5rem; border-radius: 50%; background: var(--b-dot); flex: none; }
.rs-ticker__item:last-child .rs-ticker__dot { display: none; }
.rs-ticker__toggle {
  flex: none; min-width: 44px; min-height: var(--rs-ticker-height); padding: 0 1rem; border: 0;
  border-left: 2px solid var(--b-dot); background: transparent; color: inherit; font: inherit; font-weight: 900; cursor: pointer;
}
.rs-ticker__toggle[hidden] { display: none; }

/* ---- ticker: scrolling only when motion is welcome AND scripting is on (otherwise the static list above) ---- */
@media (prefers-reduced-motion: no-preference) and (scripting: enabled) {
  .rs-ticker { --rs-ticker-duration: 60s; height: var(--rs-ticker-height); }
  .rs-ticker[data-speed="slow"] { --rs-ticker-duration: 90s; }
  .rs-ticker[data-speed="fast"] { --rs-ticker-duration: 35s; }
  .rs-ticker__inner { display: flex; width: max-content; animation: rs-ticker-scroll var(--rs-ticker-duration) linear infinite; }
  .rs-ticker__group, .rs-ticker__group--clone { display: flex; flex: 0 0 auto; flex-wrap: nowrap; padding: 0 0 0 1rem; gap: 0 var(--rs-banner-gap); }
  .rs-ticker__item { flex-wrap: nowrap; white-space: nowrap; }
  .rs-ticker__item:last-child .rs-ticker__dot { display: inline-block; }
  .rs-ticker:hover .rs-ticker__inner,
  .rs-ticker:focus-within .rs-ticker__inner,
  .rs-ticker.is-paused .rs-ticker__inner { animation-play-state: paused; }
}
/* The loop distance is exactly one group's width (set by banners.js); without JS, one sixth of the six copies. */
@keyframes rs-ticker-scroll { from { transform: translateX(0); } to { transform: translateX(var(--rs-ticker-distance, -16.6666667%)); } }

/* ---- bar ---- */
.rs-bar__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; max-width: var(--rs-max, 1180px); margin: 0 auto; padding: 0.4rem 0.75rem 0.4rem 1rem; }
.rs-bar__text { margin: 0; font-weight: 700; flex: 0 1 auto; }
.rs-bar .rs-banner__close { margin-left: auto; }
.rs-bar[hidden], .rs-ticker[hidden] { display: none; }

/* ---- pop-up ---- */
.rs-popup { border: 0; padding: 0; width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; border-radius: var(--rs-banner-card-radius); box-shadow: var(--rs-shadow-card, 0 20px 45px #12374620); }
.rs-popup::backdrop { background: rgba(11, 42, 53, 0.65); }
.rs-popup__panel { position: relative; padding: 2rem 1.5rem 1.5rem; }
.rs-popup__close { position: absolute; top: 0.25rem; right: 0.25rem; }
.rs-popup__image { display: block; max-width: 100%; height: auto; margin: 0 0 1rem; border-radius: var(--rs-banner-card-radius); }
.rs-popup__title { margin: 0 2rem 0.75rem 0; font-size: 1.6rem; line-height: 1.2; font-weight: 900; }
.rs-popup__title:focus { outline: none; }
.rs-popup__lead, .rs-popup__body { margin: 0 0 1rem; }
.rs-popup__body p { margin: 0 0 0.75rem; }
.rs-popup__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
@media (prefers-reduced-motion: no-preference) {
  .rs-popup[open] { animation: rs-popup-in 0.18s ease-out; }
}
@keyframes rs-popup-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- slide-in (bottom right, above the cookie banner area) ---- */
.rs-slidein {
  position: fixed; right: 1rem; bottom: calc(1rem + var(--rs-banner-clearance)); z-index: var(--rs-banner-z);
  width: min(22rem, calc(100vw - 2rem)); padding: 1.25rem 1rem 1rem; border-radius: var(--rs-banner-card-radius);
  box-shadow: var(--rs-shadow-card, 0 20px 45px #12374620);
}
.rs-slidein[hidden] { display: none; }
.rs-slidein .rs-banner__close { position: absolute; top: 0.1rem; right: 0.1rem; }
.rs-slidein__image { display: block; max-width: 100%; height: auto; margin: 0 0 0.75rem; border-radius: 8px; }
.rs-slidein__text { margin: 0 1.75rem 0.75rem 0; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .rs-slidein.is-open { animation: rs-slide-in 0.25s ease-out; }
}
@keyframes rs-slide-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
  .rs-slidein { left: 1rem; right: 1rem; width: auto; }
  .rs-popup__actions .rs-pill { flex: 1 1 100%; }
}


/* ============ Livelier look (decoration only; colours come from each banner's own, already-tested pair) ============ */

/* Ticker: a news-channel label, drawn as the inverse of the strip colours so it always passes contrast */
.rs-ticker__label { flex: none; display: inline-flex; align-items: center; padding: 0 1.1rem 0 1rem; background: var(--b-fg); color: var(--b-bg); font-weight: 900; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); margin-right: 8px; }

/* Bar: soft brand circles at the ends */
.rs-bar { position: relative; overflow: hidden; }
.rs-bar::before, .rs-bar::after { content: ""; position: absolute; border-radius: 50%; background: currentColor; opacity: .1; pointer-events: none; }
.rs-bar::before { left: -26px; top: -30px; width: 84px; height: 84px; }
.rs-bar::after { right: 70px; bottom: -34px; width: 64px; height: 64px; }
.rs-bar__inner { position: relative; z-index: 1; }

/* Pop-up: leaf-shaped card, brand circles and a ring pattern behind the content, accent rule under the title */
.rs-popup { border-radius: 0 64px 0 64px; box-shadow: 0 30px 70px rgba(11, 42, 53, .45); }
.rs-popup::backdrop { background: rgba(11, 42, 53, .72); backdrop-filter: blur(3px); }
.rs-popup__panel { overflow: hidden; padding: 2.25rem 2rem 1.75rem; }
.rs-popup__panel > * { position: relative; z-index: 1; }
.rs-popup__panel::before { content: ""; position: absolute; z-index: 0; top: -70px; right: -70px; width: 220px; height: 220px; border-radius: 50%; background: currentColor; opacity: .07; pointer-events: none; }
.rs-popup__panel::after { content: ""; position: absolute; z-index: 0; right: -6px; bottom: -6px; box-sizing: content-box; width: 40px; height: 40px; border: 3px solid var(--b-cta-bg); border-radius: 50%; box-shadow: 0 0 0 10px var(--b-bg), 0 0 0 13px var(--b-cta-bg), 0 0 0 23px var(--b-bg), 0 0 0 26px var(--b-cta-bg), 0 0 0 36px var(--b-bg), 0 0 0 39px var(--b-cta-bg); opacity: .55; pointer-events: none; }
.rs-popup__title { position: relative; padding-bottom: .85rem; font-size: 1.9rem; }
.rs-popup__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 56px; height: 4px; border-radius: 2px; background: var(--b-cta-bg); }
.rs-popup__image { border-radius: 0 40px 0 40px; box-shadow: 0 12px 28px rgba(11, 42, 53, .25); }
.rs-popup .rs-banner__close { background: rgba(127, 127, 127, .18); }
.rs-popup .rs-pill { box-shadow: 0 6px 16px rgba(11, 42, 53, .22); }

/* Slide-in: leaf corner, accent edge and a brand circle */
.rs-slidein { overflow: hidden; border-radius: 0 40px 0 40px; border-left: 8px solid var(--b-cta-bg); padding: 1.25rem 1.1rem 1.1rem 1rem; box-shadow: 0 18px 44px rgba(11, 42, 53, .35); }
.rs-slidein > * { position: relative; z-index: 1; }
.rs-slidein::before { content: ""; position: absolute; z-index: 0; right: -10px; bottom: -10px; box-sizing: content-box; width: 40px; height: 40px; border: 3px solid var(--b-cta-bg); border-radius: 50%; box-shadow: 0 0 0 10px var(--b-bg), 0 0 0 13px var(--b-cta-bg), 0 0 0 23px var(--b-bg), 0 0 0 26px var(--b-cta-bg), 0 0 0 36px var(--b-bg), 0 0 0 39px var(--b-cta-bg); opacity: .55; pointer-events: none; }
.rs-slidein__text { font-size: 1.05rem; }
/* The close button stays in the corner (the rule above gives every panel child position: relative) */
.rs-popup__panel > .rs-popup__close { position: absolute; top: .6rem; right: .75rem; z-index: 3; }
.rs-slidein > .rs-banner__close { position: absolute; top: .1rem; right: .1rem; z-index: 3; }

/* Phones: a shorter top bar (29 Nov 2026). The button keeps its large bold label (contrast rule for the ink theme). */
@media (max-width: 600px) {
  .rs-bar__inner { justify-content: flex-start; gap: 0.4rem 0.75rem; padding: 0.5rem 0.5rem 0.55rem 1rem; }
  .rs-bar__text { flex: 1 1 100%; font-size: 0.95rem; line-height: 1.35; padding-right: 2.5rem; }
  .rs-bar .rs-pill { padding: 0.3rem 1.1rem; }
  .rs-bar .rs-banner__close { position: absolute; top: 0.2rem; right: 0.25rem; margin: 0; }
}

/* Smaller top-bar button and text (client, 29 Nov 2026). Only for themes whose button contrast does not rely on
   large text (canary, ocean, tangerine); ink and cream keep the large bold label they need for AA. */
.rs-bar__text { font-size: 0.95rem; line-height: 1.35; }
.rs-bar.rs-theme-canary .rs-pill, .rs-bar.rs-theme-ocean .rs-pill, .rs-bar.rs-theme-tangerine .rs-pill {
  box-sizing: border-box; min-height: 36px; padding: 0.2rem 1rem; font-size: 0.95rem; font-weight: 700;
}
@media (max-width: 600px) {
  .rs-bar__text { font-size: 0.875rem; }
  .rs-bar.rs-theme-canary .rs-pill, .rs-bar.rs-theme-ocean .rs-pill, .rs-bar.rs-theme-tangerine .rs-pill {
    min-height: 34px; padding: 0.15rem 0.9rem; font-size: 0.875rem;
  }
}

/* Bold words inside a bar's message ("Words in bold" field). */
.rs-bar__text .rs-bar__bold { font-weight: 900; }

/* Christmas decoration (client, 29 Nov 2026): navy tree with a white star and baubles, white snowflakes and
   snow, white button with navy text (navy on white 12:1). Decorations are aria-hidden. */
.rs-bar--christmas::before, .rs-bar--christmas::after { display: none; }
.rs-xmas-snow { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.rs-xmas-tree { flex: none; color: var(--b-fg); }
.rs-bar--christmas .rs-bar__inner { gap: 0.5rem 0.8rem; }
.rs-bar--christmas .rs-bar__text { font-weight: 500; }
.rs-bar.rs-bar--christmas .rs-pill { background: #fff; border-color: #fff; color: var(--rs-design-navy, #06354f) !important; box-shadow: 0 2px 6px rgba(6, 53, 79, .18); }

/* Christmas bar layout (client, 29 Nov 2026): tree, title and button centred; the close cross on its own at the
   right. Phones: a small pill button, whole strip also tappable (banners.js). */
.rs-bar--christmas .rs-bar__inner { justify-content: center; padding-right: 3.25rem; padding-left: 3.25rem; }
/* The cross is placed against the full-width strip (not the centred content) so it never meets a snowflake. */
.rs-bar--christmas .rs-bar__inner { position: static; }
.rs-bar--christmas .rs-xmas-tree, .rs-bar--christmas .rs-bar__text, .rs-bar--christmas .rs-pill { position: relative; z-index: 1; }
.rs-bar--christmas .rs-banner__close { position: absolute; top: 50%; right: 0.75rem; margin: 0; transform: translateY(-50%); z-index: 2; }
@media (min-width: 601px) and (max-width: 1100px) {
  .rs-xmas-snow__flakes > svg:nth-child(4), .rs-xmas-snow__flakes > svg:nth-child(5),
  .rs-xmas-snow__dots circle:nth-child(4), .rs-xmas-snow__dots circle:nth-child(5) { display: none; }
}
@media (max-width: 600px) {
  .rs-bar--linked .rs-bar__inner { flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 0.55rem; padding: 0.4rem 2.9rem 0.4rem 0.8rem; }
  .rs-bar--linked .rs-bar__text { flex: 1 1 auto; padding-right: 0; font-size: 0.75rem; line-height: 1.25; }
  .rs-bar--linked .rs-bar__text .rs-bar__bold { font-weight: 800; }
  .rs-bar.rs-bar--linked .rs-pill { flex: none; min-height: 28px; padding: 0.15rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
  .rs-bar--linked .rs-banner__close { right: 0.2rem; }
  .rs-bar--linked .rs-bar__text, .rs-bar--linked .rs-xmas-tree { pointer-events: none; }
  .rs-xmas-tree { width: 18px; height: 22px; }
  /* Phones: no room for snowflakes without covering the words or the cross; the tree stays. */
  .rs-xmas-snow { display: none; }
}
}
