/*
 * billance.ai — marketing site
 * Modern dark theme with gradient accents.
 * Hand-written CSS, no framework, no build step.
 */

/* ---------- reset & base ---------------------------------------- */

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

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

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

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

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- design tokens --------------------------------------- */

:root {
  /* Backgrounds */
  --bg:          #0a0e1c;
  --bg-elevated: #0f1527;
  --bg-card:     #141b2f;

  /* Foregrounds */
  --fg:          #e8ebf2;
  --fg-muted:    #8b92a8;
  --fg-dim:      #5a6178;

  /* Borders */
  --border:      rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Accent palette — blue → purple → pink gradient */
  --accent-400: #60a5fa;
  --accent-500: #6366f1;
  --accent-600: #8b5cf6;
  --accent-700: #a855f7;
  --accent-800: #ec4899;

  /* Secondary accent — cyan/teal */
  --cyan:       #22d3ee;
  --emerald:    #10b981;

  /* Signature gradient */
  --grad-accent: linear-gradient(
    135deg,
    #60a5fa 0%,
    #8b5cf6 40%,
    #ec4899 100%
  );
  --grad-accent-soft: linear-gradient(
    135deg,
    rgba(96, 165, 250, 0.15) 0%,
    rgba(139, 92, 246, 0.15) 40%,
    rgba(236, 72, 153, 0.15) 100%
  );

  /* Shadows */
  --shadow-glow:  0 0 80px -20px rgba(139, 92, 246, 0.4);
  --shadow-card:  0 12px 40px -16px rgba(0, 0, 0, 0.6);
  --shadow-lift:  0 24px 60px -24px rgba(99, 102, 241, 0.5);

  /* Layout */
  --container: 1180px;
  --radius: 14px;
  --radius-lg: 22px;
}

/* ---------- ambient background effects -------------------------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 800px 600px at 20% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(ellipse 600px 500px at 85% 10%, rgba(236, 72, 153, 0.12), transparent 60%),
    radial-gradient(ellipse 700px 500px at 50% 100%, rgba(34, 211, 238, 0.08), transparent 60%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
  pointer-events: none;
}

/* ---------- utilities ------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.gradient-text {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--fg-muted);
  backdrop-filter: blur(12px);
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 12px var(--emerald);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.2); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.975rem;
  letter-spacing: -0.01em;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-accent);
  color: white;
  box-shadow: 0 8px 24px -10px rgba(139, 92, 246, 0.6);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -14px rgba(139, 92, 246, 0.8);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-500);
  transform: translateY(-2px);
}

.btn svg { width: 18px; height: 18px; }

/* ---------- header ---------------------------------------------- */

header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(10, 14, 28, 0.72);
  border-bottom: 1px solid var(--border);
}

header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
  line-height: 1;
}

/* Compact header logo: ~67% of the 72px header height. */
.logo-img {
  height: 48px;
  width: auto;
  display: block;
}

.logo-img-footer {
  height: 28px;
  width: auto;
  display: block;
  opacity: 0.85;
}

nav.primary {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
}

