/* =========================================================
   HERO CONTEXT — Phase 2 Contextual System Layer
   homepage-for-ease — experimental hero enhancement

   Z-index: 6 — above SVG cluster (3), below orbit (15).

   Element types:
     .p2-prompt   Strategic speech / thought prompts
     .p2-dash     Abstract micro dashboard cards
     .p2-device   Device frame silhouettes
     .p2-card     Campaign / media tile shapes

   Motion split:
     Outer .p2-item  — JS-controlled scroll drift + opacity
     Inner .p2-inner — CSS ambient float (transform only)

   All transforms use GPU-composited properties only.
   Respects prefers-reduced-motion.
   ========================================================= */


/* ── Container ─────────────────────────────────────────── */

#p2-context {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}


/* ── Base: all items ────────────────────────────────────── */

.p2-item {
  position: absolute;
  will-change: transform, opacity;
  /* Initial opacity — JS refines this on first rAF frame */
  opacity: 0.70;
}

.p2-item svg {
  display: block;
  width: 100%;
  height: auto;
}

.p2-inner {
  /* CSS controls ambient float; JS sets translate on parent only */
  will-change: transform;
}


/* ── Desktop positions ──────────────────────────────────── */
/* Peripheral zones only — centre safe zone (x 14–86%, y 18–78%)
   is kept free of all contextual elements.                 */

/* Left column — top to bottom */
.p2-c2         { top:  5%;  left: 3.5%;  width:  80px; }   /* campaign card */
.p2-p1         { top: 20%;  left: 0.8%;  width: 186px; }   /* prompt */
.p2-p3         { top: 55%;  left: 0.6%;  width: 192px; }   /* prompt */
.p2-d2         { top: 68%;  left: 1.8%;  width: 112px; }   /* micro dash */
.p2-dv-desktop { top: 80%;  left: 3.5%;  width: 128px; }   /* desktop silhouette */

/* Right column — top to bottom */
.p2-d1         { top:  7%;  right: 1.8%; width: 122px; }   /* micro dash */
.p2-dv-mobile  { top: 22%;  right: 3.8%; width:  52px; }   /* mobile silhouette */
.p2-p2         { top: 40%;  right: 0.8%; width: 198px; }   /* prompt */
.p2-c1         { top: 60%;  right: 2.0%; width: 174px; }   /* prompt */


/* ── Ambient float — CSS keyframe animations ────────────── */
/* Four independent float paths; staggered delays prevent sync.
   Translation range: 2–5px — deliberately non-mechanical.   */

.p2-c2         .p2-inner { animation: p2-float-a 23s ease-in-out infinite; animation-delay: -7s;  }
.p2-p1         .p2-inner { animation: p2-float-b 17s ease-in-out infinite; animation-delay:  0s;  }
.p2-p3         .p2-inner { animation: p2-float-c 15s ease-in-out infinite; animation-delay: -10s; }
.p2-d2         .p2-inner { animation: p2-float-a 19s ease-in-out infinite; animation-delay: -14s; }
.p2-dv-desktop .p2-inner { animation: p2-float-c 22s ease-in-out infinite; animation-delay: -4s;  }

.p2-d1         .p2-inner { animation: p2-float-d 24s ease-in-out infinite; animation-delay: -3s;  }
.p2-dv-mobile  .p2-inner { animation: p2-float-b 26s ease-in-out infinite; animation-delay: -8s;  }
.p2-p2         .p2-inner { animation: p2-float-d 21s ease-in-out infinite; animation-delay: -6s;  }
.p2-c1         .p2-inner { animation: p2-float-a 18s ease-in-out infinite; animation-delay: -11s; }


/* ── Keyframes ──────────────────────────────────────────── */

@keyframes p2-float-a {
  0%,  100% { transform: translate( 0px,  0px); }
  30%       { transform: translate(-3px, -4px); }
  65%       { transform: translate( 2px,  3px); }
}

@keyframes p2-float-b {
  0%,  100% { transform: translate( 0px,  0px); }
  25%       { transform: translate( 4px, -3px); }
  60%       { transform: translate(-2px,  4px); }
  80%       { transform: translate( 3px, -1px); }
}

