/* AiFlo · Hero
   Frame 1:13472 — copy block + WhatsApp phone mockup + floating stats + dashboard preview.
   Layered structure:
     .hero            — section
       .hero__bg      — soft fill + bottom fade-to-white overlay
       .hero__inner   — container
         .hero__top   — copy column + phone stage
         .hero__dashboard — large dashboard preview card
*/

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(56px, 7vw, 112px) clamp(72px, 10vw, 140px);
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent 0%, rgba(235,239,245,0) 55%, #ffffff 100%),
    var(--color-bg-soft);
  z-index: -1;
}

.hero__inner { position: relative; }

/* Upper grid — copy column wide enough that the headline fits in 2 lines,
   image column generous so the phone reads at full size with floating
   cards at its edges. */
.hero__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  position: relative;
  z-index: 20;
}

/* Copy column ------------------------------------------------- */
.hero__copy { max-width: 580px; }
.hero__copy .eyebrow { margin-bottom: var(--sp-5); }

/* Headline — sized to ALWAYS fit in 2 lines on any reasonable viewport */
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.4vw + 0.4rem, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--sp-5);
  text-wrap: balance;
}
.hero__title span { display: block; }

/* Body — 3 tight lines */
.hero__lede {
  font-size: clamp(13.5px, 0.7vw + 0.4rem, 15.5px);
  line-height: 1.55;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-6);
  max-width: 480px;
}

/* Phone stage (right column) — now hosts the hand+phone Figma export.
   `overflow: visible` is critical: the floating cards must escape this box
   during the scroll-driven flight into the dashboard slots. */
.hero__stage {
  position: relative;
  width: 100%;
  max-width: 720px;
  justify-self: end;
  overflow: visible;
  z-index: 1;
}

/* Hand+phone image (Figma export, replaces the CSS phone mockup) */
.hero__phone-img {
  position: relative;
  width: 100%;
  display: block;
  z-index: 1;
}
.hero__phone-img img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 30px 60px rgba(28, 0, 88, 0.18));
}

/* Phone mockup ----------------------------------------------- */
.phone {
  position: relative;
  width: min(100%, 393px);
  margin-inline: auto;
  background: var(--wa-bg);
  border-radius: 48px;
  border: 10px solid #1a1a1a;
  box-shadow: var(--shadow-xl), 0 0 0 2px rgba(0,0,0,0.6) inset;
  overflow: hidden;
  aspect-ratio: 393 / 771;
  display: flex;
  flex-direction: column;
  font-family: var(--font-chat);
  z-index: 1;
}
.phone__notch {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 110px; height: 24px;
  background: #0a0a0a;
  border-radius: 14px;
  z-index: 5;
}

/* Phone · status bar */
.phone__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 6px;
  background: var(--wa-green);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding-top: 18px;
}
.phone__status-icons { display: inline-flex; gap: 6px; align-items: center; }
.phone__status-icons img { width: 14px; height: 14px; filter: brightness(0) invert(1); }

/* Phone · WhatsApp header */
.wa__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 10px;
  background: var(--wa-green);
  color: #fff;
}
.wa__back { color: #fff; padding: 4px; display: inline-flex; }
.wa__avatar {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-primary-tint-2) 100%);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.wa__avatar img { width: 22px; height: 22px; object-fit: contain; }
.wa__online {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--wa-online);
  border: 2px solid var(--wa-green);
}
.wa__who { flex: 1; line-height: 1.2; }
.wa__name { font-size: 15px; font-weight: 600; }
.wa__status { font-size: 12px; opacity: 0.85; }
.wa__head-icons { display: inline-flex; gap: 14px; color: #fff; opacity: 0.9; }

/* Phone · chat body */
.wa__body {
  flex: 1;
  background: var(--wa-bg);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.wa__row { display: flex; }
.wa__row--out { justify-content: flex-end; }
.wa__row--in  { justify-content: flex-start; }

.wa__bubble {
  position: relative;
  max-width: 78%;
  padding: 8px 10px 6px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 18px;
  color: var(--color-text);
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13);
}
.wa__bubble--out { background: var(--wa-bubble-out); border-top-right-radius: 2px; }
.wa__bubble--in  { background: var(--wa-bubble-in);  border-top-left-radius: 2px; }
.wa__bubble p { margin-bottom: 4px; }

.wa__meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--wa-meta);
  float: right;
  margin-top: 2px;
}
.wa__meta--in { color: var(--wa-meta); }

