/* ==========================================================================
   SYSTEM MAP — animated flow chart (Forcepoint-style), light surface
   Inline SVG wires drawn by system-map.js between HTML cards.
   Rails: dashed slate, static. Packets: <circle> riding the rail (SMIL).
   Hover: the touched card's wires turn brand-purple and drift; the rest dims.
   ========================================================================== */

/* ---- light body tokens (section-scoped; phase 3 moves this to site.css) -- */
.light {
  --bg: #f7f6fa; --surface: #fff; --surface-2: #f1eff6;
  --text: #17141f; --muted: #5d5869;
  --hairline: rgba(23, 20, 31, .09); --shell: rgba(23, 20, 31, .03);
  background: var(--bg); color: var(--text);
  position: relative; z-index: 1; /* paints over the hero glow that spills past its section */
}
.light h1, .light h2, .light h3, .light h4 { color: var(--text); }
.light .btn-ghost { color: var(--text); border-color: rgba(23, 20, 31, .16); background: #fff; }
.light .btn-ghost:hover { border-color: rgba(126, 34, 206, .5); }
.light .chips span { color: var(--text); background: #fff; }
.light .eyebrow { background: #fff; }
.light .bezel { box-shadow: 0 0 0 1px rgba(23, 20, 31, .02), 0 24px 60px -30px rgba(23, 20, 31, .25); background: var(--surface); }
.light .glow { display: none; }
.light .sub, .light .map-cap { color: var(--muted); }

/* ---- component shell ------------------------------------------------------ */
.smap {
  --smap-ink: #17141f; --smap-muted: #6b667a;
  --smap-line: #cfcbd9;
  --smap-purple: #7e22ce; --smap-fuchsia: #d946ef; --smap-orange: #f97316;
  --smap-green: #16a34a; --smap-red: #ef4444;
  --smap-shadow: 0 14px 34px -22px rgba(23, 20, 31, .35), 0 2px 6px -2px rgba(23, 20, 31, .08);
  position: relative; margin-top: 3rem; text-align: left;
}
.smap-stage { position: relative; display: grid; gap: 0 72px; align-items: stretch; }
.smap-col { display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; z-index: 1; min-width: 0; }
.smap-col-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--smap-muted); margin-bottom: -6px;
}
.smap-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 0; pointer-events: none; }

/* radial (homepage): the columns dissolve into one grid with named areas */
@media (min-width: 901px) {
  .smap-radial .smap-stage { grid-template-rows: auto auto auto auto; gap: 44px 0; align-items: center; justify-items: center; padding: 10px 0; }
  .smap-radial .smap-col { display: contents; }
  .smap-radial .smap-col-label { display: none; }
  .smap-radial .smap-node { position: relative; z-index: 1; }
  .smap-radial .area-l1, .smap-radial .area-l2, .smap-radial .area-bl { justify-self: end; }
  .smap-radial .area-r1, .smap-radial .area-r2, .smap-radial .area-br { justify-self: start; }
  .smap-radial .area-bl { margin-right: -40px; }
  .smap-radial .area-br { margin-left: -40px; }
}

/* ---- cards ---------------------------------------------------------------- */
.smap-node {
  display: flex; align-items: center; gap: 14px; position: relative;
  background: #fff; border: 1px solid rgba(23, 20, 31, .09); border-radius: 16px;
  padding: 14px 18px; color: var(--smap-ink); text-decoration: none;
  box-shadow: var(--smap-shadow);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), opacity .4s var(--ease), border-color .4s var(--ease);
}
.smap-node.has-detail, .smap-node[href] { cursor: pointer; }
.smap-node:hover, .smap-node:focus-visible, .smap-node.lit {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px -24px rgba(126, 34, 206, .4), 0 2px 6px -2px rgba(23, 20, 31, .08);
  border-color: rgba(126, 34, 206, .4); outline: none;
}
.smap-body { display: block; min-width: 0; }
.smap-tag { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--smap-muted); margin-bottom: 5px; }
.smap-title { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.04rem; line-height: 1.2; letter-spacing: -.01em; color: var(--smap-ink); }
.smap-text { display: block; font-size: .86rem; line-height: 1.45; color: var(--smap-muted); margin-top: 3px; }
.smap-tile {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center;
  background: #fff; color: var(--smap-purple); border: 1px solid rgba(23, 20, 31, .08);
  box-shadow: 0 8px 18px -12px rgba(23, 20, 31, .35);
}
.smap-ico { width: 26px; height: 26px; }

/* pill: label only, like the reference's data sources */
.kind-pill { padding: 14px 22px; border-radius: 14px; }
.kind-pill .smap-title { font-family: var(--font-body); font-weight: 500; font-size: 1rem; letter-spacing: 0; white-space: nowrap; }
.kind-pill .smap-text { font-size: .78rem; margin-top: 1px; white-space: nowrap; }

