/* GlobalXess design tokens.
 * Single source of truth for brand colour, type, radius and shadow.
 * Used directly by the chrome (header, footer, mega-menu, sub-nav)
 * and by ad-hoc utility classes below. The page bodies still use the
 * compiled Tailwind utility classes that were exported from the
 * original design; the tokens are the values those map to. */
:root {
    --xs-color-primary: #ea580c;
    --xs-color-primary-strong: #c2410c;
    --xs-color-primary-soft: #fff7ed;
    --xs-color-secondary: #059669;
    --xs-color-text: #0f172a;
    --xs-color-text-muted: #475569;
    --xs-color-text-subtle: #64748b;
    --xs-color-surface: #ffffff;
    --xs-color-surface-soft: #f8fafc;
    --xs-color-surface-strong: #0f172a;
    --xs-color-border: #e2e8f0;
    --xs-color-border-strong: #cbd5e1;
    --xs-color-focus: #f97316;

    --xs-font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --xs-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --xs-radius-sm: 0.25rem;
    --xs-radius-md: 0.5rem;
    --xs-radius-lg: 0.75rem;

    --xs-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --xs-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --xs-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

    --xs-content-max: 64rem;

    --xs-z-header: 50;
    --xs-z-mega: 60;
    --xs-z-toast: 80;
}

@media (prefers-color-scheme: dark) {
    /* Phase 6 keeps the corporate palette light by default; a dark-mode
     * pass lives behind a future user toggle so search-engine snapshots
     * stay deterministic. The dark tokens land here when that toggle ships. */
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Mega-menu. Lives inside its trigger's <li> with position:relative,
 * so the menu sits directly below the trigger without JS coordinate
 * math. Both `hidden` and the `.is-open` class participate to make
 * sure no Tailwind preflight rule wins by accident. */
.xs-mega-host {
    position: relative;
}
.xs-mega {
    position: absolute;
    z-index: var(--xs-z-mega);
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    min-width: 640px;
    max-width: min(92vw, 880px);
    background: var(--xs-color-surface);
    border: 1px solid var(--xs-color-border);
    border-radius: var(--xs-radius-lg);
    box-shadow: var(--xs-shadow-lg);
    padding: 1.25rem;
    display: none;
}
.xs-mega[hidden] { display: none; }
.xs-mega.is-open { display: block; }
.xs-mega::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

/* World map. The page script (Coverage.cshtml) explicitly paints
 * each path's fill via `path.style.fill`. We deliberately do NOT
 * set fill in CSS so the JS-driven colour scheme can't be over-
 * ridden by external rules. */
.xs-worldmap {
    width: 100%;
    height: auto;
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: var(--xs-radius-lg);
    border: 1px solid var(--xs-color-border);
    display: block;
}
.xs-worldmap svg {
    width: 100%;
    height: auto;
    display: block;
}
.xs-worldmap path {
    transition: fill 120ms ease;
    stroke: #ffffff;
    stroke-width: 0.4;
    vector-effect: non-scaling-stroke;
}

.xs-mega__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
}

@media (min-width: 1024px) {
    .xs-mega__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.xs-mega__item {
    display: block;
    padding: 0.75rem 0.875rem;
    border-radius: var(--xs-radius-md);
    border: 1px solid transparent;
    color: var(--xs-color-text);
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease;
}

.xs-mega__item:hover,
.xs-mega__item:focus-visible {
    background: var(--xs-color-primary-soft);
    border-color: var(--xs-color-primary);
    outline: none;
}

.xs-mega__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--xs-color-text);
}

.xs-mega__desc {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--xs-color-text-muted);
    line-height: 1.4;
}

.xs-mega__footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--xs-color-border);
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--xs-color-text-muted);
}

.xs-mega__footer a {
    color: var(--xs-color-primary-strong);
    font-weight: 600;
    text-decoration: none;
}

.xs-mega__footer a:hover { text-decoration: underline; }

/* Sticky sub-nav for Solutions / long-form pages. The host section
 * adds .xs-subnav to anchor the bar below the main header. */
.xs-subnav {
    position: sticky;
    top: 64px;
    z-index: 30;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--xs-color-border);
}

.xs-subnav__inner {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 0.625rem 1rem;
    scrollbar-width: thin;
}

.xs-subnav__link {
    flex-shrink: 0;
    color: var(--xs-color-text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.xs-subnav__link:hover,
.xs-subnav__link:focus-visible {
    color: var(--xs-color-text);
    border-bottom-color: var(--xs-color-primary);
    outline: none;
}
