/* Network Visualizer — ChrisCloud learning lab */
:root {
  --bg: #0c0e12;
  --panel: #141820;
  --border: #2a3140;
  --text: #e8eaed;
  --muted: #8b939e;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.2);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.2);
  --grey: #64748b;
  --grey-dim: rgba(100, 116, 139, 0.25);
  --red: #ef4444;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  overflow-x: hidden; /* prevent accidental horizontal scroll on mobile */
}

/* ----- Initial page entrance (first paint) ----- */
@keyframes nv-nav-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes nv-head-in {
  from {
    transform: translateY(18px);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes nv-main-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes nv-btn-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes nv-divider-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.9;
  }
}
@keyframes nv-label-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.78;
  }
}
@keyframes nv-layer-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 0.72;
    transform: translateY(0);
  }
}
@keyframes nv-foot-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.nv-tooltip {
  position: relative;
  display: inline;
  text-decoration: underline dotted rgba(148, 163, 184, 0.55);
  text-underline-offset: 3px;
  cursor: inherit;
}

.nv-tooltip__trigger {
  cursor: inherit;
}

.nv-tooltip__panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  width: max-content;
  max-width: min(520px, 92vw);
  z-index: 8000;
  isolation: isolate;

  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #141820;
  color: rgba(226, 232, 240, 0.92);

  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.45;
  letter-spacing: 0.01em;

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.25);

  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.nv-tooltip__title {
  display: block;
  font-weight: 700;
  color: rgba(226, 232, 240, 0.95);
  margin-bottom: 0.35rem;
}

.nv-tooltip__body {
  display: block;
  color: rgba(226, 232, 240, 0.84);
}

.nv-tooltip__layers {
  display: grid;
  gap: 0.18rem;
  margin-top: 0.2rem;
}

.nv-tooltip:hover .nv-tooltip__panel,
.nv-tooltip:focus-visible .nv-tooltip__panel {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .nv-tooltip__panel {
    transition: none;
    transform: none;
  }
}

.site-topnav {
  position: relative;
  z-index: 12000;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  opacity: 0;
  animation: nv-nav-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.04s forwards;
}

.site-topnav__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.45rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-back {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.nav-back:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  opacity: 0.38;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.nav-refresh:hover {
  opacity: 0.72;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.nav-refresh:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
  opacity: 0.9;
}

.nav-refresh svg {
  display: block;
}

.page-head {
  position: relative;
  z-index: 12000;
  padding: 1.75rem 1.5rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  opacity: 1;
  animation: nv-head-in 0.92s ease-out 0.14s forwards;
}

/* Kicker sits over the spider-web art (was above the title row). */
.page-head__title-row {
  position: relative;
  margin: 0;
  padding: 0;
}
.page-head__title-row .kicker {
  position: absolute;
  left: 0.15rem;
  /* Upper band of the hero row — sits just above “Network Visualizer”, still over the web art */
  top: calc(1.12rem - 1px);
  transform: none;
  margin: 0;
  z-index: 2;
  max-width: none;
  white-space: nowrap;
  line-height: 1.35;
  pointer-events: none;
  text-shadow:
    0 0 10px rgba(12, 14, 18, 0.98),
    0 0 22px rgba(12, 14, 18, 0.9),
    0 0 34px rgba(12, 14, 18, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.65);
}
@media (max-width: 640px) {
  .page-head__title-row .kicker {
    left: 0.05rem;
    top: calc(0.92rem - 1px);
    max-width: none;
    white-space: nowrap;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    transform: none;
  }
}

.page-head h1,
.product-title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.product-title {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  min-height: 6.5rem;
  margin: 0 0 0.35rem;
  padding: 0.15rem 0 0.4rem;
  overflow: visible;
}

.product-title__web {
  position: absolute;
  left: -0.35rem;
  top: 50%;
  transform: translateY(-50%);
  height: 6rem;
  width: auto;
  max-width: none;
  object-fit: contain;
  opacity: 0.38;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.product-title__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  /* Sit over the background web — “Network” lands on the graphic */
  padding-left: 2rem;
  padding-top: 0.65rem;
}

.product-title__text {
  line-height: 1.15;
  text-shadow:
    0 0 8px var(--bg),
    0 0 18px rgba(12, 14, 18, 0.75),
    0 1px 3px rgba(0, 0, 0, 0.45);
}

@media (max-width: 640px) {
  .product-title {
    min-height: 5.25rem;
  }
  .product-title__web {
    height: 5rem;
    left: -0.2rem;
    opacity: 0.34;
  }
  .product-title__content {
    padding-left: 1.25rem;
    padding-top: 0.45rem;
  }
}

.product-version {
  font-family: var(--mono);
  font-size: 0.5em;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.62;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 6px var(--bg),
    0 0 14px rgba(12, 14, 18, 0.7),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

.page-head .kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
}

.page-head .kicker-beaker {
  display: inline;
  margin-left: 0.35em;
  font-size: 1.08em;
  line-height: 1;
  opacity: 0.88;
  vertical-align: 0.05em;
}

.page-head p.lead {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 52rem;
  font-size: 0.95rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.osi-stack-head {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.legend--osi {
  margin-top: 0;
  gap: 0.75rem 1.25rem;
  font-size: 0.76rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--active {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}
.dot--pending {
  background: var(--yellow);
}
.dot--idle {
  background: var(--grey);
}
.dot--error {
  background: var(--red);
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.08);
  }
}

.layout {
  position: relative;
  z-index: 0;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }
}

.sidebar-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: static;
  top: auto;
}

