/* Sensible Laps marketing site — pit-wall identity, matched to the WebUnified
   app (same palette, same self-hosted Barlow, same sparkline mark). Single dark
   theme on purpose: the board *is* the brand. */

/* ---- self-hosted Barlow Semi Condensed (latin + latin-ext, weights 500/600/700) ---- */
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/barlow-sc-500-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/barlow-sc-500-latinext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/barlow-sc-600-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/barlow-sc-600-latinext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-sc-700-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-sc-700-latinext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0b0e13;
  --surface: #141a23;
  --surface-2: #10161e;
  --line: #29333f;
  --text: #e9eef5;
  --muted: #8a97a8;
  --live: #ff3b30;
  --fastest: #b45cff; /* overall fastest lap (motorsport purple) */
  --pb: #2fd07b; /* personal best (green) */
  --amber: #ffb01f; /* wordmark + primary accent */
  --maxw: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow Semi Condensed", system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--amber);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- top nav ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--surface), rgba(11, 14, 19, 0.92));
  backdrop-filter: blur(6px);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.brand:hover {
  text-decoration: none;
}
.brand .mark {
  width: 34px;
  height: 34px;
  flex: none;
}
.site-nav ul {
  display: flex;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.site-nav ul a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.site-nav ul a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}
.site-nav ul a.current {
  color: var(--amber);
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--amber);
  color: #17110033;
  color: #201500;
}
.btn-primary:hover {
  background: #ffbe42;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover {
  border-color: var(--muted);
  background: var(--surface);
}

/* ---- hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1200px 460px at 78% -12%, rgba(180, 92, 255, 0.12), transparent 60%),
    radial-gradient(900px 420px at 5% 8%, rgba(255, 176, 31, 0.08), transparent 60%);
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  padding-top: 4rem;
  padding-bottom: 4rem;
}
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.hero h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2.4rem, 5.5vw, 3.9rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero h1 .accent {
  color: var(--amber);
}
.hero p.lead {
  margin: 0 0 1.7rem;
  color: var(--muted);
  font-size: 1.12rem;
  max-width: 46ch;
}
.hero .cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* signature: a live pulse dot reused from the app's LIVE badge */
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.55);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 59, 48, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

/* hero visual: a faux timing board — the product, shown, not described */
.board {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(var(--surface), var(--surface-2));
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.board-head .live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--live);
  font-weight: 700;
}
.board table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.board td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  text-align: right;
  white-space: nowrap;
}
.board tr:last-child td {
  border-bottom: none;
}
.board td.pos {
  text-align: center;
  color: var(--muted);
  width: 2.2rem;
}
.board tr.p1 td.pos {
  color: var(--amber);
  font-weight: 700;
}
.board td.name {
  text-align: left;
  width: 100%;
}
.board .dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.55rem;
  border: 2px solid transparent;
  vertical-align: middle;
}
.board td.best {
  color: var(--pb);
}
.board td.fast {
  color: var(--fastest);
  font-weight: 600;
}

/* ---- generic section ---- */
.section {
  padding: 3.75rem 0;
  border-bottom: 1px solid var(--line);
}
.section.alt {
  background: var(--surface-2);
}
.section > .wrap > .section-label {
  color: var(--amber);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 0.6rem;
}
.section h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.section > .wrap > p.sub {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

/* ---- feature grid ---- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.card {
  position: relative;
  padding: 1.4rem 1.35rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--chip, var(--amber));
}
.card .ic {
  width: 30px;
  height: 30px;
  margin-bottom: 0.85rem;
  color: var(--chip, var(--amber));
}
.card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.18rem;
  font-weight: 700;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}
.card a.more {
  display: inline-block;
  margin-top: 0.7rem;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- page-body (faq / downloads) ---- */
.prose {
  max-width: 70ch;
}
.prose h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 1rem;
}
.prose p {
  color: var(--muted);
  font-size: 1.05rem;
}
.prose ul {
  color: var(--muted);
}

.note {
  display: flex;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  background: var(--surface);
}
.note .ic {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--amber);
  margin-top: 0.15rem;
}
.note p {
  margin: 0;
  color: var(--text);
}

/* ---- live club list (populated by liveMqtt.js) ---- */
.live-tools {
  margin-bottom: 1.25rem;
}
input#filter {
  width: 100%;
  max-width: 420px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
input#filter::placeholder {
  color: var(--muted);
}
ul#activeLiveList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
ul#activeLiveList li a {
  display: block;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
ul#activeLiveList li a:hover {
  border-color: var(--amber);
  text-decoration: none;
}
ul#activeLiveList h3 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
  font-weight: 700;
}
ul#activeLiveList li div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
ul#activeLiveList .spanRight {
  color: var(--pb);
  font-weight: 600;
}
.live-empty {
  color: var(--muted);
}

/* ---- downloads (driven by the Sparkle appcast) ---- */
.dl-latest {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(var(--surface), var(--surface-2));
  padding: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin: 0 0 2.5rem;
}
.dl-latest .meta .tag {
  color: var(--pb);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.dl-latest .meta h3 {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.9rem;
  font-weight: 700;
}
.dl-latest .meta .when {
  color: var(--muted);
  font-size: 0.92rem;
}
.dl-latest .grab {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}
.dl-latest .grab .size {
  color: var(--muted);
  font-size: 0.82rem;
}

h3.dl-heading {
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.dl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.dl-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.dl-row > summary {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  list-style: none;
}
.dl-row > summary::-webkit-details-marker {
  display: none;
}
.dl-row .ver {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
}
.dl-row .when {
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}
.dl-row .chev {
  color: var(--muted);
  transition: transform 0.15s ease;
}
.dl-row[open] .chev {
  transform: rotate(90deg);
}
.dl-row .dl-link {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.changelog {
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.changelog h4 {
  color: var(--text);
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}
.changelog h5 {
  color: var(--amber);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0.9rem 0 0.3rem;
}
.changelog ul {
  margin: 0.2rem 0;
  padding-left: 1.2rem;
}
.changelog li {
  margin: 0.15rem 0;
}
.changelog .loading {
  padding: 0.6rem 0;
}

/* ---- footer ---- */
.site-foot {
  padding: 2.25rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-foot .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-foot nav {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.site-foot a {
  color: var(--muted);
}
.site-foot a:hover {
  color: var(--text);
}

/* ---- responsive ---- */
@media (max-width: 800px) {
  .hero .wrap {
    grid-template-columns: 1fr;
    padding-top: 2.75rem;
    padding-bottom: 2.75rem;
  }
  .hero .board {
    order: -1;
  }
  .features {
    grid-template-columns: 1fr;
  }
}
