/* WISPHero site. Mobile-first, no framework. Colors: ink, mist, slate; green and red only where they mean healthy / outage. */

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #14222b;
  --mist: #f2f5f6;
  --slate: #627983;
  --slate-text: #4b5f68;
  --ok: #1f9d74;
  --bad: #c4372a;
  --bad-text: #c4372a;
  --warn: #c98a1b;
  --bg: var(--mist);
  --surface: #ffffff;
  --text: var(--ink);
  --muted: var(--slate-text);
  --line: #d3dcdf;
  --band-bg: var(--ink);
  --band-text: #e8eef0;
  --band-muted: #b4c3c9;
  --focus: #0b5cad;
  --button-bg: var(--ink);
  --button-text: #ffffff;
  --code-bg: #e4eaec;
  --shadow: 0 1px 2px rgb(20 34 43 / 0.08), 0 8px 24px rgb(20 34 43 / 0.08);

  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --step-0: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-1: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.25rem + 1.6vw, 2.4rem);
  --step-3: clamp(2.1rem, 1.4rem + 3vw, 3.6rem);
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --max: 74rem;
  --radius: 8px;
}

/* Light is the default. Dark applies only when the visitor picks it (site.js sets data-theme on the root). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1a21;
  --surface: #16252e;
  --text: #e8eef0;
  --muted: #a9bac1;
  --line: #2a3b45;
  --band-bg: #0a1217;
  --focus: #7fb8f0;
  --button-bg: #e8eef0;
  --button-text: #14222b;
  --code-bg: #1d2f39;
  --bad-text: #f08a7e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-kerning: normal;
}

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

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); line-height: 1.2; }

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}
p { max-width: 38rem; text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

code,
kbd,
pre {
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
}
code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  background: var(--button-bg);
  color: var(--button-text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
}
.skip:focus { top: 1rem; }

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

/* Header */
.site-head {
  padding-block: 1rem;
}
.site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.brand img {
  width: 160px;
  height: auto;
}
.brand .logo-for-dark,
:root[data-theme="dark"] .brand .logo-for-light { display: none; }
:root[data-theme="dark"] .brand .logo-for-dark { display: block; }
.theme-toggle {
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-toggle[hidden] { display: none; }
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.6rem;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.site-nav li:first-child a { padding-inline-start: 0; }
.site-nav a:hover { color: var(--text); text-decoration: underline; }

/* Hero */
.hero {
  padding-block: clamp(1.5rem, 5vw, 4.5rem) clamp(2rem, 5vw, 4rem);
}
.hero .wrap {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.lead {
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--text);
  max-width: 34rem;
}
.note {
  color: var(--muted);
  font-size: 0.95em;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.6rem 1.4rem;
  /* Transparent border: invisible normally, drawn as the button's outline in Windows high-contrast (forced colors). */
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--button-text);
  font: 500 1.0625rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { text-decoration: none; filter: brightness(1.15); }

/* Ping-graph strip (hero). Same language as the app's Ping Tool. */
.pg {
  margin: 0;
  padding: clamp(0.75rem, 2.5vw, 1.25rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pg-row + .pg-row { margin-top: 0.75rem; }
.pg-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.pg-name { font-weight: 500; }
.pg-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-val.is-bad { color: var(--bad-text); font-weight: 500; }
.pg-graph {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
}
.pg-graph svg {
  width: 100%;
  height: 2.6rem;
}
.pg-graph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--surface);
  transform-origin: right center;
  transform: scaleX(0);
  animation: pg-draw 1.8s cubic-bezier(0.3, 0.1, 0.3, 1) both;
}
.pg-row:nth-child(2) .pg-graph::after { animation-delay: 0.12s; }
.pg-row:nth-child(3) .pg-graph::after { animation-delay: 0.24s; }
.pg-row:nth-child(4) .pg-graph::after { animation-delay: 0.36s; }
@keyframes pg-draw {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
.band-g { fill: var(--ok); opacity: 0.1; }
.band-a { fill: var(--warn); opacity: 0.12; }
.band-r { fill: var(--bad); opacity: 0.1; }
.trace {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.75;
  stroke-linejoin: round;
}
.loss { fill: var(--bad); }
.pg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--muted);
}
.pg-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.key {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 2px;
}
.key-g { background: color-mix(in srgb, var(--ok) 35%, var(--surface)); }
.key-a { background: color-mix(in srgb, var(--warn) 40%, var(--surface)); }
.key-loss { background: var(--bad); }

/* Section divider: the same thin latency line */
.divider {
  height: 24px;
  margin-block: 0;
  background: url("../img/divider.svg") left center / 480px 24px repeat-x;
  opacity: 0.55;
}

.section {
  padding-block: clamp(2.5rem, 7vw, 5.5rem);
}
.section-intro { margin-bottom: clamp(1.5rem, 4vw, 3rem); }
.section-intro p { color: var(--muted); }

