/* ============================================================
   Cosmic XRM marketing site — design tokens + site styles
   Dark, code-forward aesthetic. Tokens first; no hard-coded
   colors in pages — consume the custom properties below.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
    /* palette */
    --c-bg: #070b14;
    --c-bg-raised: #0d1322;
    --c-surface: #131b2e;
    --c-border: #1f2a44;
    --c-border-strong: #2c3a5e;
    --c-text: #e6ebf7;
    --c-text-muted: #94a0bb;
    --c-text-faint: #5d6880;
    --c-accent: #7c5cff;
    --c-accent-2: #38bdf8;
    --c-accent-soft: rgba(124, 92, 255, 0.14);
    --c-ok: #34d399;

    --grad-brand: linear-gradient(100deg, var(--c-accent) 0%, var(--c-accent-2) 100%);

    /* type */
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-md: 1.125rem;
    --fs-lg: 1.375rem;
    --fs-xl: clamp(1.6rem, 3.2vw, 2.25rem);
    --fs-hero: clamp(2.4rem, 6vw, 4rem);

    /* spacing & shape */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 1rem;
    --sp-4: 1.5rem;
    --sp-5: 2.5rem;
    --sp-6: 4rem;
    --sp-7: 6rem;
    --radius: 12px;
    --radius-sm: 8px;
    --container: 1140px;

    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Blazor enhanced nav focuses the h1 after navigation; keep it outline-free. */
h1:focus { outline: none; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 var(--sp-3); letter-spacing: -0.02em; }
h1 { font-size: var(--fs-hero); font-weight: 800; }
h2 { font-size: var(--fs-xl); font-weight: 700; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p  { margin: 0 0 var(--sp-3); }

a { color: var(--c-accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; height: auto; }

code, pre { font-family: var(--font-mono); font-size: 0.85em; }

.container {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--sp-4);
}

.text-gradient {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.muted { color: var(--c-text-muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: var(--fs-base);
    cursor: pointer;
}
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--grad-brand);
    color: #fff;
}
.btn-primary:hover { filter: brightness(1.12); }

.btn-ghost {
    border-color: var(--c-border-strong);
    color: var(--c-text);
    background: transparent;
}
.btn-ghost:hover { border-color: var(--c-accent-2); color: var(--c-accent-2); }

/* ---------- Header / nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(7, 11, 20, 0.82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--c-border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    min-height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: var(--fs-md);
    color: var(--c-text);
}
.brand:hover { text-decoration: none; }

.nav-desktop {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}
.nav-desktop a {
    color: var(--c-text-muted);
    font-weight: 500;
}
.nav-desktop a:hover { color: var(--c-text); text-decoration: none; }
.nav-desktop .btn { color: #fff; }

/* CSS-only mobile menu (static SSR — no JS) */
.nav-mobile { display: none; position: relative; }
.nav-mobile summary {
    list-style: none;
    cursor: pointer;
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border-strong);
    line-height: 0;
    color: var(--c-text);
}
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile[open] summary { border-color: var(--c-accent-2); }
.nav-mobile nav {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    min-width: 220px;
    padding: var(--sp-3);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.nav-mobile nav a {
    color: var(--c-text);
    font-weight: 500;
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
}
.nav-mobile nav a:hover { background: var(--c-surface); text-decoration: none; }

@media (max-width: 760px) {
    .nav-desktop { display: none; }
    .nav-mobile { display: block; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: var(--sp-7) 0 var(--sp-6);
    overflow: hidden;
}
.hero::before {
    /* soft nebula glow behind the hero copy */
    content: "";
    position: absolute;
    inset: -40% -20% auto;
    height: 130%;
    background:
        radial-gradient(600px 320px at 28% 30%, rgba(124, 92, 255, 0.22), transparent 70%),
        radial-gradient(520px 300px at 72% 20%, rgba(56, 189, 248, 0.16), transparent 70%);
    pointer-events: none;
}
.hero .container { position: relative; }

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: var(--sp-5);
    align-items: center;
}
@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; }
}

.hero-copy { max-width: 640px; }

.eyebrow {
    display: inline-block;
    padding: 0.25rem 0.8rem;
    margin-bottom: var(--sp-3);
    border: 1px solid var(--c-border-strong);
    border-radius: 999px;
    background: var(--c-accent-soft);
    color: var(--c-accent-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hero-sub {
    font-size: var(--fs-lg);
    color: var(--c-text-muted);
    max-width: 56ch;
}

.hero-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
}

/* ---------- Sections ---------- */
.section { padding: var(--sp-6) 0; }
.section-alt { background: var(--c-bg-raised); border-block: 1px solid var(--c-border); }

.section-head { max-width: 640px; margin-bottom: var(--sp-5); }
.section-head .kicker {
    color: var(--c-accent-2);
    font-size: var(--fs-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--sp-2);
}

/* ---------- Cards / grids ---------- */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
}
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: var(--sp-4);
}
.card h3 { margin-top: var(--sp-2); }
.card p { color: var(--c-text-muted); margin-bottom: 0; }

.card-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--c-accent-soft);
    color: var(--c-accent-2);
}

/* ---------- Code panel ---------- */
.code-panel {
    background: #0a0f1d;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.code-panel-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--c-bg-raised);
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-faint);
    font-size: var(--fs-sm);
    font-family: var(--font-mono);
}
.code-panel-bar .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c-border-strong);
}
.code-panel pre {
    margin: 0;
    padding: var(--sp-4);
    overflow-x: auto;
    line-height: 1.55;
    color: #c8d3f0;
}
.code-kw { color: #7c9eff; }
.code-ty { color: #4ec9b0; }
.code-st { color: #ce9178; }
.code-cm { color: #5d6880; }

/* ---------- Product screenshot frame ---------- */
.shot-frame {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.shot-frame-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-faint);
    font-size: var(--fs-sm);
    font-family: var(--font-mono);
}
.shot-frame-bar .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c-border-strong);
}
.shot-frame img { display: block; width: 100%; }
.shot-caption {
    margin-top: var(--sp-2);
    color: var(--c-text-muted);
    font-size: var(--fs-sm);
}

/* ---------- Architecture diagram ---------- */
.arch-diagram {
    display: block;
    margin-inline: auto;
    max-width: 880px;
    width: 100%;
}

/* ---------- Steps (Get started) ---------- */
.steps { counter-reset: step; display: grid; gap: var(--sp-4); max-width: 720px; }
.step {
    counter-increment: step;
    position: relative;
    padding-left: 4rem;
}
.step::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.6rem;
    height: 2.6rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--c-accent-soft);
    border: 1px solid var(--c-border-strong);
    color: var(--c-accent-2);
    font-weight: 700;
}
.step h3 { margin-bottom: var(--sp-1); }
.step p { color: var(--c-text-muted); }

/* ---------- CTA band ---------- */
.cta-band {
    text-align: center;
    padding: var(--sp-6) var(--sp-4);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    background:
        radial-gradient(480px 200px at 50% 0%, rgba(124, 92, 255, 0.18), transparent 70%),
        var(--c-surface);
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--c-border);
    padding: var(--sp-5) 0;
    margin-top: var(--sp-6);
    color: var(--c-text-muted);
    font-size: var(--fs-sm);
}
.site-footer .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}
.site-footer nav { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.site-footer a { color: var(--c-text-muted); }
.site-footer a:hover { color: var(--c-text); }

/* ---------- Error UI (template) ---------- */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}
.blazor-error-boundary::after {
    content: "An error has occurred.";
}
