/* ============================================================
   ai-analytics.css — "The Dental Exchange"
   Loads AFTER styles.css. Page-specific only.
   LIGHT theme — tracks the homepage exactly: paper background,
   ink text, indigo + teal-mint accents, white floating cards.
   A luminous tooth at the core with live KPIs orbiting it.
   ============================================================ */

:root {
  --ax-paper:  #e7ebf5;
  --ax-card:   rgba(255,255,255,.94);
  --ax-line:   #dde5f1;
  --ax-line-2: #e9ebf4;
  --ax-ink:    #0b1020;
  --ax-dim:    #4a5066;
  --ax-dim-2:  #7385a3;
  --ax-indigo: #3b4fe0;
  --ax-indigo-2: #2c3bc4;
  --ax-peri:   #eaeeff;
  --ax-teal:   #2f9e8f;
  --ax-mint:   #1f9e7f;     /* homepage "up" green */
  --ax-blue:   #5a82c2;     /* homepage chart blue */
  --ax-amber:  #b0823a;
  --ax-neg:    #c2566f;
}

/* page canvas = homepage hero gradient */
body.ax {
  color: var(--ax-ink);
  background:
    radial-gradient(120% 80% at 50% -8%, #eef2fb, transparent 58%),
    linear-gradient(180deg, #eaeef7, var(--ax-paper));
  background-attachment: fixed;
}

.ax-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ax-up   { color: var(--ax-mint); }
.ax-down { color: var(--ax-mint); }
.ax-neg  { color: var(--ax-neg); }

/* ============================================================
   TICKER TAPE
   ============================================================ */
.ax-ticker {
  position: relative; z-index: 5;
  border-bottom: 1px solid var(--ax-line);
  background: rgba(255,255,255,.72); backdrop-filter: saturate(1.3) blur(10px);
  overflow: hidden; height: 42px; display: flex; align-items: center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ax-ticker-tag {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 8px; padding: 0 20px 0 16px;
  font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: #fff; background: linear-gradient(120deg, var(--ax-indigo), var(--ax-indigo-2));
  -webkit-clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
          clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.ax-ticker-tag i { width: 7px; height: 7px; border-radius: 50%; background: #7fe7c4; box-shadow: 0 0 0 4px rgba(127,231,196,.3); animation: ax-pulse 2s infinite; }
@keyframes ax-pulse { 0%,100%{ opacity:1 } 50%{ opacity:.35 } }
.ax-ticker-track { display: flex; gap: 34px; white-space: nowrap; padding-left: 170px; will-change: transform; animation: ax-marquee 52s linear infinite; }
.ax-ticker:hover .ax-ticker-track { animation-play-state: paused; }
@keyframes ax-marquee { from { transform: translateX(0) } to { transform: translateX(-50%) } }
.ax-tk { display: inline-flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.ax-tk b { font-weight: 600; color: var(--ax-dim); letter-spacing: .04em; }
.ax-tk .v { font-family: var(--mono); color: var(--ax-ink); font-weight: 500; }
.ax-tk .d { font-family: var(--mono); font-size: 11.5px; }

/* ============================================================
   HERO — centered header + the exchange arena
   ============================================================ */
.ax-hero { position: relative; overflow: hidden; padding: clamp(34px,4vw,54px) 0 clamp(32px,5vw,60px); text-align: center; }

.ax-hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ax-aurora {
  position: absolute; inset: -24% -10%; filter: blur(56px); opacity: .82;
  background:
    radial-gradient(28% 36% at 30% 28%, rgba(90,130,194,.34), transparent 70%),
    radial-gradient(30% 38% at 72% 24%, rgba(47,158,143,.26), transparent 70%),
    radial-gradient(38% 46% at 60% 82%, rgba(108,111,214,.26), transparent 70%);
  animation: ax-aurora 24s ease-in-out infinite alternate;
}
@keyframes ax-aurora { 0%{ transform: translate(0,0) scale(1) } 50%{ transform: translate(2%,-2%) scale(1.06) } 100%{ transform: translate(-2%,2%) scale(1.03) } }
.ax-floor {
  position: absolute; left: 50%; bottom: -12%; width: 200%; height: 60%;
  transform: translateX(-50%) perspective(640px) rotateX(70deg);
  background-image: linear-gradient(rgba(120,150,210,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(120,150,210,.12) 1px, transparent 1px);
  background-size: 62px 62px; opacity: .6;
  -webkit-mask-image: radial-gradient(72% 100% at 50% 100%, #000 16%, transparent 74%);
          mask-image: radial-gradient(72% 100% at 50% 100%, #000 16%, transparent 74%);
  animation: ax-floor 10s linear infinite;
}
@keyframes ax-floor { to { background-position: 0 62px, 62px 0; } }
.ax-spot { position: absolute; inset: 0; background: radial-gradient(460px 460px at var(--mx,50%) var(--my,40%), rgba(255,255,255,.5), transparent 60%); transition: background .15s; }

.ax-hero-inner { position: relative; z-index: 2; }

.ax-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ax-indigo);
  background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.85);
  padding: 7px 15px; border-radius: var(--r-pill); margin-bottom: 22px; backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px -16px rgba(20,40,70,.5);
}
.ax-eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--ax-mint); box-shadow: 0 0 0 4px rgba(31,158,127,.18); animation: ax-pulse 2s infinite; }
.ax-back { display: inline-block; font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ax-indigo); margin-bottom: 18px; }
.ax-hero h1 {
  font-size: clamp(36px,5vw,68px); font-weight: 600; line-height: .98; letter-spacing: -.04em;
  color: var(--ax-ink); margin: 0 auto; max-width: 20ch;
}
.ax-hero h1 .grad {
  background: linear-gradient(100deg, var(--ax-indigo) 0%, #4a63d8 42%, var(--ax-teal) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ax-hero .lead { color: var(--ax-dim); font-size: clamp(15.5px,1.25vw,18px); line-height: 1.55; max-width: 56ch; margin: 16px auto 0; }
.ax-hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; justify-content: center; }

/* ---------- THE ARENA ---------- */
.ax-arena {
  position: relative; z-index: 2; width: 100%; max-width: 1120px;
  height: clamp(348px, 38vw, 440px); margin: clamp(2px,0.6vw,10px) auto 0;
  perspective: 1300px;
}
.ax-arena-scene { position: absolute; inset: 0; transform-style: preserve-3d; }

.ax-ring { position: absolute; top: 50%; left: 50%; border-radius: 50%; transform: translate(-50%,-50%) rotateX(64deg); pointer-events: none; }
.ax-ring.r1 { width: 540px; height: 540px; border: 1px solid rgba(90,130,194,.30); animation: ax-spin 34s linear infinite; }
.ax-ring.r2 { width: 760px; height: 760px; border: 1px dashed rgba(90,130,194,.24); animation: ax-spin 58s linear infinite reverse; }
@keyframes ax-spin { to { transform: translate(-50%,-50%) rotateX(64deg) rotateZ(360deg); } }

.ax-tooth-wrap { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 3; will-change: transform; }
.ax-tooth { width: clamp(132px,15vw,184px); display: block;
  filter: drop-shadow(0 18px 30px rgba(40,60,110,.22)); }
/* clean luminous disc behind the tooth (no muddy blue smudge) */
.ax-tooth-glow { position: absolute; inset: -26%; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(214,226,250,.7) 34%, rgba(150,175,235,.22) 58%, transparent 74%);
  filter: blur(14px); animation: ax-breathe 6s ease-in-out infinite; }
@keyframes ax-breathe { 0%,100%{ opacity:.85; transform: scale(1) } 50%{ opacity:1; transform: scale(1.06) } }

/* orbiting stat chips */
.ax-chip {
  position: absolute; top: 50%; left: 50%; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 11px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.94); border: 1px solid var(--ax-line);
  color: var(--ax-dim); box-shadow: 0 18px 38px -20px rgba(40,60,100,.5); backdrop-filter: blur(6px);
  will-change: transform; pointer-events: none;
}
.ax-chip::before { content:""; width: 5px; height: 5px; border-radius: 50%; background: var(--ax-indigo); box-shadow: 0 0 8px rgba(59,79,224,.6); flex: none; }
.ax-chip .m { font-family: var(--mono); color: var(--ax-ink); }

/* floating dashboard cards — white, homepage floater look */
.ax-card {
  position: absolute; z-index: 4; width: clamp(158px,15vw,190px); padding: 14px 15px; border-radius: 16px;
  background: var(--ax-card); border: 1px solid var(--ax-line);
  box-shadow: 0 24px 50px -24px rgba(40,60,100,.44); backdrop-filter: blur(6px);
  will-change: transform;
}
.ax-card .c-l { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ax-dim-2); font-weight: 600; }
.ax-card .c-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 8px; }
.ax-card .c-v { font-family: var(--mono); font-size: clamp(18px,1.7vw,22px); font-weight: 600; color: var(--ax-ink); }
.ax-card .c-d { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.ax-card .c-bars { display: flex; align-items: flex-end; gap: 4px; height: 26px; margin-top: 11px; }
.ax-card .c-bars i { flex: 1; border-radius: 3px; height: calc(var(--h) * 100%); background: linear-gradient(180deg, var(--ax-blue), #9ab6e6); }
.ax-card .c-spark { width: 100%; height: 30px; margin-top: 9px; display: block; overflow: visible; }
.ax-card .c-spark path { fill: none; stroke: var(--ax-blue); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ax-card.c-tl { top: 3%;  left: 1%;  }
.ax-card.c-tr { top: 8%;  right: 1%; }
.ax-card.c-bl { bottom: 4%; left: 4%; }
.ax-card.c-br { bottom: 9%; right: 3%; }

.ax-hero-foot { display: flex; gap: clamp(24px,4vw,54px); margin-top: clamp(20px,3vw,36px); justify-content: center; flex-wrap: wrap; position: relative; z-index: 2; }
.ax-hf { display: flex; flex-direction: column; align-items: center; }
.ax-hf b { font-family: var(--mono); font-size: clamp(22px,2.2vw,30px); font-weight: 600; color: var(--ax-ink); line-height: 1; letter-spacing: -.02em; }
.ax-hf span { font-size: 12px; color: var(--ax-dim-2); margin-top: 8px; max-width: 16ch; line-height: 1.35; }

/* ============================================================
   SECTION SCAFFOLD
   ============================================================ */
.ax-section { padding: clamp(60px,8vw,104px) 0; position: relative; }
.ax-sec-head { max-width: 720px; margin: 0 auto clamp(36px,5vw,54px); text-align: center; }
.ax-kicker { font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ax-indigo); }
.ax-sec-head h2 { font-size: clamp(30px,3.6vw,50px); font-weight: 600; letter-spacing: -.035em; color: var(--ax-ink); line-height: 1.04; margin: 14px 0 0; }
.ax-sec-head p { color: var(--ax-dim); font-size: clamp(15.5px,1.3vw,18px); line-height: 1.6; margin: 18px auto 0; max-width: 60ch; }

/* ============================================================
   THE BIG BOARD — white terminal, homepage palette
   ============================================================ */
.ax-board { border: 1px solid var(--ax-line); border-radius: var(--r-xl); overflow: hidden;
  background: #fff; box-shadow: 0 40px 90px -44px rgba(40,60,100,.4); }
.ax-board-top { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--ax-line-2); background: var(--paper); }
.ax-board-top .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ax-mint); box-shadow: 0 0 0 4px rgba(31,158,127,.16); animation: ax-pulse 2s infinite; }
.ax-board-top .ttl { font-weight: 600; color: var(--ax-ink); font-size: 14.5px; }
.ax-board-top .ttl span { color: var(--ax-dim-2); font-weight: 400; }
.ax-board-top .clock { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--ax-dim-2); }
.ax-board-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px){ .ax-board-grid { grid-template-columns: repeat(2,1fr); } }
.ax-cell { padding: 20px; border-right: 1px solid var(--ax-line-2); border-top: 1px solid var(--ax-line-2); position: relative; }
.ax-cell .lbl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ax-dim-2); }
.ax-cell .val { font-family: var(--mono); font-size: clamp(23px,2.3vw,31px); font-weight: 600; color: var(--ax-ink); margin-top: 10px; line-height: 1; letter-spacing: -.02em; transition: color .5s; }
.ax-cell.up .val { color: #12876a; } .ax-cell.dn .val { color: var(--ax-neg); }
.ax-cell .foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; font-size: 12px; }
.ax-cell .foot .d { font-family: var(--mono); font-weight: 600; flex: none; }
.ax-cell .foot .sub { color: var(--ax-dim-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-cell .spark { display: block; width: 100%; height: 30px; margin-top: 14px; overflow: visible; }
.ax-cell .spark path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   ASK — plain-English query card (light)
   ============================================================ */
.ax-ask-wrap { max-width: 820px; margin: 0 auto; }
.ax-term { border: 1px solid var(--ax-line); border-radius: 20px; overflow: hidden;
  background: #fff; box-shadow: 0 40px 90px -44px rgba(40,60,100,.4); }
.ax-term-top { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--ax-line-2); background: var(--paper); }
.ax-term-top i { width: 11px; height: 11px; border-radius: 50%; background: #d6ddee; }
.ax-term-top i:nth-child(1){ background:#f0a0ac } .ax-term-top i:nth-child(2){ background:#f0c877 } .ax-term-top i:nth-child(3){ background:#7fd8bc }
.ax-term-top span { margin-left: 8px; font-size: 12px; color: var(--ax-dim-2); font-family: var(--mono); }
.ax-term-body { padding: 24px clamp(20px,4vw,34px); min-height: 300px; }
.ax-q { display: flex; align-items: center; gap: 10px; font-size: clamp(15px,1.5vw,18px); color: var(--ax-ink); }
.ax-q .chev { color: var(--ax-mint); font-family: var(--mono); }
.ax-q .txt { font-weight: 500; }
.ax-q .caret { display: inline-block; width: 9px; height: 20px; background: var(--ax-indigo); margin-left: 1px; animation: ax-caret 1s steps(1) infinite; vertical-align: -3px; }
@keyframes ax-caret { 50%{ opacity: 0 } }
.ax-a { margin-top: 22px; opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s; }
.ax-a.show { opacity: 1; transform: none; }
.ax-a-big { font-family: var(--mono); font-size: clamp(38px,5vw,58px); font-weight: 600; color: var(--ax-ink); letter-spacing: -.03em; line-height: 1; }
.ax-a-big .u { color: var(--ax-mint); font-size: .42em; margin-left: 12px; letter-spacing: 0; }
.ax-a-sub { color: var(--ax-dim); font-size: 14px; margin-top: 12px; line-height: 1.5; max-width: 62ch; }
.ax-a-break { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.ax-a-break .pill { font-size: 12px; color: var(--ax-dim); background: var(--paper); border: 1px solid var(--ax-line-2); border-radius: 8px; padding: 8px 11px; }
.ax-a-break .pill b { font-family: var(--mono); color: var(--ax-ink); font-weight: 600; }

/* ============================================================
   METRIC UNIVERSE
   ============================================================ */
.ax-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 900px){ .ax-metrics { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 560px){ .ax-metrics { grid-template-columns: 1fr; } }
.ax-metric { padding: 22px; border-radius: var(--r-soft); border: 1px solid var(--ax-line); background: rgba(255,255,255,.7);
  transition: transform .25s, border-color .25s, box-shadow .25s; }
.ax-metric:hover { transform: translateY(-4px); border-color: var(--indigo-300); background: #fff; box-shadow: 0 24px 50px -28px rgba(40,60,100,.4); }
.ax-metric .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--ax-peri); border: 1px solid #dbe2ff; }
.ax-metric h3 { font-size: 17px; font-weight: 600; color: var(--ax-ink); margin: 16px 0 8px; letter-spacing: -.01em; }
.ax-metric p { color: var(--ax-dim); font-size: 13.5px; line-height: 1.55; }
.ax-metric .stat { margin-top: 14px; font-family: var(--mono); font-size: 13px; color: var(--ax-indigo); display: inline-flex; gap: 6px; align-items: center; }

/* ============================================================
   HOW IT STAYS TRUE
   ============================================================ */
.ax-true { display: grid; grid-template-columns: repeat(3,1fr); gap: clamp(18px,2.5vw,30px); }
@media (max-width: 820px){ .ax-true { grid-template-columns: 1fr; } }
.ax-true-item { padding-top: 22px; border-top: 2px solid var(--ax-indigo); }
.ax-true-item .n { font-family: var(--mono); font-size: 13px; color: var(--ax-indigo); }
.ax-true-item h3 { font-size: 19px; font-weight: 600; color: var(--ax-ink); margin: 14px 0 10px; letter-spacing: -.01em; }
.ax-true-item p { color: var(--ax-dim); font-size: 14.5px; line-height: 1.6; }

/* ============================================================
   CTA — indigo block (homepage style)
   ============================================================ */
.ax-cta { position: relative; overflow: hidden; border-radius: var(--r-xl);
  padding: clamp(48px,6vw,80px) clamp(28px,5vw,64px); text-align: center;
  background: radial-gradient(120% 120% at 0% 0%, var(--ax-indigo) 0%, #9aa6f5 45%, #243a63 100%); color: #fff;
  box-shadow: 0 50px 100px -50px rgba(59,79,224,.55); }
.ax-cta::before { content:""; position:absolute; inset:-40% -10% auto -10%; height:90%; pointer-events:none; opacity:.8; filter: blur(50px);
  background: radial-gradient(40% 60% at 22% 30%, rgba(127,154,214,.55), transparent 70%), radial-gradient(40% 60% at 80% 20%, rgba(70,224,200,.4), transparent 70%); }
.ax-cta h2 { position: relative; font-size: clamp(30px,4vw,54px); font-weight: 600; letter-spacing: -.04em; color: #fff; line-height: 1.02; }
.ax-cta p { position: relative; color: rgba(255,255,255,.86); font-size: clamp(15.5px,1.3vw,18px); margin: 18px auto 30px; max-width: 46ch; line-height: 1.55; }
.ax-cta .ax-hero-cta { margin-top: 0; }
.ax-cta .btn-primary { background: #fff; color: var(--ax-indigo); box-shadow: 0 16px 34px -18px rgba(0,0,0,.4); }
.ax-cta .btn-primary:hover { background: #eef0ff; }
.ax-cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.ax-cta .btn-ghost:hover { background: rgba(255,255,255,.1); border-color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 720px){
  .ax-card.c-tr, .ax-card.c-br { display: none; }
  .ax-arena { height: clamp(320px, 74vw, 420px); }
}
@media (prefers-reduced-motion: reduce), (max-width: 700px){
  .ax-ticker-track, .ax-ring, .ax-tooth-glow, .ax-floor, .ax-aurora,
  .ax-ticker-tag i, .ax-eyebrow i, .ax-board-top .dot, .ax-q .caret {
    animation: none !important;
  }
}

/* ============================================================
   PHONE HARDENING — single column, no marquee, no stuck
   pre-animation "hidden" states, no overflow.
   ============================================================ */
@media (max-width: 700px){
  /* decorative marquee ticker: not primary content, drop it entirely
     rather than leave a frozen/empty band */
  .ax-ticker { display: none; }

  /* reveal elements that were only ever made visible by a transition
     triggered off an animation/JS timer — force final state */
  .ax-a { opacity: 1 !important; transform: none !important; }

  /* decorative aurora/floor/glow layers behind the hero: keep the
     copy, drop anything that could visually smear now that it's frozen */
  .ax-hero-bg { opacity: .55; }

  /* collapse remaining multi-column grids to one column */
  .ax-board-grid,
  .ax-metrics { grid-template-columns: 1fr !important; }

  /* fixed/near-fixed width demo surfaces never exceed the viewport */
  .ax-card, .ax-chip, .ax-term, .ax-board, .ax-arena { max-width: 100%; }

  /* tighten oversized vertical rhythm on phones while keeping whitespace */
  .ax-section { padding: 44px 0; }
  .ax-hero { padding: 26px 0 24px; }
  .ax-hero-foot { gap: 22px; margin-top: 22px; }
  .ax-sec-head { margin: 0 auto 28px; }
}

@media (max-width: 460px){
  .ax-section { padding: 34px 0; }
  .ax-hero { padding: 20px 0 20px; }
  .ax-hero h1 { font-size: clamp(30px,9vw,36px); }
  .ax-hero .lead { font-size: 14.5px; }
  .ax-sec-head h2 { font-size: clamp(24px,7vw,30px); }
  .ax-term-body { padding: 18px 16px; min-height: 0; }
  .ax-a-big { font-size: clamp(30px,10vw,38px); }
}
