/* ==============================================
   TheMarginCalculator.com — style.css
   Niche: Financial / Calculators
   Fonts: Inter (headings) + DM Sans (body)
   hpanel-site-build-rules v1.4 compliant
   Cache-bust: ?v=20260509
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

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

:root {
  /* Financial niche tokens — niche-match.md locked values */
  --ink:        #0F2744;
  --navy:       #1E3D6E;
  --gold:       #16A34A;
  --gold-dark:  #15803D;
  --gold-light: #DCFCE7;
  --white:      #ffffff;
  --off:        #F8FAFC;
  --gray:       #6B7280;
  --lgray:      #E5E7EB;
  --mid:        #374151;
  --border:     #D1D5DB;
  --red:        #DC2626;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
  --font-head:  'Inter', sans-serif;
  --font-body:  'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.82;
  color: var(--mid);
  background: var(--off);
}

/* ===== TWO-LAYER CONTAINER — hpanel golden rule ===== */
section          { padding: 64px 5%; }
.inner           { max-width: 1100px; margin: 0 auto; }
.hero-section    { padding: 80px 5% 68px; background: var(--ink); }
.hero-inner      { max-width: 820px; margin: 0 auto; text-align: center; }
footer           { padding: 44px 5% 28px; background: var(--ink); color: var(--white); }
.footer-inner    { max-width: 1100px; margin: 0 auto; }

/* ===== TYPOGRAPHY ===== */
h1 { font-family: var(--font-head); font-size: clamp(2.2rem,5vw,3.6rem); font-weight: 700; line-height: 1.18; color: var(--ink); }
h2 { font-family: var(--font-head); font-size: clamp(1.7rem,3vw,2.6rem); font-weight: 700; line-height: 1.25; color: var(--ink); }
h3 { font-family: var(--font-head); font-size: 1.55rem; font-weight: 600; color: var(--ink); }
h4 { font-family: var(--font-head); font-size: 1.1rem; font-weight: 600; color: var(--ink); }
p  { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
a  { color: var(--gold-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--ink); }
strong { color: var(--ink); font-weight: 600; }

/* ===== HEADER ===== */
header {
  background: var(--ink);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 5%;
  display: flex; align-items: center; justify-content: space-between; height: 62px;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--white); }
.logo-icon {
  width: 36px; height: 36px; background: var(--gold); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 18px; font-weight: 900; color: var(--white); flex-shrink: 0;
}
.logo-text { font-family: var(--font-head); font-size: 15px; font-weight: 700; }
.logo-text span { color: #6EE7A0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
  color: #93C5FD; text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-sm); transition: var(--transition); white-space: nowrap;
}
nav a:hover, nav a.active { background: rgba(255,255,255,.12); color: var(--white); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; color: var(--white); flex-direction: column; gap: 5px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }

/* ===== HERO ===== */
.hero-section h1 { color: var(--white); margin-bottom: 16px; }
.hero-section p  { color: #93C5FD; font-size: 1.1rem; max-width: 600px; margin: 0 auto 28px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 50px; padding: 6px 16px; font-size: 13px; color: #6EE7A0; margin-bottom: 24px; font-family: var(--font-head); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-sm); font-family: var(--font-head);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: var(--transition); border: none;
}
.btn-primary { background: var(--gold); color: var(--white); }
.btn-primary:hover { background: var(--gold-dark); color: var(--white); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; border: 2px solid var(--gold); color: var(--gold-dark); }
.btn-secondary:hover { background: var(--gold-light); }

