/* ==========================================================================
   DNS Filter Lists — design system
   Minimalistic, technical, accessible. Light + dark via prefers-color-scheme.
   Mobile-first; fluid typography with clamp(); no external fonts.
   ========================================================================== */

/* ----- Design tokens --------------------------------------------------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Light theme */
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --bg-inset: #f0f2f5;
  --surface: #ffffff;
  --text: #16191f;
  --text-muted: #5b636e;
  --border: #e2e5ea;
  --border-strong: #cdd2da;
  --accent: #1f4bd8;
  --accent-hover: #1a3fb5;
  --accent-contrast: #ffffff;
  --focus: #1f4bd8;
  --success: #0f7b45;
  --warning: #9a6a00;
  --danger: #b42318;
  --code-bg: #f4f5f8;

  --radius: 8px;
  --radius-sm: 6px;
  --container: 1200px;
  --container-narrow: 780px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --bg-alt: #0f1526;
    --bg-inset: #141b30;
    --surface: #111830;
    --text: #e8ebf2;
    --text-muted: #9aa4b8;
    --border: #232c44;
    --border-strong: #33405f;
    --accent: #6d8cff;
    --accent-hover: #8aa2ff;
    --accent-contrast: #0b1020;
    --focus: #8aa2ff;
    --success: #4cc98a;
    --warning: #e0b155;
    --danger: #ff7b6b;
    --code-bg: #0e1424;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

/* ----- Reset ----------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}
body {
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3,
h4 {
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.8vw, 2.5rem);
}
h2 {
  font-size: clamp(1.3rem, 1.15rem + 0.9vw, 1.7rem);
  margin-top: 2.25rem;
}
h3 {
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
}
p {
  margin: 0.75rem 0;
}
code,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ----- Accessibility helpers ------------------------------------------ */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0.5rem;
  text-decoration: none;
}

/* ----- Layout ---------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 0.5rem + 2vw, 2rem);
}
.container.narrow {
  max-width: var(--container-narrow);
}
.center {
  text-align: center;
}
.section {
  padding-block: clamp(2rem, 1.5rem + 3vw, 4rem);
}
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.section-head h2 {
  margin-top: 0;
}
.section-intro {
  color: var(--text-muted);
  max-width: 62ch;
  margin-bottom: 1.5rem;
}
.lede {
  font-size: clamp(1.02rem, 0.98rem + 0.4vw, 1.2rem);
  color: var(--text-muted);
  max-width: 68ch;
}

/* ----- Header ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 680;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  display: inline-flex;
  color: var(--accent);
}
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.nav-toggle-close {
  display: none;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-open {
  display: none;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-close {
  display: inline-flex;
}
.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
}
.nav-list a {
  color: var(--text-muted);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-list a:hover {
  color: var(--text);
  background: var(--bg-inset);
  text-decoration: none;
}
.nav-list a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-inset);
}
.nav-gh a {
  border: 1px solid var(--border-strong);
}

/* Mobile navigation */
@media (max-width: 820px) {
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem clamp(1rem, 0.5rem + 2vw, 2rem) 1rem;
    display: none;
    box-shadow: var(--shadow);
  }
  .site-nav.open {
    display: block;
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }
  .nav-list a {
    padding: 0.7rem 0.75rem;
  }
  .nav-gh a {
    justify-content: center;
    margin-top: 0.4rem;
  }
}
@media (min-width: 821px) {
  .nav-toggle {
    display: none;
  }
  .site-nav {
    display: block !important;
  }
}

/* ----- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 550;
  line-height: 1;
  padding: 0.6rem 0.95rem;
  min-height: 2.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.btn:hover {
  background: var(--bg-inset);
  text-decoration: none;
}
.btn:active {
  transform: translateY(0.5px);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-ghost {
  background: transparent;
}
.btn-sm {
  min-height: 2.15rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}
.btn-xs {
  min-height: 1.9rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.82rem;
  gap: 0.3rem;
}
.btn-block {
  width: 100%;
  margin-top: auto;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}
.btn-row.center {
  justify-content: center;
}

/* ----- Hero ------------------------------------------------------------ */
.hero {
  padding-block: clamp(2.5rem, 2rem + 4vw, 5rem);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.hero h1 {
  max-width: 18ch;
}
.hero .lede {
  margin-top: 0.85rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.badge-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0;
  margin-top: 1.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.badge-row li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.badge-row svg {
  color: var(--success);
}

/* ----- Stats ----------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}
.stat-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-block: 1.25rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat-icon {
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.stat-value {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

/* ----- Cards ----------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}
.card-grid.two {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.cat-card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--accent);
  flex: none;
}
.cat-icon.lg {
  width: 3rem;
  height: 3rem;
}
.cat-name {
  margin: 0;
}
.cat-name a {
  color: var(--text);
}
.cat-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0.6rem 0 0.9rem;
}
.cat-meta {
  display: flex;
  gap: 1.5rem;
  margin: 0 0 1rem;
}
.cat-meta dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cat-meta dd {
  margin: 0;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

/* ----- Popular list rows ---------------------------------------------- */
.list-rows {
  display: grid;
  gap: 0.75rem;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}
.list-row-main {
  min-width: 0;
  flex: 1 1 320px;
}
.list-row-title {
  margin: 0 0 0.35rem;
}
.list-row-title a {
  color: var(--text);
}
.list-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
}
.raw-url {
  display: block;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--text-muted);
}
.list-row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ----- Badges / misc text --------------------------------------------- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.muted {
  color: var(--text-muted);
}
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 550;
  font-size: 0.92rem;
}
.link-list {
  padding-left: 1.1rem;
}
.link-list li {
  margin: 0.3rem 0;
}

