/* Reset, typography and layout helpers. All values come from tokens.css. */

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

* {
  margin: 0;
}

:root {
  /* The design is light only, so form controls and scrollbars stay light even in a dark OS theme. */
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* Keeps the hidden attribute working on elements whose class sets a display value. */
[hidden] {
  display: none !important;
}

/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-ink);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5,
h6 { font-size: var(--text-md); }

@media (min-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
}

/* Inside the signed-in app, body text is 14px and headings step down to suit dense screens. */
.app {
  font-size: var(--text-sm);
}

.app h1 {
  font-size: var(--text-2xl);
}

.app h2 {
  font-size: var(--text-lg);
}

p,
li {
  text-wrap: pretty;
}

a {
  color: var(--color-primary);
  text-underline-offset: 0.15em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary-hover);
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

::selection {
  background-color: var(--color-primary-soft);
  color: var(--color-ink);
}

/* Focus: every interactive element shows a clear outline when reached by keyboard. */
:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    /* Without this, a staggered entrance would still hold content back for its delay. */
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* Layout helpers */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-16);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-24);
  }
}

/* Marketing pages alternate between --color-bg sections and white sections with no hard edges.
   A white section fades in from the page background and back out over --section-fade, and its
   padding keeps the content on the solid white part. */
.section {
  padding-block: var(--space-48);
}

.section-surface {
  padding-block: var(--section-fade);
  background: linear-gradient(
    to bottom,
    var(--color-bg),
    var(--color-surface) var(--section-fade),
    var(--color-surface) calc(100% - var(--section-fade)),
    var(--color-bg)
  );
}

.section-header {
  display: grid;
  justify-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-32);
  text-align: center;
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--space-64);
  }

  .section-header {
    margin-bottom: var(--space-48);
  }
}

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

/* Text helpers */

.caps-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-muted);
}

/* The one highlighted word in a hero headline */
.text-accent {
  color: var(--color-primary);
}

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