/* Feature index (table of contents). Phones: the seven jobs only; wider screens add the topics under each. */
.toc-groups {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}
.toc-groups > li {
  border-top: 1px solid var(--line);
  padding-block: 0.15rem;
}
.toc h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}
.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.toc a:hover { text-decoration: underline; }
.toc h3 a { padding-block: 0.25rem; }
.toc-groups ul {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}
.toc-groups ul a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--slate) 45%, transparent);
}
.toc-groups ul a:hover { text-decoration-color: currentColor; }
.toc-more {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 1rem 0 0;
  font-weight: 500;
}
.toc .toc-more a { text-decoration: underline; }

/* Job sections and topics */
.job { border-top: 1px solid var(--line); }
.topic + .topic { margin-top: clamp(3rem, 8vw, 5.5rem); }
.topic-lead { max-width: 42rem; }
.topic-text p:last-child { margin-bottom: 0; }
h4 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.small {
  color: var(--muted);
  font-size: 0.95em;
}
.after { margin-top: 1.5rem; max-width: 42rem; }
.split,
.split-shot {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}
.split { margin-top: 1.75rem; }
.split > div > :last-child { margin-bottom: 0; }
.split-shot { align-items: center; }
.topic > .split-shot { margin-bottom: 2rem; }

.shot { margin: 0; }
.topic > .shot { margin-top: 1.5rem; }
.shot img {
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.shot figcaption,
.closeups > figcaption {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 42rem;
}
.pair {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}

/* Definition lists: a term and one plain line */
.defs {
  margin: 0 0 1rem;
  border-top: 1px solid var(--line);
}
.defs > div {
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.defs dt,
.checks dt,
.proof dt {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.25;
}
.defs dd,
.checks dd {
  margin: 0.1rem 0 0;
  color: var(--muted);
}
.defs-wide { margin-top: 1.5rem; max-width: 52rem; }
.checks {
  display: grid;
  gap: 0 2rem;
  margin: 0 0 1rem;
}
.checks > div {
  padding-block: 0.65rem;
  border-top: 1px solid var(--line);
}
.checks dd,
.defs dd { font-size: 0.95em; }

/* Numbered steps */
.how {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  counter-reset: how;
}
.how > li {
  position: relative;
  padding-inline-start: 2.4rem;
  counter-increment: how;
  max-width: 40rem;
}
.how > li + li { margin-top: 0.7rem; }
.how > li::before {
  content: counter(how);
  position: absolute;
  inset-inline-start: 0;
  top: 0.1rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  border: 1.5px solid var(--slate);
  color: var(--text);
  font: 600 0.95rem/1 var(--font-head);
}
.ticks {
  margin: 0 0 1rem;
  padding-inline-start: 1.2rem;
}
.ticks li + li { margin-top: 0.3rem; }
.ticks li::marker { color: var(--slate); }

/* Card close-ups, a third larger than on screen so their small text reads, in one sideways strip */
.closeups { margin: 1.75rem 0 0; }
.strip {
  display: flex;
  gap: 1rem;
  /* Bleed to the screen edges so the next card peeks in and the row reads as scrollable. */
  margin: 0 calc(-1 * var(--gutter));
  padding: 0.25rem var(--gutter) 1rem;
  scroll-padding-inline: var(--gutter);
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}
.strip {
  align-items: flex-start;
}
.strip > li {
  flex: 0 0 min(452px, calc(100% - 1.25rem)); /* the next card peeks in, so the row reads as scrollable */
  scroll-snap-align: start;
}
.strip figure { margin: 0; }
.strip img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}
.strip figcaption {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.strip:focus-visible { outline-offset: -3px; }

/* One phone shot inside a light section */
.phone-solo figure {
  margin: 0;
  width: 300px;
  max-width: 100%;
}
.phone-solo figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.callout {
  border-inline-start: 4px solid var(--slate);
  padding: 0.25rem 0 0.25rem 1rem;
  max-width: 44rem;
}
.topic .callout { margin-top: 2rem; }
.callout p:last-child { margin-bottom: 0; }

/* Everything else: compact two-column list */
.more {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.more li {
  padding-block: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  break-inside: avoid;
}
.more strong { color: var(--text); font-weight: 500; }

/* How far each part is proven */
.proof {
  margin: 0;
  border-top: 2px solid var(--text);
}
.proof > div {
  display: grid;
  gap: 0.25rem 2rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
}
.proof dd { margin: 0; max-width: 46rem; }

/* Dark band: phones at true size */
.band {
  background: var(--band-bg);
  color: var(--band-text);
}
.band .section-intro p { color: var(--band-muted); }
.band :focus-visible { outline-color: #7fb8f0; }
.phones {
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0.5rem var(--gutter) 1.5rem;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain;
  scrollbar-color: #4b5f68 transparent;
}
.phone {
  flex: 0 0 auto;
  width: 300px;
  scroll-snap-align: start;
}
.phone figure { margin: 0; } /* the browser's default figure margin (40px each side) shrank the phones to 200px */
.phone-frame {
  padding: 9px;
  border: 1px solid #3a4c56;
  border-radius: 42px;
  background: #05090c;
}
.phone-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 33px;
  background: #0f1a21;
}
.phone figcaption {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  color: var(--band-muted);
  max-width: 300px;
}

.phones:focus-visible { outline-offset: -3px; }

/* Your server */
.points {
  display: grid;
  gap: 1.75rem 3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.points h3 { margin-bottom: 0.3em; }
.points p { margin: 0; color: var(--muted); }

/* Footer */
.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 2rem 2.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-foot p { margin-bottom: 0.4rem; }
.site-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Install page */
.install h1 { font-size: var(--step-2); }
.install .section { padding-block: clamp(1.5rem, 4vw, 3rem); }
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps > li {
  position: relative;
  padding-inline-start: 3rem;
  counter-increment: step;
}
.steps > li + li { margin-top: 2rem; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--button-bg);
  color: var(--button-text);
  font: 600 1.05rem/1 var(--font-head);
}
.steps h3 { font-size: var(--step-1); margin-top: 0.2rem; }
.cmd {
  position: relative;
  margin: 0 0 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.cmd code { background: none; padding: 0; }
.copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.copy-status { color: var(--muted); font-size: 0.95em; min-height: 1.6em; }
.req {
  padding-inline-start: 1.2rem;
}
.req li + li { margin-top: 0.25rem; }
.hash {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  background: var(--code-bg);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  display: block;
  max-width: 38rem;
}
.dl-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
}

/* 404 */
.notfound { padding-block: clamp(3rem, 12vw, 8rem); }

/* Wider screens */
@media (min-width: 40rem) {
  .points { grid-template-columns: 1fr 1fr; }
  .toc-groups > li { display: grid; grid-template-columns: min(13rem, 35%) minmax(0, 1fr); gap: 0 1.5rem; align-items: center; }
  .toc-groups ul { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
  .checks { grid-template-columns: 1fr 1fr; }
  .defs > div { display: grid; grid-template-columns: min(11rem, 32%) minmax(0, 1fr); gap: 0 1.5rem; }
  .defs dd { margin: 0; }
  .proof > div { grid-template-columns: min(15rem, 32%) minmax(0, 1fr); }
  .ticks { columns: 2; column-gap: 2.5rem; }
  .ticks li { break-inside: avoid; }
}

@media (min-width: 48rem) {
  .split-phone { grid-template-columns: 1fr 300px; gap: 2.5rem; }
  .pair { grid-template-columns: 1fr 1fr; }
  .more { columns: 2; column-gap: 3rem; }
}

@media (min-width: 60rem) {
  .hero .wrap { grid-template-columns: 1.05fr 1fr; }
  .split-shot { grid-template-columns: 5fr 7fr; gap: clamp(2rem, 4vw, 4rem); }
  .split { grid-template-columns: 1fr 1fr; gap: 3rem; }
  .split.split-phone { grid-template-columns: 1fr 300px; gap: 4rem; }
  .split-phone > div:first-child { max-width: 44rem; }
  .checks { grid-template-columns: repeat(3, 1fr); }
  .toc-groups > li { grid-template-columns: min(15rem, 30%) minmax(0, 1fr); }
  .split-shot.reverse,
  .reverse > .split-shot { grid-template-columns: 7fr 5fr; }
  .reverse .topic-text { order: 2; }
  /* Close-ups stay one sideways row (about two and a half cards show), so five tall cards do not stack into a wall. */
  .strip { gap: 1.5rem; margin-inline: 0; padding-inline: 0; scroll-padding-inline: 0; }
  /* Four phones in one row where they fit at 240 px; narrower desktops keep the sideways scroll. */
  .phones {
    max-width: var(--max);
    margin-inline: auto;
    gap: 2rem;
  }
  .phone { width: 240px; }
  .points { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pg-graph::after { animation: none; display: none; }
}

/* Windows high-contrast / forced colors: keep the hero graph's meaning (bands, red loss block, legend keys). */
@media (forced-colors: active) {
  .pg-graph svg, .key { forced-color-adjust: none; }
  .pg-graph::after { display: none; }
  .phone-frame { border-color: CanvasText; }
  .how > li::before { border-color: CanvasText; }
  .shot img, .strip img { border-color: CanvasText; }
}

@media print {
  .skip, .site-nav, .divider, .toc, .theme-toggle { display: none; }
  .pg-graph::after { display: none; }
  .band { background: none; color: inherit; }
  .band .section-intro p, .phone figcaption { color: inherit; }
  .phones { flex-wrap: wrap; overflow: visible; }
  .phone { width: 220px; break-inside: avoid; }
  .shot, .strip li, .phone-solo figure, .points li, .checks > div, .defs > div, .proof > div { break-inside: avoid; }
  .strip { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .shot img { box-shadow: none; }
}
