/* ==========================================================================
   Session K: Tools listing page premium upgrade, Commit 2 of 3.
   --------------------------------------------------------------------------
   This commit replaces the entire CARD ruleset and adds 9 cinematic SVG
   visual animations. Page atmosphere + header + section headers + section
   dividers from Commit 1 stay intact (sections labeled below for clarity).
   The spotlight hero (above Lab section) lands in Commit 3.

   What changes from Commit 1:
     - Card shell: gradient bg (--bg2-light → --bg2), 320px min-height,
       cursor-following sheen via ::before pseudo + CSS custom props
     - Card visual: appears on ALL 9 cards (was 3 flagships in Session J);
       height 60px → 90px; container background gets its own subtle wash
     - Icon: webfont → inline SVG, wrapped in 28x28 rounded chip with
       faint dark-wash background; SVG 16x16 stroke-width 1.8
     - Status pill: leading colored dot via ::before; OPEN hidden by
       default (display:none); BETA + EARLY keep their muted colors
     - Card name: 22px → 24px
     - CTA: tool-specific verb (Enter the bench, Write code, Start a chat,
       Start plotting, Solve an equation, Run a demo, Begin review, View
       progress, Browse saved); arrow span animates +4px on hover; new
       ::after underline fills in left-to-right on hover
     - .tools-v2-card--flagship modifier class dropped (all cards equal)
     - 9 cinematic visual animations added at the bottom (per spec)

   Local tokens (scoped to .tools-v2-page, defined in Commit 1):
     --bg2-light  #F8F3E6     top of card gradients
     --indigo     #2D3A6B     code keyword + dashed reference line
     --gold       muted gold  EARLY status pill
     --font-mono  system mono Code card visual

   prefers-reduced-motion is honored: all keyframe animations + transitions
   inside .tools-v2-page are disabled; typing dots fall back to 0.6 opacity.
   ========================================================================== */

/* ==========================================================================
   COMMIT 1, Page atmosphere + header + section headers + dividers (intact)
   ========================================================================== */

.tools-v2-page {
  /* Local design tokens. Available to all descendants via CSS cascade. */
  --bg2-light: #F8F3E6;
  --indigo: #2D3A6B;
  --gold: rgba(180, 130, 20, 0.85);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 1400px 800px at 50% -200px, rgba(226, 105, 27, 0.04), transparent 70%),
    radial-gradient(ellipse 1200px 600px at 50% 100%, rgba(45, 58, 107, 0.025), transparent 70%),
    var(--bg);
  padding: 64px 24px 96px;
}

.tools-v2-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.27 0 0 0 0 0.22 0 0 0 0.03 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

.tools-v2-page > * {
  position: relative;
  z-index: 2;
}

.tools-v2-header {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 0 64px;
  text-align: center;
}

.tools-v2-header-ambient {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 30px;
  opacity: 0.4;
  pointer-events: none;
}

.tools-v2-header-ambient svg {
  display: block;
  width: 100%;
  height: 100%;
}

.tools-v2-header-ambient svg path {
  animation: gentle-oscillate 5s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.tools-v2-eyebrow {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tx2);
  margin: 0 0 28px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.tools-v2-eyebrow::before,
.tools-v2-eyebrow::after {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--bdr);
}

.tools-v2-title {
  font-family: var(--font-serif);
  font-size: 88px;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--tx);
  margin: 0 0 22px;
}

.tools-v2-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.5;
  color: var(--tx1);
  max-width: 580px;
  margin: 0 auto;
}

.tools-v2-header-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 48px auto 0;
  max-width: 320px;
}

.tools-v2-header-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--bdr), transparent);
}

.tools-v2-header-divider-glyph {
  width: 80px;
  height: 14px;
  flex-shrink: 0;
}

.tools-v2-header-divider-glyph path {
  animation: gentle-oscillate 6s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes gentle-oscillate {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50%      { transform: translateY(-2px) scaleY(0.94); }
}

.tools-v2-section {
  max-width: 1100px;
  margin: 56px auto 0;
}

.tools-v2-section:first-of-type {
  margin-top: 0;
}

.tools-v2-section-header {
  margin-bottom: 36px;
}

.tools-v2-section-eyebrow {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tx2);
  margin: 0 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.tools-v2-section-eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ac);
  flex-shrink: 0;
}

