/*
  DataSphere public portal - design tokens (canonical source).

  Scope: .ds-pub-shell, the root element of PublicLayout.razor and AuthLayout.razor.
  Mirror: Theme/PublicTheme.cs carries the same palette/typography for MudBlazor components
  (MudBlazor reads the C# theme, not these properties) - keep the two in sync by hand.

  Direction: navy ink + navy primary on a clean neutral canvas; amber is a restrained brand
  accent (brand mark, key numerals, selected states), never a border on every surface.
  Semantic colours are for status only. Brand amber (#e8920c) is 2.6:1 on white, so it is
  never used for text below 24px - use --pub-accent-ink for amber text and --pub-warning
  for amber chart fills (WCAG 1.4.11 needs 3:1).
*/

.ds-pub-shell {
  /* Canvas & surfaces */
  --pub-canvas: #f7f8fa;          /* a breath off white, so white cards lift off the page */
  --pub-surface: #ffffff;
  --pub-surface-muted: #f4f5f7;
  --pub-surface-hover: #f0f2f5;
  --pub-surface-sunken: #eef0f3;
  --pub-surface-inverse: #0e1a2b;
  /* Always-dark panel (auth brand side) - identical in both themes */
  --pub-night: #0e1a2b;
  --pub-night-ink: #f4f6f9;
  --pub-night-ink-2: rgba(244, 246, 249, 0.74);

  /* Tonal bands: break the white with paper-like shades instead of more borders.
     band = cool blue-grey, sand = warm survey paper, wash = page-header gradient top,
     contour = ink of the topographic line layer (wwwroot/img/pub-contours.svg, used as a mask) */
  --pub-band: #edf1f6;
  --pub-band-edge: #dfe5ee;
  --pub-sand: #f6f1e8;
  --pub-sand-edge: #e9e0d0;
  --pub-wash: #e9eff7;
  --pub-glow-cool: rgba(30, 77, 140, 0.10);
  --pub-glow-warm: rgba(232, 146, 12, 0.10);
  --pub-contour: rgba(30, 77, 140, 0.13);
  --pub-contour-warm: rgba(154, 93, 4, 0.12);
  --pub-night-band: #0e1a2b;

  /* Borders */
  --pub-border: #e6e8ec;
  --pub-border-strong: #d2d6dd;

  /* Ink */
  --pub-ink: #0e1a2b;
  --pub-ink-2: #4b5768;
  --pub-ink-3: #5c6777;          /* >= 4.5:1 on canvas, muted and primary-soft */
  --pub-ink-disabled: #9aa3b2;
  --pub-ink-inverse: #f4f6f9;
  --pub-ink-inverse-2: rgba(244, 246, 249, 0.72);

  /* Primary interactive (navy) */
  --pub-primary: #1e4d8c;
  --pub-primary-hover: #1a3a64;
  --pub-primary-active: #132d50;
  --pub-primary-soft: #e8eff8;
  --pub-primary-soft-ink: #1a3a64;
  --pub-on-primary: #ffffff;

  /* Brand accent (amber) */
  --pub-accent: #e8920c;
  --pub-accent-strong: #c47a08;
  --pub-accent-ink: #9a5d04;
  --pub-accent-soft: #fdf3e3;

  /* Semantic (status only) */
  --pub-success: #127235;
  --pub-success-soft: #e7f6ec;
  --pub-warning: #b45309;
  --pub-warning-soft: #fdf2e0;
  --pub-danger: #b91c1c;
  --pub-danger-soft: #fdecec;
  --pub-info: #0e7490;
  --pub-info-soft: #e3f4f8;
  --pub-neutral-soft: #eef0f3;

  /* Data viz: magnitude ramp (navy) + categorical tints for covers */
  --pub-chart-1: #1e4d8c;
  --pub-chart-2: #4f7cb8;
  --pub-chart-3: #9bb6dc;
  --pub-chart-muted: #c6ccd6;
  --pub-tint-1: #e8eff8;
  --pub-tint-2: #e7f6ec;
  --pub-tint-3: #e3f4f8;
  --pub-tint-4: #fdf3e3;
  --pub-tint-5: #f1ecf8;
  --pub-tint-6: #eef0f3;
  --pub-tint-5-ink: #6d4fb0;
  --pub-on-solid: #ffffff;        /* text on solid status fills */
  --pub-paper-white: #ffffff;     /* document canvas behind embedded files */
  --pub-map-county: #c8962f;      /* FCDC county shading - matches wwwroot/js/projectMap.js */
  --pub-map-county-fill: rgba(200, 150, 47, 0.35);

  /* Focus */
  --pub-focus: #1e4d8c;
  --pub-focus-ring: 0 0 0 2px var(--pub-surface), 0 0 0 4px var(--pub-focus);

  /* Typography */
  --pub-font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pub-font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --pub-font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --pub-font-features: "cv11", "ss01";

  --pub-text-2xs: 0.6875rem;  /* 11 */
  --pub-text-xs: 0.75rem;     /* 12 */
  --pub-text-sm: 0.875rem;    /* 14 */
  --pub-text-md: 1rem;        /* 16 */
  --pub-text-lg: 1.125rem;    /* 18 */
  --pub-text-xl: 1.25rem;     /* 20 */
  --pub-text-2xl: 1.5rem;     /* 24 */
  --pub-text-3xl: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);   /* 28 -> 36 */
  --pub-text-4xl: clamp(2.25rem, 1.6rem + 2.2vw, 3.25rem);   /* 36 -> 52 */

  --pub-lh-display: 1.05;
  --pub-lh-heading: 1.15;
  --pub-lh-ui: 1.45;
  --pub-lh-body: 1.6;

  --pub-ls-display: -0.02em;
  --pub-ls-heading: -0.015em;
  --pub-ls-ui: -0.006em;
  --pub-ls-caps: 0.08em;

  /* Spacing (4px base) */
  --pub-space-1: 4px;
  --pub-space-2: 8px;
  --pub-space-3: 12px;
  --pub-space-4: 16px;
  --pub-space-5: 20px;
  --pub-space-6: 24px;
  --pub-space-8: 32px;
  --pub-space-10: 40px;
  --pub-space-12: 48px;
  --pub-space-16: 64px;
  --pub-space-20: 80px;
  --pub-section-y: clamp(48px, 6vw, 80px);

  /* Radii */
  --pub-radius-sm: 6px;
  --pub-radius: 8px;
  --pub-radius-lg: 12px;
  --pub-radius-xl: 16px;
  --pub-radius-pill: 999px;

  /* Shadows */
  --pub-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --pub-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --pub-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.05);
  --pub-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);

  /* Motion */
  --pub-dur-fast: 150ms;
  --pub-dur: 200ms;
  --pub-dur-slow: 250ms;
  --pub-ease: cubic-bezier(0.2, 0, 0, 1);
  --pub-ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --pub-container: 1280px;
  --pub-container-wide: 1280px; /* kept equal to --pub-container so every band shares one edge */
  --pub-container-narrow: 760px;
  --pub-gutter: clamp(16px, 4vw, 32px);
  --pub-header-h: 64px;
  --pub-z-header: 1100;
  --pub-z-popover: 1200;
  --pub-z-sheet: 1300;
}

