/* Private Search: light and dark themes from one set of role tokens. */
:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --border: #e2e0da;
  --border-strong: #cfccc4;
  --text: #17171a;
  --text-2: #52514e;
  --text-3: #7d7b75;
  --link: #1a4fb5;
  --link-visited: #6a3fb0;
  --focus: #2a78d6;
  --button: #17171a;
  --button-text: #ffffff;
  --series-1: #2a78d6;  /* DNS lookup */
  --series-2: #eb6834;  /* server fetch */
  --series-3: #1baf7a;  /* page fetch */
  --good-bg: #e5f4e5;
  --good-text: #1d6b1d;
  --plain-bg: #fdf0d8;
  --plain-text: #8a5300;
  --critical-bg: #fbe9e9;
  --critical-text: #a32626;
  --critical: #d03b3b;
  --grid: #ecebe6;
  --shadow: 0 1px 2px rgba(23, 23, 26, 0.05), 0 2px 8px rgba(23, 23, 26, 0.04);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #2e2e2b;
    --border-strong: #3d3d39;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #93928a;
    --link: #8ab4f8;
    --link-visited: #c58af9;
    --focus: #3987e5;
    --button: #f0efec;
    --button-text: #121211;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --good-bg: #16301a;
    --good-text: #7fd47f;
    --plain-bg: #3a2a0c;
    --plain-text: #f2c063;
    --critical-bg: #3a1716;
    --critical-text: #f19a9a;
    --grid: #262624;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #232321;
  --border: #2e2e2b;
  --border-strong: #3d3d39;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #93928a;
  --link: #8ab4f8;
  --link-visited: #c58af9;
  --focus: #3987e5;
  --button: #f0efec;
  --button-text: #121211;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --good-bg: #16301a;
  --good-text: #7fd47f;
  --plain-bg: #3a2a0c;
  --plain-text: #f2c063;
  --critical-bg: #3a1716;
  --critical-text: #f19a9a;
  --grid: #262624;
  --shadow: none;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px 48px;
  flex: 1;
}

a { color: var(--link); }
code { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Top bar ---------------------------------------------------------------------------------------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 16px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand-mark { width: 22px; height: 22px; color: var(--series-1); }
.brand-hole { fill: var(--surface); }
.top-note { color: var(--text-3); font-size: 13px; }

/* Hero and search bar -------------------------------------------------------------------------- */
.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}
.lead {
  margin: 0 auto 28px;
  max-width: 560px;
  color: var(--text-2);
  font-size: 16px;
  text-wrap: pretty;
}
body.has-run .hero { padding-top: 28px; }
body.has-run .hero h1, body.has-run .lead { display: none; }

.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 6px 6px 6px 46px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.searchbar:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.searchbar-icon { position: absolute; left: 17px; width: 20px; height: 20px; color: var(--text-3); }
.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  padding: 8px 0;
}
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.searchbar button {
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.searchbar button:hover { opacity: 0.88; }
.searchbar button:disabled { opacity: 0.45; cursor: progress; }
.option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
}
.option input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--series-3); }
.servers {
  margin: 14px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

/* The run: steps ------------------------------------------------------------------------------- */
.run { margin-top: 8px; }
.run-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 6px;
}
.run-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.run-total { margin: 0; color: var(--text-2); font-variant-numeric: tabular-nums; }
.run-total strong { color: var(--text); font-size: 19px; margin-left: 4px; }

.lane-label {
  margin: 18px 0 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
/* Two columns: the encrypted steps on the left, the unencrypted server fetch on the right */
.lanes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; align-items: start; }
.lanes.solo { grid-template-columns: minmax(0, 1fr); }   /* the server fetch is not shown */
.lane { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lane[hidden] { display: none; }
.lane .lane-label { margin-bottom: -6px; }

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.step[hidden] { display: none; }
.step::before {                             /* the step's series color, as on the timeline */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--step-color);
  opacity: 0.35;
  transition: opacity 0.2s;
}
.step[data-series="1"] { --step-color: var(--series-1); }
.step[data-series="2"] { --step-color: var(--series-2); }
.step[data-series="3"] { --step-color: var(--series-3); }
.step[data-state="running"]::before, .step[data-state="done"]::before { opacity: 1; }
.step[data-state="idle"] { opacity: 0.7; }

.step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-head h3 { margin: 0; font-size: 15.5px; letter-spacing: -0.005em; flex: 1; min-width: 10ch; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.badge-private { background: var(--good-bg); color: var(--good-text); }
.badge-plain { background: var(--plain-bg); color: var(--plain-text); }

.step-what { margin: 8px 0 12px; color: var(--text-2); font-size: 13.5px; text-wrap: pretty; }

.step-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}
.answer {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow-wrap: anywhere;
}
.answer .mono { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.answer .sub { display: block; color: var(--text-3); font-size: 12.5px; font-weight: 500; letter-spacing: 0; }
.step[data-state="idle"] .answer, .step[data-state="running"] .answer { color: var(--text-2); font-weight: 500; font-size: 15px; }
.step[data-state="running"] .answer::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--step-color);
  vertical-align: 2px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }

