/* ==========================================================================
   FinMatz.com — Design System Stylesheet
   Paste into: WordPress Dashboard → Appearance → Customize → Additional CSS
   (or, preferred: Blocksy child theme → style.css)
   Source of truth: FinMatz Master Planning & Architecture Document, Section 7
   Brand: "Smart Tools for Smarter Money Decisions"
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS  (Section 7.2 Color, 7.3 Typography)
   These mirror the values you should also set in Blocksy Customizer → Colors
   so admins can rebrand without code. CSS vars are the fallback + component API.
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette */
  --fm-primary:        #0F6E4F; /* Deep Wealth Green — primary brand, headers, buttons */
  --fm-primary-dark:   #0A5038; /* hover/active, footer, gradients */
  --fm-primary-tint:   #EAF1EE; /* section backgrounds, category cards */
  --fm-secondary:      #1F5FA6; /* Trust Blue — links, secondary accents, H3 */
  --fm-secondary-tint: #E8F0F8; /* info backgrounds */
  --fm-accent:         #C9A227; /* Premium Gold — CTAs, highlights, key results */
  --fm-accent-tint:    #FFF8E1; /* callouts, badges */

  /* Neutrals & surfaces */
  --fm-bg:        #FFFFFF; /* Clean White — page background */
  --fm-surface:   #F4F7F9; /* cards, table stripes */
  --fm-text:      #2D3540; /* body text */
  --fm-text-muted:#5A6470; /* secondary text, captions */
  --fm-border:    #C9D2DA; /* borders, dividers */

  /* Semantic status */
  --fm-success: #1E9E6A;
  --fm-warning: #C77700;
  --fm-danger:  #C0392B;

  /* Typography scale (modular ~1.25) */
  --fm-fs-12: 0.75rem;
  --fm-fs-14: 0.875rem;
  --fm-fs-16: 1rem;
  --fm-fs-18: 1.125rem;
  --fm-fs-22: 1.375rem;
  --fm-fs-28: 1.75rem;
  --fm-fs-34: 2.125rem;
  --fm-fs-40: 2.5rem;

  --fm-font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fm-font-head: "Poppins", "Inter", system-ui, sans-serif;

  /* Spacing grid (4 / 8px) */
  --fm-space-1: 0.25rem;
  --fm-space-2: 0.5rem;
  --fm-space-3: 0.75rem;
  --fm-space-4: 1rem;
  --fm-space-6: 1.5rem;
  --fm-space-8: 2rem;
  --fm-space-12: 3rem;
  --fm-space-16: 4rem;

  --fm-radius: 8px;
  --fm-radius-lg: 14px;
  --fm-shadow-sm: 0 1px 3px rgba(15,110,79,.08);
  --fm-shadow-md: 0 6px 20px rgba(15,110,79,.10);
  --fm-maxw: 1200px;
}

/* --------------------------------------------------------------------------
   2. BASE TYPOGRAPHY
   -------------------------------------------------------------------------- */
body.finmatz,
.finmatz {
  font-family: var(--fm-font-body);
  color: var(--fm-text);
  background: var(--fm-bg);
  font-size: var(--fm-fs-16);
  line-height: 1.6;
}
.finmatz h1, .finmatz h2, .finmatz h3, .finmatz h4 { font-family: var(--fm-font-head); color: var(--fm-primary); line-height: 1.2; }
.finmatz h1 { font-size: var(--fm-fs-40); font-weight: 800; }
.finmatz h2 { font-size: var(--fm-fs-28); font-weight: 700; }
.finmatz h3 { font-size: var(--fm-fs-22); font-weight: 600; color: var(--fm-secondary); }
.finmatz a  { color: var(--fm-secondary); text-decoration: none; }
.finmatz a:hover { text-decoration: underline; }
@media (max-width: 781px){
  .finmatz h1 { font-size: var(--fm-fs-34); }
  .finmatz h2 { font-size: var(--fm-fs-22); }
}