@media (max-width: 767.98px) {
  .ds-pub-shell { --pub-header-h: 56px; }
}

.ds-dark .ds-pub-shell,
.ds-pub-shell.ds-pub-shell--dark,
.ds-pub-shell .pub-on-night {
  --pub-canvas: #0b1220;
  --pub-surface: #111a2b;
  --pub-surface-muted: #0e1626;
  --pub-surface-hover: #172238;
  --pub-surface-sunken: #0a1120;
  --pub-surface-inverse: #e6eaf0;

  --pub-band: #0f1829;
  --pub-band-edge: #1c2a40;
  --pub-sand: #14161d;
  --pub-sand-edge: #262a33;
  --pub-wash: #0f1a2e;
  --pub-glow-cool: rgba(106, 160, 232, 0.12);
  --pub-glow-warm: rgba(245, 166, 35, 0.07);
  --pub-contour: rgba(134, 179, 240, 0.10);
  --pub-contour-warm: rgba(245, 166, 35, 0.08);
  --pub-night-band: #0f1e36;

  --pub-border: #223047;
  --pub-border-strong: #2f3f5a;

  --pub-ink: #e6eaf0;
  --pub-ink-2: #aab4c3;
  --pub-ink-3: #8a96a8;
  --pub-ink-disabled: #5f6b7d;
  --pub-ink-inverse: #0b1220;
  --pub-ink-inverse-2: rgba(11, 18, 32, 0.72);

  --pub-primary: #6aa0e8;
  --pub-primary-hover: #86b3f0;
  --pub-primary-active: #4f8ad8;
  --pub-primary-soft: rgba(106, 160, 232, 0.14);
  --pub-primary-soft-ink: #a9c8f2;
  --pub-on-primary: #0b1220;

  --pub-accent: #f5a623;
  --pub-accent-strong: #fbbf4e;
  --pub-accent-ink: #f8b84a;
  --pub-accent-soft: rgba(245, 166, 35, 0.14);

  --pub-success: #34c77b;
  --pub-success-soft: rgba(52, 199, 123, 0.14);
  --pub-warning: #f3b35a;
  --pub-warning-soft: rgba(243, 179, 90, 0.14);
  --pub-danger: #f27a7a;
  --pub-danger-soft: rgba(242, 122, 122, 0.14);
  --pub-info: #5cc0d8;
  --pub-info-soft: rgba(92, 192, 216, 0.14);
  --pub-neutral-soft: #172238;

  --pub-chart-1: #6aa0e8;
  --pub-chart-2: #4a7bbd;
  --pub-chart-3: #2e4f7d;
  --pub-chart-muted: #3a4860;
  --pub-tint-1: rgba(106, 160, 232, 0.14);
  --pub-tint-2: rgba(52, 199, 123, 0.12);
  --pub-tint-3: rgba(92, 192, 216, 0.12);
  --pub-tint-4: rgba(245, 166, 35, 0.12);
  --pub-tint-5: rgba(167, 139, 250, 0.12);
  --pub-tint-6: #172238;
  --pub-tint-5-ink: #b9a6f5;
  --pub-on-solid: #0b1220;

  --pub-focus: #86b3f0;

  --pub-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --pub-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --pub-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --pub-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Night band (.pub-on-night): a full-bleed deep-navy band that re-scopes every token to the
   dark palette above, so cards, charts and links inside invert without per-component rules.
   It sits on --pub-night-band (slightly bluer than the dark canvas, so it still reads as a
   band in dark mode). */
.ds-pub-shell .pub-on-night {
  --pub-canvas: var(--pub-night-band);
  --pub-surface: rgba(255, 255, 255, 0.045);
  --pub-surface-muted: rgba(255, 255, 255, 0.03);
  --pub-surface-hover: rgba(255, 255, 255, 0.07);
  --pub-surface-sunken: rgba(0, 0, 0, 0.18);
  --pub-border: rgba(255, 255, 255, 0.10);
  --pub-border-strong: rgba(255, 255, 255, 0.18);
  --pub-ink-2: #b4bfcf;
  --pub-ink-3: #97a4b8;
  --pub-contour: rgba(170, 200, 242, 0.09);
  --pub-glow-cool: rgba(106, 160, 232, 0.16);
  --pub-glow-warm: rgba(245, 166, 35, 0.10);
  background: var(--pub-canvas);
  color: var(--pub-ink);
}