@media (min-width: 900px) {
  .sidebar-stack {
    position: sticky;
    top: 1rem;
  }
}

.scenario-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.85rem 0 0.55rem;
  opacity: 0;
  animation: nv-divider-in 0.7s ease-out 0.49s forwards;
}

.storage-section-label {
  margin: 0 0 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
  opacity: 0;
  animation: nv-label-in 0.7s ease-out 0.56s forwards;
}

.scenario-btn {
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  opacity: 0;
  animation: nv-btn-in 0.88s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(0.34s + var(--nv-btn-i, 0) * 0.1s);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.22s ease;
}

#scenario-nav-main .scenario-btn:nth-child(1) {
  --nv-btn-i: 0;
}
#scenario-nav-main .scenario-btn:nth-child(2) {
  --nv-btn-i: 1;
}
#scenario-nav-main .scenario-btn:nth-child(3) {
  --nv-btn-i: 2;
}
#scenario-nav-storage .scenario-btn:nth-child(1) {
  --nv-btn-i: 3;
}
#scenario-nav-storage .scenario-btn:nth-child(2) {
  --nv-btn-i: 4;
}
#scenario-nav-storage .scenario-btn:nth-child(3) {
  --nv-btn-i: 5;
}

.scenario-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(2px);
}

.scenario-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.scenario-btn strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.scenario-btn small {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.scenario-btn__row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.scenario-btn__icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  margin-top: 0;
  color: var(--accent);
  opacity: 0.88;
  transition: opacity 0.15s, color 0.15s, transform 0.15s;
}

.scenario-btn:hover .scenario-btn__icon {
  opacity: 1;
}

.scenario-btn[aria-pressed="true"] .scenario-btn__icon {
  opacity: 1;
  color: #60a5fa;
}

.scenario-btn--storage {
  border-color: rgba(110, 168, 150, 0.42);
  background: rgba(18, 36, 32, 0.55);
}

.scenario-btn--storage:hover {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(22, 48, 42, 0.65);
}

.scenario-btn--storage[aria-pressed="true"] {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(22, 52, 44, 0.75);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.35);
}

.scenario-btn--storage .scenario-btn__icon {
  color: #5eead4;
}

.scenario-btn--storage[aria-pressed="true"] .scenario-btn__icon {
  color: #99f6e4;
}

.scenario-btn__text {
  min-width: 0;
  flex: 1;
}

.main-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.5rem;
  min-height: 285px;
  opacity: 0;
  animation: nv-main-in 1s cubic-bezier(0.22, 1, 0.36, 1) 0.28s forwards;
}

.main-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.journey-bar {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
}

.journey-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.journey-row--status {
  align-items: flex-start;
  padding-bottom: 0.35rem;
}

.journey-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  width: 6.25rem;
  flex: 0 0 auto;
}

.journey-value {
  min-width: 0;
  flex: 1;
  font-size: 0.86rem;
  color: var(--text);
}

.journey-status-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}

.journey-step-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.72;
  flex: 0 0 auto;
  min-width: 1.15rem;
  text-align: right;
  line-height: 1.35;
  padding-top: 0.12rem;
}

.journey-complete-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--green);
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.35));
}

.journey-complete-check[hidden] {
  display: none !important;
}

.journey-complete-check svg {
  width: 15px;
  height: 15px;
  display: block;
}

