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

:root {
  /* Backgrounds — light mode (default) */
  --bg:       oklch(97% 0.003 250);
  --surface:  oklch(100% 0.001 250);
  --hover:    oklch(94% 0.005 250);
  --border:   oklch(87% 0.005 250);
  --hairline: oklch(92% 0.004 250);

  /* Text */
  --text:      oklch(17% 0.005 250);
  --secondary: oklch(40% 0.005 250);
  --faint:     oklch(60% 0.004 250);

  /* Red accent — #d72638 */
  --burgundy:   oklch(57% 0.209 22);
  --burg-hi:    oklch(57% 0.209 22);
  --burg-faint: oklch(95% 0.035 22);

  /* Block type colors — light background */
  --c-http:    oklch(44% 0.22 22);
  --c-http-bg: oklch(95% 0.060 22);
  --c-ip:      oklch(48% 0.18 52);
  --c-ip-bg:   oklch(95% 0.055 52);
  --c-dns:     oklch(46% 0.14 82);
  --c-dns-bg:  oklch(95% 0.055 82);
  --c-ok:      oklch(38% 0.15 148);
  --c-ok-bg:   oklch(94% 0.055 148);
  --c-nd:      oklch(58% 0.005 20);
  --c-nd-bg:   transparent;

  /* Typography */
  --sans:  'DM Sans', system-ui, sans-serif;
  --mono:  'DM Mono', 'Courier New', monospace;

  /* Font size scale */
  --fs-sm:       0.72rem;  /* labels, tags, counts, table headers */
  --fs-body:     0.9rem;   /* table content, inputs, footer, legend */
}

[data-theme="dark"] {
  /* Backgrounds */
  --bg:       oklch(16% 0.008 20);
  --surface:  oklch(20% 0.008 20);
  --hover:    oklch(23% 0.010 20);
  --border:   oklch(28% 0.008 20);
  --hairline: oklch(23% 0.008 20);

  /* Text */
  --text:      oklch(95% 0.005 60);
  --secondary: oklch(90% 0.008 20);
  --faint:     oklch(55% 0.008 20);

  /* Red accent — #d72638 */
  --burgundy:   oklch(57% 0.209 22);
  --burg-hi:    oklch(60.438% 0.20002 22.794);
  --burg-faint: oklch(20% 0.065 22);

  /* Block type colors — dark background */
  --c-http:    oklch(65% 0.18 20);
  --c-http-bg: oklch(18% 0.06 20);
  --c-ip:      oklch(68% 0.14 50);
  --c-ip-bg:   oklch(18% 0.05 50);
  --c-dns:     oklch(70% 0.12 85);
  --c-dns-bg:  oklch(18% 0.04 85);
  --c-ok:      oklch(65% 0.13 145);
  --c-ok-bg:   oklch(16% 0.04 145);
  --c-nd:      oklch(40% 0.005 20);
  --c-nd-bg:   oklch(14% 0.005 20);
}

html { font-size: 22px; scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.22;
}

[data-theme="dark"] .hero-bg { opacity: 0.24; }

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    oklch(97% 0.003 250 / 0.82) 0%,
    oklch(97% 0.003 250 / 0.12) 40%,
    oklch(97% 0.003 250 / 0.97) 100%
  );
}

[data-theme="dark"] .hero-overlay {
  background: linear-gradient(
    to bottom,
    oklch(10% 0.008 20 / 0.60) 0%,
    oklch(10% 0.008 20 / 0.10) 40%,
    oklch(10% 0.008 20 / 0.92) 100%
  );
}

.hero-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.85rem 7rem;
  background: oklch(10% 0.008 20);
}

.hero-logo-link {
  grid-column: 2;
  justify-self: center;
}

.hero-logo { height: 36px; display: block; }

