/* ==========================================================================
   Tokens — every design decision lives here as a CSS variable.
   Color palette + semantic themes are generated by build.mjs and inserted
   right before this file. Override any token in your own CSS to customize.

   Default design: flat, compact, widget-based — made for admin & web apps.
   ========================================================================== */

:root {
  color-scheme: light dark;

  /* Base ----------------------------------------------------------------- */
  --mo-white: #fff;
  --mo-black: #000;

  /* Typography ----------------------------------------------------------- */
  --mo-font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mo-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --mo-font-size: .9375rem;      /* 15px — base for app UIs */
  --mo-font-size-xs: .75rem;     /* 12px */
  --mo-font-size-sm: .8125rem;   /* 13px */
  --mo-font-size-lg: 1.0625rem;  /* 17px */
  --mo-line-height: 1.5;
  --mo-line-height-tight: 1.25;
  --mo-font-weight-normal: 400;
  --mo-font-weight-medium: 500;
  --mo-font-weight-semibold: 600;
  --mo-font-weight-bold: 700;
  --mo-heading-weight: 600;

  /* Surfaces (auto light/dark) -------------------------------------------
     body     → app background (soft gray, so widgets stand out)
     surface  → cards, widgets, panels, inputs
     raised   → floating things: menus, popovers, dialogs, toasts
     1 / 2 / 3 → neutral fills for hover, active, headers, wells          */
  /* The page's own text and background, as constants: colored areas re-point --mo-fg-body / --mo-bg-body
     inside themselves, so anything that must mean "the page" (like the inverse theme) uses these */
  --mo-paper: light-dark(oklch(95.6% .006 258), oklch(13.5% .007 258));
  --mo-ink: light-dark(oklch(22% .015 258), oklch(94% .005 258));
  --mo-bg-body: var(--mo-paper);
  --mo-bg-surface: light-dark(var(--mo-white), oklch(19.5% .009 258));
  --mo-bg-raised: light-dark(var(--mo-white), oklch(25.5% .01 258));   /* overlays: lighter than cards in dark mode */
  /* Neutral fills, meant for use ON a surface (hover, headers, wells) */
  --mo-bg-1: light-dark(oklch(97.8% .003 258), oklch(21.5% .01 258));
  --mo-bg-2: light-dark(oklch(95.2% .005 258), oklch(24.5% .011 258));
  --mo-bg-3: light-dark(oklch(91.8% .007 258), oklch(29% .012 258));

  /* Text */
  --mo-fg-body: var(--mo-ink);
  --mo-fg-2: light-dark(oklch(43% .015 258), oklch(78% .009 258));
  --mo-fg-3: light-dark(oklch(56% .013 258), oklch(63% .01 258));

  /* Borders ---------------------------------------------------------------
     Borderless by default: surfaces are separated by fill, not outlines.
     Form controls keep a border (needed for accessibility, WCAG 1.4.11).
     Set --mo-surface-border-width: 1px for a bordered look everywhere.   */
  --mo-border-width: 1px;
  --mo-surface-border-width: 0px;   /* cards, widgets, panels, alerts, badges */
  --mo-border-color: light-dark(oklch(91.5% .006 258), oklch(28% .011 258));
  --mo-border-color-strong: light-dark(oklch(86% .008 258), oklch(35% .012 258));
  --mo-control-border-color: var(--mo-border-color-strong);

  --mo-link-color: var(--mo-default-fg);
  --mo-link-hover-color: var(--mo-default-fg-emphasis);
  --mo-code-color: light-dark(var(--mo-pink-600), var(--mo-pink-300));

  /* Spacing scale -------------------------------------------------------- */
  --mo-spacer-0: 0;
  --mo-spacer-1: .25rem;   /*  4px */
  --mo-spacer-2: .5rem;    /*  8px */
  --mo-spacer-3: .75rem;   /* 12px */
  --mo-spacer-4: 1rem;     /* 16px */
  --mo-spacer-5: 1.5rem;   /* 24px */
  --mo-spacer-6: 2rem;     /* 32px */
  --mo-spacer-7: 3rem;     /* 48px */

  /* Radius ---------------------------------------------------------------
     Raw scale, then semantic roles. Change the roles to restyle everything. */
  --mo-radius-0: 0;
  --mo-radius-1: .25rem;   /*  4px */
  --mo-radius-2: .375rem;  /*  6px */
  --mo-radius-3: .5rem;    /*  8px */
  --mo-radius-4: .75rem;   /* 12px */
  --mo-radius-5: 1rem;     /* 16px */
  --mo-radius-6: 1.25rem;  /* 20px */
  --mo-radius-7: 1.5rem;   /* 24px */
  --mo-radius-pill: 50rem;

  --mo-radius-control: .625rem;             /* 10px — buttons, inputs, selects */
  --mo-radius-card: var(--mo-radius-5);     /* 16px — cards, widgets, alerts */
  --mo-radius-overlay: .875rem;             /* 14px — menus, popovers, toasts */
  --mo-radius-dialog: var(--mo-radius-6);   /* 20px — dialogs */

  /* Shadows --------------------------------------------------------------
     Flat by default: only floating elements use --mo-shadow-overlay.
     The scale is still here for utilities (.shadow-*) or a non-flat theme. */
  --mo-shadow-strength: 1;
  --mo-shadow-color: oklch(22% .02 258 / calc(.06 * var(--mo-shadow-strength)));
  --mo-shadow-sm: 0 1px 2px var(--mo-shadow-color);
  --mo-shadow: 0 1px 3px var(--mo-shadow-color), 0 4px 12px var(--mo-shadow-color);
  --mo-shadow-lg: 0 4px 8px var(--mo-shadow-color), 0 16px 40px var(--mo-shadow-color);
  --mo-shadow-card: none;
  --mo-shadow-control: none;
  --mo-shadow-overlay: 0 2px 6px var(--mo-shadow-color), 0 12px 32px var(--mo-shadow-color);

  /* Focus ---------------------------------------------------------------- */
  --mo-focus-ring-width: 3px;
  --mo-focus-ring-offset: 1px;

  /* Controls (density) --------------------------------------------------- */
  --mo-control-height: 2.375rem;     /* 38px */
  --mo-control-height-sm: 2rem;      /* 32px */
  --mo-control-height-lg: 2.75rem;   /* 44px */
  --mo-control-padding-x: .75rem;

  /* Motion --------------------------------------------------------------- */
  --mo-ease: cubic-bezier(.2, 0, 0, 1);
  --mo-duration: .15s;

  /* Layers --------------------------------------------------------------- */
  --mo-z-menu: 1000;
  --mo-z-sticky: 1020;
  --mo-z-fixed: 1030;
  --mo-z-toast: 1090;
  --mo-z-tooltip: 1100;

  /* Icons (used as masks, so they take the current text color) ----------- */
  --mo-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 3.5l9 9m0-9l-9 9' stroke='black' stroke-width='1.75' stroke-linecap='round'/%3E%3C/svg%3E");
  --mo-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --mo-icon-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 4h11M2.5 8h11M2.5 12h11' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --mo-icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --mo-icon-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  /* Dark versions — for marks on the soft solid fills (which carry dark text) */
  --mo-icon-check-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --mo-icon-dash-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' stroke='%23111827' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Shape presets — set on <html> for the whole app, or on any section.
   Everything (and every size variant) follows. */
.shape-sharp {
  --mo-radius-control: var(--mo-radius-1);
  --mo-radius-card: var(--mo-radius-2);
  --mo-radius-overlay: var(--mo-radius-2);
  --mo-radius-dialog: var(--mo-radius-3);
}
.shape-soft {
  --mo-radius-control: .625rem;
  --mo-radius-card: var(--mo-radius-5);
  --mo-radius-overlay: .875rem;
  --mo-radius-dialog: var(--mo-radius-6);
}
.shape-round {
  --mo-radius-control: var(--mo-radius-pill);
  --mo-radius-card: var(--mo-radius-7);
  --mo-radius-overlay: var(--mo-radius-6);
  --mo-radius-dialog: var(--mo-radius-7);
}

/* Color modes: follow the OS by default, force with data-mo-theme="light|dark" */
@media (prefers-color-scheme: dark) {
  :root:not([data-mo-theme="light"]) { --mo-shadow-strength: 3; }
}
[data-mo-theme="dark"] { color-scheme: dark; --mo-shadow-strength: 3; }
[data-mo-theme="light"] { color-scheme: light; --mo-shadow-strength: 1; }
