/* ==========================================================================
   CashCrafter — Stylesheet
   Pure CSS, no frameworks. Organized by section for easy reading.
   ==========================================================================
   Sections:
   1. CSS Reset / Base
   2. Theme Variables
   3. Layout Helpers
   4. Navigation
   5. Buttons
   6. Hero
   7. Features
   8. Budget Calculator
   9. Financial Tools
   10. Funding
   11. About
   12. Contact
   13. Footer
   14. Animations
   15. Responsive — Tablet
   16. Responsive — Mobile
   ========================================================================== */

/* ---------- 1. CSS RESET / BASE ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth; /* smooth navigation scrolling */
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px; /* offset so anchor links don't hide under sticky nav */
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img,
canvas {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

/* ---------- 2. THEME VARIABLES ---------- */
:root {
  --bg: #f7f9fc;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f1f5fb;
  --text: #1a2332;
  --text-soft: #5a6a82;
  --text-muted: #8a96a8;
  --border: #e3e9f2;

  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-soft: #dbe8ff;

  --accent: #10b981;
  --accent-soft: #d1fae5;

  --danger: #ef4444;
  --danger-soft: #fee2e2;

  --warning: #f59e0b;
  --warning-soft: #fef3c7;

  --shadow-sm: 0 1px 2px rgba(20, 30, 50, 0.05);
  --shadow-md: 0 4px 16px rgba(20, 30, 50, 0.08);
  --shadow-lg: 0 16px 40px rgba(20, 30, 50, 0.12);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
}

/* ---------- 3. LAYOUT HELPERS ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
}

.section-alt {
  background: var(--surface-soft);
}

.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 56px;
}

.section-header h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin: 12px 0 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-header p {
  color: var(--text-soft);
  font-size: 1.05rem;
  margin: 0;
}

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 4. NAVIGATION ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
}

/* SVG mark (gradient badge with growth chart + dollar) */
.logo-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logo:hover .logo-mark {
  transform: translateY(-1px) rotate(-3deg);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
}

/* Wordmark with two weights for visual contrast */
.logo-text {
  display: inline-flex;
  align-items: baseline;
  letter-spacing: -0.02em;
  font-size: 1.2rem;
}

.logo-text-cash {
  font-weight: 800;
  color: var(--text);
}

.logo-text-crafter {
  font-weight: 500;
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover {
  background: var(--surface-soft);
  color: var(--text);
  border-bottom: 2px solid #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.5), inset 0 0 6px rgba(37, 99, 235, 0.2);
  transition: border-bottom 0.3s ease, box-shadow 0.3s ease;
}

/* Auth area in nav */
.nav-auth {
  display: flex;
  align-items: center;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 8px;
  background: var(--surface-soft);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.user-chip[hidden] { display: none; }

.user-chip-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 50%;
}

.user-chip-name {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-logout {
  background: white;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: background 0.15s ease, color 0.15s ease;
}

.user-chip-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-soft);
}

/* Hamburger toggle (hidden on desktop) */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  padding: 8px;
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* ---------- 5. BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
  text-align: center;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-secondary:hover {
  background: #059669;
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-soft);
  color: var(--danger);
  border-color: var(--danger-soft);
}

.btn-block {
  width: 100%;
}

/* ---------- 6. HERO ---------- */
.hero {
  padding: 80px 0 96px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  overflow: hidden;
}

.hero-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: center;
}

.hero-text h1 {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 16px 0 20px;
  color: var(--text);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-soft);
  margin: 0 0 32px;
  max-width: 520px;
}

.badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.stats-strip {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.stat strong {
  display: block;
  font-size: 1.4rem;
  color: var(--text);
  font-weight: 700;
}

.stat span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.hero-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}

.hero-card-header .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.hero-card-row:last-of-type {
  border-bottom: none;
}

.hero-card-row span {
  color: var(--text-soft);
}