.journey-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0.06rem;
  flex-shrink: 0;
  margin-left: 0.15rem;
  min-width: 7.5rem;
}

.journey-elapsed-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.55;
  line-height: 1;
}

.journey-elapsed {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.88;
  white-space: nowrap;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.journey-typical {
  flex-shrink: 0;
  width: 100%;
  margin-top: 1.05rem;
  padding-top: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.35;
  text-align: right;
  max-width: 14rem;
}

.journey-typical__value {
  color: #cfd6df;
  font-weight: 600;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.journey-typical__suffix {
  color: var(--muted);
  opacity: 0.82;
  font-weight: 400;
}

.journey-history-toggle {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.1rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color 0.15s, background 0.15s;
}

.journey-history-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.journey-history-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.journey-history-toggle:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.journey-chevron {
  width: 1rem;
  height: 1rem;
  display: block;
  transition: transform 0.2s ease;
}

.journey-history-toggle.is-open .journey-chevron {
  transform: rotate(180deg);
}

.journey-history-panel {
  margin: -0.15rem 0 0 calc(6.25rem + 0.6rem);
  padding: 0.5rem 0 0.15rem;
  border-top: 1px solid rgba(42, 49, 64, 0.85);
}

.journey-history-heading {
  margin: 0 0 0.35rem;
  font-size: 0.65rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

.journey-history-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.45;
}

.journey-history-list li {
  padding: 0;
  list-style-position: outside;
}

.journey-history-list li::marker {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.75;
}

.journey-history-list li:has(.journey-history-item.is-current)::marker {
  color: var(--green);
  opacity: 1;
  font-weight: 600;
}

.journey-history-item {
  display: block;
  width: calc(100% + 0.25rem);
  margin-left: -0.15rem;
  text-align: left;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.journey-history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.journey-history-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@keyframes journey-highlight-pulse {
  0%,
  100% {
    border-color: rgba(34, 197, 94, 0.42);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.14);
  }
  50% {
    border-color: rgba(74, 222, 128, 0.72);
    box-shadow:
      0 0 0 3px rgba(34, 197, 94, 0.1),
      0 0 14px rgba(34, 197, 94, 0.18);
  }
}

.journey-history-item.is-current {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.45);
  animation: journey-highlight-pulse 2.4s ease-in-out infinite;
}

.journey-h-desc {
  color: var(--text);
}

.journey-h-sep {
  color: var(--muted);
  opacity: 0.65;
}

.journey-h-where {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.journey-history-item--client .journey-h-where {
  color: #93c5fd;
}

.journey-history-item--server .journey-h-where {
  color: #86efac;
}

.journey-history-item--datacenter .journey-h-where {
  color: #fcd34d;
}

.journey-h-osilayers,
.journey-osilayers {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #d4c27a;
  opacity: 0.95;
}

.actor-pill .journey-osilayers {
  font-weight: 600;
  opacity: 0.92;
}

@media (max-width: 640px) {
  .journey-history-panel {
    margin-left: 0;
  }

  /* Keep controls in a single column (no horizontal scrolling). */
  .controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
  .controls .btn {
    width: 100%;
  }
  .controls .speed-label {
    grid-column: 1 / -1;
    width: 100%;
  }
  .controls .speed-control {
    width: 100%;
    max-width: none;
  }

  .journey-label {
    width: 4.6rem;
  }

  .journey-status-wrap {
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
  }

  .journey-metrics {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    flex-direction: row;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.75rem;
  }

  .journey-typical {
    max-width: none;
    margin-top: 0;
    text-align: right;
  }

  .journey-history-toggle {
    align-self: flex-start;
  }
}

/* ----- Journey path diagram (under Where) ----- */
.journey-path {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(42, 49, 64, 0.72);
}

.journey-path__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.journey-path__kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.78;
}

.journey-path__flowdir {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: #7dd3a0;
  opacity: 0.72;
  white-space: nowrap;
}

.journey-path__svg-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 -0.15rem;
  padding: 0.15rem 0.1rem 0.05rem;
  -webkit-overflow-scrolling: touch;
}

.journey-path__svg {
  display: block;
  min-width: 520px;
  width: 100%;
  height: auto;
  max-height: 92px;
}

.journey-path__svg--mobile {
  display: none;
}

.journey-path__svg--dc {
  min-width: 400px;
  max-height: 92px;
}

.journey-path__svg .path-seg {
  stroke: rgba(55, 65, 81, 0.95);
  stroke-width: 2;
  stroke-linecap: round;
}