/* Inline pill CTAs inside AI bubble */
.wa__pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.wa__pill {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.wa__pill--violet { background: var(--color-primary); color: #fff; }
.wa__pill--violet:hover { color: #fff; opacity: 0.92; }
.wa__pill--green {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

/* Workflow pill */
.wa__workflow {
  align-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid var(--color-success-border);
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.08);
  margin: 4px 0;
}
.wa__workflow-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  display: inline-grid; place-items: center;
  flex-shrink: 0;
}

/* Workflow preview screenshot */
.wa__preview {
  align-self: center;
  width: min(255px, 92%);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #fff;
}
.wa__preview img { width: 100%; height: auto; aspect-ratio: 255 / 217; object-fit: cover; }

/* Phone · input bar */
.wa__input {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #F0F0F0;
}
.wa__input-pill {
  flex: 1;
  background: #fff;
  border-radius: var(--r-pill);
  padding: 9px 14px;
  font-size: 13.5px;
  color: #aaa;
}
.wa__send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--wa-send);
  display: inline-grid; place-items: center;
  flex-shrink: 0;
}
.wa__send img { filter: brightness(0) invert(1); }

/* Floating stat cards — lean & vertical, sit at the edges of the phone
   without covering its WhatsApp content (matches Figma). */
.stat-card {
  position: absolute;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(28, 0, 88, 0.18), 0 8px 16px rgba(0,0,0,0.04);
  padding: 16px 18px;
  width: clamp(160px, 14vw, 200px);
  font-family: var(--font-display);
  z-index: 3;
}
.stat-card__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.stat-card__head h3,
.stat-card__title {
  font-family: 'Nunito', var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
  letter-spacing: -0.015em;
  margin: 0;
}
.stat-card__sub {
  font-size: 10.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
  letter-spacing: -0.005em;
}
.stat-card__badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.stat-card__badge--blue,
.stat-card__badge--violet {
  background: var(--color-primary-tint-2);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 10.5px;
  padding: 3px 8px 3px 5px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.stat-card__badge--blue i,
.stat-card__badge--violet i,
.stat-card__badge--blue [data-lucide],
.stat-card__badge--violet [data-lucide] {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.stat-card__big {
  font-family: 'Nunito', var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--dash-text);
  margin-top: 12px;
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}
.stat-card__pct {
  font-weight: 700;
  color: var(--accent-lime);
  margin-left: 2px;
}
.stat-card__caret {
  width: 14px;
  height: 14px;
  color: var(--accent-lime);
  align-self: center;
  margin-left: 4px;
  margin-bottom: 4px;
  stroke-width: 2.4;
}
.stat-card__caret[data-lucide] { width: 14px; height: 14px; }
.stat-card__pct--lime { color: var(--accent-lime); }

/* HR · day cells (Mon active per Figma) — compact for the lean card */
.stat-card__days {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.stat-card__days li {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 2px 6px;
  border-radius: 8px;
  background: transparent;
  font-size: 10px;
  color: var(--color-text-muted);
  border: 1px solid rgba(36,36,38,0.06);
  letter-spacing: -0.005em;
}
.stat-card__days li b {
  font-family: 'Nunito', var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-top: 1px;
}
.stat-card__days li.is-active {
  background: rgba(36,36,38,0.05);
  border-color: rgba(36,36,38,0.10);
  color: var(--color-text);
}
.stat-card__days li.is-active b {
  color: var(--color-text);
}

/* Stat card placement — over the hand+phone image (Figma proportions) */
/* Edges of the phone — leaner cards don't cover the WhatsApp content */
.stat-card--tickets {
  bottom: 18%;
  left: -8%;
  transform: rotate(-6deg);
  z-index: 2;
}
.stat-card--hr {
  top: 4%;
  right: -10%;
  transform: rotate(6deg);
  z-index: 2;
}

/* Dashboard preview ------------------------------------------ */
.hero__dashboard {
  margin-top: clamp(48px, 8vw, 120px);
  background: #eceff8;
  border-radius: var(--r-3xl);
  padding: clamp(16px, 2.4vw, 32px);
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;            /* sits below .hero__top (z-index:20) so the floating cards always paint on top during flight */
  isolation: isolate;    /* contain inner shadows from interfering with the cards */
}

.dash {
  background: #fff;
  border-radius: calc(var(--r-3xl) - 4px);
  display: grid;
  grid-template-columns: 84px 1fr;
  overflow: hidden;
  font-family: var(--font-ui);
  min-height: 600px;
}

/* Dashboard sidebar */
.dash__side {
  background: #f5f6fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  gap: 24px;
}
.dash__brand img { width: 36px; height: 36px; border-radius: var(--r-sm); }
.dash__nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.dash__nav-item {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: transparent;
  transition: background var(--dur) var(--ease);
}
.dash__nav-item img { width: 22px; height: 22px; }
.dash__nav-item:hover { background: rgba(77,0,242,0.08); }
.dash__nav-item.is-active {
  background: var(--color-primary);
}
.dash__nav-item.is-active img { filter: brightness(0) invert(1); }

.dash__user {
  width: 48px; height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}
.dash__user img { width: 100%; height: 100%; object-fit: cover; }

/* Dashboard main content */
.dash__main {
  padding: clamp(20px, 3vw, 40px);
  display: flex; flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.dash__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dash__h1 {
  font-family: var(--font-ui);
  font-size: clamp(24px, 3vw, 44px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--dash-text);
  line-height: 1.15;
}
.dash__tag {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--dash-muted);
}
.dash__tag b { color: var(--dash-text); font-weight: 700; }
.dash__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
}

.dash__head-actions { display: inline-flex; gap: 8px; align-items: center; }
.dash__pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f5f6fa;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--dash-text);
}
.dash__icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: #f5f6fa;
  display: inline-grid; place-items: center;
}
.dash__icon-btn--primary { background: var(--color-primary); }

