/*
 * Design tokens mirrored from the Flutter app (lib/core/theme).
 * Colors: AppFoundationColors / AppEventColors / AppGradients / AppColorScheme.
 * Keep values in sync with the Dart sources; do not add tokens that are not
 * defined there.
 */

:root {
  color-scheme: light dark;

  /* Typefaces (AppTypography) */
  --font-heading: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;

  /* Type scale: size / weight / line-height / letter-spacing (em) */
  --type-display-size: 28px;
  --type-display-weight: 700;
  --type-display-line: 1.2;
  --type-display-track: -0.02em;
  --type-heading-lg-size: 22px;
  --type-heading-lg-weight: 700;
  --type-heading-lg-line: 1.25;
  --type-heading-lg-track: -0.01em;
  --type-heading-md-size: 18px;
  --type-heading-md-weight: 700;
  --type-heading-md-line: 1.3;
  --type-heading-md-track: -0.01em;
  --type-heading-sm-size: 15px;
  --type-heading-sm-weight: 600;
  --type-heading-sm-line: 1.35;
  --type-body-default-size: 16px;
  --type-body-default-weight: 400;
  --type-body-default-line: 1.5;
  --type-body-strong-size: 15px;
  --type-body-strong-weight: 600;
  --type-body-strong-line: 1.5;
  --type-button-size: 14px;
  --type-button-weight: 600;
  --type-button-line: 1.4;
  --type-label-lg-size: 13px;
  --type-label-lg-weight: 600;
  --type-label-lg-line: 1.4;
  --type-label-lg-track: 0.01em;
  --type-label-md-size: 11px;
  --type-label-md-weight: 600;
  --type-label-md-line: 1.4;
  --type-label-md-track: 0.06em;
  --type-caption-size: 12px;
  --type-caption-weight: 500;
  --type-caption-line: 1.5;
  --type-mono-size: 12px;
  --type-mono-weight: 400;
  --type-mono-line: 1.4;

  /* Spacing (AppSpacing) */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;

  /* Layout and sizes (AppLayout, AppSizes) */
  --screen-margin: var(--space-lg);
  --touch-target-min: 44px;
  --stroke-hairline: 1px;
  --stroke-regular: 2px;
  --spinner-inline: 14px;

  /* Shape (AppRadius) */
  --radius-none: 0;
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* Elevation (AppElevation); identical in both themes */
  --elevation-0: none;
  --elevation-1: 0 1px 3px rgba(0, 0, 0, 0.1);
  --elevation-2: 0 4px 12px rgba(0, 0, 0, 0.14);
  --elevation-3: 0 8px 24px rgba(0, 0, 0, 0.18);
  --elevation-4: 0 16px 48px rgba(0, 0, 0, 0.24);

  /* Motion (AppMotion) */
  --motion-short: 200ms;
  --motion-ease: ease;
  --motion-spinner: 800ms;
  --motion-pressed-scale: 0.97;

  /* Color, light (AppFoundationColors.light, AppEventColors.light) */
  --color-action-primary: #2a4820;
  --color-action-primary-pressed: #1c3215;
  --color-action-primary-disabled: rgba(42, 72, 32, 0.35);
  --color-action-primary-foreground: #ffffff;
  --color-action-secondary: #4a6540;
  --color-accent: #a05c18;
  --color-background-default: #eef0ec;
  --color-background-subtle: #e4e7e0;
  --color-surface-primary: #fafaf8;
  --color-surface-secondary: #e4e7e0;
  --color-surface-overlay: rgba(238, 240, 236, 0.92);
  --color-text-primary: #141c12;
  --color-text-secondary: #5a6a52;
  --color-text-disabled: #8a9a82;
  --color-text-inverse: #fafaf8;
  --color-text-mono: #5a6a52;
  --color-border-default: rgba(42, 72, 32, 0.15);
  --color-border-strong: rgba(42, 72, 32, 0.3);
  --color-border-subtle: rgba(42, 72, 32, 0.08);
  --color-event-sighting: #3f5eb5;
  --color-event-bag: #b85c3a;
  --color-on-event-sighting: #ffffff;
  --color-on-event-bag: #ffffff;
  --color-semantic-success: #4e7d5b;
  --color-semantic-warning: #a05c18;
  --color-semantic-error: #b85c3a;
  --color-semantic-on-error: #ffffff;
  --color-semantic-info: #2a4820;

  /* From AppColorScheme.light (tertiary = ochre, error container) */
  --color-tertiary-container: #ede4d9;
  --color-on-tertiary-container: #141c12;
  --color-error-container: #f1e4dd;

  /* Gradients (AppGradients.light), all top to bottom */
  --gradient-event-sighting: linear-gradient(180deg, #9db1e6, #243e7a);
  --gradient-event-bag: linear-gradient(180deg, #e8987a, #7a2e1a);
  --gradient-action-primary: linear-gradient(180deg, #4a7a38, #1c3215);
  --gradient-background-page: linear-gradient(180deg, #eef0ec, #dfe2da);

  /* Text on surface-primary for secondary copy; see the dark override. */
  --color-text-muted-on-surface: var(--color-text-secondary);
}

:root[data-theme="light"] { color-scheme: light; }

/* Dark values exist twice: system preference (unless the user forced light)
   and the manual override from the theme switch. Keep both blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* AppFoundationColors.dark, AppEventColors.dark */
    --color-action-primary: #6aad58;
    --color-action-primary-pressed: #82c470;
    --color-action-primary-disabled: rgba(106, 173, 88, 0.3);
    --color-action-primary-foreground: #111811;
    --color-action-secondary: #7a9b6a;
    --color-accent: #c97b2a;
    --color-background-default: #111811;
    --color-background-subtle: #202e1e;
    --color-surface-primary: #192119;
    --color-surface-secondary: #202e1e;
    --color-surface-overlay: rgba(17, 24, 17, 0.94);
    --color-text-primary: #cdd8c5;
    --color-text-secondary: #7a8a72;
    --color-text-disabled: #4a5a44;
    --color-text-inverse: #141c12;
    --color-text-mono: #7a8a72;
    --color-border-default: rgba(106, 173, 88, 0.16);
    --color-border-strong: rgba(106, 173, 88, 0.28);
    --color-border-subtle: rgba(106, 173, 88, 0.08);
    --color-event-sighting: #8aa4ea;
    --color-event-bag: #d4784f;
    --color-on-event-sighting: #111811;
    --color-on-event-bag: #111811;
    --color-semantic-success: #6baf80;
    --color-semantic-warning: #c97b2a;
    --color-semantic-error: #d4784f;
    --color-semantic-on-error: #111811;
    --color-semantic-info: #6aad58;

    /* AppColorScheme.dark */
    --color-tertiary-container: #352f1c;
    --color-on-tertiary-container: #cdd8c5;
    --color-error-container: #372f22;

    /* AppGradients.dark */
    --gradient-event-sighting: linear-gradient(180deg, #8aa4ea, #16213f);
    --gradient-event-bag: linear-gradient(180deg, #d4784f, #4a1e0c);
    --gradient-action-primary: linear-gradient(180deg, #82c470, #2a5820);
    --gradient-background-page: linear-gradient(180deg, #111811, #0a0e0a);

    /* text-secondary on surface-primary misses 4.5:1 in dark (see
       test/core/theme/contrast_test.dart); use primary text there. */
    --color-text-muted-on-surface: var(--color-text-primary);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* AppFoundationColors.dark, AppEventColors.dark */
  --color-action-primary: #6aad58;
  --color-action-primary-pressed: #82c470;
  --color-action-primary-disabled: rgba(106, 173, 88, 0.3);
  --color-action-primary-foreground: #111811;
  --color-action-secondary: #7a9b6a;
  --color-accent: #c97b2a;
  --color-background-default: #111811;
  --color-background-subtle: #202e1e;
  --color-surface-primary: #192119;
  --color-surface-secondary: #202e1e;
  --color-surface-overlay: rgba(17, 24, 17, 0.94);
  --color-text-primary: #cdd8c5;
  --color-text-secondary: #7a8a72;
  --color-text-disabled: #4a5a44;
  --color-text-inverse: #141c12;
  --color-text-mono: #7a8a72;
  --color-border-default: rgba(106, 173, 88, 0.16);
  --color-border-strong: rgba(106, 173, 88, 0.28);
  --color-border-subtle: rgba(106, 173, 88, 0.08);
  --color-event-sighting: #8aa4ea;
  --color-event-bag: #d4784f;
  --color-on-event-sighting: #111811;
  --color-on-event-bag: #111811;
  --color-semantic-success: #6baf80;
  --color-semantic-warning: #c97b2a;
  --color-semantic-error: #d4784f;
  --color-semantic-on-error: #111811;
  --color-semantic-info: #6aad58;

  /* AppColorScheme.dark */
  --color-tertiary-container: #352f1c;
  --color-on-tertiary-container: #cdd8c5;
  --color-error-container: #372f22;

  /* AppGradients.dark */
  --gradient-event-sighting: linear-gradient(180deg, #8aa4ea, #16213f);
  --gradient-event-bag: linear-gradient(180deg, #d4784f, #4a1e0c);
  --gradient-action-primary: linear-gradient(180deg, #82c470, #2a5820);
  --gradient-background-page: linear-gradient(180deg, #111811, #0a0e0a);

  --color-text-muted-on-surface: var(--color-text-primary);
}
