@import "tw-animate-css";
@import "tailwindcss";
@import "@fontsource-variable/lora";

@custom-variant dark (&:is(.dark *));

/* ── shadcn preset: radix-lyra (b6G4G2P4q) ─────────────────────────────── */

:root {
  --font-serif: 'Lora Variable', serif;
  --font-heading: var(--font-serif);
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, monospace;

  --background: hsl(0 0% 7%);
  --foreground: hsl(0 0% 98%);
  --card: hsl(0 0% 10%);
  --card-foreground: hsl(0 0% 98%);
  --popover: hsl(0 0% 10%);
  --popover-foreground: hsl(0 0% 98%);
  --primary: hsl(45 85% 55%);
  --primary-foreground: hsl(45 80% 15%);
  --secondary: hsl(0 0% 16%);
  --secondary-foreground: hsl(0 0% 98%);
  --muted: hsl(0 0% 16%);
  --muted-foreground: hsl(0 0% 63%);
  --accent: hsl(0 0% 16%);
  --accent-foreground: hsl(0 0% 98%);
  --destructive: hsl(0 50% 54%);
  --destructive-foreground: hsl(0 0% 98%);
  --border: hsl(0 0% 20%);
  --input: hsl(0 0% 20%);
  --ring: hsl(45 85% 55%);
  --radius: 0;
  --chart-1: hsl(45 85% 55%);
  --chart-2: hsl(160 40% 45%);
  --chart-3: hsl(30 65% 55%);
  --chart-4: hsl(280 40% 50%);
  --chart-5: hsl(340 50% 50%);
  --sidebar-background: hsl(0 0% 7%);
  --sidebar-foreground: hsl(0 0% 98%);
  --sidebar-primary: hsl(45 85% 55%);
  --sidebar-primary-foreground: hsl(45 80% 15%);
  --sidebar-accent: hsl(0 0% 16%);
  --sidebar-accent-foreground: hsl(0 0% 98%);
  --sidebar-border: hsl(0 0% 20%);
  --sidebar-ring: hsl(45 85% 55%);

  --color-success: hsl(140 25% 49%);
  --color-danger: hsl(0 50% 54%);
  --color-warning: hsl(45 85% 55%);
}

.dark {
  --background: hsl(0 0% 7%);
  --foreground: hsl(0 0% 98%);
  --card: hsl(0 0% 10%);
  --card-foreground: hsl(0 0% 98%);
  --popover: hsl(0 0% 10%);
  --popover-foreground: hsl(0 0% 98%);
  --primary: hsl(45 85% 55%);
  --primary-foreground: hsl(45 80% 15%);
  --secondary: hsl(0 0% 16%);
  --secondary-foreground: hsl(0 0% 98%);
  --muted: hsl(0 0% 16%);
  --muted-foreground: hsl(0 0% 63%);
  --accent: hsl(0 0% 16%);
  --accent-foreground: hsl(0 0% 98%);
  --destructive: hsl(0 50% 54%);
  --destructive-foreground: hsl(0 0% 98%);
  --border: hsl(0 0% 20%);
  --input: hsl(0 0% 20%);
  --ring: hsl(45 85% 55%);
}

/* ── shadcn/tailwind.css — custom variants + animations ─────────────────── */

@theme inline {
  @keyframes accordion-down {
    from { height: 0; }
    to { height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto)); }
  }
  @keyframes accordion-up {
    from { height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto)); }
    to { height: 0; }
  }
}

@custom-variant data-open {
  &:where([data-state="open"]),
  &:where([data-open]:not([data-open="false"])) { @slot; }
}
@custom-variant data-closed {
  &:where([data-state="closed"]),
  &:where([data-closed]:not([data-closed="false"])) { @slot; }
}
@custom-variant data-checked {
  &:where([data-state="checked"]),
  &:where([data-checked]:not([data-checked="false"])) { @slot; }
}
@custom-variant data-unchecked {
  &:where([data-state="unchecked"]),
  &:where([data-unchecked]:not([data-unchecked="false"])) { @slot; }
}
@custom-variant data-selected {
  &:where([data-selected="true"]) { @slot; }
}
@custom-variant data-disabled {
  &:where([data-disabled="true"]),
  &:where([data-disabled]:not([data-disabled="false"])) { @slot; }
}
@custom-variant data-active {
  &:where([data-state="active"]),
  &:where([data-active]:not([data-active="false"])) { @slot; }
}
@custom-variant data-horizontal {
  &:where([data-orientation="horizontal"]) { @slot; }
}
@custom-variant data-vertical {
  &:where([data-orientation="vertical"]) { @slot; }
}

@utility no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  &::-webkit-scrollbar { display: none; }
}

/* ── Theme mapping ──────────────────────────────────────────────────────── */

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar-background: var(--sidebar-background);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-success: var(--color-success);
  --color-danger: var(--color-danger);
  --color-warning: var(--color-warning);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --font-sans: var(--font-sans);
  --font-mono: var(--font-mono);
  --font-serif: var(--font-serif);
}

/* ── Base layer ─────────────────────────────────────────────────────────── */

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
    font-family: var(--font-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ── radix-lyra preset classes (cn-* marker classes) ────────────────────── */

/* Font heading marker — applied to CardTitle, DialogTitle, etc. */
.cn-font-heading {
  font-family: var(--font-heading);
}

/* Item component variants — matches style-lyra.css definitions */
.cn-item {
  @apply [a]:hover:bg-muted rounded-none border text-xs;
}
.cn-item-variant-default {
  @apply border-transparent;
}
.cn-item-variant-outline {
  @apply border-border;
}
.cn-item-variant-muted {
  @apply bg-muted/50 border-transparent;
}
.cn-item-size-default {
  @apply gap-2.5 px-3 py-2.5;
}
.cn-item-size-sm {
  @apply gap-2.5 px-3 py-2.5;
}
.cn-item-size-xs {
  @apply gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0;
}
.cn-item-media {
  @apply flex shrink-0 items-center justify-center [&_svg]:pointer-events-none;
}
.cn-item-media-variant-default {
  @apply gap-2.5;
}
.cn-item-media-variant-icon {
  @apply size-6 items-start;
}
.cn-item-media-variant-image {
  @apply size-10 overflow-hidden rounded-none group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover;
}
.cn-item-content {
  @apply gap-1 group-data-[size=xs]/item:gap-0;
}
.cn-item-title {
  @apply gap-2 text-xs font-medium underline-offset-4;
}
.cn-item-description {
  @apply text-muted-foreground text-left text-xs/relaxed group-data-[size=xs]/item:text-xs/relaxed;
}
.cn-item-actions {
  @apply gap-2;
}
.cn-item-header {
  @apply gap-2;
}
.cn-item-footer {
  @apply gap-2;
}
.cn-item-group {
  @apply gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2;
}
.cn-item-separator {
  @apply my-2;
}

/* ── Splint-specific utilities ─────────────────────────────────────────── */

.balance-bar {
  height: 6px;
  background: hsl(0 0% 10%);
  border-radius: 0;
  overflow: hidden;
  min-width: 40px;
}

.balance-bar-fill {
  height: 100%;
  border-radius: 0;
  transition: width 0.3s ease;
}

.balance-bar-fill.credit {
  background: var(--color-success);
}

.balance-bar-fill.owed {
  background: var(--color-danger);
}
