/* =========================================================
   SOFTYTOOLS — Design tokens & global styles
   Fast. Smart. Trade Better.
   ========================================================= */

:root {
  /* --- Color tokens (Light) --- */
  --paper: #F7F8FA;
  --paper-2: #FFFFFF;
  --ink: #16212C;
  --ink-soft: #4B5A68;
  --line: rgba(22, 33, 44, 0.12);
  --line-strong: rgba(22, 33, 44, 0.22);

  /* Brand */
  --ember: #F2762E;
  --ember-deep: #C4471A;
  --ember-soft: rgba(242, 118, 46, 0.12);

  /* Semantic finance */
  --gain: #1B8F58;
  --gain-soft: rgba(27, 143, 88, 0.12);
  --loss: #D14343;
  --loss-soft: rgba(209, 67, 67, 0.12);

  /* Surfaces */
  --surface: var(--paper-2);
  --surface-raised: #FFFFFF;
  --shadow-elevated: 0 20px 40px -24px rgba(22, 33, 44, 0.35);

  /* Type */
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* Layout */
  --max: 1180px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --nav-h: 68px;

  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #0F1720;
  --paper-2: #16212C;
  --ink: #E7ECF1;
  --ink-soft: #9FB0BE;
  --line: rgba(231, 236, 241, 0.12);
  --line-strong: rgba(231, 236, 241, 0.22);

  --ember: #F5934F;
  --ember-deep: #F2762E;
  --ember-soft: rgba(245, 147, 79, 0.14);

  --gain: #35C281;
  --gain-soft: rgba(53, 194, 129, 0.14);
  --loss: #E4685F;
  --loss-soft: rgba(228, 104, 95, 0.14);

  --surface: #16212C;
  --surface-raised: #1C2933;
  --shadow-elevated: 0 24px 48px -20px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1720;
    --paper-2: #16212C;
    --ink: #E7ECF1;
    --ink-soft: #9FB0BE;
    --line: rgba(231, 236, 241, 0.12);
    --line-strong: rgba(231, 236, 241, 0.22);
    --ember: #F5934F;
    --ember-deep: #F2762E;
    --ember-soft: rgba(245, 147, 79, 0.14);
    --gain: #35C281;
    --gain-soft: rgba(53, 194, 129, 0.14);
    --loss: #E4685F;
    --loss-soft: rgba(228, 104, 95, 0.14);
    --surface: #16212C;
    --surface-raised: #1C2933;
    --shadow-elevated: 0 24px 48px -20px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.5rem); }
p { margin: 0 0 1em; max-width: 68ch; }
.tabular { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--ember); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-sm); z-index: 200; transition: top .2s ease;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* =========================================================
   Header / Nav
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.signal-line {
  height: 2px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--ember) 30%, var(--ember-deep) 55%, transparent 80%);
  background-size: 200% 100%;
  animation: signal-sweep 2.6s ease-out 1;
}
@keyframes signal-sweep {
  0% { background-position: 120% 0; opacity: 0; }
  15% { opacity: 1; }
  100% { background-position: -20% 0; opacity: 1; }
}
.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-word { font-size: 1.28rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand-word .soft { color: var(--ink); }
.brand-word .tools { color: var(--ember); }

.nav-links {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.94rem; font-weight: 500;
}
.nav-links a {
  padding: 9px 13px; border-radius: var(--radius-sm); color: var(--ink-soft);
  transition: color .15s ease, background-color .15s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); background: var(--ember-soft); }
.nav-links a[aria-current="page"] { color: var(--ember-deep); }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--ink-soft);
  transition: border-color .15s ease, color .15s ease;
}
.theme-toggle:hover { border-color: var(--ember); color: var(--ember); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-sun, :root:not([data-theme]) .icon-sun { display: none; }
[data-theme="dark"] .icon-moon, :root:not([data-theme]) .icon-moon { display: block; }
.icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); max-width: 100%;
  font-weight: 600; font-size: 0.95rem; white-space: normal; text-align: center;
  border: 1px solid transparent; transition: transform .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--ember), var(--ember-deep));
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ember); color: var(--ember-deep); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.87rem; }

