/*
 * Base: reset, document typography, focus, and the three layout primitives.
 * Everything here is shared between the landing page and the product.
 */

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

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

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

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

/* Headings use the brand display face from the logo; body text keeps the system stack for reading. */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

/* Classes that set display override the browser's bare [hidden] rule and reveal hidden fields. */
/* Make the attribute win so the waitlist never shows the password field. */
[hidden] {
  display: none !important;
}

/* ---- Type roles. ---- */
/* A role is picked from this list rather than sized per component. */

.t-display {
  font-size: var(--text-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-bold);
  text-wrap: balance;
}

.t-h2 {
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  text-wrap: balance;
}

.t-h3 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
}

.t-lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.t-body {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.t-small {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.t-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-accent);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.t-measure {
  max-width: var(--measure);
}

a {
  color: var(--text-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

/* ---- Focus. ---- */
/* One visible focus treatment for the whole product. */
/* It is an outline rather than a shadow so it survives on any surface. */

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.on-inverse :focus-visible {
  outline-color: var(--focus-ring-inverse);
}

/* ---- Accessibility helpers. ---- */

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* ---- Layout primitives. ---- */
/* Three of them, and they compose. */
/* Sections do not invent their own spacing. */

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

.container--narrow {
  max-width: var(--container-narrow);
}

/* Vertical rhythm: one gap value for the whole stack. */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, var(--space-4));
}

/* Flex and grid children default to min-width: auto. */
/* A wide code block or long token can make the page scroll sideways. */
/* Overriding the minimum here prevents overflow across components. */
.stack > *,
.cluster > *,
.grid > * {
  min-width: 0;
}

.stack--2 { --stack-gap: var(--space-2); }
.stack--3 { --stack-gap: var(--space-3); }
.stack--5 { --stack-gap: var(--space-5); }
.stack--6 { --stack-gap: var(--space-6); }
.stack--7 { --stack-gap: var(--space-7); }

/* Horizontal grouping that wraps instead of overflowing. */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--space-4));
}

.cluster--between {
  justify-content: space-between;
}

/* An auto-fitting grid so no section needs a media query for its columns. */
.grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 15rem)), 1fr));
}

/* ---- Motion. ---- */
/* Reduced motion is honoured globally, not per component. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
