/**
 * SuperClaude Framework - Main Styles
 * Base styles, CSS variables, typography, and layout foundations
 *
 * Design Priorities:
 * - Readability first (optimized typography, spacing)
 * - Modern artwork aesthetic (clean, contemporary)
 * - No left borders on panels (per project requirements)
 * - Responsive mobile-first design
 * - Accessibility (WCAG 2.1 AA)
 */

/* ═══════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (Design Tokens)
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Color Palette - Primary */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;

    /* Color Palette - Semantic */
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #3498db;

    /* Background Colors */
    --bg-color: #ecf0f1;
    --bg-secondary: #f8f9fa;
    --card-bg: #ffffff;
    --code-bg: #f8f9fa;

    /* Border Colors */
    --border-color: #dee2e6;
    --border-light: #e9ecef;

    /* Text Colors */
    --text-color: #2c3e50;
    --text-muted: #6c757d;
    --text-light: #95a5a6;
    --text-inverse: #ffffff;

    /* Typography Scale (Major Third - 1.250) */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 2rem;        /* 32px */
    --font-size-4xl: 2.5rem;      /* 40px */

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.8;

    /* Font Families */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, Menlo, Consolas, 'DejaVu Sans Mono', 'Courier New', monospace;

    /* Spacing System (8px grid) */
    --space-1: 0.5rem;    /* 8px */
    --space-2: 1rem;      /* 16px */
    --space-3: 1.5rem;    /* 24px */
    --space-4: 2rem;      /* 32px */
    --space-5: 2.5rem;    /* 40px */
    --space-6: 3rem;      /* 48px */
    --space-8: 4rem;      /* 64px */

    /* Border Radius */
    --radius-sm: 4px;
    --radius-base: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.2);

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 900;
    --z-modal: 1000;
    --z-tooltip: 1100;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Layout Constraints */
    --container-max-width: 100%;
    --content-max-width: 100%;
    --breakpoint-mobile: 480px;
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 1024px;
}

/* Dark Mode Variables (Ready for future implementation) */
@media (prefers-color-scheme: dark) {
    :root {
        /* Uncomment when dark mode is implemented */
        /* --bg-color: #1a1a1a; */
        /* --card-bg: #2d2d2d; */
        /* --text-color: #e0e0e0; */
    }
}

/* ═══════════════════════════════════════════════════════════════
   CSS RESET & BASE STYLES
   ═══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--text-color);
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
}

/* Ensure all direct children of body don't overflow */
body > * {
    max-width: 100vw;
}

/* Hide section containers that don't have content loaded yet */
[id^="section-"]:empty {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-3);
}

h1 {
    font-size: var(--font-size-4xl);
    color: var(--primary-color);
}

h2 {
    font-size: var(--font-size-3xl);
    color: var(--primary-color);
    padding-bottom: var(--space-2);
    border-bottom: 3px solid var(--secondary-color);
    margin-bottom: var(--space-4);
}

h3 {
    font-size: var(--font-size-2xl);
    color: var(--secondary-color);
    margin-top: var(--space-5);
    margin-bottom: var(--space-2);
}

h4 {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
}

h5 {
    font-size: var(--font-size-lg);
    color: var(--primary-color);
}

h6 {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

p {
    margin: var(--space-2) 0;
    line-height: var(--line-height-relaxed);
}

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

em, i {
    font-style: italic;
}

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

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

a:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Lists */
ul, ol {
    margin: var(--space-2) 0 var(--space-2) var(--space-5);
}

li {
    margin: var(--space-1) 0;
    line-height: var(--line-height-base);
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.container {
    max-width: 100%;
    margin: 0;
    padding: var(--space-4) var(--space-4);
    width: 100%;
    box-sizing: border-box;
}

.container-narrow {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-4);
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
    padding: var(--space-8) var(--space-4);
    text-align: center;
    box-shadow: var(--shadow-md);
}

header h1 {
    color: var(--text-inverse);
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    border-bottom: none;
}

header .subtitle {
    font-size: var(--font-size-xl);
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
    line-height: var(--line-height-base);
}

/* Sections */
section {
    background: var(--card-bg);
    margin: var(--space-5) 0;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-base);
}

/* Footer */
footer {
    background: var(--primary-color);
    color: var(--text-inverse);
    text-align: center;
    padding: var(--space-5) var(--space-4);
    margin-top: var(--space-8);
}

footer a {
    color: var(--text-inverse);
    text-decoration: underline;
}

footer a:hover {
    opacity: 0.8;
}

/* Grid System */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-4);
    margin: var(--space-4) 0;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ═══════════════════════════════════════════════════════════════
   CODE BLOCKS & SYNTAX
   ═══════════════════════════════════════════════════════════════ */

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    color: var(--accent-color);
    font-weight: 500;
}

pre {
    background: var(--code-bg);
    padding: var(--space-4);
    border-radius: var(--radius-base);
    overflow-x: auto;
    margin: var(--space-4) 0;
    /* NO left border per requirements */
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
    font-size: 0.95em;
    line-height: 1.5;
}

.diagram {
    background: var(--code-bg);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    font-family: var(--font-mono);
    white-space: pre;
    margin: var(--space-4) 0;
    overflow-x: auto;
    border: 2px solid var(--border-color);
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table th {
    background: var(--primary-color);
    color: var(--text-inverse);
    padding: var(--space-3);
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover {
    background: var(--bg-secondary);
}

/* Responsive table wrapper */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--space-4) 0;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

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

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }

.font-mono { font-family: var(--font-mono); }

/* Visibility utilities */
.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;
}

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════ */

@media print {
    body {
        background: white;
        color: black;
    }

    header {
        background: none;
        color: black;
        box-shadow: none;
    }

    nav,
    .back-to-top,
    footer {
        display: none;
    }

    section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    pre,
    code {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