.tools-v2-section-title {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--tx);
  margin: 0 0 12px;
}

.tools-v2-section-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--tx1);
  margin: 0;
  max-width: 520px;
}

.tools-v2-section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 56px auto;
  max-width: 280px;
}

.tools-v2-section-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--bdr), transparent);
}

.tools-v2-section-divider-glyph {
  width: 38px;
  height: 11px;
  flex-shrink: 0;
}

.tools-v2-section-divider-glyph path {
  animation: gentle-oscillate 7s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

/* ==========================================================================
   COMMIT 2, Card system upgrade (gradient bg, sheen, chip, dots, CTAs)
   ========================================================================== */

.tools-v2-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* Mathematics 4-card grid: 2-col with constrained max-width so flagships pair. */
.tools-v2-section[data-section="mathematics"] .tools-v2-card-grid {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   Card shell: gradient background, soft resting shadow, lifts on hover,
   cursor-following sheen via ::before pseudo + JS-driven CSS variables.
   -------------------------------------------------------------------------- */
.tools-v2-card {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 26px;
  background: linear-gradient(180deg, var(--bg2-light) 0%, var(--bg2) 100%);
  border: 0.5px solid var(--bdr);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 320ms,
              box-shadow 320ms;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.015),
    0 4px 16px rgba(43, 27, 14, 0.04);
}

.tools-v2-card:hover {
  transform: translateY(-4px);
  border-color: rgba(226, 105, 27, 0.25);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 16px 40px rgba(43, 27, 14, 0.10);
}

.tools-v2-card:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 4px;
}

/* Cursor-following sheen. JS sets --sheen-x/--sheen-y on mousemove;
   CSS uses them as the radial-gradient center. Opacity 0→1 on hover. */
.tools-v2-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    600px circle at var(--sheen-x, 50%) var(--sheen-y, 0%),
    rgba(226, 105, 27, 0.08),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 320ms;
  pointer-events: none;
  z-index: 1;
}

.tools-v2-card:hover::before {
  opacity: 1;
}

/* All inner content sits above the sheen pseudo (z:2 over z:1). */
.tools-v2-card > * {
  position: relative;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Cinematic visual region, on every card now. 90px tall with its own
   subtle wash so the visual reads as a thumbnail.
   -------------------------------------------------------------------------- */
.tools-v2-card-visual {
  background:
    radial-gradient(ellipse 200px 80px at 50% 50%, rgba(255, 255, 255, 0.5), transparent),
    var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 20px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 0.5px solid rgba(224, 216, 196, 0.5);
}

.tools-v2-card-visual-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Card header (icon chip + status pill row)
   -------------------------------------------------------------------------- */
.tools-v2-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* Icon chip: 28x28 rounded-square with faint dark wash. Inline SVG
   inside scales to 16x16 and uses currentColor stroke 1.8. */
.tools-v2-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(43, 27, 14, 0.04);
  color: var(--tx1);
  flex-shrink: 0;
}

.tools-v2-card-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Status pill: leading 5px colored dot via ::before. OPEN hidden;
   BETA + EARLY visible.
   -------------------------------------------------------------------------- */
.tools-v2-card-status {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px 4px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tools-v2-card-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tools-v2-card-status[data-status="open"] {
  display: none;
}

.tools-v2-card-status[data-status="beta"] {
  background: rgba(226, 105, 27, 0.10);
  color: var(--ac);
}

.tools-v2-card-status[data-status="early"] {
  background: rgba(218, 165, 32, 0.12);
  color: var(--gold);
}

/* --------------------------------------------------------------------------
   Card name + description + CTA
   -------------------------------------------------------------------------- */
.tools-v2-card-name {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--tx);
  margin: 0 0 10px;
}

.tools-v2-card-description {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--tx1);
  margin: 0 0 20px;
  flex: 1;
}

.tools-v2-card-footer {
  margin-top: auto;
}

