/*
 * The site's whole stylesheet. Mobile first: the bare rules are the phone design, and the one
 * breakpoint at 960px is the desktop one.
 *
 * Tokens, type scale and the four Direction D rules come from docs/design_language.md, which wins
 * over the mockups.
 */

/* One file, 100-700 on a weight axis. The three mono weights are static and need one face each. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-latin-600.woff2') format('woff2');
}

:root {
  color-scheme: dark;

  --bg: #101214;
  --surface: #171a1d;
  --well: #202427;
  --line: #333a3f;
  --ink: #f0f2f3;
  --dim: #9aa1a6;
  --accent: #00b9ff;
  --high: #36b37e;
  --med: #d9a23b;
  --low: #7a8288;
  --danger: #e5544b;
  --danger-text: #f2776e;

  --r-data: 6px;
  --r-control: 10px;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-weight: 600;
}

a {
  color: var(--ink);
  text-decoration: none;
}

img,
svg {
  display: block;
}

ul {
  list-style: none;
}

/* Hover and focus are not animation: colour and border only, no movement. */
a,
.badge,
.btn,
.menu-button {
  transition:
    color 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

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

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

.skip:focus {
  left: 20px;
  top: 12px;
  z-index: 2;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--r-control);
}

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

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

.wrap {
  padding: 0 20px;
  max-width: 390px;
  margin: 0 auto;
}

.lbl {
  display: block;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

.well {
  background: var(--well);
  border-radius: var(--r-data);
  padding: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-data);
  padding: 22px;
}

/* The one raised control, ink-filled. Rule 2: a primary button is never the accent. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
}

.btn:hover {
  background: #ffffff;
}

/* The grey bar standing in for text nobody has written yet. */
.ph {
  background: var(--line);
  border-radius: 3px;
  height: 11px;
  opacity: 0.5;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  position: relative;
}

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

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.01em;
  line-height: 1;
}

.menu-button {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}

.nav {
  display: none;
}

/* Opened by site.js. 160ms on colour, the menu button's own transition; the panel itself does not
   move, so there is nothing here to respect prefers-reduced-motion for. */
.nav[data-open='true'] {
  display: flex;
  flex-direction: column;
  position: absolute;
  inset: 100% 0 auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav a {
  color: var(--dim);
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-top: 1px solid var(--line);
}

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

.menu-button {
  transition-duration: 160ms;
}

.menu-button:hover {
  color: var(--dim);
}

/* ---------- hero ---------- */

.hero {
  padding-block: 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero h1 {
  font-size: 34px;
  line-height: 38px;
  letter-spacing: -0.01em;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-sub {
  font-size: 16px;
  line-height: 1.55;
  color: var(--dim);
  max-width: 52ch;
}

.badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Outlines, not store artwork: the app is not listed yet, so there is nothing to link to. */
.badge {
  display: inline-flex;
  align-items: center;
  height: 52px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  color: var(--dim);
  font-size: 14px;
}

/* ---------- the app card in the hero ---------- */

.phone {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.phone-head strong {
  font-size: 17px;
  font-weight: 600;
}

.steppers {
  display: flex;
  gap: 18px;
}

.stepper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
}

.step-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  color: var(--dim);
}

.step-value {
  font-size: 20px;
}

.step-value span {
  font-size: 13px;
  color: var(--dim);
}

.chip-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chips {
  display: flex;
  gap: 5px;
}

.chip {
  flex: 1;
  min-width: 0;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-control);
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: transparent;
}

/* Rule 2 again: the accent ring is the rung you are on, and nothing else on the page wears it. */
.chip[data-on='true'] {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--well);
}

.chip[data-on='ink'] {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--well);
}

/* The two language chips are a pair, not a scale, so they take their own width instead of the row. */
.chip-lang {
  flex: none;
  height: 36px;
  padding: 0 20px;
  font-size: 13px;
}

.estimate {
  border-top: 1px solid var(--line);
  padding: 12px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.estimate-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.estimate-value {
  font-size: 24px;
  line-height: 28px;
}

.estimate-value span {
  font-size: 14px;
  color: var(--dim);
}

/* Confidence is a count of dots plus a word, never colour alone. */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-block;
}

.dot[data-fill='high'] {
  background: var(--high);
  border-color: var(--high);
}

