/* mafinance.xyz — margin trading calculator
   Identity: midnight blue + crimson + amber + neutral grey + paper
   Typography: sans body, condensed bold heads, mono for numerics
   Layout: risk-prospectus, callouts, tabular result panels */

:root {
  --midnight: #0f1c3f;
  --midnight-deep: #081026;
  --midnight-soft: #1f2c52;
  --crimson: #c0292c;
  --crimson-deep: #8b1a1c;
  --amber: #e8a90a;
  --amber-soft: #faecbf;
  --grey: #94a3b8;
  --grey-deep: #475569;
  --paper: #f4f6fa;
  --paper-deep: #e2e8f0;
  --line: #cbd5e1;
  --text: #1a1a1a;
  --green: #16a34a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
}

.mono {
  font-family: "JetBrains Mono", "SF Mono", "Roboto Mono", Consolas, "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.4rem;
}

/* ---------- header ---------- */
.site-header {
  background: var(--midnight);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 2px solid var(--amber);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.4rem;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  text-decoration: none;
  color: var(--paper);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  background: var(--midnight-deep);
  border: 1.5px solid var(--amber);
  border-radius: 4px;
  position: relative;
}

.brand-mark .delta {
  width: 26px;
  height: 26px;
  position: relative;
}
.brand-mark .delta::before {
  content: '';
  position: absolute;
  top: 4px; left: 0;
  width: 0; height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-bottom: 18px solid var(--amber);
}
.brand-mark .delta::after {
  content: '';
  position: absolute;
  top: 17px; left: 2px;
  width: 22px;
  height: 2px;
  background: var(--crimson);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-weight: 700;
  font-size: 1.18rem;
  color: var(--paper);
  letter-spacing: -0.01em;
}

.brand-tagline {
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: .68rem;
  color: var(--amber);
  margin-top: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--paper);
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: .2px;
  transition: color .15s ease;
}

.nav a:hover { color: var(--amber); }

.nav-toggle { display: none; }

@media (max-width: 920px) {
  .nav { display: none; }
  .nav.open {
    display: flex;
    position: absolute;
    top: 70px; left: 0; right: 0;
    background: var(--midnight);
    border-bottom: 2px solid var(--amber);
    flex-direction: column;
    padding: 1rem 1.4rem;
    gap: .8rem;
  }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 4px;
    background: none; border: 1.5px solid var(--amber);
    border-radius: 4px;
    padding: 8px 10px; cursor: pointer;
  }
  .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--amber); }
}

/* ---------- hero ---------- */
.hero {
  background: var(--midnight);
  color: var(--paper);
  padding: 3rem 0 2.6rem;
  position: relative;
  border-bottom: 1px solid var(--midnight-soft);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 60%; height: 2px;
  background: var(--crimson);
}

.hero-inner { max-width: 880px; }

.eyebrow {
  display: inline-block;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .72rem;
  font-weight: 600;
  color: var(--midnight);
  background: var(--amber);
  padding: .3rem .9rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
  border-radius: 2px;
}

.hero h1 {
  font-weight: 700;
  font-size: clamp(1.95rem, 4.2vw, 3rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  color: var(--paper);
  letter-spacing: -0.02em;
}

.hero .lead {
  font-size: 1.04rem;
  color: var(--grey);
  line-height: 1.6;
}

.hero .lead strong { color: var(--amber); }

/* ---------- main content ---------- */
main { padding: 2.4rem 0 4rem; }

.content > section { margin-bottom: 2.4rem; }

h2 {
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--midnight);
  margin: 0 0 .8rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: .8rem;
  border-bottom: 2px solid var(--midnight);
  padding-bottom: .5rem;
}

h2 .ref {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .82rem;
  font-weight: 600;
  color: var(--crimson);
  letter-spacing: 0;
}

h3 {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--midnight);
  margin: 1.4rem 0 .5rem;
  letter-spacing: -0.005em;
}

p { margin: 0 0 1rem; }

a { color: var(--crimson); text-decoration: none; border-bottom: 1px solid rgba(192, 41, 44, 0.3); transition: border-color .15s ease; font-weight: 500; }
a:hover { border-bottom-color: var(--crimson); }

ul, ol { padding-left: 1.4rem; margin: 0 0 1rem; }
li { margin-bottom: .35rem; }

/* ---------- risk callout ---------- */
.risk-callout {
  background: var(--amber-soft);
  border-left: 4px solid var(--crimson);
  padding: 1rem 1.3rem;
  margin: 1.5rem 0;
  font-size: .94rem;
  color: var(--midnight);
  border-radius: 0 4px 4px 0;
}

.risk-callout strong {
  color: var(--crimson-deep);
  display: block;
  margin-bottom: .3rem;
  font-size: .82rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: "JetBrains Mono", Consolas, monospace;
}

/* ---------- calculator card ---------- */
.tool-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--midnight);
  padding: 2rem 2rem;
  margin: 2rem 0;
  box-shadow: 0 2px 12px rgba(15, 28, 63, 0.06);
}

.tool-card h2 {
  margin-bottom: .3rem;
  border-bottom: none;
  padding-bottom: 0;
}

.tool-subtitle {
  color: var(--grey-deep);
  margin-bottom: 1.6rem;
  font-size: .94rem;
}

.side-tabs {
  display: flex;
  margin: 0 0 1.4rem;
  border: 1.5px solid var(--midnight);
  border-radius: 4px;
  overflow: hidden;
}

