/**
 * Visual Fixes v2 — STI Newsroom Flow
 * 1. Header background image rendering
 * 2. SiteOrigin Page Builder padding/gap reduction
 * 3. Dark mode text colors for SiteOrigin widget descriptions
 * 4. Comment form dark mode styling
 *
 * @since 1.0.2
 */

/* ============================================================
   1. HEADER BACKGROUND IMAGE
   When user sets a Header Image (Customize > Header Image),
   inner sections must be transparent so the image shows through.
   ============================================================ */
.site-header.has-header-image {
  position: relative;
}

/* Inner panels become transparent so the bg image is visible */
.site-header.has-header-image .header-main {
  background-color: transparent !important;
}

.site-header.has-header-image .header-content {
  background-color: transparent;
}

/* Optional dark gradient overlay so logo/nav text remains readable */
.site-header.has-header-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.35) 100%
  );
  z-index: 0;
  pointer-events: none;
}

.site-header.has-header-image .breaking-news-ticker,
.site-header.has-header-image .header-main {
  position: relative;
  z-index: 1;
}

/* Give the header some visible height when an image is present */
.site-header.has-header-image .header-main {
  padding: 1.25rem 0 !important;
  min-height: 120px;
}

/* ============================================================
   2. SITEORIGIN PAGE BUILDER — REDUCE PADDING & GAPS
   Tightens the wide margins/gutters between rows and widgets.
   ============================================================ */
.panel-grid,
.panel-grid-cell,
.so-panel,
.panel-row-style {
  margin-bottom: 12px !important;
}

.panel-grid:last-child,
.so-panel:last-child {
  margin-bottom: 0 !important;
}

/* Reduce row padding and gutter between cells */
.panel-row-style {
  padding: 12px 0 !important;
}

.panel-grid .panel-grid-cell {
  padding: 0 8px !important;
}

/* SiteOrigin row container max width / horizontal breathing room */
.panel-layout {
  padding: 0 !important;
}

/* Widget body padding tighter */
.so-panel > .widget {
  padding: 12px !important;
  margin-bottom: 0 !important;
}

/* Remove excessive top margin on first row */
.panel-layout > .panel-grid:first-child {
  margin-top: 0 !important;
}

/* Tighten heading top margins inside widgets */
.so-widget-sow-heading,
.widget_sti_newsroom_news_grid,
.widget_sti_newsroom_breaking_news,
.widget_sti_newsroom_weather {
  padding: 0 !important;
}

/* News grid spacing — tightened gap between cards */
.news-grid {
  gap: 8px !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
}

/* Tighten card internal padding so cards feel less bulky */
.news-card {
  margin-bottom: 0 !important;
}

/* SiteOrigin cell spacing — extra-tight for card-style widgets */
.panel-grid-cell .news-card {
  margin: 0 !important;
}

/* Tighter spacing inside card grids that may be wrapped in a `.row` */
.row .news-grid,
.panel-grid .news-grid {
  gap: 8px !important;
}

/* ============================================================
   3. DARK MODE — SITEORIGIN WIDGETS & TEXT
   Make widget descriptions / paragraph text white in dark mode.
   ============================================================ */
body.dark-mode .panel-grid,
body.dark-mode .panel-row-style,
body.dark-mode .panel-grid-cell,
body.dark-mode .so-panel {
  color: #e8e8e8;
}

body.dark-mode .so-panel,
body.dark-mode .so-panel p,
body.dark-mode .so-panel li,
body.dark-mode .so-panel span,
body.dark-mode .so-panel div,
body.dark-mode .so-panel small,
body.dark-mode .so-panel .widget-title,
body.dark-mode .so-panel .widget_text,
body.dark-mode .so-panel .textwidget,
body.dark-mode .so-widget-sow-editor,
body.dark-mode .so-widget-sow-editor p,
body.dark-mode .so-widget-sow-editor li,
body.dark-mode .so-widget-sow-button,
body.dark-mode .so-widget-sow-heading,
body.dark-mode .so-widget-sow-heading h1,
body.dark-mode .so-widget-sow-heading h2,
body.dark-mode .so-widget-sow-heading h3,
body.dark-mode .so-widget-sow-heading h4,
body.dark-mode .so-widget-sow-heading h5,
body.dark-mode .so-widget-sow-heading h6 {
  color: #f0f0f0 !important;
}

/* Card description / news excerpt in dark mode */
body.dark-mode .news-card,
body.dark-mode .news-card-excerpt,
body.dark-mode .news-card-description,
body.dark-mode .news-card-title,
body.dark-mode .news-card-title a,
body.dark-mode .news-card-meta,
body.dark-mode .post-excerpt,
body.dark-mode .entry-summary,
body.dark-mode .post-content {
  color: #f0f0f0 !important;
}

body.dark-mode .news-card-meta,
body.dark-mode .news-card-meta a,
body.dark-mode .post-meta,
body.dark-mode time {
  color: #b8b8b8 !important;
}

