/* ============================================================
   PRISM for PageViewLens — shared by dashboard, settings and login.
   Dark only. Token-first: components reference tokens, never literals.
   Spectrum v1→v5 is a fixed set; chart colours are derived tokens.
   Fonts are self-hosted (no CDN at runtime; the CSP only allows 'self').
   ============================================================ */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/ibm-plex-mono-latin-400.woff2') format('woff2');
}

:root {
    color-scheme: dark;

    /* ground + wells */
    --void: #07080D;
    --ink: #0a0b12;
    --raised: #0f1017;   /* opaque layer for tooltips and dialogs */

    /* text (AA on --void: white ~16:1, dim ~7:1, faint ~4.8:1) */
    --white: #F4F6FB;
    --dim: #A8AEC0;
    --faint: #787E96;

    /* elevation, translucent over --void */
    --surface: rgba(255, 255, 255, .035);
    --surface-hi: rgba(255, 255, 255, .06);
    --edge: rgba(255, 255, 255, .09);
    --edge-hi: rgba(255, 255, 255, .18);

    /* spectrum: a fixed set, never recolour a single stop */
    --v1: #6D4AFF; --v2: #2E7BFF; --v3: #1FD3E0; --v4: #4BE8A8; --v5: #FF4D9D;
    --beam: linear-gradient(90deg, var(--v1), var(--v2), var(--v3), var(--v4), var(--v5));

    /* chart series, validated for dark (OKLCH L 0.48–0.67, CVD ΔE ≥ 16):
       pageviews = v2, visitors = v5 shifted into the lightness band */
    --chart-1: #2E7BFF;
    --chart-2: #F23F92;

    /* status (outside the spectrum set) */
    --good: #4BE8A8;
    --danger-text: #FF8DA2;  /* danger tint readable as text on dark */
    --page-text: #9DC0FF;    /* v2 tint for page chips */
    --event-text: #FFA6CC;   /* v5 tint for event chips */
    --warn: #FFC93C;
    --danger: #FF4D6D;

    /* type */
    --sans: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* shape */
    --r-xs: 6px; --r-sm: 12px; --r: 18px; --r-pill: 999px;
    --ease: cubic-bezier(.16, .84, .36, 1);
    --ring: 0 0 0 3px rgb(from var(--v2) r g b / .35);
    --sidebar-width: 248px;

    /* legacy names used by generated markup in assets/*.js */
    --text-primary: var(--white);
    --text-secondary: var(--dim);
    --text-muted: var(--faint);
    --border: var(--edge);
    --bg-tertiary: var(--surface-hi);
    --font-mono: var(--mono);
}

/* ---- base ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--void); }
body {
    min-height: 100dvh;
    background: var(--void);
    color: var(--white);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
/* the Prism light: three faint spectrum glows behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(700px 420px at 12% -6%, rgb(from var(--v1) r g b / .16), transparent 65%),
        radial-gradient(620px 400px at 88% 4%, rgb(from var(--v3) r g b / .10), transparent 62%),
        radial-gradient(900px 500px at 60% 106%, rgb(from var(--v5) r g b / .07), transparent 66%);
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); }
code, kbd, pre, .mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

/* gradient phrase: one per headline, weight 600 */
.grad {
    font-weight: 600;
    background: var(--beam);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---- buttons: pills ---- */
.btn-primary, .btn-sm, .btn-cancel, .btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border-radius: var(--r-pill);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
/* the lit button: white pill on the void */
.btn-primary {
    background: var(--white);
    color: var(--void);
    border: 1px solid var(--white);
    padding: .55rem 1.2rem;
    font-size: .875rem;
    font-weight: 600;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgb(from var(--v2) r g b / .35); }
.btn-sm, .btn-cancel {
    background: var(--surface);
    color: var(--dim);
    border: 1px solid var(--edge);
    padding: .4rem .95rem;
    font-size: .8125rem;
}
.btn-sm:hover, .btn-cancel:hover { background: var(--surface-hi); border-color: var(--edge-hi); color: var(--white); }
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgb(from var(--danger) r g b / .45);
    padding: .35rem .9rem;
    font-size: .8125rem;
}
.btn-danger:hover { background: rgb(from var(--danger) r g b / .12); border-color: var(--danger); }

/* ---- forms ---- */
input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    padding: .6rem .85rem;
    background: var(--ink);
    border: 1px solid var(--edge);
    border-radius: var(--r-sm);
    color: var(--white);
    font-size: .9rem;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { outline: none; border-color: var(--v2); box-shadow: var(--ring); }
select { appearance: none; -webkit-appearance: none; cursor: pointer; }
label { color: var(--dim); }

/* ---- accessibility ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
    .grad { color: CanvasText; background: none; }
}