.tools-v2-card-cta {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ac);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tools-v2-card-cta-arrow {
  display: inline-block;
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tools-v2-card:hover .tools-v2-card-cta-arrow {
  transform: translateX(4px);
}

/* Underline fills in left-to-right on hover. */
.tools-v2-card-cta::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  height: 1px;
  width: 0;
  background: var(--ac);
  transition: width 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tools-v2-card:hover .tools-v2-card-cta::after {
  width: 100%;
}

/* ==========================================================================
   COMMIT 2, Cinematic visual animations (9 per-card)
   --------------------------------------------------------------------------
   All animations are pure CSS keyframes. transform/opacity-only so the
   compositor handles them on the GPU. Each keyframe and class is scoped
   to its specific visual; no cross-pollination.
   ========================================================================== */

/* --- Workbench: function plot draws + tangent fades + dot traces --- */
.viz-workbench-curve {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: viz-draw-curve 4s ease-out infinite;
}
@keyframes viz-draw-curve {
  0%, 10%  { stroke-dashoffset: 300; }
  40%, 90% { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 300; }
}
.viz-workbench-dot {
  animation: viz-move-dot 4s ease-in-out infinite;
}
@keyframes viz-move-dot {
  0%   { transform: translate(0, 0);    opacity: 0; }
  40%, 90% { opacity: 1; }
  60%  { transform: translate(20px, -3px); }
  100% { transform: translate(40px, 4px); opacity: 0; }
}
.viz-workbench-tangent {
  opacity: 0;
  animation: viz-fade-line 4s ease-in-out infinite;
}
@keyframes viz-fade-line {
  0%, 40%  { opacity: 0; }
  55%, 85% { opacity: 0.6; }
  100%     { opacity: 0; }
}

/* --- Code: lines type in sequentially + cursor blinks --- */
.viz-code-line {
  opacity: 0;
  animation: viz-line-in 5s ease-out infinite;
}
.viz-code-l1 { animation-delay: 0s; }
.viz-code-l2 { animation-delay: 0.8s; }
.viz-code-l3 { animation-delay: 1.6s; }
@keyframes viz-line-in {
  0%       { opacity: 0; transform: translateX(-6px); }
  12%, 88% { opacity: 1; transform: translateX(0); }
  100%     { opacity: 0; }
}
.viz-code-cursor {
  animation: viz-blink 1s steps(2) infinite;
}
@keyframes viz-blink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* --- AI Tutor: question rect + text cycle + typing dots pulse --- */
.viz-ai-msg {
  opacity: 0;
  animation: viz-msg-cycle 5s ease-in-out infinite;
}
@keyframes viz-msg-cycle {
  0%, 8%   { opacity: 0; transform: translateY(4px); }
  18%, 80% { opacity: 1; transform: translateY(0); }
  92%, 100% { opacity: 0; transform: translateY(-4px); }
}
.viz-ai-dot {
  animation: viz-ai-pulse 1.4s ease-in-out infinite;
}
.viz-ai-dot-2 { animation-delay: 0.2s; }
.viz-ai-dot-3 { animation-delay: 0.4s; }
@keyframes viz-ai-pulse {
  0%, 60%, 100% { opacity: 0.3; }
  30%           { opacity: 1; }
}

/* --- Playground: wireframe grid gently rotates -2 ↔ +2 deg --- */
.viz-playground-grid {
  transform-origin: center;
  transform-box: fill-box;
  animation: viz-gentle-rotate 8s ease-in-out infinite;
}
@keyframes viz-gentle-rotate {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

/* --- Solver: 3-step quadratic factor cycle (6s loop, 2s per step) --- */
.viz-solver-step {
  opacity: 0;
  animation: viz-step-cycle 6s ease-in-out infinite;
}
.viz-solver-s1 { animation-delay: 0s; }
.viz-solver-s2 { animation-delay: 2s; }
.viz-solver-s3 { animation-delay: 4s; }
@keyframes viz-step-cycle {
  0%, 5%    { opacity: 0; transform: translateY(4px); }
  10%, 33%  { opacity: 1; transform: translateY(0); }
  38%, 100% { opacity: 0; transform: translateY(-4px); }
}

/* --- Simulations: rocket launches across baseline + dashed trail draws --- */
.viz-rocket {
  animation: viz-launch 3.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes viz-launch {
  0%   { transform: translate(0, 0);   opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translate(150px, 0); opacity: 0; }
}
.viz-rocket-trail {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: viz-draw-trail 3.6s ease-out infinite;
}
@keyframes viz-draw-trail {
  0%   { stroke-dashoffset: 200; }
  100% { stroke-dashoffset: 0; }
}

/* --- Spaced repetition: Ebbinghaus curve draws + markers pop in --- */
.viz-forget-curve {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: viz-draw-forget 5s ease-out infinite;
}
@keyframes viz-draw-forget {
  0%, 5%   { stroke-dashoffset: 280; }
  40%, 90% { stroke-dashoffset: 0; }
  100%     { stroke-dashoffset: 280; }
}
.viz-forget-marker {
  opacity: 0;
  transform-origin: center;
  transform-box: fill-box;
  animation: viz-marker-in 5s ease-out infinite;
}
.viz-forget-m1 { animation-delay: 1s; }
.viz-forget-m2 { animation-delay: 2s; }
.viz-forget-m3 { animation-delay: 3s; }
@keyframes viz-marker-in {
  0%, 5%   { opacity: 0; transform: scale(0); }
  10%, 90% { opacity: 1; transform: scale(1); }
  100%     { opacity: 0; }
}

/* --- Progress: heatmap cells shimmer on staggered 3s cycle --- */
.viz-heatmap-cell {
  animation: viz-heatmap-shimmer 3s ease-in-out infinite;
}
@keyframes viz-heatmap-shimmer {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* --- Saved: 4 lines stack-in from the left on 4s loop --- */
.viz-saved-line {
  opacity: 0;
  animation: viz-line-stack 4s ease-out infinite;
}
.viz-saved-l1 { animation-delay: 0s; }
.viz-saved-l2 { animation-delay: 0.3s; }
.viz-saved-l3 { animation-delay: 0.6s; }
.viz-saved-l4 { animation-delay: 0.9s; }
@keyframes viz-line-stack {
  0%       { opacity: 0; transform: translateX(-12px); }
  20%, 80% { opacity: 1; transform: translateX(0); }
  100%     { opacity: 0; transform: translateX(12px); }
}

/* ==========================================================================
   COMMIT 3, Featured spotlight hero (above the Lab section)
   --------------------------------------------------------------------------
   2-col gradient card with an animated AI Tutor chat-exchange demo on
   the left (user → typing → assistant, 6s cycle) and editorial body
   on the right with pill-shaped CTA. Mobile collapses to single-col;
   visual stacks above body and the border-right becomes border-bottom.
   ========================================================================== */

.spotlight {
  max-width: 1100px;
  margin: 0 auto 56px;
  padding: 0;
}

/* Pulsing terracotta "FEATURED · TODAY" eyebrow. */
.spotlight-eyebrow {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ac);
  margin: 0 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spotlight-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ac);
  flex-shrink: 0;
  animation: spotlight-pulse 2.4s ease-in-out infinite;
}

@keyframes spotlight-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* The card itself, gradient bg, soft 2-layer shadow at rest, deeper
   shadow + 2px lift on hover. Whole card is an <a> so the click target
   spans both visual + body. */
.spotlight-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: linear-gradient(180deg, var(--bg2-light) 0%, var(--bg2) 100%);
  border: 0.5px solid var(--bdr);
  border-radius: 16px;
  overflow: hidden;
  min-height: 360px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1),
              border-color 320ms,
              box-shadow 320ms;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 8px 32px rgba(43, 27, 14, 0.06);
}

