/* ============================================================================
   ENHANCED MOBILE-FIRST BASE STYLES
   ============================================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

html {
    box-sizing: border-box;
    scroll-behavior: smooth;
    overflow-x: hidden;
    font-size: 16px; /* Base font size for rem calculations */
    height: 100%;
    -webkit-text-size-adjust: 100%; /* Prevent iOS text scaling */
    -ms-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--slate-100);
    background: var(--slate-950);
    overflow-x: hidden;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    opacity: 0;
    transition: opacity 0.5s ease;
    min-height: 100vh;
    position: relative;
    
    /* Mobile optimizations */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: pan-x pan-y;
}

body.loaded {
    opacity: 1;
}

/* Prevent horizontal scroll on mobile */
body, html {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--slate-900);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-gold-intense);
}

/* Enhanced Typography - Mobile First */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--slate-100);
    margin-bottom: 0.5em;
    letter-spacing: -0.025em;
}

h1 {
    font-size: var(--text-3xl-mobile);
    font-weight: 800;
}

h2 {
    font-size: var(--text-2xl-mobile);
    font-weight: 700;
}

h3 {
    font-size: var(--text-xl-mobile);
    font-weight: 600;
}

h4 {
    font-size: var(--text-lg-mobile);
    font-weight: 600;
}

h5 {
    font-size: var(--text-base-mobile);
    font-weight: 600;
}

h6 {
    font-size: var(--text-sm-mobile);
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    color: var(--slate-300);
    line-height: 1.7;
}

/* Links */
a {
    color: var(--gold-400);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--gold-300);
}

a:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
    border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--slate-300);
}

/* Layout - Mobile First */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding-mobile);
    width: 100%;
}

.section {
    padding: var(--section-padding-mobile) 0;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Enhanced Page State Management */
.page-state {
    transition: all 0.6s var(--ease-out-cubic);
}

.page-landing .whitepaper-section {
    display: none;
}

.page-whitepaper .landing-sections {
    display: none;
}

.page-whitepaper .expandable-home-section {
    display: none;
}

.page-whitepaper .header {
    background: linear-gradient(135deg, var(--slate-950) 0%, var(--slate-900) 100%);
}

/* Common Section Styles - Mobile First */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-badge {
    display: inline-block;
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.25);
    padding: 0.625rem 1rem;
    border-radius: 50px;
    font-size: var(--text-xs-mobile);
    font-weight: 600;
    color: var(--gold-400);
    margin-bottom: 1rem;
    backdrop-filter: var(--blur-md);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-badge:hover {
    background: rgba(234, 179, 8, 0.18);
    transform: translateY(-2px);
}

.section-title {
    font-size: clamp(1.875rem, 6vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--slate-100) 0%, var(--slate-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: var(--text-base-mobile);
    color: var(--slate-400);
    max-width: 100%;
    margin: 0 auto;
    line-height: 1.7;
}

/* Enhanced Button Styles - Mobile First */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-base-mobile);
    transition: all 0.3s var(--ease-mobile);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    
    /* Mobile optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.btn-primary {
    background: var(--gradient-gold);
    color: var(--slate-950);
    box-shadow: var(--shadow-gold-mobile);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-gold-intense);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--slate-100);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: var(--blur-md);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(234, 179, 8, 0.4);
    color: var(--gold-400);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn span {
    position: relative;
    z-index: 10;
}

/* Focus styles for accessibility */
.btn:focus {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(234, 179, 8, 0.2);
    border-top: 3px solid var(--gold-400);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Form Elements */
input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select {
    background: var(--input-background);
    border: 1px solid var(--input-border);
    color: var(--input-text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    min-height: var(--touch-target-min);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--input-placeholder);
}

/* Enhanced Utility Classes */
.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;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none; }
.visible { display: block; }

/* Mobile-specific text visibility */
.mobile-text { display: inline; }
.desktop-text { display: none; }

/* Performance optimizations */
.gpu-accelerated {
    transform: var(--transform-gpu);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Enhanced responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Enhanced selection styles */
::selection {
    background: rgba(234, 179, 8, 0.3);
    color: var(--slate-100);
}

::-moz-selection {
    background: rgba(234, 179, 8, 0.3);
    color: var(--slate-100);
}

/* Enhanced motion preferences */
@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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --card-border: rgba(255, 255, 255, 0.3);
        --input-border: rgba(255, 255, 255, 0.4);
    }
}

/* Tablet Styles */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--container-padding-tablet);
    }
    
    .section {
        padding: var(--section-padding-tablet) 0;
    }
    
    .section-header {
        margin-bottom: 4rem;
    }
    
    .section-badge {
        font-size: var(--text-sm-mobile);
        padding: 0.75rem 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .section-subtitle {
        font-size: var(--text-lg-mobile);
        max-width: 600px;
    }
    
    h1 { font-size: var(--text-4xl-mobile); }
    h2 { font-size: var(--text-3xl-mobile); }
    h3 { font-size: var(--text-2xl-mobile); }
    
    .btn {
        padding: 1.125rem 2rem;
        font-size: var(--text-base-mobile);
        gap: 0.75rem;
    }
    
    .mobile-text { display: none; }
    .desktop-text { display: inline; }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--container-padding-desktop);
    }
    
    .section {
        padding: var(--section-padding-desktop) 0;
    }
    
    .section-header {
        margin-bottom: 6rem;
    }
    
    .section-badge {
        font-size: var(--text-sm-desktop);
        padding: 0.75rem 1.25rem;
    }
    
    .section-subtitle {
        font-size: var(--text-xl-desktop);
        max-width: 700px;
    }
    
    h1 { font-size: var(--text-5xl-desktop); }
    h2 { font-size: var(--text-4xl-desktop); }
    h3 { font-size: var(--text-3xl-desktop); }
    h4 { font-size: var(--text-2xl-desktop); }
    
    .btn {
        padding: 1.25rem 2.5rem;
        font-size: var(--text-lg-desktop);
    }
}