/* ============================================================================
   PEGASSI MOTORSPORT — BASE STYLES v2
   Global reset, typography, links, scrollbar, focus, animations.
   Enhanced with richer micro-interactions, better typography, and smoother fx.
   ============================================================================ */

/* ── Reset ──────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

html,
body {
    overflow-x: hidden;
    min-height: 100vh;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: 1.6;
    color: var(--color-text);
    background: var(--gradient-dark);
    background-attachment: fixed;
}

/* ── Typography ─────────────────────────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--color-text);
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

h5 {
    font-size: var(--text-base);
}

h6 {
    font-size: var(--text-sm);
}

p {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    line-height: 1.7;
}

small {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

strong,
b {
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

/* ── Links ──────────────────────────────────────────────────────────────────── */

a {
    color: var(--color-green);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-green-hover);
}

/* ── Selection ──────────────────────────────────────────────────────────────── */

::selection {
    background: rgba(var(--color-green-rgb), 0.3);
    color: var(--color-text);
}

/* ── Focus ──────────────────────────────────────────────────────────────────── */

:focus-visible {
    outline: 2px solid rgba(var(--color-green-rgb), 0.6);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-green-rgb), 0.25);
    border-radius: var(--radius-pill);
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-green-rgb), 0.45);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--color-green-rgb), 0.25) transparent;
}

/* ── Images & Media ─────────────────────────────────────────────────────────── */

img,
video,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

/* ── Lists ──────────────────────────────────────────────────────────────────── */

ul,
ol {
    list-style: none;
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ── Misc ───────────────────────────────────────────────────────────────────── */

hr {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: var(--space-6) 0;
}

/* ── Skeleton / Loading Shimmer ─────────────────────────────────────────────── */

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.06) 50%,
            rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s var(--ease-in-out) infinite;
    border-radius: var(--radius-sm);
}

/* ── Toast Notifications ────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + var(--space-4));
    right: var(--space-4);
    z-index: var(--z-toast);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: toastSlideIn var(--duration-slow) var(--ease-spring);
    max-width: 380px;
}

.toast-success {
    border-left: 3px solid var(--color-success);
}

.toast-danger {
    border-left: 3px solid var(--color-danger);
}

.toast-warning {
    border-left: 3px solid var(--color-warning);
}

.toast-info {
    border-left: 3px solid var(--color-info);
}

/* ── Tooltip ────────────────────────────────────────────────────────────────── */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: var(--space-1) var(--space-3);
    background: var(--color-bg-deep);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--color-text);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: var(--z-toast);
    box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ── Screen Reader Only ─────────────────────────────────────────────────────── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Keyframe Animations ────────────────────────────────────────────────────── */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(var(--color-green-rgb), 0.2);
    }

    50% {
        box-shadow: 0 0 14px rgba(var(--color-green-rgb), 0.4);
    }
}

@keyframes dotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.4);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Loading Spinner ────────────────────────────────────────────────────────── */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border-light);
    border-top-color: var(--color-green);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* ── Respect user preferences ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}