/* Base styles for the Parafé site. Colour always comes from tokens.css —
   site/test/tokens.test.js fails the build on any colour literal in this file. */
@import './tokens.css' layer(tokens);

@layer reset, base;

@layer reset {
  /* Zero-specificity reset so any later layer or component can override it
     without !important. */
  :where(*, *::before, *::after) {
    box-sizing: border-box;
  }

  :where(body, h1, h2, h3, h4, p, figure) {
    margin: 0;
  }
}

@layer base {
  html {
    color-scheme: light;
  }

  body {
    background: var(--color-surface);
    color: var(--color-body);
    font-family:
      system-ui,
      -apple-system,
      'Segoe UI',
      Roboto,
      Helvetica,
      Arial,
      sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    text-wrap: pretty;
  }

  /* Single reading column. Later pages compose their content inside this. */
  .container {
    max-width: var(--measure);
    margin-inline: auto;
    padding-inline: var(--space-2);
  }

  h1,
  h2,
  h3,
  h4 {
    color: var(--color-ink);
    line-height: 1.2;
    text-wrap: balance;
  }

  p,
  li {
    max-width: var(--measure);
  }

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

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

  small,
  .muted {
    color: var(--color-muted);
  }

  /* Visible keyboard focus everywhere, including custom controls added later. */
  :focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
  }
}

@layer components {
  /* First focusable element in the document. Off-screen until it receives
     keyboard focus, then it becomes the most visible thing on the page. */
  .skip-link {
    position: absolute;
    top: -3rem;
    left: var(--space-2);
    z-index: 10;
    padding: var(--space-1) var(--space-2);
    background: var(--color-primary);
    color: var(--color-surface);
    border-radius: var(--radius);
  }

  .skip-link:focus-visible {
    top: var(--space-1);
  }

  /* Hidden from sighted users and from tab order alike; only a bot filling
     every field would ever populate it. */
  .hp-field {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .container {
    padding-block: var(--space-4);
  }

  header .container {
    padding-block: var(--space-2);
  }

  .brand {
    font-weight: 700;
    color: var(--color-ink);
  }

  .button {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius);
    background: var(--color-primary);
    color: var(--color-surface);
    text-decoration: none;
    font-weight: 600;
  }

  .button:hover {
    background: var(--color-primary-dk);
    color: var(--color-surface);
  }

  /* Contact (primary) and demo (secondary) side by side, wrapping on narrow
     screens. The demo note sits right under them in .muted. */
  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin-block: var(--space-3) var(--space-1);
  }

  .button-secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: inset 0 0 0 2px var(--color-primary);
  }

  .button-secondary:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary-dk);
    box-shadow: inset 0 0 0 2px var(--color-primary-dk);
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  caption {
    text-align: left;
    font-weight: 600;
    color: var(--color-ink);
    margin-block-end: var(--space-1);
  }

  th,
  td {
    text-align: left;
    padding: var(--space-1);
    border-bottom: 1px solid var(--color-border);
  }

  th {
    background: var(--color-surface-alt);
    color: var(--color-ink);
  }

  form p {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: none;
  }

  label {
    color: var(--color-ink);
    font-weight: 600;
  }

  input,
  textarea {
    padding: var(--space-1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-body);
    background: var(--color-surface);
    font: inherit;
  }

  button {
    align-self: start;
    padding: var(--space-1) var(--space-3);
    border: none;
    border-radius: var(--radius);
    background: var(--color-primary);
    color: var(--color-surface);
    font-weight: 600;
    font: inherit;
    cursor: pointer;
  }

  button:hover {
    background: var(--color-primary-dk);
  }
}

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