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

:root {
    --text: #000;
    --bg: #fff;
    --gray: #666;
    --light-gray: #f5f5f5;
    --border: #e5e5e5;
    --hover: #f9f9f9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    font-size: 16px;
}

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

/* Navigation */
nav {
    position: sticky;
    top: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

nav .container {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 32px;
}

nav a {
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    transition: opacity 0.2s;
}

nav a:first-child {
    font-weight: 600;
    margin-right: auto;
}

nav a:hover {
    opacity: 0.6;
}

/* Hero */
.hero {
    padding: 80px 0;
    position: relative;
}

h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--gray);
    margin-bottom: 24px;
}

.hero-desc {
    margin-bottom: 32px;
    line-height: 1.8;
}

/* Status indicator */
.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 32px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Live stats ticker */
.ticker {
    margin-bottom: 24px;
    overflow: hidden;
    height: 24px;
    position: relative;
}

.ticker-content {
    display: flex;
    gap: 48px;
    animation: scroll 40s linear infinite;
    position: absolute;
    white-space: nowrap;
}

.ticker-item {
    font-size: 14px;
    color: var(--gray);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Terminal window */
.terminal {
    background: var(--light-gray);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-top: 48px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.terminal-header {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
}

.terminal-dot:nth-child(1) { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #ffbd2e; }
.terminal-dot:nth-child(3) { background: #28ca42; }

.terminal-line {
    margin: 4px 0;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.terminal-line:nth-child(2) { animation-delay: 0.5s; }
.terminal-line:nth-child(3) { animation-delay: 1s; }
.terminal-line:nth-child(4) { animation-delay: 1.5s; }

@keyframes fadeIn {
    to { opacity: 1; }
}

.prompt { color: var(--gray); }
.command { color: var(--text); }
.output { color: #0969da; }

.buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.button {
    padding: 10px 20px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-block;
}

.button:hover {
    background: var(--hover);
    transform: translateY(-1px);
}

.button.primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.button.primary:hover {
    opacity: 0.8;
    background: var(--text);
}

/* Sections */
section {
    padding: 80px 0;
    border-top: 1px solid var(--border);
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 32px;
}

/* Work */
.work-item {
    margin-bottom: 48px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

.work-item:hover {
    background: var(--hover);
}

.work-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.work-title {
    font-weight: 600;
    font-size: 18px;
}

.work-date {
    font-size: 14px;
    color: var(--gray);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.work-role {
    color: var(--gray);
    margin-bottom: 16px;
    font-size: 14px;
}

.work-item ul {
    list-style: none;
}

.work-item li {
    padding-left: 16px;
    margin-bottom: 8px;
    position: relative;
    font-size: 15px;
    line-height: 1.7;
}

.work-item li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--gray);
}

.metric {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    background: var(--light-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
}

/* Projects */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.project {
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 8px;
    transition: all 0.2s;
}

.project:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.project-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.project-desc {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 8px;
}

.project-stat {
    font-size: 14px;
    color: var(--text);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* Skills */
.skills-intro {
    margin-bottom: 48px;
}

.skills-intro h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.skills-intro p {
    font-size: 16px;
    color: var(--gray);
}

.skill-builder {
    margin-bottom: 48px;
    position: relative;
}

.builder-container {
    display: flex;
    gap: 48px;
    align-items: flex-start;
    margin-bottom: 32px;
}

.skill-bank-section {
    flex: 1;
}

.skill-bank-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    font-weight: 600;
}

.skill-bank {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.skill-chip {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.skill-chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(9, 105, 218, 0.1), transparent);
    transition: left 0.6s ease;
}

.skill-chip:hover::before {
    left: 100%;
}

.skill-chip:hover {
    border-color: #0969da;
    background: var(--hover);
}

.skill-chip.selected {
    background: #0969da;
    color: white;
    border-color: #0969da;
}

.skill-chip.used {
    opacity: 0.4;
    cursor: not-allowed;
}

.skill-chip.used:hover::before {
    left: -100%;
}

.slots-section {
    flex: 1;
}

.slots-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    font-weight: 600;
}

.skill-slots {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skill-slot {
    background: var(--light-gray);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.skill-slot.filled {
    background: var(--bg);
    border-color: #0969da;
}

.slot-number {
    width: 32px;
    height: 32px;
    background: var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray);
    transition: all 0.3s;
    flex-shrink: 0;
}

.skill-slot.filled .slot-number {
    background: #0969da;
    color: white;
}

.slot-info {
    flex: 1;
}

.slot-label {
    font-size: 11px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.slot-content {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray);
}

.skill-slot.filled .slot-content {
    color: var(--text);
}

.remove-skill {
    opacity: 0;
    font-size: 18px;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s;
}

.skill-slot.filled:hover .remove-skill {
    opacity: 1;
}

.remove-skill:hover {
    color: #ef4444;
}

.result-box {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.result-box::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: all 0.6s;
}

.result-box.success {
    background: #f0fdf4;
    border: 1px solid #22c55e;
}

.result-box.success::before {
    width: 150%;
    height: 150%;
}

.result-content h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-content p {
    font-size: 15px;
    color: var(--gray);
    line-height: 1.6;
}

.reset-button {
    font-size: 14px;
    color: var(--gray);
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.reset-button:hover {
    color: var(--text);
    gap: 8px;
}

/* Original skills grid for fallback */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.skill-category h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.skill-category p {
    color: var(--gray);
    font-size: 14px;
    line-height: 1.8;
}

/* Contact */
.contact-list {
    list-style: none;
}

.contact-list li {
    margin-bottom: 12px;
}

.contact-list a {
    color: var(--text);
    text-decoration: none;
    transition: opacity 0.2s;
}

.contact-list a:hover {
    opacity: 0.6;
}

.contact-label {
    display: inline-block;
    width: 80px;
    color: var(--gray);
    font-size: 14px;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    font-size: 14px;
    color: var(--gray);
}

/* Responsive */
@media (max-width: 768px) {
    .builder-container {
        flex-direction: column;
        gap: 32px;
    }
    
    .skill-bank {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    nav .container {
        gap: 20px;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    section {
        padding: 60px 0;
    }
    
    h1 {
        font-size: 28px;
    }
}

/* Animations */
@keyframes blink { 
    0%, 50% { opacity: 0.7; } 
    51%, 100% { opacity: 0; } 
}

/* Essays */
.essay-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

@media (min-width: 640px) {
    .essay-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

.essay-tile {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.essay-tile:hover {
    background: var(--hover);
    transform: translateY(-2px);
}

.essay-tile h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.essay-date {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 16px;
}

.essay-excerpt {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 16px;
    flex-grow: 1;
}

.read-more {
    display: inline-block;
    font-size: 14px;
    color: #0969da; /* A distinct link color */
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

/* Inverted Colors for Essays */
body.inverted-colors {
    filter: invert(100%);
    background-color: var(--text);
    /* Adjust specific elements if needed to ensure readability */
}

body.inverted-colors img {
    filter: invert(100%); /* Invert images back to normal */
}

/* Ensure text remains readable */
body.inverted-colors nav a,
body.inverted-colors h1,
body.inverted-colors h2,
body.inverted-colors h3,
body.inverted-colors p,
body.inverted-colors li,
body.inverted-colors span,
body.inverted-colors .button {
    color: var(--text) !important;
}

/* Re-adjust specific backgrounds/borders */
body.inverted-colors nav,
body.inverted-colors footer,
body.inverted-colors .terminal,
body.inverted-colors .status,
body.inverted-colors .work-item,
body.inverted-colors .project,
body.inverted-colors .skill-chip,
body.inverted-colors .skill-slot,
body.inverted-colors .result-box,
body.inverted-colors .essay-tile {
    background: var(--bg) !important;
    border-color: var(--border) !important;
}

body.inverted-colors .button.primary {
    background: var(--bg) !important;
    color: var(--text) !important;
    border-color: var(--text) !important;
}

body.inverted-colors .button.primary:hover {
    opacity: 0.8;
    background: var(--bg) !important;
}

/* Specific adjustments for terminal dots */
body.inverted-colors .terminal-dot:nth-child(1) { background: #ff5f57 !important; }
body.inverted-colors .terminal-dot:nth-child(2) { background: #ffbd2e !important; }
body.inverted-colors .terminal-dot:nth-child(3) { background: #28ca42 !important; }

body.inverted-colors .read-more {
    color: #0969da !important;
}

/* Specific padding for Essays hero section */
#essays.hero {
    padding: 40px 0;
}