/* Overview showcase: a bento of the visual features, each a single link with a live preview.
   Hero tiles (network, map, Casebook) share the first row; CRM stands tall beside the rest.
   Copy sits on a scrim at the top so it stays readable over every preview. */
#app #workspace-shell #main .feature-showcase {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: 280px 140px 140px;
  grid-template-areas:
    "net net net net map map map map book book book book"
    "crm crm crm crm ana ana ana ana vid vid vid vid"
    "crm crm crm crm ast ast ast law law law ppl ppl";
  gap: 14px;
  margin: 0 0 24px;
}
#app #workspace-shell #main .showcase-network { grid-area: net; }
#app #workspace-shell #main .showcase-map { grid-area: map; }
#app #workspace-shell #main .showcase-crm { grid-area: crm; }
#app #workspace-shell #main .showcase-casebook { grid-area: book; }
#app #workspace-shell #main .showcase-analytics { grid-area: ana; }
#app #workspace-shell #main .showcase-video { grid-area: vid; }
#app #workspace-shell #main .showcase-assistant { grid-area: ast; }
#app #workspace-shell #main .showcase-laws { grid-area: law; }
#app #workspace-shell #main .showcase-people { grid-area: ppl; }

#app #workspace-shell #main .showcase-tile {
  --tile: var(--ap-royal, #2447d8);
  --scrim: 7, 26, 61;
  position: relative;
  isolation: isolate;
  display: block;
  min-width: 0;
  overflow: hidden;
  border-bottom: 5px solid var(--tile);
  border-radius: var(--r-lg, 18px);
  background: var(--ap-navy-900, #0b1440);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow, 0 8px 24px rgba(29, 78, 216, .08));
}
#app #workspace-shell #main .showcase-tile:focus-visible { outline: var(--focus-ring, 3px solid #ffb300); outline-offset: 3px; }
#app #workspace-shell #main :is(.showcase-network, .showcase-map, .showcase-casebook)::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 0;
  height: 96px;
  background: linear-gradient(to bottom, rgba(var(--scrim), .86) 0%, rgba(var(--scrim), .5) 58%, rgba(var(--scrim), 0) 100%);
  pointer-events: none;
}
.showcase-preview { position: absolute; inset: 0; z-index: -1; display: block; }
.showcase-svg { display: block; width: 100%; height: 100%; }
#app #workspace-shell #main .showcase-copy { position: relative; z-index: 1; display: grid; gap: 0; padding: 14px 16px 0; min-width: 0; }
#app #workspace-shell #main .showcase-title { font-family: var(--font-display, inherit); font-size: 18px; font-weight: 800; line-height: 1.2; text-shadow: 0 1px 8px rgba(7, 26, 61, .5); }
#app #workspace-shell #main .showcase-count { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 7px; min-width: 0; min-height: 32px; }
#app #workspace-shell #main .showcase-count > strong { font-family: var(--font-display, inherit); font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
#app #workspace-shell #main .showcase-count > span { color: #e3ecff; font-size: 14px; font-weight: 650; }
#app #workspace-shell #main :is(.showcase-network, .showcase-map, .showcase-casebook) .showcase-title { font-size: 21px; }
#app #workspace-shell #main :is(.showcase-network, .showcase-map, .showcase-casebook) .showcase-count > strong { font-size: 34px; }

