/* Opt in with data-brand="nova". Load after core-ui.css. */
@font-face {
  font-family: "Nova Rajdhani";
  src: url("/__nova/assets/19b50394b6b690803981e80889005311cdc65ac82fd54383e69d626042a178bf/assets/nova/core-ui/brands/fonts/rajdhani/Rajdhani-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Nova Rajdhani";
  src: url("/__nova/assets/19b50394b6b690803981e80889005311cdc65ac82fd54383e69d626042a178bf/assets/nova/core-ui/brands/fonts/rajdhani/Rajdhani-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@layer tokens {
  [data-brand="nova"] {
    color-scheme: light;
    --nova-font-body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --nova-font-display: "Nova Rajdhani", "Arial Narrow", sans-serif;
    --nova-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --nova-radius: 0;
    --nova-space-unit: 0.25rem;
    --nova-space-1: 0.25rem;
    --nova-space-2: 0.5rem;
    --nova-space-3: 0.75rem;
    --nova-space-4: 1rem;
    --nova-space-5: 1.25rem;
    --nova-space-6: 1.5rem;
    --nova-space-8: 2rem;
    --nova-space-10: 2.5rem;
    --nova-space-12: 3rem;
    --nova-space-16: 4rem;
    --nova-page-gutter: clamp(1rem, 3vw, 2rem);
    --nova-panel-padding: clamp(1rem, 2vw, 1.5rem);
    --nova-section-gap: clamp(1.5rem, 3vw, 2rem);
    --nova-control-gap: var(--nova-space-3);
    --nova-content-width: 76rem;
    --nova-reading-width: 65ch;
    --nova-highlight: var(--muted-foreground);
    --nova-link: var(--primary);
    --nova-status-positive: var(--success-foreground);
    --nova-rail: var(--surface-raised);
    --nova-ambient: transparent;
    --surface: var(--surface-default);
    --card: var(--surface-default);
    --card-foreground: var(--foreground);
    --emphasis: var(--text-emphasis);
    --selection-strong: var(--nova-line);
    --accent-secondary: var(--nova-action-secondary);
    --accent-secondary-foreground: var(--nova-action-secondary-foreground);
    --success: var(--success-foreground);
    --status-success: var(--success-soft);
    --status-success-foreground: var(--success-foreground);
    --disabled-background: var(--surface-raised);
    --disabled-foreground: var(--muted-foreground);
    --disabled-border: var(--border-muted);
    --gradient: none;
    --surface-subtle: #F2F3F3;
    --surface-default: #FFFFFF;
    --surface-raised: #E5E8E8;
    /* Skeleton placeholders fill with the raised surface; dark themes redefine it, so this follows. */
    --core-skeleton-fill: var(--surface-raised);
    --popover: #FFFFFF;
    --input: #FFFFFF;
    --foreground: #242A2D;
    --text-emphasis: #151A1C;
    --muted-foreground: #535F64;
    --border: #78858B;
    --border-muted: #C8CFD2;
    --border-strong: #59676D;
    --nova-line: #6B4DA0;
    --primary: #00666B;
    --primary-foreground: #FFFFFF;
    --primary-hover: #005458;
    --primary-active: #004449;
    --nova-action-secondary: #EEE9F5;
    --nova-action-secondary-foreground: #5B3C82;
    --nova-action-secondary-border: #80669E;
    --nova-action-secondary-hover: #E4DCEF;
    --nova-action-secondary-active: #D8CDE6;
    --selection-soft: #DCEEEF;
    --destructive: #B1362B;
    --destructive-foreground: #FFFFFF;
    --destructive-hover: #96291F;
    --destructive-active: #7B2119;
    --success-foreground: #256340;
    --success-soft: #E8F3EC;
    --success-border: #427C58;
    --info-foreground: #245E86;
    --info-soft: #EAF2F9;
    --info-border: #4C7DA0;
    --warning-foreground: #80520C;
    --warning-soft: #FBF1D9;
    --warning-border: #9D6A19;
    --error-foreground: #A22F25;
    --error-soft: #FBECE8;
    --error-border: #B94D3F;
  }

  [data-brand="nova"][data-theme="dark"] {
    color-scheme: dark;
    --surface-subtle: #111416;
    --surface-default: #1A1F22;
    --surface-raised: #252C30;
    --popover: #252C30;
    --input: #111416;
    --foreground: #E4E9EB;
    --text-emphasis: #F5F7F8;
    --muted-foreground: #B3BEC3;
    --border: #85949C;
    --border-muted: #3B474D;
    --border-strong: #ADBBC2;
    --nova-line: #C9ADEB;
    --primary: #83D7D7;
    --primary-foreground: #092D30;
    --primary-hover: #A0E4E3;
    --primary-active: #B9EDEB;
    --nova-action-secondary: #2D2638;
    --nova-action-secondary-foreground: #D7C3F0;
    --nova-action-secondary-border: #9985B0;
    --nova-action-secondary-hover: #3A3048;
    --nova-action-secondary-active: #493B5A;
    --selection-soft: #193C40;
    --destructive: #F3A290;
    --destructive-foreground: #34120B;
    --destructive-hover: #FFB7A7;
    --destructive-active: #FFD0C5;
    --success-foreground: #A6D9B8;
    --success-soft: #20372B;
    --success-border: #79B48E;
    --info-foreground: #A7CEEB;
    --info-soft: #1E303E;
    --info-border: #7DAACC;
    --warning-foreground: #E8C078;
    --warning-soft: #362D1D;
    --warning-border: #C79E56;
    --error-foreground: #FFB5A6;
    --error-soft: #3A2522;
    --error-border: #D98676;
  }

  @media (prefers-color-scheme: dark) {
    [data-brand="nova"]:not([data-theme]),
    [data-brand="nova"][data-theme="system"] {
      color-scheme: dark;
      --surface-subtle: #111416;
      --surface-default: #1A1F22;
      --surface-raised: #252C30;
      --popover: #252C30;
      --input: #111416;
      --foreground: #E4E9EB;
      --text-emphasis: #F5F7F8;
      --muted-foreground: #B3BEC3;
      --border: #85949C;
      --border-muted: #3B474D;
      --border-strong: #ADBBC2;
      --nova-line: #C9ADEB;
      --primary: #83D7D7;
      --primary-foreground: #092D30;
      --primary-hover: #A0E4E3;
      --primary-active: #B9EDEB;
      --nova-action-secondary: #2D2638;
      --nova-action-secondary-foreground: #D7C3F0;
      --nova-action-secondary-border: #9985B0;
      --nova-action-secondary-hover: #3A3048;
      --nova-action-secondary-active: #493B5A;
      --selection-soft: #193C40;
      --destructive: #F3A290;
      --destructive-foreground: #34120B;
      --destructive-hover: #FFB7A7;
      --destructive-active: #FFD0C5;
      --success-foreground: #A6D9B8;
      --success-soft: #20372B;
      --success-border: #79B48E;
      --info-foreground: #A7CEEB;
      --info-soft: #1E303E;
      --info-border: #7DAACC;
      --warning-foreground: #E8C078;
      --warning-soft: #362D1D;
      --warning-border: #C79E56;
      --error-foreground: #FFB5A6;
      --error-soft: #3A2522;
      --error-border: #D98676;
    }
  }
}

/* Component heading typography stays outside layers so downstream editorial
   element rules cannot turn a card title into a page heading. */
[data-brand="nova"] .core-card-header :is(h2, h3, h4, h5, h6) {
  margin: 0;
  font-family: var(--nova-font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: normal;
  overflow-wrap: anywhere;
}

@layer overrides {
  /* Card composition owns its insets; consumers supply content, not extra panel padding. */
  [data-brand="nova"] .core-card {
    min-inline-size: 0;
    border: 1px solid var(--border-muted);
    border-radius: var(--nova-space-3);
    background: var(--surface-default);
    color: var(--foreground);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--foreground) 4%, transparent);
  }
  [data-brand="nova"] :is(.core-card-header, .core-card-content, .core-card-footer) {
    min-inline-size: 0;
    padding: var(--nova-panel-padding);
  }
  [data-brand="nova"] .core-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--nova-control-gap);
  }
  [data-brand="nova"] .core-card-header > * { min-inline-size: 0; margin: 0; }
  [data-brand="nova"] .core-card-header + .core-card-content { padding-block-start: 0; }
  [data-brand="nova"] .core-card-content { display: grid; gap: var(--nova-space-4); }
  [data-brand="nova"] .core-card-content > * { min-inline-size: 0; margin-block: 0; }
  [data-brand="nova"] .core-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--nova-control-gap);
    padding-block: var(--nova-space-3);
    border-block-start: 1px solid var(--border-muted);
  }

  [data-brand="nova"] :focus-visible {
    outline: 3px solid var(--selection-strong);
    outline-offset: 4px;
  }

  [data-brand="nova"] ::selection {
    color: var(--foreground);
    background: var(--selection-soft);
  }

  /* Actual controls use control borders; layout dividers remain quiet. */
  [data-brand="nova"] :is(input, textarea, select) {
    border-color: var(--border);
    background-color: var(--input);
    color: var(--foreground);
    box-shadow: none;
    accent-color: var(--primary);
  }
  [data-brand="nova"] :is(input, textarea)::placeholder { color: var(--muted-foreground); opacity: 1; }
  [data-brand="nova"] :is(input, textarea, select)[aria-invalid="true"] { border-color: var(--error-border); }
  [data-brand="nova"] :is(button, [data-link-button="root"]) { box-shadow: none; }
  /* Theme changes must apply paired foreground/background colors together. */
  [data-brand="nova"] :is(button, [data-link-button="root"], [data-sidebar="menu-button"], [data-sidebar="menu-sub-button"]) {
    transition-property: box-shadow, transform;
  }
  [data-brand="nova"] :is(button, a)[class~="hover:bg-selection-soft"] {
    color: var(--foreground);
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
  }
  [data-brand="nova"] :is(button, a)[class~="hover:bg-selection-soft"]:where(:not(:disabled, [aria-disabled="true"])):hover,
  [data-brand="nova"] :is(button, a)[class~="hover:bg-surface-subtle"]:where(:not(:disabled, [aria-disabled="true"])):hover {
    color: var(--foreground);
    background-color: var(--surface-raised);
  }
  [data-brand="nova"] :is(button, a)[class~="hover:bg-selection-soft"]:where(:not(:disabled, [aria-disabled="true"])):active,
  [data-brand="nova"] :is(button, a)[class~="hover:bg-surface-subtle"]:where(:not(:disabled, [aria-disabled="true"])):active {
    background-color: var(--nova-rail);
  }
  [data-brand="nova"] :is(button, a).border-border-muted { border-color: var(--border-strong); }

  /* Toggle selection takes precedence over the shared ghost interaction. */
  [data-brand="nova"] button[class~="data-[state=on]:bg-primary"][data-state="on"]:where(:not(:disabled, [aria-disabled="true"])) {
    color: var(--primary-foreground);
    background-color: var(--primary);
    border-color: var(--primary);
  }
  [data-brand="nova"] button[class~="data-[state=on]:bg-primary"][data-state="on"]:where(:not(:disabled, [aria-disabled="true"])):hover { background-color: var(--primary-hover); }
  [data-brand="nova"] button[class~="data-[state=on]:bg-primary"][data-state="on"]:where(:not(:disabled, [aria-disabled="true"])):active { background-color: var(--primary-active); }

  [data-brand="nova"] :is(button, a).text-primary { color: var(--nova-link); }
  [data-brand="nova"] :is(button, a).text-primary:where(:not(:disabled, [aria-disabled="true"])):hover { text-decoration: underline; text-underline-offset: 0.2em; }
  [data-brand="nova"] :is(button, a).bg-gradient { background-image: none; opacity: 1; }

  /* Native core-nx button/link variants share the same action ledger. */
  [data-brand="nova"] :is(button, a):is(.bg-primary, .bg-gradient, .bg-accent-secondary, .bg-destructive) { box-shadow: none; filter: none; }
  [data-brand="nova"] :is(button, a):is(.bg-primary, .bg-gradient) { background-color: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
  [data-brand="nova"] :is(button, a):is(.bg-primary, .bg-gradient):where(:not(:disabled, [aria-disabled="true"])):hover { background-color: var(--primary-hover); }
  [data-brand="nova"] :is(button, a):is(.bg-primary, .bg-gradient):where(:not(:disabled, [aria-disabled="true"])):active { background-color: var(--primary-active); }
  [data-brand="nova"] :is(button, a).bg-accent-secondary { background-color: var(--nova-action-secondary); color: var(--nova-action-secondary-foreground); border: 1px solid var(--nova-action-secondary-border); }
  [data-brand="nova"] :is(button, a).bg-accent-secondary:where(:not(:disabled, [aria-disabled="true"])):hover { background-color: var(--nova-action-secondary-hover); }
  [data-brand="nova"] :is(button, a).bg-accent-secondary:where(:not(:disabled, [aria-disabled="true"])):active { background-color: var(--nova-action-secondary-active); }
  [data-brand="nova"] :is(button, a).bg-destructive { background-color: var(--destructive); color: var(--destructive-foreground); border-color: var(--destructive); }
  [data-brand="nova"] :is(button, a).bg-destructive:where(:not(:disabled, [aria-disabled="true"])):hover { background-color: var(--destructive-hover); }
  [data-brand="nova"] :is(button, a).bg-destructive:where(:not(:disabled, [aria-disabled="true"])):active { background-color: var(--destructive-active); }

  [data-brand="nova"] .bg-muted { background-color: var(--surface-raised); }
  [data-brand="nova"] .border-status-success { border-color: var(--success-border); }
  [data-brand="nova"] .bg-status-success { background-color: var(--success-soft); }
  [data-brand="nova"] .text-status-success-foreground { color: var(--success-foreground); }
  [data-brand="nova"] .border-status-destructive { border-color: var(--error-border); }
  [data-brand="nova"] .bg-status-destructive { background-color: var(--error-soft); }
  [data-brand="nova"] .text-status-destructive-foreground { color: var(--error-foreground); }
  [data-brand="nova"] .border-warning-border { border-color: var(--warning-border); }
  [data-brand="nova"] .bg-muted-foreground { background-color: var(--muted-foreground); }
  [data-brand="nova"] [class~="bg-[var(--warning-border)]"] { background-color: var(--warning-border); }
  [data-brand="nova"] [class~="text-[var(--warning-border)]"] { color: var(--warning-foreground); }
  [data-brand="nova"] [class~="border-[var(--success)]"] { border-color: var(--success-border); }
  [data-brand="nova"] [class~="text-[var(--success)]"] { color: var(--success-foreground); }
  [data-brand="nova"] :is([class~="bg-[color-mix(in_srgb,var(--success)_10%,white)]"], [class~="bg-[color-mix(in_srgb,var(--success)_12%,white)]"], [class~="bg-[color-mix(in_srgb,var(--success)_16%,white)]"]) { background-color: var(--success-soft); }
  [data-brand="nova"] [class~="bg-[var(--success)]"] { background-color: var(--success-foreground); }
  [data-brand="nova"] .text-destructive { color: var(--error-foreground); }
  [data-brand="nova"] .border-destructive { border-color: var(--error-border); }
  [data-brand="nova"] :is([class~="bg-[color-mix(in_srgb,var(--destructive)_9%,white)]"], [class~="bg-[color-mix(in_srgb,var(--destructive)_12%,white)]"]) { background-color: var(--error-soft); }
  [data-brand="nova"] [role="alert"].text-destructive { color: var(--error-foreground); background-color: var(--error-soft); border-color: var(--error-border); }

  /* Language is also named in the editor; hue is supplementary. */
  [data-brand="nova"] [data-ui-controller="code-editor"] { --code-editor-accent: var(--muted-foreground); }
  [data-brand="nova"] [data-ui-controller="code-editor"][data-code-editor-language="html"] { --code-editor-accent: var(--error-foreground); }
  [data-brand="nova"] [data-ui-controller="code-editor"][data-code-editor-language="javascript"] { --code-editor-accent: var(--warning-foreground); }
  [data-brand="nova"] [data-ui-controller="code-editor"][data-code-editor-language="typescript"] { --code-editor-accent: var(--info-foreground); }
  [data-brand="nova"] [data-ui-controller="code-editor"][data-code-editor-language="json"] { --code-editor-accent: var(--primary); }
  [data-brand="nova"] [data-ui-controller="code-editor"][data-code-editor-language="bash"] { --code-editor-accent: var(--success-foreground); }

  /* A busy button (spinner showing) is waiting, not unavailable: it keeps its colours. */
  [data-brand="nova"] :is(button, input, textarea, select):disabled:not([data-loading="true"], .core-button-pending),
  [data-brand="nova"] :is(button, a)[aria-disabled="true"]:not([data-loading="true"], .core-button-pending) {
    color: var(--disabled-foreground);
    background-color: var(--disabled-background);
    border-color: var(--disabled-border);
    opacity: 1;
    filter: none;
    box-shadow: none;
  }

  @media (prefers-reduced-motion: reduce) {
    [data-brand="nova"], [data-brand="nova"] *, [data-brand="nova"] *::before, [data-brand="nova"] *::after {
      scroll-behavior: auto !important;
      animation: none !important;
      transition: none !important;
    }
  }

  @media (forced-colors: active) {
    /* This layer outranks explicit dark and system token selectors. */
    [data-brand="nova"] {
      --surface-default: Canvas; --surface-subtle: Canvas; --surface-raised: Canvas; --popover: Canvas; --input: Canvas;
      --foreground: CanvasText; --text-emphasis: CanvasText; --muted-foreground: CanvasText;
      --border: ButtonText; --border-muted: CanvasText; --border-strong: ButtonText;
      --nova-line: CanvasText; --nova-link: LinkText; --selection-strong: Highlight; --selection-soft: Canvas;
      --primary: ButtonFace; --primary-foreground: ButtonText; --primary-hover: ButtonFace; --primary-active: ButtonFace;
      --nova-action-secondary: ButtonFace; --nova-action-secondary-foreground: ButtonText; --nova-action-secondary-border: ButtonText;
      --nova-action-secondary-hover: ButtonFace; --nova-action-secondary-active: ButtonFace;
      --destructive: ButtonFace; --destructive-foreground: ButtonText; --destructive-hover: ButtonFace; --destructive-active: ButtonFace;
      --success-foreground: CanvasText; --success-soft: Canvas; --success-border: CanvasText;
      --info-foreground: CanvasText; --info-soft: Canvas; --info-border: CanvasText;
      --warning-foreground: CanvasText; --warning-soft: Canvas; --warning-border: CanvasText;
      --error-foreground: CanvasText; --error-soft: Canvas; --error-border: CanvasText;
      --disabled-background: ButtonFace; --disabled-foreground: GrayText; --disabled-border: GrayText;
    }
    [data-brand="nova"] ::selection { color: HighlightText; background: Highlight; }
  }
}
