/* =====================================================
   Global Design System — RapiX Solutions
   Define ONCE here. Every section CSS references these
   vars. Nothing hardcoded anywhere else.
   ===================================================== */

/* ---- Design Tokens (:root) ---- */

:root {
    /* --- Typography Scale --- */
    --text-hero:    3.75rem;   /* 60px — H1 hero        */
    --text-h1:      3rem;      /* 48px — page title     */
    --text-h2:      2.25rem;   /* 36px — section head   */
    --text-h3:      1.5rem;    /* 24px — card/sub head  */
    --text-h4:      1.25rem;   /* 20px — minor head     */
    --text-body-lg: 1.125rem;  /* 18px — lead text      */
    --text-body:    1rem;      /* 16px — body           */
    --text-sm:      0.875rem;  /* 14px — small          */
    --text-xs:      0.75rem;   /* 12px — caption/label  */

    /* --- Line Heights --- */
    --leading-heading: 1.15;
    --leading-snug:    1.3;
    --leading-body:    1.65;
    --leading-loose:   1.8;

    /* --- Font Weights --- */
    --fw-regular:   400;
    --fw-medium:    500;
    --fw-semibold:  600;
    --fw-bold:      700;
    --fw-extrabold: 800;

    /* --- Spacing Scale (base-8) --- */
    --space-1:  0.25rem;   /*  4px */
    --space-2:  0.5rem;    /*  8px */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.5rem;    /* 24px */
    --space-8:  2rem;      /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */
    --space-32: 8rem;      /* 128px */

    /* --- Border Radius --- */
    --radius-sm:   0.375rem;   /*  6px */
    --radius-md:   0.5rem;     /*  8px */
    --radius-lg:   0.75rem;    /* 12px */
    --radius-xl:   1rem;       /* 16px */
    --radius-2xl:  1.5rem;     /* 24px */
    --radius-full: 9999px;

    /* --- Shadows --- */
    --shadow-xs: 0 1px 3px  rgba(11, 15, 42, 0.06);
    --shadow-sm: 0 2px 8px  rgba(11, 15, 42, 0.08);
    --shadow-md: 0 4px 16px rgba(11, 15, 42, 0.10);
    --shadow-lg: 0 8px 32px rgba(11, 15, 42, 0.12);
    --shadow-xl: 0 16px 48px rgba(11, 15, 42, 0.14);

    /* --- Transitions --- */
    --ease-fast:   0.15s ease;
    --ease-base:   0.2s ease;
    --ease-slow:   0.3s ease;
    --ease-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* --- Z-Index --- */
    --z-base:    1;
    --z-raised:  10;
    --z-dropdown:100;
    --z-header:  1000;
    --z-overlay: 1050;
    --z-drawer:  1100;
    --z-modal:   1200;
    --z-tooltip: 1300;

    /* --- On-dark text and surfaces (used in footer, dark cards, dark sections) --- */
    --color-on-dark:        rgba(255, 255, 255, 0.82);  /* default body text on dark */
    --color-on-dark-strong: rgba(255, 255, 255, 0.95);  /* high-emphasis text */
    --color-on-dark-soft:   rgba(255, 255, 255, 0.65);  /* secondary text */
    --color-on-dark-faint:  rgba(255, 255, 255, 0.45);  /* tertiary text */
    --color-on-dark-dim:    rgba(255, 255, 255, 0.35);  /* very dim text */
    --color-on-dark-line:   rgba(255, 255, 255, 0.10);  /* dividers, borders */
    --color-on-dark-fill:   rgba(255, 255, 255, 0.08);  /* subtle surface fills */

    /* --- Layout --- */
    --container-max: 1280px;
    --container-px:  2rem;

    /* --- Section Spacing --- */
    --section-py: 6rem;
    --section-py-sm: calc(var(--section-py) * 0.6);
}

/* =====================================================
   Responsive Overrides — ALL breakpoints in one place
   ===================================================== */

/* Tablet — ≤ 1024px */
@media (max-width: 1024px) {
    :root {
        --text-hero:    3rem;
        --text-h1:      2.5rem;
        --text-h2:      2rem;
        --text-h3:      1.375rem;

        --container-px: 1.5rem;
        --section-py:   4.5rem;
    }
}

