/*
Theme Name: ForexSphere
Theme URI: https://forexsphere.online
Author: ForexSphere
Description: A fast, lightweight, SEO-optimized WordPress theme built for forex news, market analysis, and broker review sites. Mobile-first, cross-browser compatible, with a built-in dynamic Sponsored Brokers system.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: forexsphere
*/

/* ==========================================================================
   1. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #F5F6F8;
  color: #1F2937;
  font-size: 16px;
  line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  margin: 0 0 12px;
}
p { margin: 0 0 16px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 22px; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link {
  position: absolute; top: -50px; left: 10px; background: #10B981; color: #052E22;
  padding: 10px 16px; border-radius: 6px; z-index: 9999; font-weight: 600; font-size: 14px;
  transition: top .2s;
}
.skip-link:focus { top: 10px; }

/* ==========================================================================
   2. HEADER
   ========================================================================== */
.site-header {
  background: #0B1220;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 500;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #ffffff;
  flex-shrink: 0;
}
.site-logo span.accent { color: #34D399; }
.site-logo svg { flex-shrink: 0; }

.primary-nav-wrap { display: flex; align-items: center; gap: 22px; }
.primary-nav ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.primary-nav li { position: relative; }
.primary-nav a {
  font-size: 14px; font-weight: 500; color: #C7CEDB; white-space: nowrap;
  transition: color .15s; display: inline-flex; align-items: center;
}
.primary-nav a:hover, .primary-nav li.current-menu-item > a { color: #34D399; }

/* Dropdown caret for items with children */
.primary-nav li.menu-item-has-children > a::after {
  content: ""; display: inline-block; width: 6px; height: 6px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); margin-left: 7px; opacity: .75; transition: transform .18s;
}
.primary-nav li.menu-item-has-children.submenu-open > a::after,
.primary-nav li.menu-item-has-children:hover > a::after { transform: rotate(-135deg); }

/* Dropdown panel — modern floating card style */
.primary-nav .sub-menu {
  list-style: none; margin: 0; padding: 8px; position: absolute; top: 100%; left: 0;
  min-width: 220px; background: #ffffff; border-radius: 10px;
  display: block; /* overrides the flex-row layout inherited from .primary-nav ul */
  box-shadow: 0 16px 32px rgba(11, 18, 32, 0.18), 0 2px 8px rgba(11, 18, 32, 0.08);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 600;
}
.primary-nav li:hover > .sub-menu {
  opacity: 1; visibility: visible; transform: translateY(4px);
}
.primary-nav .sub-menu li { width: 100%; }
.primary-nav .sub-menu a {
  display: block; width: 100%; padding: 10px 12px; border-radius: 6px;
  color: #374151; font-size: 13.5px; font-weight: 500;
}
.primary-nav .sub-menu a:hover { background: #F5F6F8; color: #0EA271; }
.primary-nav .sub-menu .sub-menu { top: 0; left: 100%; margin-left: 4px; }

.submenu-toggle { display: none; }

.header-cta {
  background: #10B981; color: #052E22; font-weight: 600; font-size: 13px;
  padding: 10px 18px; border-radius: 7px; white-space: nowrap; display: inline-block;
  transition: background .15s;
}
.header-cta:hover { background: #0EA271; color: #052E22; }

.menu-toggle {
  display: none; background: none; border: 0; color: #fff; font-size: 24px;
  cursor: pointer; padding: 4px 8px;
}

/* ==========================================================================
   3. LAYOUT: MAIN CONTENT + SIDEBAR
   ========================================================================== */
.content-wrap {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  padding: 28px 0 48px;
}
.main-col { flex: 2.1; min-width: 0; }
.sidebar-col { flex: 1; min-width: 0; max-width: 380px; }

@media (max-width: 900px) {
  .content-wrap { flex-direction: column; }
  .sidebar-col { max-width: 100%; width: 100%; order: 2; }
}

/* ==========================================================================
   4. CARDS
   ========================================================================== */
.card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #E3E5E8;
  overflow: hidden;
}
.tag {
  font-size: 11px; font-weight: 600; color: #10B981;
  text-transform: uppercase; letter-spacing: .04em;
}

.featured-post { margin-bottom: 20px; }
.featured-post .thumb { width: 100%; aspect-ratio: 16/8; background: #1F2937; overflow: hidden; }
.featured-post .thumb img { width: 100%; height: 100%; object-fit: cover; }
.featured-post .body { padding: 22px; }
.featured-post h1, .featured-post h2 { font-size: 24px; margin: 8px 0 10px; }
.featured-post .excerpt { font-size: 14px; color: #6B7280; }
.post-meta { font-size: 11.5px; color: #9CA3AF; margin-top: 12px; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 700px) { .article-grid { grid-template-columns: 1fr; } }
.article-grid .card { padding: 14px; }
.article-grid .thumb { width: 100%; aspect-ratio: 16/10; background: #E5E7EB; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.article-grid .thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-grid h3 { font-size: 14px; margin-top: 6px; }

.list-card { margin-bottom: 14px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.list-card .thumb { width: 88px; height: 70px; flex-shrink: 0; background: #E5E7EB; border-radius: 6px; overflow: hidden; }
.list-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-card h3 { font-size: 13.5px; margin-top: 4px; }

/* ==========================================================================
   5. SPONSORED BROKERS (sidebar widget)
   ========================================================================== */
.sponsored-brokers {
  background: #ffffff; border-radius: 10px; border: 1.5px solid #F5A623;
  padding: 16px; margin-bottom: 20px;
}
.sponsored-brokers .heading {
  display: flex; align-items: center; gap: 7px; margin-bottom: 14px;
  font-family: 'Sora', sans-serif; font-weight: 700; font-size: 14px; color: #B45309;
}
.broker-card {
  background: #FCF3E3; border-radius: 8px; padding: 12px 13px; margin-bottom: 11px;
}
.broker-card:last-child { margin-bottom: 0; }
.broker-card .row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.broker-card .name-wrap { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.broker-card .name { font-size: 14.5px; font-weight: 600; color: #111827; }
.broker-card .broker-badge {
  font-size: 9.5px; font-weight: 700; color: #052E22; background: #34D399;
  padding: 3px 8px; border-radius: 10px; white-space: nowrap; letter-spacing: .02em;
}
.broker-card .visit-btn {
  font-size: 11px; font-weight: 600; color: #052E22; background: #10B981;
  padding: 4px 10px; border-radius: 10px; white-space: nowrap; display: inline-block;
}
.broker-card .visit-btn:hover { background: #0EA271; }
.broker-card .rating { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.broker-card .stars { color: #F5A623; font-size: 13px; letter-spacing: 1px; }
.broker-card .rating-num { font-size: 11px; color: #78500F; font-weight: 600; }
.broker-card .features { font-size: 11px; color: #78500F; line-height: 1.7; list-style: none; padding: 0; margin: 0; }
.broker-card .features li::before { content: "\25CF"; font-size: 8px; margin-right: 6px; vertical-align: middle; }
.sponsored-brokers .see-all { text-align: center; font-size: 11px; color: #B45309; margin-top: 12px; font-weight: 500; display: block; }

.recent-posts-widget { background: #ffffff; border-radius: 10px; border: 1px solid #E3E5E8; padding: 16px; }
.recent-posts-widget h3 { font-size: 14px; margin-bottom: 12px; }
.recent-posts-widget ul { list-style: none; padding: 0; margin: 0; font-size: 13px; color: #374151; }
.recent-posts-widget li { padding: 5px 0; }
.recent-posts-widget a:hover { color: #10B981; }

/* Generic widget styling — applies to anything added via
   Appearance → Widgets (Recent Posts, Search, Categories, etc.)
   so it matches the rest of the site with zero extra setup. */
.widget { padding: 16px; margin-bottom: 18px; }
.widget:last-child { margin-bottom: 0; }
.widget-title { font-size: 14px; margin-bottom: 12px; }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget ul ul { padding-left: 14px; margin-top: 4px; }
.widget li {
  font-size: 13px; color: #374151; padding: 8px 0;
  border-bottom: 1px solid #F0F1F3;
}
.widget li:last-child { border-bottom: 0; }
.widget a:hover { color: #10B981; }
.widget select { width: 100%; padding: 8px; border: 1px solid #E3E5E8; border-radius: 6px; font-size: 13px; }

.widget_search .search-form,
.widget_product_search form { display: flex; gap: 8px; }
.widget input[type="search"], .widget input[type="text"] {
  flex: 1; padding: 9px 11px; border: 1px solid #E3E5E8; border-radius: 6px;
  font-size: 13px; min-width: 0;
}
.widget_search button, .widget input[type="submit"] {
  background: #10B981; color: #052E22; font-weight: 600; font-size: 12.5px;
  padding: 9px 14px; border-radius: 6px; border: 0; cursor: pointer; white-space: nowrap;
}
.widget_search button:hover, .widget input[type="submit"]:hover { background: #0EA271; }

.widget_tag_cloud .tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.widget_tag_cloud a {
  font-size: 12px !important; background: #F5F6F8; color: #374151;
  padding: 5px 11px; border-radius: 14px; display: inline-block;
}
.widget_tag_cloud a:hover { background: #10B981; color: #052E22; }

.widget_calendar table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.widget_calendar caption { font-weight: 600; padding-bottom: 8px; }
.widget_calendar td, .widget_calendar th { text-align: center; padding: 5px 2px; }
.widget_calendar a { color: #10B981; font-weight: 600; }

/* ==========================================================================
   6. SINGLE POST / BROKER REVIEW CTA
   ========================================================================== */
.single-post-content { background: #fff; border-radius: 10px; border: 1px solid #E3E5E8; padding: 28px; }
.single-post-content h1 { font-size: 26px; }
.single-post-content .post-thumb { margin: -28px -28px 20px; }
.single-post-content .post-thumb img { width: 100%; aspect-ratio: 16/8; object-fit: cover; }
.entry-content h2 { font-size: 20px; margin-top: 28px; }
.entry-content h3 { font-size: 17px; margin-top: 20px; }
.entry-content p, .entry-content li { font-size: 15px; color: #374151; }
.entry-content img { border-radius: 8px; }

.broker-cta-box {
  background: #0B1220; border-radius: 10px; padding: 20px 22px; margin: 22px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.broker-cta-box .info h4 { color: #fff; font-size: 16px; margin: 0 0 4px; }
.broker-cta-box .info p { color: #9AA5B8; font-size: 12.5px; margin: 0; }
.broker-cta-box .btn {
  background: #10B981; color: #052E22; font-weight: 600; font-size: 14px;
  padding: 11px 22px; border-radius: 7px; white-space: nowrap;
}
.broker-cta-box .btn:hover { background: #0EA271; }

.affiliate-disclosure {
  font-size: 11.5px; color: #9CA3AF; background: #F5F6F8; border-radius: 6px;
  padding: 10px 12px; margin-bottom: 18px;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
.site-footer { background: #0B1220; padding: 36px 0 0; margin-top: 20px; }
.footer-grid {
  display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr; gap: 30px;
  padding-bottom: 28px; border-bottom: 1px solid #1F2B44;
}
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-col h4 {
  font-family: 'Sora', sans-serif; font-weight: 600; font-size: 12.5px; color: #fff;
  margin-bottom: 14px; text-transform: none;
}
.footer-col p { font-size: 12.5px; color: #8A93A6; line-height: 1.7; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-col ul a { font-size: 12.5px; color: #8A93A6; }
.footer-col ul a:hover { color: #34D399; }

.newsletter-form { display: flex; gap: 7px; }
.newsletter-form input[type="email"] {
  flex: 1; background: #111A2E; border: 1px solid #1F2B44; border-radius: 6px;
  padding: 9px 11px; font-size: 12px; color: #E5E7EB; min-width: 0;
}
.newsletter-form button {
  background: #10B981; color: #052E22; font-weight: 600; font-size: 12px;
  padding: 9px 14px; border-radius: 6px; border: 0; cursor: pointer; white-space: nowrap;
}

.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; flex-wrap: wrap; gap: 10px;
}
.footer-bottom .copyright { font-size: 12px; color: #5B6578; }
.footer-social { display: flex; gap: 16px; }
.footer-social a { color: #8A93A6; font-size: 13px; font-weight: 600; }
.footer-social a:hover { color: #34D399; }

.footer-disclaimer {
  border-top: 1px solid #1F2B44; padding: 14px 0; font-size: 11.5px;
  color: #4B5568; line-height: 1.7;
}

/* ==========================================================================
   8. MOBILE HEADER
   ========================================================================== */
@media (max-width: 860px) {
  .primary-nav-wrap { display: none; }
  .menu-toggle { display: block; }
  .site-header.nav-open .primary-nav-wrap {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    position: absolute; top: 100%; left: 0; right: 0; background: #0B1220;
    padding: 10px 20px 24px; border-top: 1px solid #1F2B44;
    max-height: calc(100vh - 60px); overflow-y: auto;
  }
  .site-header.nav-open .primary-nav { width: 100%; }
  .site-header.nav-open .primary-nav ul {
    flex-direction: column; gap: 0; width: 100%;
  }
  .site-header.nav-open .primary-nav li { width: 100%; border-bottom: 1px solid #1A2338; }
  .site-header.nav-open .primary-nav > ul > li:last-child { border-bottom: 0; }
  .site-header.nav-open .primary-nav a { padding: 13px 4px; width: 100%; }
  .site-header.nav-open .header-cta { margin-top: 14px; text-align: center; }

  /* Submenus become static, collapsible sections instead of floating panels */
  .site-header.nav-open .sub-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; background: #111A2E; border-radius: 8px;
    max-height: 0; overflow: hidden; padding: 0 8px; transition: max-height .22s ease, padding .22s ease;
  }
  .site-header.nav-open li.submenu-open > .sub-menu {
    max-height: 600px; padding: 8px; margin-bottom: 6px;
  }
  .site-header.nav-open .sub-menu a { color: #C7CEDB; }
  .site-header.nav-open .sub-menu a:hover { background: #1A2338; color: #34D399; }
  .site-header.nav-open .sub-menu .sub-menu { margin-left: 10px; }

  /* Visible tap target to expand a submenu on mobile, separate from
     the link itself so tapping "Forex News" can still navigate there
     while the caret expands its children. */
  .submenu-toggle {
    display: flex; align-items: center; justify-content: center;
    position: absolute; right: 0; top: 0; height: 100%; width: 44px;
    background: none; border: 0; color: #C7CEDB; font-size: 13px; cursor: pointer;
  }
  .primary-nav li.menu-item-has-children > a::after { display: none; }
  .submenu-toggle::after {
    content: ""; display: block; width: 7px; height: 7px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg); transition: transform .18s;
  }
  li.submenu-open > .submenu-toggle::after { transform: rotate(-135deg); }
}

/* ==========================================================================
   9. ARCHIVE / CATEGORY
   ========================================================================== */
.archive-header { padding: 26px 0 6px; }
.archive-header h1 { font-size: 24px; }
.pagination { display: flex; gap: 8px; justify-content: center; margin: 30px 0; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: 6px; background: #fff; border: 1px solid #E3E5E8;
  font-size: 13px; color: #374151;
}
.pagination .current { background: #10B981; color: #052E22; border-color: #10B981; font-weight: 600; }

/* ==========================================================================
   10. MISC / ACCESSIBILITY / PRINT SAFE
   ========================================================================== */
::selection { background: #34D399; color: #052E22; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid #10B981; outline-offset: 2px; }
