/*
 * Mobile Hacking Lab — Google Ads Landing Pages
 * Animation Layer — ads-animations.css
 * Load after ads-shared.css
 *
 * Design philosophy:
 *   - Performance-only properties: opacity, transform (no layout thrash)
 *   - Purposeful motion — every animation serves a conversion goal
 *   - All animations gated behind prefers-reduced-motion: no-preference
 *   - Reduced-motion block in ads-shared.css already covers the kill-switch
 */

/* ═══════════════════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Badge dot pulse — signals "live" */
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  60%       { box-shadow: 0 0 0 7px transparent; }
}

/* CTA button shimmer sweep */
@keyframes shimmer {
  0%   { background-position: -250% center; }
  100% { background-position: 250% center; }
}

/* Hero grid very-slow drift — creates depth */
@keyframes gridDrift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 48px 48px, 48px 48px; }
}

/* Stat number pop-in */
@keyframes statPop {
  0%   { opacity: 0; transform: scale(0.88) translateY(8px); }
  70%  { transform: scale(1.04) translateY(-1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Scan line across hero — hacker aesthetic */
@keyframes scanLine {
  0%   { top: -2px; opacity: 0.6; }
  70%  { opacity: 0.3; }
  100% { top: 100%; opacity: 0; }
}

/* Glow pulse on the orange accent in headings */
@keyframes accentGlow {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  50%       { text-shadow: 0 0 28px rgba(255, 79, 45, 0.35); }
}

/* Step number count-in */
@keyframes stepIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}


/* ═══════════════════════════════════════════════════════════════
   SCROLL REVEAL SYSTEM
   Managed by ads-animations.js IntersectionObserver
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  /* Base hidden state — applied by JS */
  .anim-hidden {
    opacity: 0;
    transform: translateY(20px);
  }

  /* Revealed state */
  .anim-reveal {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }

  /* Stagger delay helpers — set via data-anim-delay attr by JS */
  .anim-delay-100 { transition-delay: 0.10s !important; }
  .anim-delay-180 { transition-delay: 0.18s !important; }
  .anim-delay-260 { transition-delay: 0.26s !important; }
  .anim-delay-340 { transition-delay: 0.34s !important; }
  .anim-delay-420 { transition-delay: 0.42s !important; }
  .anim-delay-500 { transition-delay: 0.50s !important; }
}


/* ═══════════════════════════════════════════════════════════════
   HERO — above-the-fold entrance (CSS, not scroll-triggered)
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  /* Animated grid background */
  .hero::before {
    animation: gridDrift 28s linear infinite;
  }

  /* Scan line overlay */
  .hero::after {
    /* Keep existing fade gradient, add a scan line via box-shadow trick */
  }

  /* Scan line pseudo-element on hero container */
  .hero {
    isolation: isolate;
  }

  /* Badge entrance + dot pulse */
  .hero .badge {
    animation: fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.08s;
  }

  .hero .badge .dot {
    animation: pulseDot 2.8s ease-in-out infinite;
    animation-delay: 0.6s;
  }

  /* H1 entrance */
  .hero h1 {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.18s;
  }

  /* Subheadline */
  .hero .subheadline,
  .hero p.subheadline {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.32s;
  }

  /* Primary CTA */
  .hero .btn-primary {
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.48s;
  }

  /* Trust signals */
  .hero .hero__trust {
    animation: fadeIn 0.7s ease both;
    animation-delay: 0.68s;
  }
}


/* ═══════════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {
  .navbar {
    animation: fadeIn 0.3s ease both;
  }
}


/* ═══════════════════════════════════════════════════════════════
   STATS BAR — numbers pop when scrolled into view
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {
  .stat__number.stat-animated {
    animation: statPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }

  .stats-bar {
    position: relative;
    overflow: hidden;
  }

  /* Subtle scan line across the stats bar */
  .stats-bar::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 79, 45, 0.4), transparent);
    animation: shimmer 3.5s ease-in-out infinite;
    background-size: 200% 100%;
    pointer-events: none;
  }
}


