/* ==========================================================================
   Nikki Note — Shared Design Tokens
   --------------------------------------------------------------------------
   This is the shared design token layer for apps/ in this project.
   It defines CSS custom properties on :root for both light and dark themes
   (dark via prefers-color-scheme), plus a tiny set of opt-in helpers.

   Pair this file with components.css. Both are intended to be loaded by
   simple mini-apps via two <link> tags, e.g.:

     <link rel="stylesheet" href="../_shared/tokens.css">
     <link rel="stylesheet" href="../_shared/components.css">

   IMPORTANT:
   - Do NOT touch global html/body in this file. Apps opt in by adding the
     `nn-app` / `nn-body` helper classes so existing apps keep working.
   - All component classes live in components.css and use the `nn-` prefix.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --surface-3: #f0ede5;

  /* Borders */
  --border: #e0ddd6;
  --border-strong: #c9c5bb;

  /* Text */
  --text: #2a2a28;
  --text-muted: #6b6a64;
  --text-subtle: #9b9a92;

  /* Accents */
  --accent: #8a6f4a;
  --accent-soft: #efe7d8;
  --accent-strong: #6e5638;
  --on-accent: #ffffff;

  /* Overlays (semi-transparent black, for modal scrims / drop shadows that aren't covered by --shadow-*) */
  --overlay-soft: rgba(0, 0, 0, .05);
  --overlay-medium: rgba(0, 0, 0, .25);
  --overlay-strong: rgba(0, 0, 0, .42);
  --overlay-heavy: rgba(0, 0, 0, .7);

  /* States */
  --success: #4a7a5c;
  --success-soft: #e0ecd9;
  --warn: #b88a3a;
  --warn-soft: #f4e9cf;
  --danger: #b8412d;
  --danger-soft: #f5d9cc;
  --danger-edge: #d4a4a4;
  --info: #4a6b85;
  --info-soft: #d9e6ec;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .06), 0 12px 32px rgba(0, 0, 0, .08);

  /* Fonts */
  --f-sans: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Font sizes */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 28px;

  /* Line heights */
  --lh-tight: 1.3;
  --lh-normal: 1.6;

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
}

/* --------------------------------------------------------------------------
   Dark theme overrides — applied automatically when the OS prefers dark.
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    /* Surfaces */
    --bg: #1a1815;
    --surface: #25221d;
    --surface-2: #1f1d18;
    --surface-3: #2c2924;

    /* Borders */
    --border: #3a352e;
    --border-strong: #4a4439;

    /* Text */
    --text: #ece8df;
    --text-muted: #9b948a;
    --text-subtle: #6f6a60;

    /* Accents */
    --accent: #c9a878;
    --accent-soft: #3a3024;
    --accent-strong: #e6c79a;
    --on-accent: #1a1410;

    /* Overlays — darker base on dark theme keeps scrims visible */
    --overlay-soft: rgba(0, 0, 0, .15);
    --overlay-medium: rgba(0, 0, 0, .4);
    --overlay-strong: rgba(0, 0, 0, .6);
    --overlay-heavy: rgba(0, 0, 0, .8);

    /* States */
    --success: #7fa583;
    --success-soft: #2d3a30;
    --warn: #d9b066;
    --warn-soft: #3d3220;
    --danger: #d97560;
    --danger-soft: #3d251f;
    --danger-edge: #6b3a3a;
    --info: #87a6ba;
    --info-soft: #1f2a32;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .45);
  }
}

/* --------------------------------------------------------------------------
   Opt-in helpers
   --------------------------------------------------------------------------
   We intentionally avoid styling the global html/body element so existing
   apps with their own styles are not disturbed. Apps that want the shared
   look add these classes to their root element / body.
   -------------------------------------------------------------------------- */
.nn-app,
.nn-app *,
.nn-app *::before,
.nn-app *::after {
  box-sizing: border-box;
}

.nn-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  margin: 0;
}