.clock {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-size: 13px;
}
.clock [data-field="clock"] { color: var(--text); font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 16px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.facts:empty { display: none; }
.facts div { min-width: 0; }
.facts div.wide { grid-column: 1 / -1; }
.facts div.wide dd { font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.facts dt { color: var(--text-3); font-size: 12px; }
.facts dd { margin: 1px 0 0; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts dd small { color: var(--text-3); font-weight: 500; font-size: 12px; }

.step-error, .fatal {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--critical-bg);
  color: var(--critical-text);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.step-error[hidden], .fatal[hidden] { display: none; }
.step-error::before, .fatal::before {
  content: "!";
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--critical);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.step[data-state="failed"]::before { background: var(--critical); opacity: 1; }
.step[data-state="skipped"] { opacity: 0.75; }

/* Timeline --------------------------------------------------------------------------------------- */
.timeline {
  margin: 22px 0 0;
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}
.timeline figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.timeline-title { font-weight: 650; }
.legend { display: inline-flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item[hidden] { display: none; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--series-1); }
.swatch[data-series="2"] { background: var(--series-2); }
.swatch[data-series="3"] { background: var(--series-3); }

.tl { --label: 132px; font-size: 12.5px; }
.tl-group { margin-top: 6px; }
.tl-group-name { margin: 8px 0 2px; color: var(--text); font-weight: 600; font-size: 12.5px; }
.tl-row { display: grid; grid-template-columns: var(--label) 1fr; align-items: center; min-height: 22px; }
.tl-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.tl-track { position: relative; height: 22px; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.tl-bar {
  position: absolute;
  top: 6px;
  height: 10px;
  min-width: 2px;
  border-radius: 4px;
  background: var(--series-1);
  cursor: default;
  outline-offset: 1px;
}
.tl-bar[data-series="2"] { background: var(--series-2); }
.tl-bar[data-series="3"] { background: var(--series-3); }
.tl-bar:hover, .tl-bar:focus-visible { filter: brightness(1.12); }
.tl-value {
  position: absolute;
  top: 2px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.tl-axis { display: grid; grid-template-columns: var(--label) 1fr; margin-top: 6px; }
.tl-axis-track { position: relative; height: 18px; border-top: 1px solid var(--border-strong); }
.tl-tick { position: absolute; top: 3px; transform: translateX(-50%); color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-tick:first-child { transform: none; }

/* The break where the wait for the server fetch is cut out of the timeline: two slanted strokes */
.tl-break {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  background: var(--surface);                 /* interrupts the grid lines */
}
.tl-break::before, .tl-break::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 2px;
  border-radius: 1px;
  background: var(--text-3);
  transform: skewX(-22deg);
}
.tl-break::before { left: 4px; }
.tl-break::after { left: 10px; }
.tl-axis-track .tl-break { top: -6px; bottom: auto; height: 12px; cursor: default; }
.tl-axis-track .tl-break::before, .tl-axis-track .tl-break::after { top: 0; bottom: 0; }

.tooltip {
  position: absolute;
  z-index: 10;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.tooltip strong { display: block; }

/* Results ---------------------------------------------------------------------------------------- */
.results { margin-top: 34px; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; }
.results-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.results-meta { margin: 0; color: var(--text-3); font-size: 13px; }
.result-list { list-style: none; margin: 14px 0 0; padding: 0; max-width: 680px; }
.result-list:empty { display: none; }
.page-wrap {                                /* DuckDuckGo's page, assembled from privately fetched chunks */
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.page-wrap[hidden] { display: none; }
.page-frame { display: block; width: 100%; height: min(80vh, 1100px); border: 0; background: #ffffff; }
.result { padding: 14px 0 16px; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.r-site { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; min-width: 0; }
.r-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.r-where { min-width: 0; line-height: 1.3; }
.r-name { display: block; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-url { display: block; color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title {
  display: inline-block;
  color: var(--link);
  font-size: 19px;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.r-title:hover { text-decoration: underline; }
.r-title:visited { color: var(--link-visited); }
.r-snippet { margin: 4px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.results-empty { color: var(--text-2); }
.results-foot { margin: 18px 0 0; color: var(--text-3); font-size: 13px; }

/* Footer ----------------------------------------------------------------------------------------- */
.bottom { padding: 18px 16px 28px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.bottom p { margin: 0; }

/* Narrow screens --------------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .lanes { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-top: 36px; }
  .tl { --label: 116px; font-size: 12px; }
  .tl-value { display: none; }
}
@media (max-width: 420px) {
  .wide-only { display: none; }
  .searchbar { padding-left: 40px; }
  .searchbar-icon { left: 14px; }
  .searchbar button { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
