/* /network - the firewall reference page. Builds on style.css (colours,
   header, footer, .btn); everything here is scoped to that page. The colours
   carry meaning: violet is traffic inside your network, amber is outbound
   internet traffic, green marks rules measured on the wire. */

.net-page {
  --net-amber: #ffbc0b;
  --net-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.net-home { color: inherit; text-decoration: none; }
.net-footer-home { color: inherit; }

/* Wider than the landing page: the rules table needs the room. */
.net-page .wrap { max-width: 1240px; }
.net-main { padding-bottom: 48px; }

.net-intro { padding: 40px 0 28px; max-width: 760px; }
.net-intro h1 { font-size: 40px; line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 16px; }
.net-intro p { font-size: 17px; color: var(--text-dim); margin: 0; max-width: 68ch; }

/* ---- Diagram ---- */

.net-diagram-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
}
.net-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.net-scroll-hint { display: none; margin: 0 0 8px; font-size: 12.5px; color: var(--text-dim); }
.net-diagram { min-width: 760px; }
.net-diagram svg { width: 100%; height: auto; display: block; }

.net-zone-box { fill: var(--bg-panel-2); stroke: var(--border); }
.net-zone-box-internet { stroke: var(--net-amber); stroke-opacity: 0.55; stroke-dasharray: 6 5; }
.net-zone-title { fill: var(--text-dim-2); font-size: 12px; font-weight: 600; }

.net-node { cursor: pointer; outline: none; }
.net-node rect { fill: var(--bg-panel); stroke: var(--border); stroke-width: 1.5; transition: opacity 0.2s; }
.net-node.net-zone-cluster rect { stroke: var(--accent-a); }
.net-node.net-zone-internet rect { stroke: var(--net-amber); stroke-opacity: 0.8; }
.net-node:focus-visible rect { stroke: #fff; stroke-width: 2.5; }
.net-node-idle { opacity: 0.35; }
.net-node-title { fill: var(--text); font-size: 13px; font-weight: 600; }
.net-node-sub { fill: var(--text-dim); font-size: 11px; }
.net-node-addr { fill: #c4b5fd; font-family: var(--net-mono); font-size: 10.5px; }
.net-node-tag { fill: #c4b5fd; font-size: 10px; font-weight: 600; }

.net-line { fill: none; stroke: var(--accent-a); stroke-width: 2; stroke-dasharray: 7 7; animation: net-flow 0.9s linear infinite; }
.net-edge-internet .net-line { stroke: var(--net-amber); }
.net-arrow-local { fill: var(--accent-a); }
.net-arrow-internet { fill: var(--net-amber); }
.net-edge:hover .net-line { stroke-width: 3.5; }
.net-focus .net-edge:not(.net-edge-focus) { opacity: 0.08; }
.net-focus .net-node:not(.net-node-focus) { opacity: 0.25; }
.net-focus .net-edge-focus .net-line { stroke-width: 3; }
.net-label-bg { fill: var(--bg-panel); stroke: var(--border); }
.net-label { fill: var(--text); font-size: 11px; font-weight: 600; font-family: var(--net-mono); }
@keyframes net-flow { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { .net-line { animation: none; } }

.net-diagram-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.net-legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); }
.net-swatch { display: inline-block; width: 22px; height: 0; border-top: 3px dashed; vertical-align: middle; margin-right: 8px; }
.net-swatch-local { border-color: var(--accent-a); }
.net-swatch-internet { border-color: var(--net-amber); }
.net-focus-line { margin: 0; font-size: 13px; color: var(--text-dim); }

.net-link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-a); font: inherit; font-size: 13px; font-weight: 600;
}
.net-link-btn:hover { text-decoration: underline; }
.net-link-btn:focus-visible, .net-btn:focus-visible, .net-feature input:focus-visible, .net-field input:focus-visible {
  outline: 2px solid var(--accent-a); outline-offset: 2px;
}

/* ---- Feature list and addresses ---- */

.net-controls { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; margin-top: 20px; }
.net-panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.net-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.net-panel h2, .net-rules-head h2 { font-size: 19px; margin: 0; }
.net-panel-actions { display: flex; gap: 16px; }
.net-panel-note { font-size: 13px; color: var(--text-dim); margin: 0 0 14px; }

