/* ============================================================
   Services page, visual rebuild
   Each of the four pillars gets a real, colourful visual:
   creative collage, performance chart, creative wall, email
   cards and a StoreHero-style forecasting dashboard.
   Builds on styles.css / sections.css / pages.css tokens.
   ============================================================ */

/* ---- reveals ---- */
.sv { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .8s var(--ease-out); }
.sv.is-in { opacity: 1; transform: none; }

/* ============================================================
   HERO, aligned copy + creative collage
   ============================================================ */
body[data-page="services"] .subpage-hero .wrap {
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(40px, 5vw, 80px);
}
.svc-hero-copy .sh-lede { margin-top: 26px; max-width: 46ch; }
.svc-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.svc-hero-pills span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.svc-hero-pills span::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  margin-right: 8px;
  vertical-align: middle;
  transform: translateY(-1px);
}

/* hero genie dock of recent creatives */
.svc-hero-visual {
  --accent: var(--brand);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: clamp(280px, 30vw, 400px);
}
.svc-dock-cap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.svc-dock-cap b { color: var(--paper); font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.svc-dock-cap .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(51,153,255,0.6); animation: cpulse 2s infinite; }

/* ============================================================
   GENIE DOCK, shared (hero creatives + retention emails)
   ============================================================ */
.svc-dock {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 56px 6px 10px;
  width: 100%;
  overflow: visible;
}
.svc-dock-item {
  flex: 0 0 auto;
  position: relative;
  --f: 0;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.svc-dock-card {
  width: 74px;
  height: 74px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ink-3);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform-origin: bottom center;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.26s ease;
  will-change: transform;
}
.svc-dock-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.svc-dock-card.tall { width: 86px; height: 224px; }
.svc-dock-card.tall img { height: auto; transform: translateY(0); transition: transform 0.45s ease; will-change: transform; }
.svc-dock-item.peak .svc-dock-card { box-shadow: 0 34px 70px rgba(0, 0, 0, 0.6); }

/* ---- hero scatter collage (overlapping, no grid) ---- */
.svc-hero-visual.scatter { display: block; min-height: clamp(360px, 34vw, 480px); }
.svc-dock.scatter {
  position: relative;
  display: block;
  height: clamp(360px, 34vw, 480px);
  padding: 0;
  overflow: visible;
}
.svc-dock.scatter .svc-dock-item {
  position: absolute;
  left: var(--x);
  top: var(--y);
  --mag: 1; --lift: 0;
  transform: translateY(calc(var(--lift) * 1px)) scale(var(--mag)) rotate(var(--rot, 0deg));
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.svc-dock.scatter .svc-dock-card {
  width: var(--w);
  height: var(--h);
  transform: none;
  transition: box-shadow 0.3s ease;
}

/* ============================================================
   SERVICE BLOCK, header + visual + detail
   ============================================================ */
.svc {
  --accent: var(--brand);
  padding: clamp(60px, 8vw, 110px) 0;
  border-top: 1px solid var(--line);
}
.svc:first-of-type { border-top: 0; }
.svc-top {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
  margin-bottom: clamp(34px, 4vw, 56px);
}
.svc-no {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.svc-no::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent);
}
.svc-top h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 5vw, 76px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--paper);
}
.svc-top h2 em { font-style: italic; color: var(--accent); }
.svc-lede {
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.55;
  color: var(--mute);
}

.svc-main {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: stretch;
}
.svc.reverse .svc-main { grid-template-columns: 0.85fr 1.15fr; }
.svc.reverse .svc-visual { order: 2; }

/* detail column: pillars + outcomes */
.svc-side { display: flex; flex-direction: column; gap: 16px; }
.svc-pillars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1;
}
.svc-pillar {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 20px;
  background: rgba(255, 255, 255, 0.015);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .25s ease, background .25s ease;
}
.svc-pillar:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.svc-pillar .p-no {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.svc-pillar h4 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--paper);
  line-height: 1.15;
}
.svc-pillar p { font-size: 12.5px; color: var(--mute); line-height: 1.5; }

.svc-outcomes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.svc-outcome {
  background: var(--ink);
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.svc-outcome b {
  font-family: var(--display);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
}
.svc-outcome span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  line-height: 1.35;
}

/* ---- visual shell ---- */
.svc-visual {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  min-height: 360px;
}

/* ============================================================
   01 · ACQUISITION, performance dashboard
   ============================================================ */
