/* Korevra Gbam — design tokens
 * Korevra house palette, unchanged. Gold is reserved for settled money.
 * BUILD-SPEC section 8 is binding on this file.
 */

:root {
  /* ---- brand constants: identical in every theme ---- */
  --ink: #08192E;
  --navy: #0D2B4E;
  --navy-2: #123963;
  --teal: #1B8A8A;
  --teal-lt: #3FBFA0;
  --teal-dp: #10605F;
  --gold: #D4A843;
  --gold-lt: #E8C36B;
  --gold-dp: #A87C1E;
  --gold-dpr: #7E5C12;
  --paper: #F4EDDF;
  --paper-2: #E8DCC6;
  --paper-3: #D9CBB0;
  --clay: #C4553C;
  --clay-lt: #EDA08B;
  --clay-dp: #8E3826;
  --plum: #6A4FA3;

  /* ---- type ---- */
  --dsp: "Fraunces", Georgia, "Times New Roman", serif;
  --bdy: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mno: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 19px;
  --fs-2xl: 24px;
  --fs-3xl: 32px;

  /* ---- spacing, radius, motion ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 22px; --sp-6: 30px; --sp-7: 44px; --sp-8: 64px;
  --r-sm: 7px; --r-md: 11px; --r-lg: 15px; --r-xl: 22px; --r-pill: 999px;
  --dur: 180ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --shadow-1: 0 2px 8px -2px rgba(0, 0, 0, .32);
  --shadow-2: 0 12px 30px -14px rgba(0, 0, 0, .62);
  --shadow-3: 0 30px 60px -22px rgba(0, 0, 0, .78);
  --maxw: 1180px;
}

/* ======================================================================
 * DARK — the consumer and organiser surface. This is the designed look.
 * ==================================================================== */
:root,
[data-theme="dark"] {
  --bg: #08192E;
  --bg-2: #0D2B4E;
  --surface: rgba(244, 237, 223, .055);
  --surface-2: rgba(244, 237, 223, .09);
  --surface-3: rgba(8, 25, 46, .58);
  --line: rgba(244, 237, 223, .14);
  --line-2: rgba(244, 237, 223, .26);

  --txt: #EAF0F7;          /* 14.6:1 on --bg */
  --txt-2: #B9C8D9;        /*  8.3:1 on --bg */
  --mut: #A9BACC;          /*  7.9:1 on --bg, 4.7:1 on the deepest tint we stack */
  --txt-inv: #08192E;

  /* Ink tokens that must stay legible on the dark base */
  --gold-ink: #EBCE8A;     /*  9.6:1 on --bg  — gold used as TEXT */
  --teal-ink: #5FD6BA;     /*  9.4:1 on --bg */
  --clay-ink: #F0AE9B;     /*  8.0:1 on --bg */
  --plum-ink: #B49BE8;

  --focus: #3FBFA0;
  --page-grad-1: radial-gradient(900px 520px at 82% -8%, rgba(27, 138, 138, .20), transparent 62%);
  --page-grad-2: radial-gradient(700px 460px at 4% 8%, rgba(212, 168, 67, .12), transparent 60%);
}

/* ======================================================================
 * LIGHT — the institution and operations consoles.
 * ==================================================================== */
[data-theme="light"] {
  --bg: #F7F4EC;
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1ECE0;
  --surface-3: #FFFFFF;
  --line: rgba(13, 43, 78, .14);
  --line-2: rgba(13, 43, 78, .26);

  --txt: #0A1D33;          /* 15.9:1 on --bg */
  --txt-2: #2E4462;        /*  8.6:1 on --bg */
  --mut: #4A5D77;          /*  6.0:1 on --bg */
  --txt-inv: #FFFFFF;

  /* On a light base the brand hues must be deepened to reach AA as text */
  --gold-ink: #6B4E0C;     /*  7.4:1 on --bg */
  --teal-ink: #0E5A59;     /*  6.4:1 on --bg */
  --clay-ink: #8E3826;     /*  6.9:1 on --bg */
  --plum-ink: #4C348A;

  --focus: #10605F;
  --page-grad-1: radial-gradient(900px 520px at 82% -8%, rgba(27, 138, 138, .10), transparent 62%);
  --page-grad-2: radial-gradient(700px 460px at 4% 8%, rgba(212, 168, 67, .12), transparent 60%);
}

/* ======================================================================
 * PAPER — the card and receipt artifacts. Always paper, in either theme,
 * because the artifact is a printed object and must not change with the app.
 * ==================================================================== */
.on-paper {
  --txt: #08192E;
  --txt-2: #3F5163;
  --mut: #5F6B78;
  --line: rgba(13, 43, 78, .16);
  --gold-ink: #7E5C12;     /*  7.0:1 on --paper */
  --teal-ink: #0E5A59;
  --clay-ink: #8E3826;
  --surface: rgba(13, 43, 78, .05);
}

/* ======================================================================
 * FILL SCALE — filled surfaces that never flip with the theme.
 * Anything on a --fill-* background uses --fill-ink, which is always legible.
 * ==================================================================== */
:root {
  /* Every ink below is measured against the LIGHTER stop of its gradient, which is
   * the worst case. #1B8A8A and #C4553C both fall under 4.5:1 against white, so the
   * light stops are deepened until the ink clears AA. */
  --fill-gold: linear-gradient(135deg, #D4A843, #E8C36B);
  --fill-gold-ink: #2A1D00;      /* 10.9:1 on #E8C36B */
  --fill-teal: linear-gradient(135deg, #0E5251, #157A7A);
  --fill-teal-ink: #FFFFFF;      /*  5.1:1 on #157A7A */
  --fill-navy: linear-gradient(135deg, #0D2B4E, #123963);
  --fill-navy-ink: #EAF0F7;      /* 12.4:1 on #123963 */
  --fill-clay: linear-gradient(135deg, #8E3826, #BC4E36);
  --fill-clay-ink: #FFFFFF;      /*  4.9:1 on #BC4E36 */
  --fill-mut: rgba(128, 145, 165, .18);
}

/* ======================================================================
 * STATE COLOURS — the gold rule lives here.
 * `paid` is the only state allowed to use gold. Everything pending,
 * promised or projected uses a neutral or clay tone.
 * ==================================================================== */
:root {
  --state-paid: var(--gold);
  --state-paid-ink: var(--gold-ink);
  --state-promised: var(--clay);
  --state-promised-ink: var(--clay-ink);
  --state-unpaid: rgba(147, 167, 189, .30);
  --state-unpaid-ink: var(--mut);
  --state-pending: var(--teal);
  --state-pending-ink: var(--teal-ink);
}

[data-theme="light"] {
  --state-unpaid: rgba(13, 43, 78, .16);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
}
