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

:root {
    --bg: #fbfbfb;
    --text: #1d1d1f;
    --text-secondary: #444;
    --text-muted: #888;
    --text-faint: #999;
    --border: #eee;
    --skill-bg: #f0f0f0;
    --skill-text: #555;
    --link-underline: #ccc;
    --clippy-bg: #fff;
    --clippy-border: #ddd;
    --clippy-text: #333;
    --close-bg: #e0e0e0;
    --close-text: #666;
}

.dark-mode {
    --bg: #121212;
    --text: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-faint: #52525b;
    --border: #27272a;
    --skill-bg: #27272a;
    --skill-text: #a1a1aa;
    --link-underline: #52525b;
    --clippy-bg: #1e1e1e;
    --clippy-border: #333;
    --clippy-text: #e4e4e7;
    --close-bg: #333;
    --close-text: #999;
}

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

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 80px 24px 40px;
}

section {
    margin-bottom: 48px;
}

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

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

h3 a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--link-underline);
}

h3 a:hover {
    text-decoration-color: var(--text);
}

.tagline {
    color: var(--text-muted);
    font-size: 18px;
}

p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--link-underline);
    text-underline-offset: 2px;
}

a:hover {
    text-decoration-color: var(--text);
}

/* Skills */
.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-list span {
    background: var(--skill-bg);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--skill-text);
    transition: background 0.3s, color 0.3s;
}

/* Projects */
.project {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.project:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.project p {
    font-size: 15px;
    margin-bottom: 8px;
}

.tech {
    font-size: 13px;
    color: var(--text-muted);
}

/* Contact */
.contact-links {
    display: flex;
    gap: 24px;
}

.contact-links a {
    font-size: 15px;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid var(--border);
}

footer p {
    font-size: 13px;
    color: var(--text-faint);
}

/* Clippy - prominent and fully visible */
.clippy {
    position: fixed;
    bottom: 40px;
    right: -220px;
    z-index: 90;
    cursor: pointer;
    transition: right 0.5s ease;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.clippy.visible {
    right: 40px;
}

.clippy.shake {
    animation: shake 0.6s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.clippy-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--close-bg);
    color: var(--close-text);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clippy:hover .clippy-close {
    opacity: 1;
}

.clippy-bubble {
    background: var(--clippy-bg);
    border: 1px solid var(--clippy-border);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 15px;
    color: var(--clippy-text);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    white-space: nowrap;
    transition: background 0.3s, border-color 0.3s, color 0.3s;
}

.clippy-icon {
    font-size: 56px;
    line-height: 1;
}

/* Terminal */
.terminal-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
}

.terminal-overlay.visible {
    display: flex;
}

.terminal {
    width: 90%;
    max-width: 520px;
    background: #0a0a0a;
    border-radius: 8px;
    font-family: "SF Mono", Monaco, "Courier New", monospace;
    font-size: 13px;
    color: #f0f0f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.terminal-titlebar {
    background: linear-gradient(#3c3c3c, #2a2a2a);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #000;
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

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

.terminal-btn.close { background: #ff5f56; }
.terminal-btn.minimize { background: #ffbd2e; }
.terminal-btn.maximize { background: #27ca40; }

.terminal-title {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-right: 52px;
}

.terminal-body {
    padding: 16px;
    min-height: 120px;
    background: #0a0a0a;
}

.terminal-output {
    margin-bottom: 12px;
}

.terminal-output p {
    color: #ccc;
    margin-bottom: 4px;
    line-height: 1.5;
}

.terminal-system {
    color: #888;
}

.terminal-output span {
    color: #0f0;
    font-weight: bold;
}

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

.terminal-prompt {
    color: #5af78e;
    margin-right: 8px;
    white-space: nowrap;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f0f0f0;
    font: inherit;
    outline: none;
    caret-color: #5af78e;
}

#terminal-input::placeholder {
    color: #444;
}

/* Flying matrix hint */
.flying-hint {
    position: absolute;
    color: #5af78e;
    font-family: "SF Mono", Monaco, "Courier New", monospace;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 8px #5af78e;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.flying-hint.active {
    opacity: 1;
}

#matrix-hint {
    transition: opacity 0.5s;
    color: #5af78e;
}

#matrix-hint.hidden {
    opacity: 0;
}

/* Matrix */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    min-width: 100%;
    min-height: 100%;
    z-index: 300;
    display: none;
    background: #000;
}

#matrix-canvas.active {
    display: block;
}

/* Matrix text - NO background, just glowing text */
.matrix-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 350;
    text-align: center;
    display: none;
    font-family: "SF Mono", Monaco, monospace;
    pointer-events: none;
}

.matrix-text.visible {
    display: block;
}

.matrix-text p {
    font-size: 28px;
    color: #0f0;
    margin-bottom: 20px;
    opacity: 0;
    text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 40px #0f0;
    background: transparent;
}

.matrix-text p.visible {
    animation: fadeIn 1s forwards;
}

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

/* Dark mode toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    background: var(--skill-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.3s, border-color 0.3s, transform 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s, transform 0.3s;
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg);
}

.dark-mode .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg);
}

.dark-mode .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

/* Responsive */
@media (max-width: 600px) {
    main {
        padding: 60px 20px 40px;
    }

    h1 {
        font-size: 28px;
    }

    .clippy.visible {
        right: 20px;
        bottom: 30px;
    }

    .clippy-icon {
        font-size: 44px;
    }

    .clippy-bubble {
        padding: 12px 14px;
        font-size: 14px;
    }
}
