/*
 * Instrument Sans — the canonical typeface, foundations.md §5. Both source
 * projects declare it identically, so there was no Cadence choice to make,
 * only a value to carry over.
 *
 * Variable font: one file covers 400-700, the full range the scale uses.
 * Vendored rather than pulled from a CDN because Electron has no network
 * guarantee. SIL OFL 1.1 — see ./fonts/LICENSE-OFL.txt, declared to the
 * installer's notices by tools/gen-third-party-notices.mjs.
 *
 * NOT related to apps/docs/src/renderer/fonts/, which vendors Caladea,
 * Carlito and Liberation as metric-compatible substitutes for Cambria,
 * Calibri, Times and Arial. Those render document content, which
 * foundations.md §1 puts outside this system entirely. Do not merge the two.
 */
@font-face {
  font-family: 'Instrument Sans';
  src: url('./fonts/InstrumentSans-Variable-latin.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  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;
}

/* latin-ext is a supplement, not a superset: it carries only the extended
 * characters. Both faces are needed for the accented glyphs the ~20 languages
 * packages/i18n serves rely on. */
@font-face {
  font-family: 'Instrument Sans';
  src: url('./fonts/InstrumentSans-Variable-latin-ext.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  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;
}

/*
 * Cadence design system tokens — the primitive/semantic split required by
 * docs/design-system/foundations.md §3 (cadence-platform, branch
 * docs/cadence-design-system).
 *
 * Two layers, and the split is the point:
 *   --primitive-*  raw values. NOTHING outside this file consumes these.
 *   --color-*      semantic aliases with a role. The ONLY tokens components
 *                  may reference.
 *
 * A rebrand or a dark theme rewrites the primitive layer and touches no
 * component. That is what the indirection buys; consuming a primitive
 * directly spends it for nothing.
 *
 * This file is the one place in the repo allowed to hold raw color literals.
 * packages/ui/tests/shell-no-raw-hex.test.ts enforces that for the shell.
 *
 * Mirrored by tokens.ts for JS consumers (Konva takes color strings and cannot
 * read custom properties). packages/ui/tests/tokens.test.ts fails if the two
 * drift.
 */

:root {
  /* ---------------------------------------------------------------- *
   * Primitive layer — foundations.md §4                              *
   * ---------------------------------------------------------------- */
  --primitive-near-black: #232425;
  --primitive-grey-lighter: #f5f5f5;
  --primitive-grey-darker: #efefef;
  --primitive-mid-grey: #909499;
  --primitive-blue-base: #1b58cf;
  --primitive-blue-bright: #0f7fff;
  --primitive-red: #d13438;
  --primitive-amber: #f5a623;

  /* Beyond the canonical eight. Each earns its place in the sweep:
   * white is the base surface foundations.md §4 names but does not source;
   * grey-secondary is the third text tier home.css and onboarding.css both
   * independently arrived at; the two tints back existing error and primary
   * fills that have no canonical equivalent. Recorded as deviations in
   * DESIGN.md by Task 9. */
  --primitive-white: #ffffff;
  --primitive-grey-secondary: #606366;
  --primitive-red-weak: #fdf3f3;
  --primitive-blue-weak: #eaf0fd;

  /* ---------------------------------------------------------------- *
   * Semantic layer — foundations.md §4. Components consume ONLY these. *
   * ---------------------------------------------------------------- */
  --color-text-strong-950: var(--primitive-near-black);
  --color-text-secondary-700: var(--primitive-grey-secondary);
  --color-text-sub-600: var(--primitive-mid-grey);
  --color-bg-white-0: var(--primitive-white);
  --color-bg-weak-50: var(--primitive-grey-lighter);
  /* A second, slightly stronger weak background. foundations.md §4 names only
   * one, which is not enough for nested interactive surfaces: the shell hovers
   * a project row to bg-weak-50 and hovers the action button INSIDE that row,
   * so both landing on one value would erase the button's hover exactly when
   * it is most likely to be used. Aliases an existing primitive -- this adds a
   * role, not a colour. Recorded as a deviation in DESIGN.md. */
  --color-bg-weak-100: var(--primitive-grey-darker);
  --color-stroke-soft-200: var(--primitive-grey-darker);
  /* A stroke that has to be SEEN, where stroke-soft would vanish: a card's
   * hover border against its resting stroke-soft border. Same value as
   * text-sub-600, deliberately a separate name -- aliasing a border to a TEXT
   * token is the exact mistake onboarding.css avoids when it keeps
   * --onb-border-strong file-local. Aliases an existing primitive; a role, not
   * a colour. Recorded as a deviation in DESIGN.md. */
  --color-stroke-strong-300: var(--primitive-mid-grey);
  --color-primary-base: var(--primitive-blue-base);
  --color-primary-hover: var(--primitive-blue-bright);
  --color-primary-weak: var(--primitive-blue-weak);
  --color-state-error-base: var(--primitive-red);
  --color-state-error-weak: var(--primitive-red-weak);
  --color-state-warning-base: var(--primitive-amber);

  /* ---------------------------------------------------------------- *
   * Spacing — foundations.md §6. n x 0.25rem, inherited from Tailwind *
   * v4's default; neither source project overrides it.                *
   * ---------------------------------------------------------------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ---------------------------------------------------------------- *
   * Radius — foundations.md §6, eight steps.                          *
   * Controls at medium and above use --radius-8: source disagreed     *
   * (Select-medium 10, Textarea 12, Button-medium 8) and Cadence      *
   * resolves it in Button's favour.                                   *
   * ---------------------------------------------------------------- */
  --radius-4: 4px;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-10: 10px;
  --radius-12: 12px;
  --radius-16: 16px;
  --radius-20: 20px;
  --radius-full: 999px;

  /* ---------------------------------------------------------------- *
   * Shadow — foundations.md §6, three steps, inherited unchanged.     *
   * ---------------------------------------------------------------- */
  --shadow-x-small: 0 1px 2px 0 #0a0d1408;
  --shadow-small: 0 2px 4px 0 #1b1c1d0a;
  --shadow-medium: 0 16px 32px -12px #0e121b1a;

  /* Instrument Sans has no CJK coverage. PingFang SC and Microsoft YaHei are
   * retained as fallbacks — dropping them would regress the ~20 languages
   * packages/i18n serves. --font-inter is deliberately not defined:
   * foundations.md §5 records it as declared-but-unused in both source
   * projects, so adding it here would import a token with no role. */
  --font-sans: 'Instrument Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ------------------------------------------------------------------ *
 * Type scale — foundations.md §5.
 *
 * Shipped as classes, not as bare size variables, because §5's actual
 * requirement is that a call site cannot drift a size from its
 * line-height. A --type-label-small variable would let any call site
 * pair it with any line-height it liked; a class cannot.
 *
 * Weight is deliberately absent: §5 lists 400/500/600/700 as weights
 * used ACROSS the scale, not bound per token, so weight stays a
 * separate declaration at the call site.
 * ------------------------------------------------------------------ */

.type-h4-title {
  font-size: 2rem;
  line-height: 1.2;
}

.type-h5-title {
  font-size: 1.5rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.type-h6-title {
  font-size: 1.25rem;
  line-height: 2rem;
  letter-spacing: 0.01em;
}

/* Cadence's addition. Amana's large Button applies text-label-medium but
 * its tailwind.css defines no such token, so large labels silently fall
 * back to the browser default. Defined here rather than inherited broken. */
.type-label-medium {
  font-size: 1rem;
  line-height: 1.5rem;
}

.type-label-small {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.type-label-x-small {
  font-size: 0.75rem;
  line-height: 1.25rem;
}

.type-label-2x-small {
  font-size: 0.625rem;
  line-height: 1.6;
}

.type-label-compact {
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

.type-paragraph-small {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.type-paragraph-x-small {
  font-size: 0.75rem;
  line-height: 1.25rem;
}

.type-paragraph-compact {
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

.type-subheading-x-small {
  font-size: 0.75rem;
  line-height: 1rem;
}

.type-subheading-2x-small {
  font-size: 0.6875rem;
  line-height: 0.75rem;
}