.theme-toggle {
  grid-column: 3;
  justify-self: end;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.6rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-toggle:hover .toggle-icon { opacity: 1; }

.toggle-icon {
  display: block;
  width: 24px;
  height: 24px;
  filter: invert(1);
  opacity: 0.55;
  transition: opacity 0.15s;
}

.toggle-icon-dark { display: none; }
[data-theme="dark"] .toggle-icon-light { display: none; }
[data-theme="dark"] .toggle-icon-dark  { display: block; }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.hero-date {
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.btn-explore {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bg);
  background: var(--text);
  padding: 0.55em 1.4em;
  border-radius: 2px;
  transition: opacity 0.15s;
}

.btn-explore:hover { opacity: 0.8; }

.hero-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 7rem 1rem;
  animation: fade-up 0.5s ease-out both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(1.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-content h1 {
  font-family: 'Neue Haas Grotesk Display Pro', 'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: clamp(2.53rem, 7.7vw, 4.95rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.hero-content h1 em {
  font-style: italic;
  color: var(--burg-hi);
}

.hero-subtitle {
  font-size: clamp(0.82rem, 2vw, 1.2rem);
  font-weight: 300;
  color: var(--secondary);
  max-width: 52ch;
  line-height: 1.35;
}


/* ===== HERO STATS ===== */
.hero-stats {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 1rem 7rem 5rem;
  border-top: none;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 0 3rem;
  border-right: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
}

.hero-stat:first-child { padding-left: 0; }
.hero-stat:last-child  { border-right: none; padding-right: 0; }

.hero-stat-number {
  font-family: 'Neue Haas Grotesk Display Pro', 'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-stat-label {
  font-size: var(--fs-body);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  line-height: 1.4;
}

/* ===== DATA LAYOUT ===== */
#data {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding: 2rem 7rem 5rem;
}

/* ===== METHODOLOGY ===== */
.methodology {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
}

.methodology summary {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--secondary);
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
  transition: color 0.15s;
}

.methodology summary:hover { color: var(--text); }

.methodology summary::before {
  content: '\203a';
  font-size: 1.1em;
  line-height: 1;
  transition: transform 0.15s;
}

.methodology[open] summary::before { transform: rotate(90deg); }

.methodology summary::-webkit-details-marker { display: none; }

.methodology-body {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.methodology-heading {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--burg-hi);
  margin-bottom: 0.6rem;
}

.methodology-col p {
  font-size: var(--fs-body);
  font-weight: 300;
  color: var(--secondary);
  line-height: 1.65;
}

.methodology-col p + p { margin-top: 0.5rem; }

.methodology-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.5rem 0;
}

.methodology-col ul li {
  font-size: var(--fs-body);
  font-weight: 300;
  color: var(--secondary);
  line-height: 1.5;
  padding-left: 1em;
  position: relative;
}

.methodology-col ul li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--faint);
}

.methodology-col a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--secondary);
  transition: text-decoration-color 0.15s;
}

.methodology-col a:hover { text-decoration-color: var(--text); }

.methodology-legend {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.legend-entry {
  display: flex;
  align-items: baseline;
  gap: 0.75em;
}

.legend-entry > .tag {
  min-width: 4em;
  text-align: center;
  flex-shrink: 0;
}

.legend-entry > span:last-child {
  font-size: var(--fs-body);
  font-weight: 300;
  color: var(--secondary);
  line-height: 1.5;
}

.table-section {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

/* ===== STICKY CONTROLS ===== */
.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
}

.controls label {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  white-space: nowrap;
}

.controls input {
  font-family: var(--sans);
  font-size: var(--fs-body);
  font-weight: 400;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--text);
  padding: 0.45em 0.7em;
  width: 100%;
  max-width: 320px;
  outline: none;
  transition: border-color 0.15s;
}

.controls input:focus { border-color: var(--burgundy); }
.controls input:focus-visible { outline: 2px solid var(--burg-hi); outline-offset: 2px; border-radius: 2px; }

.controls input::placeholder { color: var(--faint); }