/* ----- Flow (how it works) -------------------------------------------- */
.flow {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}
.flow-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  flex: 1 1 auto;
}
.flow-icon {
  display: inline-flex;
  color: var(--accent);
}
.flow-label {
  font-weight: 550;
  font-size: 0.9rem;
  white-space: nowrap;
}
.flow-arrow {
  margin-left: auto;
  color: var(--text-muted);
}
@media (max-width: 700px) {
  .flow {
    flex-direction: column;
  }
  .flow-arrow {
    transform: rotate(90deg);
    margin: 0 auto;
  }
}

/* ----- Tables ---------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-alt);
}
.data-table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nowrap {
  white-space: nowrap;
}
.cell-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 550;
  color: var(--text);
}
.cell-desc {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.empty-state {
  padding: 1.25rem;
  color: var(--text-muted);
  text-align: center;
}

/* ----- Toolbar / fields ------------------------------------------------ */
.toolbar {
  margin: 1.25rem 0;
}
.field {
  position: relative;
  display: block;
}
.field-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.field input {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.85rem 0.65rem 2.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.field input::placeholder {
  color: var(--text-muted);
}
.field-lg input {
  padding-block: 0.8rem;
  font-size: 1.05rem;
}

/* ----- Search ---------------------------------------------------------- */
.search-form {
  display: flex;
  gap: 0.6rem;
  margin: 1.25rem 0 0.5rem;
  align-items: stretch;
}
.search-form .field {
  flex: 1;
}
.search-form .btn {
  flex: none;
}
.search-status {
  color: var(--text-muted);
  font-size: 0.9rem;
  min-height: 1.2rem;
}
.search-results {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}
.result-domain {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-all;
}
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.result-meta .mono {
  color: var(--text);
}
@media (max-width: 520px) {
  .search-form {
    flex-direction: column;
  }
}

/* ----- Code / pre ------------------------------------------------------ */
.code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1rem 0;
}
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.36em;
}

/* ----- Lists / steps --------------------------------------------------- */
.steps {
  padding-left: 1.25rem;
}
.steps li {
  margin: 0.4rem 0;
}
.check-list {
  list-style: none;
  padding: 0;
}
.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.4rem 0;
}
.check-list svg {
  color: var(--success);
  margin-top: 0.15rem;
  flex: none;
}
.note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.92rem;
  margin: 1rem 0;
}
.note svg {
  color: var(--warning);
  flex: none;
  margin-top: 0.15rem;
}
.disclaimer {
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 2rem;
}

/* ----- Breadcrumbs ----------------------------------------------------- */
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--border-strong);
}
.breadcrumbs [aria-current="page"] {
  color: var(--text);
}

/* ----- Page head ------------------------------------------------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* ----- Documentation layout ------------------------------------------- */
.doc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
.doc-toc {
  display: none;
}
.doc-main {
  min-width: 0;
}
.doc-main h2 {
  scroll-margin-top: 5rem;
}
@media (min-width: 960px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr) 220px;
  }
  .doc-toc {
    display: block;
    order: 2;
    position: sticky;
    top: 5rem;
    align-self: start;
    font-size: 0.88rem;
  }
  .doc-toc ul {
    list-style: none;
    padding: 0;
    border-left: 1px solid var(--border);
  }
  .doc-toc a {
    display: block;
    padding: 0.25rem 0.9rem;
    color: var(--text-muted);
  }
  .doc-toc a:hover {
    color: var(--text);
    text-decoration: none;
  }
  .toc-title {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding-left: 0.9rem;
    margin-bottom: 0.4rem;
  }
}

/* ----- 404 ------------------------------------------------------------- */
.error-code {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 2rem + 8vw, 6rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

/* ----- Footer ---------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  justify-content: space-between;
  padding-block: 2rem 1rem;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.footer-brand .brand-mark {
  color: var(--accent);
}
.footer-title {
  font-weight: 650;
  margin: 0;
}
.footer-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}
.footer-nav a {
  color: var(--text-muted);
}
.footer-nav a:hover {
  color: var(--text);
}
.footer-bottom {
  padding-bottom: 1.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ----- Copy button state ---------------------------------------------- */
.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ----- Reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
