/* PageUtil. One stylesheet. Tokens follow the Telemetry Pulse design and the PageUtil screens. */

:root {
  --canvas: #f8f9ff;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --emerald: #006948;
  --emerald-dark: #005137;
  --emerald-soft: #ecfdf5;
  --emerald-ink: #065f46;
  --emerald-line: #a7f3d0;
  --indigo: #4b41e1;
  --indigo-dark: #3323cc;
  --indigo-soft: #eef2ff;
  --rose: #ba0035;
  --rose-soft: #fff1f2;
  --rose-ink: #920028;
  --rose-line: #fecdd3;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-ink: #92400e;
  --amber-line: #fde68a;
  --ad: #f1f5f9;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 15px -3px rgba(15, 23, 42, 0.07);
  --sans: "Geist", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;
  --max: 1280px;
  --header: 72px;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding-top: var(--header);
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 22px;
  min-height: 100vh;
}

img, svg, canvas { display: block; max-width: 100%; height: auto; }

/* Author display rules must not override the hidden attribute. */
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--indigo-dark); }

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

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

.wrap {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.mono, .control.mono, .metric-value, .badge, .ad-label, .eyebrow-label, .kv dd, .out, .data {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* Header */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--header);
  background: rgba(248, 249, 255, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
}

.bar {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { color: var(--ink); }

.wordmark { width: 148px; height: 36px; }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  padding: 0;
}

.nav-toggle > span,
.nav-toggle > span::before,
.nav-toggle > span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

.nav-toggle > span {
  position: relative;
}

.nav-toggle > span::before,
.nav-toggle > span::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 160ms ease, top 160ms ease;
}

.nav-toggle > span::before { top: -6px; }
.nav-toggle > span::after { top: 6px; }

.nav-toggle[aria-expanded="true"] > span { background: transparent; }

.nav-toggle[aria-expanded="true"] > span::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] > span::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 18px;
  padding: 6px 10px;
  border-radius: 8px;
}

.nav a:hover { color: var(--ink); background: #eff4ff; }

.nav a[aria-current="page"] {
  color: var(--ink);
  background: #e5eeff;
  font-weight: 600;
}

/* Hero */

.hero {
  position: relative;
  padding: 2.5rem 0 1.25rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8rem;
  width: 720px;
  height: 360px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0, 105, 72, 0.14), rgba(75, 65, 225, 0.05) 55%, transparent 75%);
  pointer-events: none;
}

.hero-inner { position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #eff4ff;
  border-radius: 999px;
  padding: 6px 14px;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(0, 105, 72, 0.6);
  animation: ping 1.8s ease-out infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(0, 105, 72, 0.45); }
  100% { box-shadow: 0 0 0 8px rgba(0, 105, 72, 0); }
}

.eyebrow-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 14px;
}

h1 {
  margin: 0 auto 0.75rem;
  max-width: 22em;
  font-size: 48px;
  line-height: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.accent { color: var(--emerald); }

.lede {
  margin: 0 auto;
  max-width: 46rem;
  color: var(--muted);
  font-size: 18px;
  line-height: 28px;
}

.page { padding-bottom: 2rem; }

/* Layout */

.explain {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  position: relative;
}

.panel .lip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: transparent;
}

.panel.lip-up .lip { background: var(--emerald); }
.panel.lip-down .lip { background: var(--rose); }
.panel.lip-warn .lip { background: var(--amber); }

.ad-slot {
  background: var(--ad);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-inline: auto;
}

.ad-slot-rail {
  min-height: 250px;
  width: 100%;
  max-width: 300px;
}

.ad-slot-leader {
  min-height: 90px;
  width: 100%;
  max-width: 728px;
}

.ad-label {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant: all-small-caps;
  text-transform: lowercase;
  color: var(--faint);
}

.how, .notes {
  background: #eff4ff;
  border-radius: 8px;
  padding: 1.5rem;
}

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.related-list a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.related-list a:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); color: var(--ink); }

.notes {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--indigo);
}

h2 {
  margin: 0.25rem 0 0.75rem;
  font-size: 20px;
  line-height: 28px;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.how p:last-child, .notes p { margin: 0; color: #3d4a42; }

.notes ol, .notes ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.75rem; }
.notes li { padding-left: 0.15rem; }
.notes strong { display: block; }

.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.related a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
}

.related a:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); }
.related a span { color: var(--muted); font-size: 13px; }

/* FAQ */

.faq-band {
  background: #eff4ff;
  padding: 3rem 0;
  margin-top: 1rem;
}

.faq-head { text-align: center; margin-bottom: 1rem; }

.faq details {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  box-shadow: var(--shadow);
}

.faq summary {
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

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

.faq summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  flex: none;
  margin-top: -4px;
}

.faq details[open] summary::after { transform: rotate(225deg); margin-top: 4px; }

.faq details p { margin: 0.75rem 0 0; color: var(--muted); }

/* Forms and results */

.tool-form, .stack { display: grid; gap: 0.9rem; }

.row-2, .row-3 { display: grid; gap: 0.9rem; }

.field { display: grid; gap: 0.35rem; text-align: left; }

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.control {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  padding: 0.7rem 0.8rem;
  font-size: 14px;
  line-height: 20px;
}

textarea.control { min-height: 9rem; resize: vertical; }

.control:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
  outline: none;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 0.7rem 1rem;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
}

