/* ==========================================================================
   Demo Analytics: base
   --------------------------------------------------------------------------
   A small, explicit reset plus element defaults and utilities. The reset is
   deliberately complete (lists, headings, buttons, tables, [hidden]) so the
   demo renders the same on any host, whatever other stylesheets are present.
   ========================================================================== */

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

* {
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--font-sans);
    font-size: 100%;
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    color-scheme: light;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Headings are styled by component classes, never by tag. */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: inherit;
    font-weight: inherit;
    line-height: var(--leading-tight);
}

p {
    overflow-wrap: break-word;
}

ul,
ol {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg,
video,
canvas {
    display: block;
}

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

button,
input,
select,
textarea {
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    background: none;
    border: 0 solid transparent;
    border-radius: 0;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
    text-indent: 0;
}

th {
    font-weight: inherit;
    text-align: left;
}

dl,
dd {
    margin: 0;
}

strong,
b {
    font-weight: var(--weight-semibold);
}

/* The hidden attribute must always win, even over display rules. */
[hidden] {
    display: none !important;
}

::selection {
    background-color: var(--color-selection);
}

/* ---------- Focus: one consistent, visible ring ---------- */

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Headings receive focus programmatically after a view change. They are not
   interactive, so they do not show a ring. */
[tabindex="-1"]:focus {
    outline: none;
}

/* ---------- Icons ---------- */

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon--sm {
    width: 16px;
    height: 16px;
}

.icon--lg {
    width: 24px;
    height: 24px;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Utilities ---------- */

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 solid transparent !important;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

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

/* ---------- Skip link ---------- */

.skip-link {
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: var(--z-skip);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-accent-contrast);
    background-color: var(--color-text);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(-150%);
    pointer-events: none;
}

.skip-link:focus-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ---------- Reduced motion safety net ----------
   Tokens already zero the durations; this also stops any keyframe loop. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }
}
