/* ============================================================
   home.css — the Home dashboard. A bento launchpad where Standby (the live
   instrument) is the hero tile and everything else orbits it, a stat strip
   fed by the rep's real profile, and an infinite "floor pulse" ticker.
   Same editorial-dark signal system as the rest of the app: achromatic
   surfaces, chromatic colour only where there is data or a product surface.
   ============================================================ */

/* ---- hero: tighter than the sub-pages so the instrument tile sits above the fold ---- */
.app-home { padding-top: clamp(2rem, 3.5vw, 3.25rem); }
.app-hero { max-width: 760px; margin-bottom: clamp(1.75rem, 3vw, 2.5rem); }
.app-hero__title { font-size: clamp(2.6rem, 1.6rem + 3.4vw, 4.4rem); margin-top: 14px; }
.app-hero__sub { font-size: 1.05rem; margin-top: 18px; }
.app-hero__cta { margin-top: 24px; }
.app-eyebrow { display: inline-flex; align-items: center; gap: 9px; }
.sig-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.sig-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent); opacity: 0; animation: sig-ping 2.2s var(--ease) infinite; }
@keyframes sig-ping { 0% { transform: scale(0.4); opacity: 0.9; } 70%, 100% { transform: scale(1.6); opacity: 0; } }

/* ---- stat strip: four numbers, one hairline, no boxes ---- */
.home-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.hstat { display: flex; flex-direction: column; padding: 18px 22px 18px 0; position: relative; }
.hstat + .hstat { padding-left: 22px; }
.hstat + .hstat::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 1px; background: var(--hairline); }
.hstat__v { font-family: var(--font-display); font-weight: 300; font-size: clamp(1.9rem, 1.2rem + 2vw, 2.7rem); line-height: 1; color: var(--text); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hstat__l { font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); margin-top: 9px; }
.hstat__s { font-size: 0.78rem; color: var(--text-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hstat.is-up .hstat__s { color: var(--accent); }
@media (max-width: 760px) {
  .home-stats { grid-template-columns: 1fr 1fr; }
  .hstat:nth-child(3)::before { display: none; }
  .hstat:nth-child(3) { padding-left: 0; }
  .hstat:nth-child(n+3) { border-top: 1px solid var(--hairline); }
}

/* ---- bento ---- */
.bento {
  display: grid; gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.tile--standby   { grid-column: 1 / 3; grid-row: 1 / 3; min-height: 372px; }
.tile--roleplay  { grid-column: 3 / 4; grid-row: 1 / 3; }
.tile--prospects { grid-column: 4 / 5; grid-row: 1 / 2; }
.tile--ai        { grid-column: 4 / 5; grid-row: 2 / 3; }
.tile--scripts   { grid-column: 1 / 3; grid-row: 3 / 4; }
.tile--board     { grid-column: 3 / 5; grid-row: 3 / 4; }
@media (max-width: 980px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .tile--standby   { grid-column: 1 / 3; grid-row: auto; min-height: 340px; }
  .tile--roleplay  { grid-column: 1 / 2; grid-row: auto; }
  .tile--prospects { grid-column: 2 / 3; grid-row: auto; }
  .tile--ai        { grid-column: 1 / 2; grid-row: auto; }
  .tile--board     { grid-column: 2 / 3; grid-row: auto; }
  .tile--scripts   { grid-column: 1 / 3; grid-row: auto; }
}
@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .tile--standby, .tile--roleplay, .tile--prospects, .tile--ai, .tile--board, .tile--scripts { grid-column: 1 / 2; }
  .tile--standby { min-height: 320px; }
}

/* the tile — a product surface with a pointer-tracked spotlight (motion.css drives --mx/--my) */
.tile {
  position: relative; isolation: isolate; overflow: hidden; text-align: left;
  display: flex; flex-direction: column; gap: 0; padding: 22px 24px;
  min-height: 168px; border: 1px solid var(--hairline); border-radius: var(--r-2xl);
  background: var(--card-solid); color: var(--text); cursor: pointer;
  transition: border-color .25s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  will-change: transform;
}
.tile:hover { border-color: var(--hairline-strong); box-shadow: var(--sh-3); }
.tile:active { transform: perspective(900px) scale(0.992); }
.tile::before {  /* spotlight */
  content: ""; position: absolute; inset: -1px; z-index: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--ink), 0.08), transparent 60%);
  opacity: 0; transition: opacity .35s var(--ease);
}
.tile:hover::before { opacity: 1; }
.tile::after {  /* arrow */
  content: "→"; position: absolute; top: 20px; right: 22px; z-index: 2; color: var(--text-3);
  font-size: 0.95rem; transition: transform .25s var(--ease), color .25s var(--ease);
}
.tile:hover::after { transform: translateX(4px); color: var(--text); }
.tile > * { position: relative; z-index: 1; }
.tile__tag { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.tile__name { font-family: var(--font-display); font-weight: 300; font-size: 1.7rem; line-height: 1; margin-top: 8px; letter-spacing: -0.02em; }
.tile__desc { font-size: 0.84rem; color: var(--text-2); line-height: 1.5; margin-top: 8px; max-width: 34ch; }
.tile__kpi { margin-top: auto; padding-top: 18px; display: flex; align-items: baseline; gap: 8px; }
.tile__kpi b { font-family: var(--font-display); font-weight: 300; font-size: 1.9rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile__kpi span { font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.tile__kpi .hot { color: var(--danger); }
.tile--scripts .tile__kpi b, .tile--board .tile__kpi b { font-size: 1.5rem; }
.tile--scripts .tile__kpi, .tile--board .tile__kpi { padding-top: 14px; }
.tile--scripts, .tile--board { min-height: 0; }

/* chromatic product surfaces — the Standby instrument (cyan) + Roleplay (amethyst) */
.tile--standby { background: radial-gradient(130% 110% at 0% 0%, color-mix(in oklab, var(--accent) 20%, transparent), var(--card-solid) 60%); }
.tile--roleplay { background: radial-gradient(120% 120% at 0% 0%, color-mix(in oklab, var(--violet) 20%, transparent), var(--card-solid) 60%); }
.tile--roleplay .tile__tag { color: var(--violet); }
.tile--ai { background: radial-gradient(120% 120% at 100% 0%, color-mix(in oklab, var(--pink) 10%, transparent), var(--card-solid) 60%); }

/* the live tag dot on the Standby tile — quiet when idle, pinging when a call is running */
.tile__live { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); transition: background .3s; }
body[data-live="1"] .tile__live { background: var(--danger); box-shadow: 0 0 0 0 color-mix(in oklab, var(--danger) 60%, transparent); animation: live-ping 1.4s ease-out infinite; }
@keyframes live-ping { to { box-shadow: 0 0 0 9px transparent; } }

/* ---- the mini instrument inside the Standby tile ---- */
.inst { margin-top: auto; padding-top: 18px; display: grid; grid-template-columns: 148px 1fr; grid-template-rows: auto auto; gap: 6px 22px; align-items: end; }
.inst__arc { grid-column: 1; grid-row: 1 / 3; width: 148px; height: auto; display: block; overflow: visible; }
.inst__track { fill: none; stroke: rgba(var(--ink), 0.10); stroke-width: 9; stroke-linecap: round; }
.inst__fill { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 50; transition: stroke-dashoffset 1.2s var(--ease), stroke .4s; }
.inst__num { grid-column: 1; grid-row: 1 / 3; align-self: end; justify-self: center; display: flex; flex-direction: column; align-items: center; margin-bottom: 2px; pointer-events: none; }
.inst__num b { font-family: var(--font); font-weight: 600; font-size: 2rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.inst__num small { font-family: var(--font-mono); font-size: 0.5rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-3); margin-top: 5px; }
.wave { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: space-between; height: 44px; }
.wave i { width: 3px; flex: none; height: 100%; border-radius: 2px; background: var(--accent); opacity: 0.55; transform: scaleY(0.12); transform-origin: center; animation: wave-idle 2.6s ease-in-out infinite; animation-delay: calc(var(--wi, 0) * -0.17s); }
.wave i:nth-child(3n) { animation-duration: 3.1s; }
.wave i:nth-child(4n+1) { animation-duration: 2.2s; }
.wave i:nth-child(1)  { --wi: 0; }  .wave i:nth-child(2)  { --wi: 1; }  .wave i:nth-child(3)  { --wi: 2; }  .wave i:nth-child(4)  { --wi: 3; }
.wave i:nth-child(5)  { --wi: 4; }  .wave i:nth-child(6)  { --wi: 5; }  .wave i:nth-child(7)  { --wi: 6; }  .wave i:nth-child(8)  { --wi: 7; }
.wave i:nth-child(9)  { --wi: 8; }  .wave i:nth-child(10) { --wi: 9; }  .wave i:nth-child(11) { --wi: 10; } .wave i:nth-child(12) { --wi: 11; }
.wave i:nth-child(13) { --wi: 12; } .wave i:nth-child(14) { --wi: 13; } .wave i:nth-child(15) { --wi: 14; } .wave i:nth-child(16) { --wi: 15; }
@keyframes wave-idle { 0%, 100% { transform: scaleY(0.12); opacity: 0.4; } 50% { transform: scaleY(0.42); opacity: 0.8; } }
body[data-live="1"] .wave i { animation: wave-live 0.9s ease-in-out infinite; animation-delay: calc(var(--wi, 0) * -0.07s); }
@keyframes wave-live { 0%, 100% { transform: scaleY(0.18); opacity: 0.55; } 40% { transform: scaleY(1); opacity: 1; } 70% { transform: scaleY(0.5); } }
.inst__foot { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); padding-top: 8px; border-top: 1px solid var(--hairline); }
.inst__arrow { display: none; }
@media (max-width: 560px) {
  .inst { grid-template-columns: 1fr; }
  .inst__arc, .inst__num { grid-column: 1; }
  .wave, .inst__foot { grid-column: 1; }
  .wave { grid-row: 3; height: 34px; }
  .inst__foot { grid-row: 4; }
}

/* ---- roleplay personas: chips that drift like a hand of cards ---- */
.personas { margin-top: auto; padding-top: 22px; display: flex; flex-wrap: wrap; gap: 7px; }
.persona-chip {
  font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text);
  padding: 6px 10px; border-radius: var(--r-pill); border: 1px solid color-mix(in oklab, var(--violet) 35%, transparent); background: color-mix(in oklab, var(--violet) 10%, transparent);
  animation: chip-float 5.5s ease-in-out infinite; animation-delay: calc(var(--f, 0) * -1.3s);
}
@keyframes chip-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ---- AI tile: a rotating "thought" ---- */
.tile__quote { margin-top: 14px; font-family: var(--font-display); font-weight: 300; font-size: 1.12rem; line-height: 1.3; color: var(--text); letter-spacing: -0.005em; min-height: 3.9em; transition: opacity .35s var(--ease), transform .35s var(--ease); }
.tile__quote.is-swapping { opacity: 0; transform: translateY(6px); }

/* ---- floor pulse ticker ---- */
.pulse { display: flex; align-items: center; gap: 18px; padding: 12px 0; border-top: 1px solid var(--hairline); overflow: hidden; }
.pulse__label { flex: none; display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.pulse__track { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.pulse__run { display: flex; gap: 34px; width: max-content; animation: pulse-run 48s linear infinite; will-change: transform; }
.pulse:hover .pulse__run { animation-play-state: paused; }
@keyframes pulse-run { to { transform: translateX(-50%); } }
.pulse__item { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 0.8rem; color: var(--text-2); }
.pulse__item b { font-family: var(--font-display); font-weight: 400; color: var(--text); font-variant-numeric: tabular-nums; }
.pulse__item .k { font-family: var(--font-mono); font-size: 0.54rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.pulse__item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-4); }
.pulse__item[data-kind="win"] .dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.pulse__item[data-kind="hot"] .dot { background: var(--danger); }
.pulse__item[data-kind="badge"] .dot { background: var(--orange); }
@media (max-width: 560px) { .pulse__label span:last-child { display: none; } }

/* every canvas shares this geometry — tints resolve through --accent / --violet / --ink (themes.css) */