/* ═══════════════════════════════════════════════════════════════
   FEATURE CARDS — hover lift + staggered reveal
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  .feature-card {
    transition:
      border-color 0.22s ease,
      background   0.22s ease,
      transform    0.22s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow   0.22s ease;
    will-change: transform;
  }

  .feature-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 79, 45, 0.45);
    background: var(--bg-card-2);
    box-shadow:
      0 8px 32px rgba(255, 79, 45, 0.10),
      0 2px 12px rgba(0, 0, 0, 0.45);
  }

  .feature-card__icon {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .feature-card:hover .feature-card__icon {
    transform: scale(1.2) rotate(-3deg);
  }

  /* Left accent bar slides in on hover */
  .feature-card {
    position: relative;
    overflow: hidden;
  }

  .feature-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 0 0 0 var(--radius);
  }

  .feature-card:hover::before {
    transform: scaleY(1);
  }
}


/* ═══════════════════════════════════════════════════════════════
   BUTTONS — shimmer + lift
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  /* Shared shimmer pseudo-element */
  .btn--primary,
  .btn-primary {
    position: relative;
    overflow: hidden;
  }

  .btn--primary::after,
  .btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
      105deg,
      transparent 35%,
      rgba(255, 255, 255, 0.10) 50%,
      transparent 65%
    );
    background-size: 250% 100%;
    border-radius: inherit;
    pointer-events: none;
    animation: shimmer 4s ease-in-out infinite;
    animation-delay: 1.2s;
  }

  .btn--primary:hover,
  .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
      0 0 0 3px rgba(255, 79, 45, 0.25),
      0 4px 18px rgba(255, 79, 45, 0.20);
  }

  .btn--primary:active,
  .btn-primary:active {
    transform: scale(0.98) translateY(0);
  }

  /* Ghost button subtle hover */
  .btn--ghost {
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
  }

  .btn--ghost:hover {
    transform: translateY(-1px);
  }
}


/* ═══════════════════════════════════════════════════════════════
   QUOTE / TESTIMONIAL CARDS
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  .quote-card {
    transition:
      border-color 0.22s ease,
      transform    0.25s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow   0.25s ease;
  }

  .quote-card:hover {
    border-color: rgba(255, 79, 45, 0.35);
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  }

  /* Animated opening quote mark */
  .quote-card__text::before {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .quote-card:hover .quote-card__text::before {
    transform: scale(1.3) translateX(-2px);
  }
}


/* ═══════════════════════════════════════════════════════════════
   FAQ ACCORDION — smooth height + color transitions
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  details > summary {
    transition: color 0.18s ease;
  }

  details[open] > summary {
    color: var(--accent);
  }

  /* Animated + / − */
  details > summary::after {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.18s ease;
  }

  details[open] > summary::after {
    transform: rotate(0deg); /* The content changes to − via shared CSS */
    color: var(--accent);
  }

  /* Paragraph reveal inside details */
  details[open] > p,
  details[open] > div {
    animation: fadeInUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}


/* ═══════════════════════════════════════════════════════════════
   COMPARE TABLE
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  .compare-table tbody tr {
    transition: background 0.15s ease;
  }

  /* Highlight MHL column cells subtly on row hover */
  .compare-table tbody tr:hover td.mhl,
  .compare-table tbody tr:hover td.check.mhl {
    color: #fff;
  }
}


/* ═══════════════════════════════════════════════════════════════
   SECTION HEADERS — scroll reveal handled by JS,
   but headings also get a subtle underline grow on reveal
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  .section-header .headline-lg {
    position: relative;
    display: inline-block;
  }

  .section-header .headline-lg::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.3s;
    border-radius: 1px;
  }

  .section-header.anim-reveal .headline-lg::after {
    width: 48px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   EXAM / HOW-IT-WORKS STEPS — step numbers animate in
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  /* The step number divs (01, 02, 03, 04) */
  [style*="font-size:2rem"][style*="font-weight:800"][style*="color:var(--accent)"],
  div > div:first-child[style*="font-weight:800"] {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}


