/* =====================================================================
   COLOUR TOKENS
   Warm Fluent neutrals and command blue for a multi-repository build
   console. Status is its own green / ochre / red / neutral family, never
   the command accent. Light and warm-graphite dark themes are fully mapped.

   Layer 1 holds the source ramps; layer 2 the semantic roles. Every other
   stylesheet and component uses layer-2 roles only, never a ramp or a hex.
   The theme follows the system unless <html data-theme> says otherwise.
   ===================================================================== */

/* ---- Layer 1: source ramps --------------------------------------- */
:root {
  /* Substrate / Fabric: warm grey paper and ink */
  --fabric-000: #ffffff;
  --fabric-050: #faf9f8;
  --fabric-100: #f3f2f1;
  --fabric-200: #edebe9;
  --fabric-300: #e1dfdd;
  --fabric-400: #a19f9d;
  --fabric-500: #8a8886;
  --fabric-600: #605e5c;
  --fabric-800: #323130;
  --fabric-900: #201f1e;

  /* Command blue: actionable, never repository health */
  --cobalt-400: #2899f5;
  --cobalt-500: #0078d4;
  --cobalt-600: #106ebe;
  --cobalt-700: #005a9e;

  /* Header band */
  --header-900: #0f2c4c;

  /* Status inks and light fills */
  --ok-600: #107c10;
  --ok-050: #e8f4e8;
  --caution-700: #8a5700;
  --caution-050: #fff4ce;
  --alert-600: #a4262c;
  --alert-050: #fde7e9;
  --neutral-600: #605e5c;
  --neutral-050: #f3f2f1;

  /* Dark room: warm graphite, not black */
  --graphite-950: #191817;
  --graphite-900: #232220;
  --graphite-875: #292826;
  --graphite-850: #302e2b;
  --graphite-800: #393734;
  --graphite-700: #514e49;
  --graphite-600: #6d6963;
  --graphite-500: #aaa69f;
  --graphite-300: #c4c0b9;
  --graphite-100: #e2dfda;
  --graphite-050: #f3f1ee;

  /* Dark-theme accents and status family */
  --sky-400: #45b1e8;
  --sky-300: #68c1ed;
  --sky-200: #96d5f3;
  --mint-300: #72d391;
  --mint-900: #243b2b;
  --amber-300: #edc16e;
  --amber-900: #493514;
  --rose-300: #ff8b85;
  --rose-900: #48272a;
  --stone-300: #bebbb4;
  --stone-900: #383632;
}

/* ---- Layer 2: semantic roles, light ------------------------------ */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  --bg: var(--fabric-000);                 /* app canvas and all work panes */
  --surface: var(--fabric-000);            /* same-plane content, never a card fill */
  --surface-sunken: var(--fabric-050);     /* recessed search and filter controls */
  --surface-hover: var(--fabric-100);      /* hovered rows and quiet control hover */
  --surface-press: var(--fabric-200);      /* pressed controls and selected neutral rows */
  --surface-select: var(--fabric-050);     /* selected repository row behind its marker */

  --header: var(--header-900);             /* sole top chrome band */
  --on-header: var(--fabric-000);          /* text and controls on header */
  --header-muted: var(--fabric-300);       /* secondary header copy and metadata */
  --header-hover: color-mix(in srgb, var(--on-header) 14%, var(--header)); /* hovered and open controls on header */

  --border: var(--fabric-300);             /* content and section hairlines */
  --border-strong: var(--fabric-400);      /* table rules and quiet control boundaries */
  --border-input: var(--fabric-500);       /* visible input edges, at least 3:1 */

  --text: var(--fabric-900);               /* titles, repo names and primary values */
  --text-body: var(--fabric-800);          /* body copy and table content */
  --text-muted: var(--fabric-600);         /* supporting text and secondary values */
  --text-faint: var(--fabric-600);         /* measured labels and timestamps, never decoration */
  --text-disabled: var(--fabric-500);      /* unavailable controls, still legible */

  --accent: var(--cobalt-500);             /* actionable links, selected nav, focus, selected-row marker */
  --accent-hover: var(--cobalt-600);       /* hovered actionable text on hover surface */
  --accent-press: var(--cobalt-700);       /* pressed action on pressed surface */
  --on-accent: var(--fabric-000);          /* label on the filled primary action */
  --focus: var(--cobalt-500);              /* visible keyboard ring on light workspace */

  --success: var(--ok-600);                /* successful checks and published releases */
  --success-fill: var(--ok-050);           /* faint success status ground only */
  --on-success: var(--fabric-000);         /* mark/text on solid success ink when required */
  --warning: var(--caution-700);           /* needs attention, draft, or review state */
  --warning-fill: var(--caution-050);      /* faint warning status ground only */
  --on-warning: var(--fabric-000);         /* mark/text on solid warning ink when required */
  --danger: var(--alert-600);              /* failed checks and blocking errors, never action accent */
  --danger-fill: var(--alert-050);         /* faint danger status ground only */
  --on-danger: var(--fabric-000);          /* mark/text on solid danger ink when required */
  --neutral-status: var(--neutral-600);   /* queued, skipped, or unknown status */
  --neutral-fill: var(--neutral-050);     /* faint neutral status ground only */
  --on-neutral: var(--fabric-000);         /* mark/text on solid neutral status ink when required */
}