nav.primary ul {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.primary a {
  color: var(--fg-muted);
  font-size: 0.925rem;
  font-weight: 500;
  transition: color 0.2s;
}

nav.primary a:hover { color: var(--fg); }

.lang-switcher {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lang-switcher button {
  padding: 0.35rem 0.7rem;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-switcher button.active {
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.mobile-only { display: none; }
@media (max-width: 760px) {
  nav.primary ul { display: none; }
  .mobile-only { display: inline-flex; }
}

/* ---------- hero ------------------------------------------------ */

section.hero {
  padding: clamp(4rem, 10vw, 9rem) 0 clamp(3rem, 6vw, 6rem);
  text-align: center;
  position: relative;
}

section.hero h1 {
  font-size: clamp(2.5rem, 7vw, 5.25rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin: 1.5rem auto 1.5rem;
  max-width: 18ch;
}

section.hero .subtitle {
  max-width: 620px;
  margin: 0 auto 2.5rem;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--fg-muted);
  line-height: 1.6;
}

section.hero .cta-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

section.hero .trust {
  margin-top: 3.5rem;
  font-size: 0.825rem;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

/* ---------- products section ------------------------------------ */

section.products {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.section-header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-header .eyebrow {
  display: inline-block;
  font-size: 0.825rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-400);
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 auto;
  max-width: 20ch;
}

.section-header p {
  max-width: 600px;
  margin: 1.25rem auto 0;
  color: var(--fg-muted);
  font-size: 1.05rem;
}

.product-grid {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-top: 3rem;
}

.product-card {
  position: relative;
  padding: clamp(1.75rem, 3vw, 2.5rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.product-card:hover {
  transform: translateY(-4px);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lift);
}

.product-card:hover::before { opacity: 1; }

.product-card .icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--grad-accent-soft);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.product-card .icon-box svg {
  width: 26px;
  height: 26px;
  stroke: url(#grad-accent);
}

.product-card h3 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.product-card h3 .product-domain {
  font-family: "JetBrains Mono", "SF Mono", Consolas, Menlo, monospace;
  font-size: 0.875rem;
  color: var(--fg-dim);
  font-weight: 500;
}

.product-card p {
  color: var(--fg-muted);
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

.product-card ul.bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  flex-grow: 1;
}

.product-card ul.bullets li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.4rem 0;
  color: var(--fg);
  font-size: 0.9rem;
}

.product-card ul.bullets li::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  background: var(--grad-accent);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
}

.product-card .card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-400);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: auto;
  transition: gap 0.2s, color 0.2s;
}

.product-card .card-cta svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.product-card:hover .card-cta {
  gap: 0.85rem;
  color: var(--accent-700);
}

/* ---------- features section ------------------------------------ */

section.features {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.feature-grid {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.feature-card {
  padding: 2rem 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s;
}

.feature-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.feature-card .feature-icon {
  width: 42px;
  height: 42px;
  background: var(--grad-accent-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.feature-card .feature-icon svg {
  width: 22px;
  height: 22px;
  stroke: url(#grad-accent);
}

.feature-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

.feature-card p {
  margin: 0;
  font-size: 0.925rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

/* ---------- workflow / how it works ----------------------------- */

section.workflow {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.workflow-row {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 3rem;
  position: relative;
}

.workflow-step {
  position: relative;
  padding: 1.75rem 1.5rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  overflow: hidden;
}

.workflow-step::before {
  content: attr(data-step);
  position: absolute;
  top: -18px;
  right: 14px;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  opacity: 0.35;
  pointer-events: none;
  letter-spacing: -0.05em;
}

.workflow-step h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  position: relative;
}

.workflow-step p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* ---------- CTA / contact --------------------------------------- */

section.cta {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.cta-box {
  position: relative;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.75rem, 5vw, 4rem);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}

.cta-box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-accent-soft);
  z-index: -1;
}

.cta-box::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25), transparent 60%);
  z-index: -1;
}

.cta-box h2 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 1rem;
}

.cta-box p {
  font-size: 1.1rem;
  color: var(--fg-muted);
  max-width: 580px;
  margin: 0 auto 2rem;
}

.cta-box .contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: 0.925rem;
  color: var(--fg);
  transition: all 0.2s;
}

.cta-box .contact-email:hover {
  border-color: var(--accent-500);
  transform: translateY(-1px);
}

.cta-box .contact-email svg {
  width: 16px;
  height: 16px;
  color: var(--accent-400);
}

/* ---------- footer ---------------------------------------------- */

footer.site {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  color: var(--fg-dim);
  font-size: 0.875rem;
}

footer.site .container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
}

footer.site .foot-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

footer.site a {
  transition: color 0.2s;
}

footer.site a:hover { color: var(--fg); }

/* ---------- scroll / load animations ---------------------------- */

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

.reveal {
  animation: fadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Stagger reveals for a subtle cascade as the user scrolls through. */
.product-grid .reveal:nth-child(2) { animation-delay: 0.1s; }
.feature-grid .reveal:nth-child(2) { animation-delay: 0.08s; }
.feature-grid .reveal:nth-child(3) { animation-delay: 0.16s; }
.feature-grid .reveal:nth-child(4) { animation-delay: 0.24s; }
.feature-grid .reveal:nth-child(5) { animation-delay: 0.32s; }
.feature-grid .reveal:nth-child(6) { animation-delay: 0.40s; }
.workflow-row .reveal:nth-child(2) { animation-delay: 0.1s; }
.workflow-row .reveal:nth-child(3) { animation-delay: 0.2s; }
.workflow-row .reveal:nth-child(4) { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { animation: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