.nav-toggle {
  display: none; width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); align-items: center; justify-content: center;
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--paper-2); border-bottom: 1px solid var(--line);
    padding: 10px; gap: 2px;
  }
  .nav-links.open a { padding: 12px 14px; }
}

@media (max-width: 500px) {
  .nav-actions .btn-primary { display: none; }
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative; overflow: hidden;
  padding: 56px 0 64px;
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 600; color: var(--ember-deep);
  background: var(--ember-soft); padding: 6px 12px; border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 { margin-bottom: 0.4em; }
.hero-sub { font-size: 1.1rem; color: var(--ink-soft); max-width: 52ch; }
.hero-cta-row { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; margin-top: 36px; flex-wrap: wrap; }
.hero-stat b { display: block; font-family: var(--font-display); font-size: 1.4rem; }
.hero-stat span { font-size: 0.85rem; color: var(--ink-soft); }

.hero-ticker-bg {
  position: absolute; inset: 0; z-index: -1; opacity: 0.5;
  pointer-events: none;
}
[data-theme="dark"] .hero-ticker-bg { opacity: 0.35; }

/* Mini live calculator widget in hero */
.mini-calc {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  padding: 22px;
}
.mini-calc-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.mini-calc-head h2 { font-size: 1rem; margin: 0; }
.pill {
  font-size: 0.72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: var(--gain-soft); color: var(--gain);
}
.field { margin-bottom: 14px; min-width: 0; }
.field label {
  display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 0.95rem; transition: border-color .15s ease;
}
.field input:focus, .field select:focus { border-color: var(--ember); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-calc-result {
  margin-top: 16px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--ember-soft); display: flex; align-items: center; justify-content: space-between;
}
.mini-calc-result span { font-size: 0.85rem; color: var(--ink-soft); }
.mini-calc-result b { font-family: var(--font-display); font-size: 1.3rem; color: var(--ember-deep); }

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

/* =========================================================
   Sections / generic content
   ========================================================= */
section { padding: 64px 0; }
.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head p { color: var(--ink-soft); }
.eyebrow-label {
  font-size: 0.85rem; font-weight: 600; color: var(--ember-deep); margin-bottom: 10px; display: block;
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 900px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 24px;
}
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 22px;
  transition: border-color .15s ease, transform .15s ease;
}
.tool-card:hover { border-color: var(--ember); transform: translateY(-2px); }
.tool-card-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--ember-soft); display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; color: var(--ember-deep);
}
.tool-card-icon svg { width: 20px; height: 20px; }
.tool-card h3 { margin-bottom: 6px; font-size: 1.05rem; }
.tool-card p { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 0; }

.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step { position: relative; padding-left: 4px; }
.step-num {
  font-family: var(--font-display); font-size: 2rem; font-weight: 700;
  color: var(--ember); opacity: 0.55; margin-bottom: 6px;
}
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }

.quote-block {
  border-left: 3px solid var(--ember); padding-left: 18px; margin: 24px 0;
  color: var(--ink-soft); font-style: normal;
}

/* =========================================================
   Calculator page — tabs & engine
   ========================================================= */
.calc-shell {
  display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start;
}
@media (max-width: 900px) { .calc-shell { grid-template-columns: 1fr; } }

.calc-nav { position: sticky; top: calc(var(--nav-h) + 16px); min-width: 0; }
.calc-nav ul { display: flex; flex-direction: column; gap: 2px; }
.calc-nav button {
  width: 100%; text-align: left; padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 0.92rem; font-weight: 500; color: var(--ink-soft);
  display: flex; align-items: center; gap: 10px;
}
.calc-nav button:hover { background: var(--ember-soft); color: var(--ink); }
.calc-nav button[aria-selected="true"] {
  background: var(--ember-soft); color: var(--ember-deep); font-weight: 600;
}
@media (max-width: 900px) {
  .calc-nav ul { flex-direction: row; overflow-x: auto; gap: 8px; padding-bottom: 6px; }
  .calc-nav { position: static; }
  .calc-nav button { white-space: nowrap; }
}

.calc-panel { display: none; }
.calc-panel.active { display: block; }
.calc-panel-inner {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-elevated);
}
.calc-panel-inner h2 { margin-bottom: 4px; }
.calc-desc { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 24px; }

.calc-body { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 28px; }
@media (max-width: 800px) { .calc-body { grid-template-columns: 1fr; } }

