/* ============================================================
   BeSeen landing page: hero + "journey" animation.

   One 10s loop shared by every animated element, so the stages stay in step:
     0–18%   1 Your business   name and postcode type in, button pressed
     15–25%  flow 1 → 2
     22–48%  2 We check        website, Google profile, map results tick off
     46–55%  flow 2 → 3
     52–72%  3 Your score      ring fills to 78
     68–77%  flow 3 → 4
     74–94%  4 Your plan       three fixes slide in, the first is ticked off
     92–97%  everything fades; 100% equals 0%, so the loop is seamless
   Only transform, opacity and clip-path are animated (plus the score ring), and
   there's no JavaScript. Reduced motion shows the finished state, still.
   ============================================================ */

@property --j-score {
  syntax: '<integer>';
  inherits: false;
  initial-value: 0;
}

.bs-hero {
  --j-t: 10s;
  --j-teal: #2dd4bf;
  --j-teal-strong: #0d9488;
  background:
    radial-gradient(60% 55% at 50% 0%, rgba(45, 212, 191, 0.14), transparent 70%),
    radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px) 0 0 / 22px 22px,
    #0b1324;
}

/* ── Layout ─────────────────────────────────────────────────── */
.journey {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
}
.j-stage { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.j-caption {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}
.j-caption b {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; margin-right: 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  color: #0b1324; background: var(--j-teal);
}

/* ── Cards ──────────────────────────────────────────────────── */
.j-card {
  position: relative;
  flex: 1;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 18px 40px -18px rgba(0, 0, 0, 0.55);
  color: #0f172a;
  font-size: 12px;
  overflow: hidden;
}
/* Active-stage ring: an overlay whose opacity is animated (cheap to composite). */
.j-card::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 1.5px solid var(--j-teal);
  box-shadow: inset 0 0 0 3px rgba(45, 212, 191, 0.12);
  opacity: 0;
  pointer-events: none;
  animation: var(--j-active) var(--j-t) ease-in-out infinite;
}
.j-s1 .j-card { --j-active: j-active-1; }
.j-s2 .j-card { --j-active: j-active-2; }
.j-s3 .j-card { --j-active: j-active-3; }
.j-s4 .j-card { --j-active: j-active-4; }

