/* =============================================================
   Mobile Story FX
   On mobile (<=720px), replace the dense desktop SVG story
   animations with big, clear, auto-cycling scene cards.
   ============================================================= */

/* By default hidden on desktop */
.mfx-story { display: none; }

@media (max-width: 720px) {
  /* Hide the desktop story viz on mobile */
  .fx-story-viz { display: none !important; }

  /* Show the mobile alternative */
  .mfx-story {
    display: block;
    width: 100%;
    margin: 0 auto;
    border-radius: 14px;
    overflow: hidden;
    background: #0a0a0a;
    border: 1px solid var(--im-border);
    position: relative;
  }

  /* Top chip - service identity */
  .mfx-story__chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--im-border);
    background: #050505;
    font-family: var(--im-font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--im-fg-muted);
    text-transform: uppercase;
  }
  .mfx-story__chip-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--im-primary);
    box-shadow: 0 0 0 4px rgba(240,200,0,0.15);
    animation: mfx-pulse 1.6s ease-in-out infinite;
  }
  @keyframes mfx-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.85); }
    50%      { opacity: 1; transform: scale(1.1); }
  }

  /* Stage indicator strip */
  .mfx-story__stages {
    display: grid;
    grid-template-columns: repeat(var(--mfx-count, 5), 1fr);
    gap: 4px;
    padding: 10px 14px 0;
    background: #050505;
  }
  .mfx-story__stage-dot {
    height: 3px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    transition: background 0.4s ease;
  }
  .mfx-story__stage-dot.is-done {
    background: rgba(240,200,0,0.25);
  }
  .mfx-story__stage-dot.is-active {
    background: var(--im-primary);
    box-shadow: 0 0 6px rgba(240,200,0,0.6);
  }

  /* Scene viewport */
  .mfx-story__viewport {
    position: relative;
    background: #050505;
    aspect-ratio: 4 / 5;
    overflow: hidden;
  }

  .mfx-scene {
    position: absolute;
    inset: 0;
    padding: 28px 22px 26px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2,0.8,0.2,1);
    pointer-events: none;
  }
  .mfx-scene.is-active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mfx-scene__num {
    font-family: var(--im-font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--im-primary);
    font-weight: 600;
    margin-bottom: 14px;
  }
  .mfx-scene__num span:nth-child(2) {
    color: var(--im-fg-dim);
    margin: 0 6px;
  }
  .mfx-scene__num span:nth-child(3) {
    color: var(--im-fg-muted);
  }

  .mfx-scene__title {
    font-family: var(--im-font-display, var(--im-font));
    font-size: 30px;
    line-height: 1.04;
    letter-spacing: -0.025em;
    color: #fff;
    font-weight: 700;
    margin-bottom: 14px;
    text-wrap: balance;
  }
  .mfx-scene__title em {
    font-style: normal;
    color: var(--im-primary);
  }
  .mfx-scene__sub {
    font-size: 15px;
    line-height: 1.45;
    color: var(--im-fg-muted);
    margin-bottom: 18px;
  }

  /* The "viz" — a single big icon/illustration per scene */
  .mfx-scene__viz {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(240,200,0,0.04), rgba(0,0,0,0));
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 18px;
    margin-top: auto;
    position: relative;
    overflow: hidden;
  }
  .mfx-scene__viz svg {
    width: 100%;
    height: 100%;
    max-height: 220px;
  }

  /* Big stat tile inside viz */
  .mfx-stat {
    text-align: center;
  }
  .mfx-stat__num {
    font-family: var(--im-font-mono);
    font-size: 64px;
    font-weight: 700;
    line-height: 1;
    color: var(--im-primary);
    letter-spacing: -0.03em;
  }
  .mfx-stat__num small {
    font-size: 28px;
    color: rgba(240,200,0,0.7);
    margin-left: 4px;
    font-weight: 600;
  }
  .mfx-stat__label {
    font-family: var(--im-font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--im-fg-muted);
    margin-top: 10px;
  }

  /* Big chip rows */
  .mfx-rows {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .mfx-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    font-family: var(--im-font-mono);
    font-size: 12px;
    letter-spacing: 0.05em;
  }
  .mfx-row strong { color: var(--im-primary); font-weight: 600; }
  .mfx-row__lbl { color: var(--im-fg-muted); }
  .mfx-row__val { color: #fff; font-weight: 600; }

  /* Mini map marker for Meta-style geo */
  .mfx-map {
    width: 100%;
    aspect-ratio: 5/3;
    background: #0a0a0a;
    border-radius: 8px;
    position: relative;
    background-image:
      radial-gradient(circle at 30% 40%, rgba(240,200,0,0.12), transparent 50%),
      radial-gradient(circle at 70% 60%, rgba(26,91,255,0.08), transparent 50%);
    overflow: hidden;
  }
  .mfx-map::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
      linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 28px 28px;
  }
  .mfx-map__radius {
    position: absolute;
    top: 50%; left: 50%;
    width: 75%; aspect-ratio: 1/1;
    transform: translate(-50%, -50%);
    border: 1.5px dashed rgba(240,200,0,0.45);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(240,200,0,0.05), transparent 60%);
  }
  .mfx-map__pin {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--im-primary);
    box-shadow: 0 0 0 5px rgba(240,200,0,0.25), 0 0 0 12px rgba(240,200,0,0.1);
  }
  .mfx-map__pin--small {
    width: 6px; height: 6px;
    box-shadow: 0 0 0 2px rgba(240,200,0,0.4);
  }

  /* Phone-style chrome for the "ad" scene */
  .mfx-phone {
    width: 80%;
    max-width: 220px;
    margin: 0 auto;
    background: #0a0a0a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  }
  .mfx-phone__bar {
    height: 4px; width: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 8px;
  }
  .mfx-phone__ad {
    background: #1a1a1a;
    border-radius: 10px;
    overflow: hidden;
    padding: 10px;
  }
  .mfx-phone__ad-img {
    aspect-ratio: 4/3;
    background:
      linear-gradient(135deg, #2a2622 0%, #1a1612 100%);
    border-radius: 6px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
  }
  .mfx-phone__ad-img::after {
    content: "";
    position: absolute; inset: 0;
    background:
      repeating-linear-gradient(135deg,
        rgba(255,255,255,0.03) 0 4px,
        transparent 4px 8px);
  }
  .mfx-phone__ad-img-mark {
    position: absolute;
    bottom: 6px; right: 6px;
    font-family: var(--im-font-mono);
    font-size: 8px;
    color: var(--im-primary);
    letter-spacing: 0.1em;
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 3px;
  }
  .mfx-phone__cta {
    background: var(--im-primary);
    color: #121212;
    text-align: center;
    font-family: var(--im-font-mono);
    font-weight: 700;
    font-size: 11px;
    padding: 7px;
    border-radius: 6px;
    letter-spacing: 0.05em;
  }
  .mfx-phone__title {
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
  }

  /* Inbox / email scene */
  .mfx-inbox {
    width: 100%;
    background: #0a0a0a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
  }
  .mfx-inbox__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .mfx-inbox__row:last-child { border-bottom: none; }
  .mfx-inbox__dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--im-primary);
    flex-shrink: 0;
  }
  .mfx-inbox__from {
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    min-width: 60px;
  }
  .mfx-inbox__subj {
    flex: 1;
    font-size: 11px;
    color: var(--im-fg-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mfx-inbox__row--reply .mfx-inbox__from { color: var(--im-primary); }
  .mfx-inbox__row--reply .mfx-inbox__subj { color: #fff; }

  /* SERP / google list */
  .mfx-serp {
    width: 100%;
    background: #0d0d0d;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.07);
  }
  .mfx-serp__bar {
    background: #1a1a1a;
    border-radius: 18px;
    padding: 7px 12px;
    font-family: var(--im-font-mono);
    font-size: 11px;
    color: #ddd;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mfx-serp__bar svg { flex-shrink: 0; opacity: 0.6; }
  .mfx-serp__result {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .mfx-serp__result:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
  .mfx-serp__tag {
    display: inline-block;
    font-family: var(--im-font-mono);
    font-size: 8px;
    color: var(--im-primary);
    letter-spacing: 0.12em;
    padding: 2px 5px;
    background: rgba(240,200,0,0.1);
    border-radius: 3px;
    margin-bottom: 4px;
    font-weight: 600;
  }
  .mfx-serp__url {
    font-family: var(--im-font-mono);
    font-size: 10px;
    color: var(--im-fg-dim);
    margin-bottom: 3px;
  }
  .mfx-serp__title {
    font-size: 13px;
    color: #fff;
    font-weight: 600;
    line-height: 1.3;
  }
  .mfx-serp__result--win .mfx-serp__title { color: var(--im-primary); }

  /* Polygon-draw mini for SiteIQ */
  .mfx-lot {
    width: 100%;
    aspect-ratio: 5/3;
    background: #0a0a0a;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    background-image:
      radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04), transparent 70%);
  }
  .mfx-lot__svg {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
  }
  .mfx-lot__svg path,
  .mfx-lot__svg polyline {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: mfx-draw 1.4s ease-out forwards;
  }
  @keyframes mfx-draw {
    to { stroke-dashoffset: 0; }
  }

  /* Tighter section padding on mobile */
  .section {
    padding-top: clamp(48px, 10vw, 72px) !important;
    padding-bottom: clamp(48px, 10vw, 72px) !important;
  }
  .fx-story-head { margin-bottom: 24px; }
  .fx-story-title {
    font-size: clamp(28px, 8vw, 36px) !important;
    line-height: 1.05 !important;
  }
  .fx-story-sub {
    font-size: 15px !important;
    line-height: 1.5 !important;
  }
}

/* Even smaller phones — prevent overflow */
@media (max-width: 380px) {
  .mfx-scene__title { font-size: 26px; }
  .mfx-stat__num { font-size: 56px; }
}