.dash {
  background:
    radial-gradient(120% 80% at 80% 0%, rgba(51,153,255,0.14), transparent 60%),
    var(--ink-2);
  border: 1px solid var(--line);
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dash-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.dash-delta { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.dash-delta.up { color: #46d39a; }
.dash-chart { position: relative; }
.dash-chart svg { display: block; width: 100%; height: auto; }
.dash-chart .gridline { stroke: rgba(255,255,255,0.06); stroke-width: 1; }
.dash-chart .axis { font-family: var(--mono); font-size: 9px; fill: rgba(255,255,255,0.35); letter-spacing: 0.06em; }
.dash-chart .ln-cm {
  fill: none; stroke: var(--brand); stroke-width: 2.6; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.dash-chart .ln-spend { fill: none; stroke: rgba(242,237,227,0.4); stroke-width: 1.4; stroke-dasharray: 4 5; }
.dash-chart .fill-cm { fill: url(#cmFill); opacity: 0; transition: opacity 1s ease .9s; }
.is-in .dash-chart .ln-cm { transition: stroke-dashoffset 2s var(--ease-out) .2s; stroke-dashoffset: 0; }
.is-in .dash-chart .fill-cm { opacity: 1; }
.dash-legend { display: flex; gap: 18px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); }
.dash-legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--brand); }
.dash-legend .sp i { background: rgba(242,237,227,0.4); height: 1px; }
.dash-platforms { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.dash-chip {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  background: var(--bone);
  border-radius: 10px;
}
.dash-chip img { height: 17px; width: auto; }

/* ============================================================
   02 · CREATIVE, scrolling creative wall
   ============================================================ */
.cwall {
  background: var(--ink-2);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 10px;
  height: 520px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 9%, #000 91%, transparent);
}
.cwall-col { display: flex; flex-direction: column; gap: 10px; will-change: transform; }
.cwall-col.up { animation: scrollUp 46s linear infinite; }
.cwall-col.down { animation: scrollDown 46s linear infinite; }
.cwall-col.slow { animation-duration: 64s; }
.cwall-col img,
.cwall-col video {
  width: 100%;
  border-radius: 10px;
  display: block;
  background: var(--ink-3);
}
.cwall-col video { object-fit: cover; }
.cwall-badge {
  position: absolute;
  left: 16px; bottom: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(10,10,11,0.78);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--paper);
}
.cwall-badge b { color: var(--accent); font-weight: 700; }
.cwall-badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); animation: cpulse 2s infinite; }
@keyframes cpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .cwall-col { animation: none !important; } .cwall { overflow-y: auto; } }

/* ============================================================
   03 · RETENTION, email cards + flows + meter
   ============================================================ */
