/* ==========================================================================
   NetScanly design system
   ========================================================================== */

:root {
  --bg: #070c18;
  --bg-1: #0b1220;
  --surface: #111a2e;
  --surface-2: #16203a;
  --surface-3: #1b2745;
  --border: #1e2b45;
  --border-soft: #182339;

  --text: #e8eef9;
  --text-2: #b9c6dc;
  --muted: #8296b3;

  --accent: #22d3ee;
  --accent-2: #10b981;
  --accent-soft: rgba(34, 211, 238, 0.12);

  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --info: #60a5fa;

  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);

  --max: 1180px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient glow behind the top of every page */
body::before {
  content: "";
  position: fixed;
  inset: -30% 0 auto 0;
  height: 620px;
  background:
    radial-gradient(60% 60% at 20% 30%, rgba(34, 211, 238, 0.10), transparent 70%),
    radial-gradient(50% 50% at 80% 20%, rgba(16, 185, 129, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

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

img, svg { max-width: 100%; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.8rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 20px;
  position: relative;
  z-index: 1;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #041016; padding: 10px 16px;
  border-radius: 0 0 8px 0; font-weight: 600; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ----------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 13, 25, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.22rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; display: block; }
.brand .b-scan {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav a {
  color: var(--text-2);
  font-size: .93rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

/* ------------------------------------------------------------------- hero */

.hero { padding: clamp(44px, 7vw, 86px) 0 30px; text-align: center; }
.hero h1 { margin-bottom: 14px; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lede {
  color: var(--text-2);
  font-size: clamp(1rem, .95rem + .35vw, 1.16rem);
  max-width: 660px;
  margin: 0 auto 26px;
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--accent);
  font-size: .8rem; font-weight: 600;
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 20px;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .18);
}

/* Site-wide tool search */
.tool-search { max-width: 620px; margin: 0 auto; position: relative; }
.tool-search input {
  width: 100%;
  padding: 15px 18px 15px 48px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .15s, box-shadow .15s;
}
.tool-search input::placeholder { color: var(--muted); }
.tool-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .13);
}
.tool-search .icon {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; display: flex;
}

.search-results {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  display: none;
  box-shadow: var(--shadow);
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.search-results .sr-cat { color: var(--muted); font-size: .8rem; }
.search-results .sr-empty { padding: 14px 16px; color: var(--muted); }

/* ------------------------------------------------------------------ stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 34px 0 10px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.stat .n {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .l { color: var(--muted); font-size: .84rem; }

/* ------------------------------------------------------------------ cards */

.section { padding: 46px 0; }
.section-head { margin-bottom: 24px; }
.section-head p { color: var(--muted); margin: 0; }

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: inherit;
  transition: border-color .16s, transform .16s, background .16s;
}
a.card:hover {
  border-color: rgba(34, 211, 238, .45);
  background: var(--surface-2);
  transform: translateY(-2px);
  text-decoration: none;
}
.card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }

.card-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 13px;
}
.card .count {
  display: inline-block; margin-top: 12px;
  font-size: .78rem; font-weight: 600; color: var(--accent);
}

