:root {
  --color-background: #0e1014;
  --color-surface: #151820;
  --color-raised: #1c2029;
  --color-selected: #232836;
  --color-border: #272c38;
  --color-text: #e7eaf0;
  --color-muted: #9aa3b2;
  --color-accent: #f5b84a;
  --color-on-accent: #0e1014;
  --color-danger: #f97066;
  --color-activity-1: #4b5567;
  --color-activity-2: #6a7588;
  --color-activity-3: #8490a3;
  --color-activity-4: #a9b3c2;
  --color-project-none: #8490a3;
  --font-sans: "Geist Variable", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-label: 0.6875rem;
  --text-label--line-height: 1rem;
  --text-label--letter-spacing: 0.08em;
  --radius-bar: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-background: #f4f2ed;
    --color-surface: #ffffff;
    --color-raised: #eceae4;
    --color-selected: #e5e1d8;
    --color-border: #d6d2c8;
    --color-text: #16181d;
    --color-muted: #555c69;
    --color-accent: #805400;
    --color-on-accent: #ffffff;
    --color-danger: #b42318;
    --color-activity-1: #adb4bf;
    --color-activity-2: #939bab;
    --color-activity-3: #768093;
    --color-activity-4: #596274;
    --color-project-none: #768093;
  }
}

/* The marketing site's stylesheet. The build puts web/src/theme.css's tokens above this as a
   :root rule, and its light ones under prefers-color-scheme: light (site/src/tokens.ts), so every
   colour, font and radius here is one of the app's, in the theme the visitor's system is in. */

@font-face {
  font-family: 'Geist Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/geist.woff2) format('woff2-variations');
}

@font-face {
  font-family: 'Geist Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/geist-mono.woff2) format('woff2-variations');
}

:root {
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
  }
}

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

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

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font: 16px/1.55 var(--font-sans);
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
pre {
  margin: 0;
}

a {
  color: var(--color-text);
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 60%, transparent);
  outline-offset: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.muted {
  color: var(--color-muted);
}

/* 11px uppercase Geist Mono in muted: docs/DESIGN.md's label. */
.label {
  font: 500 var(--text-label) / var(--text-label--line-height) var(--font-mono);
  letter-spacing: var(--text-label--letter-spacing);
  text-transform: uppercase;
  color: var(--color-muted);
}

/* The app's sidebar wordmark: the mark (docs/BRAND.md) and lowercase clockwork in Geist Mono. */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font: 600 15px/1 var(--font-mono);
  color: var(--color-text);
  text-decoration: none;
}

/* The mark is a third taller than the word beside it; its dot is the only brass in the header. */
.wordmark .mark {
  flex: none;
  width: 1.3333em;
  height: 1.3333em;
}

.mark .dot {
  fill: var(--color-accent);
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.bar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

/* The header stays at the top as the page scrolls, on a translucent ground that blurs what passes
   under it. Its hairline shows once the page has scrolled; a browser without scroll-driven
   animations shows it all the time. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-block: 0.375rem;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-background) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

@supports (animation-timeline: scroll()) {
  /* Scroll-driven, not timed: the rule follows the page's scroll position and never moves by
     itself (docs/BRAND.md), so it needs no reduced-motion guard. */
  .site-header {
    border-bottom-color: transparent;
    animation-name: header-rule;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: scroll(root);
    animation-range: 0 3rem;
  }
}

@keyframes header-rule {
  to {
    border-bottom-color: var(--color-border);
  }
}

/* An anchor scrolled to lands below the header, not under it. */
html {
  scroll-padding-top: 4.5rem;
}

/* The header's links and Sign up are a little shorter than the page's: the bar is 3.5rem. */
.site-header .link,
.site-header .button,
.site-header .wordmark {
  min-height: 2.5rem;
}

.site-header .button {
  padding-inline: 0.875rem;
  font-size: 0.9375rem;
}

/* The page you're on: underlined in the text colour, not brass, which the page keeps for its one button. */
.site-header nav > .link[aria-current='page'] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5rem;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: 1.5rem;
  margin-top: 5rem;
}

/* The phone's menu (below): a wide window shows the header's links in a row and has no use for it. */
.menu {
  display: none;
}

.menu summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 60%, transparent);
  outline-offset: 2px;
}

.menu .when-open,
.menu[open] .when-closed {
  display: none;
}

.menu[open] .when-open {
  display: inline;
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 0.25rem;
  color: var(--color-muted);
  text-decoration: none;
}