.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-dark); color: #fff; }
.btn-indigo { background: var(--indigo); color: #fff; }
.btn-indigo:hover { background: var(--indigo-dark); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-strong); box-shadow: var(--shadow-hover); color: var(--ink); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.checks { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.check { display: flex; gap: 0.4rem; align-items: center; font-size: 14px; }

.help, .banner {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
}

.banner {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border: 1px solid var(--amber-line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.banner.info {
  background: var(--indigo-soft);
  color: #312e81;
  border-color: #c7d2fe;
}

.result { margin-top: 1rem; display: grid; gap: 0.75rem; }
.result-empty { margin: 0; color: var(--muted); }
.result img, .result svg { max-width: 100%; height: auto; }

.err {
  background: var(--rose-soft);
  color: var(--rose-ink);
  border: 1px solid var(--rose-line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin: 0;
}

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.metric {
  background: #eff4ff;
  border-radius: 8px;
  padding: 0.85rem;
}
.metric-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric-value {
  display: block;
  margin-top: 0.25rem;
  font-size: 28px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.metric-note { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 12px; font-family: var(--mono); }

.kv { display: grid; gap: 0.55rem; margin: 0; }
.kv div { display: grid; grid-template-columns: minmax(7rem, 34%) 1fr; gap: 0.75rem; }
.kv dt { margin: 0; color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 500; }

.out, .data {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow: auto;
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.badge-up { background: var(--emerald-soft); color: var(--emerald-ink); border-color: var(--emerald-line); }
.badge-down { background: var(--rose-soft); color: var(--rose-ink); border-color: var(--rose-line); }
.badge-warn { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber-line); }
.badge-info { background: var(--indigo-soft); color: #312e81; border-color: #c7d2fe; }
.badge-muted { background: #f1f5f9; color: var(--muted); border-color: var(--line); }

.swatch {
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.sample { white-space: pre-wrap; overflow-wrap: anywhere; }
.sample mark { background: #fde68a; color: inherit; padding: 0 1px; }

.diff { display: grid; gap: 2px; font-family: var(--mono); font-size: 13px; line-height: 20px; }
.diff div { padding: 2px 8px; border-radius: 4px; white-space: pre-wrap; }
.diff-same { background: #f8fafc; }
.diff-add { background: var(--emerald-soft); }
.diff-del { background: var(--rose-soft); }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-family: var(--mono); }

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 40rem;
  margin: 1.5rem auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0.6rem 0.35rem 0.9rem;
}

.search-box:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(75, 65, 225, 0.2); }

#tool-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 20px;
  padding: 0.45rem 0;
  min-width: 0;
}

#tool-search-input:focus { outline: none; }

#search-clear-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.search-hint {
  display: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}

#category-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 20px;
}

.cat-pill .count {
  font-family: var(--mono);
  font-size: 11px;
}

.cat-pill.is-active {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.browser-only {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  font-size: 14px;
}

.trust {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.directory-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1.5rem 0 1rem;
}

#displayed-counter { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 13px; }

#tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

#tools-grid > a {
  display: flex;
  color: inherit;
  text-decoration: none;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

#tools-grid > a:hover .tool-card { border-color: var(--line-strong); box-shadow: var(--shadow-hover); }

.tool-card h3 { margin: 0; font-size: 16px; line-height: 24px; letter-spacing: -0.005em; }

.tool-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 18px; flex: 1; }

.card-cat { color: var(--indigo); font-weight: 600; font-size: 12px; }

.open-tool { color: var(--emerald); font-weight: 600; font-size: 12px; }

#no-results-msg { margin-top: 1.5rem; text-align: center; }

.faq-wrap { display: grid; gap: 1.5rem; }

.privacy-copy { display: grid; gap: 0.9rem; }
.privacy-copy p { margin: 0; }

.footer {
  margin-top: 2.5rem;
  background: #eff4ff;
  color: var(--muted);
}

.footer-main {
  display: grid;
  gap: 0.75rem;
  padding-top: 2rem;
}

.footer-note { margin: 0; max-width: 42rem; font-size: 14px; line-height: 22px; }

.footer-groups {
  display: grid;
  gap: 1.25rem;
  padding-block: 1.5rem;
}

.footer-group { display: grid; gap: 0.35rem; }
.footer-group p { margin: 0 0 0.25rem; color: var(--ink); font-weight: 600; font-size: 14px; }
.footer-group a, .footer-legal a { color: var(--muted); text-decoration: none; font-size: 13px; }
.footer a:hover { color: var(--ink); }

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  padding-bottom: 2rem;
  font-size: 13px;
}

.footer-legal p { margin: 0; }

/* Consent */

.consent {
  position: fixed;
  z-index: 50;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  max-width: 46rem;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 1rem 1.1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
}

.consent p { margin: 0.25rem 0 0; color: var(--muted); font-size: 13px; line-height: 18px; }
.consent .actions { flex: none; }

/* Directory filter empty */

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

@media (min-width: 720px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr 1fr; }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .trust { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #tools-grid { grid-template-columns: 1fr 1fr; }
  .footer-groups { grid-template-columns: 1fr 1fr; }
  .search-hint { display: inline; }
}

@media (min-width: 1024px) {
  .wrap { width: min(var(--max), calc(100% - 4rem)); }
  .explain { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); align-items: start; }
  #tools-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  h1 { font-size: 32px; line-height: 40px; letter-spacing: -0.02em; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header);
    left: 0;
    right: 0;
    background: var(--canvas);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 0.75rem;
    gap: 0.25rem;
  }
  .nav.is-open { display: flex; }
  .nav a {
    font-size: 15px;
    line-height: 22px;
    padding: 12px 12px;
  }
  .consent { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
  html { scroll-behavior: auto; }
  .nav-toggle > span::before,
  .nav-toggle > span::after { transition: none; }
}