.side-tab {
  flex: 1;
  padding: .65rem 1rem;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: var(--midnight);
  background: var(--paper);
  border: none;
  cursor: pointer;
  letter-spacing: .3px;
  border-right: 1px solid var(--midnight);
}
.side-tab:last-child { border-right: 0; }
.side-tab.active { background: var(--midnight); color: var(--paper); }
.side-tab.active.short { background: var(--crimson); border-color: var(--crimson); }

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.4rem;
}

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

.tool-grid label {
  display: flex;
  flex-direction: column;
  font-size: .78rem;
  font-weight: 600;
  color: var(--midnight);
  letter-spacing: .3px;
  text-transform: uppercase;
}

.tool-grid input, .tool-grid select {
  margin-top: .35rem;
  padding: .65rem .8rem;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .98rem;
  font-weight: 500;
  color: var(--text);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 3px;
  outline: none;
  text-transform: none;
  letter-spacing: 0;
}

.tool-grid input:focus, .tool-grid select:focus {
  border-color: var(--midnight);
  background: #fff;
}

.btn {
  display: inline-block;
  padding: .8rem 1.8rem;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--midnight);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease;
}

.btn:hover { background: var(--midnight-deep); }

.tool-actions {
  display: flex;
  justify-content: center;
  gap: .8rem;
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.tool-actions .btn-secondary {
  background: var(--paper);
  color: var(--midnight);
  border: 1.5px solid var(--midnight);
}

.tool-actions .btn-secondary:hover { background: var(--paper-deep); color: var(--midnight); }

/* ---------- result panel ---------- */
.result {
  margin-top: 1.8rem;
  padding: 1.6rem 1.4rem;
  background: var(--midnight);
  color: var(--paper);
  border-radius: 4px;
  position: relative;
}

.result::before {
  content: 'POSITION REPORT';
  position: absolute;
  top: 0; right: 1rem;
  background: var(--amber);
  color: var(--midnight);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: .25rem .65rem;
  border-radius: 0 0 3px 3px;
}

.result h3 {
  margin: 0 0 1.1rem;
  color: var(--paper);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--midnight-soft);
  padding-bottom: .6rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .9rem;
}

.result-tile {
  padding: .9rem 1rem;
  background: var(--midnight-deep);
  border-radius: 3px;
  border: 1px solid var(--midnight-soft);
}

.result-tile-label {
  display: block;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .68rem;
  color: var(--grey);
  margin-bottom: .35rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}

.result-tile-value {
  display: block;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: -0.01em;
}

.result-tile-value.danger { color: var(--crimson); }
.result-tile-value.warn { color: var(--amber); }
.result-tile-value.ok { color: var(--green); }

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.4rem;
  font-size: .9rem;
  background: var(--midnight-deep);
  border: 1px solid var(--midnight-soft);
}
.breakdown-table th, .breakdown-table td {
  text-align: left;
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--midnight-soft);
  color: var(--paper);
}
.breakdown-table th {
  background: var(--midnight-soft);
  color: var(--amber);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-size: .75rem;
}
.breakdown-table td:last-child { text-align: right; font-family: "JetBrains Mono", Consolas, monospace; }

/* ---------- E-E-A-T author card ---------- */
.author-card {
  background: var(--paper-deep);
  border-left: 3px solid var(--midnight);
  padding: 1.2rem 1.5rem;
  margin: 2rem 0;
  color: var(--midnight);
  font-size: .94rem;
  line-height: 1.65;
}

.author-card strong { color: var(--midnight-deep); font-weight: 700; }

/* ---------- about/contact form card ---------- */
.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--midnight);
  padding: 1.8rem 2rem;
  margin: 1rem 0 2.5rem;
}

.form-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--midnight);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.form-card input, .form-card select, .form-card textarea {
  width: 100%;
  padding: .7rem .85rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 3px;
  margin-top: .35rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  border-color: var(--midnight);
  outline: none;
  background: #fff;
}

/* ---------- tables ---------- */
.cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: .9rem;
  border: 1px solid var(--line);
}

.cookie-table th, .cookie-table td {
  text-align: left;
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--line);
}

.cookie-table th {
  background: var(--midnight);
  color: var(--paper);
  font-weight: 600;
  font-size: .76rem;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.cookie-table tr:nth-child(even) td { background: var(--paper-deep); }

.cookie-table code {
  font-family: "JetBrains Mono", Consolas, monospace;
  background: var(--paper-deep);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: .85rem;
}

/* ---------- footer ---------- */
.site-footer {
  background: var(--midnight-deep);
  color: var(--grey);
  padding: 2.4rem 0 1.4rem;
  margin-top: 3rem;
  border-top: 2px solid var(--amber);
}

.site-footer .brand-name { color: var(--paper); }
.site-footer .brand-tagline { color: var(--amber); }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.6rem;
}

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

.site-footer h4 {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-weight: 600;
  color: var(--amber);
  margin: 0 0 .7rem;
  font-size: .78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer a { color: var(--paper); border-bottom: none; font-size: .92rem; font-weight: 400; }
.site-footer a:hover { color: var(--amber); }

.footer-bottom {
  border-top: 1px solid var(--midnight-soft);
  padding-top: 1.2rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .82rem;
  color: var(--grey);
}

.footer-bottom small a { color: var(--amber); border-bottom: none; }
