:root {
    --bg: #0a0a0a;
    --fg: #f0f0f0;
    --dim: #999999;
    --border: #2a2a2a;
    --accent: #00e59b;
    --accent-hover: #00ffac;
    --accent-glow: rgba(0, 229, 155, 0.15);
    --panel-bg: #111111;
    --font-mono: "Space Mono", monospace;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Mobile-first spacing */
    --nav-height: 60px;
    --container-padding: 1rem;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body,
html {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* Make all images responsive by default */
img,
video,
svg,
canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Ensure all containers can shrink */
div,
section,
main,
article,
header,
footer,
nav {
    min-width: 0;
}

/* Prevent text overflow in all elements */
p,
h1,
h2,
h3,
h4,
h5,
h6,
a,
code,
pre {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* Code elements should not break layout */
code {
    max-width: 100%;
    overflow-x: auto;
}

pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--dim);
}
::selection {
    background: var(--accent);
    color: var(--bg);
}

/* Typography - Responsive font sizes */
h1 {
    font-size: clamp(2rem, 8vw, 5rem);
    font-weight: 700;
    margin-top: 0;
    color: var(--fg);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    margin-top: 0;
    color: var(--fg);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h3 {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 700;
    margin-top: 0;
    color: var(--fg);
    line-height: 1.3;
}

p {
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    color: var(--dim);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

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

a:hover {
    color: var(--accent-hover);
    text-shadow: 0 0 8px var(--accent-glow);
}

/* Top Navigation - Mobile First */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem var(--container-padding);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: var(--nav-height);
}

/* Add padding to body/main content to compensate for fixed nav */
body {
    padding-top: var(--nav-height);
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--fg);
    letter-spacing: -1px;
    flex-shrink: 0;
}

.brand:hover {
    color: var(--accent);
    text-shadow: none;
}

.nav-links {
    display: none; /* Hidden on mobile by default */
    gap: 1.5rem;
}

.nav-links a {
    color: var(--dim);
    font-weight: 700;
    text-transform: lowercase;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    text-shadow: none;
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--fg);
    transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation Menu */
.nav-mobile {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    z-index: 999;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
}

.nav-mobile.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-mobile a {
    display: block;
    color: var(--dim);
    font-weight: 700;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    text-transform: lowercase;
}

.nav-mobile a:hover,
.nav-mobile a.active {
    color: var(--accent);
    background: var(--panel-bg);
    text-shadow: none;
}

/* Buttons - Touch-friendly */
.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    min-height: 44px; /* Touch target size */
    border: 1px solid var(--border);
    color: var(--fg);
    font-weight: 700;
    transition: var(--transition);
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    background: var(--panel-bg);
    border-color: var(--dim);
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn.primary:hover {
    background: var(--accent-hover);
    color: var(--bg);
    border-color: var(--accent-hover);
    box-shadow: 0 0 25px var(--accent-glow);
    transform: translateY(-2px);
}

/* Code & Pre - Responsive */
code {
    background-color: var(--panel-bg);
    padding: 0.2em 0.4em;
    border: 1px solid var(--border);
    font-size: 0.85em;
    border-radius: 4px;
    color: var(--accent);
    white-space: pre-wrap;
    word-break: break-word;
}

pre {
    background-color: #000;
    border: 1px solid var(--border);
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 6px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    -webkit-overflow-scrolling: touch;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
}

pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    color: var(--fg);
    font-size: 1em;
    white-space: pre;
    word-break: normal;
}

/* Terminal Dots */
.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

/* Code Block Wrapper */
.code-block-wrapper {
    position: relative;
    margin: 2rem 0;
}
.code-block-wrapper pre {
    margin: 0;
    padding-top: 3rem;
}
.code-block-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5rem;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}
.copy-btn {
    background: transparent;
    border: none;
    color: var(--dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 0.25rem 0.5rem;
    min-height: 36px;
    text-transform: uppercase;
    touch-action: manipulation;
}
.copy-btn:hover {
    color: var(--accent);
}

/* Docs Layout - Responsive */
.docs-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: 280px;
    min-width: 280px;
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    flex-shrink: 0;
    display: block;
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
}

/* Hide sidebar on mobile */
@media (max-width: 767px) {
    .sidebar {
        display: none;
    }
}

.sidebar h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--fg);
    margin: 2rem 0 0.75rem;
    letter-spacing: 1px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar a {
    color: var(--dim);
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 0.25rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    margin-left: -1rem;
}

.sidebar a:hover {
    color: var(--fg);
    border-left-color: var(--dim);
}

.sidebar a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: linear-gradient(
        90deg,
        rgba(0, 229, 155, 0.1) 0%,
        transparent 100%
    );
}

.content {
    flex: 1;
    padding: 2rem var(--container-padding);
    min-width: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
    margin-top: 0;
    height: calc(100vh - var(--nav-height));
}

.content-inner {
    max-width: 800px;
    margin: 0 auto;
}

.content h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-top: 3rem;
}

.content h2:first-child {
    margin-top: 0;
}

.content h3 {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    margin-top: 2rem;
    color: var(--fg);
}

/* Examples & Components Layout */
.examples-container {
    padding: 3rem var(--container-padding);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.examples-header {
    margin-bottom: 3rem;
    text-align: center;
}

.examples-header h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    margin: 0 0 1rem 0;
    text-transform: uppercase;
}

.examples-header p {
    color: var(--dim);
    font-size: clamp(0.95rem, 2vw, 1.2rem);
    max-width: 600px;
    margin: 0 auto;
}