/* Dashboard cards row */
.dash__cards {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: clamp(14px, 1.5vw, 20px);
}
.dash-card--lead { grid-column: 1; grid-row: 1 / span 2; }
.dash-slot--tickets { grid-column: 2; grid-row: 1; }
.dash-slot--hr      { grid-column: 3; grid-row: 1; }
.dash-card--wf      { grid-column: 2 / span 2; grid-row: 2; }

/* Empty placeholder slots — invisible boxes the floating cards land in.
   Sized to match the floating cards (post-scale) so the landing aligns. */
.dash-slot {
  border-radius: 22px;
  background: transparent;
  min-height: 200px;
  min-width: 0;
}
/* Keep floating stat-cards above the dashboard during flight.
   z-index works because .hero__top has z-index:20 and .hero__dashboard z-index:1 */
.stat-card {
  z-index: 50;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
}
.dash-card {
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--r-2xl);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Dashboard cards now sit flat (matches Figma) */
.dash-card--lead { transform: none; opacity: 1; }
.dash-card--wf   { transform: none; opacity: 1; }

.dash-card__head {
  display: flex; align-items: center; justify-content: space-between;
}
.dash-card__head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--dash-muted);
  letter-spacing: 0;
}
.dash-card__badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--r-pill);
}
.dash-card__badge--blue { background: var(--color-primary-tint-2); color: var(--color-primary); }
.dash-card__live {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--dash-text);
  padding: 4px 8px;
  border-radius: var(--r-pill);
}

.dash-card__stat {
  font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--dash-text);
}
.dash-card__caption {
  font-size: 12px;
  color: var(--dash-muted);
  margin-top: 2px;
}
.dash-card__chart {
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fafbfd;
}
.dash-card__chart img { width: 100%; height: auto; aspect-ratio: 16 / 6; object-fit: contain; }

