/* ==========================================================================
   Throtl Guide — flowchart
   ========================================================================== */

.page-guide {
  background: #070c11;
  color: var(--text-l);
  overflow-x: hidden;
}

.page-guide .navbar.scrolled {
  background: rgba(7, 12, 17, 0.9);
}

.page-guide .nav-links a[aria-current="page"] {
  color: #fff;
}

.page-guide .nav-links a[aria-current="page"]::after {
  width: 100%;
}

.guide-shell {
  padding: 80px 0 32px;
}

.guide-stage-section {
  padding: 0 16px 24px;
}

.guide-stage-frame {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  border-radius: 20px;
  border: 1px solid rgba(189, 198, 202, 0.12);
  background:
    radial-gradient(ellipse 70% 50% at 20% -10%, rgba(101, 168, 189, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(133, 90, 208, 0.1), transparent 50%),
    linear-gradient(180deg, #101820 0%, #0b1218 100%);
  overflow: hidden;
}

.guide-stage-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.guide-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}

.guide-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  overflow: hidden;
}

.guide-stage svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  vertical-align: top;
}

.flow-col-label {
  fill: var(--white);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.flow-col-rule {
  stroke: rgba(189, 198, 202, 0.12);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.flow-edge {
  fill: none;
  stroke: rgba(200, 210, 216, 0.55);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.35s var(--ease), opacity 0.35s var(--ease), stroke-width 0.35s;
  marker-end: url(#flowArrow);
  filter: drop-shadow(0 0 2px rgba(7, 12, 17, 0.8));
}

.flow-edge-flow {
  fill: none;
  stroke: rgba(101, 168, 189, 0.7);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 7 16;
  animation: edgeFlow 2.4s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

.flow-edge-flow.is-dimmed { opacity: 0.1; }
.flow-edge-flow.is-active {
  stroke: #8ec9d8;
  stroke-width: 2.8;
  opacity: 1;
  filter: drop-shadow(0 0 7px rgba(101, 168, 189, 0.75));
  animation-duration: 1.1s;
}

@keyframes edgeFlow {
  to { stroke-dashoffset: -48; }
}

.flow-edge.is-active {
  stroke: var(--blue);
  stroke-width: 3.1;
  opacity: 1;
  marker-end: url(#flowArrowActive);
  filter: drop-shadow(0 0 7px rgba(101, 168, 189, 0.65));
}

.flow-edge.is-dimmed { opacity: 0.16; }

.flow-edge-transfer {
  fill: none;
  stroke: rgba(189, 198, 202, 0.45);
  stroke-width: 1.7;
  stroke-dasharray: 5 6;
  stroke-linecap: round;
  marker-end: url(#flowArrowTransfer);
  transition: stroke 0.35s var(--ease), opacity 0.35s var(--ease);
}

.flow-edge-transfer.is-active {
  stroke: #b89ae8;
  stroke-width: 2.2;
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(133, 90, 208, 0.45));
}

.flow-transfer.is-dimmed {
  opacity: 0.14;
}

.flow-edge-label {
  fill: rgba(200, 210, 216, 0.72);
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: rgba(7, 12, 17, 0.85);
  stroke-width: 3px;
  pointer-events: none;
}

.flow-transfer.is-active .flow-edge-label {
  fill: #d4c2f0;
}

.flow-node {
  cursor: pointer;
  outline: none;
  transition: opacity 0.35s var(--ease);
}

.flow-node-rect {
  fill: rgba(16, 24, 32, 0.92);
  stroke: rgba(189, 198, 202, 0.35);
  stroke-width: 1.5;
  transition: fill 0.25s, stroke 0.25s, filter 0.25s;
}

.flow-node-halo {
  fill: none;
  stroke: rgba(101, 168, 189, 0);
  stroke-width: 1.5;
  pointer-events: none;
  transition: stroke 0.3s, opacity 0.3s;
}

.flow-node-label {
  fill: var(--white);
  font-family: 'Montserrat', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.flow-node.role-operators .flow-node-rect { stroke: rgba(101, 168, 189, 0.7); }
.flow-node.role-service .flow-node-rect { stroke: rgba(133, 90, 208, 0.7); }
.flow-node.role-users .flow-node-rect { stroke: rgba(189, 198, 202, 0.75); }

.flow-node:hover .flow-node-rect,
.flow-node:focus-visible .flow-node-rect {
  filter: drop-shadow(0 0 14px rgba(101, 168, 189, 0.5));
  stroke-width: 2;
}

.flow-node:hover .flow-node-halo,
.flow-node:focus-visible .flow-node-halo {
  stroke: rgba(101, 168, 189, 0.35);
  animation: haloBreath 1.6s ease-in-out infinite;
}

.flow-node.role-service:hover .flow-node-rect,
.flow-node.role-service:focus-visible .flow-node-rect {
  filter: drop-shadow(0 0 14px rgba(133, 90, 208, 0.55));
}

.flow-node.is-active .flow-node-rect {
  stroke-width: 2.35;
  filter: drop-shadow(0 0 18px rgba(101, 168, 189, 0.7));
  animation: flowPulse 1.8s ease-in-out infinite;
}

.flow-node.is-active .flow-node-halo {
  stroke: rgba(101, 168, 189, 0.55);
  animation: haloBreath 1.4s ease-in-out infinite;
}

.flow-node.is-dimmed { opacity: 0.22; }
.flow-node.is-dimmed .flow-node-rect,
.flow-node.is-dimmed .flow-node-halo {
  filter: none;
  animation: none;
  stroke-opacity: 0.5;
}

@keyframes flowPulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(101, 168, 189, 0.4)); }
  50% { filter: drop-shadow(0 0 22px rgba(101, 168, 189, 0.8)); }
}

@keyframes haloBreath {
  0%, 100% { opacity: 0.35; stroke-width: 1.5; }
  50% { opacity: 0.85; stroke-width: 2.5; }
}

.flow-camera {
  transform-origin: center center;
}

/* --- Floating popover (does not shove the chart) --- */
.guide-popover {
  position: fixed;
  top: 96px;
  right: 20px;
  z-index: 1200;
  width: min(1000px, calc(100vw - 40px));
  height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #15202a 0%, #0e161e 100%);
  border: 1px solid rgba(189, 198, 202, 0.18);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  color: var(--text-l);
  animation: popoverIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.guide-popover[hidden] {
  display: none !important;
}

@keyframes popoverIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.guide-popover-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px 24px 12px;
}

.guide-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 2;
}

.guide-dialog-close:hover { background: rgba(255, 255, 255, 0.12); }

.guide-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
  margin-right: 40px;
  background: rgba(101, 168, 189, 0.18);
  color: var(--blue);
  border: 1px solid rgba(101, 168, 189, 0.35);
}

.guide-chip.role-operators {
  background: rgba(101, 168, 189, 0.18);
  color: #8ec9d8;
  border-color: rgba(101, 168, 189, 0.4);
}

.guide-chip.role-service {
  background: rgba(133, 90, 208, 0.18);
  color: #b89ae8;
  border-color: rgba(133, 90, 208, 0.4);
}

.guide-chip.role-users {
  background: rgba(189, 198, 202, 0.12);
  color: var(--silver);
  border-color: rgba(189, 198, 202, 0.3);
}

.guide-popover h2 {
  color: var(--white);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  margin-bottom: 8px;
  padding-right: 36px;
}

.guide-dev-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.guide-dev-banner[hidden] {
  display: none !important;
}

.guide-dialog-summary {
  color: var(--blue);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.guide-dialog-body {
  color: rgba(200, 210, 216, 0.85);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 14px;
}

.guide-media {
  margin-bottom: 8px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(189, 198, 202, 0.14);
  background: #000;
}

.guide-media[hidden] {
  display: none !important;
}

.guide-qr {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 8px 0 12px;
}

.guide-qr[hidden] {
  display: none !important;
}

.guide-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  border-radius: 12px;
  border: 1px solid rgba(189, 198, 202, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.guide-qr-card:hover {
  border-color: rgba(101, 168, 189, 0.45);
  background: rgba(101, 168, 189, 0.08);
  transform: translateY(-1px);
}

.guide-qr-card img {
  width: 160px;
  height: 160px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.guide-qr-card span {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.guide-media-frame {
  position: relative;
  width: 100%;
  height: 360px;
}

.guide-media-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.guide-dialog-nav {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
}

.guide-popover .btn-glass {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.guide-popover .btn {
  padding: 12px 22px;
  font-size: 0.88rem;
}

.page-guide .footer {
  background: #05090d;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.page-guide .footer-links a[aria-current="page"] {
  color: var(--blue);
  opacity: 1;
}

@media (max-width: 720px) {
  .guide-shell { padding-top: 80px; }

  .guide-popover {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: min(70vh, 600px);
    border-radius: 16px 16px 0 0;
  }

  .guide-media-frame {
    height: 280px;
  }

  .guide-dialog-nav { justify-content: stretch; }
  .guide-dialog-nav .btn { flex: 1; justify-content: center; }
}
