/* 1. Box Sizing Reset: Deterministic width/height calculations */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 2. Baseline Reset: Strip unpredictable default spacing */
* {
    margin: 0;
    padding: 0;
}

/* 3. Root Typography: Native OS rendering and sizing */
html {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    font-size: 16px;
    line-height: 1.5;
    /* Prevent iOS from resizing text on landscape orientation */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    /*min-height: 100vh;*/
    min-height: 100dvh; /* Use dynamic viewport height for mobile browsers */
    background-color: #fbfbfb;
    color: #1a1a1a;
    /* Improve text rendering on macOS */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 4. Media Normalization: Prevent layout shifts and overflows */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* 5. Form Control Determinism: Unify inputs across desktop, iOS, and Android */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    word-spacing: inherit;
    /* Remove OS-specific 3D styling and gradients */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    background-color: #ffffff;
}

/* Specific fix for Safari rendering search inputs as pills */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    display: none;
}

/* Reset button styling to act as a blank canvas */
button {
    cursor: pointer;
    background-color: transparent;
    border-color: transparent;
}

/* 6. Text Wrapping: Prevent unbreakable strings from breaking layouts */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
dd {
    overflow-wrap: break-word;
}

/* 7. Accessibility: Respect user OS preferences for reduced motion */
@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;
    }
}
