/* Tokens and type follow docs/design.md. */

@font-face {
  font-family: 'Roboto Condensed';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/roboto-condensed-v31-latin.woff2') format('woff2');
}

:root {
  color-scheme: light dark;

  --navy: #03266a;
  --ink: #03266a;
  --background: #fff;
  --note-card: #eceeef;
  --card-border: #eaebed;

  /* The ink ladder: one hue, made quieter with opacity. */
  --ink-80: color-mix(in srgb, var(--ink) 80%, transparent);
  --ink-70: color-mix(in srgb, var(--ink) 70%, transparent);
  --ink-20: color-mix(in srgb, var(--ink) 20%, transparent);
  --ink-10: color-mix(in srgb, var(--ink) 10%, transparent);

  --display: 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --header-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #fff;
    --background: #000;
    --note-card: #2c2e33;
    --card-border: #2c2e33;
  }
}

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

html {
  scroll-padding-top: calc(var(--header-height) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 1rem/1.5 var(--body);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  text-wrap: balance;
}

a {
  color: inherit;
}

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

.wrap {
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: 24px;
  top: -100px;
  z-index: 20;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: 600 1.125rem/1.5 var(--display);
}

.skip-link:focus {
  top: 8px;
}

/* Header: stays put, and the page passes under it through a wash of the
   background rather than at a hard edge. */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background);
}

.site-header::after {
  content: '';
  position: absolute;
  inset: 100% 0 auto;
  height: 24px;
  background: linear-gradient(var(--background), transparent);
  pointer-events: none;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-height);
  padding-block: 8px;
}

/* The logo beside the name. It has "Boarding" in it too, too small to read at
   this size, so the name stays as text. */

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 700 1.5rem/1 var(--display);
  text-decoration: none;
}

.wordmark img {
  flex: none;
  border-radius: 50%;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a:not(.button) {
  display: none;
  color: var(--ink-70);
  font: 600 1.125rem/1 var(--display);
  text-decoration: none;
}

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

@media (min-width: 760px) {
  .site-nav a:not(.button) {
    display: block;
  }
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 32px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: 600 1.25rem/1.2 var(--display);
  text-align: center;
  text-decoration: none;
  transition:
    opacity 0.35s,
    scale 0.35s;
}

.button:active {
  opacity: 0.7;
}

.button--small {
  min-height: 44px;
  padding-inline: 20px;
  font-size: 1.125rem;
}

.button--secondary {
  border-color: var(--ink-20);
  background: none;
  color: var(--ink);
}

.button--secondary:active {
  opacity: 1;
  scale: 0.97;
}

/* Hero */

.hero {
  display: grid;
  gap: 48px;
  align-items: center;
  padding-block: 64px 48px;
}

.hero-label {
  margin-bottom: 16px;
  color: var(--ink-70);
  font: 600 1.25rem/1.2 var(--display);
}

.hero h1 {
  max-width: 12em;
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.01em;
}

.nowrap {
  white-space: nowrap;
}

.lede {
  max-width: 36em;
  margin-top: 24px;
  color: var(--ink-70);
  font-size: 1.25rem;
  line-height: 1.45;
}

/* The progress ring, as around the app's missions: filling clockwise from the
   top over a 20% track, round caps. */

.hero-figure {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
}

.ring {
  position: relative;
  flex: none;
  width: 144px;
}

.ring svg {
  display: block;
  width: 100%;
  height: auto;
  fill: none;
  stroke: var(--ink);
  stroke-width: 14;
  /* The stroke runs to the viewBox's edge. */
  overflow: visible;
}

.ring-track {
  opacity: 0.2;
}

.ring-fill {
  stroke-linecap: round;
}

.ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 2.5rem/1 var(--display);
  font-variant-numeric: tabular-nums;
}

.hero-figure figcaption {
  max-width: 11em;
  color: var(--ink-70);
  font: 600 1.25rem/1.25 var(--display);
}

