/*!
 * Naija Money Guide News — forex-calculator.css
 * Styles for the Forex Pip Profit Calculator. Loaded only on the calculator
 * page. Mobile-first; built on the theme's --nmg-* variables so light and
 * dark modes follow the rest of the site. Every class is prefixed nmg-fx-.
 */

.nmg-fx-page,
.nmg-fx {
	--nmg-fx-profit: #0b5e3e;
	--nmg-fx-loss: #b3261e;
	--nmg-fx-neutral: #4b5563;
	--nmg-fx-muted: #555d6b;
	--nmg-fx-focus: #0b5e3e;
	--nmg-fx-card: var(--nmg-white);
	--nmg-fx-soft: var(--nmg-gray-100);
	--nmg-fx-warn-bg: #fff8e1;
	--nmg-fx-warn-text: #5c4300;
	box-sizing: border-box;
}
html[data-nmg-theme="dark"] .nmg-fx-page,
html[data-nmg-theme="dark"] .nmg-fx {
	--nmg-fx-profit: #5fd9a0;
	--nmg-fx-loss: #ff8a80;
	--nmg-fx-neutral: #b4bac4;
	--nmg-fx-muted: var(--nmg-gray-600);
	--nmg-fx-focus: #f2c94c;
	--nmg-fx-warn-bg: #2c2410;
	--nmg-fx-warn-text: #f1dc9a;
}
/* Explicit border-box (not inherit): content inside <details> sits under ::details-content in modern browsers, which breaks inherit chains. */
.nmg-fx-page *, .nmg-fx *, .nmg-fx-page *::before, .nmg-fx *::before, .nmg-fx-page *::after, .nmg-fx *::after { box-sizing: border-box; }
.nmg-fx [hidden], .nmg-fx-page [hidden] { display: none !important; }

.nmg-fx-page { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; overflow-wrap: break-word; }

/* ============ HERO ============ */
.nmg-fx-hero { text-align: center; padding: 28px 0 20px; }
.nmg-fx-eyebrow { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nmg-green); margin-bottom: 8px; }
html[data-nmg-theme="dark"] .nmg-fx-eyebrow { color: var(--nmg-accent); }
.nmg-fx-title { font-size: 1.65rem; font-weight: 800; line-height: 1.25; margin: 0 0 10px; color: var(--nmg-black); }
.nmg-fx-subtitle { font-size: 1rem; line-height: 1.6; color: var(--nmg-fx-muted); max-width: 640px; margin: 0 auto 14px; }
.nmg-fx-privacy { display: inline-block; font-size: 0.82rem; color: var(--nmg-fx-muted); background: var(--nmg-gray-100); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--nmg-border); }

/* ============ LAYOUT ============ */
.nmg-fx-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-bottom: 36px; }
.nmg-fx-form, .nmg-fx-results {
	min-width: 0;
	background: var(--nmg-fx-card);
	border: 1px solid var(--nmg-border);
	border-top: 4px solid var(--nmg-green);
	border-radius: 10px;
	padding: 18px 16px 20px;
}
html[data-nmg-theme="dark"] .nmg-fx-form, html[data-nmg-theme="dark"] .nmg-fx-results { background: var(--nmg-gray-100); border-top-color: var(--nmg-accent); }
.nmg-fx-card-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 8px; color: var(--nmg-black); }
.nmg-fx-card-title:focus { outline: none; }
.nmg-fx-short-disclaimer { font-size: 0.82rem; line-height: 1.5; color: var(--nmg-gray-800); background: var(--nmg-fx-soft); border-left: 3px solid var(--nmg-accent); border-radius: 4px; padding: 8px 10px; margin: 0 0 16px; }

@media (min-width: 960px) {
	.nmg-fx-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: start; gap: 24px; }
	.nmg-fx-results { position: sticky; top: calc(var(--nmg-header-height, 76px) + 16px); }
	.nmg-fx-title { font-size: 2rem; }
}

