/* === Reset & Custom Properties === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #FFCB1B;
  --primary-deep: #F5B800;
  --primary-glow: #FFE066;
  --navy: #02043E;
  --navy-soft: #383954;
  --muted: #6B708A;
  --light: #A6A7BA;
  --surface: #FFFFFF;
  --cream: #FFFDF5;
  --bg: #F4F7FB;
  --outline: #E8E8E8;
  --positive: #137C54;
  --negative: #B23A2D;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 999px;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--navy);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Grain overlay === */
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  pointer-events: none;
  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)' opacity='0.5'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* === Navigation === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 24px;
  transition: background 0.3s, backdrop-filter 0.3s;
  background: var(--surface);
  border-bottom: 1px solid var(--outline);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 20px;
}

.nav-app-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--surface);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: var(--navy);
  transition: transform 0.2s, box-shadow 0.2s;
}

.nav-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 4, 62, 0.3);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--navy);
  color: var(--surface);
  box-shadow: 0 4px 16px rgba(2, 4, 62, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(2, 4, 62, 0.3);
}

.btn-ghost {
  background: rgba(2, 4, 62, 0.06);
  color: var(--navy);
}

.btn-ghost:hover {
  background: rgba(2, 4, 62, 0.12);
}

.btn-dark {
  background: var(--navy);
  color: var(--surface);
  box-shadow: 0 4px 16px rgba(2, 4, 62, 0.15);
}

.btn-dark:hover {
  box-shadow: 0 8px 24px rgba(2, 4, 62, 0.25);
}

.btn-outline-dark {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  padding: 12px 26px;
}

.btn-outline-dark:hover {
  background: var(--navy);
  color: var(--surface);
}

/* === Hero === */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 24px 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--primary);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  animation: none;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--primary);
  top: -10%;
  right: -5%;
  animation-delay: 0s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: #FFE0B2;
  bottom: -5%;
  left: -10%;
  animation-delay: -7s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: #FFF9C4;
  top: 40%;
  left: 30%;
  animation-delay: -14s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto 0 calc((100vw - 1100px) / 2 + 24px);
}

.hero-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  background: rgba(2, 4, 62, 0.08);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
  animation: fadeUp 0.8s ease-out both;
}

.hero-title {
  font-family: var(--font-body);
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
  margin-bottom: 20px;
  animation: fadeUp 0.8s 0.1s ease-out both;
}

.hero-title em {
  font-style: normal;
  color: var(--surface);
}

.hero-subtitle {
  font-size: 18px;
  line-height: 1.7;
  color: var(--navy-soft);
  max-width: 440px;
  margin-bottom: 36px;
  animation: fadeUp 0.8s 0.2s ease-out both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  animation: fadeUp 0.8s 0.3s ease-out both;
}

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

/* === Phone mockup === */
.hero-phone {
  position: absolute;
  right: calc((100vw - 1100px) / 2 + 24px);
  top: 50%;
  transform: translateY(-48%) rotate(2deg);
  z-index: 2;
  animation: phoneFloat 6s ease-in-out infinite, phoneEnter 1s 0.4s ease-out both;
}

@keyframes phoneFloat {
  0%, 100% { transform: translateY(-48%) rotate(2deg); }
  50% { transform: translateY(-51%) rotate(1deg); }
}

@keyframes phoneEnter {
  from {
    opacity: 0;
    transform: translateY(-40%) rotate(4deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(-48%) rotate(2deg) scale(1);
  }
}

.phone-frame {
  width: 280px;
  background: var(--navy);
  border-radius: 36px;
  padding: 12px;
  box-shadow:
    0 24px 80px rgba(2, 4, 62, 0.25),
    0 8px 32px rgba(2, 4, 62, 0.15);
}

.phone-notch {
  width: 120px;
  height: 28px;
  background: var(--navy);
  border-radius: 0 0 16px 16px;
  margin: 0 auto -14px;
  position: relative;
  z-index: 3;
}

.phone-screen {
  background: var(--bg);
  border-radius: 26px;
  padding: 32px 16px 20px;
  min-height: 480px;
  overflow: hidden;
}

.mock-header {
  margin-bottom: 20px;
}

.mock-greeting {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.mock-title {
  display: block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 22px;
  color: var(--navy);
}

.mock-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.mock-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.mock-info {
  flex: 1;
  min-width: 0;
}

.mock-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
}

.mock-detail {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.mock-amount {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.mock-amount.positive { color: var(--positive); }
.mock-amount.negative { color: var(--negative); }
.mock-amount.settled { color: var(--muted); }

.mock-group-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 0 8px 4px;
}

.mock-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.mock-activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #FFF8E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* === Section headers === */
.section-header {
  text-align: center;
  margin-bottom: 56px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section-header.in-view {
  opacity: 1;
  transform: translateY(0);
}

.section-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary-deep);
  margin-bottom: 12px;
}

.section-header h2 {
  font-family: var(--font-body);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
}

.section-header h2 em {
  font-style: normal;
  color: var(--primary-deep);
}

/* === Features section === */
.features {
  padding: 100px 0;
  background: var(--surface);
}

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

.feature-card {
  padding: 32px 28px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  border: 1px solid transparent;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out, border-color 0.3s, box-shadow 0.3s;
}

.feature-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.feature-card:nth-child(2).in-view { transition-delay: 0.08s; }
.feature-card:nth-child(3).in-view { transition-delay: 0.16s; }
.feature-card:nth-child(4).in-view { transition-delay: 0.24s; }
.feature-card:nth-child(5).in-view { transition-delay: 0.32s; }
.feature-card:nth-child(6).in-view { transition-delay: 0.4s; }

.feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(255, 203, 27, 0.12);
}