.spotlight-card:hover {
  transform: translateY(-2px);
  border-color: rgba(226, 105, 27, 0.25);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.02),
    0 16px 48px rgba(43, 27, 14, 0.10);
}

.spotlight-card:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 4px;
}

.spotlight-visual {
  background:
    radial-gradient(ellipse 400px 280px at 50% 50%, rgba(255, 255, 255, 0.55), transparent),
    var(--bg);
  border-right: 0.5px solid rgba(224, 216, 196, 0.5);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlight-body {
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.spotlight-tag {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tx2);
  margin: 0 0 12px;
}

.spotlight-name {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--tx);
  margin: 0 0 16px;
}

.spotlight-desc {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--tx1);
  max-width: 420px;
  margin: 0 0 30px;
}

/* Pill-shaped CTA button (different shape from card-CTA's inline link). */
.spotlight-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: white;
  background: var(--ac);
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(184, 82, 47, 0.3);
  transition: background 220ms, transform 220ms, box-shadow 220ms;
}

.spotlight-card:hover .spotlight-cta {
  background: var(--ac-strong);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(184, 82, 47, 0.4);
}

.spotlight-cta-arrow {
  display: inline-block;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.spotlight-card:hover .spotlight-cta-arrow {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   AI chat demo (left half of the spotlight card)
   -------------------------------------------------------------------------- */
.ai-demo {
  width: 100%;
  max-width: 340px;
  font-family: var(--font-serif);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-demo-msg {
  padding: 14px 18px;
  font-size: 14.5px;
  line-height: 1.5;
  opacity: 0;
}

.ai-demo-msg--user {
  background: var(--ac);
  color: white;
  border-radius: 14px;
  border-bottom-right-radius: 4px;
  margin-left: 40px;
  animation: spotlight-user-msg 6s ease-in-out infinite;
}

.ai-demo-msg--assistant {
  background: white;
  color: var(--tx);
  border: 0.5px solid var(--bdr);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  margin-right: 40px;
  box-shadow: 0 1px 2px rgba(43, 27, 14, 0.03);
  animation: spotlight-assistant-msg 6s ease-in-out infinite;
}

/* Math inside user msg: white text with dotted underline. */
.ai-demo-msg--user .ai-demo-math {
  font-style: italic;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.45);
  padding-bottom: 1px;
}

/* Math inside assistant msg: terracotta italic. */
.ai-demo-msg--assistant .ai-demo-math {
  font-style: italic;
  color: var(--ac-strong);
}

.ai-demo-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  background: white;
  border: 0.5px solid var(--bdr);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 14px 18px;
  margin-right: 40px;
  box-shadow: 0 1px 2px rgba(43, 27, 14, 0.03);
  width: fit-content;
  opacity: 0;
  animation: spotlight-typing 6s ease-in-out infinite;
}

.ai-demo-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tx2);
  animation: spotlight-typing-dot 1.2s ease-in-out infinite;
}

