/* =========================================================
   TrainBard marketing site - shared styles
   Dark theme is the default. Light is opt-in via toggle.
   ========================================================= */

:root,
[data-theme="dark"] {
  --bg: #1a1b26;
  --bg-deep: #16171f;
  --header-bg: #24283b;
  --surface: #1f2133;
  --surface-alt: #24283b;
  --border: #3b3d57;
  --divider: #3b3d57;
  --text: #c0caf5;
  --text-muted: #7982a9;
  --text-paragraph: #a9b1d6;
  --accent: #7aa2f7;
  --accent-hover: rgba(122, 162, 247, 0.12);
  --blue: #7aa2f7;
  --blue-dark: #5d87e0;
  --green: #9ece6a;
  --red: #f7768e;
  --amber: #e0af68;
  --code-bg: #1a1b26;
  --inline-code-bg: #292d42;
  --inline-code-text: #ff9e64;
  --font-sans: "Inter", "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, Monaco, Menlo, monospace;
  --shell-max: 1000px;
  --shell-pad: 20px;
  --control-height: 36px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-deep: #f5f5f5;
  --header-bg: #3a3a3a;
  --surface: #ffffff;
  --surface-alt: #fafafa;
  --border: #E4E4E4;
  --divider: #E4E4E4;
  --text: #2d3748;
  --text-muted: #718096;
  --text-paragraph: #4a5568;
  --accent: #3a3a3a;
  --accent-hover: #f0f4f8;
  --blue: #9DD2EF;
  --blue-dark: #7ABCE0;
  --green: #48bb78;
  --red: #f56565;
  --amber: #f6ad55;
  --code-bg: #F5F5F5;
  --inline-code-bg: #e8edf3;
  --inline-code-text: #d6336c;
}

/* =========================================================
   Reset / base
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Underline on hover for any clickable text. */
a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
}

/* =========================================================
   Layout primitives
   ========================================================= */

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--shell-pad);
}

.section {
  padding: 96px 0;
}

/* Lightweight grouping device used in place of background bands.
   A single hairline separates major thematic shifts. */
.section + .section {
  border-top: 1px solid var(--divider);
}

/* Optional centered text block helper */
.section-centered {
  text-align: center;
}

.section-centered p,
.section-centered h2,
.section-centered h1 {
  margin-left: auto;
  margin-right: auto;
}

.section-centered .cta-actions,
.section-centered .hero-actions {
  justify-content: center;
}

.eyebrow,
.metric-label,
.nav-link {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.84rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
}

h1 {
  max-width: 820px;
  font-size: 3.4rem;
}

h2 {
  max-width: 760px;
  font-size: 2.2rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0;
  max-width: 680px;
  color: var(--text-paragraph);
}

p + p {
  margin-top: 14px;
}

/* =========================================================
   Buttons
   ========================================================= */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height);
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.button:hover {
  text-decoration: none; /* override global a:hover underline */
  border-color: var(--accent);
  color: var(--accent);
}

.button-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #1a202c;
}

.button-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: #1a202c;
}

/* Larger, more prominent CTA used for hero / final CTA */
.button-large {
  height: 44px;
  padding: 0 20px;
  font-size: 0.95rem;
}

/* =========================================================
   Header
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--divider);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding: 14px var(--shell-pad);
}

.brand {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-right: auto; /* push everything else right */
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

[data-theme="light"] .brand:hover {
  color: #9DD2EF;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.nav-link[aria-current="page"] {
  color: var(--text);
}

.nav-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  height: var(--control-height);
  width: 84px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
  }
}

/* =========================================================
   Hero
   ========================================================= */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--divider);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding-block: 96px 96px;
}

.hero-copy h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: 820px;
}

.hero-subtitle {
  margin: 22px auto 0;
  font-size: 1.1rem;
  max-width: 620px;
  color: var(--text-paragraph);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
  justify-content: center;
}

.hero-note {
  margin-top: 18px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Optional product surface beneath the hero copy.
   Replaces the giant empty image-area when no screenshot is present. */
.hero-figure {
  margin: 0 auto;
  max-width: 1000px;
  padding: 32px var(--shell-pad) 64px;
}

.hero-figure .product-surface {
  background: var(--surface);
}

@media (max-width: 720px) {
  .hero-copy {
    padding-block: 56px 48px;
  }
}

/* =========================================================
   Hero proof block (metrics + equity curve)
   ========================================================= */

.hero-proof {
  width: 100%;
  max-width: var(--shell-max);
  margin: 48px auto 0;
  padding-inline: var(--shell-pad);
  padding-bottom: 64px;
}

.results-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: -1px; /* merge with chart border */
}

.result-cell {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg);
  text-align: center;
}

.result-cell .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-cell .value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.result-cell .value.positive { color: var(--green); }
.result-cell .value.negative { color: var(--red); }
.result-cell .value.highlight { color: var(--blue); }

