/*
 * Relative Logic, Inc. - Modern Stylesheet
 * Dark Theme with CSS Variables
 * 2024 Modernization
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */
:root {
    /* Background Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    
    /* Text Colors */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    /* Accent Colors */
    --accent-primary: #58a6ff;
    --accent-secondary: #3fb950;
    --accent-tertiary: #f0883e;
    --accent-danger: #f85149;
    
    /* Border & Shadow */
    --border-color: #30363d;
    --border-light: #21262d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.3);
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    
    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Layout */
    --max-width: 1200px;
    --header-height: 70px;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin-bottom: var(--space-4);
}

ul, ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

li {
    margin-bottom: var(--space-2);
}

strong, b {
    color: var(--text-primary);
    font-weight: 600;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-tertiary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.main-content {
    padding-top: var(--space-8);
    padding-bottom: var(--space-16);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.logo img {
    height: 40px;
    width: auto;
}

.logo:hover {
    text-decoration: none;
    color: var(--accent-primary);
}

.main-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: var(--space-8);
}

.main-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-2) 0;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width var(--transition-base);
}

.main-nav a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.main-nav a:hover::after {
    width: 100%;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    text-align: center;
    padding: var(--space-16) 0;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: var(--text-xl);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */
.section-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    margin-bottom: var(--space-2);
}

.section-header p {
    color: var(--text-muted);
    margin: 0;
}

/* ==========================================================================
   App Gallery Cards
   ========================================================================== */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-12);
}

.app-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition-base), 
                box-shadow var(--transition-base),
                border-color var(--transition-base);
    position: relative;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.app-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    padding: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.app-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-slow);
}

.app-card:hover .app-card-image img {
    transform: scale(1.08);
}

.app-card-content {
    padding: var(--space-5);
}

.app-card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.app-card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
}

.app-card-badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--accent-tertiary);
    color: var(--bg-primary);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-card-badge.contract {
    background: var(--accent-secondary);
}

/* ==========================================================================
   Project Pages
   ========================================================================== */
.project-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    align-items: center;
    margin-bottom: var(--space-12);
    padding: var(--space-8) 0;
}

.project-info h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
}

.project-meta {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.project-meta span {
    font-size: var(--text-sm);
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
}

.project-description {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

.project-actions {
    display: flex;
    gap: var(--space-4);
}

.project-showcase {
    display: flex;
    justify-content: center;
    align-items: center;
}

.project-showcase img {
    max-height: 400px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Screenshot Grid */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-8);
}

.screenshot-grid img {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.screenshot-grid img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

/* Back Navigation */
.back-nav {
    margin-bottom: var(--space-6);
}

.back-nav a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.back-nav a:hover {
    color: var(--accent-primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: #79b8ff;
    text-decoration: none;
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    text-decoration: none;
}

.btn-large {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

/* App Store Button */
.btn-app-store {
    display: inline-flex;
    background: var(--text-primary);
    border-radius: var(--radius-md);
    padding: var(--space-1);
    transition: transform var(--transition-fast);
}

.btn-app-store:hover {
    transform: scale(1.05);
}

.btn-app-store img {
    height: 40px;
    width: auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-8) 0;
    margin-top: auto;
}

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

.footer-content p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
}

.footer-content a {
    color: var(--text-secondary);
}

.footer-content a:hover {
    color: var(--accent-primary);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.noborder {
    border: none;
}

/* ==========================================================================
   Legacy Compatibility
   ========================================================================== */
/* Support for existing page structures during transition */
.maincontent {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

.label {
    display: inline-block;
    vertical-align: top;
    margin: var(--space-4);
}

.bottom p {
    margin: 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
    .project-header {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }
    
    .project-showcase {
        order: -1;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .main-nav ul {
        gap: var(--space-4);
    }
    
    .app-grid {
        grid-template-columns: 1fr;
    }
    
    .screenshot-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .project-header {
        padding: var(--space-6) 0;
    }
    
    .project-showcase img {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-4);
    }
    
    .hero {
        padding: var(--space-10) 0;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .logo {
        font-size: var(--text-lg);
    }
    
    .logo img {
        height: 32px;
    }
    
    .main-nav ul {
        gap: var(--space-3);
    }
    
    .main-nav a {
        font-size: var(--text-xs);
    }
    
    .screenshot-grid {
        grid-template-columns: 1fr;
    }
    
    .project-actions {
        flex-direction: column;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@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;
    }
}

/* Focus styles */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