/* ===== CALCULATOR CARD ===== */
.calc-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden; margin-bottom: 32px;
}
.calc-header {
  background: linear-gradient(135deg, var(--ink), var(--navy));
  padding: 24px 32px; color: var(--white);
}
.calc-header h2 { color: var(--white); font-size: 1.4rem; margin-bottom: 4px; }
.calc-header p  { color: #93C5FD; font-size: 14px; margin: 0; }
.calc-body { padding: 32px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-group label { font-family: var(--font-head); font-size: 13px; font-weight: 600; color: var(--ink); text-transform: uppercase; letter-spacing: .5px; }
.field-group input {
  padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 16px; color: var(--ink); background: var(--off);
  transition: var(--transition);
}
.field-group input:focus { outline: none; border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.field-divider { text-align: center; color: var(--gray); font-size: 13px; font-weight: 500; padding: 8px 0; grid-column: 1/-1; }
.calc-actions { display: flex; gap: 12px; margin-bottom: 28px; }
.calc-btn {
  flex: 1; padding: 14px; border-radius: var(--radius-sm); font-family: var(--font-head);
  font-size: 15px; font-weight: 700; cursor: pointer; transition: var(--transition); border: none;
}
.calc-btn-primary { background: var(--gold); color: var(--white); }
.calc-btn-primary:hover { background: var(--gold-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.calc-btn-reset { background: var(--lgray); color: var(--mid); flex: 0 0 auto; padding: 14px 20px; }
.calc-btn-reset:hover { background: var(--border); }
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.result-card {
  background: var(--off); border: 1.5px solid var(--lgray); border-radius: var(--radius);
  padding: 20px; text-align: center; transition: var(--transition);
}
.result-card.highlight { background: var(--gold-light); border-color: var(--gold); }
.result-label { font-family: var(--font-head); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--gray); margin-bottom: 8px; }
.result-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--ink); }
.result-sub { font-size: 12px; color: var(--gray); margin-top: 4px; }
.quality-bar { margin-top: 20px; padding: 16px; background: var(--off); border-radius: var(--radius-sm); border: 1px solid var(--lgray); }
.quality-label { font-family: var(--font-head); font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 8px; }
.quality-track { height: 8px; background: var(--lgray); border-radius: 99px; overflow: hidden; }
.quality-fill  { height: 100%; border-radius: 99px; transition: width 0.5s ease; }

/* ===== INFO GAIN BOX (required by thin-content-template) ===== */
.info-gain-box {
  background: #FFFEF0; border: 1px solid #E6DB55; border-radius: var(--radius);
  padding: 20px 24px; margin: 28px 0;
}
.info-gain-box h3 { font-family: var(--font-head); font-size: 1rem; color: #856404; margin-bottom: 8px; }
.info-gain-box p  { font-style: italic; line-height: 1.7; color: #713F12; margin: 0; font-size: 0.95rem; }
.info-gain-box small { display: block; margin-top: 10px; color: #92400E; font-size: 12px; }

/* ===== AEO SUMMARY BLOCK (required by 25-pass Check 27) ===== */
.aeo-summary {
  background: var(--white); border-left: 4px solid var(--gold); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px; margin-bottom: 28px; box-shadow: var(--shadow-sm);
}
.aeo-summary p { font-size: 0.95rem; color: var(--mid); margin: 0; line-height: 1.65; }

/* ===== TEAM BOX (E-E-A-T) ===== */
.team-box {
  background: var(--off); border: 1px solid var(--lgray); border-radius: var(--radius);
  padding: 20px 24px; margin: 24px 0;
}
.team-box-label { font-family: var(--font-head); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--gray); margin-bottom: 10px; }
.team-box p { font-size: 0.92rem; color: var(--mid); margin: 0; line-height: 1.7; }
.team-box a { color: var(--gold-dark); }

/* ===== PRIVACY BADGE ===== */
.privacy-badge {
  display: flex; align-items: center; gap: 10px;
  background: var(--gold-light); border: 1px solid var(--gold); border-radius: var(--radius-sm);
  padding: 12px 18px; margin: 20px 0; font-size: 13px; color: var(--gold-dark);
}
.privacy-badge svg { flex-shrink: 0; }

/* ===== CONTENT SECTIONS ===== */
.section-white { background: var(--white); }
.section-off   { background: var(--off); }
.section-ink   { background: var(--ink); }
.section-gold  { background: var(--gold-light); }

.section-label {
  font-family: var(--font-head); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--gold-dark);
  margin-bottom: 12px;
}
.section-intro { font-size: 1.1rem; color: var(--gray); max-width: 640px; margin: 0 auto 40px; text-align: center; }

/* ===== CARDS / GRID ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.card {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--lgray);
  padding: 28px; box-shadow: var(--shadow-sm); transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-icon { font-size: 2rem; margin-bottom: 14px; }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card p  { font-size: 0.92rem; color: var(--gray); margin: 0; }

/* ===== FORMULA BOX ===== */
.formula-box {
  background: var(--ink); color: var(--white); border-radius: var(--radius);
  padding: 20px 24px; font-family: 'Courier New', monospace; font-size: 14px;
  line-height: 1.9; margin: 20px 0;
}
.formula-box span { color: #6EE7A0; font-weight: 600; }

/* ===== FAQ ===== */
.faq-list { list-style: none; }
.faq-item { border-bottom: 1px solid var(--lgray); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 0; cursor: pointer; font-family: var(--font-head);
  font-size: 1rem; font-weight: 600; color: var(--ink); gap: 16px;
}
.faq-q:hover { color: var(--gold-dark); }
.faq-icon { flex-shrink: 0; font-size: 1.2rem; color: var(--gold); transition: var(--transition); }
.faq-a { padding: 0 0 18px; color: var(--mid); line-height: 1.8; display: none; font-size: 0.95rem; }
.faq-item.open .faq-a { display: block; }
.faq-item.open .faq-icon { transform: rotate(45deg); }

/* ===== RELATED CALCULATORS ===== */
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.related-link {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; background: var(--white); border: 1.5px solid var(--lgray);
  border-radius: var(--radius-sm); font-family: var(--font-head); font-size: 14px;
  font-weight: 500; color: var(--ink); transition: var(--transition);
}
.related-link:hover { border-color: var(--gold); background: var(--gold-light); color: var(--gold-dark); }
.related-link .icon { font-size: 1.1rem; }

/* ===== BREADCRUMB ===== */
.breadcrumb { padding: 12px 5%; background: var(--white); border-bottom: 1px solid var(--lgray); }
.breadcrumb-inner { max-width: 1100px; margin: 0 auto; font-size: 13px; color: var(--gray); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--gold-dark); }
.breadcrumb span { color: var(--lgray); }

/* ===== TRUST FOOTER (required by thin-content-template) ===== */
.trust-footer {
  background: #FAFAFA; border-top: 2px solid var(--lgray);
  padding: 20px 5%; margin-top: 40px;
}
.trust-footer-inner { max-width: 1100px; margin: 0 auto; font-size: 0.9rem; color: var(--gray); }
.trust-footer a { color: var(--gold-dark); }

/* ===== SITE FOOTER ===== */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; margin-bottom: 40px; }
.footer-brand p { color: #93C5FD; font-size: 13px; line-height: 1.8; margin-top: 12px; }
.footer-col h4 { font-family: var(--font-head); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #6EE7A0; margin-bottom: 16px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: #93C5FD; font-size: 13px; transition: var(--transition); }
.footer-col a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-copy { font-size: 12px; color: #6B7280; }
.footer-logo { display: flex; align-items: center; gap: 8px; color: var(--white); text-decoration: none; }

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { background: var(--ink); color: var(--white); padding: 14px 16px; text-align: left; font-family: var(--font-head); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--lgray); color: var(--mid); }
.data-table tr:nth-child(even) td { background: var(--off); }
.data-table tr:hover td { background: var(--gold-light); }

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-40 { margin-bottom: 40px; }
.mt-24 { margin-top: 24px; }
.tag { display: inline-block; background: var(--gold-light); color: var(--gold-dark); border-radius: 50px; padding: 3px 12px; font-size: 12px; font-weight: 600; font-family: var(--font-head); }

/* ===== IMAGE WRAPPER (hpanel — no fixed height on img) ===== */
.img-wrap { position: relative; overflow: hidden; border-radius: var(--radius); }
.img-16x9 { aspect-ratio: 16/9; }
.img-4x3  { aspect-ratio: 4/3; }
.img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== MODERNITY SIGNALS (check 1 — hover transitions) ===== */
button, .btn, .card, .related-link, nav a { transition: all var(--transition); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  section { padding: 48px 5%; }
  .hero-section { padding: 60px 5% 48px; }
  h1 { font-size: clamp(1.8rem,6vw,2.4rem); }
  h2 { font-size: clamp(1.4rem,5vw,2rem); }
  .field-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  nav { display: none; }
  nav.open { display: flex; flex-direction: column; position: absolute; top: 62px; left: 0; right: 0; background: var(--ink); padding: 16px 5%; box-shadow: var(--shadow-lg); }
  .nav-toggle { display: flex; }
  .card-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr 1fr; }
  .calc-body { padding: 20px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .results-grid { grid-template-columns: 1fr; }
  .calc-actions { flex-direction: column; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}
