/**
 * Base CSS
 *
 * CSS Reset, Custom Properties, and Typography
 * Dark theme for Groupetto - Rennrad Team Tracking App
 *
 * @package Groupetto_2026
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
    /* Primary Colors - Energetic Red */
    --color-primary: #E63946;
    --color-primary-dark: #C62D39;
    --color-primary-light: #FF4D5A;

    /* Secondary Colors */
    --color-secondary: #457B9D;
    --color-secondary-dark: #355F7A;
    --color-secondary-light: #5A9BC0;

    /* Dark Theme Colors (Default) */
    --color-bg: #000000;
    --color-bg-alt: #0A0A0A;
    --color-bg-elevated: #141414;
    --color-bg-card: #1A1A1A;

    /* Text Colors */
    --color-text: #FFFFFF;
    --color-text-light: #A0A0A0;
    --color-text-muted: #5A5A5A;

    /* Accent Colors */
    --color-accent: #2DD4BF;
    --color-accent-dark: #14B8A6;

    /* Utility Colors */
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-error: #EF4444;

    /* Borders */
    --color-border: rgba(255, 255, 255, 0.1);
    --color-border-light: rgba(255, 255, 255, 0.05);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, #FF6B6B 100%);
    --gradient-dark: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
    --gradient-card: linear-gradient(145deg, var(--color-bg-card) 0%, var(--color-bg-alt) 100%);
    --gradient-hero: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
    --gradient-glow: radial-gradient(ellipse at center, rgba(230, 57, 70, 0.15) 0%, transparent 70%);

    /* Typography - System Fonts */
    /* Apple: SF Pro, Windows: Segoe UI, Android: Roboto */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
    --font-family-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
    --font-family-mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace;

    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-md: 1.125rem;   /* 18px */
    --font-size-lg: 1.25rem;    /* 20px */
    --font-size-xl: 1.5rem;     /* 24px */
    --font-size-2xl: 2rem;      /* 32px */
    --font-size-3xl: 2.5rem;    /* 40px */
    --font-size-4xl: 3rem;      /* 48px */
    --font-size-5xl: 4rem;      /* 64px */
    --font-size-hero: clamp(2.5rem, 8vw, 5rem);

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-black: 900;

    --line-height-tight: 1.1;
    --line-height-snug: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    --letter-spacing-tight: -0.03em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.05em;
    --letter-spacing-wider: 0.1em;

    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    --space-3xl: 4rem;     /* 64px */
    --space-4xl: 6rem;     /* 96px */
    --space-5xl: 8rem;     /* 128px */

    /* Section Spacing */
    --section-padding-y: clamp(4rem, 10vw, 8rem);
    --section-padding-x: var(--space-lg);

    /* Layout */
    --container-max-width: 1200px;
    --container-padding: var(--space-lg);

    /* Borders */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
    --border-radius-2xl: 2rem;
    --border-radius-full: 9999px;

    /* Shadows - subtle for dark theme */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
    --shadow-2xl: 0 25px 60px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px rgba(230, 57, 70, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-tooltip: 600;

    /* Header */
    --header-height: 80px;
    --header-height-scrolled: 64px;
}

/* ==========================================================================
   Light Mode Overrides (optional toggle)
   ========================================================================== */

.light-mode {
    --color-bg: #FAFAFA;
    --color-bg-alt: #FFFFFF;
    --color-bg-elevated: #FFFFFF;
    --color-bg-card: #FFFFFF;
    --color-text: #0A0A0A;
    --color-text-light: #525252;
    --color-text-muted: #A3A3A3;
    --color-border: rgba(0, 0, 0, 0.1);
    --color-border-light: rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   CSS Reset (Modern Reset)
   ========================================================================== */

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

* {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

ul[role='list'],
ol[role='list'],
nav ul,
nav ol {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

a:not([class]) {
    text-decoration-skip-ink: auto;
}

button {
    background: transparent;
    border: none;
    cursor: pointer;
}

@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;
    }
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-display);
    font-weight: var(--font-weight-black);
    font-style: italic;
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text);
}

h1 {
    font-size: var(--font-size-hero);
    font-weight: var(--font-weight-black);
    font-style: italic;
}

h2 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-black);
    font-style: italic;
}

h3 {
    font-size: var(--font-size-2xl);
}

h4 {
    font-size: var(--font-size-xl);
}

h5 {
    font-size: var(--font-size-lg);
}

h6 {
    font-size: var(--font-size-md);
}

p {
    font-size: var(--font-size-md);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-light);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-muted);
}

/* Gradient text effect */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   Focus Styles (Accessibility)
   ========================================================================== */

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Screen Reader Only
   ========================================================================== */

.screen-reader-text,
.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;
}

.screen-reader-text:focus,
.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: var(--space-sm) var(--space-md);
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background-color: var(--color-bg);
    color: var(--color-text);
}

/* ==========================================================================
   Selection Styling
   ========================================================================== */

::selection {
    background-color: var(--color-primary);
    color: white;
}

/* ==========================================================================
   Scrollbar Styling (Webkit)
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--color-text-muted);
    border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}