/* ============ FIELDS ============ */
.nmg-fx-field, .nmg-fx-fieldset { margin: 0 0 14px; min-width: 0; }
.nmg-fx-fieldset { border: 0; padding: 0; }
.nmg-fx-field label, .nmg-fx-fieldset legend, .nmg-fx-sublabel { display: block; font-size: 0.9rem; font-weight: 700; color: var(--nmg-black); margin: 0 0 5px; padding: 0; }
.nmg-fx-sublabel { margin-top: 10px; }
.nmg-fx input[type="text"], .nmg-fx select {
	display: block; width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px;
	font: inherit; font-size: 1rem; line-height: 1.3;
	color: var(--nmg-black); background: var(--nmg-white);
	border: 1px solid var(--nmg-gray-400); border-radius: var(--nmg-radius);
	-webkit-appearance: none; appearance: none;
}
html[data-nmg-theme="dark"] .nmg-fx input[type="text"], html[data-nmg-theme="dark"] .nmg-fx select { background: var(--nmg-gray-200); border-color: var(--nmg-border); }
.nmg-fx select {
	padding-right: 34px;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
	background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.nmg-fx input[aria-invalid="true"], .nmg-fx select[aria-invalid="true"] { border-color: var(--nmg-fx-loss); border-width: 2px; }
.nmg-fx input:focus-visible, .nmg-fx select:focus-visible, .nmg-fx summary:focus-visible, .nmg-fx button:focus-visible, .nmg-fx a:focus-visible, .nmg-fx-segment input:focus-visible + label {
	outline: 3px solid var(--nmg-fx-focus); outline-offset: 2px;
}
.nmg-fx-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 14px; }
.nmg-fx-row > .nmg-fx-field { margin-bottom: 0; }
.nmg-fx-row-size, .nmg-fx-row-rate { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); margin-bottom: 6px; }
.nmg-fx-field .nmg-fx-row { margin-bottom: 6px; }
.nmg-fx-help { font-size: 0.8rem; line-height: 1.45; color: var(--nmg-fx-muted); margin: 6px 0 0; }
.nmg-fx-pair-summary { font-size: 0.82rem; line-height: 1.45; color: var(--nmg-gray-800); background: var(--nmg-fx-soft); border-radius: 4px; padding: 7px 10px; margin: 8px 0 0; }
.nmg-fx-error { font-size: 0.84rem; line-height: 1.4; font-weight: 600; color: var(--nmg-fx-loss); margin: 6px 0 0; }
.nmg-fx-error::before { content: "\26A0\FE0E\00a0"; }
.nmg-fx-error-summary { border: 2px solid var(--nmg-fx-loss); border-radius: 6px; padding: 10px 12px; margin: 0 0 16px; font-size: 0.9rem; }
.nmg-fx-error-summary:focus { outline: 3px solid var(--nmg-fx-focus); }
.nmg-fx-error-summary-title { font-weight: 800; margin: 0 0 6px; }
.nmg-fx-error-summary ul { margin: 0; padding-left: 18px; }
.nmg-fx-error-summary a { color: var(--nmg-fx-loss); font-weight: 600; text-decoration: underline; }
.nmg-fx-noscript { background: var(--nmg-fx-warn-bg); color: var(--nmg-fx-warn-text); padding: 10px 12px; border-radius: 6px; }

