/*
 * cranklet.app
 *
 * Colors are the app's own tokens (docs/design.md, "Tokens"): sand and slate
 * grounds, brand blue for graphics and the darker accent blue for links and
 * buttons, green for the hard zone. Brand blue and brand gray are never small
 * text in light mode; the design doc says why. Numbers use the system's rounded
 * face (SF Pro Rounded on Apple devices), as in the app. Text uses the system
 * sans. No web fonts: the site makes no request to anyone but itself.
 */

:root {
  --ground: #F6F7F5;
  --surface: #FFFFFF;
  --raised: #EDF0F3;
  --hairline: #E2E8F0;
  --ink: #0F172A;
  --muted: #475569;
  --accent: #2563EB;
  --blue: #3B82F6;
  --green: #6B8F6A;
  --zone-easy: #94A3B8;
  --zone-tempo: #3B82F6;
  --zone-hard: #6B8F6A;
  --on-accent: #FFFFFF;
  --link: #2563EB;
  --shadow: 15 23 42;

  /* The mini player bar: slate in both themes. */
  --inverse: #0F172A;
  --on-inverse: #F1F5F9;
  --on-inverse-muted: #94A3B8;

  --round: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 16px;
  --radius-tile: 22px;
  --radius-phone: 28px;
  --page: 1120px;
  --gutter: clamp(16px, 5vw, 40px);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0F172A;
    --surface: #1E293B;
    --raised: #293548;
    --hairline: #334155;
    --ink: #F1F5F9;
    --muted: #94A3B8;
    --accent: #60A5FA;
    --link: #F1F5F9;
    --shadow: 0 0 0;

    /* The page is already slate, so the bar sits one step up. */
    --inverse: #293548;
  }
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent);
}

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3 {
  font-family: var(--round);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
}

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

/* Big rounded numbers with tabular digits, as in the app */

.num {
  font-family: var(--round);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* POWER, CADENCE: the app's small caps label */

.label {
  font-family: var(--round);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header */

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--round);
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: 20px;
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

/* Phone frame around a screenshot */

.phone {
  margin: 0;
  border-radius: var(--radius-phone);
  border: 1px solid var(--hairline);
  background: var(--surface);
  padding: 6px;
  box-shadow: 0 24px 60px -24px rgb(var(--shadow) / 0.35);
}

.phone img {
  border-radius: calc(var(--radius-phone) - 6px);
  width: 100%;
}

/* Hero */

.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  padding-top: clamp(24px, 6vw, 72px);
  padding-bottom: clamp(48px, 8vw, 96px);
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
}

.hero .promise {
  margin-top: 18px;
  font-family: var(--round);
  font-size: clamp(1.5rem, 2.8vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  max-width: 20ch;
}

.hero .promise .line {
  display: block;
}

.hero .lede {
  margin-top: 16px;
  max-width: 40ch;
  font-size: 1.125rem;
  color: var(--muted);
}

.hero .phone {
  max-width: 320px;
  justify-self: center;
}

.availability {
  margin-top: 28px;
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Sections */

.section {
  padding: clamp(56px, 9vw, 112px) 0;
}

.section h2 {
  font-size: clamp(1.875rem, 3.6vw, 2.75rem);
}

.section .body {
  margin-top: 16px;
  max-width: 52ch;
  color: var(--muted);
}

.band {
  background: var(--raised);
}

/* Split rows: a phone and a column of text */

.feature {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.feature--flip {
  grid-template-columns: 1.2fr 0.8fr;
}

.feature .phone {
  max-width: 320px;
  justify-self: center;
}

/* The player: four readouts, as the app draws them */

.readouts {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 480px;
}

.readouts div {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.readouts dt {
  font-family: var(--round);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.readouts dd {
  margin: 8px 0 0;
}

.readouts .num {
  font-size: clamp(2.75rem, 6vw, 3.75rem);
}

.readouts .unit {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-left: 4px;
}

.readouts .target {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* The ride controls: minus, pause disc, plus */

.controls {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 20px;
}

.controls li {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--hairline);
  font-family: var(--round);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.controls .pause {
  width: 80px;
  height: 80px;
  background: var(--blue);
  border-color: var(--blue);
  color: #FFFFFF;
  font-size: 1.75rem;
  letter-spacing: 0.12em;
}

.controls .note {
  width: auto;
  height: auto;
  border: 0;
  background: none;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--muted);
  max-width: 24ch;
  text-align: left;
}

.band .readouts div,
.band .controls li {
  background: var(--surface);
}

.band .controls .pause {
  background: var(--blue);
}

.band .controls .note {
  background: none;
}

/* The workout graph: bars by zone, as in the app */

.zones {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 96px;
  max-width: 480px;
}

.zones li {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--zone-easy);
}

.zones .tempo {
  background: var(--zone-tempo);
}

.zones .hard {
  background: var(--zone-hard);
}

.zone-key {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.zone-key li::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 8px;
  background: var(--zone-easy);
}

.zone-key .tempo::before {
  background: var(--zone-tempo);
}

.zone-key .hard::before {
  background: var(--zone-hard);
}

/* Three ways to ride: the app's hero tiles */

.tiles {
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tiles li {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-tile);
  padding: 24px;
}

.tiles h3 {
  font-size: 1.375rem;
  margin-top: 14px;
}

.tiles p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
}

.tiles .modes {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tiles .modes li {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--raised);
  font-family: var(--round);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

/* The tile icons are drawn with CSS so the page loads nothing. */

.glyph {
  display: block;
  width: 44px;
  height: 44px;
}

.glyph--bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.glyph--bars span {
  flex: 1;
  border-radius: 4px;
  background: var(--blue);
}

.glyph--bars span:nth-child(1) {
  height: 45%;
}

.glyph--bars span:nth-child(2) {
  height: 70%;
}

.glyph--bars span:nth-child(3) {
  height: 100%;
}

.glyph--ring {
  border-radius: 999px;
  border: 7px solid var(--ink);
  position: relative;
}

.glyph--ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
  border: 4px solid var(--blue);
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-20deg);
}

.glyph--hills {
  position: relative;
  overflow: hidden;
}

.glyph--hills::before,
.glyph--hills::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 30px;
  height: 30px;
  background: var(--green);
  transform: rotate(45deg);
  border-radius: 4px;
}

.glyph--hills::before {
  left: -4px;
  bottom: -8px;
  opacity: 0.6;
}

.glyph--hills::after {
  left: 16px;
  bottom: -4px;
}

/* Steps with zone chips, as on the workout page */

.steps {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  max-width: 420px;
}

.steps li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.9375rem;
}