.journey-path__svg .path-seg.is-active {
  stroke: rgba(100, 116, 139, 0.98);
}

.journey-path__svg .path-seg--dc {
  stroke: rgba(55, 75, 72, 0.95);
}

.journey-path__svg .path-seg-flow {
  fill: none;
  stroke: url(#path-flow-grad-wan);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 7 12;
  opacity: 0;
  pointer-events: none;
}

.journey-path__svg--mobile .path-seg-flow {
  stroke: url(#path-flow-grad-wan-mobile);
}

.journey-path__svg .path-seg-flow--dc {
  stroke: url(#path-flow-grad-dc);
}

.journey-path__svg--mobile .path-seg-flow--dc {
  stroke: url(#path-flow-grad-dc-mobile);
}

.journey-path__svg--mobile .path-flow-only {
  transform-box: fill-box;
  transform-origin: center;
}

/* Mobile: visually flip ONLY the animated overlay for return flows. */
#journey-path-wan-svg-mobile[data-flow="in"] .path-flow-only {
  transform: scaleX(-1);
}

#journey-path-dc-svg-mobile[data-flow="in"] .path-flow-only {
  transform: scaleX(-1);
}

.journey-path__svg .path-seg-flow.is-flow {
  opacity: 0.88;
  animation: journey-path-dash 1.05s linear infinite;
}

#journey-path-wan-svg[data-flow="in"] .path-seg-flow.is-flow {
  animation-direction: reverse;
}

#journey-path-dc-svg[data-flow="in"] .path-seg-flow--dc.is-flow {
  animation-direction: reverse;
}

@keyframes journey-path-dash {
  to {
    stroke-dashoffset: -38;
  }
}

.journey-path__svg .path-node__ring {
  fill: rgba(0, 0, 0, 0.28);
  stroke: rgba(90, 100, 118, 0.88);
  stroke-width: 1.5;
}

.journey-path__svg .path-node.is-active .path-node__ring {
  fill: rgba(34, 197, 94, 0.14);
  stroke: rgba(74, 222, 128, 0.82);
  filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.22));
}

.journey-path__svg .path-node__lbl {
  pointer-events: none;
}

.journey-path__svg .path-node__lbl {
  font-size: 10.2px;
}

.journey-path__svg .path-node.is-active .path-node__lbl {
  fill: #c5cdd6;
  font-weight: 600;
}

.journey-path__caption {
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.4;
  color: #cbd5e1;
  opacity: 0.6;
  max-width: 52rem;
}

.journey-path__proto {
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--muted);
  opacity: 0.88;
  max-width: 52rem;
}

@media (max-width: 640px) {
  /* Revert mobile path layout: keep the original single-row diagram and allow horizontal scroll. */
  .journey-path__svg--desktop {
    display: block;
  }
  .journey-path__svg--mobile {
    display: none;
  }
  .journey-path__flowdir {
    font-size: 0.66rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey-path__svg .path-seg-flow.is-flow {
    animation: none !important;
    stroke-dashoffset: 0;
    opacity: 0.45;
  }
}

.actor-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.74rem;
  color: var(--text);
  flex: 0 0 auto;
}

.actor-pill svg {
  width: 1.05rem;
  height: 1.05rem;
}

.actor-pill[data-actor="client"] {
  border-color: rgba(59, 130, 246, 0.55);
}

.actor-pill[data-actor="server"] {
  border-color: rgba(34, 197, 94, 0.55);
}

.actor-pill[data-actor="datacenter"] {
  border-color: rgba(234, 179, 8, 0.65);
}

@keyframes actor-pill-pulse {
  0%,
  100% {
    border-color: rgba(34, 197, 94, 0.48);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.12);
  }
  50% {
    border-color: rgba(74, 222, 128, 0.78);
    box-shadow:
      0 0 0 3px rgba(34, 197, 94, 0.12),
      0 0 12px rgba(34, 197, 94, 0.2);
  }
}

#journey-actor[data-journey-active="true"] {
  animation: actor-pill-pulse 2.4s ease-in-out infinite;
  border-color: rgba(34, 197, 94, 0.52);
}