.controls select {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--secondary);
  min-height: 2.1rem;
  padding: 0.45em 2.1rem 0.45em 0.75rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 1rem) calc(50% - 0.1rem),
    calc(100% - 0.76rem) calc(50% - 0.1rem);
  background-size: 0.34rem 0.34rem, 0.34rem 0.34rem;
  background-repeat: no-repeat;
  white-space: nowrap;
}

.controls select:hover,
.isp-dropdown-toggle:hover {
  border-color: var(--secondary);
  color: var(--text);
}

.controls select:focus {
  border-color: var(--burgundy);
}

.controls select:focus-visible,
.isp-dropdown-toggle:focus-visible {
  outline: 2px solid var(--burg-hi);
  outline-offset: 2px;
}

.isp-dropdown-toggle {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--secondary);
  min-height: 2.1rem;
  min-width: 8.4rem;
  padding: 0.45em 2.1rem 0.45em 0.75rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  white-space: nowrap;
  text-align: left;
}

.isp-dropdown {
  position: relative;
}

.isp-dropdown-toggle::after {
  content: '';
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.isp-dropdown.open .isp-dropdown-toggle {
  border-color: var(--secondary);
  color: var(--text);
}

.isp-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.4rem 0;
  z-index: 30;
  min-width: 10rem;
  box-shadow: 0 4px 12px oklch(0% 0 0 / 0.08);
}

[data-theme="dark"] .isp-dropdown-menu {
  box-shadow: 0 4px 12px oklch(0% 0 0 / 0.3);
}

.isp-dropdown.open .isp-dropdown-menu { display: block; }

.isp-dropdown-menu label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35em 0.75em;
  font-family: var(--sans);
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}

.isp-dropdown-menu label:hover { background: var(--hover); }

.isp-dropdown-menu input[type="checkbox"] {
  accent-color: var(--burg-hi);
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

/* Column visibility — hide ISP columns when toggled */
#data-table.hide-isp-0 .col-isp-0,
#data-table.hide-isp-1 .col-isp-1,
#data-table.hide-isp-2 .col-isp-2,
#data-table.hide-isp-3 .col-isp-3,
#data-table.hide-isp-4 .col-isp-4,
#data-table.hide-isp-5 .col-isp-5,
#data-table.hide-isp-6 .col-isp-6 { display: none; }

.btn-csv {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-left: auto;
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--secondary);
  white-space: nowrap;
  transition: color 0.15s;
}

.btn-csv:hover { color: var(--text); }

.count {
  font-size: var(--fs-sm);
  color: var(--faint);
  white-space: nowrap;
}

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: var(--fs-body);
  table-layout: fixed;
}

thead th {
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.7rem 0.9rem;
  text-align: center;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow:hidden;
}

/* First 3 columns: site, category, domain — sized explicitly */
thead th:nth-child(1) { width: 160px; text-align: left; }
thead th:nth-child(2) { width: 132px; text-align: left; }
thead th:nth-child(3) { width: 180px; text-align: left; }
/* ISP columns share remaining space equally */
thead th:nth-child(n+4) { width: 65px; }

[data-theme="dark"] thead th {
  background: var(--surface);
  color: var(--secondary);
}

thead th:last-child { border-right: none; }

tbody tr {
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s;
}

tbody tr:not(.table-state):hover { background: var(--hover); }

tbody td {
  font-size: 0.78rem;
  padding: 0.42rem 0.9rem;
  white-space: nowrap;
  border-right: 1px solid var(--hairline);
}

tbody td:last-child { border-right: none; }

td.site {
  font-family: var(--sans);
  font-weight: 500;
  color: var(--text);
  vertical-align: middle;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  border-right: 1px solid var(--border);
}

