/* Base styles: reset, typography, layout primitives, header and footer.
   Design tokens live in tokens.css; page-specific styles in landing.css. */

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

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Safety net: one element wider than the screen widens the phone
     layout viewport, which zooms the whole page out and drags every
     fixed element with it (the 2026-07-25 header bug). clip, not
     hidden: hidden would make body a scroll container and detach the
     sticky header. */
  overflow-x: clip;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

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

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

::selection {
  background: var(--accent);
  color: var(--paper);
}

/* Layout primitives */

.container {
  width: min(var(--container), 100% - 2.5rem);
  margin-inline: auto;
}

.container-narrow {
  width: min(var(--container-narrow), 100% - 2.5rem);
  margin-inline: auto;
}

.kicker {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.skip-link {
  position: absolute;
  left: -100vw;
  top: var(--space-2);
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 10;
}

.skip-link:focus {
  left: var(--space-2);
  color: var(--paper);
}

/* Header */

.site-header {
  border-bottom: var(--border-hard);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Plain nav link in the anonymous header (Pricing). Quieter than the
   buttons beside it on purpose: it points, they act. Hidden on the
   narrowest phones, where the header row is already the tightest fit. */
.header-nav-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.6em 0.5em;
  margin-right: var(--space-1);
}

.header-nav-link:hover {
  color: var(--ink);
}

@media (max-width: 419px) {
  .header-nav-link {
    display: none;
  }
}

/* Phone widths: the header row is the tightest fit on the site, the
   wordmark plus the credit chip plus a button share ~335px. Trim
   instead of wrapping: a two-line sticky header would spend canvas
   height every page needs. */
@media (max-width: 479px) {
  .site-header .container {
    gap: var(--space-2);
  }

  /* Scoped to .site-header on purpose, and not only for the footer's
     sake: the bare .wordmark base rule below and .credit-chip's base in
     workspace.css (later in load order) tie these on specificity, so an
     unscoped override here silently loses the cascade. */
  .site-header .wordmark {
    font-size: 1.125rem;
  }

  .site-header .btn-sm {
    font-size: var(--text-xs);
    padding: 0.6em 0.9em;
  }
}

/* The signed-in row (wordmark + credit chip + Dashboard) still overflowed
   the narrowest phones after the trims above: the chip and the button
   cannot shrink below their text, so every fixed cost shaves again. */
@media (max-width: 360px) {
  /* The container's gutter is a width cap, not padding: widen it here
     instead of padding it, or the row loses another 24px it needs. */
  .site-header .container {
    width: calc(100% - 1.5rem);
  }

  .site-header .wordmark {
    font-size: 1rem;
  }

  .site-header .btn-sm {
    padding: 0.55em 0.7em;
  }

  .site-header .credit-chip {
    gap: 0.35em;
    padding: 0.35em 0.55em;
  }
}

/* Scrolled-to sections clear the sticky header */
[id] {
  scroll-margin-top: 4.5rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark em {
  font-style: normal;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark em {
  color: var(--accent);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
  padding-block: var(--space-7);
  margin-top: var(--space-9);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-footer p {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

/* Motion preferences */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Legal pages */

.legal-page h1 {
  font-size: var(--text-h2);
  margin: var(--space-2) 0;
}

.legal-page h2 {
  font-size: var(--text-lg);
  margin: var(--space-6) 0 var(--space-2);
}

.legal-updated {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-soft);
  margin-bottom: var(--space-4);
}

.footer-legal a {
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

/* The footer Billing control is a form button (the portal needs a POST),
   restyled to sit inline with the surrounding links. */
.footer-billing-form {
  display: inline;
}

.footer-billing {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-family: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.footer-billing:hover {
  color: var(--accent-deep);
}