/* A link inside a sentence: underlined like prose, but as tall a tap target as every other link. */
.inline-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.link:hover,
.link[aria-current='page'] {
  color: var(--color-text);
}

/* Buttons: secondary on raised, and the one brass primary. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-raised);
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: var(--color-selected);
}

.button.primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.button.primary:hover {
  background: color-mix(in srgb, var(--color-accent) 88%, var(--color-text));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* The landing page. */
.hero {
  padding-block: 5rem 3rem;
  display: grid;
  gap: 1.5rem;
  justify-items: start;
}

.hero h1 {
  max-width: 18ch;
  font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.standfirst {
  max-width: 38rem;
  font-size: 1.125rem;
  color: var(--color-muted);
}

.picture {
  display: grid;
  gap: 0.75rem;
}

.picture figcaption {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* The timeline picture: the app's rows, label column and bars (web/src/timeline/tracks.tsx). */
.tl {
  --label-w: 190px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.tl-axis,
.tl-row {
  display: flex;
}

.tl-row {
  border-top: 1px solid var(--color-border);
}

.tl-label {
  flex: none;
  width: var(--label-w);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.125rem;
  padding: 0.5rem 0.375rem 0.5rem 0.875rem;
  border-right: 1px solid var(--color-border);
  min-width: 0;
}

.tl-label strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-label span {
  font: 11px/0.75rem var(--font-mono);
  text-transform: uppercase;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-hours,
.tl-track {
  position: relative;
  flex: 1;
  min-width: 0;
}

.tl-hours {
  height: 1.75rem;
}

.tl-hour {
  position: absolute;
  top: 0.375rem;
  padding-left: 0.375rem;
  border-left: 1px solid var(--color-border);
  font: var(--text-label) / var(--text-label--line-height) var(--font-mono);
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.tl-track {
  min-height: 2.875rem;
  background-image: linear-gradient(to right, var(--color-border) 1px, transparent 1px);
  background-size: calc(100% / 9) 100%;
}

.tl-bar {
  position: absolute;
  top: 8px;
  height: 22px;
  min-width: 3px;
  border-radius: var(--radius-bar);
}

.tl-device {
  top: 17px;
  height: 12px;
}

/* The now line's ground: over the tracks, under the hours. The label column keeps its place. */
.tl {
  position: relative;
}

.tl-plot {
  position: absolute;
  top: 1.75rem;
  bottom: 0;
  left: var(--label-w);
  right: 0;
  pointer-events: none;
}

.tl-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--color-accent);
  visibility: hidden;
}

/*
 * The landing page draws its day once, as the link preview's video does (docs/BRAND.md): the
 * finished day holds, its bars clear, then the now line crosses the chart at a constant rate and
 * each bar is drawn as the line passes over it. It ends on the finished day and stays there.
 * Nothing eases, the chart's ground never changes, and the page ships no script: each bar waits
 * (`--s`) and is drawn (`--w`) for its own share of the crossing, set where the picture is built.
 * With reduced motion, or on paper, the day is simply there.
 */
@media screen and (prefers-reduced-motion: no-preference) {
  .picture .tl-bar {
    animation:
      tl-clear calc(var(--clear) + 0.1s) linear var(--hold) 1,
      tl-wait calc(var(--cross) * var(--s)) linear calc(var(--hold) + var(--clear)) 1,
      tl-draw calc(var(--cross) * var(--w)) linear calc(var(--hold) + var(--clear) + var(--cross) * var(--s)) 1 forwards;
  }

  .picture .tl-now {
    animation: tl-cross var(--cross) linear calc(var(--hold) + var(--clear)) 1;
  }
}

/*
 * Faded out by the time the clearing ends, and held there a moment longer, until tl-wait has it.
 * No `from`: each bar fades from its own opacity, so the idle stretch starts at its 0.5.
 */
@keyframes tl-clear {
  82%,
  to {
    opacity: 0;
  }
}

/* Not drawn at all until the line reaches the bar's start. */
@keyframes tl-wait {
  from,
  to {
    clip-path: inset(0 100% 0 0);
  }
}

/* Drawn from its start as far as the line has got. */
@keyframes tl-draw {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes tl-cross {
  from {
    left: 0;
    visibility: visible;
  }
  to {
    left: 100%;
    visibility: visible;
  }
}

.tl-idle {
  opacity: 0.5;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  padding-block: 5rem 3rem;
}

.features h2,
.closing h2,
.setup h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
}

.features p {
  margin-top: 0.625rem;
  color: var(--color-muted);
}

.sources {
  display: grid;
  gap: 1rem;
  padding-block: 2rem;
}

.sources ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.sources li {
  display: grid;
  gap: 0.375rem;
  align-content: start;
  padding: 1.125rem;
  font-size: 0.9375rem;
}

.sources li + li {
  border-left: 1px solid var(--color-border);
}

.sources li span {
  color: var(--color-muted);
}

.closing {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
  padding-block: 4rem 0;
}

.closing h2 {
  font-size: 1.75rem;
}

/* The setup page. */
.setup {
  max-width: 46rem;
  padding-block: 4rem 0;
  display: grid;
  gap: 1.5rem;
}

/* minmax(0, 1fr), not auto: a long command scrolls inside its block instead of widening the page. */
.setup,
.steps,
.steps > li {
  grid-template-columns: minmax(0, 1fr);
}

.setup h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 1rem;
}

.steps > li {
  counter-increment: step;
  display: grid;
  gap: 0.875rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.steps h2::before {
  content: counter(step) '. ';
  font-family: var(--font-mono);
  color: var(--color-muted);
}

.steps p {
  color: var(--color-text);
}

.steps .muted {
  color: var(--color-muted);
}

.steps p code,
.next p code {
  overflow-wrap: anywhere;
  padding: 0.0625rem 0.3125rem;
  border-radius: var(--radius-sm);
  background: var(--color-raised);
}

/* A command: its own block, selected whole by one click so it copies without a script. A long one
   wraps to stay in view; the copied text is still the one line. */
.code {
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-background);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/1.6 var(--font-mono);
  color: var(--color-text);
  user-select: all;
  -webkit-user-select: all;
}

.code code {
  font-size: inherit;
}

/* The download page. */
.download {
  max-width: 52rem;
  padding-block: 4rem 0;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
}

.download h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.015em;
}

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

.installers section {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.installers .note {
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9375rem;
}

.next {
  display: grid;
  gap: 0.75rem;
}

.next h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
}

/* The terms and the privacy policy: long prose at a readable measure, plain headings. */
.legal {
  max-width: 44rem;
  padding-block: 4rem 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.legal h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.legal h2 {
  margin: 1.5rem 0 0;
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
}

.legal h3 {
  margin: 0.5rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  font-weight: 600;
}

.legal ul {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.25rem;
}

/* The phone: one column, the label column as narrow as the app's. */
@media (max-width: 40rem) {
  .wrap {
    padding-inline: 1rem;
  }

  .hero {
    padding-block: 3rem 2rem;
  }

  /* The header on one line: the wordmark, then Sign up and Menu. The three links move into the
     menu, which opens as a list across the page, under the header and over what follows. */
  .site-header .bar,
  .site-header nav {
    flex-wrap: nowrap;
  }

  .site-header nav {
    gap: 0.5rem;
  }

  /* A finger needs the full 2.75rem the wide bar trims. */
  .site-header .button,
  .site-header .wordmark {
    min-height: 2.75rem;
  }

  .site-header nav > .link {
    display: none;
  }

  .menu {
    display: block;
  }

  .menu-links {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    right: 0;
    display: grid;
    padding: 0.25rem 1rem 0.5rem;
    border-block: 1px solid var(--color-border);
    background: var(--color-background);
  }

  .menu-links .link {
    min-height: 3rem;
    padding-inline: 0;
    font-size: 1.0625rem;
    color: var(--color-text);
  }

  .menu-links .link + .link {
    border-top: 1px solid var(--color-border);
  }

  .menu-links .link[aria-current='page'] {
    font-weight: 600;
  }

  .features,
  .sources ul,
  .installers {
    grid-template-columns: minmax(0, 1fr);
  }

  .features {
    gap: 2rem;
    padding-block: 3.5rem 2rem;
  }

  .sources li + li {
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }

  .tl {
    --label-w: 120px;
  }

  .tl-label {
    padding-left: 0.625rem;
  }

  /* A narrow label column: the name and its meta wrap rather than lose their ends. */
  .tl-label strong,
  .tl-label span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Every other hour, so the labels don't run into each other, and not the last, which would run
     off the edge. */
  .tl-hour:nth-child(even),
  .tl-hour:last-child {
    display: none;
  }

  .steps > li {
    padding: 1.125rem;
  }
}
