/*
 * Gatherment design system: tokens, reset and base type.
 * Every other stylesheet is one primitive or one layout and reads only these variables.
 * The rules are in docs/design-system.md.
 */

@layer reset, base, components, layouts, utilities;

/* Google Sans Variable, self-hosted under the OFL (app/assets/fonts/OFL-LICENSE.txt). */
@font-face {
  font-family: "Google Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("/assets/google-sans-latin-wght-normal-d7a4411a.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Google Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("/assets/google-sans-latin-ext-wght-normal-954301ab.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Colour. All text is ink; hierarchy comes from size and weight, never a lighter grey. */
  --color-ink: #0a2a1b;
  --color-canvas: #faf9f6;
  --color-surface: #ffffff;
  --color-button: #04301f;
  --color-button-hover: #0b4a31;
  --color-on-button: #ffffff;
  --color-focus: #5b3fd6;
  --color-ink-4: color-mix(in srgb, var(--color-ink) 4%, transparent);
  --color-ink-8: color-mix(in srgb, var(--color-ink) 8%, transparent);
  --color-ink-12: color-mix(in srgb, var(--color-ink) 12%, transparent);
  --color-scrim: color-mix(in srgb, var(--color-ink) 40%, transparent);

  /* Bands: one pastel per page or step, joined to the canvas by a wave. */
  --color-sky: #86e4fd;
  --color-lilac: #d9d9fd;
  --color-butter: #fff3a3;
  --color-peach: #feb59e;
  --color-coral: #fe8f7f;
  --color-mint: #d7f1e4;

  /* Feedback reuses the band colours, so it never introduces a red or a grey. */
  --color-notice: var(--color-mint);
  --color-alert: var(--color-coral);

  /* The fill an element takes on its surface: ink at 8% on canvas and in white surfaces, white on a band. */
  --fill: var(--color-ink-8);
  --fill-hover: var(--color-ink-12);
  /* A white row or card under the pointer. */
  --color-surface-hover: var(--color-surface-hover);

  /* Type */
  --font-sans: "Google Sans Variable", "Google Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.5rem;
  --text-display: clamp(2.75rem, 6vw + 1rem, 5rem);
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 700;
  --leading-tight: 1.02;
  --leading-snug: 1.2;
  --leading-normal: 1.5;
  --tracking-display: -0.055em;
  --tracking-heading: -0.03em;
  --tracking-title: -0.02em;
  --tracking-snug: -0.01em;

  /* Space, on a 4px grid */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Shape: squircles. Browsers with corner-shape get true superellipse corners (see the reset). */
  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  /* Elevation, only for things that float over the page */
  --shadow-float: 0 18px 40px -12px color-mix(in srgb, var(--color-ink) 35%, transparent), 0 2px 6px color-mix(in srgb, var(--color-ink) 10%, transparent);
  --shadow-raised: 0 1px 2px color-mix(in srgb, var(--color-ink) 12%, transparent), 0 6px 16px -6px color-mix(in srgb, var(--color-ink) 30%, transparent);
  --shadow-panel: -24px 0 64px -24px color-mix(in srgb, var(--color-ink) 30%, transparent);

  /* Sizes */
  --control-height: 3rem;
  --control-height-sm: 2.25rem;
  --control-height-lg: 3.5rem;
  --content-width: 72rem;
  --form-width: 36rem;
  --panel-width: 27rem;
  --gutter: var(--space-6);

  /* Motion */
  --duration-fast: 120ms;
  --duration: 220ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@supports (corner-shape: squircle) {
  :root {
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 32px;
    --radius-xl: 44px;
  }
}

@media (max-width: 767px) {
  :root { --gutter: var(--space-4); }
}

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

  @supports (corner-shape: squircle) {
    *, ::before, ::after { corner-shape: squircle; }
  }

  body, h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
  ul[class], ol[class] { padding: 0; list-style: none; }
  img, svg { display: block; max-width: 100%; }
  button, input, select, textarea { font: inherit; color: inherit; }

  @media (prefers-reduced-motion: reduce) {
    *, ::before, ::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  }
}

@layer base {
  body {
    background: var(--color-canvas);
    color: var(--color-ink);
    font: var(--weight-medium) var(--text-md) / var(--leading-normal) var(--font-sans);
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4 { font-weight: var(--weight-bold); line-height: var(--leading-snug); text-wrap: balance; }
  h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-heading); }
  h3 { font-size: var(--text-lg); letter-spacing: var(--tracking-snug); }
  strong, b { font-weight: var(--weight-bold); }

  a { color: inherit; text-underline-offset: 0.18em; }

  :focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
  ::selection { background: var(--color-lilac); }
}