.main-panel .blurb {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1.25rem;
  max-width: 48rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.btn {
  padding: 0.3rem 0.62rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.74rem;
  line-height: 1.25;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  filter: brightness(1.08);
  color: #fff;
}

.speed-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.speed-label__text {
  font-size: 0.7rem;
}

.speed-control {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
  width: 11.75rem;
  min-width: 0;
  max-width: 14rem;
  padding: 0.38rem 0.55rem 0.45rem;
  border-radius: 9px;
  border: 1px solid rgba(42, 49, 64, 0.95);
  background: linear-gradient(165deg, rgba(0, 0, 0, 0.42) 0%, rgba(20, 24, 32, 0.55) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 3px rgba(0, 0, 0, 0.35);
}

.speed-ticks {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.1rem;
  padding: 0 0.04rem 0 0.06rem;
  font-size: 0.58rem;
  color: var(--muted);
  font-family: var(--mono);
  user-select: none;
  opacity: 0.92;
}

.speed-ticks span {
  text-align: center;
}

.speed-ticks span:first-child {
  text-align: left;
}

.speed-ticks span:last-child {
  text-align: right;
}

input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}

.speed-control input[type="range"] {
  height: 1.4rem;
  cursor: pointer;
}

.speed-control input[type="range"]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 2px;
  border-radius: 4px;
}

.osi-wrap {
  display: grid;
  gap: 0.28rem;
  margin-bottom: 1.05rem;
}

.osi-layer {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.48rem 0.72rem;
  align-items: start;
  padding: 0.46rem 0.62rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 0.25s, background 0.25s, transform 0.2s;
}

#osi-stack[data-nv-first] .osi-layer {
  opacity: 0;
  animation: nv-layer-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(0.62s + var(--nv-layer-i, 0) * 0.072s);
}

.osi-layer[data-state="active"] {
  border-color: var(--green);
  background: var(--green-dim);
  transform: translateX(3px);
  /* Light pulse — enough motion to read “current” without bouncing the card */
  animation: osi-active-pulse 2.75s ease-in-out infinite;
}

@keyframes osi-active-pulse {
  0%,
  100% {
    border-color: #22c55e;
    transform: translateX(3px);
    box-shadow:
      0 0 0 0 rgba(34, 197, 94, 0.38),
      0 2px 14px rgba(34, 197, 94, 0.2);
  }
  50% {
    border-color: #4ade80;
    transform: translateX(3px);
    box-shadow:
      0 0 0 6px rgba(34, 197, 94, 0.06),
      0 0 22px rgba(34, 197, 94, 0.28),
      0 3px 18px rgba(34, 197, 94, 0.26);
  }
}

@media (prefers-reduced-motion: reduce) {
  .osi-layer[data-state="active"] {
    animation: none;
    transform: translateX(3px);
    box-shadow: 0 2px 14px rgba(34, 197, 94, 0.28);
  }
}

.osi-layer[data-state="pending"] {
  border-color: var(--yellow);
  background: var(--yellow-dim);
}

.osi-layer[data-state="idle"] {
  opacity: 0.72;
}

.osi-layer__num {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  width: 1.75rem;
  text-align: center;
  padding-top: 0.08rem;
}

.osi-layer__body h3 {
  margin: 0 0 0.12rem;
  font-size: 0.81rem;
  font-weight: 600;
}

.osi-layer__body .proto {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  margin: 0 0 0.22rem;
}

.osi-layer__body .note {
  margin: 0;
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.38;
}

.flow-note {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  margin-top: 1rem;
}

.flow-note strong {
  color: var(--text);
}

.disclaimer {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  max-width: 52rem;
}

.footer-mini {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0;
  animation: nv-foot-in 0.84s ease-out 1.12s forwards;
}

.footer-mini__back {
  margin: 0 0 0.65rem;
}

.footer-mini__meta {
  margin: 0;
}

.footer-back-home {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 500;
  opacity: 0.62;
  letter-spacing: 0.01em;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.footer-back-home:hover {
  color: var(--accent);
  opacity: 1;
  text-decoration: none;
}

.footer-back-home:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 3px;
  border-radius: 3px;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .journey-history-item.is-current,
  #journey-actor[data-journey-active="true"] {
    animation: none !important;
  }
  .journey-history-item.is-current {
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
  }
  #journey-actor[data-journey-active="true"] {
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.3);
  }
  .site-topnav,
  .page-head,
  .main-panel,
  .footer-mini,
  .sidebar-divider,
  .storage-section-label,
  .scenario-btn {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .storage-section-label {
    opacity: 0.78 !important;
  }
  .sidebar-divider {
    opacity: 0.9 !important;
  }
  #osi-stack[data-nv-first] .osi-layer {
    animation: none !important;
    opacity: 0.72 !important;
    transform: none !important;
  }
}
