/* MadiOps — base element styles & resets */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background: var(--color-bg-subtle);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-3);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
    margin: 0 0 var(--space-4);
    color: var(--color-text-muted);
}

a {
    color: var(--color-text-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img, svg {
    max-width: 100%;
    display: block;
}

ul, ol {
    margin: 0 0 var(--space-4);
    padding-left: var(--space-6);
}

code, pre {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

pre {
    background: var(--color-grey-900);
    color: var(--color-grey-100);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-6) 0;
}

button {
    font-family: inherit;
}

a,
button,
summary,
[role="button"],
input[type="submit"],
input[type="button"] {
    touch-action: manipulation;
}

/* Focus visibility — never remove outlines without a replacement */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection {
    background: var(--color-red-100);
}

/* Reduced motion support */
@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;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    z-index: var(--z-toast);
}

.skip-link:focus {
    left: var(--space-4);
    top: var(--space-4);
}
