@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poiret-one-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Poiret One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poiret-one-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Urbanist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/urbanist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Urbanist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/urbanist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bb-bg-base: #1F1D1C;
  --bb-bg-surface: #2C2A27;
  --bb-bg-raised: #363330;
  --bb-bg-muted: #49453F;
  --bb-text-primary: #F5F5F3;
  --bb-text-secondary: #B8B5AE;
  --bb-text-ink: #2A2824;
  --bb-text-subtle: #49453F;
  --bb-light-bg: #F5F4F0;
  --bb-light-surface: #ECEAE4;
  --bb-light-border: #D8D6D0;
  --bb-green-deep: #2D5C4F;
  --bb-green-mid: #3D7A6A;
  --bb-green-bright: #5AA68F;
  --bb-green-subtle: #D0EAE4;
  --bb-amber-mid: #C8A96E;
  --bb-amber-deep: #816026;
  --bb-red-mid: #CF8174;
  --bb-red-deep: #8E4034;
  --bb-primary-600: #387061;
  --bb-primary-700: #326658;
  --bb-gray-900: #1F1D1C;
  --bb-gray-950: #161411;

  --bb-font-display: 'Poiret One', sans-serif;
  --bb-font-sans: 'Urbanist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --bb-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --bg: var(--bb-light-bg);
  --surface: var(--bb-light-surface);
  --text: var(--bb-text-ink);
  --muted: var(--bb-text-subtle);
  --line: var(--bb-light-border);
  --accent: var(--bb-green-deep);
  --gauge-track: var(--bb-light-border);
  --gauge-dl: var(--bb-green-mid);
  --gauge-ul: var(--bb-amber-deep);
  --danger: var(--bb-red-deep);
  --shadow: 0 1px 3px rgba(22, 20, 17, 0.12), 0 1px 2px rgba(22, 20, 17, 0.08);
  --shadow-lg: 0 10px 15px rgba(22, 20, 17, 0.12), 0 4px 6px rgba(22, 20, 17, 0.08);

  color-scheme: light;
  font-size: clamp(1.0625rem, 1.01rem + 0.28vw, 1.125rem);
}

:root.dark {
  --bg: var(--bb-bg-base);
  --surface: var(--bb-bg-surface);
  --text: var(--bb-text-primary);
  --muted: var(--bb-text-secondary);
  --line: var(--bb-bg-raised);
  --accent: var(--bb-green-bright);
  --gauge-track: var(--bb-bg-raised);
  --gauge-dl: var(--bb-green-bright);
  --gauge-ul: var(--bb-amber-mid);
  --danger: var(--bb-red-mid);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.45), 0 4px 6px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--bb-font-sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--bb-font-display);
  font-weight: 400;
  font-synthesis: none;
  line-height: 1.2;
  margin: 0;
}

a {
  color: var(--accent);
  font-weight: 500;
  text-underline-offset: 0.2em;
}

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--bb-primary-600);
  color: var(--bb-text-primary);
  border-radius: 0.5rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-nav {
  background: var(--bb-gray-950);
  color: var(--bb-text-primary);
}

.nav-inner {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: block;
  transition: opacity 0.15s;
}

.site-logo:hover {
  opacity: 0.7;
}

.site-logo img {
  display: block;
  height: 4rem;
  width: auto;
}

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

.nav-links a {
  color: var(--bb-text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
}

.nav-links a:hover {
  background: var(--bb-primary-600);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--bb-text-secondary);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--bb-bg-raised);
  color: var(--bb-text-primary);
}

.theme-toggle .icon-sun,
:root.dark .theme-toggle .icon-moon {
  display: none;
}

:root.dark .theme-toggle .icon-sun {
  display: block;
}

.page-header {
  background: var(--bb-primary-600);
  color: var(--bb-text-primary);
  text-align: center;
  padding: 4rem 1.5rem;
}

.page-header h1 {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3rem);
}

.container {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.test-card {
  background: var(--surface);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 2rem;
  transition: box-shadow 0.2s;
}

.test-card:hover {
  box-shadow: var(--shadow-lg);
}

.gauges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
}

.gauge {
  margin: 0;
  text-align: center;
}

.gauge canvas {
  display: block;
  width: 100%;
  max-width: 20rem;
  aspect-ratio: 8 / 5;
  height: auto;
  margin: 0 auto;
}

.gauge figcaption {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -2.75rem;
}

.gauge-label,
.stat-label,
.connection dt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.gauge-value .figure {
  font-size: 2.25rem;
  font-weight: 600;
}

.figure {
  font-family: var(--bb-font-mono);
  font-variant-numeric: tabular-nums;
  font-variant-ligatures: none;
}

.unit {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

.gauge-dl .gauge-label::before,
.gauge-ul .gauge-label::before {
  content: "";
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-right: 0.375rem;
  border-radius: 50%;
  vertical-align: 0.05em;
}

.gauge-dl .gauge-label::before {
  background: var(--gauge-dl);
}

.gauge-ul .gauge-label::before {
  background: var(--gauge-ul);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg);
}

.stat-value .figure {
  font-size: 1.5rem;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn-primary {
  min-width: 12rem;
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--bb-primary-600);
  color: var(--bb-text-primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-primary:hover {
  background: var(--bb-primary-700);
}

.btn-primary.running {
  background: var(--bb-red-deep);
}

.status {
  margin: 0;
  min-height: 1.6em;
  font-size: 0.9375rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.connection {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.connection dd {
  margin: 0.125rem 0 0;
  overflow-wrap: anywhere;
}

.mono {
  font-family: var(--bb-font-mono);
  font-size: 0.9375rem;
  font-variant-ligatures: none;
}

.prose {
  max-width: 65ch;
  margin: 3rem auto 0;
  font-size: 1.0625rem;
  line-height: 1.75;
}

.prose h2 {
  font-size: 1.875rem;
  margin-bottom: 1rem;
}

.prose p {
  margin: 0 0 1.25em;
}

.site-footer {
  background: var(--bb-gray-900);
  border-top: 1px solid var(--line);
  color: var(--bb-text-secondary);
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.9375rem;
}

.footer-links {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.site-footer a {
  color: var(--bb-text-secondary);
  font-weight: 500;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--bb-text-primary);
  text-decoration: underline;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 40rem) {
  .nav-links a {
    display: none;
  }

  .site-logo img {
    height: 3rem;
  }

  .page-header {
    padding: 2.5rem 1rem;
  }

  .container {
    padding: 2rem 1rem 3rem;
  }

  .test-card {
    padding: 1.5rem 1rem;
  }

  .gauges {
    gap: 0.75rem;
  }

  .gauge figcaption {
    margin-top: -1.75rem;
  }

  .gauge-value .figure {
    font-size: 1.5rem;
  }

  .connection {
    grid-template-columns: minmax(0, 1fr);
  }
}

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