/* Ledgerly design tokens and motion primitives (DESIGN.md). Loaded before site.css, app.css and the portal's
   styles. Every colour, font, radius, shadow, duration and easing in the product comes from here. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/sourcesans3-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* colour */
  --paper: #f6f4ee;
  --paper-2: #efeae0;
  --sheet: #ffffff;
  --ink: #141619;
  --ink-2: #3b3f48;
  --ink-3: #5b606c;
  --line: #dedad0;
  --line-2: #c9c4b6;
  --brand: #c84b31;
  --brand-ink: #9e331b;
  --brand-soft: #fbeee9;
  --ok: #166534;
  --ok-soft: #e8f5ee;
  --warn: #92400e;
  --warn-soft: #fff7e6;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --night: #16181c;
  --night-2: #23262d;
  --night-ink: #b4b8c2;
  --chart-1: #141619;
  --chart-2: #c84b31;
  --chart-3: #166534;
  --chart-4: #b89b6a;
  --chart-5: #8a8f9c;

  /* type */
  --font-head: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* shape and depth */
  --r-1: 8px;
  --r-2: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(20, 22, 25, .06), 0 4px 14px rgba(20, 22, 25, .07);
  --shadow-2: 0 2px 6px rgba(20, 22, 25, .06), 0 18px 44px rgba(20, 22, 25, .13);
  --ring: 0 0 0 3px rgba(200, 75, 49, .28);

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-1: 120ms;
  --t-2: 200ms;
  --t-3: 360ms;
  --t-4: 640ms;

  /* text on the brand colour (buttons): white in both themes */
  --on-brand: #ffffff;
  /* documents shown inside the app (an e-invoice, a letter) stay white paper in both themes */
  --doc: #ffffff;
  color-scheme: light;
}

/* ---- Dark theme (app only). <html data-theme="dark">, or data-theme="auto" on a device set to dark.
   Same roles as above: the page is the darkest surface, panels sit a step lighter, text is warm off-white.
   The brand colour keeps its value for fills (white text stays readable); --brand-ink is the light variant
   for brand-coloured text and links on dark surfaces. Pages that never set data-theme (the public site)
   are not affected. Keep the two blocks below identical. ---- */
:root[data-theme="dark"] {
  --paper: #121315; --paper-2: #24272c; --sheet: #1b1d21;
  --ink: #eceae4; --ink-2: #cbc9c2; --ink-3: #a3a5ad;
  --line: #31343a; --line-2: #464a52;
  --brand: #c84b31; --brand-ink: #f39a83; --brand-soft: #3a211b;
  --ok: #6fd39a; --ok-soft: #16291e; --warn: #f2b85e; --warn-soft: #2e2512; --bad: #f4867c; --bad-soft: #351b19;
  --night: #0b0c0e; --night-2: #202328; --night-ink: #b4b8c2;
  --chart-1: #eceae4; --chart-2: #e26a4f; --chart-3: #6fd39a; --chart-4: #cdb282; --chart-5: #8f949f;
  /* dark values of the app aliases (app.css :root) */
  --line-soft: #272a2f; --hover: #22252a; --head: #202227; --ok-strong: #9ee6bb; --bad-soft-2: #43201d; --brand-press: #a93d27;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .45), 0 18px 44px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --paper: #121315; --paper-2: #24272c; --sheet: #1b1d21;
    --ink: #eceae4; --ink-2: #cbc9c2; --ink-3: #a3a5ad;
    --line: #31343a; --line-2: #464a52;
    --brand: #c84b31; --brand-ink: #f39a83; --brand-soft: #3a211b;
    --ok: #6fd39a; --ok-soft: #16291e; --warn: #f2b85e; --warn-soft: #2e2512; --bad: #f4867c; --bad-soft: #351b19;
    --night: #0b0c0e; --night-2: #202328; --night-ink: #b4b8c2;
    --chart-1: #eceae4; --chart-2: #e26a4f; --chart-3: #6fd39a; --chart-4: #cdb282; --chart-5: #8f949f;
    --line-soft: #272a2f; --hover: #22252a; --head: #202227; --ok-strong: #9ee6bb; --bad-soft-2: #43201d; --brand-press: #a93d27;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .45), 0 18px 44px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

/* the parts of the page nobody draws */
::selection { background: var(--brand); color: #fff; }
html { scrollbar-color: var(--line-2) transparent; }
:where(input, textarea) { caret-color: var(--brand); }

/* ---- page-to-page transition (CSS only; browsers without it navigate as before) ---- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out var(--t-1) ease-in both; }
::view-transition-new(root) { animation: vt-in var(--t-2) var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* ---- shared keyframes ---- */
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes row-note { from { background-color: var(--brand-soft); } }

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