/* ═══════════════════════════════════════════════════════════
   Theme — Variables, resets, typography, scrollbars, grain
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ─── Surfaces — Linear's dark mode palette ─── */
  --bg-0: #1a1a1e;
  --bg-1: #1e1f23;
  --bg-2: #25262b;
  --bg-3: #2c2d33;
  --bg-active: #35363d;

  /* ─── Borders ─── */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* ─── Text ─── */
  --text-primary: #e2e2e2;
  --text-secondary: #9b9ba4;
  --text-tertiary: #5e5e6a;
  --text-ghost: #3b3b44;

  /* ─── Accent ─── */
  --accent-primary: #5e6ad2;
  --accent-gold: #c4975a;
  --accent-blue: #5e6ad2;
  --accent-green: #4cb782;
  --accent-purple: #b36bd4;
  --accent-red: #d45252;
  --accent-amber: #e5a33d;
  --accent-teal: #5bb5c4;

  /* ─── Status — Linear status circle colors ─── */
  --status-backlog: #5e5e6a;
  --status-todo: #9b9ba4;
  --status-in-progress: #f2c94c;
  --status-in-review: #5e6ad2;
  --status-done: #4cb782;
  --status-cancelled: #5e5e6a;
  --status-draft: #e5a33d;

  /* ─── Priority — Linear style ─── */
  --priority-urgent: #f45858;
  --priority-high: #f59e0b;
  --priority-medium: #eab308;
  --priority-low: #6b7280;
  --priority-none: #3b3b44;

  /* ─── Sizing ─── */
  --sidebar-width: 240px;
  --panel-width: 480px;
  --row-height: 36px;
  --topbar-height: 44px;
  --filterbar-height: 36px;

  /* ─── Typography ─── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* ─── Transitions — Linear uses 150ms ─── */
  --duration-fast: 100ms;
  --duration-normal: 150ms;
  --duration-slow: 250ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* ─── Shadows — Linear style with cool blue-gray tint ─── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.6);

  /* ─── Radii — Linear uses very small radii (4px max) ─── */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
}

/* ─── Reset ─── */

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

html {
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-0);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ─── Typography ─── */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.625rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.077rem; }
h4 { font-size: 1rem; }

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-in-out);
}

a:hover {
  color: var(--text-primary);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.923rem;
}

/* ─── kbd styling ─── */

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 0.769rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  line-height: 1;
}

/* ─── Selection ─── */

::selection {
  background: rgba(94, 106, 210, 0.25);
  color: var(--text-primary);
}

/* ─── Focus ─── */

:focus-visible {
  outline: 1px solid var(--accent-primary);
  outline-offset: -1px;
  border-radius: var(--radius-sm);
}

/* ─── Base elements ─── */

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* ─── Film Grain Overlay ─── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ─── Utility Classes ─── */

.hidden {
  display: none !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: var(--font-mono);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Mark highlight (used in command palette fuzzy search) ─── */

mark {
  background: rgba(94, 106, 210, 0.25);
  color: var(--text-primary);
  border-radius: 1px;
}
