/* Filter calculators — dark theme matching contempl8 / biquad. */
:root {
  --navy:        #080c1a;
  --navy-mid:    #0f1530;
  --navy-card:   #121828;
  --navy-border: #1e2a45;
  --violet:      #7c3aed;
  --violet-dim:  rgba(124, 58, 237, 0.18);
  --cyan:        #06b6d4;
  --gold:        #f59e0b;
  --text:        #f0eeff;
  --text-sec:    rgba(240, 238, 255, 0.80);
  --text-muted:  rgba(240, 238, 255, 0.50);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 18px; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--navy);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding: 1.5rem;
  max-width: 1100px;
  margin-inline: auto;
}

/* ambient glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 8% 4%,  rgba(124, 58, 237, 0.13) 0%, transparent 70%),
    radial-gradient(ellipse 45% 32% at 92% 88%, rgba(6, 182, 212, 0.10) 0%, transparent 65%);
}

header, section, .filter-grid, footer { position: relative; z-index: 1; }

/* ── header ── */
header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--navy-border);
}
header h1 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
header a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
header a:hover { color: var(--cyan); }

/* ── sections / cards ── */
section {
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
h2 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin-bottom: 0.7rem;
}
/* hub family-group header */
h2.group {
  position: relative;
  z-index: 1;
  font-size: 0.84rem;
  margin: 1.9rem 0 0.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--navy-border);
}
h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.95rem 0 0.4rem;
}
h4 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan);
  margin: 0.9rem 0 0.25rem;
}
.mono { font-family: var(--mono); color: var(--text); }
.warn { color: var(--gold); font-size: 0.85rem; }
footer.legal {
  position: relative;
  z-index: 1;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--navy-border);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}
footer.legal a { color: var(--cyan); text-decoration: none; }
footer.legal a:hover { text-decoration: underline; }

/* ── schematic ──
   The SVG is fully self-colored/sized by js/schematic.js (style presets, label
   colors, halos). No fill/stroke/font-size overrides here — CSS rules beat SVG
   presentation attributes and would clobber the renderer's sizing & color coding. */
.schematic { padding: 1.8rem 1.1rem; text-align: center; }
.schematic svg { max-width: 640px; width: 100%; height: auto; display: block; margin: 0 auto; }

/* ── inputs ── */
.inputs label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.35rem 1rem 0.35rem 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inputs label small { text-transform: none; letter-spacing: 0; color: var(--text-muted); }
/* stacked variant: 2-column grid of controls (label text inline, input below) */
.inputs.stacked {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 1.3rem;
  align-items: start;
}
.inputs.stacked h2,
.inputs.stacked .note,
.inputs.stacked button,
.inputs.stacked label.wide { grid-column: 1 / -1; }
.inputs.stacked label { display: block; margin: 0.4rem 0; }
.inputs.stacked label[hidden] { display: none; }
.inputs.stacked label input,
.inputs.stacked label select { display: block; width: 100%; margin-top: 0.25rem; }

input[type=number], input[type=text], select {
  background: var(--navy-mid);
  color: var(--text);
  border: 1px solid var(--navy-border);
  padding: 0.5rem 0.7rem;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 1.05rem;
  outline: none;
  width: 10.5rem;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--violet); }
.inputs select { width: auto; }

button {
  background: var(--violet-dim);
  color: var(--text);
  border: 1px solid var(--violet);
  padding: 0.45rem 1.1rem;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}
button:hover { background: rgba(124, 58, 237, 0.30); }

/* ── outputs ── */
.outputs p { color: var(--text-sec); font-size: 0.9rem; margin: 0.3rem 0; }
.outputs p sub, .outputs p sup { color: var(--text-muted); }
.note { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.5rem; }
.outputs p, section > p { color: var(--text-sec); }
section strong { color: var(--text); font-weight: 600; }
ul.note { margin: 0.4rem 0 0.3rem 1.3rem; }
ul.note li { margin: 0.32rem 0; }
section .plot { margin-top: 0.8rem; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--cyan);
  background: var(--navy-mid); padding: 0.05rem 0.32rem; border-radius: 3px; }

/* ── result tables (designer) ── */
.result-table { border-collapse: collapse; width: 100%; margin: 0.4rem 0; font-size: 0.85rem; }
.result-table th, .result-table td { border: 1px solid var(--navy-border); padding: 0.35rem 0.6rem; text-align: left; }
.result-table th {
  background: var(--navy-mid);
  color: var(--text-sec);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.7rem;
}
.result-table td { font-family: var(--mono); color: var(--text); }

/* ── plots ── */
.plots { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .plots { grid-template-columns: 1fr 1fr; } }
.plot {
  width: 100%;
  height: 320px;
  background: var(--navy-mid);
  border: 1px solid var(--navy-border);
  border-radius: 6px;
}

/* ── hub cards ── */
.filter-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin: 1rem 0;
}
.filter-card {
  display: block;
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.filter-card:hover { border-color: var(--violet); transform: translateY(-2px); }
.filter-card h3 { margin: 0 0 0.35rem; color: var(--text); font-size: 1rem; }
.filter-card p { color: var(--text-muted); font-size: 0.82rem; }

/* representative topology thumbnail inside each card */
.card-schem {
  height: 80px;
  margin: 0.1rem 0 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--navy-border);
  padding-bottom: 0.55rem;
}
.card-schem svg { width: 100%; height: 80px; stroke-width: 1.4px; }
/* normalize stroke weight across cartoon/kicad sources at thumbnail scale */
.card-schem svg line, .card-schem svg path, .card-schem svg polyline,
.card-schem svg rect, .card-schem svg circle { vector-effect: non-scaling-stroke; }
