/* ============================================================================
   tool-page-v2.css — the tool-specific layer for the /platform redesign.

   The redesign uses the house aisi design system (css/mv-aisi.css, js/mv-aisi.js,
   mv-particles) so the tool pages match /solutions and the AI Search Intelligence
   page. This file only adds what the aisi system does not provide:

     1. the animations for the audit SVG scene in the hero stage (the static
        parts use the aisi SVG palette classes directly in the markup, so they
        are theme-aware like every other house diagram),
     2. a CSS-counter number on the steps (the build has no loop index),
     3. small chips on the feature / persona cards and the red problem icon.

   Scoped under .tp-v2 (set on the body alongside aisi-body). Tokens / keywords /
   rgba only, no hardcoded hex, so design-lint holds.
   ============================================================================ */

/* ---------- steps: number aisi-step-n via a counter (no loop index) ---------- */
.tp-v2 .aisi-steps { counter-reset: v2step; }
.tp-v2 .aisi-step-n::before { counter-increment: v2step; content: counter(v2step); }

/* ---------- stagger the cards within a section (the build emits no index,
   so recreate the aisi data-d delays by position) ---------- */
.tp-v2 .aisi-map .aisi-rise:nth-child(2),
.tp-v2 .aisi-faq .aisi-q:nth-child(2) { transition-delay: 0.08s; }
.tp-v2 .aisi-map .aisi-rise:nth-child(3),
.tp-v2 .aisi-faq .aisi-q:nth-child(3) { transition-delay: 0.16s; }
.tp-v2 .aisi-map .aisi-rise:nth-child(4),
.tp-v2 .aisi-faq .aisi-q:nth-child(4) { transition-delay: 0.24s; }
.tp-v2 .aisi-map .aisi-rise:nth-child(5) { transition-delay: 0.32s; }
.tp-v2 .aisi-map .aisi-rise:nth-child(6) { transition-delay: 0.40s; }

/* ---------- small chip for the feature tag / persona "who" ---------- */
.tp-v2 .v2-chiplabel {
  display: inline-block;
  align-self: flex-start;
  font: 700 10.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-solid);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  margin-bottom: 10px;
}

/* ---------- the tool-family glyph on the generic hero diagram's chip ---------- */
.tp-v2 .v2-glyph {
  fill: none;
  stroke: white;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- product screenshots (brief section 4: shot 1 is the hero, shot 2
   sits under How it works, shot 3 follows the feature list) ----------
   A real capture of the result view, framed as a glass panel: hairline border,
   the house radius, a soft shadow, nothing cropped. The hero one sits inside an
   aisi stage so it keeps the stage glow. The figures carry the v1 tp-shot
   classes so tests/tool-pages-qa.mjs reads them the same on both templates.
   Tokens / rgba only. */
.tp-v2 .tp-shot {
  margin: 0;
  position: relative;
}
.tp-v2 .tp-shot picture {
  display: block;
}
/* height:auto + the width/height attributes reserve the box before the image
   arrives (no layout shift, on the eager hero or a lazy figure scrolling into
   view). A full-width capture is set to width:100%; a capture narrower than
   the column (one panel of a report) gets tp-shot--narrow from the build and
   keeps its attribute width — no CSS width, so it shows at its own size
   instead of being stretched soft, and max-width caps it on a phone. */
.tp-v2 .tp-shot img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--border));
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}
.tp-v2 .tp-shot:not(.tp-shot--narrow) img {
  width: 100%;
}
.tp-v2 .tp-shot figcaption {
  margin: 12px 4px 0;
  font: 500 13px/1.5 var(--font);
  color: var(--text-3);
  text-align: center;
}
.tp-v2 .v2-shot-stage {
  min-width: 0;
}
.tp-v2 .tp-shot-hero img {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
/* Below the steps and the feature grid, give the capture its own room and a
   comfortable reading width so a 1600px screenshot does not swallow the page. */
.tp-v2 .aisi-steps + .tp-shot,
.tp-v2 .aisi-map + .tp-shot {
  margin-top: clamp(28px, 4vw, 44px);
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- problem cards: a red icon instead of the brand one ---------- */
.tp-v2 .aisi-tool--problem .aisi-tool-ic {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 13%, transparent);
}

/* ---------- closing CTA, as a contained branded panel ----------
   The bare centered close read as flat on the light page; a branded panel
   gives it presence and is consistent in both themes. Tokens / rgba only. */
.tp-v2 .v2-cta-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  text-align: center;
  padding: clamp(48px, 8vh, 84px) clamp(24px, 5vw, 64px);
  border-radius: var(--radius-xl);
  color: white;
  background:
    radial-gradient(90% 130% at 12% 0%, color-mix(in srgb, var(--brand-2) 55%, transparent), transparent 60%),
    radial-gradient(90% 130% at 100% 100%, color-mix(in srgb, var(--brand) 45%, transparent), transparent 55%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 40%, black) 0%, color-mix(in srgb, var(--brand) 15%, black) 58%, black 100%);
  box-shadow: var(--shadow-lg);
}
.tp-v2 .v2-cta-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(100% 100% at 50% 0%, black 15%, transparent 70%);
  opacity: 0.5;
}
.tp-v2 .v2-cta-panel h2 { color: white; margin: 0 auto; max-width: 22ch; }
.tp-v2 .v2-cta-panel .aisi-lead { color: rgba(255, 255, 255, 0.82); margin: 16px auto 0; max-width: 56ch; }
.tp-v2 .v2-cta-panel .aisi-cta-row { justify-content: center; margin-top: 30px; }
.tp-v2 .v2-cta-panel .aisi-btn--primary,
.tp-v2 .v2-cta-panel .aisi-btn--primary:hover { background: white; color: var(--brand-solid); border-color: white; }
.tp-v2 .v2-cta-panel .aisi-btn--ghost { background: rgba(255, 255, 255, 0.12); color: white; border-color: rgba(255, 255, 255, 0.28); }
.tp-v2 .v2-cta-panel .aisi-btn--ghost:hover { background: rgba(255, 255, 255, 0.22); color: white; }
.tp-v2 .v2-cta-note { margin: 18px auto 0; font: 500 13px/1.5 var(--font); color: rgba(255, 255, 255, 0.6); }