td.category {
  font-family: var(--sans);
  font-size: 0.64rem;
  font-weight: 500;
  color: var(--secondary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-right: 1px solid var(--hairline);
}

.category-short { display: none; }
.category-long { display: inline; }

td.domain {
  font-family: var(--mono);
  font-weight: 400;
  color: var(--secondary);
  overflow: hidden;
  border-right: 1px solid var(--hairline);
}

.domain-text {
  overflow-x: auto;
  white-space: nowrap;
}

td.status {
  text-align: center;
  vertical-align: middle;
  padding: 0.32rem 0.6rem;
  white-space: normal;
}

td.status .tag {
  display: block;
  font-size: 0.64rem;
  width: fit-content;
  margin-inline: auto;
}

td.status .tag + .tag {
  margin-top: 0.2em;
}

/* ===== TAG COMPONENT ===== */
.tag {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.2em 0.55em;
  border-radius: 2px;
  letter-spacing: 0.05em;
  display: inline-block;
}

.tag-http { background: var(--c-http-bg); color: var(--c-http); }
.tag-ip   { background: var(--c-ip-bg);   color: var(--c-ip); }
.tag-dns  { background: var(--c-dns-bg);  color: var(--c-dns); }
.tag-ok   { background: var(--c-ok-bg);   color: var(--c-ok); }
.tag-nd   { background: transparent; color: var(--faint); padding-left: 0; padding-right: 0; }

/* ===== FOOTER ===== */
.footer {
  background: oklch(10% 0.008 20);
  border-top: none;
  padding: 2rem 7rem;
  font-size: var(--fs-body);
  color: oklch(92% 0.005 60);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-data {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-logo-link { display: flex; }
.footer-logo { height: 36px; display: block; }

.footer-license {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--fs-body);
  opacity: 0.55;
}

.footer-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.8rem;
}

.footer-nav a {
  color: oklch(92% 0.005 60);
  text-decoration: none;
  transition: opacity 0.15s;
  opacity: 0.55;
  display: flex;
}

.footer-source {
  font-size: var(--fs-body);
  opacity: 0.55;
}

.footer-source a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-nav a:hover { opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  #data { padding: 2rem 4rem 4rem; }
  thead th:nth-child(2) { width: 80px; }
  .category-short { display: inline; }
  .category-long { display: none; }
}
@media (max-width: 860px) {
  .hero-header { padding: 0.85rem 4rem; }
  .hero-content { padding: 0 4rem 1rem; }
  .hero-stats { padding: 1rem 4rem 5rem; }
  #data { padding: 2rem 4rem 4rem; }
  .methodology-body { grid-template-columns: 1fr; }
  .footer { padding: 2rem 4rem; }
}

@media (max-width: 600px) {
  .hero { min-height: auto; min-height: 100svh; }
  .hero-header { padding: 0.85rem 1.5rem; }

  .hero-content { padding: 0 1.5rem 0.5rem; }
  .hero-content h1 { font-size: clamp(2.4rem, 9vw, 4.95rem); }

  .hero-stats { padding: 0.75rem 1.5rem 3rem; flex-wrap: wrap; gap: 1.5rem; }
  .hero-stat { border-right: none; padding: 0; }
  .hero-stat-number { font-size: clamp(2.2rem, 10vw, 5rem); }

  .hero-actions { gap: 1rem; margin-top: 1rem; }
  .hero-date { font-size: 0.55rem; }
  .btn-explore { font-size: 0.55rem; padding: 0.5em 1.2em; }

  #data { padding: 2rem 1.5rem 3rem; }
  .footer { padding: 1.5rem 1.5rem; flex-direction: column; align-items: flex-start; }
  .controls input { max-width: none; }
}

@media (max-width: 600px) and (orientation: landscape) {
  .hero { min-height: auto; }
  .hero-content { padding: 1rem 1.5rem; }
  .hero-stats { padding: 1rem 1.5rem 1.5rem; }
}

/* ===== UTILITIES ===== */

/* Global focus ring for keyboard nav */
:focus-visible {
  outline: 2px solid var(--burg-hi);
  outline-offset: 3px;
  border-radius: 1px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.table-state td {
  padding: 2rem 2.5rem;
  color: var(--faint);
  font-size: var(--fs-body);
  font-weight: 300;
  text-align: left;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
