/*
  Berth beta site.
  Tokens follow docs/design-system.md. Contrast figures are WCAG 2 ratios against the surface named.
  System fonts only, no external requests: the Content-Security-Policy in _headers allows nothing else.
*/

:root {
  color-scheme: light dark;

  --page: #FAFAFB;            /* design-system "background" */
  --card: #FFFFFF;
  --well: #F3F4F6;            /* design-system "muted" */
  --text: #1A1C20;            /* 16.4:1 on page, 15.5:1 on well */
  --text-2: #555A63;          /* 6.7:1 on page, 6.3:1 on well */
  --accent: #2B5FC7;          /* actions only; white on it 5.9:1 */
  --accent-hover: #244FA6;    /* white on it 7.7:1 */
  --accent-pressed: #1F4590;  /* white on it 9.1:1 */
  --on-accent: #FFFFFF;
  --route: #0E7C7B;           /* destinations only; 5.0:1 on card */
  --route-band: rgb(14 124 123 / 0.16);
  --route-edge: rgb(14 124 123 / 0.5);
  --border: rgb(0 0 0 / 0.085);
  --border-strong: rgb(0 0 0 / 0.16);
  --focus-outer: #1A1C20;
  --focus-inner: #FFFFFF;
  --logo: #000000;            /* the logo is pure black or pure white, never a grey */

  --font-text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #222327;
    --card: #2A2B30;
    --well: #1D1E21;
    --text: #F1F2F4;          /* 14.0:1 on page, 12.6:1 on card */
    --text-2: #B9BDC5;        /* 8.3:1 on page, 7.5:1 on card */
    --accent: #7AA7FF;        /* #10131A on it 7.8:1 */
    --accent-hover: #97BAFF;
    --accent-pressed: #B3CCFF;
    --on-accent: #10131A;
    --route: #4FC1BC;         /* 6.5:1 on card */
    --route-band: rgb(79 193 188 / 0.2);
    --route-edge: rgb(79 193 188 / 0.55);
    --border: rgb(255 255 255 / 0.085);
    --border-strong: rgb(255 255 255 / 0.15);
    --focus-outer: #F1F2F4;
    --focus-inner: #10131A;
    --logo: #FFFFFF;
  }
}

@media (prefers-contrast: more) {
  :root {
    --text-2: var(--text);
    --border: rgb(0 0 0 / 0.4);
    --border-strong: rgb(0 0 0 / 0.6);
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    --border: rgb(255 255 255 / 0.4);
    --border-strong: rgb(255 255 255 / 0.6);
  }
}

/* Base */

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

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

/* Glide to in-page links such as "Join the beta", unless the system asks for less motion
   (Windows: Settings > Accessibility > Visual effects > Animation effects). */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 1.0625rem/1.6 var(--font-text);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  text-wrap: balance;
}

p,
dd,
figcaption {
  margin: 0;
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--focus-outer);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-inner);
}

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Header */

.site-header {
  padding-block: 1.5rem;
}

.logo {
  display: block;
  width: auto;
  height: 1.75rem;
  color: var(--logo);
}

/* Hero */

.hero {
  display: grid;
  gap: 3rem;
  padding-block: 2.5rem 1rem;
}

.eyebrow {
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 600;
}

h1 {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 1.3rem + 3.6vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 34rem;
  margin-top: 1.25rem;
  color: var(--text-2);
  font-size: 1.1875rem;
  line-height: 1.55;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 2rem;
}

.cta-note {
  color: var(--text-2);
  font-size: 0.9375rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.375rem;
  border: 1px solid transparent; /* shows as a frame in Windows contrast themes */
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1.25 var(--font-text);
  text-decoration: none;
  transition: background-color 120ms ease;
}

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

.button:active {
  background: var(--accent-pressed);
}

/* Route map: the signature. Teal means "the place the plan gives it", nothing else. */

