/* CostPilot — Shared Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  /* --- Light mode colors (synced to dashboard --cp-* light) --- */
  --bg: #f6f7fb;
  --bg-2: #eef2f7;
  --bg-3: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #111827;
  --text-2: #374151;
  --text-3: #64748b;
  --text-4: #94a3b8;

  /* Brand */
  --accent: #4f46e5;
  --accent-2: #4338ca;
  --accent-bg: #eef2ff;
  --accent-border: #c7d2fe;
  --teal: #0D9488;
  --teal-bg: #F0FDFA;
  --teal-border: #99F6E4;

  /* Status */
  --green: #059669;
  --green-bg: #ecfdf5;
  --amber: #f59e0b;
  --amber-bg: #fffbeb;
  --red: #EF4444;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows (synced to dashboard --cp-shadow) */
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow: 0 10px 30px rgb(15 23 42 / 0.06);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 20px 50px rgb(15 23 42 / 0.08);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.12);

  /* Typography — unchanged */
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  /* --- Dark mode colors (synced to dashboard --cp-* dark / .dark-mode) --- */
  --bg: #09090b;
  --bg-2: #0f0f12;
  --bg-3: #141414;
  --surface: #141414;
  --surface-2: #1a1a1a;
  --border: #1f1f1f;
  --border-2: #2d2d2d;
  --text: #f5f5f5;
  --text-2: #d4d4d4;
  --text-3: #a3a3a3;
  --text-4: #737373;

  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --accent-bg: rgb(120 53 15 / 0.2);
  --accent-border: rgb(120 53 15 / 0.4);
  --teal: #2DD4BF;
  --teal-bg: #042F2E;
  --teal-border: #134E4A;

  --green: #10b981;
  --green-bg: rgb(5 150 105 / 0.12);
  --amber: #fbbf24;
  --amber-bg: rgb(120 53 15 / 0.28);

  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 14px 38px rgb(0 0 0 / 0.25);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 22px 70px rgb(0 0 0 / 0.34);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.6);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s, color 0.2s;
  line-height: 1.6;
}

/* ---- NAVBAR ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  min-width: 0;
  min-height: 60px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.nav-logo-img {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

[data-theme="light"] .logo-for-dark { display: none; }
[data-theme="dark"] .logo-for-light { display: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 36px;
  list-style: none;
  min-width: 0;
}

.nav-links a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-links a.active {
  color: var(--text);
}

.nav-github {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.15s;
  background: var(--surface);
}

.nav-github:hover {
  border-color: var(--border-2);
  color: var(--text);
  background: var(--surface-2);
}

.nav-github-stars {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-bg);
  border-radius: 4px;
  padding: 1px 5px;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-theme {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-theme:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
}

.btn-primary:hover {
  background: var(--accent-2);
  box-shadow: 0 4px 14px 0 color-mix(in srgb, var(--accent) 35%, transparent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

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

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-sm {
  font-size: 13px;
  padding: 7px 14px;
}

.btn-lg {
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-lg);
}

.btn-xl {
  font-size: 16px;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
}

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  border: 1px solid;
}

.badge-accent {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.badge-teal {
  color: var(--teal);
  background: var(--teal-bg);
  border-color: var(--teal-border);
}

.badge-green {
  color: var(--green);
  background: var(--green-bg);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}

.badge-amber {
  color: var(--amber);
  background: var(--amber-bg);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.card-hover:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.form-input {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-input::placeholder {
  color: var(--text-4);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.form-hint {
  font-size: 12px;
  color: var(--text-3);
}

.form-error {
  font-size: 12px;
  color: var(--red);
}

/* ---- DIVIDER ---- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-4);
  font-size: 12px;
  font-weight: 500;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- CODE BLOCK ---- */
.code-block {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--text-2);
  overflow-x: auto;
  line-height: 1.7;
}

.code-comment {
  color: var(--text-4);
  font-style: italic;
}

.code-keyword {
  color: var(--accent);
}

.code-string {
  color: var(--teal);
}

.code-number {
  color: var(--amber);
}

.code-fn {
  color: var(--accent-2);
}

/* ---- SCROLL REVEAL ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-delay-1 {
  transition-delay: 0.1s;
}

.reveal-delay-2 {
  transition-delay: 0.2s;
}

.reveal-delay-3 {
  transition-delay: 0.3s;
}

.reveal-delay-4 {
  transition-delay: 0.4s;
}

.reveal-delay-5 {
  transition-delay: 0.5s;
}

/* ---- SECTION ---- */
.section {
  padding: 96px 32px;
}

.section-sm {
  padding: 64px 32px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.container-sm {
  max-width: 800px;
  margin: 0 auto;
}

.container-xs {
  max-width: 560px;
  margin: 0 auto;
}

/* ---- FOOTER ---- */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 32px 32px;
  background: var(--bg-2);
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 48px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 260px;
  margin-bottom: 20px;
}

.footer-col-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}

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

.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-4);
}

.footer-bottom > div {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-bottom a {
  color: var(--text-4);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--text-3);
}

/* Stat mono */
.mono {
  font-family: var(--font-mono);
}

/* ---- NOISE OVERLAY ---- */
.noise-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ---- FAQ ACCORDION ---- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 16px;
  transition: background 0.15s;
}

.faq-question:hover {
  background: var(--surface-2);
}

.faq-question svg {
  flex-shrink: 0;
  transition: transform 0.25s;
  color: var(--text-4);
}

.faq-item.open .faq-question svg {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-answer-inner {
  padding: 0 24px 20px;
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.7;
}

/* Mobile nav toggle */
.nav-mobile-toggle {
  display: none;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.nav-mobile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-mobile-icon-close {
  display: none;
}

.nav-mobile-only {
  display: none !important;
}

.nav-mobile-break {
  margin-top: 8px;
}

.nav-mobile-open .nav-mobile-only {
  display: flex !important;
}

.nav-mobile-open .nav-mobile-toggle {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text);
}

.nav-mobile-open .nav-mobile-icon-menu {
  display: none;
}

.nav-mobile-open .nav-mobile-icon-close {
  display: flex;
}

.nav-mobile-open .nav-links {
  display: flex !important;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  right: 0;
  margin-left: 0;
  padding: 12px;
  gap: 4px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  z-index: 99;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}

.nav-mobile-open .nav-links li {
  width: 100%;
}

.nav-mobile-open .nav-links a {
  display: flex;
  width: 100%;
  padding: 10px 12px;
}

.nav-mobile-open .nav-mobile-only .btn {
  justify-content: center;
}

body.nav-menu-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .hiw-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .nav-github {
    display: none;
  }

  .nav-hide-mobile {
    display: none !important;
  }

  .nav-mobile-toggle {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-grid > :first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 0 20px;
  }

  .section {
    padding: 72px 20px;
  }

  .section-sm {
    padding: 48px 20px;
  }

  .footer {
    padding: 40px 20px 24px;
  }

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

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}