/* BUY / SELL segmented control */
.nmg-fx-segment { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px solid var(--nmg-gray-400); border-radius: 8px; overflow: hidden; }
.nmg-fx-segment input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nmg-fx-segment label { display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 0; cursor: pointer; font-weight: 800; letter-spacing: 0.04em; color: var(--nmg-black); background: var(--nmg-white); text-align: center; }
html[data-nmg-theme="dark"] .nmg-fx-segment label { background: var(--nmg-gray-200); }
.nmg-fx-segment input:checked + .nmg-fx-seg-buy { background: #0b5e3e; color: #fff; }
.nmg-fx-segment input:checked + .nmg-fx-seg-sell { background: #8f1d17; color: #fff; }
.nmg-fx-segment input:checked + label::before { content: "\2713\00a0"; }
.nmg-fx-segment { position: relative; }

/* disclosures */
.nmg-fx details { margin: 0 0 14px; }
.nmg-fx summary { cursor: pointer; font-weight: 700; font-size: 0.92rem; color: var(--nmg-green); padding: 10px 0; min-height: 44px; }
html[data-nmg-theme="dark"] .nmg-fx summary { color: var(--nmg-accent); }
.nmg-fx-advanced, .nmg-fx-optional { border-top: 1px solid var(--nmg-border); }
.nmg-fx-optional:last-of-type { border-bottom: 1px solid var(--nmg-border); }
.nmg-fx-rate { background: var(--nmg-fx-soft); border: 1px solid var(--nmg-border); border-radius: 8px; padding: 12px; margin: 0 0 14px; }
.nmg-fx-rate .nmg-fx-field { margin-bottom: 0; }
.nmg-fx-fetch { margin-top: 10px; }

/* buttons */
.nmg-fx-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.nmg-fx-btn { min-height: 48px; font-size: 1rem; font-weight: 700; border: 0; cursor: pointer; text-align: center; }
.nmg-fx-actions .nmg-btn-primary { flex: 2 1 140px; }
.nmg-fx-actions .nmg-btn-secondary { flex: 1 1 90px; }
.nmg-fx .nmg-btn-primary { background: var(--nmg-green); color: #fff; }
.nmg-fx .nmg-btn-primary:hover { background: var(--nmg-green-dark); }
html[data-nmg-theme="dark"] .nmg-fx .nmg-btn-primary { background: #0f7a52; }
.nmg-fx-link-btn { flex: 1 1 100%; background: transparent; color: var(--nmg-green); text-decoration: underline; min-height: 44px; }
html[data-nmg-theme="dark"] .nmg-fx-link-btn { color: var(--nmg-accent); }

/* ============ RESULTS ============ */
.nmg-fx-empty { color: var(--nmg-fx-muted); line-height: 1.55; margin: 0; padding: 14px; background: var(--nmg-fx-soft); border-radius: 6px; }
.nmg-fx-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nmg-fx-example-note { font-size: 0.82rem; background: var(--nmg-fx-warn-bg); color: var(--nmg-fx-warn-text); border-radius: 4px; padding: 7px 10px; margin: 0 0 12px; }
.nmg-fx-headline { display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px 16px; border-radius: 8px; background: var(--nmg-fx-soft); border-left: 6px solid var(--nmg-fx-neutral); margin-bottom: 12px; }
.nmg-fx-headline.is-profit { border-left-color: var(--nmg-fx-profit); }
.nmg-fx-headline.is-loss { border-left-color: var(--nmg-fx-loss); }
.nmg-fx-headline-label { font-size: 0.85rem; font-weight: 700; color: var(--nmg-gray-800); }
.nmg-fx-headline-value { font-size: 1.9rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--nmg-fx-neutral); overflow-wrap: anywhere; }
.nmg-fx-headline.is-profit .nmg-fx-headline-value { color: var(--nmg-fx-profit); }
.nmg-fx-headline.is-loss .nmg-fx-headline-value { color: var(--nmg-fx-loss); }
.nmg-fx-headline-sub { font-size: 0.86rem; color: var(--nmg-fx-muted); overflow-wrap: anywhere; }
.nmg-fx-warning { font-size: 0.84rem; line-height: 1.45; background: var(--nmg-fx-warn-bg); color: var(--nmg-fx-warn-text); border-radius: 6px; padding: 8px 10px; margin: 0 0 10px; }

.nmg-fx-breakdown { margin: 0 0 14px; padding: 0; }
.nmg-fx-row-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--nmg-border); }
.nmg-fx-row-item dt { flex: 1 1 140px; font-size: 0.88rem; color: var(--nmg-gray-800); margin: 0; }
.nmg-fx-row-item dd { flex: 0 1 auto; max-width: 100%; margin: 0; font-weight: 700; font-size: 0.95rem; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; margin-left: auto; }
.nmg-fx-row-item dd.is-profit { color: var(--nmg-fx-profit); }
.nmg-fx-row-item dd.is-loss { color: var(--nmg-fx-loss); }
.nmg-fx-row-total { border-top: 2px solid var(--nmg-black); border-bottom: 0; padding-top: 12px; }
.nmg-fx-row-total dt, .nmg-fx-row-total dd { font-size: 1rem; font-weight: 800; }
.nmg-fx-risk h3, .nmg-fx-assumptions h3 { font-size: 1rem; margin: 18px 0 6px; color: var(--nmg-black); }
.nmg-fx-assumptions ul { margin: 0 0 12px; padding-left: 18px; font-size: 0.84rem; line-height: 1.5; color: var(--nmg-gray-800); }
.nmg-fx-assumptions li { margin-bottom: 4px; }
.nmg-fx-result-disclaimer { font-size: 0.78rem; line-height: 1.5; color: var(--nmg-fx-muted); margin: 8px 0 0; }

/* ============ ARTICLE + FAQ ============ */
.nmg-fx-article, .nmg-fx-faq, .nmg-fx-related { max-width: 780px; margin: 0 auto 32px; line-height: 1.7; }
.nmg-fx-article h2, .nmg-fx-faq h2, .nmg-fx-related h2 { font-size: 1.35rem; line-height: 1.3; margin: 32px 0 10px; color: var(--nmg-black); scroll-margin-top: calc(var(--nmg-header-height, 76px) + 12px); }
.nmg-fx-article h3 { font-size: 1.05rem; margin: 18px 0 6px; color: var(--nmg-black); }
.nmg-fx-article p, .nmg-fx-article li { color: var(--nmg-gray-800); }
.nmg-fx-article p { margin: 0 0 12px; }
.nmg-fx-article ul, .nmg-fx-article ol { margin: 0 0 14px; padding-left: 22px; }
.nmg-fx-article li { margin-bottom: 6px; }
.nmg-fx-article code { font-size: 0.92em; background: var(--nmg-gray-200); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
.nmg-fx-example { background: var(--nmg-gray-100); border: 1px solid var(--nmg-border); border-left: 4px solid var(--nmg-accent); border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
.nmg-fx-example h3 { margin-top: 0; }
.nmg-fx-steps { margin-bottom: 0 !important; }
.nmg-fx-faq-item { border-bottom: 1px solid var(--nmg-border); padding: 12px 0; }
.nmg-fx-faq-item summary { font-weight: 700; cursor: pointer; color: var(--nmg-black); min-height: 44px; display: list-item; }
.nmg-fx-faq-item summary:focus-visible { outline: 3px solid var(--nmg-fx-focus); outline-offset: 2px; }
.nmg-fx-faq-item p { margin: 8px 0 0; color: var(--nmg-gray-800); }
.nmg-fx-related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.nmg-fx-related a { color: var(--nmg-green); font-weight: 600; text-decoration: underline; }
html[data-nmg-theme="dark"] .nmg-fx-related a { color: var(--nmg-accent); }

@media (prefers-reduced-motion: reduce) { .nmg-fx *, .nmg-fx-page * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print { .nmg-fx-actions, .nmg-fx-fetch { display: none !important; } .nmg-fx-results { position: static; } }
