@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-variable.woff2') format('woff2');
}

@tailwind base;
@tailwind components;
@tailwind utilities;

/* LIGHT MODE */
:root {
  --button-outline: rgba(0,0,0, .10);
  --badge-outline: rgba(0,0,0, .05);

  /* Automatic computation of border around primary / danger buttons */
  --opaque-button-border-intensity: -8; /* In terms of percentages */

  /* Backgrounds applied on top of other backgrounds when hovered/active */
  --elevate-1: rgba(0,0,0, .03);
  --elevate-2: rgba(0,0,0, .08);

  --background: 220 5% 98%;

  --foreground: 220 10% 15%;

  --border: 220 8% 85%;

  --card: 220 5% 96%;

  --card-foreground: 220 10% 18%;

  --card-border: 220 8% 88%;

  --sidebar: 220 5% 94%;

  --sidebar-foreground: 220 10% 20%;

  --sidebar-border: 220 8% 86%;

  --sidebar-primary: 210 100% 45%;

  --sidebar-primary-foreground: 0 0% 98%;

  --sidebar-accent: 220 8% 88%;

  --sidebar-accent-foreground: 220 10% 25%;

  --sidebar-ring: 210 100% 45%;

  --popover: 220 5% 92%;

  --popover-foreground: 220 10% 22%;

  --popover-border: 220 8% 84%;

  --primary: 210 100% 45%;

  --primary-foreground: 0 0% 98%;

  --secondary: 220 5% 88%;

  --secondary-foreground: 220 10% 25%;

  --muted: 220 8% 90%;

  --muted-foreground: 220 5% 40%;

  --accent: 220 12% 86%;

  --accent-foreground: 220 10% 30%;

  --destructive: 0 84% 50%;

  --destructive-foreground: 0 0% 98%;

  --input: 220 10% 75%;
  --ring: 210 100% 45%;
  --chart-1: 210 100% 35%;
  --chart-2: 142 76% 30%;
  --chart-3: 35 91% 40%;

  /* Font size design tokens - adjust these to change all font sizes at once */
  --font-size-table-header: 1rem;      /* 16px - table headers (bigger for testing) */
  --font-size-table-data: 1rem;        /* 16px - table data (bigger for testing) */
  --font-size-table-data-small: 0.875rem; /* 14px - secondary table data */
  --font-size-ui-small: 0.875rem;       /* 14px - small UI text */
  --font-size-ui-base: 1rem;            /* 16px - standard UI text */
  --chart-4: 280 100% 35%;
  --chart-5: 15 91% 35%;

  --font-sans: Inter, sans-serif;
  --font-serif: Georgia, serif;
  --font-mono: Inter, sans-serif;
  --radius: .5rem; /* 8px */
  --shadow-2xs: 0px 1px 2px 0px hsl(220 10% 20% / 0.05);
  --shadow-xs: 0px 1px 2px 0px hsl(220 10% 20% / 0.08);
  --shadow-sm: 0px 1px 3px 0px hsl(220 10% 20% / 0.10), 0px 1px 2px -1px hsl(220 10% 20% / 0.10);
  --shadow: 0px 1px 3px 0px hsl(220 10% 20% / 0.10), 0px 1px 2px -1px hsl(220 10% 20% / 0.10);
  --shadow-md: 0px 4px 6px -1px hsl(220 10% 20% / 0.10), 0px 2px 4px -2px hsl(220 10% 20% / 0.10);
  --shadow-lg: 0px 10px 15px -3px hsl(220 10% 20% / 0.10), 0px 4px 6px -4px hsl(220 10% 20% / 0.10);
  --shadow-xl: 0px 20px 25px -5px hsl(220 10% 20% / 0.10), 0px 8px 10px -6px hsl(220 10% 20% / 0.10);
  --shadow-2xl: 0px 25px 50px -12px hsl(220 10% 20% / 0.25);
  --tracking-normal: 0em;
  --spacing: 0.25rem;

  /* Automatically computed borders - intensity can be controlled by the user by the --opaque-button-border-intensity setting */

  /* Fallback for older browsers */
  --sidebar-primary-border: hsl(var(--sidebar-primary));
  --sidebar-primary-border: hsl(from hsl(var(--sidebar-primary)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);

  /* Fallback for older browsers */
  --sidebar-accent-border: hsl(var(--sidebar-accent));
  --sidebar-accent-border: hsl(from hsl(var(--sidebar-accent)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);

  /* Fallback for older browsers */
  --primary-border: hsl(var(--primary));
  --primary-border: hsl(from hsl(var(--primary)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);

  /* Fallback for older browsers */
  --secondary-border: hsl(var(--secondary));
  --secondary-border: hsl(from hsl(var(--secondary)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);

  /* Fallback for older browsers */
  --muted-border: hsl(var(--muted));
  --muted-border: hsl(from hsl(var(--muted)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);

  /* Fallback for older browsers */
  --accent-border: hsl(var(--accent));
  --accent-border: hsl(from hsl(var(--accent)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);

  /* Fallback for older browsers */
  --destructive-border: hsl(var(--destructive));
  --destructive-border: hsl(from hsl(var(--destructive)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
}

.dark {
  --button-outline: rgba(255,255,255, .10);
  --badge-outline: rgba(255,255,255, .05);

  --opaque-button-border-intensity: 9;  /* In terms of percentages */

  /* Backgrounds applied on top of other backgrounds when hovered/active */
  --elevate-1: rgba(255,255,255, .04);
  --elevate-2: rgba(255,255,255, .09);

  --background: 220 15% 8%;

  --foreground: 0 0% 95%;

  --border: 220 10% 20%;

  --card: 220 12% 12%;

  --card-foreground: 0 0% 92%;

  --card-border: 220 10% 25%;

  --sidebar: 220 12% 10%;

  --sidebar-foreground: 0 0% 90%;

  --sidebar-border: 220 10% 18%;

  --sidebar-primary: 210 100% 56%;

  --sidebar-primary-foreground: 0 0% 98%;

  --sidebar-accent: 220 10% 16%;

  --sidebar-accent-foreground: 0 0% 85%;

  --sidebar-ring: 210 100% 56%;

  --popover: 220 10% 14%;

  --popover-foreground: 0 0% 88%;

  --popover-border: 220 10% 22%;

  --primary: 210 100% 56%;

  --primary-foreground: 0 0% 98%;

  --secondary: 220 8% 18%;

  --secondary-foreground: 0 0% 80%;

  --muted: 220 8% 16%;

  --muted-foreground: 0 0% 70%;

  --accent: 220 12% 14%;

  --accent-foreground: 0 0% 75%;

  --destructive: 0 84% 60%;

  --destructive-foreground: 0 0% 98%;

  --input: 220 10% 30%;
  --ring: 210 100% 56%;
  --chart-1: 210 100% 65%;
  --chart-2: 142 76% 50%;
  --chart-3: 35 91% 55%;
  --chart-4: 280 100% 65%;
  --chart-5: 15 91% 55%;

  --shadow-2xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.15);
  --shadow-xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.20);
  --shadow-sm: 0px 1px 3px 0px hsl(0 0% 0% / 0.25), 0px 1px 2px -1px hsl(0 0% 0% / 0.25);
  --shadow: 0px 1px 3px 0px hsl(0 0% 0% / 0.25), 0px 1px 2px -1px hsl(0 0% 0% / 0.25);
  --shadow-md: 0px 4px 6px -1px hsl(0 0% 0% / 0.25), 0px 2px 4px -2px hsl(0 0% 0% / 0.25);
  --shadow-lg: 0px 10px 15px -3px hsl(0 0% 0% / 0.25), 0px 4px 6px -4px hsl(0 0% 0% / 0.25);
  --shadow-xl: 0px 20px 25px -5px hsl(0 0% 0% / 0.25), 0px 8px 10px -6px hsl(0 0% 0% / 0.25);
  --shadow-2xl: 0px 25px 50px -12px hsl(0 0% 0% / 0.50);

  /* Font size design tokens - same as light mode for consistency */
  --font-size-table-header: 1rem;      /* 16px - table headers (bigger for testing) */
  --font-size-table-data: 1rem;        /* 16px - table data (bigger for testing) */
  --font-size-table-data-small: 0.875rem; /* 14px - secondary table data */
  --font-size-ui-small: 0.875rem;       /* 14px - small UI text */
  --font-size-ui-base: 1rem;            /* 16px - standard UI text */
}

@layer base {
  * {
    @apply border-border;
  }

  html {
    font-feature-settings: "tnum" 1, "cv11" 1;
  }

  body {
    @apply font-sans antialiased bg-background text-foreground;
  }
}

@layer utilities {
  /* Font size utility classes using CSS variables - with !important to override Tailwind */
  .text-table-header {
    font-size: var(--font-size-table-header) !important;
  }
  .text-table-data {
    font-size: var(--font-size-table-data) !important;
  }
  .text-table-data-small {
    font-size: var(--font-size-table-data-small) !important;
  }
  .text-ui-small {
    font-size: var(--font-size-ui-small) !important;
  }
  .text-ui-base {
    font-size: var(--font-size-ui-base) !important;
  }
  
  /* Force solid borders for table columns */
  .border-r {
    border-style: solid !important;
  }
}

/**
 * Using the elevate system.
 * Automatic contrast adjustment.
 *
 * <element className="hover-elevate" />
 * <element className="active-elevate-2" />
 *
 * // Using the tailwind utility when a data attribute is "on"
 * <element className="toggle-elevate data-[state=on]:toggle-elevated" />
 * // Or manually controlling the toggle state
 * <element className="toggle-elevate toggle-elevated" />
 *
 * Elevation systems have to handle many states.
 * - not-hovered, vs. hovered vs. active  (three mutually exclusive states)
 * - toggled or not
 * - focused or not (this is not handled with these utilities)
 *
 * Even without handling focused or not, this is six possible combinations that
 * need to be distinguished from eachother visually.
 */
@layer utilities {

  /* Hide ugly search cancel button in Chrome until we can style it properly */
  input[type="search"]::-webkit-search-cancel-button {
    @apply hidden;
  }

  /* Placeholder styling for contentEditable div */
  [contenteditable][data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: hsl(var(--muted-foreground));
    pointer-events: none;
  }

  /* .no-default-hover-elevate/no-default-active-elevate is an escape hatch so consumers of
   * buttons/badges can remove the automatic brightness adjustment on interactions
   * and program their own. */
  .no-default-hover-elevate {}

  .no-default-active-elevate {}


  /**
   * Toggleable backgrounds go behind the content. Hoverable/active goes on top.
   * This way they can stack/compound. Both will overlap the parent's borders!
   * So borders will be automatically adjusted both on toggle, and hover/active,
   * and they will be compounded.
   */
  .toggle-elevate::before,
  .toggle-elevate-2::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0px;
    /*border-radius: inherit;   match rounded corners */
    border-radius: inherit;
    z-index: -1;
    /* sits behind content but above backdrop */
  }

  .toggle-elevate.toggle-elevated::before {
    background-color: var(--elevate-2);
  }

  /* If there's a 1px border, adjust the inset so that it covers that parent's border */
  .border.toggle-elevate::before {
    inset: -1px;
  }

  /* Does not work on elements with overflow:hidden! */
  .hover-elevate:not(.no-default-hover-elevate),
  .active-elevate:not(.no-default-active-elevate),
  .hover-elevate-2:not(.no-default-hover-elevate),
  .active-elevate-2:not(.no-default-active-elevate) {
    position: relative;
    z-index: 0;
  }

  .hover-elevate:not(.no-default-hover-elevate)::after,
  .active-elevate:not(.no-default-active-elevate)::after,
  .hover-elevate-2:not(.no-default-hover-elevate)::after,
  .active-elevate-2:not(.no-default-active-elevate)::after {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0px;
    /*border-radius: inherit;   match rounded corners */
    border-radius: inherit;
    z-index: 999;
    /* sits in front of content */
  }

  .hover-elevate:hover:not(.no-default-hover-elevate)::after,
  .active-elevate:active:not(.no-default-active-elevate)::after {
    background-color: var(--elevate-1);
  }

  .hover-elevate-2:hover:not(.no-default-hover-elevate)::after,
  .active-elevate-2:active:not(.no-default-active-elevate)::after {
    background-color: var(--elevate-2);
  }

  /* If there's a 1px border, adjust the inset so that it covers that parent's border */
  .border.hover-elevate:not(.no-hover-interaction-elevate)::after,
  .border.active-elevate:not(.no-active-interaction-elevate)::after,
  .border.hover-elevate-2:not(.no-hover-interaction-elevate)::after,
  .border.active-elevate-2:not(.no-active-interaction-elevate)::after,
  .border.hover-elevate:not(.no-hover-interaction-elevate)::after {
    inset: -1px;
  }
}

/* Global subtle scrollbar — applies to all elements for consistent styling */
* {
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--muted-foreground) / 0.3) transparent;
}
*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 9999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}
*::-webkit-scrollbar-button {
  display: none;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Dark mode: bump thumb to be slightly lighter */
.dark * {
  scrollbar-color: hsl(var(--muted-foreground) / 0.45) transparent;
}
.dark *::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.45);
}
.dark *::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.65);
}

/* Force all Radix popper wrappers (tooltips, dropdowns, etc.) above dialogs */
[data-radix-popper-content-wrapper] {
  z-index: 9999 !important;
}

/* Review row exit animation — blue flash then fade+collapse */
@keyframes row-link-exit {
  0%   { background: hsl(217 91% 60% / 0.22); opacity: 1;   max-height: 80px; }
  60%  { background: hsl(217 91% 60% / 0.06); opacity: 0.4; max-height: 80px; }
  100% { background: transparent;             opacity: 0;   max-height: 0; padding-top: 0; padding-bottom: 0; }
}
.row-link-exit {
  animation: row-link-exit 440ms ease-out forwards;
  pointer-events: none;
  overflow: hidden;
}