/* CatTail CSS Custom Properties (Variables) */
:root {
    /* Primary Colors */
    --color-primary: #0d6efd;
    --color-primary-dark: #0a58ca;
    --color-primary-light: #3d8bfd;
    
    /* Status Colors. The readiness palette is the §7 color convention
       rev 2 — the HEAT LADDER (docs/archive/owned_installed_terminology_audit.md):
       grey = nothing to do, green = installable now, olive = exists unowned
       (acquire); the warm rungs climb without advice: yellow = checking /
       in-flight (no state emits it yet), orange = unknown / no verdict,
       error = the data is known-wrong, red reserved for hard failures. */
    --color-success: #198754;
    --color-partial: #8ca42d;
    --color-warning: #ffc107;
    --color-unknown: #ed631d;
    --color-error: #e44029;
    --color-danger: #dc3545;
    --color-info: #0dcaf0;
    --color-secondary: #6c757d;
    --color-info-dark: #0a9bbf;
    --color-danger-dark: #b02a37;
    
    /* Neutral Colors */
    --color-white: #ffffff;
    --color-black: #000000;
    --color-dark: #212529;
    --color-light: #f8f9fa;
    
    /* Background Colors */
    --bg-primary: rgba(255, 255, 255, 0.05);
    --bg-secondary: rgba(255, 255, 255, 0.08);
    --bg-overlay: rgba(0, 0, 0, 0.6);
    --bg-card-gradient: linear-gradient(to top, rgba(7, 0, 91, 0.71), #001233a1);

    /* The flattened backdrop a data-list row sits on, and the two translucent
       overlays drawn on top of it. Nothing paints list rows themselves
       (.list-row in components.css is deliberately background-free), so these
       exist for the frozen identity strip, which has to be opaque and has to
       paint exactly what is beside it (docs/responsive-conventions.md).

       --bg-list-surface reads the same variable the page paints with rather
       than a literal, so it follows the theme. Each percentage below mirrors
       the alpha of the rule it flattens — .list-row:hover is 0.06 and
       .list-header-row is 0.08 — because an opaque equivalent is the only way
       to draw that tint over an opaque surface. T18 walks the real ancestor
       stack and fails if any of the three stops describing what is there. */
    --bg-list-surface: var(--bs-body-bg);
    --list-row-hover-opaque: color-mix(in srgb, #ffffff 6%, var(--bg-list-surface));
    --list-header-opaque: color-mix(in srgb, #ffffff 8%, var(--bg-list-surface));

    /* The floor under the two columns a list row may not squeeze away: Title,
       which is the row's identity, and Category, the context it is read in.
       Both are fr tracks, and because every list cell carries min-width: 0 the
       tracks resolved to 0px as soon as the row was over-constrained — the
       cell's own overflow: hidden then clipped the name away, so at or below a
       ~576px viewport a list row showed a checkbox, an icon and the status
       columns, and no title at all.

       0px here means "no floor": above the mobile seam the row has room and its
       two flexible tracks should simply divide it by their fr ratio. The seam in
       views.css raises these to real lengths, where the row has to scroll
       whatever we do — so scrolling with a readable name costs nothing there,
       and the desktop side keeps the layout it has. T19 asserts both halves of
       that, either side of the seam.

       A floor put on the TRACK (components.css) rather than as min-width on the
       cell, because #stagingListContainer .list-col-title sets min-width: 0 at a
       higher specificity and would have zeroed a cell-level floor silently.
       docs/responsive-conventions.md section 2b has the measured widths. */
    --list-title-floor: 0px;
    --list-category-floor: 0px;

    /* The one track set both list surfaces are laid out on, read by the sort bar
       (components.css), the rows (components.css) and the wrapper that owns the
       grid in list mode (views.css). One declaration, because two copies of a
       template this long drift: the bar and the rows did exactly that once, and
       T17c is the check that caught it.

       The six status tracks cap at their former px width and take their minimum
       from their content — see components.css for why that is min-content rather
       than auto. The two text tracks carry the floors above. */
    --list-template: minmax(min-content, 40px) minmax(min-content, 100px) minmax(var(--list-title-floor), 2fr) minmax(var(--list-category-floor), 1.5fr) minmax(min-content, 80px) minmax(min-content, 80px) minmax(min-content, 50px) minmax(min-content, 80px);

    
    /* Border Colors */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-light: #d5d5d5bd;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.7);
    
    /* Spacing Scale */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-xxl: 3rem;     /* 48px */
    
    /* Typography */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-monospace: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Border Radius */
    --radius-sm: 0.25rem;   /* 4px */
    --radius-md: 0.375rem;  /* 6px */
    --radius-lg: 0.5rem;    /* 8px */
    --radius-xl: 0.75rem;   /* 12px */
    --radius-2xl: 1rem;     /* 16px */
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-slower: 500ms ease;
    
    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* Responsive Breakpoints (matching Bootstrap) */
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;
    
    /* Container Max Widths */
    --container-max-sm: 540px;
    --container-max-md: 720px;
    --container-max-lg: 960px;
    --container-max-xl: 1140px;
    --container-max-xxl: 1320px;
    
    /* Card Size Scale (for game cards) */
    --card-size-1: 9;   /* 9 columns */
    --card-size-2: 7;   /* 7 columns */
    --card-size-3: 5;   /* 5 columns */
    --card-size-4: 3;   /* 3 columns */
    --card-size-5: 2;   /* 2 columns */

    /* Gap-aware grid track minimums for the Card Size scale. An N-column
       grid loses (N-1) × --spacing-md to inter-column gutters, so a bare
       100%/N minimum fits only N-1 columns at some widths ("could fit
       another column, but doesn't"). The -0.5px epsilon absorbs sub-pixel
       rounding so exactly N tracks always resolve; 1fr stretches them back
       to equal width. Used by the card, icon and smart view grids. */
    --card-track-1: calc((100% - (var(--card-size-1) - 1) * var(--spacing-md)) / var(--card-size-1) - 0.5px);
    --card-track-2: calc((100% - (var(--card-size-2) - 1) * var(--spacing-md)) / var(--card-size-2) - 0.5px);
    --card-track-3: calc((100% - (var(--card-size-3) - 1) * var(--spacing-md)) / var(--card-size-3) - 0.5px);
    --card-track-4: calc((100% - (var(--card-size-4) - 1) * var(--spacing-md)) / var(--card-size-4) - 0.5px);
    --card-track-5: calc((100% - (var(--card-size-5) - 1) * var(--spacing-md)) / var(--card-size-5) - 0.5px);

    /* Smart View Category Card Size scale + track minimums. This ladder is
       DELIBERATELY SEPARATE from the shared --card-track-* above (which card /
       icon views consume). Smart view dropped the old 9-column (narrowest)
       option and added a NEW 1-column (biggest-box) slot at the far right, so
       the 5 slider positions now mean 7 / 5 / 3 / 2 / 1 columns. Same gap-aware
       formula: a bare 100%/N minimum fits only N-1 columns at some widths, so
       the -0.5px epsilon absorbs sub-pixel rounding and 1fr stretches the
       tracks back to equal width. Repointed ONLY by the
       #gameGrid.smart-view[data-card-size=N] selectors in views.css. */
    --smart-card-size-1: 7;
    --smart-card-size-2: 5;
    --smart-card-size-3: 3;
    --smart-card-size-4: 2;
    --smart-card-size-5: 1;
    --smart-card-track-1: calc((100% - (var(--smart-card-size-1) - 1) * var(--spacing-md)) / var(--smart-card-size-1) - 0.5px);
    --smart-card-track-2: calc((100% - (var(--smart-card-size-2) - 1) * var(--spacing-md)) / var(--smart-card-size-2) - 0.5px);
    --smart-card-track-3: calc((100% - (var(--smart-card-size-3) - 1) * var(--spacing-md)) / var(--smart-card-size-3) - 0.5px);
    --smart-card-track-4: calc((100% - (var(--smart-card-size-4) - 1) * var(--spacing-md)) / var(--smart-card-size-4) - 0.5px);
    --smart-card-track-5: calc((100% - (var(--smart-card-size-5) - 1) * var(--spacing-md)) / var(--smart-card-size-5) - 0.5px);

    /* Groups-page Card Size scale + track minimums. Deliberately coarser
       than the Library's (wider group cards): 6/4/3/2/1.5 columns. Track
       vars follow the same gap-aware formula as --card-track-* but use the
       Groups grid's own gutter (--groups-grid-gap, consumed by
       .groups-grid too), so exactly N tracks always resolve there too. */
    --groups-grid-gap: 0.75rem;
    /* The narrowest a group card may get. Its header has to hold the name, the
       delete control and the sync checkbox, and the card's chrome does not
       shrink: without a floor, auto-fill drew 45px-wide cards on a phone whose
       header cluster was 145px, painting the controls outside the card. Every
       desktop rung is already wider than this, so it only bites on narrow
       viewports, where it means fewer, wider columns. Consumed by the
       max() floor in .groups-grid[data-card-size=N] (groups.html). */
    --groups-card-min-width: 130px;
    --groups-card-size-1: 6;
    --groups-card-size-2: 4;
    --groups-card-size-3: 3;
    --groups-card-size-4: 2;
    --groups-card-size-5: 1.5;
    --groups-track-1: calc((100% - (var(--groups-card-size-1) - 1) * var(--groups-grid-gap)) / var(--groups-card-size-1) - 0.5px);
    --groups-track-2: calc((100% - (var(--groups-card-size-2) - 1) * var(--groups-grid-gap)) / var(--groups-card-size-2) - 0.5px);
    --groups-track-3: calc((100% - (var(--groups-card-size-3) - 1) * var(--groups-grid-gap)) / var(--groups-card-size-3) - 0.5px);
    --groups-track-4: calc((100% - (var(--groups-card-size-4) - 1) * var(--groups-grid-gap)) / var(--groups-card-size-4) - 0.5px);
    --groups-track-5: calc((100% - (var(--groups-card-size-5) - 1) * var(--groups-grid-gap)) / var(--groups-card-size-5) - 0.5px);
    
    /* Badge Sizes */
    --badge-font-size-base: 0.75em;
    --badge-padding-y: 0.15em;
    --badge-padding-x: 0.4em;
    
    /* Game Card Specific */
    --game-card-overlay-padding: 8px;
    --game-card-badge-gap: 2px;
    --game-card-title-size: var(--font-size-base);
}

/* Dark theme specific overrides */
[data-bs-theme="dark"] {
    --color-body: #212529;
    --color-text: #ffffff;
    --bg-body: #212529;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: rgba(255, 255, 255, 0.3);
        --text-secondary: rgba(255, 255, 255, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    :root {
        --transition-fast: 0ms;
        --transition-base: 0ms;
        --transition-slow: 0ms;
    }
}