/* MLNF Critical CSS - Above-fold essentials loaded synchronously */
/* Version: 1.0.0 - Performance optimized split */

/* ==========================================
   CSS RESET & BASE STYLES
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Optimize for touch devices */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html {
    scroll-behavior: smooth;
    /* Ensure smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    /* Primary background with fallback */
    background-color: #0a0a0a;
    background-image: url('https://images.unsplash.com/photo-1419242902214-272b3f66ee7a?auto=format&fit=crop&w=2070&q=80') !important;
    background-position: center center !important;
    background-size: cover !important;
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
    color: var(--text);
    font-family: var(--font-primary, 'Montserrat', sans-serif);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Optimize for mobile touch */
    -webkit-overflow-scrolling: touch;
    margin: 0; /* Ensure no body margins */
    padding: 0; /* Ensure no body padding */
    position: relative;
}

/* ==========================================
   LIGHT THEME VARIABLES & OVERRIDES
   ========================================== */

/* Light theme overrides */
body.light-theme {
    --primary: #ffffff;
    --secondary: #f0f0f5;
    --text: #1a1a33;
    --accent: #d62d4d; /* Main accent for light theme */
    --highlight: #3a3a5c;
    --success: #2e7d32;
    --warning: #ff8f00;
    --danger: #c62828;
    /* Light theme background with fallback */
    background-color: #ffffff !important; /* Fallback solid color */
    background: 
        linear-gradient(180deg, rgba(240, 240, 245, 0.2), #ffffff), 
        url('https://images.unsplash.com/photo-1506905925346-21bda4d32df4?auto=format&fit=crop&w=2070&q=80') center/cover fixed !important;
    /* Ensure fixed attachment works properly */
    background-attachment: fixed !important;
    background-repeat: no-repeat !important;
}

body.light-theme .feature-card,
body.light-theme .debate-arena,
body.light-theme .mindmap-section .mindmap-preview,
body.light-theme footer
{
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.92), rgba(240, 240, 245, 0.92));
    border-color: rgba(214, 45, 77, 0.25); /* Using light theme accent */
}

body.light-theme .btn-outline,
body.light-theme nav.main-nav a {
    color: var(--accent);
    border-color: var(--accent);
}

body.light-theme .btn-outline:hover,
body.light-theme nav.main-nav a:hover {
    background: var(--accent);
    color: var(--primary);
}

body.light-theme .highlight-item,
body.light-theme .debate-position {
    background: rgba(214, 45, 77, 0.06);
    border-left-color: var(--accent);
}

body.light-theme .mindmap-node {
    background: var(--accent);
    color: var(--primary);
}

body.light-theme .mindmap-line {
    background: rgba(214, 45, 77, 0.35);
}

/* ==========================================
   ESSENTIAL SPINNER (loading states)
   ========================================== */

/* Spinner styles moved to /css/components/spinners.css */

/* ==========================================
   MAIN LAYOUT CONTAINER
   ========================================== */

main {
    position: relative;
    z-index: 1;
    flex: 1 0 auto; /* Grow to fill space but don't shrink */
    padding: 0; /* Remove main padding that creates clearance around content */
    max-width: none; /* Allow full width */
    margin: 0;
    width: 100%;
}

/* Page content padding - apply to sections inside main instead */
.page-header, .placeholder-content, .mindmap-section {
    padding: 0; /* Remove default padding to make sections full width */
}

/* Add inner padding using a container or inner elements */
.page-header {
    padding: 2rem; /* Add padding back */
    padding-top: 0; /* Make flush with header - was 2rem */
}

.placeholder-content {
    padding: 2rem; /* Add padding for content */
}

.mindmap-section {
    padding: 2rem; /* Add padding for content */
}

/* Responsive padding adjustments for main content */
@media (max-width: 768px) {
    .page-header, .placeholder-content, .mindmap-section {
        padding: 1.5rem;
    }
    .page-header {
        padding-top: 0; /* Make flush with header - was 1.5rem */
    }
}

@media (max-width: 480px) {
    .page-header, .placeholder-content, .mindmap-section {
        padding: 1rem;
    }
    .page-header {
        padding-top: 0; /* Make flush with header - was 1rem */
    }
}

/* ==========================================
   HEADER STRUCTURE & NAVIGATION
   ========================================== */

/* Header Structure */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0; /* Flush with edges - internal spacing handled by logo/controls containers */
    margin: 0; /* Ensure no default browser margins */
    background: var(--gradient-secondary);
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2500;
    min-height: var(--header-height, 70px);
    width: 100%;
    margin-left: 0;
    box-sizing: border-box;
}

