/* iFXTrader Theme Styles */
/* Color palette (provided):
   Dark base: #010851, #072CC9, #052198
   Other: #1C3FCC, #377E47, #9E1318, #474747
*/

/* CSS Variables: Light theme defaults */
:root {
  /* Semantic brand colors */
  --color-brand-900: #010851; /* deep navy */
  --color-brand-700: #052198; /* royal/indigo */
  --color-brand-600: #072CC9; /* vivid cobalt */
  --color-brand-500: #1C3FCC; /* primary accent */

  --color-success: #377E47;
  --color-danger: #9E1318;
  --color-neutral: #474747;

  /* Provide semantic success/danger tokens for components */
  --success: var(--color-success);
  --danger: var(--color-danger);

  /* Light theme tokens */
  --bg: #ffffff;
  --bg-muted: #f5f7fb;
  --text: #0f152a;
  --text-muted: #333745;
  --surface: #ffffff;
  --surface-contrast: #f0f3fa;
  --primary: var(--color-brand-500);
  --primary-contrast: #ffffff;
  --link: var(--color-brand-600);
  --border: #e1e6f0;
  --shadow: rgba(16, 24, 40, 0.08);
}

/* Dark theme overrides */
[data-theme="dark"] {
  --bg: #010851; /* base dark */
  --bg-muted: #031065;
  /* Increase text contrast for better readability */
  --text: #f2f5ff;
  --text-muted: #c7d0ff;
  --surface: #052198; /* panel */
  --surface-contrast: #072CC9; /* headers / accents */
  --primary: #1C3FCC; /* lighter accent for contrast */
  --primary-contrast: #ffffff;
  --link: #9bb4ff;
  /* Lighten borders for clearer separation on dark surfaces */
  --border: rgba(230, 233, 255, 0.28);
  --shadow: rgba(0, 0, 0, 0.35);
}

/* Strengthen card borders and text contrast in dark mode */
[data-theme="dark"] .card { border-color: rgba(230, 233, 255, 0.34); }
[data-theme="dark"] h2,
[data-theme="dark"] h3 { color: #ffffff; }
[data-theme="dark"] .lead { color: #d5dcff; }

/* Reset and base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { width: min(1100px, 92%); margin-inline: auto; }
.stack-2 > * + * { margin-top: 0.5rem; }
.stack-4 > * + * { margin-top: 1rem; }
.stack-6 > * + * { margin-top: 1.5rem; }

/* Header/Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.brand .logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, var(--color-brand-600), var(--color-brand-900));
}
/* Header brand logo image */
.brand .logo-img { height: 36px; width: auto; display: block; border-radius: 6px; }
.nav-links {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
}
.nav-links a {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
}
.nav-links a.active { background: var(--surface-contrast); }
.nav-actions { display: flex; align-items: center; gap: 0.75rem; }
.nav-links .has-dropdown { position: relative; }
.nav-links .has-dropdown > a { display: inline-flex; align-items: center; }
.nav-links .dropdown {
  position: absolute;
  top: 100%; left: 0;
  min-width: 220px;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow);
  padding: 0.25rem;
}
.nav-links .dropdown a {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
}
.nav-links .has-dropdown:hover .dropdown,
.nav-links .has-dropdown:focus-within .dropdown { display: flex; }

/* Theme toggle */
.toggle {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.6rem; border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; user-select: none;
  background: var(--surface);
}
.toggle .dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary);
}

/* Hero */
.hero {
  background: linear-gradient(180deg, var(--surface-contrast), var(--bg));
  position: relative;
}
.hero-inner { padding: 3rem 0; display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(2rem, 3.2vw, 3rem); line-height: 1.2; margin: 0; }
.hero p { font-size: 1.05rem; color: var(--text-muted); }
.hero .cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text); font-weight: 600;
}
.btn-primary { background: var(--primary); color: var(--primary-contrast); border-color: transparent; }
/* Invert success/danger buttons in light mode for better contrast */
.btn-success { background: transparent; color: var(--success); border-color: var(--success); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }

/* Keep filled styles in dark mode */
[data-theme="dark"] .btn-success { background: var(--success); color: #ffffff; border-color: transparent; }
[data-theme="dark"] .btn-danger { background: var(--danger); color: #ffffff; border-color: transparent; }

.backdrop {
  border-radius: 12px; overflow: hidden; box-shadow: 0 12px 30px var(--shadow);
}

/* Sections */
section { padding: 2.5rem 0; }
section h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0 0 0.5rem; }
section .lead { color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 16px var(--shadow);
}
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-responsive { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); }
.site-footer .inner { padding: 1.25rem 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-muted); }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); padding: 0.75rem 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 0.5rem 0 1rem; }

/* Responsive */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
}

/* Home-specific: center highlights H3 */
.highlights h3 { text-align: center; }
/* Home-specific: center all content in highlights cards */
.highlights .card { text-align: center; }

/* Home-specific: center Mission headings */
.mission h2 { text-align: center; }
/* Home-specific: center Mission card content */
.mission .card { text-align: center; }

/* Home-specific: center all h3 on index.html */
.home h3 { text-align: center; }

/* Home-specific: hero backdrop sizing (use container height + object-fit) */
.home .hero .backdrop {
  width: 100%;
  /* Drop height another ~25% */
  height: clamp(180px, 22.5vw, 315px);
}
.home .hero .backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill container while preserving aspect ratio */
}
@media (max-width: 900px) {
  /* Drop mobile height another ~25% */
  .home .hero .backdrop { height: clamp(135px, 30.75vw, 236px); }
}


/* Funding-specific: center all H2 headers on funding.html */
.funding h2 { text-align: center; }
/* Funding-specific: center all H3 headers on funding.html */
.funding h3 { text-align: center; }
/* Funding-specific: center CTA buttons */
.funding .cta { display: flex; justify-content: center; gap: 0.75rem; }
