/* ==========================================================================
   Design tokens — single source of truth for site-wide values.
   These are DEFINITIONS only. Consume via var(--token-name) in new code.
   No global cascade overrides here (would clash with main.css). The only
   exception is --font-primary, which is intentionally applied below.
   ========================================================================== */
:root {
    /* Brand palette — original tokens (kept) */
    --black-color: #000000;
    --white-color: #ffffff;
    --contrast: #222222;
    --contrast-2: #575760;
    --contrast-3: #b2b2be;
    --base: #f0f0f0;
    --base-2: #f7f8f9;
    --base-3: #ffffff;
    --accent: #88CB00;

    /* Accent variants — for hover, active, light backgrounds */
    --accent-hover: #7AB500;
    --accent-light: #E8F5C7;
    --accent-dark: #5A8800;

    /* Semantic color aliases — prefer these in new components */
    --color-text: var(--contrast);
    --color-text-muted: var(--contrast-2);
    --color-text-light: var(--contrast-3);
    --color-text-inverse: var(--white-color);
    --color-bg: var(--white-color);
    --color-bg-alt: var(--base-2);
    --color-bg-muted: var(--base);
    --color-border: #e5e5e5;
    --color-border-strong: #cccccc;
    --color-link: var(--accent);
    --color-link-hover: var(--accent-hover);

    /* Status / feedback */
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-error: #dc3545;
    --color-info: #17a2b8;

    /* Shadows (rgba already used 4× and 3× in main.css — aliased here) */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-soft: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 2px var(--shadow-color);
    --shadow-md: 0 4px 12px var(--shadow-color);
    --shadow-lg: 0 8px 24px var(--shadow-color);

    /* Typography
       Fallback chain matches Poppins x-height/letter-spacing closely so
       the swap from fallback → Poppins is visually minimal (less CLS). */
    --font-primary: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-heading: var(--font-primary);

    --fs-xs: 13px;
    --fs-sm: 14px;
    --fs-base: 15px;
    --fs-md: 17px;
    --fs-lg: 20px;
    --fs-xl: 24px;
    --fs-2xl: 29px;
    --fs-3xl: 35px;
    --fs-4xl: 42px;

    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    --lh-tight: 1.2;
    --lh-base: 1.5;
    --lh-relaxed: 1.8;

    /* Spacing scale (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Layout / containers */
    --container-max: 1200px;
    --container-narrow: 1024px;
    --container-padding: 20px;

    /* Border radius */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --radius-pill: 9999px;

    /* Motion */
    --transition-fast: 0.1s ease-in-out;
    --transition-base: 0.2s ease-in-out;
    --transition-slow: 0.3s ease-in-out;
}

/* Single intentional cascade rule — primary font for site + form controls.
   Inherits everywhere via body. */
body,
button,
input,
select,
textarea {
    font-family: var(--font-primary);
}

.site-logo {
    max-width: 200px;
}

/* ==========================================================================
   Back-to-top button
   GP base CSS (inc/css-output.php) sets position:fixed, opacity/translateY
   for the show/hide animation. We only override the visual surface here
   so the show/hide mechanic keeps working untouched.
   Mobile-first: 44px target meets WCAG tap-area minimum.
   ========================================================================== */
a.generate-back-to-top {
    position: fixed;
    top: auto;
    left: auto;
    right: var(--space-4);
    bottom: var(--space-4);
    width: 44px;
    height: 44px;
    line-height: 44px;
    border-radius: var(--radius-pill);
    background-color: var(--accent);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* opacity / transform are intentionally NOT overridden here.
       GP's base CSS hides the button (opacity:0.1, translateY(1000px))
       and its JS adds `.generate-back-to-top__show` after the user
       scrolls past `data-start-scroll` (set via the filter in
       sourcefuse-perf.php). The JS-driven appear handles visibility. */
    transition: background-color var(--transition-base),
                box-shadow var(--transition-base),
                opacity 0.3s ease-in-out,
                transform 0.3s ease-in-out;
}

a.generate-back-to-top:hover,
a.generate-back-to-top:focus {
    background-color: var(--accent-hover);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-lg);
}

a.generate-back-to-top .gp-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

@media (min-width: 768px) {
    a.generate-back-to-top {
        width: 48px;
        height: 48px;
        line-height: 48px;
        bottom: var(--space-6);
        right: var(--space-6);
    }
    a.generate-back-to-top .gp-icon svg {
        width: 20px;
        height: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    a.generate-back-to-top {
        transition: opacity 0.3s ease-in-out;
    }
}