/*
 * Bonjour Bob — design tokens.
 *
 * Direction: the morning. A navy night, a sun that rises, and one light sheet of paper to write
 * on. Made for owners of very small companies who are not at ease with technology: generous
 * text, frank contrast, large targets, nothing that moves for long.
 *
 * Names are those of pingoose/web/static/css/tokens.css, so that this file can take its place.
 * What is new here: --font-display, the sheet (paper, ink), the halo, and the scene (sky and sun).
 *
 * Two themes. Night is the default. Day is chosen with data-theme="light" on <html>; the same
 * values also apply inside any element with the class "paper", which is how a light sheet sits
 * on the night: buttons and fields inside it need no rule of their own. The class "on-scene"
 * does the reverse: it brings the night back for what stands on the scene in the day theme.
 */

@font-face {
  font-family: "Young Serif";
  src: url("fonts/young-serif-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Young Serif names things: the brand, titles, the greeting. Never under 22px, never a paragraph.
     Atkinson Hyperlegible Next says everything else, Bob's own words included. */
  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-voice: var(--font-sans);

  /* Running text is 17px. Nothing goes under 15px. */
  --text-xs: 0.9375rem;
  --text-sm: 1rem;
  --text-base: 1.0625rem;
  --text-md: 1.1875rem;
  --text-lg: 1.375rem;
  --text-xl: 1.75rem;
  --text-display: clamp(2rem, 1.45rem + 2.4vw, 3rem);

  --weight-regular: 400;
  --weight-strong: 650;

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.5;

  --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;

  /* One radius per material: what is pressed, what is said or written on, what is laid in the thread. */
  --radius-control: 0.875rem;
  --radius-bubble: 1.25rem;
  --radius-sheet: 0.75rem;

  /* A finger must find every control: 48px, and 52px for the two buttons of the sheet. */
  --size-control: 3rem;
  --size-control-large: 3.25rem;
  --size-icon: 1.375em; /* follows the text it sits in */
  --measure: 40rem;
  --width-thread: 46rem;
  --width-sheet: 68rem;

  --duration-fast: 120ms;
  --duration-base: 220ms;
  --duration-flight: 900ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* The sheet of paper: the same in both themes. */
  --color-paper: #fbf6ea;
  --color-ink: #111a30;
  --color-caret: #b8500f;

  /* The scene: sky and sun. Always night, whatever the theme. */
  --color-sky-top: #070c1b;
  --color-sky-low: #141c3c;
  --color-sun-core: #fff0c2;
  --color-sun-light: #fcd277;
  --color-sun: #f9bd52;
  --color-sun-deep: #ee8440;
  --color-haze-rose: #9e3d61;
  --color-haze-peach: #f58547;
  --color-on-scene: #fbf3e4;
  --color-on-scene-soft: #d6dae6;
  --color-on-scene-muted: #c3c9d9;
}

/* Night: the default, and what stands directly on the scene in either theme (class "on-scene"). */
:root,
.on-scene {
  color-scheme: dark;

  --color-bg: #0b1228;
  --color-surface: #151e3d;
  --color-raised: #1e2950;
  --color-sunken: #070c1b;
  --color-bubble: #263466;
  --color-text: #fbf3e4;
  --color-muted: #c3c9d9;
  --color-primary: #f9bd52;
  --color-primary-hover: #fcd277;
  --color-on-primary: #111a30;
  --color-accent: #ff9d6b;
  --color-accent-soft: #3b2a33;
  --color-danger: #ffa99b;
  --color-danger-soft: #4a2530;
  --color-control: #8f97b5;
  --color-line: #2a3566;
  --color-mark: #f9bd52;

  /* What surrounds a sheet rather than what is on it: these follow the theme, never the sheet. */
  --color-halo: #f9bd52;
  --color-edge: #fbf6ea;
  --color-shadow: rgb(0 0 0 / 70%);
  --color-veil: rgb(4 8 20 / 72%);
}

/* Day: everything is on the sheet. */
:root[data-theme="light"],
.paper {
  color-scheme: light;

  --color-bg: #f1ead9;
  --color-surface: #f7f1e2;
  --color-raised: #fbf6ea;
  --color-sunken: #e8dfca;
  --color-bubble: #e2d7bd;
  --color-text: #111a30;
  --color-muted: #565c70;
  --color-primary: #111a30;
  --color-primary-hover: #22305a;
  --color-on-primary: #fbf6ea;
  --color-accent: #9c400b;
  --color-accent-soft: #f9e3c4;
  --color-danger: #9c2a20;
  --color-danger-soft: #f6ddd6;
  --color-control: #6f7385;
  --color-line: #d9cfb8;
  --color-mark: #ee8440;
}

:root[data-theme="light"] {
  --color-halo: #111a30;
  --color-edge: #6f7385;
  --color-shadow: rgb(17 26 48 / 22%);
  --color-veil: rgb(17 26 48 / 45%);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-flight: 0ms;
  }
}