.examples-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.components-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
}

.example-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    width: 100%;
}

.components-grid .example-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.example-card-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
}

.example-card-header h3 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.example-notes {
    padding: 1rem 1.25rem;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    color: var(--fg);
    font-size: 0.9rem;
}

.example-card-body {
    padding: 0;
    background: #000;
}

.showcase-media-wrap {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    background: var(--bg);
}

.showcase-media {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.showcase-ascii-art {
    padding: 1.5rem;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--accent);
    white-space: pre;
    line-height: 1.2;
    background: #050505;
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    overflow-x: auto;
}

.showcase-meta {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: #000;
}

.showcase-cmd-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--panel-bg);
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    flex: 1;
    min-width: 200px;
}

.showcase-cmd-wrap code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--fg);
    flex: 1;
    font-size: 0.85rem;
    overflow-x: auto;
}

/* Home Page - Hero Section */
.hero-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 4rem auto;
    padding: 0 var(--container-padding);
    gap: 3rem;
    flex: 1;
}

.hero-left {
    flex: 1;
    min-width: 0;
}

.hero-left h1 {
    margin-bottom: 1.5rem;
}

.hero-left p {
    font-size: clamp(0.95rem, 2vw, 1.25rem);
    color: var(--dim);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 500px;
}

.typed-text {
    color: var(--fg);
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1em;
    background-color: var(--accent);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.install-box {
    display: inline-flex;
    align-items: center;
    background: #000;
    border: 1px solid var(--border);
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.install-box code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--fg);
    font-size: clamp(0.85rem, 2vw, 1rem);
    margin-right: 1rem;
    overflow-x: auto;
}

.hero-right {
    flex: 1;
    min-width: 0;
}

.terminal-window {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    width: 100%;
}

.terminal-header {
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.terminal-title {
    flex: 1;
    text-align: center;
    color: var(--dim);
    font-size: 0.8rem;
    min-width: 0;
}

.terminal-body {
    padding: 1rem;
    overflow-x: auto;
}

.terminal-body pre {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    font-size: clamp(0.7rem, 2vw, 0.85rem);
}

/* Badges */
.badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 2rem !important;
}

.badge {
    display: inline-block;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Quick Start Section */
.quick-start-section {
    padding: 4rem var(--container-padding);
    max-width: 1000px;
    margin: 0 auto;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

.step-box {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    background: var(--panel-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    border-radius: 50%;
    box-shadow: 0 0 15px var(--accent-glow);
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
}

.step-content p {
    color: var(--dim);
    margin: 0 0 1rem 0;
    font-size: clamp(0.9rem, 2vw, 0.95rem);
}

/* Features Section */
.features-section {
    background: var(--panel-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 4rem var(--container-padding);
}

.features-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin: 0 0 1rem 0;
    text-align: center;
}

.section-subtitle {
    color: var(--dim);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    margin: 0 0 3rem 0;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2rem 1.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.feature-card h3 {
    margin: 0 0 1rem 0;
    color: var(--fg);
    font-size: clamp(1rem, 3vw, 1.2rem);
}

.feature-card h3::before {
    content: "■";
    color: var(--accent);
    margin-right: 10px;
    font-size: 1rem;
}

.feature-card p {
    color: var(--dim);
    margin: 0;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    line-height: 1.6;
}

/* Code Quality Section */
.code-quality-section {
    padding: 4rem var(--container-padding);
    max-width: 1000px;
    margin: 0 auto;
}

.stat-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 2rem 1.5rem;
    border-radius: 8px;
    transition: var(--transition);
    text-align: center;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--accent-glow);
}

.stat-card > div:first-child {
    font-size: clamp(2rem, 8vw, 3rem);
    color: var(--accent);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-card > div:last-child {
    color: var(--dim);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* Footer */
footer {
    padding: 2rem var(--container-padding);
    text-align: center;
    background: var(--bg);
    margin-top: auto;
    border-top: 1px solid var(--border);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--dim);
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--dim);
}

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

/* Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===========================================
   TABLET BREAKPOINT (768px)
   =========================================== */
@media (min-width: 768px) {
    :root {
        --container-padding: 2rem;
    }
    
    .nav-links {
        display: flex;
    }
    
    .nav-toggle,
    .nav-mobile {
        display: none;
    }
    
    .components-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-split {
        margin: 5rem auto;
        gap: 4rem;
    }
    
    .step-box {
        gap: 2rem;
    }
}

/* ===========================================
   DESKTOP BREAKPOINT (1024px)
   =========================================== */
@media (min-width: 1024px) {
    :root {
        --container-padding: 2rem;
    }
    
    .components-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-card {
        padding: 2.5rem;
    }
}

/* ===========================================
   LARGE DESKTOP (1200px+)
   =========================================== */
@media (min-width: 1200px) {
    :root {
        --container-padding: 2rem;
    }
    
    .components-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
    
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .hero-split {
        gap: 4rem;
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .top-nav,
    .nav-toggle,
    .nav-mobile,
    footer,
    .btn,
    .copy-btn {
        display: none !important;
    }
    
    pre,
    code {
        border: 1px solid #ccc;
        background: #f5f5f5;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
}

/* ===========================================
   REDUCED MOTION
   =========================================== */
@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
   =========================================== */
@media (prefers-contrast: high) {
    :root {
        --border: #ffffff;
        --dim: #cccccc;
    }
    
    .btn,
    .badge,
    .feature-card {
        border-width: 2px;
    }
}