.route-card {
  margin: 0;
  padding: 1.25rem 1.5rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.route-map {
  display: grid;
  grid-template-columns: max-content minmax(2rem, 1fr) max-content;
  grid-template-rows: auto 14.25rem;
  row-gap: 0.625rem;
}

.route-head {
  grid-row: 1;
  grid-column: 1;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

.route-head-to {
  grid-column: 3;
}

.route-from,
.route-to {
  display: grid;
  grid-row: 2;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Four 3rem rows, 0.75rem apart: centres at 1.5, 5.25, 9 and 12.75rem. */
.route-from {
  grid-column: 1;
  grid-template-rows: repeat(4, 3rem);
  row-gap: 0.75rem;
}

/* Centres at 3.375 (between the first two sources), 8.25 and 12.75rem. */
.route-to {
  grid-column: 3;
  grid-template-rows: 1.875rem 3rem 1.875rem 3rem 1.5rem 3rem;
}

.route-to .chip:nth-child(1) { grid-row: 2; }
.route-to .chip:nth-child(2) { grid-row: 4; }
.route-to .chip:nth-child(3) { grid-row: 6; }

/* viewBox height is in rem, so the bands line up with the rows above at any font size. */
.route-bands {
  display: block;
  grid-row: 2;
  grid-column: 2;
  width: 100%;
  height: 14.25rem;
}

.route-bands path {
  fill: var(--route-band);
  stroke: var(--route-edge);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 3rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--card);
  white-space: nowrap;
}

.chip b {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
}

.chip span {
  color: var(--text-2);
  font: 0.75rem/1.35 var(--font-mono);
}

.route-to .chip {
  border-color: var(--route);
}

.route-to .chip b {
  color: var(--route);
}

.route-card figcaption {
  margin-top: 1rem;
  color: var(--text-2);
  font-size: 0.875rem;
}

/* Sections */

.section {
  padding-block: 3rem;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.125rem;
  line-height: 1.35;
}

.section-lede {
  max-width: 40rem;
  margin-top: 0.625rem;
  color: var(--text-2);
}

.aside {
  max-width: 44rem;
  margin-top: 2rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

/* What Berth does */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 2.5rem 3rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.features li {
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
}

.where {
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
}

.features h3 {
  margin: 0.25rem 0 0.5rem;
}

.features li > p:last-child {
  color: var(--text-2);
}

/* Five steps: a real sequence, so it is numbered. */

.steps {
  display: grid;
  gap: 1.75rem;
  max-width: 40rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 3.25rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--page);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
}

.steps li::after {
  content: "";
  position: absolute;
  top: 2rem;
  bottom: -1.75rem;
  left: 1rem;
  width: 1px;
  background: var(--border-strong);
}

.steps li:last-child::after {
  display: none;
}

.steps h3 {
  line-height: 2rem;
}

.steps p {
  margin-top: 0.25rem;
  color: var(--text-2);
}

/* What to expect */

.facts {
  margin: 2rem 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.facts > div {
  display: grid;
  gap: 0.375rem;
  padding: 1.25rem 1.5rem;
}

.facts > div + div {
  border-top: 1px solid var(--border);
}

.facts dt {
  font-weight: 600;
}

.facts dd {
  max-width: 42rem;
  margin: 0;
  color: var(--text-2);
}

.facts dd > * + * {
  margin-top: 0.75rem;
}

.ui {
  color: var(--text);
  font-weight: 600;
}

.code-block {
  display: flex;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--well);
}

.code {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.75rem 1rem;
  color: var(--text);
  font: 0.875rem/1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-user-select: all; /* one click selects the whole command, even without copy.js */
  user-select: all;
}

/* Added by copy.js. A standard button: the accent stays with Join the beta. */
.copy-button {
  flex: none;
  min-width: 4.75rem; /* holds "Copied" without changing width */
  min-height: 2.25rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  padding: 0 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font: 600 0.875rem/1 var(--font-text);
  cursor: pointer;
  transition: background-color 120ms ease;
}

.copy-button:hover {
  background: color-mix(in srgb, var(--card) 93%, var(--text));
}

.copy-button:active {
  background: color-mix(in srgb, var(--card) 86%, var(--text));
}

/* Join */

.join {
  padding: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.join > p:first-of-type {
  max-width: 40rem;
  margin-top: 0.75rem;
  color: var(--text-2);
}

.join .button {
  margin-top: 1.75rem;
}

.join .aside {
  margin-top: 1.5rem;
}

/* Footer */

.site-footer {
  margin-top: 2rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.875rem;
}

.site-footer p {
  max-width: 44rem;
}

.site-footer p + p {
  margin-top: 0.375rem;
}

/* Wider screens */

@media (min-width: 40rem) {
  .facts > div {
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: 4rem;
    padding-block: 4rem 2rem;
  }

  .section {
    padding-block: 4rem;
  }
}

@media (min-width: 64rem) {
  .steps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5rem;
    max-width: none;
  }

  .steps li {
    padding: 3rem 0 0;
  }

  .steps li::after {
    top: 1rem;
    right: -1.5rem;
    bottom: auto;
    left: 2rem;
    width: auto;
    height: 1px;
  }

  .steps h3 {
    line-height: 1.35;
  }
}

/* Narrow phones: keep the route map inside the card down to 320px. */

@media (max-width: 26rem) {
  .route-card {
    padding: 1rem 0.75rem 0.875rem;
  }

  .chip {
    padding: 0 0.5rem;
  }

  .chip b {
    font-size: 0.875rem;
  }

  .chip span {
    font-size: 0.6875rem;
  }

  .facts > div {
    padding: 1rem 1.125rem;
  }

  .join {
    padding: 1.75rem 1.25rem;
  }
}

/* Windows contrast themes */

@media (forced-colors: active) {
  .route-bands path {
    fill: none;
    stroke: CanvasText;
  }

  .route-to .chip {
    border-width: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

.nowrap {
  white-space: nowrap;
}

/* Sign-up form. Fields follow the app: a frame with a stronger bottom edge, and the accent
   underline marks focus. */

:root {
  --field-edge: rgb(0 0 0 / 0.16);
  --field-underline: rgb(0 0 0 / 0.5);  /* 3.9:1 on card */
}

@media (prefers-color-scheme: dark) {
  :root {
    --field-edge: rgb(255 255 255 / 0.12);
    --field-underline: rgb(255 255 255 / 0.55);
  }
}

.signup {
  display: grid;
  gap: 1.25rem 1.5rem;
  max-width: 46rem;
  margin-top: 1.75rem;
}

.field {
  display: grid;
  align-content: start;
  gap: 0.375rem;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 2.75rem;
  margin: 0;
  padding: 0 0.75rem;
  border: 1px solid var(--field-edge);
  border-bottom-color: var(--field-underline);
  border-radius: 4px;
  background: var(--page);
  color: var(--text);
  font: 1rem/1.25 var(--font-text);
}

.field input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: inset 0 -1px 0 var(--accent);
  background: var(--card);
}

.hint {
  color: var(--text-2);
  font-size: 0.875rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.check input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15rem 0 0;
  accent-color: var(--accent);
}

.check a,
.site-footer a,
.message a:not(.button),
.terms a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.signup .button {
  justify-self: start;
  margin-top: 0.25rem;
  cursor: pointer;
}

/* Hidden from people and screen readers; see the comment in index.html. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (min-width: 40rem) {
  .signup {
    grid-template-columns: 1fr 1fr;
  }

  .signup .check,
  .signup .button {
    grid-column: 1 / -1;
  }
}

@media (forced-colors: active) {
  .field input:focus {
    outline: 2px solid Highlight;
  }
}

/* Thank-you, error and terms pages */

.message,
.terms {
  padding-block: 3rem 5rem;
}

.message > *,
.terms > * {
  max-width: 42rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 1.4rem + 2vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.message .lede,
.terms .lede {
  margin-top: 1rem;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2rem;
}

.terms ol {
  margin: 2rem 0 0;
  padding-left: 1.5rem;
}

.terms li {
  padding-left: 0.25rem;
}

.terms li + li {
  margin-top: 1.25rem;
}

.terms li::marker {
  font-weight: 600;
}

.terms li > p,
.terms li > ul {
  margin-top: 0.25rem;
  color: var(--text-2);
}

.terms ul {
  padding-left: 1.25rem;
}

.terms .aside {
  margin-top: 2.5rem;
}