@media (min-width: 880px) {
  .hero-figure {
    flex-direction: column;
    text-align: center;
  }

  .ring {
    width: 240px;
  }

  .ring-value {
    font-size: 4.5rem;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
}

/* Sections: the heading on the leading side, the content beside it. */

.section {
  display: grid;
  gap: 24px 48px;
  padding-block: 48px;
}

.section h2 {
  font-size: 2.5rem;
  line-height: 1.1;
}

.section-body {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.section-body > p {
  max-width: 38em;
  color: var(--ink-70);
  font-size: 1.125rem;
}

@media (min-width: 880px) {
  .hero {
    grid-template-columns: 1fr auto;
    gap: 64px;
    padding-block: 96px 64px;
  }

  .section {
    grid-template-columns: 264px 1fr;
    padding-block: 64px;
  }
}

/* Cards: full width, radius 24, separated by fill, no shadow. */

.card {
  padding: 24px;
  border-radius: 24px;
  background: var(--note-card);
}

.card-label {
  color: var(--ink-70);
  font: 600 1rem/1.2 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-value {
  margin-top: 4px;
  font: 600 clamp(2.5rem, 8vw, 3.5rem) / 1.1 var(--display);
}

/* Stat cards, as on the app's Flight log: outlined, the number under its
   label at the bottom leading corner. */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-height: 176px;
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: 32px;
}

.stat dt {
  color: var(--ink-70);
  font: 600 1.25rem/1.2 var(--display);
}

.stat dd {
  font: 700 clamp(3rem, 12vw, 4.5rem) / 1 var(--display);
  font-variant-numeric: tabular-nums;
}

/* Rows on one card with dividers, as in the app's points history. */

.rows > * {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 12px;
  border-top: 1px solid var(--ink-10);
  font: 600 1.125rem/1.3 var(--display);
}

.rows > :first-child {
  border-top: 0;
  padding-top: 0;
}

.rows > :last-child {
  padding-bottom: 0;
}

.rows small {
  display: block;
  margin-top: 2px;
  color: var(--ink-70);
  font: 1rem/1.4 var(--body);
}

.rows .amount {
  flex: none;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.rows .amount--large {
  font-size: 2rem;
  line-height: 1;
}

.card .rows {
  margin-top: 24px;
}

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

/* Meters: a capsule bar under a row's label and figure. With a track it's a
   share of a whole; without one, bars in a card are to the same scale. */

.meter {
  display: block;
  flex: 0 0 100%;
  width: 100%;
  fill: var(--ink);
}

.meter-track {
  opacity: 0.2;
}

/* Steps */

.steps {
  display: grid;
  gap: 12px;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
}

.step-number {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--note-card);
  font: 600 1.25rem/1 var(--display);
}

.steps h3 {
  /* Its first line sits level with the number. */
  margin-top: 5px;
  font-size: 1.5rem;
  line-height: 1.2;
}

.steps p {
  margin-top: 8px;
  color: var(--ink-70);
}

/* Plain lists */

.list li {
  padding-block: 12px;
  border-top: 1px solid var(--card-border);
  font: 600 1.125rem/1.3 var(--display);
}

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

.split {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 600px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

.fine-print {
  color: var(--ink-70);
  font-size: 1rem;
}

.section-body > .fine-print {
  font-size: 1rem;
}

/* Footer */

.site-footer {
  margin-top: 48px;
  padding-block: 32px 48px;
  border-top: 1px solid var(--card-border);
  color: var(--ink-70);
}

.site-footer .wrap {
  display: grid;
  gap: 16px;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

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

/* Legal pages and the 404 page */

.prose {
  max-width: 680px;
  padding-block: 64px 48px;
  color: var(--ink-80);
}

.prose h1 {
  color: var(--ink);
  font-size: 2.5rem;
  line-height: 1.1;
}

.prose h2 {
  margin-top: 32px;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1.2;
}

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

.prose ul {
  padding-left: 20px;
  list-style: disc;
}

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

.prose strong {
  color: var(--ink);
}

.prose .updated {
  margin-top: 8px;
  color: var(--ink-70);
}

.prose .actions {
  margin-top: 24px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  /* The ring fills once as the page opens. */
  .ring-fill {
    animation: ring-fill 0.6s 0.15s ease-out backwards;
  }

  /* Bars fill once as they come into view: site.js empties them (.is-empty)
     until then. Without it they're simply full. */
  .meter-fill {
    transition: width 0.6s cubic-bezier(0.22, 0.8, 0.36, 1);
  }

  .meter.is-empty .meter-fill {
    width: 0;
  }
}

@keyframes ring-fill {
  from {
    stroke-dasharray: 0 100;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
}