.net-features { display: flex; flex-direction: column; }
.net-feature {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer;
}
.net-feature:first-child { border-top: none; }
.net-feature input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent-a); cursor: pointer; }
.net-feature-text { display: flex; flex-direction: column; }
.net-feature-name { font-weight: 600; font-size: 14px; }
.net-feature-desc { font-size: 12.5px; color: var(--text-dim); }
.net-feature-count { font-size: 12.5px; color: var(--text-dim-2); white-space: nowrap; padding-top: 2px; }
.net-feature:has(input:not(:checked)) .net-feature-name { color: var(--text-dim); }

.net-addresses { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.net-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-dim); }
.net-field input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  padding: 9px 11px; font-family: var(--net-mono); font-size: 13px; min-width: 0;
}
.net-field input::placeholder { color: var(--text-dim-2); opacity: 0.6; }

/* ---- Rules ---- */

.net-rules-wrap { margin-top: 20px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.net-rules-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.net-rules-count { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.net-rules-actions { display: flex; gap: 10px; }
.net-btn { padding: 10px 18px; font-size: 14px; }
.net-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.net-rules { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
.net-rules th:nth-child(1), .net-rules th:nth-child(2) { width: 21%; }
.net-rules th:nth-child(3) { width: 10%; }
.net-rules th:nth-child(5) { width: 11%; }
.net-rules th:nth-child(6) { width: 9.5%; }
.net-rules th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--text-dim); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.net-rules td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.net-rules tbody tr:last-child td { border-bottom: none; }
.net-rules tbody tr:hover td { background: rgba(139, 92, 246, 0.06); }
.net-detail { display: block; font-size: 12px; color: var(--text-dim-2); margin-top: 2px; }
.net-port { font-family: var(--net-mono); font-weight: 600; white-space: nowrap; }
.net-port-text { white-space: normal; }
.net-empty td { color: var(--text-dim); text-align: center; padding: 24px; }

.net-source { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.net-source-measured { background: rgba(54, 208, 104, 0.15); color: #8ff0ae; }
.net-source-code { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
.net-source-docs { background: rgba(255, 188, 11, 0.13); color: #ffd873; }

.net-notes { margin-top: 18px; display: grid; gap: 8px; }
.net-notes p { margin: 0; font-size: 13px; color: var(--text-dim); max-width: 90ch; }
.net-print-only { display: none; }

/* ---- Small screens ---- */

@media (max-width: 900px) {
  .net-controls { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .net-intro { padding-top: 24px; }
  .net-intro h1 { font-size: 30px; }
  .net-intro p { font-size: 16px; }
  .net-diagram-wrap, .net-panel, .net-rules-wrap { padding: 16px; }
  .net-addresses { grid-template-columns: 1fr; }
  .net-scroll-hint { display: block; }

  /* One block per rule instead of a wide table. */
  .net-rules thead { display: none; }
  .net-rules, .net-rules tbody, .net-rules tr, .net-rules td { display: block; width: 100%; }
  .net-rules tbody tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .net-rules tbody tr:last-child { border-bottom: none; }
  .net-rules td { border: none; padding: 3px 0; display: grid; grid-template-columns: 80px 1fr; gap: 10px; }
  .net-rules td::before { content: attr(data-label); color: var(--text-dim-2); font-size: 12px; padding-top: 1px; }
  .net-rules td > span { justify-self: start; }
  .net-rules tbody tr:hover td { background: none; }
  .net-empty td { display: block; }
  .net-empty td::before { content: none; }
}

/* ---- Print: the rules for the firewall team, on white paper ---- */

@media print {
  .net-page { background: #fff !important; background-image: none !important; color: #000; }
  .net-page header, .net-page footer, .net-scroll-hint, .net-diagram-wrap, .net-controls, .net-rules-actions, .net-intro p { display: none !important; }
  .net-intro { padding: 0 0 6px; }
  .net-intro h1 { font-size: 20pt; color: #000; }
  .net-rules-wrap { background: none; border: none; padding: 0; margin: 0; }
  .net-rules-head h2, .net-rules-count { color: #000; }
  .net-print-only { display: block; font-size: 9.5pt; color: #333; margin: 0 0 10px; }
  .net-rules { font-size: 9pt; }
  .net-rules th { color: #000; border-bottom: 1.5px solid #000; }
  .net-rules td { color: #000; border-bottom: 0.5px solid #999; }
  .net-rules tr { break-inside: avoid; }
  .net-rules tbody tr[hidden] { display: none; }
  .net-detail { color: #444; }
  .net-source { background: none !important; color: #000 !important; padding: 0; font-weight: 400; }
  .net-notes p { color: #333; font-size: 9pt; }
}