.ret {
  overflow: visible;
  background:
    radial-gradient(110% 70% at 15% 0%, rgba(232,68,111,0.12), transparent 60%),
    var(--ink-2);
  border: 1px solid var(--line);
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.ret-mails { position: relative; height: 270px; }
.ret-card {
  position: absolute;
  width: 60%;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 24px 50px -18px rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.12);
}
.ret-card .rc-chrome { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-bottom: 1px solid rgba(10,10,11,0.08); }
.ret-card .rc-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: none; }
.ret-card .rc-from { font-size: 10.5px; font-weight: 700; color: #141414; line-height: 1.1; }
.ret-card .rc-sub { font-size: 9px; color: #8a8a8a; line-height: 1.2; max-width: 16ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ret-card .rc-tag { margin-left: auto; font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.1em; color: #b3b3b3; text-transform: uppercase; }
.ret-card .rc-view { height: 188px; overflow: hidden; background: #f4f4f4; }
.ret-card .rc-view img { width: 100%; display: block; }
.ret-card.rc1 { left: 0;   top: 24px; transform: rotate(-3deg); z-index: 2; }
.ret-card.rc2 { right: 0;  top: 0;    transform: rotate(3deg);  z-index: 3; }
.ret-flows { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ret-flow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
}
.ret-arr { color: var(--pink); font-size: 12px; }
.ret-meter-label { font-size: 13px; color: var(--mute); margin-bottom: 9px; }
.ret-meter-label b { font-family: var(--display); font-size: 22px; font-weight: 800; color: var(--pink); letter-spacing: -0.01em; }
.ret-meter-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.ret-meter-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #E8446F, #F0A04B); transition: width 1.6s var(--ease-out) .3s; }
.is-in .ret-meter-fill { width: 38%; }

/* ============================================================
   04 · FORECASTING, StoreHero-style dashboard
   ============================================================ */
.fc {
  background:
    radial-gradient(110% 80% at 85% 100%, rgba(70,211,154,0.12), transparent 60%),
    var(--ink-2);
  border: 1px solid var(--line);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.fc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fc-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; background: rgba(255,255,255,0.015); }
.fc-kpi b { font-family: var(--display); font-size: clamp(20px, 2vw, 26px); font-weight: 800; letter-spacing: -0.02em; color: var(--paper); display: block; line-height: 1; }
.fc-kpi span { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); }
.fc-kpi.pos b { color: #46d39a; }
.fc-panel { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.fc-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.fc-panel-head .t { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.fc-panel-head .v { font-family: var(--mono); font-size: 10px; color: var(--accent); }
/* contribution margin bars */
.fc-bars { display: flex; align-items: flex-end; gap: 8px; height: 92px; }
.fc-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.fc-bar i {
  width: 100%;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #46d39a, color-mix(in srgb, #46d39a 28%, transparent));
  height: 0;
  transition: height 1.2s var(--ease-out);
}
.is-in .fc-bar i { height: var(--h); }
.fc-bar span { font-family: var(--mono); font-size: 8px; color: var(--mute); letter-spacing: 0.04em; }
/* cohort curve */
.fc-curve svg { display: block; width: 100%; height: auto; }
.fc-curve .gridline { stroke: rgba(255,255,255,0.06); stroke-width: 1; }
.fc-curve .ln {
  fill: none; stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}
.fc-curve .area { fill: url(#fcFill); opacity: 0; transition: opacity 1s ease .8s; }
.fc-curve .pb { stroke: rgba(242,237,227,0.3); stroke-width: 1; stroke-dasharray: 3 4; }
.is-in .fc-curve .ln { transition: stroke-dashoffset 2s var(--ease-out) .3s; stroke-dashoffset: 0; }
.is-in .fc-curve .area { opacity: 1; }

/* ============================================================
   The Loop strip (kept, restyled a touch)
   ============================================================ */
.svc-loop {
  border-top: 1px solid var(--line);
  padding: clamp(48px, 6vw, 80px) 0;
}
.svc-loop-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(28px, 4vw, 48px);
  background:
    radial-gradient(90% 140% at 0% 0%, rgba(51,153,255,0.1), transparent 55%),
    var(--ink-2);
}
.svc-loop-ring {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.svc-loop-ring .step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
}
.svc-loop-ring .step .d { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.svc-loop-ring .step:nth-child(2) .d { background: var(--orange); }
.svc-loop-ring .step:nth-child(3) .d { background: var(--pink); }
.svc-loop-ring .step:nth-child(4) .d { background: #46d39a; }
.svc-loop-ring .step .arr { color: var(--mute); margin-left: auto; }
.svc-loop-text h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 2.8vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--paper);
  margin-bottom: 14px;
}
.svc-loop-text h3 em { font-style: italic; color: var(--brand); }
.svc-loop-text p { color: var(--mute); font-size: clamp(15px, 1.1vw, 17px); line-height: 1.55; max-width: 60ch; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  body[data-page="services"] .subpage-hero .wrap { grid-template-columns: 1fr; }
  .svc-hero-visual { min-height: 0; margin-top: 8px; }
  .svc-hero-visual.scatter { min-height: 0; }
  .svc-dock { flex-wrap: wrap; padding-top: 40px; }
  .svc-dock.scatter { position: static; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; height: auto; gap: 12px; padding-top: 24px; }
  .svc-dock.scatter .svc-dock-item { position: static; transform: none; }
  .svc-dock.scatter .svc-dock-card { width: 104px; height: 138px; }
  .svc-top { grid-template-columns: 1fr; gap: 16px; align-items: start; }
  .svc-main, .svc.reverse .svc-main { grid-template-columns: 1fr; }
  .svc.reverse .svc-visual { order: 0; }
  .svc-loop-card { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 560px) {
  .svc-pillars { grid-template-columns: 1fr; }
  .cwall { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Mobile dock effects (touch has no cursor to drive the genie)
   ============================================================ */
@media (max-width: 980px) {
  /* retention emails → swipeable carousel; centred card enlarges and
     auto-scrolls to reveal the full email (see wireRevealCarousel) */
  .svc-dock.ret-dock {
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px max(4px, calc(50% - 86px)) 6px;
  }
  .svc-dock.ret-dock::-webkit-scrollbar { display: none; }
  .svc-dock.ret-dock .svc-dock-item { scroll-snap-align: center; }
  .svc-dock.ret-dock .svc-dock-card.tall {
    width: 172px;
    height: 360px;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
  }
  .svc-dock.ret-dock .svc-dock-item.peak .svc-dock-card.tall {
    transform: scale(1.05);
    box-shadow: 0 34px 70px rgba(0, 0, 0, 0.6);
  }
}

/* hero creative collage → stagger in on scroll, then a gentle perpetual float */
@media (hover: none) and (max-width: 980px) {
  .svc-dock.scatter .svc-dock-item {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.6s ease, transform 0.7s var(--ease-out);
    transition-delay: var(--d, 0ms);
  }
  .svc-dock.scatter .svc-dock-item.in { opacity: 1; transform: none; }
  .svc-dock.scatter .svc-dock-item.in .svc-dock-card { animation: svc-float 5s ease-in-out infinite; }
  .svc-dock.scatter .svc-dock-item:nth-child(2n).in .svc-dock-card { animation-duration: 6.4s; animation-delay: -2s; }
  .svc-dock.scatter .svc-dock-item:nth-child(3n).in .svc-dock-card { animation-duration: 5.6s; animation-delay: -3.2s; }
}
@keyframes svc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) {
  .svc-dock.scatter .svc-dock-item.in .svc-dock-card { animation: none; }
}