/* ═══════════════════════════════════════════════════════════════
   CTA SECTION — urgency badge + headline
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  .cta-section {
    position: relative;
    overflow: hidden;
  }

  /* Radial glow behind CTA */
  .cta-section::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 300px;
    background: radial-gradient(ellipse at center, rgba(255, 79, 45, 0.07) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .cta-section .urgency {
    animation: fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .cta-section .headline-lg {
    position: relative;
  }
}


/* ═══════════════════════════════════════════════════════════════
   NAVBAR LOGO — subtle pulse on the "MHL" accent on hover
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  .navbar__logo span {
    display: inline-block;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .navbar__logo:hover span {
    transform: scale(1.08);
  }
}


/* ═══════════════════════════════════════════════════════════════
   PROBLEM/SOLUTION CALLOUT BOX
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {

  /* The accent-left-border solution box */
  .section > .container > div[style*="border-left"] {
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
  }

  .section > .container > div[style*="border-left"]:hover {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  }
}


/* ═══════════════════════════════════════════════════════════════
   TERMINAL WINDOW — decorative hero element
   ═══════════════════════════════════════════════════════════════ */

.terminal-window {
  background: #07080a;
  border: 1px solid #22252d;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 79, 45, 0.07),
    0 32px 72px rgba(0, 0, 0, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
  position: relative;
}

/* macOS-style title bar */
.terminal-window__titlebar {
  background: #13151a;
  border-bottom: 1px solid #22252d;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.terminal-window__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.terminal-window__dot:nth-child(1) { background: #ff5f57; }
.terminal-window__dot:nth-child(2) { background: #febc2e; }
.terminal-window__dot:nth-child(3) { background: #28c840; }

.terminal-window__filename {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  /* visually center — compensate for the 3 dots + gaps on left */
  margin-left: -52px;
}

/* Terminal body */
.terminal-window__body {
  padding: 18px 20px 22px;
  font-family: var(--font-mono);
  font-size: 0.775rem;
  line-height: 1.9;
  color: #b4bcdb;
  overflow-x: auto;
}

/* Syntax token classes */
.t-prompt  { color: var(--accent); font-weight: 600; }
.t-cmd     { color: #e8eaf0; }
.t-path    { color: #82aaff; }
.t-flag    { color: #c3e88d; }
.t-num     { color: #f78c6c; }
.t-crash   { color: #ff5f57; font-weight: 600; }
.t-ok      { color: #28c840; font-weight: 600; }
.t-warn    { color: #febc2e; }
.t-dim     { color: var(--text-dim); }
.t-bold    { color: #fff; font-weight: 600; }
.t-section { color: #c792ea; font-weight: 600; }

/* Blinking block cursor */
@keyframes cursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.t-cursor {
  display: inline-block;
  width: 7px;
  height: 0.85em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: cursorBlink 1.1s step-end infinite;
  margin-left: 1px;
  border-radius: 1px;
}

/* ── Hero two-column split layout ──────────────────────────────── */

/* Override the max-width constraint on hero__inner */
.hero--split .hero__inner {
  max-width: 100% !important;
}

@media (min-width: 960px) {
  .hero--split .hero__inner {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 52px;
    align-items: center;
  }
}

/* Hide the visual column on small screens */
.hero__visual {
  display: none;
}

@media (min-width: 960px) {
  .hero__visual {
    display: block;
  }
}

/* Constrain text column width on desktop so it doesn't spread too wide */
.hero__copy {
  /* Mobile: full width, inherits hero__inner */
}

@media (prefers-reduced-motion: no-preference) {

  /* Terminal entrance — slightly after the text */
  .hero__visual {
    animation: fadeInUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.55s;
  }

  /* Subtle perpetual float */
  @keyframes termFloat {
    0%, 100% { transform: translateY(0px);   }
    50%       { transform: translateY(-7px);  }
  }

  .terminal-window {
    animation: termFloat 7s ease-in-out infinite;
    animation-delay: 2s;
  }

  /* Accent glow pulse on the terminal border */
  @keyframes termGlow {
    0%, 100% { box-shadow: 0 0 0 1px rgba(255,79,45,.07), 0 32px 72px rgba(0,0,0,.6), 0 8px 24px rgba(0,0,0,.45); }
    50%       { box-shadow: 0 0 0 1px rgba(255,79,45,.18), 0 32px 72px rgba(0,0,0,.6), 0 0 32px rgba(255,79,45,.08); }
  }

  .terminal-window {
    animation: termFloat 7s ease-in-out infinite, termGlow 5s ease-in-out infinite;
    animation-delay: 2s, 3s;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR — styled to match theme
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}
