/* Education workspace color tokens (VETI-3690 groundwork, extended 2026-08-18 for the course
   workspace visual reskin — see docs/superpowers/specs/2026-08-18-course-workspace-visual-reskin-design.md).
   Ported verbatim from the Claude Design system's tokens/colors.css + tokens/spacing.css.

   Scoped under .education-workspace and --tl- prefixed to match the existing scoped dark-palette
   convention (see ProjectList.razor's .projects-dashboard --tl-* block). The palette values below
   intentionally duplicate that block value-for-value for now — extracting a single shared token
   source both pages consume means also refactoring ProjectList.razor, which is a live shipped page
   outside this story's scope. Tracked as a follow-up, not done here.

   Now wired into a component: CourseWorkspace.razor applies this class (plus theme-dark when
   ThemeStateService.Mode is Dark) to a wrapper around its hero + tab bar. WorkspaceHome.razor's
   Overview cards are DOM descendants of that wrapper and inherit these custom properties without
   their own class change — CSS custom properties are inherited through the DOM tree, including
   into other components' rendered output. */
.education-workspace {
  /* Brand — same hex in both modes */
  --tl-navy: #0B1F3A;
  --tl-gold: #F4A623;
  --tl-blue: #2D6CDF;

  /* Status — same hex in both modes */
  --tl-success: #22C55E;
  --tl-warning: #F4A623;
  --tl-error:   #EF4444;
  --tl-info:    #3B82F6;
  --tl-ai:      #7C3AED;

  /* Light mode raw (NEW — copied verbatim from Claude Design tokens/colors.css "Light mode raw") */
  --tl-light-bg:          #F0F2F5;
  --tl-light-surface:     #FFFFFF;
  --tl-light-surface-alt: #F8F7F4;
  --tl-light-border:      #E2E6EB;
  --tl-light-text:        #0B1F3A;
  --tl-light-text-2:      #555555;
  --tl-light-text-muted:  #8A8A8A;

  /* Dark mode raw (UNCHANGED from the original VETI-3690 file) */
  --tl-dark-bg:          #080F1A;
  --tl-dark-surface:     #0D1B2E;
  --tl-dark-surface-alt: #152336;
  --tl-dark-border:      #1E2F45;
  --tl-dark-text:        #FFFFFF;
  --tl-dark-text-2:      #CBD5E1;
  --tl-dark-text-muted:  #64748B;

  /* Light semantic aliases (NEW — this is the default; .theme-dark below overrides these) */
  --tl-bg:            var(--tl-light-bg);
  --tl-surface:       var(--tl-light-surface);
  --tl-surface-alt:   var(--tl-light-surface-alt);
  --tl-border:        var(--tl-light-border);
  --tl-text:          var(--tl-light-text);
  --tl-text-2:        var(--tl-light-text-2);
  --tl-text-muted:    var(--tl-light-text-muted);

  --tl-primary:      var(--tl-gold);
  --tl-primary-text: var(--tl-navy);
  --tl-accent:       var(--tl-gold);
  --tl-accent-text:  var(--tl-navy);

  /* Light status surfaces (NEW — copied from Claude Design tokens/colors.css light defaults) */
  --tl-success-fg: #15803D; --tl-success-bg: #E9F7EE;
  --tl-warning-fg: #B4790F; --tl-warning-bg: #FDF3E1;
  --tl-error-fg:   #B91C1C; --tl-error-bg:   #FDECEC;
  --tl-info-fg:    #1D4ED8; --tl-info-bg:    #EAF1FE;
  --tl-ai-fg:      #6D28D9; --tl-ai-bg:      #F3EEFE;

  /* Education-specific tokens with no existing DS equivalent (confirmed with user, unchanged) */
  --tl-gold-button-text: #1a1400;
  --tl-scrim: rgba(8, 15, 26, 0.72);

  /* VETI-7553: course manage pages. Cover placeholder gradient (navy to violet) is the same in
     both modes. */
  --tl-cover-placeholder: linear-gradient(135deg, #0F3D73 0%, #6C4BF4 100%);
  /* VETI-7545 decision C-8: the Draft badge uses the Claude Design amber, not the slate it had.
     Light: #74490A on #FCEFD6 is about 6.8:1 (the plain --tl-warning-* pair is only about 2.9:1). */
  --tl-badge-draft-bg: #FCEFD6;
  --tl-badge-draft-fg: #74490A;

  /* VETI-7545: course manage design match. Values come from the Claude Design canvas
     (design-ref/Main.dc.html theme()); each one is re-pointed under .theme-dark below. */
  --tl-border-strong: #B9C2D2;      /* outline buttons, chips, dashed empty-state border */
  --tl-gold-text:     #7D5A08;      /* gold text on surface: about 6.3:1 on #FFFFFF, 5.9:1 on --tl-surface-alt */
  --tl-text-subtle:   #56637A;      /* card meta text: about 6.1:1 on #FFFFFF (--tl-text-muted is only about 3.4:1) */
  --tl-error-border:  #F0BDBF;      /* border of the load-error bar */
  --tl-error-solid:   #B3261E;      /* destructive button fill */
  --tl-on-error:      #FFFFFF;      /* text on --tl-error-solid: about 6.5:1 */
  --tl-skeleton:      #E6EAF1;      /* flat loading skeleton blocks */
  --tl-cover-1: #13264A;            /* cover placeholder gradient start */
  --tl-cover-2: #2B4C86;            /* cover placeholder gradient ends, one per card */
  --tl-cover-3: #2F6470;
  --tl-cover-4: #4E4282;
  --tl-on-cover-icon: rgba(255, 255, 255, 0.55); /* decorative video icon on the placeholder cover */
  --tl-shadow-card: 0 1px 2px rgba(15, 27, 51, 0.05), 0 6px 18px rgba(15, 27, 51, 0.05);
  --tl-shadow-dialog: 0 12px 40px rgba(9, 16, 32, 0.25);
  /* VETI-7545 UI-B: create/edit form controls (design-ref/CourseForm.dc.html theme()). */
  --tl-control:      #13264A;       /* selected radio card border, checkbox/radio accent, switch on: about 15:1 on #FFFFFF */
  --tl-switch-off:   #8892A6;       /* switch track when off: about 3.1:1 on #FFFFFF (non-text) */
  --tl-switch-knob:  #FFFFFF;       /* switch knob, both modes */
  --tl-shadow-bar:   0 -4px 16px rgba(15, 27, 51, 0.06); /* sticky Save bar */

  /* Heatmap ramp — unchanged */
  --tl-heatmap-step-1: rgba(45, 108, 223, 0.25);
  --tl-heatmap-step-2: rgba(45, 108, 223, 0.45);
  --tl-heatmap-step-3: rgba(45, 108, 223, 0.7);

  /* Radius (NEW — copied verbatim from Claude Design tokens/spacing.css, same in both modes) */
  --tl-radius-card:   12px;
  --tl-radius-button: 8px;
  --tl-radius-badge:  6px;
  --tl-radius-pill:   20px;
  /* VETI-7545: the course manage design's larger card and button radii (spec section 9, "~14px"). */
  --tl-radius-card-lg:   14px;
  --tl-radius-button-lg: 10px;

  /* Spacing — 8px grid (NEW — copied verbatim from Claude Design tokens/spacing.css, same in both modes) */
  --tl-space-1: 8px;
  --tl-space-2: 16px;
  --tl-space-3: 24px;
  --tl-space-4: 32px;
  --tl-space-5: 40px;
  --tl-space-6: 48px;

  /* Fluent UI Blazor token remap (NEW) — Fluent web components read these custom properties
     directly (confirmed via devtools by the ProjectList.razor precedent this mirrors), so
     overriding them here recolors FluentButton/FluentBadge/FluentTabs/AppCard without touching
     their markup. Accepted trade-off (same one ProjectList.razor already made): this overrides
     a tenant's configured accent color to the fixed --tl-accent for course pages specifically. */
  --accent-fill-rest: var(--tl-accent);
  --fill-color: var(--tl-surface);
  --neutral-foreground-rest: var(--tl-text);
  --neutral-foreground-hint: var(--tl-text-2);
  --neutral-stroke-rest: var(--tl-border);
  /* Fluent computes the on-accent text color in JS from the tenant's configured accent color,
     which does not re-run against the --accent-fill-rest override above -- so without this,
     a tenant with a dark configured accent would get a white computed foreground rendered on
     the forced gold background (white on #F4A623 ~2.1:1 contrast, fails WCAG AA). */
  --foreground-on-accent-rest: var(--tl-gold-button-text);

  background: var(--tl-bg);
  color: var(--tl-text);
}

/* Dark theme scope — applied by CourseWorkspace.razor alongside education-workspace when
   ThemeStateService.Mode is Dark, mirroring the Claude Design tokens/colors.css convention
   ([data-theme="dark"], .theme-dark) and Course_UI.dc.html's own root element
   (class="cu theme-dark" data-theme="dark").

   Only the semantic aliases are re-pointed here — --tl-dark-* raw values above already carry the
   actual hex, and the remap block above already resolves from --tl-bg/--tl-surface/etc via var(),
   so it does not need to be repeated in this block. */
.education-workspace.theme-dark {
  /* VETI-4070: was var(--tl-navy) (#0B1F3A) per the original VETI-3690 file's confirmed choice,
     but that's nearly indistinguishable from --tl-dark-surface (#0D1B2E), flattening the hero/
     tabs/panel into one solid block instead of Course_UI.dc.html's layered look (near-black page
     behind lighter navy cards). Course_UI.dc.html's own `.cu` root sets `--bg:var(--dark-bg)`
     (#080F1A) — matching that here restores the intended card-on-page contrast. */
  --tl-bg:            var(--tl-dark-bg);
  --tl-surface:       var(--tl-dark-surface);
  --tl-surface-alt:   var(--tl-dark-surface-alt);
  --tl-border:        var(--tl-dark-border);
  --tl-text:          var(--tl-dark-text);
  --tl-text-2:        var(--tl-dark-text-2);
  --tl-text-muted:    var(--tl-dark-text-muted);

  --tl-success-fg: #4ADE80; --tl-success-bg: #10261A;
  --tl-warning-fg: #F4A623; --tl-warning-bg: #2A2110;
  --tl-error-fg:   #F87171; --tl-error-bg:   #2A1414;
  --tl-info-fg:    #60A5FA; --tl-info-bg:    #12203A;
  --tl-ai-fg:      #A78BFA; --tl-ai-bg:      #1C1830;

  --tl-cover-placeholder: linear-gradient(135deg, #0F3D73 0%, #6C4BF4 100%);
  /* VETI-7545 decision C-8: Draft badge, dark amber. #F3C76E on #3A2A0A is about 8.7:1 */
  --tl-badge-draft-bg: #3A2A0A;
  --tl-badge-draft-fg: #F3C76E;

  /* VETI-7545: course manage design match, dark values from the same canvas. */
  --tl-border-strong: #3A4C74;
  --tl-gold-text:     #F0C861;      /* about 10.8:1 on #0D1B2E */
  --tl-text-subtle:   #9AA7BF;      /* about 7.1:1 on #0D1B2E (--tl-text-muted is only about 3.6:1) */
  --tl-error-border:  #6B2A30;
  --tl-error-solid:   #F2858B;
  --tl-on-error:      #2A0A0D;      /* about 7.4:1 on #F2858B */
  --tl-skeleton:      #1C2A47;
  --tl-cover-1: #0F1E3D;
  --tl-cover-2: #24437A;
  --tl-cover-3: #24545E;
  --tl-cover-4: #41376F;
  --tl-shadow-card: none;
  --tl-shadow-dialog: 0 12px 40px rgba(0, 0, 0, 0.5);
  /* VETI-7545 UI-B: create/edit form controls, dark. */
  --tl-control:      #7FA8FF;       /* about 7.4:1 on #0D1B2E */
  --tl-switch-off:   #6E7B96;       /* about 4.0:1 on #0D1B2E (non-text) */
  --tl-switch-knob:  #FFFFFF;
  --tl-shadow-bar:   0 -4px 16px rgba(0, 0, 0, 0.35);
}

/* VETI-7545: course manage pages (/courses/manage, /new, /{id}/edit) use the Claude Design canvas
   palette and type (https://claude.ai/artifact/DQKGjfLk93Acrkmy2yxg6M, Main.dc.html and
   CourseForm.dc.html theme()). The canvas re-values the shared neutrals, gold and status pairs, so
   they are re-pointed only under .cm-theme, which CourseManageList.razor and CourseManageEdit.razor
   add next to .education-workspace. The course workspace pages keep the values above. */
.education-workspace.cm-theme {
  --tl-font-sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;

  --tl-bg:          #F5F6FA;
  --tl-surface:     #FFFFFF;
  --tl-surface-alt: #EEF1F6;
  --tl-border:      #DCE1EA;
  --tl-text:        #0F1B33;
  --tl-text-2:      #34425C;
  --tl-text-muted:  #56637A;

  --tl-gold:              #E3B341;  /* gold fill: #1A1405 on it is about 10:1 */
  --tl-accent:            #E3B341;
  --tl-primary:           #E3B341;
  --tl-gold-button-text:  #1A1405;

  --tl-success-fg: #1C6339; --tl-success-bg: #E2F3E8;
  --tl-warning-fg: #74490A; --tl-warning-bg: #FCEFD6;
  --tl-error-fg:   #A1232A; --tl-error-bg:   #FBE7E7;
  --tl-info-fg:    #1E4C93; --tl-info-bg:    #E4ECFA;
  --tl-scrim: rgba(9, 16, 32, 0.55);

  /* The canvas uses one radius set: cards 14px, buttons and fields 10px, pills fully rounded. */
  --tl-radius-card:   14px;
  --tl-radius-button: 10px;
  --tl-radius-pill:   999px;

  font-family: var(--tl-font-sans);
  /* The canvas sets no line-height, so text uses the browser's "normal" (about 1.2). The app body
     inherits Fluent's fixed 20px type-ramp line-height, which made every label, help line and
     heading on these pages taller than drawn. Elements the canvas sizes (titles, summaries, help
     text) set their own line-height in the component stylesheets. */
  line-height: normal;
  -webkit-font-smoothing: antialiased;
}

.education-workspace.cm-theme.theme-dark {
  --tl-bg:          #0A1324;
  --tl-surface:     #111C33;
  --tl-surface-alt: #18253F;
  --tl-border:      #26355A;
  --tl-text:        #EEF2FA;
  --tl-text-2:      #C5CEDF;
  --tl-text-muted:  #9AA7BF;

  --tl-gold:              #E8BC4E;
  --tl-accent:            #E8BC4E;
  --tl-primary:           #E8BC4E;
  --tl-gold-button-text:  #1A1405;

  --tl-success-fg: #8ADDAA; --tl-success-bg: #12321F;
  --tl-warning-fg: #F3C76E; --tl-warning-bg: #3A2A0A;
  --tl-error-fg:   #FFA7AC; --tl-error-bg:   #3A1418;
  --tl-info-fg:    #A9C6FF; --tl-info-bg:    #14284A;
  --tl-scrim: rgba(0, 0, 0, 0.62);
}

/* app.css sets h1-h6 to 'Cormorant Garamond' with !important (academy rule). The canvas sets every
   heading on these pages in Inter, so this has to be !important too; the two classes give it the
   higher specificity (same approach as Library.razor.css .library-title). */
.education-workspace.cm-theme :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--tl-font-sans) !important;
}

