/* Ride Recorder site
   Colours and fonts are the app's own. */

@font-face {
  font-family: "Bebas Neue";
  src: url("../assets/fonts/BebasNeue-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #fcfcfc;
  --ink: #111111;
  --muted: #50565d;
  --label: #7b7b7b;
  --rule: #1976d2;
  --link: #1565c0;
  --bar: #dae0e5;
  --bar-ink: #111111;
  --line: #cfd6dc;
  --red: #f13b3b;
  --chart: #f44336;
  --btn: #1976d2;
  --btn-ink: #ffffff;
  --brand-blue: #1565c0;

  --display: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #111111;
  --ink: #fcfcfc;
  --muted: #b3b9c0;
  --label: #a6a6a6;
  --link: #74b3f5;
  --bar: #161e26;
  --bar-ink: #fcfcfc;
  --line: #2b3640;
  --red: #fb6c6c;
  --brand-blue: #2f8be6;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

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

/* Titles are set in Bebas, as they are in the app. */
h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(3.25rem, 7.4vw, 6.25rem); line-height: 0.92; }
h2 { font-size: clamp(2.5rem, 4.6vw, 4rem); line-height: 0.95; }

p { margin: 0; max-width: 36em; }

a { color: var(--link); }

:focus-visible { outline: 3px solid var(--rule); outline-offset: 3px; }

.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}

.rule {
  border: 0;
  height: 1px;
  margin: 0;
  background: var(--rule);
}

/* Top bar: the app's bottom bar, moved to the top */

.topbar { background: var(--bar); color: var(--bar-ink); }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

/* A stroke in the fill colour thickens the logo's lines slightly at this small size. */
.brand-mark { width: 36px; height: 36px; flex: none; overflow: visible; stroke-width: 8; stroke-linejoin: round; }
.brand-mark .mark-frame { fill: currentColor; stroke: currentColor; }
.brand-mark .mark-r { fill: var(--rule); stroke: var(--rule); }

.wordmark {
  font-family: var(--display);
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 3px;
  white-space: nowrap;
}

.wordmark-ride { color: var(--brand-blue); }

.topbar-actions { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }

.topbar-actions { gap: 10px; }

/* Dark theme switch */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: clamp(4px, 2vw, 18px);
  padding: 8px 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.switch-label {
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  line-height: 1;
  padding-top: 3px;
  text-transform: uppercase;
}

.switch-track {
  position: relative;
  width: 46px;
  height: 24px;
  border: 2px solid currentColor;
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: currentColor;
}