body.light-theme header {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.92), rgba(240, 240, 245, 0.92));
    border-color: rgba(214, 45, 77, 0.25);
}

.logo {
    padding-left: 1.5rem; /* Add padding to logo container for spacing from edge */
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
}

.logo i {
    color: var(--accent);
    font-size: 2rem;
    margin-right: 0.75rem;
    transition: transform 0.3s ease;
}

.logo a:hover i {
    transform: rotate(-15deg) scale(1.1);
}

.title-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.full-title {
    display: block !important;
    font-family: 'Orbitron', 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 1.8rem;
    line-height: 1.2;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(var(--accent-rgb, 255, 94, 120), 0.4);
    letter-spacing: 0.5px;
    white-space: normal;
}

.full-title .title-line-one,
.full-title .title-line-two {
    display: block;
}

.full-title .title-line-two {
    white-space: nowrap;
}

.short-title {
    display: none !important;
    font-family: 'Orbitron', 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 1.8rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(var(--accent-rgb, 255, 94, 120), 0.4);
    letter-spacing: 0.5px;
}

/* Main Desktop Navigation */
nav.main-nav {
    display: flex;
    align-items: center;
}

nav.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.2rem;
    flex-wrap: wrap;
}

nav.main-nav a {
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    position: relative;
    /* Mobile touch optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Minimum touch target size */
    min-width: 44px;
}

nav.main-nav a span {
    display: inline-block;
    position: relative;
}

nav.main-nav a i {
    margin-bottom: 0.25em;
    font-size: 0.85rem;
}

nav.main-nav a span::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 2.5px;
    background: var(--accent);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease-out;
}

nav.main-nav a:hover,
nav.main-nav a.active {
    color: var(--accent);
}

nav.main-nav a:hover span::after,
nav.main-nav a.active span::after {
    transform: scaleX(1);
}

/* Header Controls Wrapper */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-right: 1.5rem; /* Add padding to controls container for spacing from edge */
}

/* Header Auth Buttons (for logged-out state) */
.header-auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.header-auth-buttons .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    min-width: auto;
    animation: none;
}

.header-auth-buttons .btn-primary:hover,
.header-auth-buttons .btn-outline:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ==========================================
   CRITICAL RESPONSIVE DESIGN
   ========================================== */

/* For Header & Main Nav responsiveness */
@media (max-width: 920px) {
    .logo {
        padding-left: 1rem; /* Reduce padding for smaller screens */
    }
    .header-controls {
        padding-right: 1rem; /* Reduce padding for smaller screens */
    }
    .full-title {
        display: none !important; /* Hide full title */
    }
    .short-title {
        display: block !important; /* Show short title */
    }
    /* Main nav hidden on mobile - hamburger menu used instead */
    /* The .mobile-nav-toggle button (hamburger) is styled in components/shared/styles.css */
    /* and its display:block is handled by a media query there. */
}

/* Additional responsive breakpoints for header */
@media (max-width: 768px) {
    header {
        min-height: 60px; /* Reduced height for smaller screens */
    }
    .logo {
        padding-left: 0.75rem; /* Further reduce padding */
    }
    .header-controls {
        padding-right: 0.75rem; /* Further reduce padding */
    }
}

@media (max-width: 480px) {
    .logo {
        padding-left: 0.5rem; /* Minimal padding for mobile */
    }
    .header-controls {
        padding-right: 0.5rem; /* Minimal padding for mobile */
    }
}

/* ==========================================
   MOBILE PARALLAX FIX
   ========================================== */

/* Mobile devices often disable background-attachment: fixed for performance */
@media (max-width: 768px) {
    body {
        background-attachment: scroll !important;
    }
    
    body.light-theme {
        background-attachment: scroll !important;
    }
}

/* ==========================================
   FALLBACK VARIABLES
   ========================================== */

/* Fallback for --accent-rgb if not defined in base-theme.css */
/* This helps if base-theme.css is not loaded or variables are missing */
:root {
    --accent-rgb: 255, 94, 120; /* Default to the dark theme accent RGB values */
}
body.light-theme {
    --accent-rgb: 214, 45, 77; /* Light theme accent RGB values */
}

/* ==========================================
   CRITICAL INTERACTIVE ELEMENTS
   ========================================== */

/* Ensure all interactive elements are clickable */
a, button, input, textarea, select, .clickable {
    position: relative;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Ensure navigation links are always on top */
nav a {
    position: relative;
    z-index: 2501; /* Above header z-index */
}