.hero-card-row strong {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
}

.hero-card-row.income strong {
  color: var(--accent);
}
.hero-card-row.expense strong {
  color: var(--danger);
}
.hero-card-row.balance strong {
  color: var(--primary);
}

.hero-bar {
  margin-top: 16px;
  height: 8px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

.hero-bar-fill {
  height: 100%;
  width: 61%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 999px;
  animation: barGrow 1.4s ease forwards;
  transform-origin: left center;
}

@keyframes barGrow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hero-card-note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- 7. FEATURES ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.feature-card:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.5), inset 0 0 6px rgba(37, 99, 235, 0.2);
  border-color: var(--primary-soft);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.15rem;
  margin: 0 0 8px;
  color: var(--text);
  font-weight: 700;
}

.feature-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ---------- 8. BUDGET CALCULATOR ---------- */
.calculator-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  align-items: start;
}

.calculator-forms {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.entry-form,
.calculator-results,
.tool-card,
.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.entry-form h3,
.tool-card h3,
.chart-wrapper h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row label {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 500;
}

.form-row input,
.form-row textarea {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-alt);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-row input.input-error,
.form-row textarea.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.form-row textarea {
  resize: vertical;
  min-height: 110px;
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: -6px 0 12px;
  min-height: 1em;
}

.form-success {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 12px 0 0;
  text-align: center;
  font-weight: 500;
}

.calculator-results {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.summary-card {
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  text-align: center;
  transition: transform 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
}

.summary-card span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.summary-card strong {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.income-card {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #a7f3d0;
}
.income-card strong { color: #047857; }

.expense-card {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: #fecaca;
}
.expense-card strong { color: #b91c1c; }

.balance-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #bfdbfe;
}
.balance-card strong { color: var(--primary-dark); }

/* Animated highlight when a summary value updates */
.summary-card strong.flash {
  animation: flashUpdate 0.6s ease;
}

@keyframes flashUpdate {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Status banner — surplus / deficit / neutral */
.status-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  border: 1px solid var(--border);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.status-banner.is-positive {
  background: var(--accent-soft);
  color: #047857;
  border-color: #a7f3d0;
}

.status-banner.is-negative {
  background: var(--danger-soft);
  color: #b91c1c;
  border-color: #fecaca;
}

.status-banner.is-warning {
  background: var(--warning-soft);
  color: #92400e;
  border-color: #fde68a;
}

/* Chart wrapper */
.chart-wrapper {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.chart-canvas-wrapper {
  position: relative;
  height: 320px;
}

#expenseChart {
  max-height: 320px;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  margin: 0;
}

.lists-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.list-block h4 {
  font-size: 0.9rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  font-weight: 600;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

.entry-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  margin-bottom: 8px;
  font-size: 0.9rem;
  animation: slideInLeft 0.3s ease;
}

.entry-list .item-name {
  color: var(--text);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-list .item-amount {
  font-weight: 700;
  margin: 0 12px;
}

.entry-list .income-amount { color: var(--accent); }
.entry-list .expense-amount { color: var(--danger); }

.entry-list .delete-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.entry-list .delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.list-empty {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 16px;
}

/* ---------- 9. FINANCIAL TOOLS ---------- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.tool-card p {
  color: var(--text-soft);
  margin: 0 0 16px;
  font-size: 0.92rem;
}

.tool-result {
  margin: 16px 0 0;
  padding: 12px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  color: var(--primary-dark);
  font-weight: 600;
  text-align: center;
  font-size: 0.95rem;
  min-height: 1em;
  display: none;
}

.tool-result.visible {
  display: block;
  animation: fadeInUp 0.3s ease;
}

.tool-result.is-error {
  background: var(--danger-soft);
  color: #b91c1c;
}

/* ---------- 10. FUNDING ---------- */
.funding-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.funding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.funding-card:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.5), inset 0 0 6px rgba(37, 99, 235, 0.2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.funding-icon {
  font-size: 1.8rem;
  width: 56px;
  height: 56px;
  background: var(--surface-soft);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.funding-card h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
}

.funding-lead {
  margin: 0 0 12px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.funding-card p {
  color: var(--text-soft);
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.funding-points {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.funding-points li {
  padding: 6px 0;
  border-top: 1px dashed var(--border);
}

.funding-points li:first-child {
  border-top: none;
}

.funding-points strong {
  color: var(--text);
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
  margin-top: auto;
  align-self: flex-start;
}

/* ---------- 11. ABOUT ---------- */
.about-container {
  max-width: 820px;
}

.about-card {
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
}

.about-avatar {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.about-text h3 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  color: var(--text);
  font-weight: 700;
}

.about-role {
  margin: 0 0 14px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.about-text p {
  color: var(--text-soft);
  margin: 0 0 16px;
  font-size: 1rem;
  line-height: 1.7;
}

.about-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 12. CONTACT ---------- */
.contact-container {
  max-width: 640px;
}

.contact-form {
  padding: 32px;
}

/* ---------- 13. FOOTER ---------- */
.footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 48px 0 32px;
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

.footer-brand .logo {
  color: white;
}

.footer-brand .logo-text-cash {
  color: white;
}

.footer-brand .logo-text-crafter {
  color: #93c5fd;
}

.footer-brand p {
  margin: 8px 0 0;
  color: #94a3b8;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 500;
}

.footer-links a:hover {
  color: white;
}

.footer-copy {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
}

/* ---------- AUTH MODAL ---------- */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-modal[hidden] { display: none; }

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.auth-dialog {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: dialogIn 0.25s ease;
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-close:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.auth-header {
  text-align: center;
  margin-bottom: 20px;
}

.auth-header h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
  color: var(--text);
  font-weight: 700;
}

.auth-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.auth-tabs {
  display: flex;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-tab.is-active {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form[hidden] { display: none; }

.auth-note {
  margin: 16px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Login gate inside the calculator */
.login-gate {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  max-width: 540px;
  margin: 0 auto;
}

.login-gate[hidden] { display: none; }

.login-gate-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.login-gate h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
  color: var(--text);
  font-weight: 700;
}

.login-gate p {
  margin: 0 0 20px;
  color: var(--text-soft);
  font-size: 0.95rem;
}

#calculatorGrid[hidden] { display: none; }

/* ---------- 14. ANIMATIONS ---------- */

/* Reveal-on-scroll: starts hidden, fades in when .visible is added by JS */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- 15. RESPONSIVE — TABLET ---------- */
@media (max-width: 960px) {
  .section { padding: 72px 0; }

  .hero { padding: 56px 0 72px; }

  .hero-container {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .features-grid,
  .tools-grid,
  .funding-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .calculator-grid { grid-template-columns: 1fr; }

  .summary-cards { grid-template-columns: 1fr; }

  .about-card {
    flex-direction: column;
    text-align: center;
    padding: 28px;
  }
}

/* ---------- 16. RESPONSIVE — MOBILE ---------- */
@media (max-width: 720px) {
  .menu-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: #ffffff;
    flex-direction: column;
    gap: 0;
    padding: 12px 16px 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links a {
    padding: 14px 12px;
    border-radius: var(--radius-sm);
  }

  .nav-auth {
    margin: 12px 0 0;
    padding: 12px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    width: 100%;
    justify-content: center;
  }

  .auth-dialog {
    padding: 24px;
  }

  .features-grid,
  .tools-grid,
  .funding-grid { grid-template-columns: 1fr; }

  .lists-grid { grid-template-columns: 1fr; }

  .stats-strip { gap: 20px; }

  .section { padding: 56px 0; }

  .calculator-results { padding: 20px; }

  .about-avatar {
    width: 90px;
    height: 90px;
    font-size: 1.8rem;
  }
}