.unit-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.unit-toggle button {
  padding: 7px 13px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--line-strong); color: var(--ink-soft);
}
.unit-toggle button[aria-pressed="true"] { background: var(--ember); border-color: var(--ember); color: #fff; }

.result-card {
  background: var(--ember-soft); border-radius: var(--radius-md); padding: 20px;
}
.result-row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.result-row:last-child { border-bottom: 0; }
.result-row span { font-size: 0.87rem; color: var(--ink-soft); }
.result-row b { font-family: var(--font-display); font-size: 1.15rem; }
.result-row.primary b { font-size: 1.6rem; color: var(--ember-deep); }
.result-row.gain b { color: var(--gain); }
.result-row.loss b { color: var(--loss); }
.result-note {
  font-size: 0.83rem; color: var(--ink-soft); margin-top: 14px; margin-bottom: 0;
}
.warn-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--loss-soft); color: var(--loss); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 0.87rem; margin-top: 14px;
}
.formula-box {
  background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 0.87rem; color: var(--ink-soft); margin-top: 18px;
}
.formula-box code { color: var(--ember-deep); font-weight: 600; }

/* =========================================================
   Guides / Blog
   ========================================================= */
.guide-card {
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 22px;
  background: var(--surface); display: flex; flex-direction: column; gap: 8px;
}
.guide-tag { font-size: 0.78rem; font-weight: 700; color: var(--ember-deep); }
.guide-card h3 { margin-bottom: 2px; }
.guide-meta { font-size: 0.82rem; color: var(--ink-soft); }

article.guide { max-width: 74ch; margin: 0 auto; }
article.guide h2 { margin-top: 1.7em; }
article.guide h3 { margin-top: 1.3em; }
article.guide ul, article.guide ol { margin: 0 0 1.2em; padding-left: 1.3em; }
article.guide li { list-style: disc; margin-bottom: 0.4em; }
article.guide ol li { list-style: decimal; }
.toc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 18px 20px; margin: 24px 0 36px;
}
.toc h2 { font-size: 0.95rem; margin-bottom: 10px; }
.toc ul { padding-left: 0; }
.toc li { list-style: none; margin-bottom: 6px; }
.toc a { color: var(--ember-deep); font-size: 0.9rem; }
.faq-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq-item h3 { margin-bottom: 6px; font-size: 1rem; }

/* =========================================================
   Breadcrumbs
   ========================================================= */
.breadcrumbs { font-size: 0.85rem; color: var(--ink-soft); padding: 16px 0 0; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--line-strong); }
.breadcrumbs a:hover { color: var(--ember-deep); }
.breadcrumbs li[aria-current] { color: var(--ink); }

/* =========================================================
   Forms (Contact / Request a Tool)
   ========================================================= */
.form-panel { max-width: 640px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form-grid textarea { min-height: 130px; resize: vertical; }
.form-grid .field input, .form-grid .field select, .form-grid .field textarea {
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.form-status {
  margin-top: 16px; padding: 14px; border-radius: var(--radius-sm); font-size: 0.9rem; display: none;
}
.form-status.show { display: block; }
.form-status.info { background: var(--ember-soft); color: var(--ember-deep); }
.form-status.success { background: var(--gain-soft); color: var(--gain); }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 0.87rem; color: var(--ink-soft); }
.checkbox-row input { margin-top: 3px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.footer-brand p { color: var(--ink-soft); font-size: 0.9rem; margin-top: 12px; max-width: 32ch; }
.footer-col h4 { font-size: 0.85rem; margin-bottom: 12px; color: var(--ink-soft); }
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
.footer-col a { font-size: 0.9rem; color: var(--ink); }
.footer-col a:hover { color: var(--ember-deep); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--ink-soft);
}
@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* Ad placeholder slot: transparent, clearly labeled, non-intrusive */
.ad-slot {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px; text-align: center; font-size: 0.75rem; color: var(--ink-soft);
  margin: 32px 0;
}

/* Disclaimer strip used on calculator/guides pages */
.disclaimer-strip {
  font-size: 0.82rem; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 28px;
}

/* Utility */
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
.center-head { max-width: 62ch; margin: 0 auto 36px; text-align: center; }
