/* =============================================================
   1. Tokens (ToolSprout's own neutral green identity)
   ============================================================= */
:root {
  --bg: #f5f9f8;
  --bg-alt: #e9f2ef;
  --card: #ffffff;
  --text: #142420;
  --text-soft: #56706a;
  --border: #dbe8e3;

  --accent: #0f6f5c;
  --accent-bright: #14b892;
  --accent-dark: #0b5347;

  --error: #b5432f;
  --red: #c94b3f;
  --amber: #d99a2b;
  --green: #3f9d5c;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sans: "Inter", system-ui, sans-serif;
  --display: "Sora", var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1613;
    --bg-alt: #131f1b;
    --card: #17231f;
    --text: #eaf5f1;
    --text-soft: #9fb6ae;
    --border: #223129;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; text-wrap: balance; line-height: 1.15; color: var(--text); }
::selection { background: var(--accent-bright); color: #06231c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--card); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.skip-link:focus { top: 1rem; }
.sr-only-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.25rem; }

/* =============================================================
   4. Header (ToolSprout site-wide)
   ============================================================= */
.site-header { position: sticky; top: 0; z-index: 50; padding: .85rem 0; border-bottom: 1px solid var(--border); background: var(--card); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.header-inner { gap: 1rem; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 1.1rem; }
.logo { font-family: var(--display); font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; color: var(--text); }
.logo-mark {
  display: inline-grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
  gap: 3px; width: 26px; height: 26px; padding: 5px; border-radius: 8px;
  background: var(--accent-dark); flex-shrink: 0;
}
.logo-mark span { background: var(--accent-bright); border-radius: 2px; }

.header-nav { position: relative; }
.dropdown-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .8rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem;
  color: var(--text); transition: background .15s var(--ease-out);
}
.dropdown-toggle:hover { background: var(--bg-alt); }
.dropdown-caret { transition: transform .18s var(--ease-out); }
.dropdown-toggle[aria-expanded="true"] .dropdown-caret { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: calc(100% + .5rem); left: 0; min-width: 190px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px -16px rgba(10, 30, 25, .25);
  padding: .4rem; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s var(--ease-out), transform .16s var(--ease-out), visibility .16s;
}
.dropdown-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu li a { display: block; padding: .55rem .7rem; border-radius: 8px; font-size: .92rem; font-weight: 500; color: var(--text); }
.dropdown-menu li a:hover { background: var(--bg-alt); text-decoration: none; }

.header-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: .5rem .9rem; flex: 1; max-width: 260px; min-width: 140px;
}
.search-icon { color: var(--text-soft); flex-shrink: 0; }
.header-search input { border: 0; background: none; outline: none; color: var(--text); font: inherit; font-size: .92rem; width: 100%; }
.header-search input::placeholder { color: var(--text-soft); }
.search-kbd {
  font-family: var(--sans); font-size: .72rem; color: var(--text-soft);
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: .1rem .4rem; flex-shrink: 0; display: none;
}
@media (min-width: 540px) { .search-kbd { display: inline-block; } }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding-block: .9rem; font-size: .85rem; color: var(--text-soft); }
.breadcrumb a { color: var(--text-soft); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent-dark); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); margin-bottom: .6rem; }
.hero .subtitle { color: var(--text-soft); max-width: 56ch; margin-inline: auto; font-size: 1.02rem; }

/* =============================================================
   6. Tool card / calculator layout
   ============================================================= */
.tool-section { padding-block: 1.25rem 1rem; }
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: 0 12px 40px -20px rgba(15, 60, 50, .25);
}
@media (min-width: 720px) { .tool-card { padding: 2rem; } }

.calc-layout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .calc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

.calc-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
.form-row { margin-bottom: 1rem; }
.form-row.span-2 { grid-column: 1 / -1; }
.form-row label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .4rem; }
.form-row .field-hint { display: block; font-weight: 500; color: var(--text-soft); font-size: .78rem; margin-top: .3rem; }
.field-hint--warning { color: #96650f; font-weight: 700; }
.text-input, .number-input, .select-input {
  width: 100%; padding: .7rem .85rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); font-size: .95rem; color: var(--text); font-family: var(--sans);
}
.text-input:focus, .number-input:focus, .select-input:focus { outline: none; border-color: var(--accent); }