.result-cell .delta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.equity-chart {
  border: 1px solid var(--border);
  background: var(--bg);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 0.72rem;
}

.chart-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.chart-legend .dot.strategy { background: var(--blue); }
.chart-legend .dot.other { background: var(--text-muted); }
.chart-legend .dot.benchmark { background: var(--text); }

.equity-chart svg {
  display: block;
  width: 100%;
  padding: 8px 0;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.equity-caption {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 620px) {
  .results-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-cell .value {
    font-size: 1.2rem;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* =========================================================
   Workflow strip (3 steps)
   ========================================================= */

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.workflow-step {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.workflow-step .step-marker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.workflow-step h3 {
  margin: 0;
}

.workflow-step p {
  margin: 0;
}

@media (max-width: 720px) {
  .workflow-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Feature grid (text + screenshot)
   ========================================================= */

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 40px;
  align-items: center;
}

.feature-grid--reverse > :first-child {
  order: 2;
}

.feature-grid p + p,
.feature-grid p + ul {
  margin-top: 14px;
}

.feature-grid ul {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-paragraph);
  max-width: 640px;
}

.feature-grid ul li {
  position: relative;
  padding-left: 18px;
  font-family: var(--font-sans);
}

.feature-grid ul li::before {
  content: "·";
  position: absolute;
  left: 4px;
  top: -2px;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1;
}

.feature-grid .supporting {
  margin-top: 24px;
  padding: 14px 16px;
  border-left: 2px solid var(--blue);
  background: var(--surface);
  font-size: 0.95rem;
  color: var(--text-paragraph);
  max-width: 640px;
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .feature-grid--reverse > :first-child {
    order: 0;
  }
}

/* =========================================================
   Product surface (screenshot frame)
   ========================================================= */

.product-surface {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--surface);
}

.product-surface img {
  width: 100%;
  border-bottom: 1px solid var(--border);
}

.product-surface figcaption {
  padding: 10px 14px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Theme-aware images inside product surfaces */
.product-surface .theme-img {
  display: none;
  width: 100%;
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .product-surface .theme-img-dark,
[data-theme="light"] .product-surface .theme-img-light {
  display: block;
}

.product-surface .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 24px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background:
    repeating-linear-gradient(0deg, var(--border) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, var(--border) 0 1px, transparent 1px 28px);
  border-bottom: 1px solid var(--border);
  opacity: 0.6;
}

/* =========================================================
   Privacy diagram
   ========================================================= */

.privacy-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
}

.privacy-flow .node {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.privacy-flow .arrow {
  color: var(--text-muted);
}

.privacy-note {
  margin-top: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* =========================================================
   Pricing
   ========================================================= */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 36px;
}

.pricing-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.pricing-card[data-featured="true"] {
  border-top: 3px solid var(--blue);
}

.pricing-card h3 {
  margin: 0;
  font-size: 1rem;
}

.price {
  margin: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
}

.price .price-suffix {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 4px;
}

.pricing-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-paragraph);
  font-size: 0.92rem;
}

.pricing-card ul li {
  font-family: var(--font-sans);
}

.pricing-card .pricing-foot {
  margin-top: auto;
}

.pricing-cta-row {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

@media (max-width: 960px) {
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

/* Pricing comparison table (full pricing page) */

.pricing-table-wrap {
  margin-top: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
}

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.pricing-table th,
.pricing-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.pricing-table thead th {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
}

.pricing-table tbody th {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-table td.numeric {
  font-family: var(--font-mono);
  color: var(--text);
}

.pricing-table tr:last-child th,
.pricing-table tr:last-child td {
  border-bottom: none;
}

/* =========================================================
   FAQ
   ========================================================= */

.faq-list {
  display: grid;
  gap: 0;
  margin-top: 32px;
  border-top: 1px solid var(--divider);
}

.faq-item {
  border-bottom: 1px solid var(--divider);
}

.faq-item summary {
  padding: 16px 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 1.2rem;
}

.faq-item summary:hover {
  color: var(--accent);
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item .faq-body {
  padding: 0 0 18px;
  color: var(--text-paragraph);
  max-width: 720px;
}

/* =========================================================
   Final CTA
   ========================================================= */

.cta-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  padding: 18px 0;
  border-top: 1px solid var(--divider);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.site-footer .footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

/* =========================================================
   Page heading block (used on subpages)
   ========================================================= */

.page-head {
  padding: 72px 0 32px;
  border-bottom: 1px solid var(--divider);
}

.page-head h1 {
  font-size: 2.6rem;
  max-width: 760px;
}

.page-head p {
  margin-top: 16px;
  font-size: 1.05rem;
}

@media (max-width: 720px) {
  .section {
    padding: 64px 0;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  .page-head h1 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
