/* moji-hunter — the tokens every app shares.
 *
 * Tailwind 4 is CSS-first, so this is the whole theme: one file, no build
 * step. It is a package only because Turbopack refuses to resolve a path that
 * escapes the importing app's root, so consumers depend on it as
 * `file:../moji-hunter-theme` and set `turbopack.root` one level up.
 * Import it after `tailwindcss`.
 *
 * The names are shadcn/ui's on purpose. A component pasted in from there
 * arrives already themed, in every app, without a mapping layer. Ours are
 * added at the bottom rather than renaming theirs.
 *
 * The values are not invented — they are lifted from the sketch at
 * src/moji-hunter-teach-design, which is where they were decided by looking.
 */

/* The sketch, the docs and this all agree on data-theme rather than a class,
   so `dark:` has to be taught the same trick. */
@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));

:root {
  --background: #fafbfc;
  --foreground: #1b2440;

  --card: #ffffff;
  --card-foreground: #1b2440;
  --popover: #ffffff;
  --popover-foreground: #1b2440;

  /* navy: every primary action in the sketch, and the focus ring */
  --primary: #14224d;
  --primary-foreground: #ffffff;

  --secondary: #eef0f5;
  --secondary-foreground: #14224d;

  --muted: #eef0f5;
  --muted-foreground: #5a647a;

  /* rose, used as a tint behind emphasis rather than as a fill */
  --accent: #fff1f4;
  --accent-foreground: #e11d48;

  /* shadcn's name for error, so a pasted component turns the same red */
  --destructive: var(--error);
  --destructive-foreground: var(--error-foreground);

  --border: #eef0f5;
  --input: #e2e6ef;
  --ring: #14224d;

  --radius: 14px;

  /* ours, with no shadcn equivalent */
  --faint: #98a1b3;

  /* States, each a solid, the text on it, and a tint to lay behind text in
     the solid colour. Hues kept clear of ours: error is red without the rose,
     info is cyan because blue is --lit. */
  --error: #dc2626;
  --error-foreground: #ffffff;
  --error-tint: #fef2f2;
  --warning: #d97706;
  --warning-foreground: #ffffff;
  --warning-tint: #fffbeb;
  --info: #0891b2;
  --info-foreground: #ffffff;
  --info-tint: #ecfeff;
  --ok: #2eb65f;
  --ok-foreground: #ffffff;
  --ok-tint: #effaf6;
  /* A word under the pointer, in the sentence and in the list at once. */
  --lit: #e6ecff;
  /* A surface that is dark in both themes. --primary cannot do this: it is
     navy in light and pale blue in dark, so anything filled with it inverts. */
  --deep: #14224d;
  --deep-foreground: #ffffff;
}

/* Graphite: a neutral near-black with no tint, white headings and the rose
 * accent. A navy-tinted slate was tried first and read as washed out.
 *
 * The second selector is for a page that forces dark on itself rather than
 * following her: only the root layout renders <html>, and the student route
 * must not read her cookie to reach it. Without it the content is dark and
 * everything around it — the overscroll, the browser's own surfaces — stays
 * light.
 */
[data-theme="dark"],
html:has([data-theme="dark"]) {
  --background: #151617;
  --foreground: #e9e9e7;

  --card: #1e1f21;
  --card-foreground: #e9e9e7;
  --popover: #1e1f21;
  --popover-foreground: #e9e9e7;

  --primary: #f6f6f4;
  --primary-foreground: #151617;

  --secondary: #2a2b2e;
  --secondary-foreground: #e9e9e7;

  --muted: #2a2b2e;
  --muted-foreground: #a1a19c;

  --accent: #3a2229;
  --accent-foreground: #ff8fa6;

  --destructive: var(--error);
  --destructive-foreground: var(--error-foreground);

  --border: #2c2d30;
  --input: #3a3b3f;
  --ring: #f6f6f4;

  --faint: #85857f;

  --error: #f87171;
  --error-foreground: #151617;
  --error-tint: #3a2224;
  --warning: #fbbf24;
  --warning-foreground: #151617;
  --warning-tint: #352d1c;
  --info: #22d3ee;
  --info-foreground: #151617;
  --info-tint: #18333a;
  --ok: #6ecf8f;
  --ok-foreground: #151617;
  --ok-tint: #1e3326;
  --lit: #2e3546;
  --deep: #0e0f10;
  --deep-foreground: #e9e9e7;
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);

  --color-faint: var(--faint);
  --color-ok: var(--ok);
  --color-ok-foreground: var(--ok-foreground);
  --color-ok-tint: var(--ok-tint);
  --color-error: var(--error);
  --color-error-foreground: var(--error-foreground);
  --color-error-tint: var(--error-tint);
  --color-warning: var(--warning);
  --color-warning-foreground: var(--warning-foreground);
  --color-warning-tint: var(--warning-tint);
  --color-info: var(--info);
  --color-info-foreground: var(--info-foreground);
  --color-info-tint: var(--info-tint);
  --color-lit: var(--lit);
  --color-deep: var(--deep);
  --color-deep-foreground: var(--deep-foreground);

  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  /* the sketch's card corner, rounder than anything shadcn ships with */
  --radius-card: 22px;
  /* Anything that reads as a chip: an exercise, a segment, a lit word. */
  --radius-chip: 5px;

  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  /* Japanese is set in a serif on purpose: it is the thing being read, not chrome */
  --font-jp: "Noto Serif JP", ui-serif, serif;
}

/* Furigana. Kept here rather than in a component because the ratio is a
   reading decision, not a layout one, and it has to survive the day this is
   drawn by something other than <ruby>. */
@layer base {
  rt {
    font-size: 0.42em;
    font-weight: 600;
    color: var(--muted-foreground);
    letter-spacing: 0.02em;
    user-select: none;
  }
}
