/* Day/night theme. Night = html[data-bs-theme="dark"] (also switches Bootstrap 5.3 components).
   Set by the inline script in _header.php: saved choice (localStorage "zlark-theme") or OS preference. */

/* Toggle button (header): same look as the other navbar icons (32px feather icon in a 36px box, no outline) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; border-radius: 6px; }
.theme-toggle svg { width: 32px; height: 32px; }
.theme-toggle .theme-icon-sun { display: none; }
/* header-shell is a 3-col grid on desktop; add a column and put the toggle last (after the CTA) */
@media (min-width: 1200px) {
  .header-shell:has(.theme-toggle) { grid-template-columns: auto 1fr auto auto; }
  .theme-toggle { margin-left: 0; order: 1; }
  .theme-toggle svg { width: 24px; height: 24px; }
}
/* mobile: keep the hamburger last, toggle just before it */
@media (max-width: 1199px) {
  .header-shell .navmenu { order: 2; }
  .theme-toggle { order: 1; margin-left: auto; margin-right: 10px; }
}
html[data-bs-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
html[data-bs-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }

/* ---------- Night palette ---------- */
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --background-color: #0b0b0c;
  --default-color: #d8d8dc;
  --heading-color: #f4f4f5;
  --accent-color: #4a9be0;
  --surface-color: #141416;
  --contrast-color: #ffffff;
  --nav-mobile-background-color: #141416;
  --nav-dropdown-background-color: #141416;
  --nav-dropdown-color: #c8c8cc;
  --bs-body-bg: #0b0b0c;
  --bs-body-color: #d8d8dc;
}
html[data-bs-theme="dark"] .light-background {
  --background-color: #101012;
  --surface-color: #18181b;
}
html[data-bs-theme="dark"] .header { --default-color: #ffffff; --heading-color: #ffffff; }
html[data-bs-theme="dark"] body.index-page #home.hero { background: var(--background-color) !important; }

/* Slate text and white boxes hardcoded for the day look */
html[data-bs-theme="dark"] :is(.home-trust-strip__item, .pf-mini-card, .pf-mini-title, .pf-period-shell-value,
  .pf-period-select option, .pf-mini-stat-value, .pf-more-toggle, .pf-premium-stat-value, .perf-kpi__value,
  .is-neutral, .perf-table-row__value, .perf-monthly-table tbody td, .perf-metric-story__value,
  .paywall-input-wrap input, .relevant-article-item:hover) {
  color: var(--heading-color);
}
html[data-bs-theme="dark"] :is(.pf-mode, .pf-premium-line, .post-premium-line, .trade-row-label,
  .trade-progress-title, .paywall-proof) {
  color: #a8a8b0;
}
html[data-bs-theme="dark"] :is(.pf-period-shell, .pf-mode:hover, .pf-period-select option, .pf-mini-stat,
  .pf-more-stats, .pf-more-item, .pf-more-item-link:focus-visible, .perf-chart-svg, .research-chart,
  .paywall-card, .paywall-input-wrap input, .nl-input-wrap, .trade-sheet-head, .research-performance__panel,
  .courses-events .results-all:hover, .research-mobile-notes-panel,
  .research-mobile-notes-panel .daily-commentary-widget .research-entry-form) {
  background: var(--surface-color);
}
html[data-bs-theme="dark"] .perf-block::before { background: var(--background-color); }
html[data-bs-theme="dark"] .perf-block:nth-of-type(even)::before { background: #101012; }
html[data-bs-theme="dark"] .paywall-input-wrap input { border-color: rgba(255, 255, 255, 0.15); }
html[data-bs-theme="dark"] .ph-line { background: #26262a; }

/* Tooltips */
html[data-bs-theme="dark"] :is(.perf-equity-tooltip, .perf-drawdown-tooltip, .perf-monthly-tooltip,
  .research-chart__tooltip, .courses-events .research-ticker--media) {
  background: rgba(24, 24, 27, 0.97);
  color: var(--default-color);
}

/* Light-blue "premium teaser" gradients */
html[data-bs-theme="dark"] :is(.courses-events .archive-sidebar .newsletter-widget, .pf-premium-teaser,
  .post-premium-teaser, .pricing .pricing-item.is-peeked, .header-nav-cta:focus-visible) {
  background-color: var(--surface-color);
  background-image: none;
}

/* Tinted pills/badges: mixing with white glows on dark, use transparent tints instead */
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--open { background: color-mix(in srgb, var(--accent-color), transparent 84%); }
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--profit,
html[data-bs-theme="dark"] .courses-events .research-card:not(.research-card--featured) .research-result.is-positive,
html[data-bs-theme="dark"] .results-summary-icon { background: color-mix(in srgb, #16a34a, transparent 82%); }
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--loss,
html[data-bs-theme="dark"] .courses-events .research-card:not(.research-card--featured) .research-result.is-negative {
  background: color-mix(in srgb, #dc2626, transparent 82%);
  border-color: color-mix(in srgb, #dc2626, transparent 60%);
}
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--closed { background: color-mix(in srgb, #64748b, transparent 80%); }
html[data-bs-theme="dark"] .courses-events .daily-commentary-widget.has-seen-history .research-commentary-item.is-unread {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: -10px 0 0 rgba(255, 255, 255, 0.05), 8px 0 0 rgba(255, 255, 255, 0.05);
}
html[data-bs-theme="dark"] .features .feature-box.orange { background-color: #221c12; }
html[data-bs-theme="dark"] .features .feature-box.red { background-color: #221414; }

/* Thin dark borders vanish on dark backgrounds */
html[data-bs-theme="dark"] :is(.courses-events .research-card, .courses-events .research-card-media,
  .courses-events .event-card .event-image, .courses-events .archive-sidebar .newsletter-widget,
  .courses-events .research-empty, .courses-events .research-tab, .courses-events .research-ticker,
  .courses-events .results-all, .courses-events .results-item, .nl-input-wrap input, .paywall-input-wrap input,
  .perf-card-panel, .perf-error, .perf-monthly-table thead th, .perf-table-col + .perf-table-col,
  .perf-broker-reference__tile--active, .pf-mini-card, .pf-mini-stat, .pf-mode, .pf-more-item, .pf-more-stats,
  .pf-period-shell, .pf-premium-teaser, .post-premium-teaser, .pricing .pricing-item, .pricing ul li.upsell,
  .relevant-article-item, .research-deliverables__card, .research-deliverables__shot-block,
  .research-deliverables__shot-frame, .research-mobile-notes-panel, .section, .trade-row, .trade-sheet,
  .trade-sheet-head, tr.row-sep td::before) {
  border-color: rgba(255, 255, 255, 0.12);
}
html[data-bs-theme="dark"] :is(.courses-events .research-card:hover, .courses-events .research-tab:hover,
  .courses-events .results-all:hover, .research-deliverables__card:hover, .nl-input-wrap input:focus) {
  border-color: rgba(255, 255, 255, 0.24);
}
/* Badge/button drawn in heading color or navy: invisible on dark */
html[data-bs-theme="dark"] .courses-events .research-new { color: var(--background-color); }
html[data-bs-theme="dark"] :is(.pf-premium-link, .post-premium-link) { background: #ffffff; color: #0b0b0c; }
html[data-bs-theme="dark"] :is(.pf-premium-link, .post-premium-link):hover { background: #e4e4e7; color: #0b0b0c; }
html[data-bs-theme="dark"] .paywall-submit { background: #ffffff; border-color: #ffffff; color: #0b0b0c; }
html[data-bs-theme="dark"] .paywall-submit:hover { background: #e4e4e7; border-color: #e4e4e7; color: #0b0b0c; }
html[data-bs-theme="dark"] .paywall-submit .btn-spinner { border-color: rgba(11, 11, 12, 0.3); border-top-color: #0b0b0c; }
html[data-bs-theme="dark"] .courses-events .research-tab.is-active { color: var(--background-color); }
html[data-bs-theme="dark"] :is(.courses-events .results-all, .trade-sheet) { background: var(--surface-color); }
html[data-bs-theme="dark"] .courses-events .results-all:hover { background: #1f1f23; }
html[data-bs-theme="dark"] .pf-mini-tooltip { background: rgba(24, 24, 27, 0.97); color: var(--default-color); }
html[data-bs-theme="dark"] .newsletter-form input[type="email"] { background: var(--surface-color); color: var(--heading-color); }
/* send icon is white, .invert made it black for the white field */
html[data-bs-theme="dark"] .newsletter-form .nl-confirm-btn .invert { filter: none; }
/* share icons are black SVGs */
html[data-bs-theme="dark"] .share-button .icon { filter: invert(1); }
/* featured weekly card: navy fade → neutral black to match the charcoal palette */
html[data-bs-theme="dark"] .courses-events .research-card--featured .research-card-media::after {
  background: linear-gradient(90deg, rgba(11, 11, 12, 0.97) 0%, rgba(11, 11, 12, 0.9) 42%, rgba(11, 11, 12, 0.45) 75%, rgba(11, 11, 12, 0.25) 100%);
}
@media (max-width: 767px) {
  html[data-bs-theme="dark"] .courses-events .research-card--featured .research-card-media::after {
    background: linear-gradient(180deg, rgba(11, 11, 12, 0.62) 0%, rgba(11, 11, 12, 0.82) 100%);
  }
}
/* paywall: logo is white, .invert made it black for the white card */
html[data-bs-theme="dark"] .paywall-brand.invert { filter: none; }
/* check marks (paywall + pricing) drawn in navy */
html[data-bs-theme="dark"] .pricing-check { background-color: rgba(244, 244, 245, 0.85); }
/* blurred placeholders for locked values were dark-on-light */
html[data-bs-theme="dark"] .locked-chip { background: linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.12) 100%); }
html[data-bs-theme="dark"] .locked-value-bar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.3) 100%);
  box-shadow: none;
}
/* trade status pills: pale outlines + dark text were made for white; soft tint, no outline on night */
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill { border-color: transparent; }
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--open { background: rgba(74, 155, 224, 0.14); color: #7cb8ec; }
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--profit,
html[data-bs-theme="dark"] .courses-events .research-card:not(.research-card--featured) .research-result.is-positive { background: rgba(34, 197, 94, 0.12); border-color: transparent; color: #4ade80; }
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--loss,
html[data-bs-theme="dark"] .courses-events .research-card:not(.research-card--featured) .research-result.is-negative { background: rgba(239, 68, 68, 0.12); border-color: transparent; color: #f87171; }
html[data-bs-theme="dark"] :is(.courses-events, .relevant-articles) .research-trade-pill--closed { background: rgba(255, 255, 255, 0.07); color: #a1a1aa; }
/* pagination chevrons are black SVGs */
html[data-bs-theme="dark"] .pagination .page-link img.icon { filter: invert(1); }
/* other black currentColor SVG <img> icons on plain backgrounds */
html[data-bs-theme="dark"] :is(.archive-search-btn img, .article-meta .post-info img, .faq .faq-toggle img,
  .research-commentary-action-icon, .research-commentary-indicator-icon) { filter: invert(1); }
/* home hero (styles inline in index.php, made for a white hero) */
html[data-bs-theme="dark"] .hero-copy .logo.invert { filter: none; }
html[data-bs-theme="dark"] .hero .section-title h2 { color: var(--heading-color); }
html[data-bs-theme="dark"] .hero-action--primary { background: #ffffff; border-color: #ffffff; color: #0b0b0c; }
html[data-bs-theme="dark"] :is(.hero-action--primary:hover, .hero-action--primary:focus-visible) { background: #e4e4e7; border-color: #e4e4e7; color: #0b0b0c; }
html[data-bs-theme="dark"] .hero-action:not(.hero-action--primary) { border-color: rgba(255, 255, 255, 0.28); color: var(--heading-color); }
html[data-bs-theme="dark"] :is(.hero-action:not(.hero-action--primary):hover, .hero-action:not(.hero-action--primary):focus-visible) { border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.06); color: var(--heading-color); }
html[data-bs-theme="dark"] .hero-proof-disclaimer { color: #8b8b93; }
html[data-bs-theme="dark"] .hero-performance-panel {
  background: var(--surface-color);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

/* ---------- performance page (performance.css is slate-on-white) ---------- */
html[data-bs-theme="dark"] .perf-hero .section-title h2 { color: var(--heading-color); }
html[data-bs-theme="dark"] :is(.perf-hero .section-title p, .perf-hero-copy__lede, .perf-metric-intro,
  .perf-metric-story p, .perf-table-row__label, .perf-broker-reference__copy span, .perf-error) { color: #a8a8b0; }
html[data-bs-theme="dark"] :is(.perf-stat-box__label, .perf-metric-story h3, .perf-broker-reference__copy strong,
  .perf-meta-chip) { color: #d8d8dc; }
html[data-bs-theme="dark"] :is(.perf-stat-box__note, .perf-year-card__year, .perf-year-card__equity,
  .perf-disclaimer__copy, .perf-broker-reference__badge, .perf-broker-reference__protection-note,
  .perf-cta__fineprint) { color: #8b8b93; }
html[data-bs-theme="dark"] .perf-meta-chip { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); }
html[data-bs-theme="dark"] :is(.perf-table-row:nth-child(even), .perf-monthly-table tbody tr:nth-child(even)) { background: rgba(255, 255, 255, 0.03); }
html[data-bs-theme="dark"] .perf-monthly-table thead th { border-bottom-color: rgba(255, 255, 255, 0.1); }
html[data-bs-theme="dark"] .perf-error { background: var(--surface-color); }
/* charts: labels/grid are drawn in navy, some via SVG attributes */
html[data-bs-theme="dark"] .perf-equity-label,
html[data-bs-theme="dark"] .perf-page svg text[fill^="rgba(15"] { fill: #8b8b93; }
html[data-bs-theme="dark"] :is(.perf-equity-grid, .perf-equity-axis),
html[data-bs-theme="dark"] .perf-page svg [stroke^="rgba(15"] { stroke: rgba(255, 255, 255, 0.1); }
html[data-bs-theme="dark"] :is(.perf-equity-hover-line, .perf-drawdown-hover-line) { stroke: rgba(255, 255, 255, 0.3); }
html[data-bs-theme="dark"] :is(.perf-equity-hover-point, .perf-drawdown-hover-point) { stroke: var(--surface-color); }
/* CTA button: white on night like the other trial buttons */
html[data-bs-theme="dark"] .perf-cta__button { background: #ffffff; border-color: #ffffff; color: #0b0b0c; }
html[data-bs-theme="dark"] :is(.perf-cta__button:hover, .perf-cta__button:focus-visible) { background: #e4e4e7; border-color: #e4e4e7; color: #0b0b0c; }
html[data-bs-theme="dark"] .perf-cta__button-text::after { color: rgba(11, 11, 12, 0.6); }
/* broker/FDIC/SIPC tiles: dark tiles, logos shown in white */
html[data-bs-theme="dark"] :is(.perf-broker-reference__tile--active, .perf-broker-reference__tile--protection) { background: var(--surface-color); }
html[data-bs-theme="dark"] :is(.perf-broker-reference__logo, .perf-broker-reference__protection-logo) { filter: brightness(0) invert(1); }
/* FDIC image has an opaque white background: whitening it gives a blank box, keep the original */
html[data-bs-theme="dark"] .perf-broker-reference__protection-logo--fdic { filter: none; border-radius: 4px; }
/* research-access hero card: same grey gradient as the home panel */
html[data-bs-theme="dark"] .research-hero__panel { background: var(--surface-color); border-color: rgba(255, 255, 255, 0.1); }
html[data-bs-theme="dark"] .research-hero__panel::before { opacity: 0; }
html[data-bs-theme="dark"] .hero-cta { background: #ffffff; border-color: #ffffff; color: #0b0b0c; }
html[data-bs-theme="dark"] .hero-cta:hover { background: #e4e4e7; border-color: #e4e4e7; }
html[data-bs-theme="dark"] .hero-cta .hero-cta-title { color: #0b0b0c; }
/* chart legend names (ZLARK / S&P 500) were navy */
html[data-bs-theme="dark"] .research-pill .research-pill__name { color: #a8a8b0; }
/* research-access chart: S&P 500 series is navy (CSS, inline styles and SVG gradient stops) */
html[data-bs-theme="dark"] .research-chart__gray { stroke: rgba(228, 228, 231, 0.6); }
html[data-bs-theme="dark"] .research-chart__hover-point--gray { fill: rgba(228, 228, 231, 0.75); }
html[data-bs-theme="dark"] #grayGradient stop { stop-color: #e4e4e7; }
html[data-bs-theme="dark"] .research-chart__hover-line { stroke: rgba(255, 255, 255, 0.3); }
html[data-bs-theme="dark"] [style*="color:rgba(15,23,42,0.52)"] { color: rgba(228, 228, 231, 0.75) !important; }
html[data-bs-theme="dark"] [style*="background:rgba(15,23,42,0.52)"] { background: rgba(228, 228, 231, 0.75) !important; }
/* pricing: highlighted (peeked) plan card — lifted surface + accent border instead of the light-blue wash */
html[data-bs-theme="dark"] .pricing .pricing-item:is(:hover, :focus-within, .is-peeked) {
  background-color: #1b1b1f;
  background-image: none;
  border-color: rgba(74, 155, 224, 0.55);
  box-shadow: 0 0 0 1px rgba(74, 155, 224, 0.25), 0 12px 32px rgba(0, 0, 0, 0.45);
}
html[data-bs-theme="dark"] .pricing ul li.upsell { border-top-color: rgba(255, 255, 255, 0.14); }
/* research-access "What You Get" cards */
html[data-bs-theme="dark"] .research-deliverables__badge { background: rgba(255, 255, 255, 0.08); color: #a8a8b0; }
/* light/dark image pairs (research-access screenshots) */
.theme-dark-only { display: none; }
html[data-bs-theme="dark"] .theme-dark-only { display: contents; }
html[data-bs-theme="dark"] .theme-light-only { display: none; }
/* newsletter email fields styled with --contrast-color (white) via ID / long selectors (mobile sticky popup, sidebar) */
html[data-bs-theme="dark"] #nl-sticky.sidebar-widget.newsletter-widget .newsletter-form input[type="email"],
html[data-bs-theme="dark"] .courses-events .sidebar-widget.newsletter-widget .newsletter-form input[type="email"] {
  background: var(--surface-color);
  color: var(--heading-color);
}
/* mobile header search panel: close × is #212529 and the submit icon is a black SVG <img> */
html[data-bs-theme="dark"] .header-search-form button { color: var(--heading-color); }
html[data-bs-theme="dark"] .header-search-form button img { filter: invert(1); }
html[data-bs-theme="dark"] .header-search-form { border: 0; box-shadow: none; }
html[data-bs-theme="dark"] .header-search-form input { box-shadow: 0 8px 28px rgba(255, 255, 255, 0.10); }
/* mobile menu open: the close X takes the corner, hide the day/night icon under it */
.mobile-nav-active .theme-toggle { visibility: hidden; }
/* mobile menu "Get Access": white on night like the other CTAs */
html[data-bs-theme="dark"] .navmenu .navmenu-mobile-cta-item a:is(*, :focus, :hover, :focus-visible) { background: #ffffff; border-color: #ffffff; color: #0b0b0c; }
html[data-bs-theme="dark"] .navmenu .navmenu-mobile-cta-item a::after { color: rgba(11, 11, 12, 0.6); }
/* performance.css forces pictures visible with !important on mobile */
.perf-page .research-deliverables__shot picture.theme-dark-only { display: none !important; }
html[data-bs-theme="dark"] .perf-page .research-deliverables__shot picture.theme-dark-only { display: block !important; }
html[data-bs-theme="dark"] .perf-page .research-deliverables__shot picture.theme-light-only { display: none !important; }
/* TradingView paints a 1px border inside its iframe when not transparent (night); clip it off */
html[data-bs-theme="dark"] #tv-container iframe { clip-path: inset(1px); }

/* index Headlines slider: round prev/next buttons (Swiper navigation) */
.news-slider { position: relative; }
.news-nav {
  position: absolute; top: calc(50% - 22px); z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.12); background: #fff; color: #212529;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12); cursor: pointer;
  transition: opacity .2s, background-color .2s, color .2s;
}
.news-nav:hover { color: var(--accent-color); }
.news-nav-prev { left: 0; }
.news-nav-next { right: 0; }
.news-nav.swiper-button-disabled { opacity: 0; pointer-events: none; }
@media (min-width: 1280px) { .news-nav-prev { left: -28px; } .news-nav-next { right: -28px; } }
html[data-bs-theme="dark"] .news-nav { background: #18181b; color: #f4f4f5; border-color: rgba(255, 255, 255, 0.12); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
html[data-bs-theme="dark"] .news-nav:hover { background: #222226; color: #fff; }
