/**
 * Base Styles
 * Reset, typography, and global body styles
 * Cross-browser compatible: Chrome, Safari (macOS/iOS), Firefox, Edge
 */

/* ==================== */
/* CSS RESET            */
/* ==================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Prevent tap highlight on all elements */
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    /* Prevent text size adjustment on orientation change */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Font smoothing for all browsers */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Smooth scrolling */
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    height: 100vh;
    font-family: var(--font-primary);
    font-size: var(--body-size);
    line-height: 1.5;
    color: var(--text-primary);

    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior: none;

    /* Prevent text selection during game */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    /* Prevent callout on long press (iOS) */
    -webkit-touch-callout: none;
}

/* ==================== */
/* BACKGROUND STATES    */
/* ==================== */

body {
    background: url('../images/background_images/background.png') center center / cover no-repeat fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

body.welcome {
    background: url('../images/background_images/opening_page.png') center center / cover no-repeat fixed;
}

body.report-view {
    background: url('../images/background_images/background.png') center center / cover no-repeat fixed;
    justify-content: flex-start;
    padding-top: var(--space-xl);
}

/* ==================== */
/* TYPOGRAPHY           */
/* ==================== */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--weight-bold);
    line-height: 1.2;
}

h1 {
    font-size: var(--title-size);
}

h2 {
    font-size: var(--subtitle-size);
}

p {
    font-size: var(--body-size);
}

/* ==================== */
/* LINKS & BUTTONS      */
/* ==================== */

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;

    /* Touch optimization - all browsers */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

button:focus {
    outline: 3px solid var(--accent-green);
    outline-offset: 2px;
}

/* Safari/older browser support for focus-visible */
button:focus:not(:focus-visible) {
    outline: none;
}

button:focus-visible {
    outline: 3px solid var(--accent-green);
    outline-offset: 2px;
}

/* Firefox-specific focus styling */
button:-moz-focusring {
    outline: 3px solid var(--accent-green);
    outline-offset: 2px;
}

/* ==================== */
/* IMAGES               */
/* ==================== */

img {
    max-width: 100%;
    height: auto;
    display: block;

    /* Prevent dragging */
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* ==================== */
/* UTILITY CLASSES      */
/* ==================== */

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.no-scroll {
    overflow: hidden;
}

/* ==================== */
/* FOCUS MANAGEMENT     */
/* ==================== */

/* Skip to main content link (accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-bg-solid);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    z-index: var(--z-modal);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-md);
}

/* ==================== */
/* SCROLLBAR STYLING    */
/* ==================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--dirt-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dirt-dark);
}

/* ==================== */
/* SELECTION STYLING    */
/* ==================== */

::selection {
    background: var(--accent-green-light);
    color: var(--text-dark);
}

::-moz-selection {
    background: var(--accent-green-light);
    color: var(--text-dark);
}