.ai-demo-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-demo-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes spotlight-typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* 3-state chat exchange on a 6s cycle. Percentages mapped to seconds:
   0% = 0s    | 5% = 0.3s  | 33% = 2.0s  | 38% = 2.3s
   58% = 3.5s | 62% = 3.7s | 95% = 5.7s  | 100% = 6.0s
   User msg occupies 0-2s, typing 2.3-3.5s, assistant 3.7-5.7s,
   then ~0.3s gap before loop restart. */
@keyframes spotlight-user-msg {
  0%, 5%    { opacity: 0; transform: translateY(8px); }
  10%, 33%  { opacity: 1; transform: translateY(0); }
  38%, 100% { opacity: 0; transform: translateY(-4px); }
}

@keyframes spotlight-typing {
  0%, 33%   { opacity: 0; transform: translateY(8px); }
  38%, 58%  { opacity: 1; transform: translateY(0); }
  62%, 100% { opacity: 0; transform: translateY(-4px); }
}

@keyframes spotlight-assistant-msg {
  0%, 62%   { opacity: 0; transform: translateY(8px); }
  67%, 95%  { opacity: 1; transform: translateY(0); }
  100%      { opacity: 0; transform: translateY(-4px); }
}

/* Mobile: spotlight card collapses to single column. Visual stacks
   above body; border-right becomes border-bottom. Sizing tightens. */