.theme-switch[aria-checked="true"] .switch-track { background: var(--rule); border-color: var(--rule); }
.theme-switch[aria-checked="true"] .switch-knob { left: 24px; background: #ffffff; }

.topbar-btn {
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  line-height: 1;
  padding: 12px 16px 9px;
  background: var(--btn);
  color: var(--btn-ink);
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-btn:hover { background: #135ca8; }

/* Hero */

.hero { padding-block: clamp(40px, 6vw, 84px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.lede {
  margin-top: 1.5rem;
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
}

.stores { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }

.badge { display: block; }
.badge img { height: 54px; width: auto; }

.hero-note { margin-top: 1rem; color: var(--muted); font-size: 0.9375rem; }

/* The live data page */

.device {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: var(--bg);
  border: 2px solid var(--ink);
  overflow: hidden;
}

.device-rows {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.row { flex: 1 1 0; min-height: 0; display: flex; }
.row-solo { flex-grow: 1.5; }

.field {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 4px;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  container-type: size;
}

.field:focus-visible { outline-offset: -5px; }
.field:hover .field-label { color: var(--rule); }

.field-label,
.f-label {
  font-family: var(--display);
  color: var(--label);
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.field-label { font-size: clamp(1rem, 13cqh, 1.5rem); }

.field-value,
.f-value {
  font-family: var(--display);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.field-value {
  margin-block: auto;
  /* Size to the cell, as the app does: limited by height, or by how many
     characters have to fit across. */
  font-size: min(62cqh, calc(86cqw / (var(--chars, 4) * 0.4)));
}

/* The app's inset blue rules between fields */
.row + .row .field::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: var(--rule);
}

.field + .field::after {
  content: "";
  position: absolute;
  left: 0;
  top: 14%;
  bottom: 10%;
  width: 1px;
  background: var(--rule);
}

.device-chart { flex: 0 0 auto; padding: 6px 14px 10px; }

.chart-readout {
  display: flex;
  justify-content: center;
  gap: 1em;
  max-width: none;
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--label);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.chart { display: block; width: 100%; height: 84px; border-left: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
#chart-area { fill: var(--chart); }
#chart-avg-line { stroke: var(--label); stroke-width: 1; vector-effect: non-scaling-stroke; }

.device-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bar);
  color: var(--bar-ink);
}

.bar-btn {
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
  padding: 12px 14px 9px;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.bar-btn:disabled { opacity: 0.4; cursor: default; }

.bar-pause {
  margin-left: auto;
  width: 44px;
  height: 44px;
  padding: 6px;
  border: 0;
  background: none;
  cursor: pointer;
}

.bar-pause svg { width: 100%; height: 100%; fill: var(--red); }
.bar-pause .icon-play { display: none; }
.bar-pause[aria-pressed="true"] .icon-play { display: block; }
.bar-pause[aria-pressed="true"] .icon-pause { display: none; }
.bar-pause[aria-pressed="true"] svg { fill: #43a047; }

.device-hint { margin-top: 12px; font-size: 0.9375rem; color: var(--muted); }

/* Field picker, laid over the data page */

.picker {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bar);
  color: var(--bar-ink);
}

.picker[hidden] { display: none; }

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.picker-head h2 { font-size: 1.75rem; letter-spacing: 0.02em; line-height: 1; }

.picker-close {
  font: 400 0.9375rem var(--body);
  color: inherit;
  background: none;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.picker-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(48px, 1fr);
  gap: 4px;
  padding: 4px;
}

.picker-option {
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  padding: 6px;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}

.picker-option:focus-visible { outline-offset: -4px; }
.picker-option[aria-current="true"] { background: var(--btn); color: var(--btn-ink); }

/* Sections */

.band { padding-block: clamp(56px, 9vw, 120px); }

.band-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 5vw, 72px);
  align-items: end;
}

.band-head p,
.split-copy p { color: var(--muted); }

.split-copy h2 + p,
.split-copy p + p { margin-top: 1.25rem; }

/* Wall of data fields */

.wall {
  list-style: none;
  margin: clamp(32px, 5vw, 64px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.wall li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 136px;
  padding: 24px 8px 20px;
}

.wall li::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: var(--rule);
}

.wall li::after {
  content: "";
  position: absolute;
  right: 0;
  top: 16%;
  bottom: 16%;
  width: 1px;
  background: var(--rule);
}

/* No rule on the right of the last column or under the last row. */
.wall li:nth-child(5n)::after,
.wall li:nth-last-child(-n+5)::before { display: none; }

.f-label { font-size: 1.25rem; text-align: center; }

.f-value {
  margin-block: auto;
  font-size: clamp(2.6rem, 4.6vw, 4rem);
  white-space: nowrap;
  text-align: center;
}

.f-value-pair { font-size: clamp(1.7rem, 2.7vw, 2.3rem); line-height: 1; }

.f-chart { width: 78%; height: 52px; margin-block: auto; fill: var(--chart); border-left: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.f-icon { width: 52px; height: 52px; margin-block: auto; fill: var(--ink); }

.f-chart-elevation { fill: #43a047; }

/* Text beside screenshots */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 7vw, 104px);
  align-items: center;
}

.shot { width: 100%; border: 1px solid var(--line); }

.shots-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2vw, 24px);
  align-items: start;
}

.shots-pair .shot { aspect-ratio: 9 / 16; object-fit: cover; object-position: top; }
.shots-pair .shot-drop { margin-top: 18%; }

.shots-single { max-width: 320px; }
.split > .shots-single:last-child { justify-self: end; }

.spec { margin: 1.75rem 0 0; }

.spec > div {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding-block: 12px;
  border-top: 1px solid var(--line);
}

.spec > div:last-child { border-bottom: 1px solid var(--line); }

.spec dt {
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
}

.spec dd { margin: 0; color: var(--muted); }

.types { list-style: none; margin: 1.75rem 0 0; padding: 0; }

.types li {
  padding-block: 12px 9px;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
}

.types li:last-child { border-bottom: 1px solid var(--line); }

.split-copy .also { margin-top: 1.5rem; font-size: 0.9375rem; }

/* Price and download */

.get-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(32px, 7vw, 104px);
  align-items: center;
}

.price { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.price .f-label { font-size: 1.5rem; }
.price .f-value { font-size: clamp(6rem, 13vw, 10.5rem); }

.get-copy p { margin-top: 1rem; color: var(--muted); }

/* Footer */

.footer { background: var(--bar); color: var(--bar-ink); padding-block: 36px; font-size: 0.9375rem; }

.footer a { color: inherit; text-underline-offset: 4px; }

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 40px;
  align-items: center;
}

.footer-contact { margin-top: 10px; max-width: none; }

.footer-links { display: flex; flex-wrap: wrap; gap: 8px 28px; }

.footer-legal {
  grid-column: 1 / -1;
  max-width: 62em;
  font-size: 0.8125rem;
  line-height: 1.6;
  opacity: 0.75;
}

/* Privacy and terms pages */

.legal { padding-block: clamp(40px, 6vw, 84px) clamp(56px, 9vw, 120px); }

.legal-body { max-width: 44rem; }

.legal h1 { font-size: clamp(3rem, 6vw, 4.75rem); }
.legal h2 { font-size: clamp(1.7rem, 3vw, 2.1rem); line-height: 1.05; margin-top: 2.6rem; }

.legal p,
.legal ul { margin-top: 1rem; max-width: none; }

.legal ul { padding-left: 1.25rem; }
.legal li + li { margin-top: 0.5rem; }
.legal .legal-date { color: var(--muted); font-size: 0.9375rem; }
.legal a { overflow-wrap: anywhere; }

/* Narrow screens */

@media (max-width: 900px) {
  .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wall li:nth-child(n)::after,
  .wall li:nth-child(n)::before { display: block; }
  .wall li:nth-child(3n)::after,
  .wall li:last-child::after,
  .wall li:last-child::before { display: none; }
  .wall li:nth-last-child(1)::before { display: none; }
}

@media (max-width: 760px) {
  .hero-grid,
  .band-head,
  .split,
  .get-grid,
  .footer-inner { grid-template-columns: minmax(0, 1fr); }

  .hero-demo { max-width: 440px; }
  .band-head { align-items: start; }

  .split-media-first > .shots { order: 2; }
  .split > .shots-single:last-child { justify-self: start; }
  .shots-single { max-width: 280px; }

  .price { align-items: flex-start; }
  .spec > div { grid-template-columns: 8.5rem minmax(0, 1fr); }
  .topbar-get { display: none; }
}

@media (max-width: 520px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wall li:nth-child(n)::after,
  .wall li:nth-child(n)::before { display: block; }
  .wall li:nth-child(2n)::after,
  .wall li:last-child::after,
  .wall li:last-child::before { display: none; }
  .wall li { min-height: 120px; }
  .f-label { font-size: 1.1rem; }
  .brand-mark { width: 30px; height: 30px; }
  .wordmark { font-size: 1.55rem; }
  .brand { gap: 9px; }
  .badge img { height: 48px; }
}

@media (max-width: 400px) {
  .switch-label { font-size: 1.1rem; }
  .theme-switch { gap: 7px; margin-right: 2px; }
  .topbar-btn { font-size: 1.15rem; padding-inline: 12px; }
  .topbar-inner { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
