/* =====================================================================
   design-system/tokens/primitives.css  ·  Layer 2 of 3: PRIMITIVES  ·  DS v2 (design v4, 2026-10-24)
   ---------------------------------------------------------------------
   Raw values: self-hosted fonts, colour ramps, spring curves.
   Components NEVER use these (tests/ds_package_test.php fails any
   --p-* or --brand-accent-* inside components.css). semantic.css maps
   them to purpose names (--color-text, --color-tint, ...).
   Hex/rgb literals are allowed only in this file and in brand.css.
   Palette = design-v4.html (Aus approved 2026-10-24). Where a v4 value fails
   the rule book's 4.5:1 it is kept for non-text use and a darker sibling is
   added for text (README "v4 palette, AA adjustments").
   ===================================================================== */

/* ---------- Fonts: self-hosted woff2 subsets (OFL 1.1, see fonts/OFL-*.txt) ----------
   v4 uses the platform UI font (SF Pro / Segoe UI) for Latin; Lao and Thai come from
   our own Noto subsets (no Google Fonts: render-blocking, breaks View Transitions). */
/* currency signs only (kip U+20AD and friends) for platforms whose UI font lacks them */
@font-face { font-family: "DS Currency"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-currency.woff2") format("woff2");
  unicode-range: U+20A0-20AB, U+20AD-20C0; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/noto-sans-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Lao"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/noto-sans-lao.woff2") format("woff2");
  unicode-range: U+0E81-0EDF, U+200C-200D, U+25CC; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2009, U+2010-2014, U+2022, U+2026, U+2212; }

