/* ============================================================
   DCMS Portal — 06 graph
   "Connected shapes": hub badge, server node grid, SVG connectors.
   JS (server-graph.js) draws the paths/dots and sets inline
   animation-delay per line; everything visual lives here.
   ============================================================ */

@layer graph {
  .server-graph {
    position: relative;
    margin-top: var(--space-3);
  }

  /* -- connector canvas -------------------------------------------------- */
  svg.graph-lines,
  .graph-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 0;
  }

  .graph-line {
    fill: none;
    stroke: var(--border-strong);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    animation: dash-in 900ms var(--ease-out) forwards;
  }

  .graph-line-online {
    stroke: var(--accent);
    animation: dash-in 900ms var(--ease-out) forwards,
      line-pulse 3.2s var(--ease-in-out) 1.2s infinite;
  }

  .graph-dot {
    fill: var(--border-strong);
  }

  .graph-dot-online {
    fill: var(--accent);
  }

  /* -- hub: floating DCMS badge with an amber glow ring ------------------ */
  .graph-hub {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    margin: 0 auto 76px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-pill);
    box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-glow-soft), var(--shadow-md);
  }

  .hub-label {
    font-size: var(--fs-sm);
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--text);
  }

  /* -- node grid ---------------------------------------------------------- */
  .server-nodes {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
    align-items: stretch;
  }

  .server-node {
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--dur-quick) var(--ease-out),
      border-color var(--dur-quick) var(--ease-out);
  }

  .server-node.node-online {
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.28),
      0 0 20px rgba(16, 185, 129, 0.14), var(--shadow-sm);
  }

  .server-node-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: 4px;
  }

  .server-label {
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: -0.005em;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .server-ip {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: var(--space-4);
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }

  .server-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border);
  }

  .server-meta dt {
    font-size: var(--fs-2xs);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 2px;
  }

  .server-meta dd {
    margin: 0;
    font-size: var(--fs-sm);
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  /* -- billing row: upgrade CTA or billing-portal link ------------------- */
  .server-billing {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .plan-price-hint {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-muted);
  }

  .server-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
  }

  /* ============================================================
     <= 900px : drop the constellation, keep a clean stack
     ============================================================ */
  @media (max-width: 900px) {
    .graph-lines,
    svg.graph-lines,
    .graph-hub {
      display: none;
    }

    .server-graph {
      margin-top: 0;
    }

    .server-nodes {
      grid-template-columns: 1fr;
      gap: var(--space-4);
    }
  }
}
