/* Protocols: a patch-panel board of every protocol in the hero, the explorer (Preferences-style list and panel)
   with a partner -> server -> storage flow, and a side-by-side matrix for reviews. */

:root,
:root[data-theme="dark"] {
  --px-glow: #ffffff0d;
  --px-led-in: #22c55e;
  --px-led-in-glow: #22c55e66;
  --px-led-out: #60a5fa;
  --px-led-out-glow: #60a5fa66;
  --px-led-off: #3a3a3a;
}
:root[data-theme="light"] {
  --px-glow: #ffffff0a;
  --px-led-in: #16a34a;
  --px-led-in-glow: #16a34a40;
  --px-led-out: #60a5fa;
  --px-led-out-glow: #60a5fa55;
  --px-led-off: #3a3a3a;
}

/* ------------------------------------------------------------------ hero */
.px-hero {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); align-items: center; gap: 40px clamp(32px, 5vw, 72px);
}
/* a faint engineering grid behind the hero, fading out at the edges */
.px-hero::before {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 70% at 70% 45%, #000 20%, transparent 75%);
  pointer-events: none;
}
.px-hero h1 { max-width: 13ch; font-size: clamp(2.5rem, 1.2rem + 3.2vw, 4.25rem); }
.px-copy .lede { max-width: 46ch; }
.px-copy .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.px-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 520px; margin: 36px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.px-stats div { display: flex; flex-direction: column-reverse; gap: 2px; }
.px-stats dt { color: var(--muted); font-size: .875rem; line-height: 1.35; }
.px-stats dd { margin: 0; color: var(--strong); font-size: clamp(2rem, 1.5rem + 1.4vw, 2.75rem); font-weight: 750; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* the board: always the console's dark, like the admin it stands for */
.px-board {
  border: 1px solid var(--console-line); border-radius: var(--r-lg); overflow: hidden;
  background: radial-gradient(520px 260px at 100% 0%, var(--px-glow), transparent 70%), var(--console-bg);
  color: var(--console-ink); box-shadow: var(--shadow);
}
.px-board-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 14px 18px; border-bottom: 1px solid var(--console-line); background: var(--console-bar);
}
.px-board-head p { color: var(--console-ink); font-size: .9375rem; font-weight: 700; }
.px-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--console-muted); font-size: .8125rem; }
.px-legend li { display: flex; align-items: center; gap: 6px; }
.px-legend li:last-child .px-led { --c: var(--px-led-out); --g: var(--px-led-out-glow); }
.px-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--console-line); }
.px-grid li { display: flex; }
.px-tile {
  position: relative; flex: 1;
  display: grid; align-content: space-between; gap: 10px;
  min-height: 108px; padding: 14px 14px 12px 16px; border: 0;
  background: var(--console-bg); color: var(--console-ink); text-align: left; cursor: pointer;
  transition: background-color var(--t-fast) ease;
}
.px-tile:hover { background: var(--console-hover); }
.px-tile:active { background: var(--console-tab-on); }
.px-tile:focus-visible { outline: 2px solid var(--console-focus); outline-offset: -2px; }
.px-tile.is-current { background: var(--console-tab-on); }
.px-tile.is-current::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--orange); animation: bar-in var(--t-med) var(--ease);
}
.px-more { grid-column: span 3; }
.px-more a {
  flex: 1; display: grid; align-content: center; gap: 4px; padding: 14px 16px;
  background: var(--console-bg); color: var(--console-ink); text-decoration: none;
  transition: background-color var(--t-fast) ease;
}
.px-more a:hover { background: var(--console-hover); }
.px-more a:focus-visible { outline: 2px solid var(--console-focus); outline-offset: -2px; }
.px-more strong { font-size: .9375rem; font-weight: 750; color: var(--console-focus); }
.px-more small { color: var(--console-muted); font-size: .75rem; line-height: 1.3; }
.px-tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.px-tile strong { font-size: .9375rem; font-weight: 750; line-height: 1.25; }
.px-tile small { color: var(--console-muted); font-size: .75rem; line-height: 1.3; }
.px-new { flex: none; padding: 1px 6px; border-radius: 5px; background: var(--console-tab-on); color: var(--console-ink); font-size: .6875rem; font-weight: 750; }
.px-leds { display: flex; gap: 10px; }
.px-led {
  --c: var(--px-led-in); --g: var(--px-led-in-glow);
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--console-muted); font-size: .6875rem; font-weight: 700;
}
.px-led::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--px-led-off); transition: background-color 120ms ease, box-shadow 120ms ease; }
.px-led + .px-led { --c: var(--px-led-out); --g: var(--px-led-out-glow); }
.px-led.on::before { background: var(--c); box-shadow: 0 0 0 3px var(--g); }
.px-led.on { color: var(--console-ink); }
.px-led.blink::before { background: var(--px-led-off); box-shadow: none; }

/* ------------------------------------------------------------------ sections */
.px-section { max-width: var(--measure); margin-inline: auto; padding-top: clamp(56px, 7vw, 104px); }
.px-section-head { margin-bottom: 28px; }
.px-section-head h2 { font-size: clamp(1.875rem, 1.2rem + 2.1vw, 2.875rem); line-height: 1.1; letter-spacing: -.025em; }
.px-section-head p { max-width: 60ch; margin-top: 12px; color: var(--muted); font-size: 1.0625rem; }
.page-protocols .settings { padding-bottom: 0; }
.page-protocols .settings-side { top: calc(var(--topbar) + 20px); }

