/* ========================================================
   USWeatherHub — Living Weather Canvas Design Tokens
   A human-crafted design system for premium weather UX
   ======================================================== */

/* ---- Color Palette ---- */
:root {
    /* Warm Neutrals (Light Mode Default) */
    --color-bg-primary: #F8F6F3;
    --color-bg-secondary: #FFFFFF;
    --color-bg-tertiary: #F0EDE8;
    --color-bg-card: #FFFFFF;
    --color-bg-card-hover: #FAFAF8;
    --color-bg-nav: rgba(255, 255, 255, 0.85);
    --color-bg-footer: #1B1D22;

    /* Text */
    --color-text-primary: #1A1C20;
    --color-text-secondary: #5A5D63;
    --color-text-tertiary: #9CA0A8;
    --color-text-inverse: #F8F6F3;

    /* Accent */
    --color-accent: #2563EB;
    --color-accent-hover: #1D4ED8;
    --color-accent-light: #DBEAFE;
    --color-accent-glow: rgba(37, 99, 235, 0.15);

    /* Weather Contextual Colors */
    --weather-sunny: #F59E0B;
    --weather-sunny-bg: #FFFBEB;
    --weather-cloudy: #94A3B8;
    --weather-cloudy-bg: #F1F5F9;
    --weather-rainy: #3B82F6;
    --weather-rainy-bg: #EFF6FF;
    --weather-snowy: #A5B4FC;
    --weather-snowy-bg: #EEF2FF;
    --weather-stormy: #7C3AED;
    --weather-stormy-bg: #F5F3FF;
    --weather-hot: #EF4444;
    --weather-hot-bg: #FEF2F2;
    --weather-cold: #06B6D4;
    --weather-cold-bg: #ECFEFF;

    /* Borders & Dividers */
    --color-border: #E8E5E0;
    --color-border-light: #F0EDE8;
    --color-divider: #E8E5E0;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    --shadow-accent: 0 4px 14px rgba(37, 99, 235, 0.25);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-24: 6rem;

    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-full: 9999px;

    /* Transitions */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.25, 0.1, 0, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 500ms;
    --duration-slower: 800ms;
}

/* ---- Dark Mode Overrides ---- */
[data-theme="dark"] {
    --color-bg-primary: #0F1117;
    --color-bg-secondary: #1A1C22;
    --color-bg-tertiary: #23262E;
    --color-bg-card: #1A1C22;
    --color-bg-card-hover: #23262E;
    --color-bg-nav: rgba(15, 17, 23, 0.9);
    --color-bg-footer: #090A0D;

    --color-text-primary: #F0EDE8;
    --color-text-secondary: #9CA0A8;
    --color-text-tertiary: #5A5D63;
    --color-text-inverse: #1A1C20;

    --color-accent: #60A5FA;
    --color-accent-hover: #93C5FD;
    --color-accent-light: #1E3A5F;
    --color-accent-glow: rgba(96, 165, 250, 0.15);

    --color-border: #2A2D35;
    --color-border-light: #23262E;
    --color-divider: #2A2D35;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-accent: 0 4px 14px rgba(96, 165, 250, 0.2);

    /* Weather context on dark */
    --weather-sunny-bg: #292420;
    --weather-cloudy-bg: #1E2028;
    --weather-rainy-bg: #1A2030;
    --weather-snowy-bg: #1E1E30;
    --weather-stormy-bg: #201A30;
    --weather-hot-bg: #2A1A1A;
    --weather-cold-bg: #1A2528;
}

/* ---- Global Reset & Body ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--duration-slow) var(--ease-smooth),
                color var(--duration-slow) var(--ease-smooth);
}

/* ---- Typography ---- */
h1, h2, h3, .heading {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-weight: 400;
    line-height: 1.15;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

.text-display {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: clamp(3.5rem, 8vw, 7rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.text-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.text-body { font-size: 1rem; color: var(--color-text-secondary); }
.text-small { font-size: 0.875rem; color: var(--color-text-secondary); }
.text-caption { font-size: 0.75rem; color: var(--color-text-tertiary); }

/* ---- Accent Gradient Text ---- */
.text-gradient {
    background: linear-gradient(135deg, var(--color-accent), #7C3AED);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Card System ---- */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--duration-base) var(--ease-smooth),
                transform var(--duration-base) var(--ease-spring),
                border-color var(--duration-base) var(--ease-smooth);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-accent-light);
}

.card-interactive:hover {
    transform: translateY(-4px);
}

.card-tilt:hover {
    transform: perspective(600px) rotateY(-2deg) translateY(-4px);
}

/* ---- Weather Condition Cards ---- */
.weather-card-sunny { background: var(--weather-sunny-bg); border-color: rgba(245, 158, 11, 0.15); }
.weather-card-cloudy { background: var(--weather-cloudy-bg); border-color: rgba(148, 163, 184, 0.15); }
.weather-card-rainy { background: var(--weather-rainy-bg); border-color: rgba(59, 130, 246, 0.15); }
.weather-card-snowy { background: var(--weather-snowy-bg); border-color: rgba(165, 180, 252, 0.15); }
.weather-card-stormy { background: var(--weather-stormy-bg); border-color: rgba(124, 58, 237, 0.15); }

/* ---- Button System ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    border: none;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-spring);
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-accent);
}

/* ---- Navigation ---- */
.nav-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--color-bg-nav);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-border-light);
    transition: all var(--duration-base) var(--ease-smooth);
}

.nav-bar.scrolled {
    box-shadow: var(--shadow-md);
}

.nav-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 0.5rem 0;
    position: relative;
    transition: color var(--duration-fast) var(--ease-smooth);
}

.nav-link:hover, .nav-link.active {
    color: var(--color-text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0; right: 0;
    height: 2px;
    background: var(--color-accent);
    border-radius: 1px;
}

/* ---- Pill / Badge ---- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.pill-live {
    background: #DCFCE7;
    color: #16A34A;
}
[data-theme="dark"] .pill-live {
    background: #14532D;
    color: #4ADE80;
}

/* ---- Data Visualisation Helpers ---- */
.metric-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--color-bg-tertiary);
    overflow: hidden;
}
.metric-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--duration-slower) var(--ease-out-expo);
}

/* ---- Utility Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.animate-fade-in-up { animation: fadeInUp var(--duration-slow) var(--ease-out-expo) both; }
.animate-fade-in { animation: fadeIn var(--duration-slow) var(--ease-smooth) both; }
.animate-scale-in { animation: scaleIn var(--duration-slow) var(--ease-spring) both; }
.animate-slide-right { animation: slideInRight var(--duration-slow) var(--ease-out-expo) both; }

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

/* ---- Selection ---- */
::selection {
    background: var(--color-accent-light);
    color: var(--color-accent);
}