/* Network: the repeat network on deep navy. */
#app #workspace-shell #main .showcase-network { --tile: var(--ap-sky-2, #4f7cff); background: radial-gradient(120% 90% at 70% 60%, #1d2f8f 0%, #0b1440 70%); }
.showcase-network .showcase-preview { inset: 64px 0 0; }
.sc-edge { stroke: rgba(173, 196, 255, .34); stroke-width: 1.2; }
.sc-edge-repeat { stroke: #ffb300; stroke-opacity: .7; stroke-width: 1.6; }
.sc-node { fill: #7ea0ff; stroke: #0b1440; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; }
.sc-node[data-type="accused"] { fill: #ff5c8d; }
.sc-node[data-type="witness"] { fill: #2dd4bf; }
.sc-node[data-type="person"] { fill: #ff8a65; }
.sc-node[data-type="vehicle"] { fill: #ffb300; }
.sc-node[data-type="place"] { fill: #b794ff; }
.sc-node[data-type="seizure"] { fill: #cbd5e1; }
.sc-node[data-type="seal"] { fill: #38bdf8; }
.sc-node[data-type="phone"] { fill: #34d399; }
.sc-node[data-type="permit"] { fill: #fbbf24; }
.sc-node-repeat { stroke: #fff; stroke-width: 2; }

/* Hotspot map: the drawn AP map, real pins and district rings. */
#app #workspace-shell #main .showcase-map { --tile: var(--ap-marigold, #ff8a00); background: #dbe8ff; }
.sc-ring, .sc-ripple { fill: rgba(255, 92, 141, .2); stroke: #c2185b; stroke-width: 1.4; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; }
.sc-ripple { fill: none; stroke-width: 2; opacity: 0; }
.sc-pin-body { transform-box: fill-box; transform-origin: 50% 100%; }
.sc-pan { transform-box: view-box; transform-origin: center; }
.sc-pin path { fill: #c2185b; stroke: #fff; stroke-width: 1.6; }
.sc-pin circle { fill: #fff; }

/* CRM: five follow-up columns. */
#app #workspace-shell #main .showcase-crm { --tile: var(--ap-gold, #ffb300); background: linear-gradient(150deg, #2447d8 0%, #4b2bbf 60%, #6d28d9 100%); }
#app #workspace-shell #main .showcase-crm .showcase-preview { inset: auto 12px 12px; height: calc(100% - 104px); }
.sc-crm { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; height: 100%; }
.sc-crm-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; overflow: hidden; padding: 6px 5px; border-radius: 10px; background: rgba(255, 255, 255, .14); }
.sc-crm-head { display: grid; gap: 0; min-width: 0; color: #fff; line-height: 1.15; }
.sc-crm-head b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sc-crm-head small { overflow: hidden; color: #e3ecff; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sc-crm-card { display: block; flex: none; height: 16px; border-radius: 5px; border-inline-start: 4px solid #93c5fd; background: #fff; }
.sc-crm-card[data-tone="high"] { border-color: #ff5c8d; }
.sc-crm-card[data-tone="overdue"] { border-color: #ffb300; background: #fff4dc; }
.sc-crm-card[data-tone="low"] { border-color: #2dd4bf; }
/* The travelling card: one column wide (column minus its padding), stepping one column pitch at a
   time to the column --at (set by startCrmTravel in feature-launchpad.js, which moves the counts with it). */
.sc-crm-mover { position: absolute; bottom: 8px; inset-inline-start: 5px; display: block; width: calc((100% - 24px) / 5 - 10px); height: 16px; border-radius: 5px; border-inline-start: 4px solid #ff5c8d; background: #fff; box-shadow: 0 6px 14px rgba(7, 26, 61, .35); opacity: 0; transform: translateX(calc(var(--at, 0) * (100% + 16px))); }
.sc-crm-mover[data-tone="overdue"] { border-color: #ffb300; background: #fff4dc; }
.sc-crm-mover[data-tone="low"] { border-color: #2dd4bf; }
.sc-crm-mover[data-tone="normal"] { border-color: #93c5fd; }

/* Casebook: paper cards and coloured strings on a dark board. */
#app #workspace-shell #main .showcase-casebook { --tile: #b01722; --scrim: 43, 26, 16; background: radial-gradient(120% 100% at 50% 60%, #5b3a22 0%, #2b1a10 80%); }
.showcase-casebook .showcase-preview { inset: 76px 0 0; }
.sc-card rect { fill: #fffaf0; stroke: rgba(43, 26, 16, .35); stroke-width: .8; }
.sc-card[data-kind="fir"] rect:first-child { fill: #fff; }
.sc-fir-band { fill: #2447d8; }
.sc-lines { stroke: #94a3b8; stroke-width: 2; stroke-linecap: round; }
.sc-place { fill: #c2185b; }
.sc-tack { fill: #e11d48; stroke: #7f1d1d; stroke-width: .8; }
.sc-string { fill: none; stroke-width: 1.6; stroke-linecap: round; opacity: .92; }
.sc-sway { transform-box: fill-box; transform-origin: 50% 0; }
.sc-graph { transform-box: view-box; transform-origin: center; }

/* Analytics: monthly incident bars with a trend line. */
#app #workspace-shell #main .showcase-analytics { --tile: var(--ap-rose-2, #ff5c8d); background: linear-gradient(140deg, #6d28d9 0%, #a21caf 60%, #c2185b 100%); }
.showcase-analytics .showcase-preview { inset: auto 14px 10px auto; width: 56%; height: 72%; }
.sc-bar { fill: rgba(255, 255, 255, .55); transform-box: fill-box; transform-origin: bottom; }
.sc-bar-peak { fill: #ffb300; }
.sc-spark, .sc-spark-glow { fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sc-spark-glow { stroke: #ffe08a; stroke-width: 4; stroke-linecap: round; stroke-dasharray: .07 .93; stroke-dashoffset: 1; opacity: 0; }

/* Case video: a player frame and its five scenes. */
#app #workspace-shell #main .showcase-video { --tile: #2dd4bf; background: linear-gradient(135deg, #071a3d 0%, #14206b 100%); }
.showcase-video .showcase-preview { inset: auto 14px 12px 42%; }
.sc-video { display: grid; gap: 6px; }
.sc-video-screen { position: relative; display: flex; align-items: center; justify-content: center; height: 52px; border-radius: 10px; background: linear-gradient(120deg, #2346d8, #b42971 55%, #a86508); }
.sc-video-play { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; }
.sc-video-play svg { width: 16px; height: 16px; fill: #2346d8; transform: translateX(1px); }
.sc-video-ref { position: absolute; inset-inline-start: 8px; bottom: 4px; color: #fff; font-size: 11px; font-weight: 700; }
.sc-video-strip { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.sc-scene { display: grid; min-width: 0; padding: 3px 4px; overflow: hidden; border-radius: 6px; background: var(--scene); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1.15; white-space: nowrap; text-overflow: ellipsis; }
.sc-scene b { font-size: 9.5px; opacity: .85; }
.sc-scene[data-scene="overview"] { --scene: #2346d8; }
.sc-scene[data-scene="who"] { --scene: #087b70; }
.sc-scene[data-scene="where"] { --scene: #2459ca; }
.sc-scene[data-scene="what"] { --scene: #b42971; }
.sc-scene[data-scene="when"] { --scene: #a86508; }
/* Full-width and transparent, so moving it by its own width carries the 3px head across the strip. */
.sc-playhead { position: absolute; inset-block: -3px; inset-inline-start: 0; width: 100%; border-inline-end: 3px solid #ffb300; translate: -100% 0; pointer-events: none; }

/* Case assistant: a question chip and the reply on its way. */
#app #workspace-shell #main .showcase-assistant { --tile: #34d399; --scrim: 6, 78, 71; background: linear-gradient(135deg, #064e47 0%, #0b7f73 60%, #14b8a6 100%); }
.showcase-assistant .showcase-preview { inset: auto 14px 8px 14px; }
.showcase-assistant .sc-chat-ask { padding: 4px 9px; font-size: 11.5px; }
.sc-chat { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.sc-chat-ask { flex: none; max-width: 70%; padding: 5px 10px; border-radius: 12px 12px 3px 12px; background: #fff; color: #064e47; font-size: 12px; font-weight: 700; line-height: 1.3; }
.sc-chat-reply { align-self: flex-start; flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 5px 10px; border-radius: 12px 12px 12px 3px; background: rgba(255, 255, 255, .22); }
.sc-chat-reply i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.sc-chat-note { margin-inline-start: 4px; overflow: hidden; color: #fff; font-size: 11.5px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }

/* Law library: the four statute covers. */
#app #workspace-shell #main .showcase-laws { --tile: var(--ap-gold, #ffb300); --scrim: 90, 22, 24; background: linear-gradient(135deg, #b32d30 0%, #b45309 100%); }
.showcase-laws .showcase-preview { inset: auto 10px 0 auto; height: 56px; }
.sc-books { display: flex; align-items: flex-end; height: 100%; }
.sc-books img { width: 40px; height: auto; margin-inline-start: -14px; border-radius: 3px 7px 7px 3px; box-shadow: -4px 6px 14px rgba(0, 0, 0, .35); transform: rotate(calc((var(--i) - 1.5) * 5deg)) translateY(12px); transform-origin: bottom center; }

/* People: drawn portraits fanned on the right. */
#app #workspace-shell #main .showcase-people { --tile: #14b8a6; --scrim: 6, 78, 71; background: linear-gradient(120deg, #064e47, #0b7f73 60%, #14b8a6); }
.showcase-people .showcase-preview { inset: auto 10px 10px auto; }
.sc-faces { display: flex; align-items: flex-end; }
.sc-faces img { width: 42px; height: 42px; margin-inline-start: -14px; border: 2px solid #fff; border-radius: 15px; background: #e3f6f2; box-shadow: 0 6px 14px rgba(7, 26, 61, .28); }

/* Motion: previews arrive with their own entrance, then keep a quiet ambient loop: the network
   sways with flowing edges and pulsing repeats, map pins pulse under rippling hotspots while the
   map drifts, Casebook strings draw and cards sway, bars regrow under a moving trend line, and a
   CRM card travels across the columns. Only transforms, opacity and stroke offsets animate;
   nothing moves the tile itself. Tiles off screen or in a hidden tab carry data-motion="off"
   (feature-launchpad.js) and pause. Reduced motion declares none of this. */
@media (prefers-reduced-motion: no-preference) {
  /* Network */
  .sc-graph { animation: sc-orbit 16s ease-in-out infinite alternate; }
  .sc-node { animation: sc-pop 420ms var(--ease, ease-out) both, sc-drift 3.6s ease-in-out infinite alternate; animation-delay: calc(var(--i) * 35ms), calc(var(--i) * -310ms); }
  .sc-node-repeat { animation: sc-pop 420ms var(--ease, ease-out) both, sc-drift 3.6s ease-in-out infinite alternate, sc-pulse 1.1s ease-in-out infinite alternate; animation-delay: calc(var(--i) * 35ms), calc(var(--i) * -310ms), calc(var(--i) * 90ms); }
  .sc-edge { stroke-dasharray: 4 3; animation: sc-flow 2.4s linear infinite; }
  .sc-edge-repeat { stroke-dasharray: 6 4; animation: sc-flow 1s linear infinite; }

  /* Hotspot map */
  .sc-pan { animation: sc-pan 22s ease-in-out infinite alternate; }
  .sc-pin { animation: sc-fade 360ms ease-out both; animation-delay: calc(var(--i) * 30ms); }
  .sc-pin-body { animation: sc-drop 460ms cubic-bezier(.3, 1.4, .5, 1) both, sc-beat 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 30ms), calc(600ms + var(--i) * 170ms); }
  .sc-ripple { animation: sc-ripple 2.6s ease-out infinite; animation-delay: calc(var(--i) * 330ms); }

  /* Casebook */
  .sc-sway { animation: sc-sway 4.8s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -420ms); }
  .sc-string { stroke-dasharray: 600; animation: sc-redraw 9s ease-in-out infinite; animation-delay: calc(var(--i) * 450ms); }

  /* Analytics */
  .sc-bar { animation: sc-regrow 6s var(--ease, ease-out) infinite; animation-delay: calc(var(--i) * 60ms); }
  .sc-spark { stroke-dasharray: 1; animation: sc-trace 6s ease-in-out infinite; }
  .sc-spark-glow { animation: sc-comet 3s linear infinite; }

  /* CRM */
  .sc-crm-card { animation: sc-slide 380ms var(--ease, ease-out) both; animation-delay: calc(var(--j) * 60ms); }
  .sc-crm-mover { transition: transform 600ms cubic-bezier(.6, 0, .3, 1), opacity 300ms ease; }
  .sc-crm[data-travel="on"] .sc-crm-mover:not([data-off]) { opacity: 1; }
  :is(.sc-crm-head > b, .showcase-crm .showcase-count > strong).sc-tick { display: inline-block; animation: sc-tick-up 420ms var(--ease, ease-out) both; }
  :is(.sc-crm-head > b, .showcase-crm .showcase-count > strong).sc-tick[data-tick="down"] { animation-name: sc-tick-down; }

  /* The rest */
  .sc-playhead { animation: sc-play 6s linear infinite; }
  .sc-chat-reply i { animation: sc-type 1.1s ease-in-out infinite; }
  .sc-chat-reply i:nth-child(2) { animation-delay: 180ms; }
  .sc-chat-reply i:nth-child(3) { animation-delay: 360ms; }
  .sc-books img { animation: sc-book 5s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -1.1s); }
  .sc-faces img { animation: sc-bob 3.4s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.8s); }

  #app #workspace-shell #main .showcase-tile[data-motion="off"] :is(svg, svg *, .sc-crm *, .sc-video *, .sc-chat *, .sc-books *, .sc-faces *) { animation-play-state: paused; }
}
@keyframes sc-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes sc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-drop { from { translate: 0 -26px; } to { translate: 0 0; } }
@keyframes sc-beat { 0%, 70%, 100% { scale: 1; } 80% { scale: 1.28; } 90% { scale: .96; } }
@keyframes sc-slide { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sc-orbit { from { rotate: -4deg; scale: .97; } to { rotate: 4deg; scale: 1.03; } }
@keyframes sc-drift { from { translate: calc(var(--dx) * -1) calc(var(--dy) * -1); } to { translate: var(--dx) var(--dy); } }
@keyframes sc-pulse { from { scale: 1; } to { scale: 1.4; } }
@keyframes sc-flow { to { stroke-dashoffset: -14; } }
@keyframes sc-pan { from { scale: 1.08; translate: -3% -2%; } to { scale: 1.1; translate: 3% 2%; } }
@keyframes sc-ripple { 0% { scale: .8; opacity: .9; } 100% { scale: 1.9; opacity: 0; } }
@keyframes sc-sway { from { rotate: -2.2deg; } to { rotate: 2.2deg; } }
@keyframes sc-redraw { 0% { stroke-dashoffset: 600; } 22%, 78% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -600; } }
@keyframes sc-regrow { 0% { transform: scaleY(.08); } 18%, 82% { transform: scaleY(1); } 100% { transform: scaleY(.08); } }
@keyframes sc-trace { 0% { stroke-dashoffset: 1; } 30%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
@keyframes sc-comet { 0% { stroke-dashoffset: 1; opacity: 0; } 10%, 90% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sc-tick-up { from { transform: translateY(45%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sc-tick-down { from { transform: translateY(-45%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sc-play { from { translate: -100% 0; } to { translate: 0 0; } }
@keyframes sc-type { 0%, 100% { opacity: .35; transform: none; } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes sc-book { from { rotate: -2deg; } to { rotate: 2deg; } }
@keyframes sc-bob { from { translate: 0 0; } to { translate: 0 -4px; } }

/* Desktop: the video copy keeps to the left of its player, so a long (Telugu) unit wraps instead of
   running under the screen. Laptops (1366): a taller last row keeps a wrapped count clear of the
   Chitti AI chat chips and the People portraits; up to 1500 px, where the content column also keeps
   clear of the round Chitti AI button (src/chitti-launcher.css). */
@media (min-width: 1181px) {
  #app #workspace-shell #main .showcase-video .showcase-copy { max-width: calc(42% - 6px); padding-inline-end: 0; }
}
@media (min-width: 1181px) and (max-width: 1500px) {
  #app #workspace-shell #main .feature-showcase { grid-template-rows: 280px 140px 168px; }
}

/* Tablets and small laptops: six columns, heroes still first. */
@media (max-width: 1180px) {
  #app #workspace-shell #main .feature-showcase {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: 250px 200px 132px 120px;
    grid-template-areas:
      "net net map map book book"
      "crm crm crm ana ana ana"
      "vid vid vid ast ast ast"
      "law law law ppl ppl ppl";
  }
}

/* Phones: network and map fill the first screen, Casebook and CRM follow, the rest pair up. */
@media (max-width: 760px) {
  #app #workspace-shell #main .feature-showcase {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 212px 190px 200px 160px 132px 150px 140px;
    grid-template-areas: "net net" "map map" "book book" "crm crm" "ana ana" "vid ast" "law ppl";
    gap: 10px;
    margin-bottom: 18px;
  }
  #app #workspace-shell #main .showcase-copy { padding: 12px 12px 0; }
  #app #workspace-shell #main .showcase-title,
  #app #workspace-shell #main :is(.showcase-network, .showcase-map, .showcase-casebook) .showcase-title { font-size: 17px; }
  #app #workspace-shell #main .showcase-count > strong { font-size: 24px; }
  #app #workspace-shell #main :is(.showcase-network, .showcase-map, .showcase-casebook) .showcase-count > strong { font-size: 28px; }
  #app #workspace-shell #main .showcase-count > span { font-size: 13px; }
  #app #workspace-shell #main .showcase-crm .showcase-preview { height: calc(100% - 92px); }
  .showcase-analytics .showcase-preview { inset: auto 10px 8px auto; width: 58%; height: 70%; }
  .showcase-video .showcase-preview, .showcase-assistant .showcase-preview { inset: auto 10px 10px; }
  .sc-video-screen { height: 34px; }
  .sc-video-ref { display: none; }
  .sc-chat-reply { padding: 4px 8px; }
  .sc-chat-note { font-size: 11px; }
  .sc-chat-ask { max-width: 100%; font-size: 11.5px; }
  #app #workspace-shell #main .showcase-copy:lang(te) .showcase-title { font-size: 15.5px; }
  .showcase-laws .showcase-preview { height: 50px; }
  .sc-books img { width: 32px; margin-inline-start: -10px; }
  .sc-scene { font-size: 0; padding: 0; height: 8px; }
  .sc-scene b { display: none; }
  .showcase-casebook .showcase-preview { inset: 64px 0 0; }
}
@media (forced-colors: active) {
  #app #workspace-shell #main .showcase-tile { border: 2px solid LinkText; }
  #app #workspace-shell #main :is(.showcase-network, .showcase-map, .showcase-casebook)::after { background: Canvas; opacity: .85; }
}
