/* =================================================================== */
/* Your Mortgage Toolbox — shared styles                                 */
/* Used by every calculator page + index + guides_faq.                   */
/* =================================================================== */

/* === Design tokens === */
:root {
  --brand-red: #990000;
  --brand-red-hover: #cc0000;
  --text-color: #333;
  --text-muted: #666;
  --bg-page: #ffffff;
  --bg-soft: #f8f8f8;
  --bg-card: #eeeeee;
  --border-color: #ccc;
  --border-soft: #ddd;
  --max-width: 1200px;
  --content-width: 800px;
  --radius: 6px;
  --shadow: 0 2px 6px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Arial, sans-serif;
  color: var(--text-color);
  background: var(--bg-page);
  line-height: 1.5;
}
a { color: var(--brand-red); }
a:hover { color: var(--brand-red-hover); }

/* === Sticky top header / nav === */
.site-header {
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
}
.logo-link img { max-height: 50px; display: block; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--brand-red);
  color: var(--brand-red);
  font-size: 22px;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius);
}

.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav > a {
  color: var(--brand-red);
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
  padding: 8px 0;
}
.main-nav > a:hover { text-decoration: underline; }

/* Desktop dropdown trigger — bordered button, inverts on hover/active */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-red);
  background: white;
  border: 2px solid var(--brand-red);
  border-radius: 4px;
  padding: 6px 14px;
  font-weight: bold;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-dropdown-toggle:hover,
.nav-dropdown[aria-expanded="true"] .nav-dropdown-toggle {
  background: var(--brand-red);
  color: white;
}
.nav-dropdown-toggle .chevron {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  transition: transform 0.2s;
}
.nav-dropdown[aria-expanded="true"] .nav-dropdown-toggle .chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 240px;
  display: none;
}
.nav-dropdown[aria-expanded="true"] .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  font-weight: normal;
  text-decoration: none;
  color: var(--text-color);
}
.nav-dropdown-menu a:hover { background: var(--bg-soft); }
.nav-dropdown-menu a.current {
  font-weight: bold;
  background: var(--bg-soft);
  color: var(--brand-red);
}

/* Mobile nav (hamburger overlay) */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow);
  }
  .main-nav.is-open { display: flex; }
  .main-nav > a {
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-card);
    text-align: left;
    width: 100%;
  }
  .nav-dropdown-toggle {
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--brand-red);
    padding: 12px 0;
    text-align: left;
    width: 100%;
    justify-content: flex-start;
    border-bottom: 1px solid var(--bg-card);
  }
  .nav-dropdown-toggle:hover,
  .nav-dropdown[aria-expanded="true"] .nav-dropdown-toggle {
    background: transparent;
    color: var(--brand-red);
  }
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 12px;
  }
}

/* === Hero === */
.page-hero {
  background: var(--brand-red);
  color: white;
  padding: 30px 20px;
  text-align: center;
}
.page-hero h1 { margin: 0 0 8px; font-size: 1.6em; }
.page-hero p { margin: 0; font-size: 1em; opacity: 0.95; }
@media (min-width: 600px) {
  .page-hero h1 { font-size: 2em; }
  .page-hero p { font-size: 1.1em; }
}

/* === Calculator page layout === */
.calc-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 30px 20px 40px;
}
.calc-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.calc-card form { margin: 0; }
.calc-section-heading {
  color: var(--text-color);
  font-size: 1.05em;
  font-weight: bold;
  margin: 0 0 4px;
}
.calc-section-sub {
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 16px;
  font-size: 14px;
}
.calc-divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 22px 0;
}

/* === Form fields === */
.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.field-row label { font-size: 14px; font-weight: bold; }
@media (min-width: 600px) {
  .field-row {
    grid-template-columns: 1fr 220px;
    align-items: center;
    gap: 12px;
  }
  .field-row label { font-weight: normal; }
}

.field-control input,
.field-control select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  font-size: 14px;
  font-family: inherit;
}
.field-control input:focus,
.field-control select:focus {
  outline: 2px solid var(--brand-red);
  outline-offset: 1px;
}
.field-note {
  font-size: 12px;
  color: var(--brand-red);
  font-style: italic;
  margin: -6px 0 12px;
}
@media (min-width: 600px) {
  .field-note { padding-left: calc(100% - 220px); }
}

