/*
 * Fi1m — Base: design tokens, themes, reset
 * ==========================================
 * Dark is the default theme. Light overrides via [data-theme="light"].
 * Every colour used anywhere in the site should resolve to a token here.
 */

:root {
    /* Brand */
    --primary: #EA4C42;
    --primary-rgb: 234, 76, 66;
    --primary-dark: #d33e34;
    --link-hover: #f06a62;
    --accent-ai: #3A66FF;

    /* Status */
    --positive-color: #4CD964;
    --mixed-color: #FF9500;
    --negative-color: #FF3B30;

    /* Type */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Layout */
    --container-max: 1200px;
    --container-pad: 20px;
    --radius: 8px;
    --radius-lg: 12px;

    /* Dark theme (default) */
    --background: #121212;
    --background-rgb: 18, 18, 18;
    --card-background: #1e1e1e;
    --card-border: rgba(255, 255, 255, 0.05);
    --card-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    --border-color: #2a2a2a;

    --heading-color: #ffffff;
    --text-color: #F8F9FA;
    --text-color-muted: #a0a0a0;
    --gray: #8a919a;
    --light-gray: #e9ecef;

    --search-background: rgba(255, 255, 255, 0.08);
    --search-focus-background: rgba(255, 255, 255, 0.14);
    --placeholder-color: rgba(255, 255, 255, 0.5);
    --tag-background: rgba(234, 76, 66, 0.15);

    --overlay-gradient: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 30%, rgba(0,0,0,0.6) 50%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0) 100%);
    --theme-toggle-bg: #2a2a2a;
    --theme-toggle-text: #ffffff;
}

[data-theme="light"] {
    --background: #ffffff;
    --background-rgb: 255, 255, 255;
    --card-background: #f6f7f8;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --border-color: #e3e6ea;

    --heading-color: #111418;
    --text-color: #212529;
    --text-color-muted: #5c636b;
    --gray: #6c757d;
    --light-gray: #ced4da;

    --search-background: rgba(0, 0, 0, 0.05);
    --search-focus-background: rgba(0, 0, 0, 0.09);
    --placeholder-color: rgba(0, 0, 0, 0.45);
    --tag-background: rgba(234, 76, 66, 0.1);

    --overlay-gradient: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.7) 30%, rgba(0,0,0,0.5) 60%, rgba(0,0,0,0.3) 80%, transparent 100%);
    --link-hover: #d33e34;
    --theme-toggle-bg: #e9ecef;
    --theme-toggle-text: #212529;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover);
}

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

input,
textarea {
    font-family: inherit;
}

h1, h2, h3, h4 {
    color: var(--heading-color);
    line-height: 1.25;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* While the theme flips, no element animates its colours (set by site.js for one frame) */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
    transition: none !important;
}

/* Theme-dependent assets: show one of a pair depending on theme */
.theme-light-only { display: none; }
[data-theme="light"] .theme-light-only { display: block; }
[data-theme="light"] .theme-dark-only { display: none; }
