/* ==========================================================================
   Capstone theme for Plane
   Injected by the nginx layer in front of plane-proxy.

   Strategy: override Plane's PRIMITIVE design tokens (--brand-*), not its
   component classes. Everything semantic (--border-color-accent-strong,
   --background-color-accent-primary, ...) already resolves through these,
   so retinting the primitives retints the entire application and keeps
   working across Plane upgrades.

   Plane scopes its palettes with [data-theme*=light] / [data-theme*=dark].
   This sheet loads after Plane's, so equal-specificity rules win on order.
   ========================================================================== */

/* ---------- Light ---------- */
[data-theme*="light"] {
  --brand-100:  oklch(98.4% 0.012 295);
  --brand-200:  oklch(96.9% 0.024 295);
  --brand-300:  oklch(94.1% 0.048 295);
  --brand-400:  oklch(89.8% 0.080 295);
  --brand-500:  oklch(83.6% 0.120 294);
  --brand-600:  oklch(75.5% 0.160 294);
  --brand-700:  oklch(62.0% 0.205 293);
  --brand-800:  oklch(55.0% 0.200 292);
  --brand-900:  oklch(48.0% 0.180 291);
  --brand-1000: oklch(40.0% 0.150 290);
  --brand-1100: oklch(32.0% 0.115 289);
  --brand-1200: oklch(24.0% 0.080 288);
  --brand-default: oklch(62.0% 0.205 293);

  --cap-shadow-sm: 0 1px 2px oklch(24% 0.05 290 / 0.06),
                   0 1px 3px oklch(24% 0.05 290 / 0.05);
  --cap-shadow-md: 0 2px 4px oklch(24% 0.05 290 / 0.06),
                   0 6px 16px oklch(24% 0.05 290 / 0.08);
  --cap-shadow-lg: 0 8px 24px oklch(24% 0.05 290 / 0.10),
                   0 2px 6px oklch(24% 0.05 290 / 0.06);
  --cap-glow: oklch(62% 0.205 293 / 0.28);
  --cap-scroll-thumb: oklch(72% 0.05 292 / 0.45);
  --cap-scroll-thumb-hover: oklch(62% 0.12 293 / 0.65);
}

/* ---------- Dark ---------- */
[data-theme*="dark"] {
  --brand-100:  oklch(20.5% 0.035 292);
  --brand-200:  oklch(25.0% 0.052 292);
  --brand-300:  oklch(32.0% 0.072 293);
  --brand-400:  oklch(40.5% 0.098 293);
  --brand-500:  oklch(46.5% 0.118 293);
  --brand-600:  oklch(58.0% 0.160 294);
  --brand-700:  oklch(72.0% 0.178 295);
  --brand-800:  oklch(80.0% 0.140 296);
  --brand-900:  oklch(86.0% 0.105 297);
  --brand-1000: oklch(91.0% 0.070 298);
  --brand-1100: oklch(95.0% 0.045 299);
  --brand-1200: oklch(98.0% 0.022 300);
  --brand-default: oklch(72.0% 0.178 295);

  --cap-shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.30);
  --cap-shadow-md: 0 2px 6px oklch(0% 0 0 / 0.36),
                   0 8px 20px oklch(0% 0 0 / 0.28);
  --cap-shadow-lg: 0 10px 30px oklch(0% 0 0 / 0.45),
                   0 2px 8px oklch(0% 0 0 / 0.30);
  --cap-glow: oklch(72% 0.178 295 / 0.35);
  --cap-scroll-thumb: oklch(50% 0.04 292 / 0.55);
  --cap-scroll-thumb-hover: oklch(72% 0.14 295 / 0.70);
}

/* --------------------------------------------------------------------------
   Softer geometry. Plane's scale is quite tight; opening it up a little is
   most of the difference between "utility" and "considered".
   -------------------------------------------------------------------------- */
:root {
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-3xl: 1.75rem;
}

/* --------------------------------------------------------------------------
   Micro-interaction. Restrained on purpose: this is a tool people will use
   for hours, so motion is short, eased, and only on things you can act on.
   -------------------------------------------------------------------------- */
button,
a,
[role="button"],
[class*="cursor-pointer"] {
  transition: background-color 140ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 140ms cubic-bezier(0.4, 0, 0.2, 1),
              color 140ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 180ms cubic-bezier(0.34, 1.3, 0.64, 1);
}

button:active,
[role="button"]:active {
  transform: scale(0.985);
}

/* Focus rings in the brand colour rather than the browser default. */
:focus-visible {
  outline: 2px solid var(--brand-default);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Depth. Cards and menus read as surfaces rather than outlined rectangles.
   -------------------------------------------------------------------------- */
[class*="shadow-custom-shadow"],
[role="menu"],
[role="dialog"],
[role="listbox"] {
  box-shadow: var(--cap-shadow-lg) !important;
}

/* Kanban / list cards lift very slightly on hover. */
[class*="issue-block"]:hover,
[data-rbd-draggable-id]:hover {
  box-shadow: var(--cap-shadow-md);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Scrollbars. Small thing, disproportionate effect on how finished it feels.
   -------------------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--cap-scroll-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--cap-scroll-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background-color 160ms ease;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--cap-scroll-thumb-hover);
}

/* --------------------------------------------------------------------------
   Typography polish. Tighter tracking on headings, better numerals in tables
   and anywhere counts and dates line up in columns.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  letter-spacing: -0.017em;
}

table,
[class*="tabular"],
[class*="spreadsheet"] {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Sign-in screen. The one page every teammate sees before anything else,
   so it gets a slow brand-tinted wash instead of a flat panel.
   -------------------------------------------------------------------------- */
@keyframes cap-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

body:has(input[name="email"], input[type="password"])::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 42% at 18% 22%, var(--cap-glow), transparent 70%),
    radial-gradient(38% 38% at 82% 78%, var(--cap-glow), transparent 72%);
  filter: blur(18px);
  opacity: 0.85;
  animation: cap-drift 26s ease-in-out infinite;
}

body:has(input[name="email"], input[type="password"]) > * {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Respect the user's motion preference. Non-negotiable.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [class*="issue-block"]:hover,
  [data-rbd-draggable-id]:hover {
    transform: none;
  }
}