/* Radio group (savings.html month/year toggle) */
.radio-group { display: flex; gap: 16px; align-items: center; }
.radio-group label { font-weight: normal; cursor: pointer; }
.radio-group input[type=radio] { transform: scale(1.2); margin-right: 6px; }

/* "Solve for" radios (mtgcalc.html) */
.solve-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.solve-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: center;
}
.solve-option input[type=radio] { margin: 0; transform: scale(1.2); }
.solve-option label { font-size: 14px; }
.solve-option .field-control { grid-column: 1 / -1; padding-left: 30px; }
@media (min-width: 600px) {
  .solve-option {
    grid-template-columns: auto 1fr 220px;
    align-items: center;
  }
  .solve-option .field-control { grid-column: auto; padding-left: 0; }
}

/* === Buttons === */
.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}
.btn {
  background: var(--brand-red);
  color: white;
  padding: 10px 22px;
  border: 2px solid var(--brand-red);
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
  transition: background 0.15s;
}
.btn:hover {
  background: var(--brand-red-hover);
  border-color: var(--brand-red-hover);
  color: white;
  text-decoration: none;
}
.btn-secondary {
  background: white;
  color: var(--brand-red);
}
.btn-secondary:hover {
  background: var(--bg-soft);
  color: var(--brand-red);
}

/* mtgcalc amortization image-link */
.calc-amort-link img { max-width: 100%; height: auto; display: block; }

/* mtgcalc disclaimer note */
.calc-disclaimer {
  font-style: italic;
  color: var(--brand-red);
  font-size: 13px;
  margin-top: 14px;
  text-align: center;
  line-height: 1.45;
}

/* === Results === */
.calc-results-heading {
  background: var(--brand-red);
  color: white;
  padding: 10px 14px;
  font-weight: bold;
  font-size: 1em;
  border-radius: var(--radius);
  margin: 28px 0 10px;
}
.calc-results {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 240px;
}

/* === Affiliate slot === */
.affiliate-slot {
  /* Hidden until affiliate partnerships are signed.
     To re-enable: delete the next line. */
  display: none;
  background: white;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
  margin: 28px 0;
  text-align: center;
}
.affiliate-slot .label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 6px;
}
.affiliate-slot p { margin: 6px 0; }
.affiliate-slot a { font-weight: bold; }

/* === Accuracy expandable === */
.accuracy-section {
  margin-top: 26px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.accuracy-section summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--brand-red);
}
.accuracy-section summary:hover { text-decoration: underline; }
.accuracy-section p { margin: 12px 0 0; font-size: 14px; }
.accuracy-section em { font-family: "Cambria Math", Georgia, serif; }

/* === Inline share === */
.share-section { margin-top: 30px; text-align: center; }
.share-section p { margin-bottom: 10px; font-size: 14px; }
.share-buttons { display: inline-flex; gap: 12px; justify-content: center; }
.share-buttons a img { width: 40px; height: 40px; display: block; }

/* === Universal footer === */
.universal-footer {
  background: var(--bg-soft);
  padding: 24px 20px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  font-size: 14px;
}
.universal-footer a {
  color: var(--brand-red);
  text-decoration: underline;
  font-weight: bold;
}
.universal-footer a:hover { text-decoration: none; }
.universal-footer p { margin: 6px 0; }

/* === Home page (index.html) — calculator grid + cards === */
.hero {
  background-color: var(--brand-red);
  color: white;
  padding: 20px;
  text-align: center;
}
.hero h1 { margin-bottom: 10px; }
.hero p { font-size: 1.2em; }
.cta-button {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 24px;
  background-color: white;
  color: var(--brand-red);
  text-decoration: none;
  border-radius: 6px;
  font-weight: bold;
}
.container {
  padding: 40px 20px;
  max-width: var(--max-width);
  margin: auto;
}
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.card {
  background-color: var(--bg-card);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 1.2em;
  margin-top: 0;
  color: var(--brand-red);
}
.card p { color: var(--text-color); }
.card a {
  display: inline-block;
  margin-top: 10px;
  color: var(--brand-red);
  text-decoration: underline;
  font-weight: bold;
}

