/* ==========================================================================
   MudBlazor → "Terroir" remap.
   Loaded AFTER _content/MudBlazor/MudBlazor.min.css (and after terroir.css) so
   these win. Every value points at a theme-aware Terroir token (defined in
   terroir.css), so Mud components follow the light/dark toggle automatically
   from this single block — no second dark theme stylesheet required, and no
   [data-theme] selector here (the tokens themselves flip under
   :root[data-theme="dark"] in terroir.css).

   The C# TerroirMudTheme.Build()
   factory anchors the Mud palette with hex approximations (MudColor cannot parse
   oklch), so THIS FILE is the authoritative runtime surface source — it re-points
   Mud's generated --mud-palette-* vars at the real Terroir oklch tokens.
   ========================================================================== */

:root {
  /* --- Neutrals: black/white anchors Mud derives many surfaces from --------- */
  --mud-palette-black:            var(--ink);
  --mud-palette-white:            var(--surface);

  /* --- Backgrounds & surfaces ---------------------------------------------- */
  --mud-palette-background:       var(--paper);
  --mud-palette-background-gray:  var(--surface-2);
  --mud-palette-surface:          var(--surface);
  --mud-palette-drawer-background: var(--surface);
  --mud-palette-drawer-text:      var(--ink);
  --mud-palette-drawer-icon:      var(--ink-2);
  --mud-palette-appbar-background: var(--surface);
  --mud-palette-appbar-text:      var(--ink);

  /* --- Text ---------------------------------------------------------------- */
  --mud-palette-text-primary:     var(--ink);
  --mud-palette-text-secondary:   var(--ink-2);
  --mud-palette-text-disabled:    var(--ink-3);

  /* --- Actions ------------------------------------------------------------- */
  --mud-palette-action-default:            var(--ink-2);
  --mud-palette-action-disabled:           var(--ink-3);
  --mud-palette-action-disabled-background: var(--surface-2);

  /* --- Lines / borders / dividers ------------------------------------------ */
  --mud-palette-lines-default:    var(--line);
  --mud-palette-lines-inputs:     var(--line);
  --mud-palette-divider:          var(--line);
  --mud-palette-divider-light:    var(--line-soft);
  --mud-palette-table-lines:      var(--line-soft);
  --mud-palette-table-striped:    var(--surface-2);
  --mud-palette-table-hover:      var(--surface-2);

  /* --- Primary (pine; per-tenant accent overrides via --brand in app.css) -- */
  --mud-palette-primary:               var(--brand);
  --mud-palette-primary-text:          var(--brand-contrast);
  --mud-palette-primary-lighten:       var(--brand-soft);
  --mud-palette-primary-darken:        var(--pine-deep);
  --mud-palette-primary-hover:         var(--brand-soft);

  /* --- Secondary (wine) ---------------------------------------------------- */
  --mud-palette-secondary:             var(--wine);
  --mud-palette-secondary-text:        oklch(0.97 0.02 30);

  /* --- Semantic (kept distinct but in-palette) ----------------------------- */
  --mud-palette-info:        var(--sky);
  --mud-palette-info-text:   #ffffff;
  --mud-palette-success:     var(--pine);
  --mud-palette-success-text: var(--on-pine);
  --mud-palette-warning:     var(--wheat-deep);
  --mud-palette-warning-text: var(--ink);
  --mud-palette-error:       var(--wine);
  --mud-palette-error-text:  oklch(0.97 0.02 30);
  --mud-palette-dark:        var(--ink);
  --mud-palette-dark-text:   var(--surface);

  /* --- Shape (Mud reads border radius from a layout property, mirrored here) */
  --mud-default-borderradius: var(--r-sm);
}

/* A few component touch-ups the theme object alone can't reach --------------- */

/* Headings inside Mud surfaces read as editorial serif to match the app. */
.mud-card .mud-card-header .mud-typography-h5,
.mud-card .mud-card-header .mud-typography-h6,
.mud-card .mud-card-header-content .mud-typography,
.mud-dialog-title {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Cards / papers sit on the warm surface with a hairline + soft shadow. */
.mud-card,
.mud-paper-outlined {
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
}

/* DataGrid / table: warm hairlines, uppercase editorial header, surface-2 hover. */
.mud-table .mud-table-cell {
  border-color: var(--line-soft);
}
.mud-table-head .mud-table-cell,
.mud-table-head th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--t--2);
  color: var(--ink-3);
}
.mud-table-hover .mud-table-row:hover {
  background: var(--surface-2);
}

/* Dialog / popover on the warm surface with the deeper shadow. */
.mud-dialog {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-3);
  border-radius: var(--r-md);
}

/* Mud buttons inherit the primary remap; nudge weight/letterspacing to match. */
.mud-button-root { font-weight: 600; letter-spacing: 0.01em; }
