:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #22d3ee;
    --accent-dim: #0891b2;
    --accent-glow: rgba(34, 211, 238, 0.15);
    --border: #27272a;
    --border-hover: #3f3f46;
    --success: #4ade80;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Outfit', system-ui, sans-serif;
    --transition: 0.2s ease;
    --transition-slow: 0.4s ease;
}

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

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
}

html {
    scroll-behavior: smooth;
    overflow-x: clip;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: clip;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Background Grid */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.bg-grid.visible {
    opacity: 1;
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 3rem;
    min-height: 64px;
    z-index: 100;
    background: rgba(10, 10, 11, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition);
}

.nav.scrolled {
    border-bottom-color: var(--border);
}

.nav-logo {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--transition);
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a.nav-link-active {
    color: var(--accent);
}

.nav-links a.nav-link-active::after {
    width: 100%;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-resume {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: 4px;
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 99;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-menu a {
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.mobile-menu a:hover {
    color: var(--accent);
}

.mobile-resume {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.75rem 2rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 1rem;
}

/* Main Content */
main {
    position: relative;
    z-index: 1;
}

section {
    padding: 6rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 3rem;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 3rem;
    gap: 4rem;
}

.hero-content {
    max-width: 800px;
}

.terminal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.terminal-prompt {
    color: var(--accent);
}

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

.terminal-cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent);
}

@keyframes blink {
    50% { opacity: 0; }
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-title em {
    font-style: normal;
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.hero-subtitle a {
    color: var(--accent);
    transition: opacity var(--transition);
}

.hero-subtitle a:hover {
    opacity: 0.8;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: #5eead4;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

/* Hero Terminal */
.hero-terminal {
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease 0.3s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.terminal-dots {
    display: flex;
    gap: 6px;
}

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

.terminal-dots span:nth-child(1) { background: #ff5f56; }
.terminal-dots span:nth-child(2) { background: #ffbd2e; }
.terminal-dots span:nth-child(3) { background: #27c93f; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.terminal-body {
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.terminal-line {
    margin-bottom: 0.75rem;
}

.terminal-command {
    color: var(--text-secondary);
}

.terminal-output {
    color: var(--text-muted);
    line-height: 1.8;
}

/* Worked Across */
.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.logo-card {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    transition: transform var(--transition), box-shadow var(--transition);
}

.logo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.logo-card img {
    max-width: 150px;
    max-height: 46px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-slow);
}

.project-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.project-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
}

.project-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.project-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.project-tags span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

.project-link {
    font-size: 0.85rem;
    color: var(--accent);
    transition: gap var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

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

.project-link:hover {
    gap: 0.75rem;
}

/* Experience Cards */
.experience-list {
    display: grid;
    gap: 1.25rem;
}

.experience-card {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    transition: border-color var(--transition), transform var(--transition);
}

.experience-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.experience-brand {
    min-height: 118px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.experience-brand.light-brand {
    background: rgba(255, 255, 255, 0.94);
}

.experience-brand.single-brand img {
    max-height: 58px;
    width: auto;
}

.experience-brand.dual-brand,
.dual-brand {
    gap: 1rem;
}

.dual-brand img {
    max-height: 42px;
    width: auto;
}

.text-brand {
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    line-height: 1.8;
}

.experience-copy {
    display: grid;
    gap: 0.65rem;
}

.experience-period {
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.74rem;
}

.experience-copy h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.experience-copy p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.75;
}

/* Section Leads */
.section-lead {
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin: -1.75rem 0 2.25rem;
    max-width: 820px;
}

/* Craft */
.craft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.craft-card,
.principle-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    transition: border-color var(--transition), transform var(--transition);
}

.craft-card:hover,
.principle-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.craft-card h3,
.principle-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.craft-card p,
.principle-card p {
    color: var(--text-secondary);
    line-height: 1.75;
}

/* Principles */
.principles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.principle-number {
    display: inline-block;
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    letter-spacing: 0.12em;
}

/* Contact */
.contact {
    position: relative;
}

.contact .section-lead {
    max-width: 760px;
    margin: -1.75rem 0 2rem;
}

.contact-content {
    max-width: 760px;
}

.contact-content-ref {
    max-width: 900px;
}

.contact-text {
    max-width: 780px;
    font-size: 1.08rem;
    color: var(--text-secondary);
    margin-bottom: 2.4rem;
    line-height: 1.85;
    text-align: left;
}

.contact-links {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 120px;
    background: rgba(17, 17, 19, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    padding: 0.95rem 1.35rem;
    border-radius: 999px;
    transition: all var(--transition);
}

.contact-link:hover {
    border-color: rgba(34, 211, 238, 0.4);
    background: rgba(24, 24, 27, 0.96);
    transform: translateY(-2px);
}

.contact-links-minimal .contact-link-minimal {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.contact-links-minimal .contact-link-minimal:hover {
    color: var(--accent);
}

/* Footer */
.footer {
    text-align: center;
    padding: 3rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-hint {
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    opacity: 0.5;
}

.footer-hint kbd {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
}

/* Command Palette */
.command-palette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.command-palette.open {
    opacity: 1;
    pointer-events: all;
}

.command-palette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.command-palette-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(-20px);
    transition: transform var(--transition);
}

.command-palette.open .command-palette-content {
    transform: translateY(0);
}

.command-palette-input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
}

.command-palette-input::placeholder {
    color: var(--text-muted);
}

.command-palette-results {
    max-height: 300px;
    overflow-y: auto;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background var(--transition);
}

.command-item:hover,
.command-item.selected {
    background: var(--bg-tertiary);
}

.command-icon {
    color: var(--text-muted);
    font-size: 1rem;
}

.command-text {
    flex: 1;
    font-size: 0.95rem;
}

.command-shortcut {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Secret Mode */
.secret-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.secret-mode.open {
    opacity: 1;
    pointer-events: all;
}

.secret-content {
    text-align: center;
    max-width: 500px;
    padding: 3rem;
}

.secret-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.secret-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.secret-content .btn {
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 900px) {
    .section-lead {
        margin-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav {
        padding: calc(0.9rem + env(safe-area-inset-top)) max(1rem, calc(1.5rem + env(safe-area-inset-right))) 0.9rem max(1rem, calc(1.5rem + env(safe-area-inset-left)));
    }

    .nav-toggle {
        display: flex;
    }

    section {
        padding: 4rem 1.5rem;
    }

    .hero {
        min-height: 100svh;
        padding-top: 2.5rem;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero-cta .btn {
        width: 100%;
    }

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

    .experience-card {
        grid-template-columns: 1fr;
    }

    .contact-links {
        flex-direction: column;
    }

    .contact-link {
        justify-content: center;
    }

}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.project-card:nth-child(1) {
    animation: float 6s ease-in-out infinite;
    animation-delay: 0s;
}

.project-card:nth-child(2) {
    animation: float 6s ease-in-out infinite;
    animation-delay: 2s;
}

.project-card:nth-child(3) {
    animation: float 6s ease-in-out infinite;
    animation-delay: 4s;
}

/* Scroll animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}
