:root {
  --primary: #1a2744;
  --primary-light: #2d4a7a;
  --primary-surface: #e8edf5;
  --background: #f5f6f8;
  --surface: #ffffff;
  --text-primary: #1a1d26;
  --text-secondary: #6b7280;
  --accent: #e87722;
  --accent-pressed: #c4621a;
  --income: #059669;
  --expense: #dc2626;
  --in-progress: #2563eb;
  --paused: #d97706;
  --dm-accent: #c59443;
  --dm-accent-pressed: #a87a32;
  --border: rgba(26, 29, 38, 0.08);
  --topbar-bg: #ffffff;
  --theme-toggle-track: #e8edf5;
  --theme-toggle-knob: #ffffff;
  --theme-toggle-icon: #6b7280;
  --theme-toggle-active: #e87722;
  --code-bg: rgba(26, 39, 68, 0.08);
  --space: 20px;
  --radius: 12px;
  --max: 720px;
}

html[data-theme="dark"] {
  --primary: #e8edf5;
  --primary-light: #93c5fd;
  --primary-surface: #161f28;
  --background: #0b1218;
  --surface: #1a222c;
  --text-primary: #ffffff;
  --text-secondary: #8e97a4;
  --accent: #ff7f00;
  --accent-pressed: #e87722;
  --income: #00a843;
  --expense: #e55039;
  --in-progress: #2563eb;
  --paused: #d97706;
  --dm-accent: #c59443;
  --dm-accent-pressed: #a87a32;
  --border: #2d3748;
  --topbar-bg: #0b1218;
  --theme-toggle-track: #1c252e;
  --theme-toggle-knob: #2a3440;
  --theme-toggle-icon: #8e97a4;
  --theme-toggle-active: #ff7f00;
  --code-bg: rgba(255, 255, 255, 0.08);
}

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

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

body.landing {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
}

/* Do not let SVGs scale to container width (breaks 16px UI icons). */
svg {
  max-width: none;
}

a {
  color: inherit;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

/* —— Top bar (mobile-first) —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--space);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 14px;
  margin-left: auto;
  min-width: 0;
}

.topbar-brand {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-decoration: none;
}

.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 12px;
}

.topbar-nav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

/* —— Hero —— */
.hero {
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(45, 74, 122, 0.55), transparent 55%),
    linear-gradient(165deg, #1a2744 0%, #223552 42%, #2d4a7a 100%);
  color: #fff;
  padding: 40px var(--space) 48px;
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.hero-brand {
  margin: 0 0 16px;
  font-size: clamp(2.5rem, 12vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(1.25rem, 5vw, 1.65rem);
  font-weight: 600;
  line-height: 1.25;
  max-width: 16em;
}

.hero-lead {
  margin: 0 0 24px;
  font-size: 1rem;
  line-height: 1.55;
  opacity: 0.92;
  max-width: 34em;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-pressed);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

/* —— Sections —— */
.section {
  padding: 48px var(--space);
}

.section-head {
  max-width: var(--max);
  margin: 0 auto 28px;
}

.section h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 4.5vw, 1.65rem);
  color: var(--primary);
  letter-spacing: -0.02em;
}

.section-lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 36em;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow-dm {
  color: var(--dm-accent);
}

/* Features */
.feature-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: var(--max);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-list-compact .feature {
  background: transparent;
  border: none;
  padding: 8px 0;
}

.feature-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
}

.feature-dot-blue { background: var(--in-progress); }
.feature-dot-green { background: var(--income); }
.feature-dot-accent { background: var(--accent); }
.feature-dot-primary { background: var(--primary-light); }
.feature-dot-amber { background: var(--paused); }
.feature-dot-dm { background: var(--dm-accent); }

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

.feature p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* Download */
.section-download {
  background: var(--primary-surface);
}

.store-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease;
}

.store-btn:hover,
.store-btn:focus-visible {
  background: var(--primary-light);
}

.store-btn[aria-disabled="true"] {
  opacity: 0.72;
  pointer-events: none;
}

.store-btn-label {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
  letter-spacing: 0.02em;
}

.store-btn-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.store-btn-dm {
  background: var(--dm-accent);
  color: #fff;
}

.store-btn-dm:hover,
.store-btn-dm:focus-visible {
  background: var(--dm-accent-pressed);
}

.store-note {
  max-width: var(--max);
  margin: 14px auto 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* DirMaster block */
.section-dm {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.section-dm .store-grid {
  margin-top: 28px;
}

/* Footer */
.site-footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.85);
  padding: 36px var(--space);
}

.site-footer-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.footer-brand {
  display: block;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 6px;
}

.footer-copy {
  margin: 0 0 12px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.footer-link {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.footer-link:hover {
  color: #fff;
}

/* —— Wider screens —— */
@media (min-width: 640px) {
  .hero {
    padding: 64px var(--space) 72px;
  }

  .hero-cta {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .btn {
    min-width: 180px;
  }

  .store-grid {
    flex-direction: row;
  }

  .store-btn {
    flex: 1;
  }

  .topbar-nav a {
    font-size: 14px;
  }
}

@media (min-width: 900px) {
  :root {
    --space: 28px;
    --max: 880px;
  }

  .hero {
    min-height: 58vh;
    display: flex;
    align-items: flex-end;
  }

  .feature-list:not(.feature-list-compact) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .feature-list:not(.feature-list-compact) .feature:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
