/* ================================================
   FinanceUtils – Shared Stylesheet
   Palette: $100 bill (Series 2013) inspired
   ================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:         #cbd8de;
  --card-bg:    #f5f8fa;
  --accent:     #85bb65;
  --accent-dk:  #6fa354;
  --header-bg:  #2c3e50;
  --text:       #2d3436;
  --text-muted: #636e72;
  --border:     #d0dde4;
  --shadow:     0 2px 14px rgba(0, 0, 0, 0.09);
  --radius:     10px;
  --font:       'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────── */
header {
  background: var(--header-bg);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.logo .accent { color: var(--accent); }

nav {
  display: flex;
  gap: 1.75rem;
}

nav a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.18s;
}

nav a:hover,
nav a.active { color: var(--accent); }

/* ── Footer ──────────────────────────────────── */
footer {
  background: var(--header-bg);
  color: rgba(255, 255, 255, 0.58);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 0.875rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: color 0.18s;
}

.footer-links a:hover { color: var(--accent); }

.footer-copy { margin-bottom: 0.375rem; }

/* ── Main layout ─────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* ── Page header ─────────────────────────────── */
.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
}

/* ── Card ────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.75rem;
}

/* ── Tool cards grid (home) ──────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.tool-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  border-left: 4px solid var(--accent);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
}

.tool-card .tool-icon {
  font-size: 2rem;
  margin-bottom: 0.875rem;
  display: block;
}

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tool-card .link-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── About section (home) ────────────────────── */
.about-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.about-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.about-section p {
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.75;
}

.about-section p:last-child { margin-bottom: 0; }

/* ── Calculator forms ────────────────────────── */
.calc-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(133, 187, 101, 0.18);
}

.form-group input::placeholder { color: #b2bec3; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.7rem 2.25rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
  display: inline-block;
}

.btn:hover  { background: var(--accent-dk); }
.btn:active { transform: scale(0.97); }

/* ── Result block ────────────────────────────── */
.result-block {
  display: none;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.result-block.visible { display: block; }

.result-text {
  background: rgba(133, 187, 101, 0.1);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.result-main {
  font-size: 1.13rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.result-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
}

@keyframes result-flash {
  0%   { background: rgba(133, 187, 101, 0.10); }
  28%  { background: rgba(133, 187, 101, 0.55); }
  100% { background: rgba(133, 187, 101, 0.10); }
}

.result-text.flashing { animation: result-flash 1.15s ease-out; }

/* ── Chart containers ────────────────────────── */
.chart-wrap {
  position: relative;
  height: 280px;
}

/* Historical bar chart: scrollable on mobile */
.chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 6px;
}

.chart-scroll-inner {
  min-width: 1150px;
  height: 320px;
  position: relative;
}

/* ── SEO / content sections ──────────────────── */
.seo-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
}

.seo-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  color: var(--text);
}

.seo-card p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.75;
  font-size: 0.95rem;
}

.seo-card p:last-child { margin-bottom: 0; }

/* Decade table */
.decade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.decade-table th {
  background: var(--header-bg);
  color: #fff;
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.84rem;
}

.decade-table th:last-child { text-align: right; }

.decade-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.decade-table td:last-child {
  text-align: right;
  font-weight: 600;
}

.decade-table tr:last-child td { border-bottom: none; }
.decade-table tr:nth-child(even) td { background: rgba(0, 0, 0, 0.025); }

/* ── Static content pages ────────────────────── */
.content-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem;
}

.content-card h1 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.content-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.75rem 0 0.625rem;
  color: var(--text);
}

.content-card p {
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.75;
}

.content-card p:last-child { margin-bottom: 0; }

.content-card ul {
  color: var(--text-muted);
  padding-left: 1.5rem;
  margin-bottom: 0.875rem;
}

.content-card ul li {
  margin-bottom: 0.375rem;
  line-height: 1.7;
}

.content-card a {
  color: var(--accent);
  text-decoration: none;
}

.content-card a:hover { text-decoration: underline; }

/* Contact form */
.contact-form { margin-top: 1.5rem; }

.contact-form .cf-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.contact-form label {
  font-size: 0.84rem;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form textarea {
  resize: vertical;
  min-height: 130px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(133, 187, 101, 0.18);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
  header {
    padding: 0 1rem;
    height: 56px;
  }

  nav { gap: 1rem; }
  nav a { font-size: 0.8rem; }

  main { padding: 1.5rem 1rem; }

  .page-header h1  { font-size: 1.55rem; }
  .page-header .subtitle { font-size: 0.97rem; }

  .form-row { grid-template-columns: 1fr; }

  .card,
  .seo-card,
  .content-card { padding: 1.25rem; }

  .btn { width: 100%; text-align: center; }
}