.check-row { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; font-weight: 600; margin-bottom: 1rem; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; margin-top: .15rem; }
.check-row .check-label-note { display: block; font-weight: 500; color: var(--text-soft); font-size: .78rem; margin-top: .1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .9rem;
  transition: transform .15s var(--ease-bounce);
}
.btn-primary { background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; box-shadow: 0 10px 24px -10px rgba(15, 111, 92, .5); }
.btn-primary:hover { transform: translateY(-2px); text-decoration: none; }
.btn-secondary { background: var(--bg-alt); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { transform: translateY(-2px); text-decoration: none; }

/* =============================================================
   7. Result panel
   ============================================================= */
.result-panel { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
@media (min-width: 720px) { .result-panel { padding: 1.5rem; } }

.hero-result { text-align: center; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.hero-result-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin-bottom: .4rem; }
.hero-result-value { font-family: var(--display); font-size: clamp(2.2rem, 8vw, 3rem); font-weight: 800; color: var(--accent-dark); line-height: 1; }
.hero-result-note { color: var(--text-soft); font-size: .85rem; margin-top: .5rem; }

.margin-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px; font-weight: 700; font-size: .82rem; margin-top: .6rem; }
.margin-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.margin-badge--red { background: #fbeae6; color: var(--red); }
.margin-badge--red::before { background: var(--red); }
.margin-badge--amber { background: #fbf1e0; color: #96650f; }
.margin-badge--amber::before { background: var(--amber); }
.margin-badge--green { background: color-mix(in srgb, var(--green) 18%, var(--card)); color: #276a3f; }
.margin-badge--green::before { background: var(--green); }

.breakdown-list { display: grid; gap: .6rem; margin-bottom: 1rem; }
.breakdown-item { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .7rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.breakdown-item-label { font-weight: 700; font-size: .86rem; }
.breakdown-item-note { display: block; font-weight: 500; color: var(--text-soft); font-size: .78rem; margin-top: .15rem; }
.breakdown-item-amount { font-family: var(--display); font-weight: 800; font-size: .95rem; white-space: nowrap; }

.summary-stats { display: grid; gap: .7rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 500px) { .summary-stats { grid-template-columns: repeat(4, 1fr); } }
.summary-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .6rem; text-align: center; }
.summary-stat-value { display: block; font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--accent-dark); }
.summary-stat-label { display: block; font-size: .72rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: .03em; margin-top: .2rem; }

.result-error { color: var(--error); font-weight: 700; font-size: .9rem; padding: 1rem; }

/* =============================================================
   8. Affiliate card + email capture
   ============================================================= */
.affiliate-disclosure {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; color: var(--text-soft); font-style: normal;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: .3rem .7rem; margin-bottom: .9rem;
}
.affiliate-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.25rem; }
.affiliate-card--green { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.affiliate-card--amber { border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
.affiliate-card--red { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.affiliate-program { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin-bottom: .3rem; }
.affiliate-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.affiliate-card p { color: var(--text-soft); font-size: .9rem; margin-bottom: .9rem; }

.email-capture { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.email-capture h3 { font-size: 1rem; margin-bottom: .35rem; }
.email-capture p { color: var(--text-soft); font-size: .86rem; margin-bottom: .8rem; }
.email-capture form { display: flex; flex-wrap: wrap; gap: .6rem; }
.email-capture input[type="email"] {
  flex: 1; min-width: 180px; padding: .65rem .85rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: .9rem;
}
.email-capture input[type="email"]:focus { outline: none; border-color: var(--accent); }
.email-status { font-size: .82rem; margin-top: .6rem; min-height: 1.2em; font-weight: 600; }
.email-status--success { color: #276a3f; }
.email-status--error { color: var(--error); }

/* =============================================================
   9. Fee reference table + verified badge
   ============================================================= */
.fee-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.fee-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.fee-table th, .fee-table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.fee-table th { font-weight: 700; color: var(--text-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.fee-table td:last-child, .fee-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.verified-badge {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .84rem; font-weight: 600; color: var(--text-soft);
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: .5rem 1rem; margin-bottom: 1.5rem;
}
.verified-badge a { font-weight: 700; }

/* =============================================================
   10. Compare table
   ============================================================= */
.compare-table-wrap { overflow-x: auto; margin: 1.5rem 0; }
.compare-table { width: 100%; border-collapse: collapse; min-width: 560px; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.compare-table th, .compare-table td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.compare-table thead th { background: var(--bg-alt); font-weight: 800; }
.compare-table td:not(:first-child), .compare-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.compare-table tbody tr:last-child td { border-bottom: none; font-weight: 800; }
.compare-table tbody tr.row-net td { color: var(--accent-dark); font-weight: 800; }

/* =============================================================
   11. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  border: 2px dashed #cfe3dc; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-weight: 700; letter-spacing: .06em; font-size: .85rem;
  background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin: 2rem auto; max-width: 960px; }
.ad-slot--incontent { min-height: 250px; margin: 2rem auto; max-width: 728px; }

.corner-ad {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 40;
  background: var(--card); border: 2px dashed #cfe3dc; border-radius: var(--radius);
  padding: .7rem 2.2rem .7rem 1rem; max-width: 240px; font-size: .8rem; color: var(--text-soft);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.corner-ad.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.corner-ad strong { display: block; font-weight: 800; color: var(--text); margin-bottom: .15rem; }
.corner-ad-close { position: absolute; top: .4rem; right: .4rem; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-alt); font-size: .85rem; line-height: 1; }

/* =============================================================
   12. Content sections (how it works / use cases / body copy / FAQ)
   ============================================================= */
.content-section { padding-block: 2rem; }
.content-section h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); margin-bottom: 1rem; }
.content-section > p { color: var(--text-soft); max-width: 68ch; margin-bottom: 1rem; }
.content-section > p.center-text { max-width: none; margin-inline: 0; text-align: justify; text-align-last: left; }
.intro-line { font-size: 1.02rem; color: var(--text-soft); max-width: 68ch; margin-bottom: 1.25rem; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.step .step-num {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: #fff; font-weight: 800; margin-bottom: .75rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--text-soft); font-size: .92rem; }

.usecases { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .usecases { grid-template-columns: repeat(5, 1fr); } }
.usecase { background: var(--bg-alt); border-radius: var(--radius); padding: 1rem .75rem; text-align: center; border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; }
.usecase-icon { display: block; margin-bottom: .4rem; color: var(--text); }
.usecase-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.usecase h3 { font-size: .88rem; margin-top: auto; }

.faq { max-width: 68ch; }
.faq details { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--text-soft); margin-top: .6rem; font-size: .94rem; }

/* =============================================================
   13. Related tools / cluster nav
   ============================================================= */
.related-tools-title { font-size: 1rem; margin-bottom: .75rem; color: var(--text-soft); }
.related-tools-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.related-tools-list a {
  display: inline-flex; padding: .5rem 1rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: .88rem;
}
.related-tools-list a:hover { border-color: var(--accent); color: var(--accent-dark); text-decoration: none; }

.hub-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .hub-grid { grid-template-columns: repeat(3, 1fr); } }
.hub-card {
  display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.4rem; transition: transform .15s var(--ease-bounce), box-shadow .2s var(--ease-out);
}
.hub-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px -18px rgba(15,60,50,.35); text-decoration: none; }
.hub-card h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.hub-card p { color: var(--text-soft); font-size: .9rem; margin-bottom: .8rem; }
.hub-card .tool-open-btn { font-weight: 700; color: var(--accent-dark); font-size: .88rem; }

/* =============================================================
   14. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: 1rem; color: var(--text-soft); font-size: .85rem; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* =============================================================
   15. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dropdown-menu, .dropdown-caret, .corner-ad, .btn, .hub-card { transition: none; }
}

/* =============================================================
   16. Mobile safety net — no horizontal scroll at 375px
   ============================================================= */
@media (max-width: 420px) {
  .calc-grid { grid-template-columns: 1fr; }
  .summary-stats { grid-template-columns: repeat(2, 1fr); }
}
