/*
 * Tokens, base elements and the theme toggle. The stylesheet is hand-written
 * and has no build step; it is split by purpose into the files in
 * public/css/, linked in this order by Document.tsx: base, shell,
 * components, lists, charts, pages. A later file may rely on an earlier one.
 *
 * Tokens and component shapes are copied from mehedi_bhai's console design
 * (src/app/globals.css and DESIGN_SYSTEM.md there). The contrast measurements
 * behind each colour live in that file, so change a value there first, then
 * here.
 *
 * The theme is a `.dark` class on <html>, set before first paint in
 * Document.tsx. Classes are named for what a thing is (`.btn-primary`,
 * `.card`), never for a colour.
 */

@font-face {
  font-family: "Geist";
  src: url("/vendor/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---- Tokens ------------------------------------------------------------ */

:root {
  color-scheme: light;
  --radius: 0.625rem;
  /* Geist has no Bengali; a Bengali name falls through to the system face. */
  --font:
    "Geist", "Hind Siliguri", "Noto Sans Bengali", ui-sans-serif, system-ui,
    sans-serif;

  --ink: #0b1220;
  --background: #f7f9fc;
  --foreground: #172033;
  --card: #ffffff;
  --panel: #ffffff;
  --popover: #ffffff;
  --muted: #f1f5f9;
  --muted-foreground: #5a6577;
  --accent: #eef2f7;
  --border: #e2e8f0;
  --hairline: rgba(23, 32, 51, 0.11);
  --input: #ffffff;
  --input-border: #8592a6;
  --ring: #0a66c2;

  --primary: #0a66c2;
  --primary-fill: #0a66c2;
  --primary-fill-hover: #08529c;
  --primary-foreground: #ffffff;
  --brand-orange: #f5a723;
  --brand-orange-foreground: #172033;

  --success: #137a39;
  --success-soft: rgba(19, 122, 57, 0.1);
  --warning: #c2410c;
  --warning-soft: rgba(234, 88, 12, 0.1);
  --danger: #c62828;
  --danger-soft: rgba(198, 40, 40, 0.1);
  --info: #0a66c2;
  --info-soft: rgba(10, 102, 194, 0.1);
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;

  --sidebar: #eef2f6;
  --sidebar-accent: #ffffff;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.05);

  /* Chart marks. On time, Late and Absent sit side by side in a stacked
     bar, so they are their own steps, checked with the dataviz palette
     validator against the card in each theme: the status tokens' orange and
     red are too close to tell apart there. */
  --chart-on-time: #137a39;
  --chart-late: #d99a0b;
  --chart-absent: #c62828;
  --chart-bar: var(--primary);
}

/* A navy ladder, not the light theme inverted: depth comes from each surface
   being a step lighter, so there are no shadows here. */
.dark {
  color-scheme: dark;
  --background: #0b1220;
  --foreground: #f8fafc;
  --card: #172033;
  --panel: #172033;
  --popover: #1e293b;
  --muted: #1e293b;
  --muted-foreground: #94a3b8;
  --accent: #223049;
  --border: #283548;
  --hairline: rgba(248, 250, 252, 0.13);
  --input: #111827;
  --input-border: #5c6e8a;
  --ring: #4da3ff;

  --primary: #2b8fff;
  --primary-fill: #1a6fd4;
  --primary-fill-hover: #1560bc;
  --brand-orange-foreground: #1a1204;

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #fb923c;
  --warning-soft: rgba(251, 146, 60, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #4da3ff;
  --info-soft: rgba(77, 163, 255, 0.14);

  --sidebar: #111827;
  --sidebar-accent: #223049;
  --shadow-xs: none;

  --chart-on-time: #108043;
  --chart-late: #ca8f10;
  --chart-absent: #e5443b;
}

/* ---- Base -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--sidebar);
  color: var(--foreground);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.muted {
  color: var(--muted-foreground);
}

.small {
  font-size: 0.75rem;
}

.stack-xs {
  display: grid;
  gap: 0.25rem;
}

.stack-sm {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

/* The theme toggle's two labels; only the one that applies is shown. */
.dark .when-light,
:root:not(.dark) .when-dark {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