@media (max-width: 1023px) {
  .spotlight-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .spotlight-visual {
    padding: 32px 24px;
    border-right: none;
    border-bottom: 0.5px solid rgba(224, 216, 196, 0.5);
  }
  .spotlight-body {
    padding: 40px 32px;
  }
  .spotlight-name {
    font-size: 36px;
  }
  .spotlight-desc {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .spotlight {
    margin-bottom: 40px;
  }
  .spotlight-visual {
    padding: 24px 16px;
  }
  .spotlight-body {
    padding: 32px 24px;
  }
  .spotlight-name {
    font-size: 30px;
  }
  .ai-demo-msg {
    font-size: 13.5px;
    padding: 12px 16px;
  }
}

/* ==========================================================================
   PREFERS-REDUCED-MOTION, disable all decorative animations + transitions
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .tools-v2-page *,
  .tools-v2-page *::before,
  .tools-v2-page *::after {
    animation: none !important;
    transition: none !important;
  }
  /* Keep the visual elements visible (don't leave them at opacity:0 from
     the keyframe start state). */
  .tools-v2-page .viz-workbench-curve,
  .tools-v2-page .viz-rocket-trail,
  .tools-v2-page .viz-forget-curve {
    stroke-dashoffset: 0;
  }
  .tools-v2-page .viz-workbench-dot,
  .tools-v2-page .viz-workbench-tangent,
  .tools-v2-page .viz-ai-msg,
  .tools-v2-page .viz-ai-dot,
  .tools-v2-page .viz-code-line,
  .tools-v2-page .viz-solver-s1,
  .tools-v2-page .viz-rocket,
  .tools-v2-page .viz-forget-marker,
  .tools-v2-page .viz-saved-line,
  .tools-v2-page .ai-demo-msg,
  .tools-v2-page .ai-demo-typing {
    opacity: 1;
  }
  /* Only the first solver step is shown when motion is reduced. */
  .tools-v2-page .viz-solver-s2,
  .tools-v2-page .viz-solver-s3 {
    display: none;
  }
  /* When motion is reduced, only show the user message + assistant
     message in the spotlight (hide the typing bubble, feels redundant
     without the staggered timing). */
  .tools-v2-page .ai-demo-typing {
    display: none;
  }
}

/* ==========================================================================
   TABLET (768-1023px)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .tools-v2-title {
    font-size: 60px;
  }
  .tools-v2-card-grid,
  .tools-v2-section[data-section="mathematics"] .tools-v2-card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: none;
  }
  .tools-v2-card {
    padding: 24px;
    min-height: 300px;
  }
}

/* ==========================================================================
   MOBILE (<768px)
   ========================================================================== */
@media (max-width: 768px) {
  .tools-v2-page {
    padding: 32px 16px 64px;
  }
  .tools-v2-header {
    padding: 24px 0 40px;
  }
  .tools-v2-header-ambient {
    width: 160px;
    height: 24px;
    top: 4px;
  }
  .tools-v2-title {
    font-size: 48px;
    line-height: 1.0;
  }
  .tools-v2-tagline {
    font-size: 17px;
  }
  .tools-v2-header-divider {
    max-width: 260px;
    gap: 14px;
    margin-top: 32px;
  }
  .tools-v2-header-divider-glyph {
    width: 60px;
    height: 12px;
  }
  .tools-v2-section {
    margin-top: 40px;
  }
  .tools-v2-section-title {
    font-size: 28px;
  }
  .tools-v2-section-tagline {
    font-size: 14.5px;
  }
  .tools-v2-card-grid,
  .tools-v2-section[data-section="mathematics"] .tools-v2-card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    max-width: none;
  }
  .tools-v2-card {
    padding: 22px;
    min-height: 280px;
  }
  .tools-v2-card-name {
    font-size: 22px;
  }
  .tools-v2-card-visual {
    height: 76px;
    padding: 8px 12px;
    margin-bottom: 16px;
  }
  .tools-v2-section-divider {
    margin: 36px auto;
    max-width: 220px;
    gap: 10px;
  }
  .tools-v2-section-divider-glyph {
    width: 32px;
    height: 10px;
  }
}
