/* Grunden: nollställning, typografi och sidans ramar. Värdena kommer från tokens.css. */

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

html {
    height: 100%;
    background: #f2f2f7;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html[data-scheme="dark"] {
    background: #000;
}

body {
    margin: 0;
    min-height: 100%;
    font: var(--body);
    color: var(--label);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "tnum" 0;
    overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
dl,
dd {
    margin: 0;
    padding: 0;
}

ul,
ol {
    list-style: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    appearance: none;
    border: 0;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:disabled {
    cursor: default;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img,
svg,
canvas {
    display: block;
}

svg.icon {
    width: 1em;
    height: 1em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

svg.icon.filled {
    fill: currentColor;
    stroke: none;
}

[hidden] {
    display: none !important;
}

:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: 2px;
}

::selection {
    background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Temats bakgrund: en duk bakom allt, ritad av js/core/theme.js. Syns bara när ett tema är valt. */
#backdrop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    display: none;
    /* Duken är liten och dras ut – oskärpan gör färgfälten mjuka som appens MeshGradient. */
    filter: blur(28px);
    transform: scale(1.12);
}

html[data-theme]:not([data-theme="standard"]) #backdrop {
    display: block;
}

html[data-theme]:not([data-theme="standard"]) body::before {
    /* Dämpningen ovanpå färgfälten (ThemeBackdrop: svart 0,3; 0,5 med "Öka kontrast"). */
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

@media (prefers-contrast: more) {
    html[data-theme]:not([data-theme="standard"]) body::before {
        background: rgba(0, 0, 0, 0.5);
    }
}

#app {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Det som läses upp utan att synas: "Sparat", fel från bakgrundsåtgärder. */
#live {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: min(560px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--label) 88%, transparent);
    color: var(--bg);
    font: var(--subheadline);
    font-weight: 600;
    box-shadow: var(--popover-shadow);
    animation: toast-in 0.25s var(--ease);
}

html[data-theme]:not([data-theme="standard"]) .toast {
    background: rgba(255, 255, 255, 0.92);
    color: #000;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

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