/* Compact tool list inside a category card */
.tool-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.tool-links a {
  font-size: .8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.tool-links a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------- tool pages */

.breadcrumb { font-size: .86rem; color: var(--muted); padding-top: 22px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 7px; opacity: .5; }

.tool-head { padding: 12px 0 26px; }
.tool-head .lede { color: var(--text-2); max-width: 70ch; margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .86rem; font-weight: 600; color: var(--text-2); }

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: .97rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: .9rem; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .13);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238296b3' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.field.check { flex-direction: row; align-items: center; gap: 9px; padding-top: 24px; }
.field.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.field.check label { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  font-size: .97rem; font-weight: 600; font-family: inherit;
  color: #04121a;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  border: 0; border-radius: 10px;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-ghost {
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- results */

.results { margin-top: 26px; }
.results:empty { display: none; }

.result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.result-block > h3 {
  font-size: .96rem; margin: 0 0 12px;
  color: var(--text-2); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700;
}

.kv { display: grid; grid-template-columns: minmax(130px, 210px) 1fr; gap: 1px; }
.kv > div { padding: 9px 12px; background: var(--bg-1); font-size: .92rem; word-break: break-word; }
.kv > div:nth-child(odd) { color: var(--muted); font-weight: 500; }
.kv > div:nth-child(even) { font-family: var(--mono); font-size: .87rem; }

.tbl-scroll { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
table.tbl th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
table.tbl td { font-family: var(--mono); font-size: .86rem; word-break: break-word; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }

pre.code {
  margin: 0; padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 10px; overflow-x: auto;
  font-family: var(--mono); font-size: .84rem; line-height: 1.55;
  color: var(--text-2); white-space: pre-wrap; word-break: break-word;
}

/* Grade badge */
.grade-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.grade {
  width: 76px; height: 76px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 18px;
  font-size: 1.85rem; font-weight: 800; letter-spacing: -.04em;
  border: 2px solid currentColor;
}
.grade.g-a { color: var(--ok);     background: rgba(52, 211, 153, .12); }
.grade.g-b { color: #a3e635;       background: rgba(163, 230, 53, .12); }
.grade.g-c { color: var(--warn);   background: rgba(251, 191, 36, .12); }
.grade.g-d { color: #fb923c;       background: rgba(251, 146, 60, .12); }
.grade.g-f { color: var(--danger); background: rgba(251, 113, 133, .12); }
.grade-meta .score { font-size: 1.05rem; font-weight: 700; }
.grade-meta .label { color: var(--muted); font-size: .9rem; }

/* Pass / warn / fail checklist */
.checks { display: flex; flex-direction: column; gap: 2px; }
.check {
  display: grid; grid-template-columns: 22px 1fr; gap: 11px;
  padding: 10px 12px; background: var(--bg-1); align-items: start;
}
.check .ico { font-weight: 800; line-height: 1.5; }
.check.pass .ico { color: var(--ok); }
.check.warn .ico { color: var(--warn); }
.check.fail .ico { color: var(--danger); }
.check .t { font-weight: 600; font-size: .93rem; }
.check .d { color: var(--muted); font-size: .86rem; font-family: var(--mono); word-break: break-word; }

/* Inline notes */
.note {
  padding: 12px 15px; border-radius: 10px; font-size: .9rem;
  border: 1px solid; margin-bottom: 14px;
}
.note.info   { background: rgba(96,165,250,.09);  border-color: rgba(96,165,250,.3);  color: #bfdbfe; }
.note.ok     { background: rgba(52,211,153,.09);  border-color: rgba(52,211,153,.3);  color: #a7f3d0; }
.note.warn   { background: rgba(251,191,36,.09);  border-color: rgba(251,191,36,.3);  color: #fde68a; }
.note.error  { background: rgba(251,113,133,.09); border-color: rgba(251,113,133,.3); color: #fecdd3; }

.list-plain { margin: 0; padding-left: 20px; color: var(--text-2); font-size: .92rem; }
.list-plain li { margin-bottom: 5px; font-family: var(--mono); font-size: .86rem; word-break: break-word; }

.meta-line { color: var(--muted); font-size: .84rem; margin-top: 4px; }

/* Loading state */
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(4,18,26,.3); border-top-color: #04121a;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- content */

.prose { max-width: 72ch; color: var(--text-2); }
.prose h2 { color: var(--text); margin-top: 1.6em; }
.prose h3 { color: var(--text); margin-top: 1.4em; }
.prose code {
  font-family: var(--mono); font-size: .88em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px; color: var(--accent);
}
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 18px;
  margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 10px 0 0; color: var(--muted); font-size: .93rem; }

/* ----------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
  margin-top: 60px;
  padding: 44px 0 30px;
}
.footer-grid {
  display: grid;
  gap: 30px;
  grid-template-columns: 1.4fr repeat(auto-fit, minmax(140px, 1fr));
}
.footer-grid h4 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 12px;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 7px; }
.footer-grid a { color: var(--text-2); font-size: .9rem; }
.footer-grid a:hover { color: var(--accent); }
.footer-about p { color: var(--muted); font-size: .9rem; max-width: 34ch; }
.footer-bottom {
  margin-top: 30px; padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: .85rem;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px 16px;
  }
  .nav.open { display: flex; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { padding-bottom: 2px; }
  .kv > div:nth-child(even) { padding-top: 2px; }
  .panel { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
