/* WorkAdept Portal — reset + base element styles. Layer order is declared once in tokens.css. */

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

  /* :where() keeps every reset at zero specificity so components never fight it. */
  :where(body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol) {
    margin: 0;
  }

  :where(img, svg, video) {
    display: block;
    max-inline-size: 100%;
  }

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

  :where(fieldset) {
    margin: 0;
    padding: 0;
    border: 0;
  }
}

@layer base {
  html {
    overflow-x: clip;
  }

  body {
    min-block-size: 100dvh;
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    /* Natively themes checkboxes/radios/range/progress in both schemes. */
    accent-color: var(--color-accent);
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.025em;
    line-height: 1.15;
    text-wrap: balance;
  }

  p {
    max-inline-size: 65ch;
    text-wrap: pretty;
  }

  a {
    color: var(--color-accent-strong);
    text-decoration-color: color-mix(in oklch, var(--color-accent) 45%, transparent);
    text-underline-offset: 0.2em;

    &:hover {
      text-decoration-color: currentColor;
    }
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--color-paper-2);
    padding-inline: var(--space-1);
    border-radius: var(--radius-sm);
  }

  button {
    cursor: pointer;

    &:disabled {
      cursor: not-allowed;
    }
  }

  /* HTMX's equivalent default indicator rules live in this same-origin stylesheet so the
     library never needs to inject an inline <style> element that the portal CSP must block. */
  .htmx-indicator {
    visibility: hidden;
    opacity: 0;
  }

  .htmx-request .htmx-indicator,
  .htmx-request.htmx-indicator {
    visibility: visible;
    opacity: 1;
    transition: opacity 200ms ease-in;
  }

  :focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: 2px;
  }

  ::placeholder {
    color: var(--color-muted);
  }

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