.dash-card__substats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}
.dash-card__substats li {
  display: flex; flex-direction: column; gap: 2px;
}
.dash-card__substats span { font-size: 10.5px; color: var(--dash-muted); }
.dash-card__substats b { font-size: 14px; font-weight: 700; color: var(--dash-text); }

/* Workflow distribution segmented bar */
.wf-bar {
  display: flex;
  height: 10px;
  border-radius: var(--r-pill);
  overflow: hidden;
}
.wf-bar span { width: var(--seg); background: var(--c); }

.wf-list { display: flex; flex-direction: column; gap: 8px; }
.wf-list li {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--dash-text);
}
.wf-list li i {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.wf-list li em {
  font-style: normal;
  color: var(--dash-muted);
  font-size: 11.5px;
}
.wf-list li b { font-weight: 700; }

/* Yearly progress strip */
.dash__year {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  height: 14px;
}
.dash__year-cell {
  background: #f0f1f5;
  border-radius: 4px;
}
.dash__year-cell.is-active {
  background: rgba(212, 255, 94, 0.55);
  box-shadow: inset 0 0 0 1px rgba(163, 177, 111, 0.5);
}

/* Responsive ------------------------------------------------- */
@media (max-width: 960px) {
  .hero__top {
    grid-template-columns: 1fr;
    gap: clamp(64px, 10vw, 96px);
  }
  .hero__copy { max-width: none; text-align: left; }
  .hero__stage { max-width: 393px; margin-inline: auto; }

  .stat-card--tickets { left: -4%; }
  .stat-card--hr      { right: -4%; }

  .dash {
    grid-template-columns: 64px 1fr;
  }
  .dash__nav-item { width: 40px; height: 40px; }

  .dash-card--lead, .dash-card--wf { transform: none; opacity: 1; }
  .dash__cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero__stage { max-width: 320px; }
  .phone { border-width: 8px; border-radius: 38px; }
  .phone__notch { width: 90px; height: 18px; }

  .stat-card { width: 140px; padding: 10px 12px; }
  .stat-card__big { font-size: 28px; }
  .stat-card__head h3,
  .stat-card__title { font-size: 15px; }
  .stat-card--tickets { left: -6px; bottom: 4%; }
  .stat-card--hr      { right: -6px; top: 4%; }

  .dash {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    width: 100%;
    overflow: hidden;
  }
  .dash__side, .dash__main { min-width: 0; }
  .dash__side {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 8px;
  }
  .dash__nav { flex-direction: row; flex: 0 1 auto; flex-wrap: wrap; }
  .dash__user { width: 36px; height: 36px; flex-shrink: 0; }

  /* Collapse the 3-col dashboard grid to a single stack on mobile.
     Without this, the explicit grid-column placements on the children
     force the implicit grid to keep 3 columns, overflowing the viewport. */
  .dash__cards {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }
  .dash-card--lead,
  .dash-slot--tickets,
  .dash-slot--hr,
  .dash-card--wf {
    grid-column: 1;
    grid-row: auto;
    min-width: 0;
  }
  .dash-slot { min-height: 0; }
  .dash-slot--tickets,
  .dash-slot--hr { display: none; } /* the floating stat-cards become the visual */

  .dash-card__substats {
    grid-template-columns: repeat(3, 1fr);
  }
  .dash__year { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .dash__header { flex-wrap: wrap; gap: 8px; }

  /* Small headline: keep within 2-3 lines on 375 viewport */
  .hero__title { font-size: clamp(24px, 6.5vw, 32px); }
  .hero__lede  { font-size: 14px; }
  .dash__h1    { font-size: clamp(22px, 6vw, 30px); }
  .dash__head-actions { flex-wrap: wrap; }
}

@media (max-width: 380px) {
  /* Floating stat cards crowd the phone too tightly on the smallest screens —
     hide them so the WhatsApp mockup remains the focal point. */
  .stat-card { display: none; }
  .hero__stage { max-width: 280px; }
}

/* Reduced motion -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .stat-card,
  .dash-card--lead,
  .dash-card--wf { transform: none !important; }
  .reveal { transition: none; }
}