/* Widget headings (e.g., "Top Stories", "Latest News") underline color stays red */
body.dark-mode .widget-title,
body.dark-mode .section-title {
  color: #ffffff !important;
  border-bottom-color: var(--color-primary-red, #D60000);
}

/* Sidebars and sidebar widgets in dark mode */
body.dark-mode .sidebar .widget,
body.dark-mode aside.sidebar {
  background-color: #2a2a2a !important;
  color: #f0f0f0 !important;
}

/* ============================================================
   4. COMMENT FORM — DARK MODE READABILITY
   Fix the "Leave a Reply" form being unreadable on dark theme.
   ============================================================ */
body.dark-mode .comments-area,
body.dark-mode .comment-respond,
body.dark-mode .comment-list,
body.dark-mode .comment-list li,
body.dark-mode .comment-list .comment-body,
body.dark-mode .comment-author,
body.dark-mode .comment-meta,
body.dark-mode .comment-content,
body.dark-mode .comment-reply-title,
body.dark-mode .comment-form label,
body.dark-mode .comment-notes,
body.dark-mode .logged-in-as,
body.dark-mode .form-allowed-tags {
  color: #f0f0f0 !important;
}

body.dark-mode .comment-form input[type="text"],
body.dark-mode .comment-form input[type="email"],
body.dark-mode .comment-form input[type="url"],
body.dark-mode .comment-form textarea {
  background-color: #1f1f1f !important;
  color: #f0f0f0 !important;
  border-color: #444 !important;
}

body.dark-mode .comment-form input[type="submit"],
body.dark-mode .form-submit input[type="submit"] {
  background-color: var(--color-primary-red, #D60000) !important;
  color: #ffffff !important;
  border: none !important;
  padding: 0.6rem 1.4rem !important;
  border-radius: 4px !important;
  cursor: pointer;
  font-weight: 600;
}

body.dark-mode .comment-form input[type="submit"]:hover {
  background-color: var(--color-accent-red, #FF2E2E) !important;
}

/* Light mode fallback for comment form */
.comment-form input[type="submit"],
.form-submit input[type="submit"] {
  background-color: var(--color-primary-red, #D60000);
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.comment-form input[type="submit"]:hover {
  background-color: var(--color-accent-red, #FF2E2E);
}

/* ============================================================
   5. SOCIAL ICON SVG — INHERIT COLOR FROM PARENT
   ============================================================ */
.social-icons-header .social-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.social-icons-header .social-icon {
  color: #ffffff;
}

.social-icons-header .social-icon:hover {
  background: var(--color-primary-red, #D60000) !important;
  color: #ffffff !important;
}

/* Ensure dark mode toggle SVG colors switch with state */
.dark-mode-toggle .icon-sun svg,
.dark-mode-toggle .icon-moon svg {
  display: block;
}

/* ============================================================
   6. NEWS GRID — 1-COLUMN LIST LAYOUT
   Used when the widget's "Columns" select = 1.
   Mirrors the reference image: title on top, then image-left /
   excerpt-right with a "Read More" button.
   ============================================================ */
.news-grid-list {
  display: block !important;
  grid-template-columns: none !important;
}

.news-card-row {
  display: block;
  padding: 18px 0;
  border-bottom: 1px solid var(--color-border, #E5E5E5);
  margin-bottom: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.news-card-row:last-child { border-bottom: none; }

.news-card-row .news-card-title {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}

.news-card-row .news-card-title a {
  color: var(--color-primary-black, #0D0D0D);
  text-decoration: none;
}

.news-card-row .news-card-meta {
  font-size: 0.78rem;
  color: var(--color-text-light, #666);
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.news-card-row .news-card-meta .byline {
  color: var(--color-primary-red, #D60000);
  font-weight: 600;
}

.news-card-row-inner {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  align-items: start;
}

.news-card-row-inner .news-card-image img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.news-card-row-inner .news-card-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-card-row-inner .news-card-excerpt {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text, #333);
}

@media (max-width: 640px) {
  .news-card-row-inner {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   7. ATTRACTIVE PAGINATION
   Round, red-accent pagination used by the STI News Grid widget.
   ============================================================ */
.sti-pagination {
  display: flex;
  justify-content: center;
  margin: 30px 0 10px;
}

.sti-pagination .page-numbers,
.sti-pagination ul.page-numbers {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.sti-pagination li { list-style: none; }

.sti-pagination .page-numbers a,
.sti-pagination .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f5f5f5;
  color: var(--color-primary-black, #0D0D0D);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.sti-pagination .page-numbers a:hover {
  background: var(--color-primary-red, #D60000);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(214, 0, 0, 0.25);
}

.sti-pagination .page-numbers.current {
  background: var(--color-primary-red, #D60000);
  color: #fff;
  box-shadow: 0 4px 10px rgba(214, 0, 0, 0.3);
}

.sti-pagination .page-numbers.dots {
  background: transparent;
  box-shadow: none;
}

/* ============================================================
   8. STI TRENDING / LATEST TABBED WIDGET
   ============================================================ */
.sti-trending-latest {
  background: transparent;
}

.sti-tl-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--color-border, #E5E5E5);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.sti-tl-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #999;
  position: relative;
  transition: color 0.2s ease;
}

.sti-tl-tab.active {
  color: var(--color-primary-red, #D60000);
}

.sti-tl-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 2px;
  background: var(--color-primary-red, #D60000);
}

.sti-tl-tab .sti-tl-icon { display: inline-block; vertical-align: middle; }

.sti-tl-panel { display: none; }
.sti-tl-panel.active { display: block; }
.sti-tl-panel[hidden] { display: none; }

.sti-tl-hero {
  display: block;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
  text-decoration: none;
  background: #000;
}

.sti-tl-hero .sti-tl-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.95;
}

.sti-tl-hero .sti-tl-hero-content {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.1) 100%);
  color: #fff;
}

.sti-tl-hero .sti-tl-hero-title {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 6px 0;
}

.sti-tl-hero .sti-tl-hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sti-tl-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border, #E5E5E5);
  text-decoration: none;
  align-items: center;
}

.sti-tl-row .sti-tl-row-image img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}

.sti-tl-row .sti-tl-row-title {
  font-size: 0.92rem;
  line-height: 1.35;
  margin: 0 0 6px 0;
  color: var(--color-primary-black, #0D0D0D);
  font-weight: 600;
}

.sti-tl-row .sti-tl-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: #999;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sti-tl-row:hover .sti-tl-row-title { color: var(--color-primary-red, #D60000); }

/* ============================================================
   9. TOP NAV BAR — 3 COLUMN LAYOUT
   ============================================================ */
.sti-topbar {
  font-size: 0.82rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sti-topbar-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.sti-topbar-col { display: flex; align-items: center; }
.sti-topbar-left   { justify-content: flex-start; }
.sti-topbar-center { justify-content: center; }
.sti-topbar-right  { justify-content: flex-end; }

.sti-topbar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.sti-topbar-nav ul li a {
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: opacity 0.2s ease;
}

.sti-topbar-nav ul li a:hover { opacity: 0.7; }

.sti-topbar .top-bar-widget { margin: 0; }
.sti-topbar .top-bar-widget + .top-bar-widget { margin-left: 18px; }

@media (max-width: 768px) {
  .sti-topbar-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    text-align: center;
  }
  .sti-topbar-col { justify-content: center; }
}

/* ============================================================
   10. DARK MODE — UNIVERSAL WHITE TEXT
   Force all widget text, page content, and post content to white
   when dark mode is on. Excludes intentionally-coloured elements
   (badges, buttons, links, icons, brand colours).
   ============================================================ */
body.dark-mode,
body.dark-mode p,
body.dark-mode li,
body.dark-mode span,
body.dark-mode div,
body.dark-mode small,
body.dark-mode label,
body.dark-mode strong,
body.dark-mode em,
body.dark-mode blockquote,
body.dark-mode .entry-content,
body.dark-mode .entry-summary,
body.dark-mode .widget,
body.dark-mode .widget *,
body.dark-mode .so-panel,
body.dark-mode .so-panel *,
body.dark-mode .panel-grid-cell *,
body.dark-mode .news-card-row,
body.dark-mode .news-card-row *,
body.dark-mode .sti-trending-latest *,
body.dark-mode #primary,
body.dark-mode .site-content,
body.dark-mode .site-content * {
  color: #ffffff !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: #ffffff !important;
}

/* Re-allow brand-coloured / accent elements in dark mode */

body.dark-mode .category-badge,
body.dark-mode .news-read-more-btn,
body.dark-mode .btn,
body.dark-mode .sti-tl-tab.active,
body.dark-mode .breaking-news-ticker .ticker-label,
body.dark-mode .sti-pagination .page-numbers.current {
  color: #ffffff !important;
}

body.dark-mode .sti-tl-tab { color: #999 !important; }
body.dark-mode .sti-tl-tab.active { color: var(--color-primary-red, #D60000) !important; }

body.dark-mode .sti-pagination .page-numbers a,
body.dark-mode .sti-pagination .page-numbers span:not(.current) {
  background: #2a2a2a !important;
  color: #f0f0f0 !important;
}

body.dark-mode .sti-pagination .page-numbers a:hover,
body.dark-mode .sti-pagination .page-numbers.current {
  background: var(--color-primary-red, #D60000) !important;
  color: #fff !important;
}

/* Card title/meta retain their colours in dark mode */
body.dark-mode .news-card-row .news-card-title a,
body.dark-mode .sti-tl-row .sti-tl-row-title {
  color: #ffffff !important;
}

body.dark-mode .news-card-row .news-card-meta .byline {
  color: var(--color-accent-red, #FF2E2E) !important;
}

body.dark-mode .news-card-row .news-card-meta,
body.dark-mode .sti-tl-row .sti-tl-row-meta,
body.dark-mode .sti-tl-hero .sti-tl-hero-meta {
  color: #b8b8b8 !important;
}

/* Borders in dark mode */
body.dark-mode .news-card-row,
body.dark-mode .sti-tl-row,
body.dark-mode .sti-tl-tabs {
  border-color: #2e2e2e !important;
}

body.dark-mode .breaking-news-ticker .ticker-label {color: #ff0000 !important;}

