/* ==========================================================================
   BASE STYLES - Typography, Layout, and Foundation
   
   This file establishes the basic visual foundation of your site:
   - Font families and sizes
   - Heading styles
   - Paragraph spacing
   - Basic layout utilities
   ========================================================================== */

/* ==========================================================================
   BODY & HTML - Foundation Setup
   ========================================================================== */

html {
    /* Sets base font size - 1rem = 16px by default */
    font-size: 16px;
    
    /* Prevents iOS text size adjustment on orientation change */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    /* Primary font family from your brand guidelines */
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-background);
    
    /* Smooth font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

/* ==========================================================================
   TYPOGRAPHY SCALE - Headings
   ========================================================================== */

/* Main page title (like "Mindroot Labs") */
h1 {
    font-size: var(--font-size-5xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
    
    /* Gradient text effect for brand name */
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    
    /* Fallback for browsers that don't support background-clip */
    @supports not (-webkit-background-clip: text) {
        color: var(--color-primary);
        background: none;
    }
}

/* Section titles (like "What We Do", "Our Products") */
h2 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-primary);
    margin-bottom: var(--space-6);
    text-align: center;
}

/* Subsection titles (like "AI-Powered Solutions") */
h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

/* Card titles and smaller headings */
h4 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
}

h5 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

h6 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==========================================================================
   TEXT CONTENT - Paragraphs, Lists, Links
   ========================================================================== */

/* Standard paragraph text */
p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

/* Large intro text (like hero descriptions) */
.text-large {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
}

/* Small text (like captions, meta info) */
.text-small {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

/* Emphasized text */
.text-emphasis {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

/* ==========================================================================
   SPECIAL TEXT STYLES - Brand-specific elements
   ========================================================================== */

/* Tagline styling (like "Where ideas take root") */
.tagline {
    font-size: var(--font-size-xl);
    font-style: italic;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
    opacity: 0.9;
}

/* Hero description text */
.hero-description {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
    max-width: 600px; /* Prevents lines from being too long */
}

/* Section subtitles */
.section-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: var(--space-12);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   LINKS - Default link styling
   ========================================================================== */

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-colors);
}

a:hover {
    color: var(--color-primary-dark);
}

a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Links within text content */
p a, 
.text-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

p a:hover,
.text-content a:hover {
    text-decoration-thickness: 2px;
}

/* ==========================================================================
   LAYOUT UTILITIES - Container and spacing classes
   ========================================================================== */

/* Main content containers */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Wider container for full-width sections */
.container-wide {
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Full-width container */
.container-full {
    width: 100%;
    padding: 0 var(--space-4);
}

/* ==========================================================================
   SECTION SPACING - Consistent vertical rhythm
   ========================================================================== */

/* Standard section padding */
section {
    padding: var(--space-24) 0;
}

/* Large section padding (for hero, contact) */
.section-large {
    padding: var(--space-32) 0;
}

/* Small section padding */
.section-small {
    padding: var(--space-16) 0;
}

/* ==========================================================================
   GRID & FLEXBOX UTILITIES - Layout helpers
   ========================================================================== */

/* Flexbox utilities */
.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-center {
    align-items: center;
    justify-content: center;
}

.flex-between {
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-gap {
    gap: var(--space-4);
}

/* Grid utilities */
.grid {
    display: grid;
}

.grid-center {
    place-items: center;
}

/* ==========================================================================
   TEXT ALIGNMENT - Utility classes
   ========================================================================== */

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ==========================================================================
   VISIBILITY & DISPLAY UTILITIES
   ========================================================================== */

.hidden {
    display: none;
}

.invisible {
    visibility: hidden;
}

.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;
}

/* ==========================================================================
   SELECTION & INTERACTION STATES
   ========================================================================== */

/* Text selection styling */
::selection {
    background-color: var(--color-primary);
    color: white;
    text-shadow: none;
}

::-moz-selection {
    background-color: var(--color-primary);
    color: white;
    text-shadow: none;
}

/* ==========================================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-primary);
    color: white;
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* ==========================================================================
   PRINT STYLES - Basic print optimization
   ========================================================================== */

@media print {
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black;
        background: white;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
        color: black;
    }
    
    a {
        text-decoration: underline;
        color: black;
    }
    
    /* Hide non-essential elements when printing */
    .no-print,
    nav,
    button,
    .btn {
        display: none !important;
    }
}

/* ==========================================================================
   REDUCED MOTION - Accessibility for users with vestibular disorders
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}