/* =====================================================================
   Spark Interact theme for Twenty CRM. 2026 brand (design system: openproject-trial/docs/brand/DESIGN.md).
   Added to every page by the spark-proxy (spark-proxy/nginx.conf).

   How it works: Twenty draws everything from --t-* CSS variables declared inside `@layer twenty-ui`
   on <html class="light|dark">. Unlayered rules always beat layered ones, so redefining the variables
   on .light / .dark below reskins the whole app without touching Twenty's code.
   Twenty's class names are build hashes, so only variables, element selectors and the few stable ids
   (#top-bar-title, #dialog-container, #dropdown-content) are used. Re-check after every Twenty upgrade.

   Defaults from the brand's open questions: Spark orange stays out of the app (it clashes with the
   orange used for priority/status); burgundy is for brand surfaces only, never data.
   ===================================================================== */

/* ---------- Fonts (self-hosted) ----------
   Headings: Sets Grotesk (licensed web fonts still to come) with Inter Tight as the stand-in.
   When the Sets Grotesk .woff2 files arrive: add an @font-face "Sets Grotesk"; --spark-font-head lists it first. */
@font-face { font-family: "Spark Display"; font-weight: 300 600; font-style: normal; font-display: swap; src: url("/spark-theme/fonts/inter-tight-variable.woff2") format("woff2"); }
@font-face { font-family: "Fragment Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/spark-theme/fonts/fragment-mono-400.woff2") format("woff2"); }

/* ---------- Brand tokens ---------- */
:root {
  --spark-night: #000524;
  --spark-lavender: #B391FF;
  --spark-lavender-deep: #5C3DD6;   /* accent text/icons/focus on light: 6.8:1 on white */
  --spark-ocean: #016CAE;           /* links on light: 5.6:1 on white */
  --spark-ink: #16171A;
  --spark-bone: #F2F2EF;
  --spark-bone-2: #E8E7E2;
  --spark-white: #F5F6F8;
  --spark-font-head: "Sets Grotesk", "Spark Display", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --spark-font-mono: "Fragment Mono", ui-monospace, Menlo, monospace;
  /* Motion (Emil Kowalski review): strong curves, short durations */
  --spark-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --spark-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --spark-dur-press: 160ms;
  --spark-dur-quick: 120ms;
  --spark-dur-panel: 200ms;
}

/* ---------- Light ----------
   Bone app frame with white tables and cards; Ink text; Lavender for selection and highlights;
   Ocean for links and accent buttons (white text on Ocean 5.6:1); Night for inverted surfaces. */
.light {
  /* surfaces */
  --t-background-primary: #FFFFFF;
  --t-background-secondary: var(--spark-bone);
  --t-background-tertiary: var(--spark-bone-2);
  --t-background-quaternary: #DEDCD6;
  --t-background-noisy: var(--spark-bone);
  --t-background-inverted-primary: var(--spark-night);
  --t-background-inverted-secondary: #1C2142;
  --t-background-primary-inverted: var(--spark-night);
  --t-background-primary-inverted-hover: #1C2142;
  --t-background-transparent-blue: rgba(179, 145, 255, 0.16);

  /* text */
  --t-font-color-primary: var(--spark-ink);
  --t-font-color-secondary: #4D4F57;
  --t-font-color-tertiary: #7A7C84;
  --t-font-color-light: #A2A3A9;
  --t-font-color-extra-light: #C8C8CC;
  --t-font-color-on-accent: #FFFFFF;

  /* lines: 1 px hairlines, Ink at low opacity so they sit on Bone and white alike */
  --t-border-color-strong: rgba(22, 23, 26, 0.16);
  --t-border-color-medium: rgba(22, 23, 26, 0.10);
  --t-border-color-light: rgba(22, 23, 26, 0.06);
  --t-border-color-inverted: var(--spark-night);
  --t-border-color-blue: var(--spark-lavender);

  /* accent scale (selection, highlights, focus): Lavender tints → deep lavender → Night */
  --t-accent-accent1: #FCFBFF;
  --t-accent-accent2: #F7F3FF;
  --t-accent-accent3: #EFE7FF;
  --t-accent-accent4: #E6DAFF;
  --t-accent-accent5: #DCCBFF;
  --t-accent-accent6: #CFB9FF;
  --t-accent-accent7: #C2A6FF;
  --t-accent-accent8: var(--spark-lavender);
  --t-accent-accent9: var(--spark-lavender-deep);
  --t-accent-accent10: #4A2DBA;
  --t-accent-accent11: #4A2DBA;
  --t-accent-accent12: var(--spark-night);
  --t-accent-accent3570: var(--spark-lavender);
  --t-accent-accent4060: var(--spark-lavender);
  --t-accent-primary: #DCCBFF;
  --t-accent-secondary: #DCCBFF;
  --t-accent-tertiary: #EFE7FF;
  --t-accent-quaternary: #F7F3FF;

  /* "blue" = links, accent buttons, info: Ocean */
  --t-color-blue: var(--spark-ocean);
  --t-color-blue9: var(--spark-ocean);
  --t-color-blue10: #01588E;
  --t-color-blue11: #01588E;
  --t-color-blue12: #014670;

  /* tooltips on Night */
  --t-tooltip-background: rgba(0, 5, 36, 0.92);
}