.dot[data-fill='med'] {
  background: var(--med);
  border-color: var(--med);
}

.dot[data-fill='low'] {
  background: var(--low);
  border-color: var(--low);
}

.next-set {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The one well on the page, holding the one figure the page exists to give. */
.answer {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.answer .figure {
  font-size: 44px;
  line-height: 44px;
  font-weight: 500;
  color: var(--accent);
}

.answer .unit {
  font-size: 17px;
  color: var(--dim);
}

/* ---------- sections ---------- */

.section {
  padding-top: 48px;
}

.section > .lbl {
  margin-bottom: 16px;
}

.section h2 {
  font-size: 24px;
  line-height: 1.2;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.steps-below {
  margin-top: 36px;
}

.step {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.step h3 {
  font-size: 17px;
  line-height: 1.25;
}

.step p {
  color: var(--dim);
  line-height: 23px;
}

.rows {
  display: flex;
  flex-direction: column;
}

.rows-below {
  margin-top: 10px;
}

.rows .row {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rows .row h3 {
  font-size: 17px;
}

.rows .row p {
  color: var(--dim);
  line-height: 23px;
  max-width: 60ch;
}

.footnote {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 16px;
}

.footnote p {
  color: var(--dim);
  font-size: 14px;
  line-height: 21px;
  max-width: 70ch;
}

/* ---------- plates, confidence table, meter, back-off list ---------- */

.plates {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.plate {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.plate i {
  display: block;
  background: var(--dim);
  border-radius: 2px;
}

.plate span {
  font-size: 12px;
  color: var(--dim);
}

.conf-row {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conf-row p {
  font-size: 14px;
  line-height: 20px;
}

.meter {
  display: block;
  position: relative;
}

.meter-track {
  display: block;
  height: 14px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--well);
  overflow: hidden;
  position: relative;
}

.meter-over {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 71.4%;
  right: 0;
  background: var(--danger);
  opacity: 0.15;
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 7px;
  width: 45.7%;
  background: var(--med);
}

.meter-limit {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 71.4%;
  width: 2px;
  background: var(--danger);
}

.meter-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.backoff-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 9px 0;
  font-size: 14px;
  color: var(--dim);
}

.backoff-row[data-default='true'] {
  color: var(--ink);
}

.backoff-row .tag {
  font-size: 11px;
  color: var(--accent);
}

.card-foot {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  font-size: 12px;
  color: var(--dim);
}

.split {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- the trend chart ---------- */

.trend-pair {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.trend-prose {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trend-prose h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
}

.trend-prose p {
  color: var(--dim);
  line-height: 23px;
}

.trend {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trend-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trend-head .value {
  font-size: 20px;
  white-space: nowrap;
}

.trend-head .value span {
  font-size: 13px;
  color: var(--dim);
}

.trend svg {
  width: 100%;
  height: auto;
}

/* The site's only animation. The finished line is the default, so a page without `site.js` still
   shows a complete chart. */
@media (prefers-reduced-motion: no-preference) {
  .trend-line[data-draw='pending'] {
    stroke-dasharray: var(--trend-len);
    stroke-dashoffset: var(--trend-len);
  }

  .trend-line[data-draw='run'] {
    stroke-dasharray: var(--trend-len);
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 900ms cubic-bezier(0.2, 0.6, 0.2, 1);
  }
}

/* ---------- the three-up closer ---------- */

.closers {
  display: flex;
  flex-direction: column;
}

.closer {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.closer h3 {
  font-size: 17px;
}

.closer p {
  color: var(--dim);
  font-size: 14px;
  line-height: 21px;
}

/* ---------- support ---------- */

.email-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.email-card .who {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.email-card strong {
  font-size: 17px;
  font-weight: 600;
}

.email-card .address {
  font-size: 14px;
}

.checklist {
  max-width: 640px;
}

.checklist ul {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.checklist li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  line-height: 23px;
}

.checklist .dash {
  font-size: 14px;
  color: var(--dim);
}

/* ---------- privacy ---------- */

.policy .row {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.policy h2 {
  font-size: 17px;
  line-height: 23px;
  font-weight: 600;
}

.policy .lines {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 620px;
}

/* ---------- page head for support and privacy ---------- */

.page-head {
  padding-block: 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-head h1 {
  font-size: 34px;
  line-height: 38px;
  letter-spacing: -0.01em;
}

.page-head p {
  font-size: 16px;
  line-height: 1.55;
  color: var(--dim);
  max-width: 52ch;
}

.page-head .updated {
  font-size: 14px;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 64px;
}

.site-footer .wrap {
  padding-block: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: space-between;
}

.site-footer .who {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-footer .wordmark {
  font-size: 17px;
}

.site-footer nav {
  display: flex;
  gap: 26px;
}

.site-footer nav a {
  color: var(--dim);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer nav a:hover {
  color: var(--ink);
}

/* ---------- desktop ---------- */

@media (min-width: 960px) {
  .wrap {
    padding: 0 64px;
    max-width: 1288px;
  }

  .site-header .wrap {
    height: 72px;
  }

  .wordmark {
    gap: 9px;
    font-size: 21px;
  }

  .menu-button {
    display: none;
  }

  /* The panel the menu button opens becomes the ordinary nav, whatever state it was left in. */
  .nav,
  .nav[data-open='true'] {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: center;
    position: static;
    background: none;
    border-bottom: 0;
  }

  .nav a {
    border-top: 0;
    padding: 0;
    min-height: 44px;
  }

  /*
   * Grid rather than a row, because the badges follow the app card on the phone and sit under the
   * copy on desktop. That is a move between columns, which flex `order` cannot do.
   */
  .hero {
    padding-block: 80px 88px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    column-gap: 64px;
    row-gap: 28px;
    align-content: center;
  }

  .hero-copy {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 640px;
  }

  .hero .badges {
    grid-area: 2 / 1;
  }

  .hero h1 {
    font-size: 54px;
    line-height: 60px;
  }

  .hero-sub {
    font-size: 19px;
  }

  .phone {
    grid-area: 1 / 2 / span 2;
    align-self: center;
  }

  .section {
    padding-top: 88px;
  }

  .section > .lbl {
    margin-bottom: 26px;
  }

  .section h2 {
    font-size: 34px;
  }

  .steps {
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
  }

  .steps-below {
    margin-top: 56px;
  }

  .rows-below {
    margin-top: 18px;
  }

  .step h3 {
    font-size: 19px;
  }

  .step-wide {
    flex: 1.35;
  }

  .rows .row {
    flex-direction: row;
    gap: 40px;
    padding: 24px 0;
  }

  .rows .row h3 {
    font-size: 20px;
    width: 240px;
    flex: none;
  }

  .rows-wide .row h3 {
    width: 300px;
  }

  .rows .row p {
    font-size: 16px;
    line-height: 25px;
  }

  .footnote {
    margin-top: 32px;
  }

  .closers {
    flex-direction: row;
    gap: 48px;
    align-items: stretch;
  }

  .split {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    flex-direction: row;
  }

  /* The rows are first in the HTML, which is the phone's order and the order a reader gets. */
  .split-fixed {
    order: -1;
    width: 440px;
    flex: none;
  }

  .split-rest {
    flex: 1;
    min-width: 0;
  }

  .trend-pair {
    gap: 48px;
    align-items: center;
    flex-direction: row;
    margin-top: 30px;
  }

  .trend {
    flex: none;
  }

  .trend-head {
    flex-direction: row;
    gap: 16px;
    justify-content: space-between;
    align-items: baseline;
  }

  .trend svg {
    width: 460px;
  }

  .trend-prose {
    flex: 1;
    min-width: 0;
    max-width: 560px;
  }

  .trend-prose h3 {
    font-size: 23px;
  }

  .page-head {
    padding-block: 80px 40px;
  }

  .page-head h1 {
    font-size: 44px;
    line-height: 48px;
    max-width: 18ch;
  }

  .page-head p {
    font-size: 19px;
  }

  .email-card {
    flex-direction: row;
    gap: 28px;
    align-items: center;
    justify-content: space-between;
  }

  .policy .row {
    flex-direction: row;
    gap: 40px;
    padding: 28px 0;
  }

  .policy h2 {
    width: 280px;
    flex: none;
  }

  .policy .lines {
    flex: 1;
  }

  .site-footer {
    margin-top: 104px;
  }

  .site-footer .wrap {
    flex-direction: row;
    gap: 32px;
    align-items: center;
  }
}
