/* CSS Variables for theming */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --accent-primary: #0066cc;
    --accent-secondary: #0052a3;
    --border-color: #d0d0d0;
    --shadow: rgba(0, 0, 0, 0.1);
    --terminal-bg: #1e1e1e;
    --terminal-text: #00ff00;
    --card-bg: #ffffff;
}

[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent-primary: #58a6ff;
    --accent-secondary: #1f6feb;
    --border-color: #30363d;
    --shadow: rgba(0, 0, 0, 0.3);
    --terminal-bg: #0d1117;
    --terminal-text: #00ff41;
    --card-bg: #161b22;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 6px var(--shadow);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px var(--shadow);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
    transition: opacity 0.3s ease;
}

.theme-toggle .sun-icon {
    position: absolute;
    opacity: 0;
}

.theme-toggle .moon-icon {
    position: absolute;
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 0;
}

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.header-content {
    text-align: center;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glitch effect */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch:hover::before,
.glitch:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
}

.glitch:hover::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-primary);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch:hover::after {
    left: -2px;
    text-shadow: -2px 0 var(--accent-secondary);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(random(100) + px, 9999px, random(100) + px, 0);
    }
    100% {
        clip: rect(random(100) + px, 9999px, random(100) + px, 0);
    }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Navigation */
nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    border-radius: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.nav-link.active {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: white;
}

/* Main Content */
main {
    min-height: calc(100vh - 300px);
    padding-bottom: 2rem;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Terminal */
.hero {
    margin-bottom: 3rem;
}

.terminal {
    background: var(--terminal-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.terminal-header {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-button.red {
    background: #ff5f56;
}

.terminal-button.yellow {
    background: #ffbd2e;
}

.terminal-button.green {
    background: #27c93f;
}

.terminal-title {
    margin-left: auto;
    margin-right: auto;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.terminal-body {
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    color: var(--terminal-text);
    font-size: 0.95rem;
}

.terminal-body p {
    margin: 0.5rem 0;
}

.prompt {
    color: var(--accent-primary);
    font-weight: bold;
}

.output {
    color: var(--terminal-text);
    padding-left: 1rem;
}

.cursor {
    animation: blink 1s infinite;
}

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

/* Tech Grid */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tech-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.tech-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: 0 10px 20px var(--shadow);
}

.tech-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tech-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.tech-card p {
    color: var(--text-secondary);
}

/* Sites Section */
.sites-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.site-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.site-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow);
}

.site-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-card .file-icon {
    font-size: 1.2rem;
}

.site-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Page Viewer */
.page-viewer {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    margin-top: 2rem;
    display: none;
}

.page-viewer.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.page-viewer h1,
.page-viewer h2,
.page-viewer h3 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.page-viewer h1 {
    font-size: 2.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.page-viewer h2 {
    font-size: 2rem;
}

.page-viewer h3 {
    font-size: 1.5rem;
}

.page-viewer p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-viewer code {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.page-viewer pre {
    background: var(--terminal-bg);
    color: var(--terminal-text);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1rem 0;
}

.page-viewer pre code {
    background: none;
    padding: 0;
}

.page-viewer a {
    color: var(--accent-primary);
    text-decoration: none;
}

.page-viewer a:hover {
    text-decoration: underline;
}

.page-viewer ul,
.page-viewer ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.page-viewer li {
    margin-bottom: 0.5rem;
}

.page-viewer blockquote {
    border-left: 4px solid var(--accent-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.back-button {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: var(--accent-secondary);
    transform: translateX(-5px);
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .tech-grid {
        grid-template-columns: 1fr;
    }

    nav {
        gap: 1rem;
    }

    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
}
