@import url('core/icons.css');
@import url('core/buttons.css');
@import url('core/badges.css');
@import url('core/forms.css');

/* Base page fade-in animation */
@keyframes page-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hard-load: animate direct children of body (excluding header/nav) */
body > *:not(header):not(nav) {
    animation: page-fade-in 0.25s ease-out both;
}

/* HTMX swap: re-trigger animation on content swapped into #main-content */
#main-content.page-transitioning > * {
    animation: page-fade-in 0.25s ease-out both;
}

/* Base CSS */
:root {
    /* ── Brand / palette tokens ─────────────────────────────────────────────
     * Fixed values that do not change between themes.
     * Do not use these directly in component styles — use the semantic
     * tokens below instead.
     * -------------------------------------------------------------------- */
    --primary: #155dfc;
    --primary-light: #63a4ff;
    --primary-dark: #0e4bbf;
    --secondary: #2d3748;
    --secondary-light: #4a5568;
    --secondary-dark: #1a202c;
    --error: #e53e3e;
    --error-light: #f56565;
    --error-dark: #c53030;
    --danger: #e53e3e;
    --danger-dark: #c53030;
    --success: #38a169;
    --success-light: #68d391;
    --success-dark: #2f855a;
    --info: #3182ce;
    --info-light: #63b3ed;
    --info-dark: #2b6cb0;
    --warning: #dd6b20;
    --warning-light: #f6ad55;
    --warning-dark: #c05621;
    --white: #ffffff;
    --black: #000000;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;
    --call-to-action: #ff6900;
    --call-to-action-light: #ff9f00;
    --call-to-action-dark: #f54a00;

    /* Screen Sizes */
    --screen-sm: 640px;
    --screen-md: 768px;
    --screen-lg: 1024px;
    --screen-xl: 1280px;
    --screen-2xl: 1536px;
    --screen-3xl: 1920px;
    --screen-4xl: 2560px;
    --screen-5xl: 3840px;

    /* File */
    --max-file-editor-height: 67vh;

    /* ── Semantic surface tokens (light theme defaults) ──────────────────────
     * Components must use these tokens instead of raw --gray-* or --white so
     * that the theme can be changed by overriding only these values.
     *
     * To apply a theme, load its file after base.css in your HTML:
     *   <link rel="stylesheet" href="/v1/base.css">
     *   <link rel="stylesheet" href="/v1/themes/dark.css">
     *
     * Available themes: themes/dark.css, themes/light.css
     * -------------------------------------------------------------------- */

    /* Page / app background */
    --bg: var(--white);

    /* Card / panel surfaces */
    --surface-1: var(--gray-100);   /* primary card background        */
    --surface-2: var(--gray-200);   /* elevated card / input bg       */
    --surface-3: var(--gray-300);   /* hover state, nested surfaces   */

    /* Borders */
    --border: var(--gray-300);
    --border-subtle: var(--gray-200);

    /* Text */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-700);
    --text-muted: var(--gray-500);

    /* Overlay / drawer */
    --overlay-bg: var(--white);
    --overlay-shadow: rgba(0, 0, 0, 0.2);
}

body {
    font-family: "Inter", sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    margin: 0;
}

/* Got some warning in the browser for headings in sections. Did this to shut it up. */
:where(section h1) {
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

body.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Helper classes */

/* Clean hyper links */
a.clean-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;

    &:hover {
        text-decoration: underline;
    }

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