/* tabular numbers for results & tables (Section 7.4) */
.fm-tabular, .fm-result-value, .fm-table td { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   3. BUTTONS  (Section 7.4)
   Applied via the "fm-btn" / "fm-btn-secondary" class on core/buttons blocks.
   -------------------------------------------------------------------------- */
.fm-btn .wp-block-button__link,
.wp-block-button.fm-btn .wp-block-button__link {
  background: var(--fm-accent);
  color: #1c1300;
  font-weight: 600;
  border-radius: var(--fm-radius);
  padding: 0.75rem 1.5rem;
  min-height: 44px;            /* 44x44 tap target */
  display: inline-flex; align-items: center;
  transition: background .15s ease, transform .15s ease;
}
.fm-btn .wp-block-button__link:hover { background: #b8922170; background: var(--fm-primary); color:#fff; }
.fm-btn .wp-block-button__link:focus-visible { outline: 2px solid var(--fm-secondary); outline-offset: 2px; }

.fm-btn-secondary .wp-block-button__link {
  background: transparent;
  color: var(--fm-primary);
  border: 2px solid var(--fm-primary);
  border-radius: var(--fm-radius);
  padding: 0.65rem 1.4rem;
  font-weight: 600; min-height: 44px;
}
.fm-btn-secondary .wp-block-button__link:hover { background: var(--fm-primary-tint); }

/* --------------------------------------------------------------------------
   4. CARDS  (calculator / article / trust)  Section 7.4
   Apply class on a core/column or core/group.
   -------------------------------------------------------------------------- */
.fm-card {
  background: var(--fm-bg);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius-lg);
  padding: var(--fm-space-6);
  box-shadow: var(--fm-shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  height: 100%;
}
.fm-card:hover { transform: translateY(-3px); box-shadow: var(--fm-shadow-md); }
.fm-card .fm-card-icon { font-size: 2rem; color: var(--fm-primary); margin-bottom: var(--fm-space-2); }
.fm-card h3 { margin: 0 0 .25rem; color: var(--fm-primary); }
.fm-card p  { color: var(--fm-text-muted); margin: 0; font-size: var(--fm-fs-14); }

.fm-category-card { background: var(--fm-primary-tint); border-color: transparent; text-align: center; }
.fm-chip {
  display: inline-block; background: var(--fm-secondary-tint); color: var(--fm-secondary);
  font-size: var(--fm-fs-12); font-weight: 600; padding: 2px 10px; border-radius: 999px;
}

/* --------------------------------------------------------------------------
   5. SECTION BANDS / LAYOUT HELPERS
   -------------------------------------------------------------------------- */
.fm-band            { padding: var(--fm-space-12) var(--fm-space-4); }
.fm-band-tint       { background: var(--fm-primary-tint); }
.fm-band-surface    { background: var(--fm-surface); }
.fm-hero            { background: linear-gradient(135deg, var(--fm-primary) 0%, var(--fm-primary-dark) 100%); color:#fff; }
.fm-hero h1, .fm-hero h2 { color:#fff; }
.fm-hero .fm-sub    { color: #dCeee6; font-size: var(--fm-fs-18); }
.fm-section-title   { text-align:center; margin-bottom: var(--fm-space-8); }

/* --------------------------------------------------------------------------
   6. CALCULATOR WIDGET SHELL  (Section 10 — reserve dimensions to protect CLS)
   -------------------------------------------------------------------------- */
.fm-calc-shell {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--fm-space-6);
  border: 1px solid var(--fm-border); border-radius: var(--fm-radius-lg);
  padding: var(--fm-space-6); background: var(--fm-bg); min-height: 420px; /* reserves space → CLS≈0 */
}
.fm-calc-result { background: var(--fm-primary-tint); border-radius: var(--fm-radius); padding: var(--fm-space-6); text-align:center; }
.fm-result-value { font-family: var(--fm-font-head); font-size: var(--fm-fs-34); font-weight: 800; color: var(--fm-primary); }
@media (max-width: 781px){ .fm-calc-shell { grid-template-columns: 1fr; min-height: 640px; } }

/* --------------------------------------------------------------------------
   7. TABLES  (Section 7.4)
   -------------------------------------------------------------------------- */
.fm-table table { width:100%; border-collapse: collapse; }
.fm-table thead th { background: var(--fm-primary); color:#fff; text-align:left; padding:.6rem .8rem; }
.fm-table tbody tr:nth-child(odd) td { background: var(--fm-surface); }
.fm-table td, .fm-table th { padding:.55rem .8rem; border-bottom:1px solid var(--fm-border); }
@media (max-width: 600px){ .fm-table { overflow-x:auto; } }

/* --------------------------------------------------------------------------
   8. ACCORDIONS / FAQ  (Section 7.4) — works with core/details block
   -------------------------------------------------------------------------- */
.fm-faq .wp-block-details,
details.fm-faq-item {
  border: 1px solid var(--fm-border); border-radius: var(--fm-radius);
  padding: var(--fm-space-4); margin-bottom: var(--fm-space-3); background: var(--fm-bg);
}
.fm-faq summary { font-weight: 600; color: var(--fm-primary); cursor: pointer; list-style: none; }
.fm-faq summary::-webkit-details-marker { display:none; }
.fm-faq summary::after { content:"+"; float:right; color: var(--fm-accent); font-weight:700; }
.fm-faq details[open] summary::after { content:"–"; }

/* --------------------------------------------------------------------------
   9. ALERTS / CALLOUTS  (Section 7.4)
   -------------------------------------------------------------------------- */
.fm-alert { border-radius: var(--fm-radius); padding: var(--fm-space-4); border-left: 4px solid; margin: var(--fm-space-4) 0; }
.fm-alert-info    { background: var(--fm-secondary-tint); border-color: var(--fm-secondary); }
.fm-alert-success { background: #e7f6ef; border-color: var(--fm-success); }
.fm-alert-warning { background: var(--fm-accent-tint); border-color: var(--fm-warning); }
.fm-alert-danger  { background: #fcebe9; border-color: var(--fm-danger); }

/* --------------------------------------------------------------------------
   10. AD SLOTS — reserve fixed dimensions to protect CLS (Section 11.3)
   Wrap every ad in one of these so layout never shifts when the ad loads.
   -------------------------------------------------------------------------- */
.fm-ad { display:block; margin: var(--fm-space-6) auto; text-align:center; overflow:hidden; background: var(--fm-surface); }
.fm-ad::before { content:"Advertisement"; display:block; font-size:11px; letter-spacing:.08em; text-transform:uppercase; color: var(--fm-text-muted); padding: 4px 0; }
.fm-ad-leaderboard { min-height: 90px; max-width: 728px; }     /* desktop top */
.fm-ad-sidebar     { min-height: 600px; width: 300px; position: sticky; top: 90px; } /* 300x600 */
.fm-ad-incontent   { min-height: 250px; max-width: 728px; }
.fm-ad-multiplex   { min-height: 250px; }
.fm-ad-anchor      { position: fixed; left:0; right:0; bottom:0; min-height: 50px; z-index: 999; background:#fff; box-shadow:0 -2px 8px rgba(0,0,0,.08); }
@media (min-width: 782px){ .fm-ad-anchor { display:none; } } /* anchor = mobile only */

/* --------------------------------------------------------------------------
   11. FOOTER (8-column SEO footer)  Section 7.9
   -------------------------------------------------------------------------- */
.fm-footer { background: var(--fm-primary-dark); color:#cfe3da; padding: var(--fm-space-12) var(--fm-space-4) var(--fm-space-6); }
.fm-footer a { color:#eef6f2; }
.fm-footer h4 { color:#fff; font-size: var(--fm-fs-16); margin-bottom: var(--fm-space-3); }
.fm-footer .fm-footer-grid { display:grid; grid-template-columns: repeat(8, 1fr); gap: var(--fm-space-6); max-width: var(--fm-maxw); margin:0 auto; }
.fm-footer ul { list-style:none; padding:0; margin:0; }
.fm-footer li { margin-bottom: 6px; font-size: var(--fm-fs-14); }
.fm-footer-base { border-top:1px solid rgba(255,255,255,.15); margin-top: var(--fm-space-8); padding-top: var(--fm-space-4); text-align:center; font-size: var(--fm-fs-12); color:#aecabe; }
@media (max-width: 1024px){ .fm-footer .fm-footer-grid { grid-template-columns: repeat(4,1fr); } }
@media (max-width: 600px){ .fm-footer .fm-footer-grid { grid-template-columns: repeat(2,1fr); } }

/* --------------------------------------------------------------------------
   12. BREADCRUMBS, SHARE BAR, AUTHOR BOX, TOC
   -------------------------------------------------------------------------- */
.fm-breadcrumb { font-size: var(--fm-fs-14); color: var(--fm-text-muted); margin-bottom: var(--fm-space-4); }
.fm-breadcrumb a { color: var(--fm-secondary); }
.fm-share { display:flex; gap:.5rem; }
.fm-share a { width:40px; height:40px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; background: var(--fm-primary-tint); color: var(--fm-primary); }
.fm-author-box { display:flex; gap: var(--fm-space-4); background: var(--fm-surface); border-radius: var(--fm-radius-lg); padding: var(--fm-space-6); align-items:center; }
.fm-toc { background: var(--fm-surface); border:1px solid var(--fm-border); border-radius: var(--fm-radius); padding: var(--fm-space-4); }
.fm-toc h4 { margin-top:0; color: var(--fm-primary); }

/* --------------------------------------------------------------------------
   13. ACCESSIBILITY & MOTION  (Section 7.7)
   -------------------------------------------------------------------------- */
.finmatz :focus-visible { outline: 2px solid var(--fm-secondary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce){
  .fm-card, .fm-btn .wp-block-button__link { transition: none; }
}
.fm-visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