@keyframes p2-float-c {
  0%,  100% { transform: translate( 0px,  0px); }
  40%       { transform: translate(-4px,  2px); }
  70%       { transform: translate( 3px, -3px); }
}

@keyframes p2-float-d {
  0%,  100% { transform: translate( 0px,  0px); }
  35%       { transform: translate( 3px,  4px); }
  72%       { transform: translate(-3px, -2px); }
  88%       { transform: translate( 1px,  3px); }
}


/* ── Tablet (768–1024px) — reduce density ~30% ──────────── */

@media (max-width: 1024px) and (min-width: 768px) {
  .p2-dv-desktop,
  .p2-c2,
  .p2-p3 {
    display: none;
  }
}


/* ── Mobile (<768px) — maximum 2 elements ───────────────── */
/* Retain micro dashboard (upper-right) + one prompt (lower-right).
   Both are peripheral and never overlap the centred headline.  */

@media (max-width: 767px) {
  .p2-p1,
  .p2-p3,
  .p2-d2,
  .p2-dv-mobile,
  .p2-dv-desktop,
  .p2-c1,
  .p2-c2 {
    display: none;
  }

  /* Reposition visible elements for narrow viewport */
  .p2-d1 {
    top: 10%;
    right: 2%;
    width: 108px;
  }

  .p2-p2 {
    top: auto;
    bottom: 26%;
    right: 2%;
    width: 150px;
  }
}


/* ── Reduced-motion ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .p2-inner {
    animation: none;
  }
}


/* ═══════════════════════════════════════════════════════
   HERO LOCK-UP REFINEMENT
   Typography, hierarchy, and left-anchored layout.
   No motion, scroll, or animation changes.
   ═══════════════════════════════════════════════════════ */

/* Left-anchor the entire text block ─────────────────── */

#hero-text {
  align-items: flex-start;
}

/* Headline container ─────────────────────────────────── */
/* Starts at x: 14% — the defined safe-zone boundary.    */

#hero-headline {
  align-items: flex-start;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 4%;
}

/* Headline lines ─────────────────────────────────────── */
/* Title case, weight 650, tight tracking, left-aligned. */

#hero-headline .hl-main {
  text-align: left;
  text-transform: uppercase;
  font-size: clamp(1.75rem, 5.5vw, 5.1rem);
  font-weight: 650;
  line-height: 1.07;
  letter-spacing: -0.025em;
  margin-bottom: 0;
  color: #0f0f0f;
}

/* "Make Global Marketing" — always one line */
#hero-headline .hl-main:first-child {
  white-space: nowrap;
}

/* Breathing room between headline and subline — tightened to bond as a unit */
#hero-headline .hl-main + .accent {
  margin-top: clamp(1.0rem, 2.8vw, 2.9rem);
}

/* Subline — supporting thesis, sits clearly between headline and logos */

#hero-headline .accent {
  display: block;
  text-align: left;
  font-size: clamp(1.10rem, 1.9vw, 1.42rem);
  font-weight: 700 !important;
  font-variation-settings: "wght" 700 !important;
  font-synthesis: none;
  line-height: 1.38;
  letter-spacing: -0.025em;
  color: #4a4a4a;
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: #4a4a4a;
  max-width: clamp(280px, 36vw, 440px);
}

/* "Scale" — subtle brand-teal accent ────────────────── */

#hero-headline .hl-scale {
  color: #00F1AA;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  font-variation-settings: inherit;
}

/* ── Logo section ────────────────────────────────────── */

.hfe-logos {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 4%;
  margin-top: clamp(2.4rem, 3.2vw, 3.8rem);
}

.hfe-logo-label {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(15, 15, 15, 0.40);
  margin: 0 0 1.2rem 0;
  padding: 0;
}

.hfe-logo-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;       /* single line on desktop */
  align-items: center;
  gap: clamp(1.6rem, 2.2vw, 2.8rem);
}

.hfe-logo-row img {
  height: clamp(14px, 1.5vw, 18px);
  width: auto;
  object-fit: contain;
  opacity: 0.80;
  display: block;
  flex-shrink: 0;
}

/* Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  #hero-headline {
    padding-left: 16px;
    padding-right: 5%;
  }
  #hero-headline .accent { max-width: 88%; }
  .hfe-logos {
    padding-left: 16px;
    padding-right: 5%;
  }
  .hfe-logo-row { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  #hero-headline .hl-main {
    font-size: min(8vw, 2.2rem);
    letter-spacing: -0.02em;
  }
}

@media (max-width: 360px) {
  #hero-headline .hl-main { font-size: min(7.5vw, 1.8rem); }
  #hero-headline .accent  { font-size: 0.95rem; }
}



/* ═══════════════════════════════════════════════════════════
   HERO PHONE FRAME — end-to-end delivery screen
   Dark phone shell, right column (45%). Screen SVG shows
   an animated campaign pipeline with market delivery bars.
   ═══════════════════════════════════════════════════════════ */

/* Hide legacy orbit-layer */
body.hfe-page #orbit-layer {
  display: none;
}

/* Scroll cue — pinned, always visible, teal, perfectly centred */
body.hfe-page .scroll-cue {
  position: absolute;
  bottom: 2.4rem;
  left: 0;
  right: 0;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  color: #00F1AA;
}

/* Phone column ─────────────────────────────────────────────── */
/* Right edge tracks the nav "Get in Touch" CTA right edge.
   Container = 1200px, nav-inner padding-right = 20px.
   Formula: max(20px, (100vw - 1200px)/2 + 20px)
   Phone sits below the fixed nav (top: 68px) so it's never
   overlapped by the navigation.                               */
.hfe-phone-col {
  position: absolute;
  top: 68px;
  right: max(20px, calc((100vw - 1200px) / 2 + 20px));
  bottom: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 8;  /* above hero-complexity-bg (3) and p2-context (6) */
}

/* Phone shell ──────────────────────────────────────────────── */
/* Width driven by viewport width OR constrained by available
   height (whichever is smaller) so the frame always fits
   without touching nav or overflowing the hero.               */
.hfe-phone-frame {
  position: relative;
  width: min(clamp(180px, 22vw, 280px), calc((100vh - 68px - 3rem) * 9 / 14));
  aspect-ratio: 9 / 14;
  /* Frame shell removed — interface floats as a system panel */
  background: transparent;
  border-radius: 0;
  padding: 0;
  overflow: visible;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Screen area — floating system panel */
.hfe-phone-screen {
  flex: 1;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #F6F7F8;
  min-height: 0;
  /* Two-layer depth: contact + ambient, inner edge highlight */
  box-shadow:
    0 2px 8px rgba(0,0,0,0.06),
    0 20px 60px rgba(0,0,0,0.04),
    inset 0 1px 0 rgba(255,255,255,0.26);
}

/* Dynamic Island removed with frame */
.hfe-phone-screen::before {
  display: none;
}

.hfe-screen-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Home bar */
.hfe-phone-homebar {
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,0.22);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* Home bar — removed with frame */
body.hfe-page .hfe-phone-homebar { display: none; }

/* Peripheral ghost UI fragments — removed for system-layer focus */
body.hfe-page #p2-context { display: none; }

/* ── Atmospheric light background ──────────────────────────
   Replaces radar SVG with a pure soft radial atmosphere.
   Brand teal ≤ 5% opacity — felt, not seen.
   ──────────────────────────────────────────────────────────*/

/* Remove structural radar graphics */
body.hfe-page #hero-complexity-bg {
  display: none;
}

/* Hero background + scroll buffer.
   Height: fixed 420px scroll buffer — content fully fades before hero exits.
   Background lives on ::before so opacity: 0.5 doesn't affect content.        */
body.hfe-page #parallax-hero {
  height: calc(100vh + 120px);
  background: none;
  color: #0f0f0f;
}

body.hfe-page #parallax-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 241, 170, 0.3) 64%, #00f1aa 100%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* H pattern now handled by inline SVG #hero-h-bg in HTML */

/* Override explicit white set in styles.css on .hl-main */
body.hfe-page #hero-headline .hl-main {
  color: #0f0f0f;
}

