/* ==========================================================================
   GPA-Networks — Tools
   Schlichtes, technisches Design für den internen Werkzeugkasten.
   ========================================================================== */

:root {
  --bg: #0b0f14;
  --bg-grid: #10161d;
  --surface: #121821;
  --surface-alt: #171f2a;
  --border: #232c38;
  --text: #e8edf2;
  --text-muted: #8a96a3;
  --text-faint: #5b6672;
  --accent: #4fd1c5;
  --accent-dim: #2f8f86;
  --accent-soft: rgba(79, 209, 197, 0.12);
  --warn: #f5a623;
  --warn-soft: rgba(245, 166, 35, 0.12);
  --danger: #ef5b5b;
  --danger-soft: rgba(239, 91, 91, 0.12);
  --radius: 8px;
  --radius-sm: 4px;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --maxw: 980px;
}

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

html { color-scheme: dark; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand:hover { text-decoration: none; }

.brand svg { flex-shrink: 0; }

.brand .brand-sub {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.85rem;
  border-left: 1px solid var(--border);
  padding-left: 10px;
  margin-left: 2px;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }

.nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Hero / intro ---------- */

.hero {
  padding: 40px 0 8px;
}

.hero .eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero p {
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0;
}

/* ---------- Panels / readout cards ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 20px 0;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.panel-title .n { color: var(--accent); font-family: var(--font-mono); margin-right: 8px; }

.panel-hint {
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* status rows: label + monospace value + status dot */

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.status-row:last-child { border-bottom: none; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.status-dot.is-loading {
  background: var(--warn);
  animation: pulse 1.1s ease-in-out infinite;
}

.status-dot.is-ok { background: var(--accent); }
.status-dot.is-error { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot.is-loading { animation: none; }
}

.status-label {
  color: var(--text-muted);
  font-size: 0.88rem;
  min-width: 168px;
  flex-shrink: 0;
}

.status-value {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
}

.status-value.muted { color: var(--text-faint); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-dim);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover { background: rgba(79, 209, 197, 0.2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); }

/* ---------- Forms ---------- */

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 160px;
}

.field label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.field input, .field select {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
}

.field input:focus, .field select:focus {
  border-color: var(--accent-dim);
}

.field-actions { flex: 0 0 auto; }

/* ---------- Result blocks ---------- */

.result {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 20px;
}

.result:empty::before {
  content: '—';
  color: var(--text-faint);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  margin-top: 14px;
}

.result-table th, .result-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.result-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.note {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: 10px;
}

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

/* ---------- Tools grid & external link cards ---------- */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 0 32px;
}

.tool-link-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.15s ease, transform 0.05s ease;
}

.tool-link-card:hover {
  border-color: var(--accent-dim);
  text-decoration: none;
  transform: translateY(-1px);
}

.tool-link-card .title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.tool-link-card .title svg { color: var(--text-faint); }

.tool-link-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.tool-link-card .url {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

/* ---------- Section index numbers ---------- */

.section-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0 8px;
}

.section-nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}

.section-nav a:hover { color: var(--accent); border-color: var(--accent-dim); text-decoration: none; }

/* ---------- Speedtest embed ---------- */

.speedtest-frame-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.speedtest-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 520px;
  border: 0;
}

.speedtest-placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 28px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 24px 0 40px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .status-row { flex-wrap: wrap; }
  .status-label { min-width: 100%; }
  .panel { padding: 18px; }
}