/* card: icon tile + title + one line, like the reference's AI cards */
.kind-card { padding: 16px 22px 16px 16px; border-radius: 18px; background: linear-gradient(180deg, #fff, #fbf8ff); border-color: rgba(126, 34, 206, .28); min-width: 250px; }
.kind-card .smap-text { white-space: nowrap; }

/* hub: icon over two lines, with two stacked shells behind it */
.kind-hub {
  flex-direction: column; text-align: center; gap: 10px;
  width: 210px; padding: 26px 22px 22px; border-radius: 22px;
  background: #fff; border-color: rgba(126, 34, 206, .3);
  /* two stacked shells behind the hub, like the reference */
  box-shadow:
    0 0 0 14px rgba(255, 255, 255, .75), 0 0 0 15px rgba(126, 34, 206, .13),
    0 0 0 28px rgba(255, 255, 255, .5), 0 0 0 29px rgba(126, 34, 206, .08),
    0 30px 60px -26px rgba(126, 34, 206, .4);
  margin: 30px 0;
}
.kind-hub .smap-tile { width: 60px; height: 60px; border: none; box-shadow: none; background: transparent; }
.kind-hub .smap-ico { width: 44px; height: 44px; stroke-width: 1.4; }
.kind-hub .smap-title { font-size: 1.15rem; color: var(--smap-purple); }
.kind-hub .smap-text { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--smap-purple); margin-top: 0; line-height: 1.2; }
.kind-hub:hover, .kind-hub.lit, .kind-hub:focus-visible {
  transform: none; border-color: rgba(126, 34, 206, .5);
  box-shadow:
    0 0 0 14px rgba(255, 255, 255, .75), 0 0 0 15px rgba(126, 34, 206, .13),
    0 0 0 28px rgba(255, 255, 255, .5), 0 0 0 29px rgba(126, 34, 206, .08),
    0 30px 60px -26px rgba(126, 34, 206, .5);
}

/* lane map kinds */
.kind-lane { display: block; background: #fff; border-color: rgba(23, 20, 31, .09); padding: 16px 18px; }
.kind-store { background: #f2fdf7; border-color: rgba(22, 163, 74, .35); }
.kind-store .smap-tile { color: var(--smap-green); }
.kind-app { background: linear-gradient(180deg, #fff, #fff8f2); border-color: rgba(249, 115, 22, .4); }
.kind-app .smap-tile { color: var(--smap-orange); }
.kind-team { background: linear-gradient(180deg, #fff, #fdf5ff); border-color: rgba(217, 70, 239, .38); }
.kind-team .smap-tile { color: var(--smap-fuchsia); }
.kind-error { display: block; background: #fff6f6; border-color: rgba(239, 68, 68, .4); padding: 14px 18px; }
.kind-error .smap-tag { color: var(--smap-red); }
.kind-error .smap-title { font-size: .95rem; }

/* workflow buttons inside a lane */
.smap-items { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.smap-item {
  font: inherit; font-size: .8rem; font-weight: 500; line-height: 1.25; text-align: left;
  color: var(--smap-ink); background: #fff; border: 1px solid rgba(23, 20, 31, .14); border-radius: 10px;
  padding: 7px 10px; cursor: pointer;
  transition: border-color .3s var(--ease), color .3s var(--ease), background .3s var(--ease), transform .3s var(--ease);
}
.smap-item.featured { border-color: rgba(126, 34, 206, .45); font-weight: 700; }
.smap-item:hover, .smap-item:focus-visible { border-color: var(--smap-purple); color: var(--smap-purple); outline: none; transform: translateY(-1px); }
.smap-item.is-selected { background: var(--smap-purple); border-color: var(--smap-purple); color: #fff; }
.smap-item.bench { display: none; }
.smap-node.is-open .smap-item.bench { display: inline-block; }
.smap-more {
  font: inherit; font-size: .78rem; font-weight: 600; color: var(--smap-purple);
  background: none; border: 1px dashed rgba(126, 34, 206, .4); border-radius: 10px; padding: 7px 10px; cursor: pointer;
}
.smap-more:hover { background: rgba(126, 34, 206, .06); }

/* ---- wires ---------------------------------------------------------------- */
.smap-edge { transition: opacity .35s var(--ease); }
.smap-rail { fill: none; stroke: var(--smap-line); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 4 7; }
.smap-flow {
  fill: none; stroke: var(--smap-purple); stroke-width: 1.8; stroke-linecap: round;
  stroke-dasharray: 4 7; opacity: 0;
  animation: smap-dash 1.1s linear infinite;
  transition: opacity .35s var(--ease);
}
@keyframes smap-dash { to { stroke-dashoffset: -11; } }
.smap-edge.lit .smap-flow { opacity: .9; }
.smap-edge.kind-error .smap-rail { stroke: rgba(239, 68, 68, .35); }
.smap-edge.kind-error .smap-flow { stroke: var(--smap-red); }
.smap-edge.kind-back .smap-flow { stroke: var(--smap-orange); animation-direction: reverse; }
.smap-bend { fill: #fff; stroke: var(--smap-line); stroke-width: 1.6; }
.smap-edge.lit .smap-bend { stroke: var(--smap-purple); }
.smap-dot.end { fill: #fff; stroke: #b9b3c9; stroke-width: 1.8; }
.smap-dot.port { fill: var(--smap-purple); stroke: #fff; stroke-width: 2; }
.smap-edge.kind-error .smap-dot.port, .smap-edge.kind-error .smap-dot.end { stroke: var(--smap-red); }
.smap-edge.kind-back .smap-dot.end { stroke: var(--smap-orange); }
.smap-edge.lit .smap-dot.end { stroke: var(--smap-purple); }
.smap-pkt { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 1)) drop-shadow(0 0 6px rgba(147, 51, 234, .75)); }
.smap-edge.kind-error .smap-pkt { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 1)) drop-shadow(0 0 6px rgba(239, 68, 68, .8)); }
.smap-edge.kind-back .smap-pkt { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 1)) drop-shadow(0 0 6px rgba(249, 115, 22, .8)); }
.smap-lbl {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; fill: var(--smap-muted);
  paint-order: stroke; stroke: #f7f6fa; stroke-width: 4px; stroke-linejoin: round; text-anchor: middle;
}

/* hover focus: the touched node and its wires stay, the rest dims */
.smap.is-focus .smap-node:not(.lit) { opacity: .45; }
.smap.is-focus .smap-edge:not(.lit) { opacity: .25; }

/* off-screen: CSS motion paused (SMIL is paused from JS) */
.smap.is-off .smap-flow { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .smap-flow { animation: none; }
  .smap-pkt { display: none; }
  .smap-col + .smap-col::after { animation: none; }
}

/* ---- detail panel --------------------------------------------------------- */
.smap-panel {
  position: relative; margin-top: 22px;
  background: #fff; border: 1px solid rgba(126, 34, 206, .3); border-radius: 18px; padding: 22px 24px;
  display: grid; gap: 20px;
  box-shadow: 0 24px 50px -30px rgba(126, 34, 206, .4);
}
.smap-panel[hidden] { display: none; }
@media (min-width: 760px) { .smap-panel.has-img { grid-template-columns: 1fr 320px; align-items: start; } }
.smap-panel .close {
  position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(23, 20, 31, .12); background: #fff; color: var(--smap-muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.smap-panel .close:hover { color: var(--smap-ink); border-color: rgba(23, 20, 31, .3); }
.smap-panel .smap-tag { margin-bottom: 8px; }
.smap-panel h4 { font-size: 1.25rem; padding-right: 40px; }
.smap-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin-top: 14px; font-size: .9rem; }
.smap-panel dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--smap-muted); padding-top: 4px; }
.smap-panel dd { margin: 0; color: var(--smap-ink); line-height: 1.5; }
.smap-panel .note { margin-top: 12px; font-size: .88rem; color: var(--smap-muted); line-height: 1.55; }
.smap-panel figure { margin: 0; }
.smap-panel img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid rgba(23, 20, 31, .1); }
.smap-panel figcaption { font-size: .75rem; color: var(--smap-muted); margin-top: 6px; }
.smap-panel figcaption a { color: var(--smap-purple); }

/* ---- phones: vertical stack, wires replaced by a dashed spine with a packet */
@media (max-width: 900px) {
  .smap-stage { display: flex; flex-direction: column; gap: 0; }
  .smap-wires { display: none; }
  .smap-col { gap: 12px; }
  .smap-col + .smap-col { padding-top: 54px; }
  .smap-col + .smap-col::before {
    content: ""; position: absolute; left: 50%; top: 8px; height: 38px;
    border-left: 2px dashed rgba(126, 34, 206, .45); transform: translateX(-50%);
  }
  .smap-col + .smap-col::after {
    content: ""; position: absolute; left: 50%; top: 6px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%;
    background: radial-gradient(circle, #fff 0 25%, #d946ef 60%, #7e22ce);
    box-shadow: 0 0 6px rgba(217, 70, 239, .8);
    animation: smap-drop 1.6s linear infinite;
  }
  @keyframes smap-drop { to { transform: translateY(34px); } }
  .smap-col-label { margin-bottom: 0; }
  .kind-hub { width: auto; align-self: stretch; }
  .kind-hub { box-shadow: var(--smap-shadow); margin: 0; }
  .kind-card { min-width: 0; }
  .kind-card .smap-text, .kind-pill .smap-title, .kind-pill .smap-text { white-space: normal; }
  .smap.is-focus .smap-node:not(.lit), .smap.is-focus .smap-edge:not(.lit) { opacity: 1; }
  .smap-panel { margin-top: 0; padding: 18px; }
}