/* Logos — 4-wide grid at tablet (phone visible, space tight) */
@media (max-width: 1023px) {
  body.hfe-page .hfe-logo-row {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    gap: 0.9rem 1.4rem;
    max-width: 380px;
  }
}

/* Stacked layout: all sizes up to full desktop (≤1280px) ──────────────────
   Uses flex spacers (::before / ::after) instead of justify-content:center.
   Spacers are flex:1 so they share available space equally → content is
   visually centred when it fits. When content overflows they collapse to 0,
   so the content always starts at padding-top (68px = nav height) and can
   never slip behind the nav.                                                 */
@media (max-width: 1280px) {
  body.hfe-page .sticky-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 68px;
    padding-bottom: 16px;
  }

  /* Centering spacers — collapse safely when content overflows */
  body.hfe-page .sticky-container::before,
  body.hfe-page .sticky-container::after {
    content: '';
    flex: 1;
  }

  /* Pull text into flow — takes its natural height */
  body.hfe-page #hero-text {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0 16px !important;
  }

  /* Phone col sits immediately below text as a natural flex sibling */
  body.hfe-page .hfe-phone-col {
    position: relative;
    top: auto; right: auto; left: auto; bottom: auto;
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 45px;
  }

  /* Width drives size; aspect-ratio auto-computes height */
  .hfe-phone-frame {
    width: min(70vw, 220px);
    height: auto;
    max-height: none;
  }

  body.hfe-page .scroll-cue { display: none; }
  #hero-headline .hl-main { font-weight: 700; }
  #hero-headline .hl-scale {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    font-variation-settings: inherit;
  }

  /* Logo grid — 1fr prevents overflow on Samsung Internet */
  body.hfe-page .hfe-logo-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 100%;
    gap: 0.5rem 0.7rem;
  }
  body.hfe-page .hfe-logo-row img {
    width: 100%;
    height: auto;
    max-height: 13px;
    flex-shrink: 1;
  }
}

/* Tablet + intermediate (768px–1280px): wider padding and larger phone */
@media (min-width: 768px) and (max-width: 1280px) {
  body.hfe-page #hero-text {
    padding: 0 32px !important;
  }
  body.hfe-page .hfe-phone-col {
    padding-top: 40px;
  }
  body.hfe-page .hfe-phone-frame {
    width: 65vw;
    max-width: 480px;
    height: auto;
    max-height: 55dvh;
  }
}

/* ── Screen animations ──────────────────────────────────────
   Progress bar + market bars: scaleX from 0→1, left anchor.
   Active step: expanding ring + circle glow.
   Badge: opacity pulse.                                       */

.hfe-prog,
.hfe-bar {
  transform-box: fill-box;
  transform-origin: 0 50%;
}

.hfe-prog    { animation: hfe-fill 1.8s cubic-bezier(.22,1,.36,1) 0.6s both; }
.hfe-bar-1   { animation: hfe-fill 1.5s cubic-bezier(.22,1,.36,1) 1.1s both; }
.hfe-bar-2   { animation: hfe-fill 1.5s cubic-bezier(.22,1,.36,1) 1.4s both; }
.hfe-bar-3   { animation: hfe-fill 1.5s cubic-bezier(.22,1,.36,1) 1.7s both; }

@keyframes hfe-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hfe-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: hfe-ring-expand 2.4s ease-out 1.2s infinite;
}

@keyframes hfe-ring-expand {
  0%   { transform: scale(0.70); opacity: 0.75; }
  100% { transform: scale(1.60); opacity: 0;    }
}

.hfe-step-glow {
  animation: hfe-glow 2.4s ease-in-out infinite;
}

@keyframes hfe-glow {
  0%, 100% { fill: #00F1AA; }
  50%       { fill: #3AFFD0; }
}

.hfe-badge {
  animation: hfe-badge 2.4s ease-in-out infinite;
}

@keyframes hfe-badge {
  0%, 100% { fill: rgba(0,241,170,0.18); }
  50%       { fill: rgba(0,241,170,0.38); }
}

/* Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hfe-prog,
  .hfe-bar-1,
  .hfe-bar-2,
  .hfe-bar-3,
  .hfe-ring,
  .hfe-step-glow,
  .hfe-badge  { animation: none; }
}