/* === Guides & FAQs page === */
.guide-list a {
  display: block;
  margin: 10px 0;
  color: var(--brand-red);
  font-weight: bold;
  text-decoration: underline;
}
.faq-item {
  border-bottom: 1px solid var(--border-soft);
  padding: 15px 0;
}
.faq-question {
  font-weight: bold;
  cursor: pointer;
  position: relative;
  padding-right: 20px;
}
.faq-question::after {
  content: '\25BC';
  position: absolute;
  right: 0;
  transition: transform 0.3s;
}
.faq-question.active::after { transform: rotate(180deg); }
.faq-answer {
  display: none;
  margin-top: 10px;
  color: var(--text-color);
}

/* Container variant for guides/donate (narrower) */
.content-container {
  padding: 40px 20px;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
}
.content-container h2 {
  color: var(--brand-red);
  margin-bottom: 10px;
}

/* === Email-gate section (guides_faq.html) === */
.guides-gate {
  background: linear-gradient(135deg, #ffffff 0%, var(--bg-soft) 100%);
  border: 2px solid var(--brand-red);
  border-radius: var(--radius);
  padding: 28px 22px;
  margin: 10px 0 36px;
  text-align: center;
  box-shadow: var(--shadow);
}
.guides-gate h2 {
  margin: 0 0 8px;
  color: var(--brand-red);
  font-size: 1.4em;
}
.guides-gate .gate-sub {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 1em;
}
.ml-fallback-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto 12px;
}
.ml-fallback-form input {
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
}
.ml-fallback-form button {
  background: var(--brand-red);
  color: #ffffff;
  font-weight: bold;
  font-size: 16px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.ml-fallback-form button:hover { background: var(--brand-red-hover); }
.form-trust {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* === Guide card grid (preview + library) === */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.guide-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}
.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.guide-card .guide-num {
  display: inline-block;
  font-size: 12px;
  font-weight: bold;
  color: var(--brand-red);
  background: #ffffff;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid var(--brand-red);
  margin-bottom: 10px;
  align-self: flex-start;
}
.guide-card h3 {
  font-size: 1.05em;
  margin: 0 0 6px;
  color: var(--text-color);
  line-height: 1.3;
}
.guide-card p {
  font-size: 0.92em;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.45;
  flex-grow: 1;
}
.guide-card .guide-locked {
  display: inline-block;
  font-size: 12px;
  color: var(--brand-red);
  font-weight: bold;
  margin-top: auto;
}
.guide-card .guide-download {
  display: inline-block;
  margin-top: auto;
  background: var(--brand-red);
  color: #ffffff;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: var(--radius);
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  transition: background 0.15s;
}
.guide-card .guide-download:hover {
  background: var(--brand-red-hover);
  color: #ffffff;
}

/* === Library callout (guides-library.html) === */
.library-callout {
  background: var(--bg-soft);
  border-left: 4px solid var(--brand-red);
  padding: 14px 18px;
  margin: 0 0 24px;
  border-radius: 4px;
  font-size: 0.95em;
}
.library-callout strong { color: var(--brand-red); }

/* === Cookie consent banner === */
.ymt-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 2px solid var(--brand-red);
  padding: 16px 20px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-family: Arial, sans-serif;
}
.ymt-cookie-text {
  flex: 1;
  min-width: 280px;
  line-height: 1.5;
  color: var(--text-color);
}
.ymt-cookie-text a {
  color: var(--brand-red);
  font-weight: bold;
}
.ymt-cookie-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ymt-cookie-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  white-space: nowrap;
}
.ymt-cookie-btn-primary {
  background: var(--brand-red);
  color: #ffffff;
}
.ymt-cookie-btn-primary:hover { background: var(--brand-red-hover); }
.ymt-cookie-btn-secondary {
  background: #ffffff;
  color: var(--brand-red);
  border-color: var(--brand-red);
}
.ymt-cookie-btn-secondary:hover { background: var(--bg-soft); }
@media (max-width: 600px) {
  .ymt-cookie-banner { flex-direction: column; align-items: stretch; }
  .ymt-cookie-buttons { justify-content: stretch; }
  .ymt-cookie-buttons .ymt-cookie-btn { flex: 1; }
}
