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

html {
    height: 100%;
    overflow: hidden;
}

/* Root CSS variables for theming */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #161616;
    --bg-tertiary: #262626;
    --border-color: #404040;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #b5b5b5;
    --accent-color: #ff8c69;
    --accent-secondary: #e67e5c;
    --name-color: #ffffff;
}

/* Light theme overrides */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --border-color: #c0c0c0;
    --text-primary: #000000;
    --text-secondary: #2a2a2a;
    --text-muted: #4a4a4a;
    --accent-color: #cc5500;
    --accent-secondary: #b84d00;
    --name-color: #000000;
}

/* Apply theme automatically based on system preference only if no manual theme is set */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg-primary: #ffffff;
        --bg-secondary: #f5f5f5;
        --bg-tertiary: #e0e0e0;
        --border-color: #c0c0c0;
        --text-primary: #000000;
        --text-secondary: #2a2a2a;
        --text-muted: #4a4a4a;
        --accent-color: #cc5500;
        --accent-secondary: #b84d00;
        --name-color: #000000;
    }
}

body {
    height: 100vh;
    width: 100vw;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Hack', 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    cursor: default;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* i3wm-style status bar at top */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 26px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    font-size: 12px;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.workspace-indicator {
    display: flex;
    gap: 8px;
}

.workspace {
    padding: 2px 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 2px;
    font-weight: 500;
}

.workspace.active {
    background: var(--accent-color);
    color: var(--bg-secondary);
}

.system-info {
    display: flex;
    gap: 16px;
    font-size: 11px;
}

.info-item {
    color: var(--text-secondary);
}

/* Main window container mimicking tiling WM */
.wm-container {
    position: absolute;
    top: 26px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-primary);
}

/* Terminal-style window */
.terminal-window {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.window-header {
    height: 32px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    justify-content: space-between;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.close-btn { background: #f38ba8; }
.minimize-btn { background: #fab387; }
.maximize-btn { background: #a6e3a1; }

.window-title {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
}

.terminal-content {
    flex: 1;
    padding: 20px 20px 20px 20px;
    background: var(--bg-secondary);
    overflow-y: auto;
    position: relative;
    scroll-padding-top: 10px;
    transition: background-color 0.3s ease;
}

/* Terminal prompt styling */
.prompt-line {
    margin-bottom: 16px;
    margin-top: 4px;
}

.prompt {
    color: var(--accent-color);
    margin-right: 8px;
    font-weight: bold;
}

.user-info {
    color: var(--text-primary);
    font-weight: 500;
}

.path {
    color: var(--accent-secondary);
}

/* Profile section styling */
.profile {
    margin-bottom: 24px;
}

.name {
    color: var(--name-color);
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(193, 120, 23, 0.3);
}

.role {
    color: var(--accent-color);
    font-size: 16px;
    margin-bottom: 16px;
    font-style: italic;
}

/* Command output styling */
.command-line {
    margin-bottom: 8px;
    color: var(--text-muted);
}

.command-output {
    margin-bottom: 16px;
    color: var(--text-primary);
}

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

.input-prompt {
    margin-bottom: 4px;
}

.input-container {
    display: flex;
    align-items: center;
}

.input-wrapper {
    margin-left: 4px;
    flex: 1;
    position: relative;
}

#terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    caret-color: transparent;
}

#custom-cursor {
    position: absolute;
    height: 2px;
    width: 8px;
    background: var(--accent-color);
    bottom: 2px;
    left: 0px;
    animation: blink 1s infinite;
    pointer-events: none;
}

/* Link styling */
.links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 14px;
}

.link-item:hover {
    background: var(--border-color);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateX(4px);
}

.link-icon {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Special hover effects for different platforms */
.link-item[href*="github"]:hover {
    border-color: #a6adc8;
    color: #a6adc8;
}

.link-item[href*="medium"]:hover {
    border-color: #a6e3a1;
    color: #a6e3a1;
}

.link-item[href*="linkedin"]:hover {
    border-color: #74c7ec;
    color: #74c7ec;
}

.link-item[href*="resume"]:hover,
.link-item[href*="pdf"]:hover {
    border-color: #fab387;
    color: #fab387;
}

.link-item[href*="mailto"]:hover {
    border-color: #f38ba8;
    color: #f38ba8;
}

.link-item[href*="donate"]:hover {
    border-color: #f9e2af;
    color: #f9e2af;
}

/* Terminal cursor animation */
.cursor {
    display: inline-block;
    background: var(--accent-color);
    width: 8px;
    height: 16px;
    margin-left: 2px;
    animation: blink 1s infinite;
}

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

/* Desktop scaling */
@media (min-width: 769px) {
    body {
        transform: scale(1.25);
        transform-origin: top left;
        width: 80%;
        height: 80%;
    }
    
    html {
        overflow: auto;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        font-size: 12px;
        /* Account for mobile browser bars */
        min-height: 100vh;
        height: auto;
    }
    
    .status-bar {
        height: 22px;
        padding: 0 8px;
        font-size: 10px;
    }
    
    .workspace {
        padding: 1px 6px;
        font-size: 10px;
    }
    
    .wm-container {
        top: 22px;
        padding: 4px;
        gap: 1px;
        /* Allow for extra scrolling room */
        min-height: calc(100vh - 22px);
        height: auto;
    }
    
    .terminal-window {
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        /* Ensure window grows with content */
        min-height: calc(100vh - 30px);
        height: auto;
    }
    
    .window-header {
        height: 24px;
        padding: 0 8px;
    }
    
    .window-title {
        font-size: 10px;
    }
    
    .control-btn {
        width: 8px;
        height: 8px;
    }
    
    .terminal-content {
        padding: 16px 8px 80px 8px; /* Reduced bottom padding */
        scroll-padding-top: 8px;
        scroll-padding-bottom: 20px;
        /* Ensure smooth scrolling without abrupt cutoffs */
        min-height: calc(100vh - 46px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Ensure terminal output always has top spacing */
    #terminal-output {
        padding-top: 8px;
    }
    
    .name {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .role {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .prompt-line {
        margin-bottom: 12px;
    }
    
    .profile {
        margin-bottom: 16px;
    }
    
    .links {
        gap: 4px;
    }
    
    .link-item {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .link-icon {
        width: 12px;
        height: 12px;
        margin-right: 6px;
    }
    
    
    /* Make input area more touch-friendly */
    #input-line {
        margin-top: 8px;
        /* Extra margin to ensure it's not at the very bottom */
        margin-bottom: 20px;
    }
    
    #input-line > div:first-child {
        margin-bottom: 2px;
        font-size: 11px;
    }
    
    #terminal-input {
        font-size: 12px;
        min-height: 20px;
    }
    
    #custom-cursor {
        width: 6px;
        height: 12px;
    }
}