/* ---- Layer 2: semantic roles, dark -------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: var(--graphite-950);             /* warm graphite app canvas */
    --surface: var(--graphite-900);        /* one continuous work plane */
    --surface-sunken: var(--graphite-950); /* recessed search and filter controls */
    --surface-hover: var(--graphite-850);  /* hovered rows and quiet control hover */
    --surface-press: var(--graphite-800); /* pressed controls and selected neutral rows */
    --surface-select: var(--graphite-875); /* selected repository row behind its marker */

    --header: var(--header-900);           /* sole top chrome band, retained as navy */
    --on-header: var(--fabric-000);        /* text and controls on header */
    --header-muted: var(--graphite-300);   /* secondary header copy and metadata */
    --header-hover: color-mix(in srgb, var(--on-header) 14%, var(--header)); /* hovered and open controls on header */

    --border: var(--graphite-700);         /* content and section hairlines */
    --border-strong: var(--graphite-600); /* table rules and quiet control boundaries */
    --border-input: var(--graphite-500);  /* visible input edges, at least 3:1 */

    --text: var(--graphite-050);           /* titles, repo names and primary values */
    --text-body: var(--graphite-100);      /* body copy and table content */
    --text-muted: var(--graphite-300);    /* supporting text and secondary values */
    --text-faint: var(--graphite-300);    /* measured labels and timestamps, never decoration */
    --text-disabled: var(--graphite-500); /* unavailable controls, still legible */

    --accent: var(--sky-400);              /* actionable links, selected nav, focus, selected-row marker */
    --accent-hover: var(--sky-300);        /* hovered actionable text on hover surface */
    --accent-press: var(--sky-200);        /* pressed action on pressed surface */
    --on-accent: var(--graphite-950);     /* label on the filled primary action */
    --focus: var(--sky-300);               /* visible keyboard ring on dark workspace */

    --success: var(--mint-300);            /* successful checks and published releases */
    --success-fill: var(--mint-900);       /* faint success status ground only */
    --on-success: var(--graphite-950);    /* mark/text on solid success ink when required */
    --warning: var(--amber-300);           /* needs attention, draft, or review state */
    --warning-fill: var(--amber-900);      /* faint warning status ground only */
    --on-warning: var(--graphite-950);    /* mark/text on solid warning ink when required */
    --danger: var(--rose-300);             /* failed checks and blocking errors, never action accent */
    --danger-fill: var(--rose-900);         /* faint danger status ground only */
    --on-danger: var(--graphite-950);      /* mark/text on solid danger ink when required */
    --neutral-status: var(--stone-300);   /* queued, skipped, or unknown status */
    --neutral-fill: var(--stone-900);     /* faint neutral status ground only */
    --on-neutral: var(--graphite-950);    /* mark/text on solid neutral status ink when required */
  }
}

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

  --bg: var(--graphite-950);               /* warm graphite app canvas */
  --surface: var(--graphite-900);          /* one continuous work plane */
  --surface-sunken: var(--graphite-950);   /* recessed search and filter controls */
  --surface-hover: var(--graphite-850);    /* hovered rows and quiet control hover */
  --surface-press: var(--graphite-800);   /* pressed controls and selected neutral rows */
  --surface-select: var(--graphite-875);  /* selected repository row behind its marker */

  --header: var(--header-900);             /* sole top chrome band, retained as navy */
  --on-header: var(--fabric-000);          /* text and controls on header */
  --header-muted: var(--graphite-300);     /* secondary header copy and metadata */
  --header-hover: color-mix(in srgb, var(--on-header) 14%, var(--header)); /* hovered and open controls on header */

  --border: var(--graphite-700);           /* content and section hairlines */
  --border-strong: var(--graphite-600);   /* table rules and quiet control boundaries */
  --border-input: var(--graphite-500);    /* visible input edges, at least 3:1 */

  --text: var(--graphite-050);             /* titles, repo names and primary values */
  --text-body: var(--graphite-100);        /* body copy and table content */
  --text-muted: var(--graphite-300);      /* supporting text and secondary values */
  --text-faint: var(--graphite-300);      /* measured labels and timestamps, never decoration */
  --text-disabled: var(--graphite-500);   /* unavailable controls, still legible */

  --accent: var(--sky-400);                /* actionable links, selected nav, focus, selected-row marker */
  --accent-hover: var(--sky-300);          /* hovered actionable text on hover surface */
  --accent-press: var(--sky-200);          /* pressed action on pressed surface */
  --on-accent: var(--graphite-950);       /* label on the filled primary action */
  --focus: var(--sky-300);                 /* visible keyboard ring on dark workspace */

  --success: var(--mint-300);              /* successful checks and published releases */
  --success-fill: var(--mint-900);         /* faint success status ground only */
  --on-success: var(--graphite-950);      /* mark/text on solid success ink when required */
  --warning: var(--amber-300);             /* needs attention, draft, or review state */
  --warning-fill: var(--amber-900);        /* faint warning status ground only */
  --on-warning: var(--graphite-950);      /* mark/text on solid warning ink when required */
  --danger: var(--rose-300);               /* failed checks and blocking errors, never action accent */
  --danger-fill: var(--rose-900);          /* faint danger status ground only */
  --on-danger: var(--graphite-950);       /* mark/text on solid danger ink when required */
  --neutral-status: var(--stone-300);     /* queued, skipped, or unknown status */
  --neutral-fill: var(--stone-900);       /* faint neutral status ground only */
  --on-neutral: var(--graphite-950);      /* mark/text on solid neutral status ink when required */
}