:root {
  /* ---------- v4 light neutrals ---------- */
  --p-white: #FFFFFF;          /* v4 --bg, --card */
  --p-l-bg2: #F5F5F7;          /* v4 --bg2: sidebars, grouped page */
  --p-l-bg3: #FAFAFA;          /* v4 --bg3: row hover, quiet panels */
  --p-l-fill: #F2F2F5;         /* v4 --fill */
  --p-l-fill2: #E9E9EE;        /* v4 --fill2 */
  --p-l-text: #1D1D1F;         /* v4 --text */
  --p-l-text2: #636366;        /* text secondary (v4 #6E6E73 kept as tertiary: passes 4.5 where v4's #8E8E93 doesn't) */
  --p-l-text3: #6E6E73;        /* text tertiary (v4 text2 value; v4 text3 #8E8E93 = 3.3:1, non-text only) */
  --p-l-gray3: #8E8E93;        /* v4 --text3: control borders (3:1), decorative marks */
  --p-l-border: #858589;       /* control border: >= 3:1 on #FFF and #F5F5F7 */
  --p-l-switch-off: #E5E5EA;   /* v4 --switch-off */
  --p-l-sep: rgb(60 60 67 / 0.13);   /* v4 --sep */
  --p-l-sep2: rgb(60 60 67 / 0.08);  /* v4 --sep2 */
  --p-l-hover: rgb(127 127 127 / 0.08);  /* v4 nav hover */
  --p-l-selected: rgb(120 120 128 / 0.12); /* v4 nav selected (lightened from .13 so secondary counts keep 4.5:1) */
  --p-l-seg-on: #FFFFFF;
  --p-l-yellow-tint: #FFF8E0;  /* v4 --yellow-tint (internal note) */

  /* ---------- v4 dark neutrals ---------- */
  --p-d-bg: #1C1C1E;           /* v4 dark --bg */
  --p-d-bg2: #141416;
  --p-d-bg3: #18181A;
  --p-d-fill: #2C2C2E;
  --p-d-fill2: #3A3A3C;
  --p-d-fill-hover: #303032;   /* hover fill: v4 #3A3A3C gives blue text only 4.0:1 */
  --p-d-card: #242426;
  --p-d-elevated: #2C2C2E;     /* v4 dark menus / sheets / popovers */
  --p-d-text: #F5F5F7;
  --p-d-text2: #A1A1A6;
  --p-d-text3: #98989D;        /* v4 #8D8D93 lifted to pass 4.5 on fill */
  --p-d-gray3: #8D8D93;
  --p-d-border: #76767C;
  --p-d-switch-off: #39393D;
  --p-d-sep: rgb(235 235 245 / 0.13);
  --p-d-sep2: rgb(235 235 245 / 0.07);
  --p-d-hover: rgb(127 127 127 / 0.12);
  --p-d-selected: rgb(120 120 128 / 0.24);
  --p-d-seg-on: #636366;
  --p-d-yellow-tint: #2F2A1C;
  --p-d-toast: #3A3A3C;

  /* ---------- v4 status colours ---------- */
  --p-l-green: #18792F;        /* text (v4 #1F8F3A = 4.2:1, darkened) */
  --p-green-dot: #34C759;      /* dots, online, switch-on mark (non-text) */
  --p-l-green-switch: #248A3D; /* switch on track: 4.4:1 against white (iOS increased-contrast green) */
  --p-l-red: #D70015;          /* v4 --red */
  --p-l-red-hover: #B80012;
  --p-l-red-pressed: #9A000F;
  --p-red-badge: #FF3B30;      /* v4 badge red (decorative only; badges use --p-l-red for the 4.5 label) */
  --p-l-orange: #B34700;       /* text (v4 #C24E00 = 4.3:1 on fill, darkened) */
  --p-orange-dot: #FF9500;
  --p-l-indigo: #5856D6;
  --p-d-green: #30D158;
  --p-d-red: #FF6961;
  --p-d-red-hover: #FF8A84;
  --p-d-red-pressed: #E5554E;
  --p-d-orange: #FFA94D;
  --p-d-indigo: #8E8CF0;
  --p-d-on-red: #2A0509;

  /* ---------- Third-party channel colours (badges only) ---------- */
  --p-facebook: #0A7CFF;       /* v4 --c-msgr */
  --p-whatsapp: #25D366;
  --p-whatsapp-ink: #06301A;
  --p-instagram: #E1306C;
  --p-tiktok: #111111;

  /* ---------- Paper ---------- */
  --p-ink: #000000;
  --p-paper: #FFFFFF;
  --p-ink-text: #1D1D1F;       /* toast surface (v4 light) */

  /* ---------- Shadow / highlight channels ---------- */
  --p-shade-black: 0 0 0;
  --p-highlight: 255 255 255;
  --p-scrim-light: rgb(0 0 0 / 0.28);  /* v4 --scrim */
  --p-scrim-dark: rgb(0 0 0 / 0.5);

  /* ---------- Spring curves (tools/spring-linear.mjs, mass 1, settle at 0.2 %) ---------- */
  /* k 520, c 38, zeta 0.83, settles 354 ms, 0.9 % overshoot: pages, sheets, modals (ADR-001 §6) */
  --p-spring-354: linear(0, 0.006 1.382%, 0.024 2.877%, 0.054 4.485%, 0.097 6.262%, 0.191 9.45%, 0.416 16.276%, 0.518 19.52%, 0.614 22.906%, 0.696 26.178%, 0.764 29.365%, 0.821 32.609%, 0.87 35.966%, 0.91 39.492%, 0.945 43.526%, 0.971 47.898%, 0.99 52.722%, 1.002 58.223%, 1.009 71.03%, 1);
  /* k 900, c 54, zeta 0.90, settles 194 ms, no overshoot: chips, fades, small UI (ADR-001 §6) */
  --p-spring-193: linear(0, 0.004 1.649%, 0.018 3.402%, 0.04 5.309%, 0.072 7.371%, 0.171 12.423%, 0.464 25.515%, 0.586 31.701%, 0.656 35.773%, 0.718 39.845%, 0.771 43.969%, 0.818 48.247%, 0.861 52.99%, 0.897 57.99%, 0.926 63.299%, 0.95 69.072%, 0.968 75.103%, 0.982 81.804%, 1);
  /* MOTION_V2 §6 press release (1% settle): k225 c21 zeta 0.70, 95% of the travel by ~180 ms, settles ~400 ms, 4.5% overshoot */
  --p-spring-press-release: linear(0, 0.035, 0.117, 0.23, 0.352, 0.478, 0.594, 0.697, 0.789, 0.862, 0.922, 0.967, 0.999, 1.022, 1.036, 1.043, 1.045, 1.044, 1.04, 1.036, 1.03, 1.024, 1.019, 1.014, 1);
  /* MOTION_V2 §4 (1% settle): land k300 c27 zeta 0.78 · parcel k520 c32 zeta 0.70 · send k420 c36 zeta 0.88 */
  --p-spring-land: linear(0, 0.038, 0.129, 0.247, 0.373, 0.496, 0.609, 0.707, 0.789, 0.855, 0.907, 0.945, 0.974, 0.994, 1.007, 1.014, 1.018, 1.019, 1.019, 1.017, 1.015, 1.012, 1);
  --p-spring-parcel: linear(0, 0.048, 0.162, 0.306, 0.452, 0.594, 0.719, 0.818, 0.899, 0.958, 0.998, 1.024, 1.038, 1.044, 1.044, 1.04, 1.034, 1.027, 1.021, 1.015, 1);
  --p-spring-send: linear(0, 0.027, 0.093, 0.176, 0.273, 0.371, 0.461, 0.549, 0.628, 0.695, 0.755, 0.806, 0.847, 0.882, 0.911, 0.933, 0.951, 0.965, 0.976, 0.984, 1);
  /* k 1000, c 46, zeta 0.73, settles 239 ms, 3.6 % overshoot: chip morph, switch knob, toast */
  --p-spring-240: linear(0, 0.007 1.549%, 0.027 3.224%, 0.06 5.025%, 0.109 7.035%, 0.215 10.595%, 0.46 17.923%, 0.565 21.231%, 0.665 24.665%, 0.747 27.931%, 0.816 31.072%, 0.873 34.213%, 0.92 37.437%, 0.959 40.787%, 0.99 44.472%, 1.013 48.451%, 1.027 52.764%, 1.035 57.663%, 1.033 66.122%, 1);
}