/* Headings and paragraphs default to "normal" line-height like the canvas (reboot.css gives p a
   fixed one). :where keeps this at element
   specificity, so a component rule that sets its own line-height (e.g. .cm-title 1.2) still wins,
   while it still beats Fluent's reboot.css heading line-heights, which load before this file. */
:where(.education-workspace.cm-theme) :is(h1, h2, h3, h4, h5, h6, p) {
  line-height: normal;
}

/* The canvas dims the page behind every dialog with --tl-scrim (55% light, 62% dark). Fluent's own
   overlay is a fixed 30% black, so the delete, unsaved-changes and remove-lesson dialogs on these
   pages re-colour it here, once, instead of in three component stylesheets. */
.education-workspace.cm-theme fluent-dialog::part(overlay) {
  background: var(--tl-scrim);
}

/* Each dialog's content block already carries the canvas's 24px padding; Fluent's control part
   adds another 24px around it, which doubled the inset and widened the box past the drawn size. */
.education-workspace.cm-theme fluent-dialog::part(control) {
  padding: 0;
}

/* Current-lesson highlight for LessonRow.razor (VETI-3336) — no other existing component needs
   a "highlighted row" treatment, so this is a genuine addition rather than reinventing something
   Fluent's own styling already covers. */
.lesson-row-current {
  border-left: 3px solid var(--tl-info-fg);
  padding-left: var(--tl-space-1);
}