/* Large mobile — ≤ 768px */
@media (max-width: 768px) {
    :root {
        --text-hero:    2.375rem;
        --text-h1:      2rem;
        --text-h2:      1.75rem;
        --text-h3:      1.25rem;
        --text-body-lg: 1.0625rem;

        --container-px: 1.25rem;
        --section-py:   3.5rem;
    }
}

/* Small mobile — ≤ 640px */
@media (max-width: 640px) {
    :root {
        --text-hero:    2rem;
        --text-h1:      1.75rem;
        --text-h2:      1.5rem;
        --text-h3:      1.125rem;
        --text-h4:      1.0625rem;
        --text-body-lg: 1rem;

        --container-px: 1rem;
        --section-py:   3rem;
    }
}

/* =====================================================
   Base overrides — correct stale Tailwind compiled output
   ===================================================== */

body {
    background-color: var(--color-white);
    color: var(--color-body);
}

/* Headings always use the brand text color (deep navy) */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-text);
}

/* =====================================================
   Accessibility — skip link + focus styles
   ===================================================== */

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    text-decoration: none;
    z-index: var(--z-overlay);
    transition: top var(--ease-base);
}

.skip-link:focus {
    top: var(--space-4);
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* =====================================================
   Container — used by every section
   ===================================================== */

.rs-container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-px);
    padding-right: var(--container-px);
}

/* =====================================================
   Section Wrappers
   ===================================================== */

.rs-section {
    padding-top: var(--section-py);
    padding-bottom: var(--section-py);
}

.rs-section--sm {
    padding-top: var(--section-py-sm);
    padding-bottom: var(--section-py-sm);
}

/* Background variants */
.rs-section--white  { background-color: var(--color-white); }
.rs-section--light  { background-color: var(--color-bg); }
.rs-section--dark   { background-color: var(--color-text); color: var(--color-white); }
.rs-section--primary { background-color: var(--color-primary); color: var(--color-white); }

/* =====================================================
   Section Header — label + heading + subheading block
   Reused across every section.
   ===================================================== */

.rs-section-header {
    margin-bottom: var(--space-12);
}

.rs-section-header--center {
    text-align: center;
}

.rs-section-header--center .rs-section-sub {
    margin-left: auto;
    margin-right: auto;
}

/* Eyebrow / label */
.rs-section-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--text-xs);
    color: var(--color-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-3);
}

.rs-section-label::before {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* Section on dark bg */
.rs-section--dark   .rs-section-label,
.rs-section--primary .rs-section-label {
    color: var(--color-on-dark);
}

.rs-section--dark   .rs-section-label::before,
.rs-section--primary .rs-section-label::before {
    background-color: var(--color-on-dark);
}

/* Heading */
.rs-section-heading {
    font-family: var(--font-heading);
    font-weight: var(--fw-extrabold);
    font-size: var(--text-h2);
    line-height: var(--leading-heading);
    color: var(--color-text);
    margin-bottom: var(--space-4);
}

.rs-section--dark    .rs-section-heading,
.rs-section--primary .rs-section-heading {
    color: var(--color-white);
}

/* Subheading */
.rs-section-sub {
    font-family: var(--font-body);
    font-size: var(--text-body-lg);
    line-height: var(--leading-body);
    color: var(--color-muted);
    max-width: 58ch;
}

.rs-section--dark    .rs-section-sub,
.rs-section--primary .rs-section-sub {
    color: var(--color-on-dark-soft);
}

/* =====================================================
   Back to Top Button
   ===================================================== */

.back-to-top {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    z-index: var(--z-dropdown);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--ease-slow), visibility var(--ease-slow), transform var(--ease-slow), background-color var(--ease-base);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--color-primary-dark);
}

@media (max-width: 640px) {
    .back-to-top {
        bottom: var(--space-4);
        right: var(--space-4);
        width: 42px;
        height: 42px;
    }
}

/* =====================================================
   Highlight span — blue accent in headings
   e.g. <span class="rs-highlight">word</span>
   ===================================================== */

.rs-highlight {
    color: var(--color-primary);
}

/* =====================================================
   Divider
   ===================================================== */

.rs-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 0;
}