.feature-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  margin-bottom: 20px;
}

.feature-card h3 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

/* === How it works === */
.how-it-works {
  padding: 100px 0;
  background: var(--cream);
}

.steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
}

.step {
  flex: 1;
  text-align: center;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.step.in-view {
  opacity: 1;
  transform: translateY(0);
}

.step:nth-child(3).in-view { transition-delay: 0.1s; }
.step:nth-child(5).in-view { transition-delay: 0.2s; }

.step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--navy);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.step h3 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}

.step p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.step-divider {
  width: 60px;
  height: 2px;
  background: var(--outline);
  margin-top: 24px;
  flex-shrink: 0;
}

/* === CTA === */
.cta {
  position: relative;
  padding: 100px 0;
  text-align: center;
  overflow: hidden;
}

.cta-bg {
  position: absolute;
  inset: 0;
  background: var(--primary);
}

.blob-4 {
  width: 400px;
  height: 400px;
  background: var(--surface);
  top: -20%;
  left: -10%;
  animation-delay: -3s;
}

.blob-5 {
  width: 350px;
  height: 350px;
  background: #FFE082;
  bottom: -15%;
  right: -5%;
  animation-delay: -10s;
}

.cta .container {
  position: relative;
  z-index: 2;
}

.cta h2 {
  font-family: var(--font-body);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--navy);
  margin-bottom: 16px;
}

.cta p {
  font-size: 18px;
  color: var(--navy-soft);
  margin-bottom: 36px;
}

.cta-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* === Footer === */
.footer {
  padding: 40px 0;
  background: var(--cream);
  border-top: 1px solid var(--outline);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.footer-icon {
  color: var(--light);
}

.footer-links {
  display: flex;
  gap: 24px;
}

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

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

/* ========================================
   Responsive
   ======================================== */

/* Desktop with enough room for phone */
@media (min-width: 1000px) {
  .hero-content {
    margin-left: calc(max((100vw - 1100px) / 2 + 24px, 48px));
    max-width: 500px;
  }

  .hero-phone {
    right: calc(max((100vw - 1100px) / 2 + 24px, 48px));
  }
}

/* Tablet: stack phone below hero text */
@media (max-width: 999px) {
  .hero {
    flex-direction: column;
    justify-content: flex-start;
    min-height: auto;
    padding: 120px 24px 60px;
    gap: 40px;
  }

  .hero-content {
    margin: 0 auto;
    text-align: center;
    max-width: 540px;
  }

  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-phone {
    position: relative;
    right: auto;
    top: auto;
    transform: rotate(0deg);
    margin: 0 auto;
    animation: phoneFloatMobile 6s ease-in-out infinite, phoneEnterMobile 1s 0.4s ease-out both;
  }

  @keyframes phoneFloatMobile {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(0deg); }
  }

  @keyframes phoneEnterMobile {
    from {
      opacity: 0;
      transform: translateY(30px) scale(0.95);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

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

  .steps {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .step {
    padding: 24px;
    max-width: 400px;
  }

  .step-divider {
    width: 2px;
    height: 32px;
    margin: 0;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .hero {
    padding: 100px 20px 40px;
    gap: 32px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 5px 14px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .phone-frame {
    width: 240px;
  }

  .phone-screen {
    min-height: 400px;
    padding: 28px 12px 16px;
  }

  .mock-title {
    font-size: 18px;
  }

  .features {
    padding: 64px 0;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .feature-card {
    padding: 24px 20px;
  }

  .how-it-works {
    padding: 64px 0;
  }

  .cta {
    padding: 64px 0;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .cta-buttons .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .section-header {
    margin-bottom: 40px;
  }
}