/* explorer panel: partner -> CrushMFT27 -> other servers */
.px-flow {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(96px, .9fr) minmax(0, 1fr) minmax(96px, .9fr) minmax(0, 1fr); align-items: center; gap: 0 4px;
  padding: 22px 18px; border-radius: var(--r-md); background: var(--panel-2);
}
.px-node {
  display: grid; justify-items: center; gap: 8px; padding: 14px 8px; border-radius: var(--r-md);
  color: var(--ink); text-align: center; transition: opacity var(--t-med) ease;
}
.px-node svg { width: 30px; height: 30px; color: var(--accent-ink); }
.px-node strong { font-size: .875rem; font-weight: 700; line-height: 1.3; }
.px-node.core { background: var(--orange); color: var(--on-orange); box-shadow: var(--shadow-sm); }
.px-node.core svg { color: var(--on-orange); }
.px-node.off { opacity: .4; }
.px-node.off svg { color: var(--faint); }
.px-link { display: grid; gap: 8px; justify-items: center; }
.px-link small { color: var(--faint); font-size: .75rem; font-weight: 650; text-align: center; line-height: 1.25; }
.px-link.on small { color: var(--ink); }
.px-wire { position: relative; width: 100%; height: 2px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.px-link.on .px-wire { background: var(--faint); }
.px-wire i { position: absolute; inset: 0 auto 0 0; width: 36%; border-radius: 2px; background: var(--strong); opacity: 0; }
.px-link.on .px-wire i { opacity: 1; animation: px-pulse 1.6s var(--ease-io) infinite; }
.px-link.out.on .px-wire i { animation-delay: .8s; }
@keyframes px-pulse { from { transform: translateX(-100%); } to { transform: translateX(280%); } }

.px-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.px-sides div { padding: 14px 16px; border-radius: var(--r-md); background: var(--panel-2); }
.px-sides dt { display: flex; align-items: center; gap: 8px; color: var(--strong); font-weight: 700; font-size: .9375rem; }
.px-sides dt::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--px-led-in); box-shadow: 0 0 0 3px var(--px-led-in-glow); }
.px-sides div + div dt::before { background: var(--px-led-out); box-shadow: 0 0 0 3px var(--px-led-out-glow); }
.px-sides div.off dt { color: var(--muted); }
.px-sides div.off dt::before { background: var(--line-strong); box-shadow: none; }
.px-sides dd { margin: 4px 0 0; color: var(--muted); font-size: .875rem; }
.proto-panel .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }

/* ------------------------------------------------------------------ matrix */
.px-table-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; background: var(--panel); }
.px-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .9375rem; }
.px-table th, .px-table td { padding: 12px 16px; text-align: left; vertical-align: middle; }
.px-table thead th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: .8125rem; font-weight: 650; border-bottom: 1px solid var(--line); white-space: nowrap; }
.px-table tbody tr + tr :is(th, td) { border-top: 1px solid var(--rule); }
.px-table tbody tr { transition: background-color var(--t-fast) ease; }
.px-table tbody tr:hover { background: var(--hover); }
.px-table tbody th { white-space: nowrap; }
.px-table tbody th button {
  padding: 4px 6px; margin-left: -6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--strong); font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px;
  transition: text-decoration-color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.px-table tbody th button:hover { text-decoration-color: currentColor; }
.px-table tbody th button:active { background: var(--sel-soft); }
.px-table tbody th .badge { margin-left: 6px; vertical-align: 1px; }
.px-table td:nth-child(2) { color: var(--muted); white-space: nowrap; }
.px-yes svg { width: 20px; height: 20px; color: var(--green); }
.px-no { color: var(--faint); }
.px-desc { min-width: 280px; color: var(--muted); font-size: .875rem; }
.px-end {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  margin: 24px 0 88px; padding: 22px 24px; border-radius: var(--r-lg); background: var(--panel-2);
}
.px-end p { color: var(--ink); font-weight: 600; }
.px-end .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .px-hero { grid-template-columns: minmax(0, 1fr); }
  .px-hero h1 { max-width: 18ch; }
}
@media (max-width: 860px) {
  .px-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .px-more { grid-column: span 1; }
  .px-flow { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 16px; }
  .px-wire { width: 2px; height: 24px; }
  .px-link.on .px-wire i { width: 100%; height: 40%; animation-name: px-pulse-v; }
  .px-sides { grid-template-columns: minmax(0, 1fr); }
}
@keyframes px-pulse-v { from { transform: translateY(-100%); } to { transform: translateY(280%); } }
@media (max-width: 560px) {
  .px-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .px-stats div:last-child { grid-column: 1 / -1; }
  .px-tile { min-height: 96px; }
  .px-end { margin-bottom: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .px-wire i { display: none; }
}

/* phones: the matrix becomes a stack of cards, one per protocol */
@media (max-width: 720px) {
  .px-table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .px-table, .px-table tbody, .px-table tr, .px-table th, .px-table td { display: block; }
  .px-table { min-width: 0; }
  .px-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .px-table tbody { display: grid; gap: 10px; }
  .px-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
  .px-table tbody tr + tr :is(th, td) { border-top: 0; }
  .px-table :is(th, td) { padding: 0; }
  .px-table tbody th { grid-column: 1 / -1; white-space: normal; }
  .px-table td[data-label] { display: grid; gap: 2px; white-space: normal; }
  .px-table td[data-label]::before { content: attr(data-label); color: var(--faint); font-size: .75rem; font-weight: 650; }
  .px-table td[data-label="Role"] { grid-column: 1 / -1; }
  .px-desc { grid-column: 1 / -1; min-width: 0; }
}