.steps .chip {
  padding: 2px 10px;
  border-radius: 8px;
  font-family: var(--round);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: var(--zone-easy);
}

.steps .chip.tempo {
  background: var(--zone-tempo);
}

.steps .chip.hard {
  background: var(--zone-hard);
}

.steps .watts {
  font-family: var(--round);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Routes: two phones under the text */

.duo-head {
  max-width: 60ch;
}

.duo {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 300px));
  justify-content: center;
  gap: clamp(20px, 5vw, 64px);
}

.duo figure {
  margin: 0;
}

.duo figcaption {
  margin-top: 14px;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* The second phone sits lower, so the pair does not read as a grid. */
.duo figure + figure {
  margin-top: 56px;
}

/* A grade legend: gray flat, blue up, green steep. */
.grades {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.grades li::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 8px;
  background: var(--zone-easy);
}

.grades .up::before {
  background: var(--zone-tempo);
}

.grades .steep::before {
  background: var(--zone-hard);
}

/* Ticks beside a phone */

.ticks {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.ticks li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: baseline;
}

/* A tick in a round blue badge. */
.ticks li::before {
  content: "\2713";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  transform: translateY(3px);
}

/* Devices and files: a grid of short notes */

.sources {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 36px;
}

.sources h3 {
  font-size: 1.125rem;
}

.sources p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 1rem;
}

/* Where rides go: a strip like the app's "This week" card */

.week {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 8px;
}

.week div {
  text-align: center;
  padding: 0 8px;
}

.week div + div {
  border-left: 1px solid var(--hairline);
}

.week dt {
  font-family: var(--round);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.week dd {
  margin: 6px 0 0;
}

.week .num {
  font-size: 1.75rem;
}

/* The mini player bar, as a statement */

.bar {
  margin: 32px auto 0;
  max-width: 560px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  background: var(--inverse);
  color: var(--on-inverse);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 16px 40px -20px rgb(var(--shadow) / 0.5);
  text-align: left;
}

.bar .mode {
  font-family: var(--round);
  font-weight: 700;
}

.bar .time,
.bar .watts {
  font-family: var(--round);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bar .unit {
  color: var(--on-inverse-muted);
  font-weight: 400;
  margin-left: 2px;
}

.bar .pause {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--blue);
  color: #FFFFFF;
  font-family: var(--round);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
}

/* Statement: one centered block */

.statement {
  text-align: center;
}

.statement h2,
.statement .body {
  margin-left: auto;
  margin-right: auto;
}

.statement h2 {
  max-width: 22ch;
}

/* Privacy promises */

.promises {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  border-top: 1px solid var(--hairline);
  padding-top: 28px;
}

.promises dt {
  font-family: var(--round);
  font-size: 1.25rem;
  font-weight: 700;
}

.promises dd {
  margin: 6px 0 0;
  color: var(--muted);
}

.private-note {
  margin-top: 32px;
  max-width: 60ch;
}

/* Text pages: privacy, help, 404 */

.page {
  padding-top: clamp(24px, 5vw, 56px);
  padding-bottom: clamp(56px, 9vw, 112px);
}

.prose {
  max-width: 68ch;
}

.prose h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
}

.prose h2 {
  font-size: 1.5rem;
  margin-top: 40px;
}

.prose h3 {
  font-size: 1.125rem;
  margin-top: 24px;
}

.prose p,
.prose ul,
.prose ol {
  margin-top: 14px;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 8px;
}

.prose .meta {
  margin-top: 12px;
  color: var(--muted);
}

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9375em;
  background: var(--raised);
  border-radius: 6px;
  padding: 1px 6px;
}

.notice {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.notice > :first-child {
  margin-top: 0;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 32px 0 48px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  justify-content: space-between;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

/* A little movement on arrival, and none for people who ask for none */

@media (prefers-reduced-motion: no-preference) {
  .hero .copy,
  .hero .phone {
    animation: rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .hero .phone {
    animation-delay: 120ms;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* Tablets */

@media (max-width: 1023px) {
  .promises {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones and small tablets: one column */

@media (max-width: 767px) {
  .hero .wrap,
  .feature,
  .feature--flip {
    grid-template-columns: 1fr;
  }

  .hero .phone,
  .feature .phone {
    max-width: 280px;
  }

  /* The picture comes after its text. */
  .feature .phone {
    order: 2;
  }

  .tiles {
    grid-template-columns: 1fr;
  }

  .sources {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .duo {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .duo figure + figure {
    margin-top: 32px;
  }

  .bar {
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
  }

  .bar .mode {
    grid-column: 1 / -1;
  }

  .promises {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .site-nav {
    gap: 16px;
  }
}

@media print {
  .site-header nav,
  .site-footer,
  .phone,
  .skip {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