/* ---------- Dark ----------
   Night surfaces, white text, Lavender accents (Lavender on Night 8:1), a lifted Ocean for links. */
.dark {
  --t-background-primary: #080C2C;
  --t-background-secondary: var(--spark-night);
  --t-background-tertiary: #151A3A;
  --t-background-quaternary: #1E2447;
  --t-background-noisy: var(--spark-night);
  --t-background-inverted-primary: var(--spark-white);
  --t-background-primary-inverted: var(--spark-white);
  --t-background-transparent-blue: rgba(179, 145, 255, 0.18);

  --t-font-color-primary: var(--spark-white);
  --t-font-color-secondary: #B9BBC6;
  --t-font-color-tertiary: #8B8EA0;
  --t-font-color-light: #676B80;
  --t-font-color-extra-light: #4C5068;

  --t-border-color-strong: rgba(245, 246, 248, 0.16);
  --t-border-color-medium: rgba(245, 246, 248, 0.10);
  --t-border-color-light: rgba(245, 246, 248, 0.06);
  --t-border-color-blue: var(--spark-lavender);

  --t-accent-accent1: #0C0F2F;
  --t-accent-accent2: #13163A;
  --t-accent-accent3: #1D1C4C;
  --t-accent-accent4: #26225E;
  --t-accent-accent5: #302970;
  --t-accent-accent6: #3D3385;
  --t-accent-accent7: #5143A3;
  --t-accent-accent8: #6C58C7;
  --t-accent-accent9: var(--spark-lavender);
  --t-accent-accent10: #C4A9FF;
  --t-accent-accent11: #C4A9FF;
  --t-accent-accent12: #EFE7FF;
  --t-accent-primary: #302970;
  --t-accent-secondary: #302970;
  --t-accent-tertiary: #1D1C4C;
  --t-accent-quaternary: #13163A;

  --t-color-blue: #4FA9E6;          /* lifted Ocean: 6.9:1 on Night */
  --t-color-blue9: #4FA9E6;
  --t-color-blue10: #73BBEC;
  --t-color-blue11: #73BBEC;
  --t-color-blue12: #9CCFF2;

  --t-tooltip-background: rgba(245, 246, 248, 0.94);
  --t-tooltip-color: var(--spark-night);
}

/* ---------- Shape: 4 px controls, 10 px panels (no large "bubble" UI) ---------- */
.light, .dark {
  --t-border-radius-sm: 4px;
  --t-border-radius-md: 4px;
  --t-border-radius-sm-round: 4px;
  --t-border-radius-md-round: 4px;
  --t-border-radius-lg: 10px;
  --t-border-radius-lg-round: 10px;
  --t-border-radius-xl: 10px;
  /* motion: hover colour 120 ms, panels 200 ms (never over 300 ms) */
  --t-animation-duration-fast: 0.12;
  --t-animation-duration-normal: 0.2;
}
@supports (corner-shape: squircle) {
  .light, .dark {
    --t-border-radius-xs: 2px;
    --t-border-radius-sm: 4px;
    --t-border-radius-md: 4px;
    --t-border-radius-lg: 10px;
    --t-border-radius-xl: 10px;
  }
}

/* ---------- Type ----------
   Page titles in the display face (light grotesk, slight negative tracking). */
#top-bar-title,
#top-bar-title * {
  font-family: var(--spark-font-head);
  letter-spacing: -0.01em;
}
.light #top-bar-title { color: var(--spark-ink); }
/* Record-table column headings: Fragment Mono capitals (.header-cell and .record-table-cell-content are
   Twenty's own stable class names, not build hashes) */
.header-cell .record-table-cell-content {
  font-family: var(--spark-font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- Details ---------- */
::selection { background: rgba(179, 145, 255, 0.35); color: inherit; }
.light :focus-visible { outline-color: var(--spark-lavender-deep); }
.dark :focus-visible { outline-color: var(--spark-lavender); }

/* Press feedback on buttons (mouse and touch), colour-only when reduced motion is on */
button { transition-property: background-color, border-color, color, transform; transition-timing-function: var(--spark-ease-out); }
button:active:not(:disabled) { transform: scale(0.97); transition-duration: var(--spark-dur-press); }
@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled) { transform: none; }
}

/* Thin scrollbars that match the palette */
.light * { scrollbar-color: rgba(22, 23, 26, 0.22) transparent; }
.dark * { scrollbar-color: rgba(245, 246, 248, 0.22) transparent; }

/* Record page title (opportunity, lead, person, company…): wrap long names instead of cutting them off. */
h3[font-size="lg"],
h3[font-size="lg"] * {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  height: auto !important;
  max-height: none !important;
  overflow-wrap: anywhere;
}
h3[font-size="lg"] { line-height: 1.3 !important; }

/* Thin, quiet scrollbars everywhere (Chrome 121+, Edge, Firefox use the standard properties). */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--t-font-color-light, #A2A3A9) 70%, transparent) transparent;
}
*:hover { scrollbar-color: var(--t-font-color-tertiary, #7A7C84) transparent; }
