/** @css {"owns":"magicTV base styles, theme variables, responsive layout"} */

:root {
    /* Accent pairs (Miami Vice defaults; Appearance may override) */
    --tv-main-1: #00FFFF;
    --tv-main-1-flip: #FF00FF;
    --tv-main-2: #00FF88;
    --tv-main-2-flip: #FF00FF;
    --tv-main-3: #FF00FF;
    --tv-main-3-flip: #00FFFF;

    /* Legacy aliases */
    --tv-primary: var(--tv-main-1);
    --tv-accent: var(--tv-main-2);
    --tv-secondary: var(--tv-main-3);

    /* Surfaces */
    --tv-bg: #0A0E27;
    --tv-bg-secondary: #141829;
    --tv-border: #2A2E3A;
    --tv-border-light: #3A3E4A;

    /* Text */
    --tv-text-primary: #FFFFFF;
    --tv-text-secondary: #B3B3B3;
    --tv-text-muted: #737373;
    --tv-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Shadows (fixed black-alpha; not theme-editable) */
    --tv-shadow: 0 4px 16px rgb(0 0 0 / 0.4);
    --tv-shadow-sm: 0 2px 8px rgb(0 0 0 / 0.3);
    
    /* Spacing */
    --tv-spacing-xs: 0.25rem;
    --tv-spacing-sm: 0.5rem;
    --tv-spacing-md: 1rem;
    --tv-spacing-lg: 1.5rem;
    --tv-spacing-xl: 2rem;
    
    /* Border radius */
    --tv-radius-sm: 4px;
    --tv-radius-md: 8px;
    --tv-radius-lg: 12px;
    
    /* Transitions */
    --tv-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Round icon-button recipe (magicTV-wide, currentColor-driven).
       Two variants, one recipe:
       - solid (magic remote leads): ring + disc visible at rest
       - ghost (overlay TVs): transparent at rest, same shades on hover/toggle
       Consume as color-mix(in srgb, currentColor <token>, transparent). */
    --btn-ring: 22%;
    --btn-tint: 10%;
    --btn-ring-hover: 35%;
    --btn-tint-hover: 18%;
    --btn-ring-active: 45%;
    --btn-tint-active: 24%;
    --btn-press-scale: 1.04;

    /* Catalog tile hover pop — tiles and list rows share .channel-tile,
       so one token drives the popout in both grid and list layouts. */
    --tile-hover-scale: 1.03;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    background: var(--tv-bg);
    color: var(--tv-text-primary);
    font-family: var(--tv-font-family);
    line-height: 1.5;
    height: 100%;
    overflow: hidden;
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1rem;
}

p {
    margin-bottom: var(--tv-spacing-md);
    color: var(--tv-text-secondary);
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--tv-transition);
    border-radius: var(--tv-radius-sm);
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--tv-text-primary);
}

button:hover {
    background: color-mix(in srgb, var(--tv-primary) 10%, transparent);
    border-color: var(--tv-primary);
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Links */
a {
    color: var(--tv-primary);
    text-decoration: none;
    transition: var(--tv-transition);
}

a:hover {
    color: var(--tv-secondary);
    text-decoration: underline;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--tv-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--tv-border-light);
    border-radius: var(--tv-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--tv-primary);
}

/* Input fields */
input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    background: var(--tv-bg-secondary);
    border: 1px solid var(--tv-border-light);
    color: var(--tv-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--tv-radius-sm);
    transition: var(--tv-transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--tv-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--tv-primary) 10%, transparent);
}

input::placeholder {
    color: var(--tv-text-muted);
}

/* Utility classes */
.is-hidden {
    display: none !important;
}

/* Responsive grid mixin values */
@media (max-width: 480px) {
    :root {
        --tv-grid-cols: 2;
        --tv-grid-gap: 0.5rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --tv-grid-cols: 3;
        --tv-grid-gap: 0.75rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --tv-grid-cols: 4;
        --tv-grid-gap: 1rem;
    }
}

@media (min-width: 1025px) {
    :root {
        --tv-grid-cols: 5;
        --tv-grid-gap: 1rem;
    }
}

/* Touch target minimum size (accessibility) */
@media (pointer: coarse) {
    button, a, [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
