/* iGrid017: the Makueni digital superhighway view. Built on the eServices tokens. */

.igrid {
  --t-green: #198754;
  --t-blue: #0072bc;
  --t-purple: #6f42c1;
  --t-teal: #0f8b7d;
  --t-slate: #52606d;
  --t-navy: #1f3a68;
  --t-amber: #b7791f;
  --t-rose: #c2415d;
  --flow: #e8590c;
  padding-bottom: 56px;
}

.site-nav a[aria-current="true"] {
  background: rgba(0, 114, 188, 0.1);
  color: var(--blue-deep);
}

/* ── Hero figures ── */
.nx-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.nx-stats li {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.nx-stats b {
  display: block;
  color: var(--blue-deep);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.nx-stats span {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Sections ── */
.nx-block {
  margin-top: clamp(36px, 5vw, 56px);
}

.nx-head {
  margin-bottom: 14px;
}

.nx-flowbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nx-flowbar__label {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nx-flow-no {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--flow, #e8590c);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Architecture diagram ── */
.nx-arch-wrap {
  max-width: 1440px;
  margin: 18px auto 0;
  padding-inline: var(--gutter);
}

.nx-arch {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(130px, 0.85fr) minmax(0, 3fr) minmax(0, 2.25fr);
  gap: 56px;
  align-items: start;
  padding: 44px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: radial-gradient(circle, #dfe5ee 1px, transparent 1px);
  background-size: 18px 18px;
}

.nx-col {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.nx-wires {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.nx-wire {
  fill: none;
  stroke: #8a97a8;
  stroke-width: 1.5;
}

.nx-wire.is-on {
  stroke: var(--flow, #e8590c);
  stroke-width: 2.5;
}

.nx-wire-label {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 0 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* Groups: a thin coloured frame with a label chip, as in cloud architecture diagrams. */
.nx-group {
  --tone: var(--t-slate);
  position: relative;
  min-width: 0;
  padding: 30px 12px 12px;
  border: 1.5px solid var(--tone);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
}

.nx-group .nx-group {
  border-style: dashed;
  background: #fff;
}

.nx-group__label {
  position: absolute;
  top: -1px;
  left: -1px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100% + 2px);
  padding: 4px 10px 4px 4px;
  border-radius: 6px 0 6px 0;
  background: var(--tone);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-group__chip {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.28);
}

.nx-group__note {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.nx-group__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px 8px;
}

.nx-col--users .nx-group__tiles,
.nx-col--channels .nx-group__tiles {
  grid-template-columns: 1fr;
  gap: 14px;
}

.nx-col--right .nx-group__tiles {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nx-group--core {
  display: grid;
  gap: 22px;
  padding: 34px 16px 16px;
  border-width: 2px;
}

.nx-core-modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.nx-group--docked {
  display: grid;
  gap: 14px;
}

.nx-tone-green { --tone: var(--t-green); }
.nx-tone-blue { --tone: var(--t-blue); }
.nx-tone-purple { --tone: var(--t-purple); }
.nx-tone-teal { --tone: var(--t-teal); }
.nx-tone-slate { --tone: var(--t-slate); }
.nx-tone-navy { --tone: var(--t-navy); }
.nx-tone-amber { --tone: var(--t-amber); }
.nx-tone-rose { --tone: var(--t-rose); }
.nx-tone-sky { --tone: #0b7fab; }

/* Tiles: square service icon over a short label. */
.nx-tile {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  padding: 6px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.2s ease;
}

.nx-tile:hover {
  background: rgba(15, 27, 45, 0.05);
}

.nx-tile__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--tone);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 27, 45, 0.18);
}

.nx-tile__icon .icon {
  width: 24px;
  height: 24px;
}

.nx-tile__name {
  max-width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.nx-tile.is-selected .nx-tile__icon {
  outline: 3px solid var(--tone);
  outline-offset: 3px;
}

.nx-step-badge {
  position: absolute;
  top: -4px;
  right: 50%;
  margin-right: -32px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--flow);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  animation: nx-pop 0.3s ease;
}

.nx-arch.is-flowing .nx-tile:not(.in-flow) {
  opacity: 0.3;
}

.nx-arch.is-flowing .nx-tile.in-flow .nx-tile__icon {
  outline: 3px solid var(--flow);
  outline-offset: 3px;
}

/* ── Flow narration ── */
.nx-flow-panel {
  margin-top: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--flow, #e8590c);
  border-radius: var(--radius);
  background: var(--surface);
}

.nx-flow-panel h3 {
  font-size: 1.125rem;
}

.nx-flow-panel > p {
  margin-top: 4px;
  color: var(--muted);
}

.nx-flow-steps {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.nx-flow-steps li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
}

.nx-flow-steps .nx-flow-no {
  --flow: #e8590c;
  width: 24px;
  height: 24px;
}

.nx-flow-steps b {
  display: block;
  font-size: 0.9375rem;
}

.nx-flow-steps span {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.nx-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* ── Detail drawer ── */
.nx-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(420px, 100%);
  padding: 28px 26px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -16px 0 40px rgba(15, 27, 45, 0.12);
  animation: nx-slide 0.22s ease;
}

.nx-drawer__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-2);
  font-size: 1.375rem;
  line-height: 1;
  cursor: pointer;
}

.nx-drawer__group {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tone);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.nx-drawer__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-right: 40px;
}

.nx-drawer__head .nx-tile__icon {
  flex: none;
  width: 52px;
  height: 52px;
}

.nx-drawer h3 {
  font-size: 1.25rem;
  line-height: 1.25;
}

.nx-drawer p {
  margin-top: 14px;
  color: var(--ink-2);
}

.nx-drawer h4 {
  margin: 20px 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nx-drawer ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-2);
}

.nx-drawer li + li {
  margin-top: 4px;
}

.nx-drawer__open {
  display: inline-block;
  margin-top: 20px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.nx-drawer__open:hover {
  background: var(--blue-deep);
}

/* ── Diagram key ── */
.nx-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.8125rem;
}

.nx-key li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nx-key__line {
  position: relative;
  width: 28px;
  height: 2px;
  background: #8a97a8;
}

.nx-key__line::after,
.nx-key__line--both::before {
  content: "";
  position: absolute;
  top: -4px;
  border: 5px solid transparent;
}

.nx-key__line::after {
  right: -4px;
  border-left-color: #8a97a8;
}

.nx-key__line--both::before {
  left: -4px;
  border-right-color: #8a97a8;
}

.nx-key__box {
  width: 18px;
  height: 14px;
  border: 1.5px dashed var(--t-slate);
  border-radius: 3px;
}

.nx-key__step {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--flow);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
}

@keyframes nx-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes nx-slide {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Narrower screens: the diagram stacks top to bottom and the wires give way to order. */
@media (max-width: 1100px) {
  .nx-arch {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 36px 14px 14px;
  }

  .nx-col--users .nx-group__tiles,
  .nx-col--channels .nx-group__tiles,
  .nx-col--right .nx-group__tiles {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .nx-wires,
  .nx-wire-label {
    display: none;
  }
}

@media (max-width: 640px) {
  .nx-core-modules {
    grid-template-columns: 1fr;
  }



  .nx-drawer {
    top: auto;
    max-height: 78vh;
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nx-step-badge,
  .nx-drawer {
    animation: none;
  }
}

/* Text runs the full width of the page, not a narrow column. */
.hero__content[data-igrid-view] .lead,
.igrid .category__head p {
  max-width: none;
}

.igrid .category__head {
  display: block;
}

.igrid .category__head p {
  margin-top: 6px;
}

.nx-col--right .nx-tile__name {
  font-size: 0.6875rem;
  overflow-wrap: normal;
  hyphens: manual;
}