/* ---------- FAQ chevron via CSS (the build forbids an svg inside the
   summary, which must hold only the question text to match the schema) ---------- */
.tp-v2 .aisi-q summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-left: 14px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease;
}
.tp-v2 .aisi-q[open] summary::after {
  transform: rotate(-135deg);
  border-color: var(--purple-bright);
}

/* ============================================================================
   The audit scene animations. Static shapes carry aisi-fill-* / aisi-stroke /
   aisi-txt classes in the markup; only motion and status colour live here.
   ============================================================================ */

/* scanning sweep */
.tp-v2 .v2-scan { animation: v2-scan 3.6s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
.tp-v2 .v2-scanline { fill: var(--brand-2); }
.tp-v2 .v2-scanglow { fill: var(--brand-2); opacity: 0.16; }
@keyframes v2-scan {
  0% { transform: translateY(0); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateY(292px); opacity: 0; }
}

/* Core Web Vitals bar colours (pass / warning) */
.tp-v2 .fill-pass { fill: var(--green-bright); }
.tp-v2 .fill-warn { fill: var(--amber); }
.tp-v2 .fill-crit { fill: var(--red); }

/* score gauge */
.tp-v2 .v2-gauge-track { fill: none; stroke-width: 12; }
.tp-v2 .v2-gauge-arc {
  fill: none;
  stroke: url(#v2grad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 339;
  stroke-dashoffset: 339;
  animation: v2-arc 3.6s ease-out infinite;
}
.tp-v2 .v2-g1 { stop-color: var(--brand); }
.tp-v2 .v2-g2 { stop-color: var(--brand-2); }
@keyframes v2-arc {
  0% { stroke-dashoffset: 339; }
  30%, 100% { stroke-dashoffset: 54; }
}
.tp-v2 .v2-score { font: 800 30px var(--font-heading); }

/* core web vitals bars */
.tp-v2 .v2-metric-fl { animation: v2-grow 3.6s ease-out infinite; transform-box: fill-box; transform-origin: left center; }
@keyframes v2-grow {
  0% { transform: scaleX(0); }
  40%, 100% { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .tp-v2 .v2-scan,
  .tp-v2 .v2-gauge-arc,
  .tp-v2 .v2-metric-fl { animation: none !important; }
}

/* ---------- no scroll-reveal on the tool pages ----------
   The shared aisi system fades each section in from dimmed + shifted as it
   scrolls into view (.aisi-rise -> .in). The owner does not want that on the
   /platform tool pages, so neutralise it here: every section is simply visible
   from the start, no fade and no slide. Scoped to .tp-v2, so /solutions and the
   AI Search page keep their reveal. */
.tp-v2 .aisi-rise {
  opacity: 1;
  transform: none;
  transition: none;
}