.j-top {
  display: flex; align-items: center; gap: 5px;
  padding: 9px 12px;
  border-bottom: 1px solid #eef1f5;
  background: #f8fafc;
}
.j-top i { width: 7px; height: 7px; border-radius: 99px; background: #dde3ea; }
.j-top span {
  margin-left: 6px; flex: 1;
  font-size: 10.5px; color: #64748b;
  background: #eef1f5; border-radius: 99px; padding: 2px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.j-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px 4px;
  font-weight: 600; font-size: 12.5px;
}
.j-head small { font-weight: 500; font-size: 10.5px; color: #64748b; }
.j-body { padding: 10px 14px 14px; }

/* Stage 1: the form */
.j-label { font-size: 10.5px; color: #64748b; margin-bottom: 4px; }
.j-field {
  height: 28px; display: flex; align-items: center;
  padding: 0 9px; margin-bottom: 9px;
  border: 1px solid #dde3ea; border-radius: 7px;
  font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden;
}
.j-type { display: inline-block; clip-path: inset(0 100% 0 0); }
.j-type-1 { animation: j-type-1 var(--j-t) infinite; }
.j-type-2 { animation: j-type-2 var(--j-t) infinite; }
.j-btn {
  margin-top: 4px; height: 30px; display: grid; place-items: center;
  border-radius: 7px; color: #fff; font-weight: 600; font-size: 11.5px;
  background: var(--j-teal-strong);
  animation: j-press var(--j-t) infinite;
}

/* Stage 2: the three checks */
.j-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 7px 0; }
.j-row + .j-row { border-top: 1px solid #f1f4f8; }
.j-ico {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: #ecfdf9; color: var(--j-teal-strong);
}
.j-ico svg { width: 14px; height: 14px; }
.j-name { font-weight: 500; font-size: 11.5px; }
.j-track { height: 4px; margin-top: 5px; border-radius: 99px; background: #eef1f5; overflow: hidden; }
.j-fill { height: 100%; border-radius: inherit; background: var(--j-teal); transform: scaleX(0); transform-origin: left; }
.j-chip {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  transform: scale(0); opacity: 0;
}
.j-chip-warn { color: #b45309; background: #fffbeb; }
.j-chip-ok { color: #0f766e; background: #ccfbf1; }
.j-r1 .j-fill { animation: j-fill-1 var(--j-t) infinite; }
.j-r2 .j-fill { animation: j-fill-2 var(--j-t) infinite; }
.j-r3 .j-fill { animation: j-fill-3 var(--j-t) infinite; }
.j-r1 .j-chip { animation: j-pop-1 var(--j-t) infinite; }
.j-r2 .j-chip { animation: j-pop-2 var(--j-t) infinite; }
.j-r3 .j-chip { animation: j-pop-3 var(--j-t) infinite; }

/* Stage 3: the score ring */
.j-score { display: grid; place-items: center; padding: 6px 14px 14px; }
.j-ring { position: relative; width: 104px; height: 104px; }
.j-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.j-ring circle { fill: none; stroke-width: 9; }
.j-ring .j-ring-bg { stroke: #eef1f5; }
.j-ring .j-ring-fg {
  stroke: var(--j-teal-strong); stroke-linecap: round;
  stroke-dasharray: 226.2; stroke-dashoffset: 226.2;
  animation: j-ring var(--j-t) infinite;
}
.j-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: #0b1324;
  counter-reset: j-score var(--j-score);
  animation: j-count var(--j-t) infinite;
}
.j-num::after { content: counter(j-score); opacity: 0; animation: j-digits var(--j-t) infinite; }
.j-num::before {
  content: '–'; position: absolute; color: #cbd5e1;
  opacity: 0; animation: j-dash var(--j-t) infinite;
}
.j-verdict {
  margin-top: 8px; font-size: 11px; font-weight: 500; color: #475569; text-align: center;
  opacity: 0; animation: j-verdict var(--j-t) infinite;
}
.j-verdict b { color: #0f766e; }

/* Stage 4: the plan. Each item sits in a slot that shows faint placeholder lines
   while it's empty, so the card never looks blank; the item covers them as it arrives. */
.j-slot { position: relative; margin-bottom: 6px; border-radius: 8px; background: #f8fafc; }
.j-slot::before, .j-slot::after {
  content: ''; position: absolute; left: 32px; height: 5px; border-radius: 99px; background: #e8edf3;
}
.j-slot::before { top: 12px; right: 30%; }
.j-slot::after { top: 24px; width: 34px; }
.j-item {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start;
  padding: 7px 8px; border-radius: 8px; background: #f8fafc;
  font-size: 11px; line-height: 1.35;
  opacity: 0; transform: translateX(-8px);
}
.j-i1 { animation: j-item-1 var(--j-t) infinite; }
.j-i2 { animation: j-item-2 var(--j-t) infinite; }
.j-i3 { animation: j-item-3 var(--j-t) infinite; }
.j-box {
  position: relative; width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid #cbd5e1; background: #fff;
}
.j-box svg {
  position: absolute; inset: -1.5px; width: 16px; height: 16px; padding: 2px;
  border-radius: 5px; background: var(--j-teal-strong); color: #fff;
  transform: scale(0); animation: j-check var(--j-t) infinite;
}
.j-tag { display: block; margin-top: 2px; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.j-tag-high { color: #dc2626; }
.j-tag-med { color: #b45309; }
.j-tag-low { color: #0f766e; }

/* ── Connectors: a faint track with dots that carry the flow ───── */
.j-flow {
  --len: 44px; --fx: 1; --fy: 0;
  position: relative; flex: 0 0 var(--len);
  align-self: center; height: 2px; margin-bottom: 34px; /* centred on the cards, not the captions */
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 4px, transparent 4px 8px);
}
.j-flow i {
  position: absolute; left: -3px; top: -3px;
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--j-teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18);
  opacity: 0;
}
.j-f1 i { animation: j-flow-1 var(--j-t) linear infinite; }
.j-f2 i { animation: j-flow-2 var(--j-t) linear infinite; }
.j-f3 i { animation: j-flow-3 var(--j-t) linear infinite; }
.j-flow i:nth-child(2) { animation-delay: 0.22s; }
.j-flow i:nth-child(3) { animation-delay: 0.44s; }

/* ── Keyframes ───────────────────────────────────────────────── */
@keyframes j-active-1 { 0% { opacity: 0 } 2%, 17% { opacity: 1 } 21%, 100% { opacity: 0 } }
@keyframes j-active-2 { 0%, 21% { opacity: 0 } 24%, 46% { opacity: 1 } 50%, 100% { opacity: 0 } }
@keyframes j-active-3 { 0%, 51% { opacity: 0 } 54%, 70% { opacity: 1 } 74%, 100% { opacity: 0 } }
@keyframes j-active-4 { 0%, 73% { opacity: 0 } 76%, 92% { opacity: 1 } 96%, 100% { opacity: 0 } }

@keyframes j-type-1 {
  0%, 2%   { clip-path: inset(0 100% 0 0); opacity: 1; animation-timing-function: steps(13, end); }
  9%, 92%  { clip-path: inset(0 0 0 0); opacity: 1; }
  96%      { clip-path: inset(0 0 0 0); opacity: 0; }
  97%, 100% { clip-path: inset(0 100% 0 0); opacity: 0; }
}
@keyframes j-type-2 {
  0%, 9.5% { clip-path: inset(0 100% 0 0); opacity: 1; animation-timing-function: steps(6, end); }
  13%, 92% { clip-path: inset(0 0 0 0); opacity: 1; }
  96%      { clip-path: inset(0 0 0 0); opacity: 0; }
  97%, 100% { clip-path: inset(0 100% 0 0); opacity: 0; }
}
@keyframes j-press {
  0%, 14%   { transform: scale(1); background: #0d9488; }
  15.2%     { transform: scale(0.95); background: #0f766e; }
  16.5%, 100% { transform: scale(1); background: #0d9488; }
}

@keyframes j-flow-1 {
  0%, 15%   { transform: translate(0, 0); opacity: 0; }
  16%       { opacity: 1; }
  23%       { transform: translate(calc(var(--len) * var(--fx)), calc(var(--len) * var(--fy))); opacity: 1; }
  24%, 100% { transform: translate(calc(var(--len) * var(--fx)), calc(var(--len) * var(--fy))); opacity: 0; }
}
@keyframes j-flow-2 {
  0%, 46%   { transform: translate(0, 0); opacity: 0; }
  47%       { opacity: 1; }
  53%       { transform: translate(calc(var(--len) * var(--fx)), calc(var(--len) * var(--fy))); opacity: 1; }
  54%, 100% { transform: translate(calc(var(--len) * var(--fx)), calc(var(--len) * var(--fy))); opacity: 0; }
}
@keyframes j-flow-3 {
  0%, 68%   { transform: translate(0, 0); opacity: 0; }
  69%       { opacity: 1; }
  75%       { transform: translate(calc(var(--len) * var(--fx)), calc(var(--len) * var(--fy))); opacity: 1; }
  76%, 100% { transform: translate(calc(var(--len) * var(--fx)), calc(var(--len) * var(--fy))); opacity: 0; }
}

@keyframes j-fill-1 { 0%, 24% { transform: scaleX(0); opacity: 1; } 31%, 92% { transform: scaleX(1); opacity: 1; } 96% { transform: scaleX(1); opacity: 0; } 97%, 100% { transform: scaleX(0); opacity: 0; } }
@keyframes j-fill-2 { 0%, 31% { transform: scaleX(0); opacity: 1; } 38%, 92% { transform: scaleX(1); opacity: 1; } 96% { transform: scaleX(1); opacity: 0; } 97%, 100% { transform: scaleX(0); opacity: 0; } }
@keyframes j-fill-3 { 0%, 38% { transform: scaleX(0); opacity: 1; } 45%, 92% { transform: scaleX(1); opacity: 1; } 96% { transform: scaleX(1); opacity: 0; } 97%, 100% { transform: scaleX(0); opacity: 0; } }
@keyframes j-pop-1 { 0%, 31% { transform: scale(0); opacity: 0; } 33% { transform: scale(1.15); opacity: 1; } 34.5%, 92% { transform: scale(1); opacity: 1; } 96%, 100% { transform: scale(1); opacity: 0; } }
@keyframes j-pop-2 { 0%, 38% { transform: scale(0); opacity: 0; } 40% { transform: scale(1.15); opacity: 1; } 41.5%, 92% { transform: scale(1); opacity: 1; } 96%, 100% { transform: scale(1); opacity: 0; } }
@keyframes j-pop-3 { 0%, 45% { transform: scale(0); opacity: 0; } 47% { transform: scale(1.15); opacity: 1; } 48.5%, 92% { transform: scale(1); opacity: 1; } 96%, 100% { transform: scale(1); opacity: 0; } }

@keyframes j-ring {
  0%, 54%   { stroke-dashoffset: 226.2; opacity: 1; animation-timing-function: cubic-bezier(0.3, 0.7, 0.2, 1); }
  66%, 92%  { stroke-dashoffset: 49.8; opacity: 1; }
  96%       { stroke-dashoffset: 49.8; opacity: 0; }
  97%, 100% { stroke-dashoffset: 226.2; opacity: 0; }
}
@keyframes j-count {
  0%, 54%   { --j-score: 0; animation-timing-function: cubic-bezier(0.3, 0.7, 0.2, 1); }
  66%, 96%  { --j-score: 78; }
  97%, 100% { --j-score: 0; }
}
@keyframes j-digits { 0%, 53.5% { opacity: 0; } 54.5%, 92% { opacity: 1; } 96%, 100% { opacity: 0; } }
/* The number only shows while it's counting or done; a soft dash holds its place otherwise. */
@keyframes j-dash { 0%, 53% { opacity: 1; } 54%, 96% { opacity: 0; } 98%, 100% { opacity: 1; } }
@keyframes j-verdict { 0%, 63% { opacity: 0; transform: translateY(4px); } 67%, 92% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: none; } }

@keyframes j-item-1 { 0%, 76% { opacity: 0; transform: translateX(-8px); } 79%, 92% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: none; } }
@keyframes j-item-2 { 0%, 79% { opacity: 0; transform: translateX(-8px); } 82%, 92% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: none; } }
@keyframes j-item-3 { 0%, 82% { opacity: 0; transform: translateX(-8px); } 85%, 92% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: none; } }
@keyframes j-check { 0%, 87% { transform: scale(0); } 89% { transform: scale(1.15); } 90%, 92% { transform: scale(1); } 96%, 100% { transform: scale(1); } }

/* ── Small screens: the same journey, top to bottom ─────────── */
@media (max-width: 959px) {
  .journey { flex-direction: column; align-items: center; max-width: 360px; }
  .j-stage { flex: none; width: 100%; }
  .j-caption { margin-top: 8px; }
  .j-flow {
    --len: 30px; --fx: 0; --fy: 1;
    width: 2px; height: var(--len); flex: 0 0 var(--len); margin: 6px 0;
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0 4px, transparent 4px 8px);
  }
  .j-flow i { left: -3px; top: -4px; }
  .j-score { grid-template-columns: auto 1fr; gap: 14px; justify-items: start; }
  .j-ring { width: 84px; height: 84px; }
  .j-num { font-size: 22px; }
  .j-verdict { text-align: left; margin-top: 0; }
}

/* ── Reduced motion: the finished picture, still ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .bs-hero *, .bs-hero *::after { animation: none !important; }
  .j-type { clip-path: none; }
  .j-fill { transform: scaleX(1); }
  .j-chip, .j-item, .j-verdict { opacity: 1; transform: none; }
  .j-ring .j-ring-fg { stroke-dashoffset: 49.8; }
  .j-num { --j-score: 78; }
  .j-num::before { opacity: 0; }
  .j-num::after { opacity: 1; }
  .j-i1 .j-box svg { transform: scale(1); }
  .j-s4 .j-card::after { opacity: 1; }
}
