/* ==========================================================================
   NCG Ticker — announcement / CTA / ticker bars
   Colors come from inline styles (per-ticker), so this only handles layout,
   positioning, and motion.
   ========================================================================== */

.ncg-ticker {
    /* Colors come from a scheme class (or the custom inline vars). Defaults
       mirror the Brand scheme so an unclassed bar still renders sensibly. */
    --tkr-bg: #23312C;
    --tkr-fg: #ffffff;
    --tkr-border: #C89B7B;

    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    z-index: 9990;
    box-sizing: border-box;
    background: var(--tkr-bg);
    color: var(--tkr-fg);
}

/* Inherit the scheme text color everywhere inside the bar. */
.ncg-ticker .ncg-ticker-cta,
.ncg-ticker .ncg-ticker-dismiss { color: var(--tkr-fg); }

/* ==========================================================================
   COLOR SCHEMES — contrast-checked (WCAG AA) light/base values.
   General: brand / info / success / neutral / dark.
   Severity: caution (yellow) / warning (orange) / critical (red).
   ========================================================================== */
.ncg-ticker.scheme-brand    { --tkr-bg:#23312C; --tkr-fg:#ffffff; --tkr-border:#C89B7B; }
.ncg-ticker.scheme-info     { --tkr-bg:#e7f0fb; --tkr-fg:#0b3d78; --tkr-border:#2271b1; }
.ncg-ticker.scheme-success  { --tkr-bg:#e6f4ea; --tkr-fg:#14532d; --tkr-border:#2a7d46; }
.ncg-ticker.scheme-neutral  { --tkr-bg:#ffffff; --tkr-fg:#1d2327; --tkr-border:#c3c4c7; }
.ncg-ticker.scheme-dark     { --tkr-bg:#1d2327; --tkr-fg:#ffffff; --tkr-border:#3c434a; }
.ncg-ticker.scheme-caution  { --tkr-bg:#f6c343; --tkr-fg:#1d2327; --tkr-border:#b8890a; }
.ncg-ticker.scheme-warning  { --tkr-bg:#a85300; --tkr-fg:#ffffff; --tkr-border:#7a3d00; }
.ncg-ticker.scheme-critical { --tkr-bg:#b32d2e; --tkr-fg:#ffffff; --tkr-border:#8a1f20; }

.ncg-ticker .ncg-ticker-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 44px 10px 20px; /* right padding leaves room for the × */
    position: relative;
}

.ncg-ticker-content {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    min-width: 0;
}

.ncg-ticker-msg { display: inline; }

.ncg-ticker-cta {
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
}
.ncg-ticker-cta:hover { opacity: 0.85; }

/* Dismiss button */
.ncg-ticker-dismiss {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px 8px;
}
.ncg-ticker-dismiss:hover { opacity: 1; }

/* ---- Positions (each carries a scheme-colored border) ------------------- */
/* Top: injected at wp_body_open, flows in normally and pushes the page down. */
.ncg-ticker.pos-top {
    position: relative;
    border-bottom: 3px solid var(--tkr-border);
}

/* Bottom: fixed to the viewport bottom. */
.ncg-ticker.pos-bottom {
    position: fixed;
    left: 0;
    bottom: 0;
    border-top: 3px solid var(--tkr-border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.12);
}

/* Inline: a bordered banner card, matching the left-accent style used by the
   other NCG shortcodes (e.g. the survey/newsletter panels). */
.ncg-ticker.pos-inline {
    position: relative;
    border: 1px solid var(--tkr-border);
    border-left-width: 5px;
    border-radius: 8px;
    margin: 20px 0;
}

/* ---- Type: CTA (make the link a button) --------------------------------- */
.ncg-ticker.type-cta .ncg-ticker-cta {
    border: 2px solid currentColor;
    border-radius: 4px;
    padding: 6px 16px;
}

/* ---- Type: Ticker (scrolling marquee) ----------------------------------- */
.ncg-ticker.type-ticker .ncg-ticker-content { width: 100%; flex-wrap: nowrap; }
.ncg-ticker-marquee {
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.ncg-ticker-marquee span {
    display: inline-block;
    padding-left: 100%;
    animation: ncg-ticker-scroll 22s linear infinite;
}
.ncg-ticker.type-ticker:hover .ncg-ticker-marquee span { animation-play-state: paused; }

@keyframes ncg-ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}

@media (max-width: 600px) {
    .ncg-ticker { font-size: 14px; }
    .ncg-ticker .ncg-ticker-inner { padding: 9px 40px 9px 14px; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .ncg-ticker-marquee span { animation: none; padding-left: 0; }
}

/* ==========================================================================
   ACCESSIBILITY
   Hooks into the NCG a11y toolbar (html[data-ncg-theme="…"]) so the color
   schemes stay legible in dark and high-contrast modes, plus keyboard focus
   and OS-level contrast preferences.
   ========================================================================== */

/* Keyboard focus — visible ring in the bar's own text color. */
.ncg-ticker-dismiss:focus-visible,
.ncg-ticker-cta:focus-visible {
    outline: 2px solid var(--tkr-fg);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ---- Dark mode ---------------------------------------------------------- */
/* Light-background schemes would glare on a dark page; remap them to dark
   surfaces (using the a11y theme variables) while keeping the accent border.
   The vivid schemes (brand/dark/severity) already read well on dark. */
html[data-ncg-theme="dark"] .ncg-ticker.scheme-neutral {
    --tkr-bg: var(--ncg-color-bg-paper, #1A1F1D);
    --tkr-fg: var(--ncg-color-body, #E4E4E4);
    --tkr-border: var(--ncg-color-border, #5A5A5A);
}
html[data-ncg-theme="dark"] .ncg-ticker.scheme-info {
    --tkr-bg: #10263d; --tkr-fg: #cfe3fb; --tkr-border: #3f8fd6;
}
html[data-ncg-theme="dark"] .ncg-ticker.scheme-success {
    --tkr-bg: #10281a; --tkr-fg: #bfe6cd; --tkr-border: #3fae68;
}
html[data-ncg-theme="dark"] .ncg-ticker.scheme-caution {
    --tkr-bg: #3a2c05; --tkr-fg: #f6d675; --tkr-border: #b8890a;
}

/* ---- High contrast ------------------------------------------------------ */
/* Prioritize legibility over hue: black field, white text, a bold border kept
   in the scheme accent for at-a-glance severity, and a classic yellow link. */
html[data-ncg-theme="high-contrast"] .ncg-ticker {
    --tkr-bg: #000000 !important;
    --tkr-fg: #ffffff !important;
}
html[data-ncg-theme="high-contrast"] .ncg-ticker.pos-top,
html[data-ncg-theme="high-contrast"] .ncg-ticker.pos-bottom,
html[data-ncg-theme="high-contrast"] .ncg-ticker.pos-inline {
    border-width: 4px;
    border-color: var(--tkr-border);
}
html[data-ncg-theme="high-contrast"] .ncg-ticker.scheme-neutral,
html[data-ncg-theme="high-contrast"] .ncg-ticker.scheme-dark,
html[data-ncg-theme="high-contrast"] .ncg-ticker.scheme-brand {
    --tkr-border: #ffffff; /* these accents would vanish on black */
}
html[data-ncg-theme="high-contrast"] .ncg-ticker .ncg-ticker-cta { color: #ffff00; }
html[data-ncg-theme="high-contrast"] .ncg-ticker.type-cta .ncg-ticker-cta { border-color: #ffff00; }

/* ---- OS-level "more contrast" preference -------------------------------- */
@media (prefers-contrast: more) {
    .ncg-ticker.pos-top { border-bottom-width: 4px; }
    .ncg-ticker.pos-bottom { border-top-width: 4px; }
    .ncg-ticker.pos-inline { border-width: 2px; border-left-width: 6px; }
}
