:root {
    --clr-bg: #0e0e10;
    --clr-surface: #1c1c21;
    --clr-text-main: #ffffff;
    --clr-text-muted: #a1a1aa;
    --clr-border: #27272a;
    --clr-nav-hover: rgba(255, 255, 255, 0.1); 
    --gradient-primary: linear-gradient(to right, #ff00cc, #333399);
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
    --radius-pill: 100vw;
    --radius-card: 16px;
    --ff-primary: 'Barlow', sans-serif;
    --ff-serif: 'Fraunces', serif;
    --clr-selection-bg: #ffffff; 
    --clr-selection-text: #0e0e10;
    --clr-focus: #ffffff;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--clr-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--clr-border);
    border-radius: 10px;
    border: 2px solid var(--clr-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--clr-text-muted);
}

[data-theme="light"] {
    --clr-bg: #efeae2;
    --clr-surface: #fdfbf7;
    --clr-text-main: #27272a;
    --clr-text-muted: #6e6e73;
    --clr-border: #dcd8d0;
    --clr-nav-hover: rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --clr-selection-bg: #27272a;
    --clr-selection-text: #fdfbf7;
    --clr-focus: #000000;
}

::selection {
    background: var(--clr-selection-bg);
    color: var(--clr-selection-text);
    text-shadow: none;
}

::-moz-selection {
    background: var(--clr-selection-bg);
    color: var(--clr-selection-text);
    text-shadow: none;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
    font-family: var(--ff-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

section, .site-footer {
    scroll-margin-top: 100px;
}

body.modal-open {
    overflow: hidden;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
button { font-family: inherit; }

main {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0; 
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

:focus-visible {
    outline: 2px solid var(--clr-focus);
    outline-offset: 4px;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

h1, h2, h3, .logo, .big-name {
    font-family: var(--ff-serif);
    font-weight: 800;
}

.wrapper {
    width: min(100% - 2rem, 1100px);
    margin-inline: auto;
    position: relative;
    z-index: 2;
}

.section { padding-block: 6rem; }
.bg-alt { background-color: var(--clr-bg); }

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    text-transform: lowercase;
    letter-spacing: -0.02em;
}

.section-divider {
    border: none;
    height: 1px;
    background-color: var(--clr-border);
    margin-block: 0;
    width: 100%;
}

.gradient-hover {
    background-image: var(--gradient-primary);
    background-size: 100%;
    background-repeat: no-repeat;
    background-clip: text;
    -webkit-background-clip: text;
    color: var(--clr-text-main);
    transition: color 0.4s ease;
}
.gradient-hover:hover { color: transparent; }

.scroll-reveal-text {
    position: relative;
    color: var(--clr-text-main);
    text-decoration: none;
    display: inline-block;
}

.scroll-reveal-text::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 10px;
    height: 8px;
    width: 0;
    background: var(--gradient-primary);
    z-index: -1;
    animation: revealUnderline 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

@keyframes revealUnderline {
    from { width: 0; }
    to { width: 100%; }
}

.floating-header {
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0;
    width: 100%;
    max-width: 1280px; 
    margin-inline: auto;
    display: flex; 
    justify-content: center;
    z-index: 1000; 
    pointer-events: none;
    transition: all 0.5s ease-in-out;
    padding-top: 2rem;
    padding-bottom: 1.5rem; 
    border-bottom: 1px solid var(--clr-border);
}

.nav-container {
    pointer-events: auto; 
    display: flex; 
    align-items: center; 
    gap: 3rem;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    padding: 0 1rem;
    width: 100%;
    border-radius: 0;
    justify-content: space-between; 
    transition: all 0.5s ease-in-out;
}

.floating-header.scrolled {
    top: 20px;
    width: 100%; 
    padding-top: 0;
    padding-bottom: 0; 
    border-bottom: none; 
}

.floating-header.scrolled .nav-container {
    background: var(--clr-surface); 
    border: 1px solid var(--clr-border);
    padding: 0.75rem 2rem; 
    border-radius: var(--radius-pill);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.2);
    width: max-content;
    justify-content: center;
    backdrop-filter: blur(10px);
}
[data-theme="dark"] .floating-header.scrolled .nav-container { background: rgba(28, 28, 33, 0.85); }
[data-theme="light"] .floating-header.scrolled .nav-container { background: rgba(253, 251, 247, 0.85); }

.logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.5px; }
.nav-list { display: flex; gap: 0.5rem; }

.nav-list a { 
    font-size: 0.95rem; 
    font-weight: 500; 
    color: var(--clr-text-muted); 
    padding: 0.5em 1em; 
    border-radius: 8px; 
    transition: all 0.2s ease;
}

.nav-list a:hover, 
.nav-list a.active-link { 
    color: var(--clr-text-main); 
    background-color: var(--clr-nav-hover); 
}

.nav-controls { display: flex; align-items: center; gap: 1rem; padding-left: 2rem; border-left: 1px solid var(--clr-border); }

.floating-header:not(.scrolled) .nav-controls {
    border-left-color: transparent; 
}

.nav-toggle { display: none; background: none; border: none; font-size: 1.2rem; color: var(--clr-text-main); cursor: pointer;}

.btn-icon { 
    background: none; 
    border: none; 
    color: var(--clr-text-muted);
    cursor: pointer; 
    font-size: 1.1rem; 
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    height: 24px;
    width: 24px;
}
.btn-icon:hover { 
    color: var(--clr-text-main); 
}

.btn-text span {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.btn-text:hover span {
    margin-left: 6px;
}

.cv-dropdown { 
    position: relative; 
    display: flex; 
    align-items: center;
}
.cv-options {
    position: absolute; 
    top: 150%; 
    left: 50%;
    transform: translateX(-50%);
    background: var(--clr-surface); 
    border: 1px solid var(--clr-border);
    border-radius: 8px; 
    min-width: 140px; 
    width: max-content;
    max-width: 90vw;
    padding: 0.5rem;
    display: flex; 
    flex-direction: column; 
    box-shadow: var(--shadow);
    opacity: 1; 
    visibility: visible; 
    transition: 0.2s;
    z-index: 1001;
}
.cv-options.hidden { 
    opacity: 0; 
    visibility: hidden; 
    transform: translateX(-50%) translateY(-10px); 
}
.cv-options a { padding: 8px 12px; font-size: 0.85rem; border-radius: 4px; }
.cv-options a:hover { background: var(--clr-border); }

.theme-toggle { 
    background: transparent; 
    border: none; 
    cursor: pointer; 
    color: var(--clr-text-muted); 
    padding: 0; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: color 0.3s ease;
}

.theme-toggle:hover {
    color: var(--clr-text-main);
}

.theme-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.sun-core {
    fill: currentColor;
    transition: r 0.4s, transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: center;
}

.moon-cutout {
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: center;
}

.sun-rays {
    stroke: currentColor;
    stroke-width: 2px;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.5s;
    transform-origin: center;
    opacity: 0;
    transform: scale(0.6);
}

[data-theme="light"] .theme-icon {
    transform: rotate(90deg);
}

[data-theme="light"] .sun-core {
    r: 5; 
}

[data-theme="light"] .moon-cutout {
    transform: translate(25px, -15px);
}

[data-theme="light"] .sun-rays {
    opacity: 1;
    transform: scale(1);
}

.sun-core {
    r: 9;
}

.moon-cutout {
    transform: translate(0, 0); 
}

.hero { 
    padding-top: 12rem;
    padding-bottom: 8rem;
    min-height: 100vh; 
    display: flex; 
    align-items: center; 
    position: relative; 
    overflow: hidden; 
}

.hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px); 
    opacity: 0.25; 
    z-index: 1; 
    animation: float-glow 10s infinite alternate ease-in-out;
}

.glow-1 {
    top: 10%;
    right: -5%; 
    width: 700px; 
    height: 700px;
    background: radial-gradient(circle, #ff00cc 0%, transparent 70%);
}

.glow-2 {
    bottom: 0%;
    right: 15%; 
    width: 600px; 
    height: 600px;
    background: radial-gradient(circle, #333399 0%, transparent 70%);
    animation-delay: -5s; 
}

@keyframes float-glow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-30px, 30px) scale(1.05); }
}

.hero-title { 
    font-size: clamp(5rem, 14vw, 10rem);
    line-height: 0.95; 
    margin-bottom: 2rem; 
    letter-spacing: -0.04em;
    font-weight: 800;
}
.hero-subtitle { font-size: 1.35rem; color: var(--clr-text-muted); max-width: 50ch; margin-bottom: 3rem; }
.hero-actions { display: flex; gap: 1.5rem; align-items: center; }

.btn { padding: 1.1em 2.2em; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.95rem; cursor: pointer; text-transform: lowercase; transition: 0.3s; border: 1px solid transparent; }
.btn-primary { background: var(--clr-text-main); color: var(--clr-bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 15px rgba(255,255,255,0.3); }
[data-theme="light"] .btn-primary:hover { box-shadow: 0 0 15px rgba(0,0,0,0.2); }

.btn-text { background-color: transparent; color: var(--clr-text-main); padding-inline: 0; }

.grid-3, .projects-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 2rem; 
}

.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    padding: 2rem;
    border-radius: var(--radius-card);
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    height: 100%; 
    display: flex;
    flex-direction: column;
}

.card:hover { border-color: var(--clr-text-main); transform: translateY(-5px); }
.card-icon { font-size: 2rem; margin-bottom: 1rem; color: var(--clr-text-muted); transition: 0.3s; }
.card:hover .card-icon { color: var(--clr-text-main); }

.skill-card:hover {
    transform: none; 
}

.project-card { cursor: pointer; } 
.project-card.hidden { display: none; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.company { font-weight: 800; font-family: var(--ff-serif); font-size: 1.1rem; }

.card-title { margin-bottom: 1rem; font-size: 1.25rem; line-height: 1.3; }
.card-desc { color: var(--clr-text-muted); font-size: 0.95rem; flex-grow: 1; }
.tech-stack { display: flex; gap: 0.8rem; margin-top: 1.5rem; flex-wrap: wrap; }
.tech-stack li { font-size: 0.75rem; color: var(--clr-text-muted); border: 1px solid var(--clr-border); padding: 4px 10px; border-radius: 20px; }

.filters { display: flex; gap: 1rem; margin-bottom: 3rem; flex-wrap: wrap; }
.filter-btn { background: transparent; border: 1px solid var(--clr-border); color: var(--clr-text-muted); padding: 0.5em 1.5em; border-radius: var(--radius-pill); cursor: pointer; transition: 0.3s; }
.filter-btn.active, .filter-btn:hover { border-color: var(--clr-text-main); color: var(--clr-text-main); }

.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid var(--clr-border);
    color: var(--clr-text-muted);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    min-height: 30px;
}

.pulse-dot {
    display: block;
    width: 6px;
    height: 6px;
    background-color: var(--clr-text-main);
    border-radius: 50%;
    animation: pulse-mono 2s infinite;
}

@keyframes pulse-mono {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.5; }
    100% { transform: scale(0.95); opacity: 1; }
}

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--clr-text-main);
    color: var(--clr-bg);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    z-index: 900;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: all;
}

.site-footer { padding-top: 6rem; padding-bottom: 3rem; border-top: 1px solid var(--clr-border); margin-top: 4rem; }
.footer-label { font-size: 0.9rem; color: var(--clr-text-muted); margin-bottom: 1rem; }
.big-name { font-size: clamp(3rem, 8vw, 6rem); line-height: 0.9; letter-spacing: -3px; display: block; margin-bottom: 3rem; width: fit-content; }
.footer-links { display: flex; gap: 2rem; margin-bottom: 4rem; flex-wrap: wrap; }
.social-link { background: transparent; border: none; font-family: var(--ff-primary); font-size: 1.1rem; color: var(--clr-text-muted); cursor: pointer; position: relative; padding: 0; }
.social-link::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 1px; background: var(--gradient-primary); transition: 0.3s; }
.social-link:hover { color: var(--clr-text-main); }
.social-link:hover::after { width: 100%; }
.copyright { font-size: 0.8rem; color: var(--clr-text-muted); opacity: 0.5; }

.toast-msg {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px); 
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
    color: var(--clr-text-main);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

[data-theme="light"] .toast-msg {
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.1);
}

.toast-msg.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}
::view-transition-new(root) { z-index: 2147483647; }
::view-transition-old(root) { z-index: 1; }

@media (max-width: 900px) {
    .grid-3, .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-3, .projects-grid { grid-template-columns: 1fr; }
    
    .floating-header { 
        top: 10px; 
        padding-inline: 10px; 
        width: 100%; 
        border-bottom: none; 
    }
    
    .nav-container { 
        padding: 0.5rem 1.5rem; 
        width: 100%; 
        justify-content: space-between; 
        gap: 0;
        background: var(--clr-surface) !important;
        border: 1px solid var(--clr-border) !important;
        border-radius: var(--radius-pill) !important;
        box-shadow: 0 10px 40px -10px rgba(0,0,0,0.2) !important;
    }
    
    .nav-list { 
        position: fixed; 
        top: 95px; 
        left: 10px; 
        right: 10px; 
        background: rgba(28, 28, 33, 0.9); 
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid var(--clr-border); 
        flex-direction: column; 
        padding: 2rem; 
        border-radius: var(--radius-card); 
        text-align: center; 
        display: flex; 
        visibility: hidden;
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
        pointer-events: none;
        box-shadow: 0 15px 50px -10px rgba(0,0,0,0.5);
    }

    [data-theme="light"] .nav-list {
        background: rgba(255, 255, 255, 0.9); 
        box-shadow: 0 15px 50px -10px rgba(0,0,0,0.1);
    }
    
    .nav-list[data-visible="true"] { 
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
    
    .nav-controls { 
        padding-left: 1rem; 
        border-left: 1px solid var(--clr-border);
        margin-left: 0.5rem;
        gap: 0;
        display: flex;
        align-items: center;
    }
    
    .cv-dropdown {
        margin-right: 1rem;
    }

    .theme-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0;
        width: 24px;
        height: 24px;
    }
    
    .nav-toggle { 
        display: flex;
        align-items: center;
        justify-content: center;
        
        margin-left: 1rem;
        padding-left: 1rem;
        border-left: 1px solid var(--clr-border);
        
        height: 24px;
        font-size: 1.2rem;
        color: var(--clr-text-main);
        background: none;
        border-top: none;
        border-right: none;
        border-bottom: none;
        cursor: pointer;
    }
    
    .hero-title { font-size: 4rem; }

    .scroll-reveal-text::after {
        display: none !important;
    }
}

.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    transition: visibility 0s linear 0.3s;
}

.modal.open {
    visibility: visible;
    transition-delay: 0s;
}

.modal-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transform: translateZ(0);
    will-change: opacity;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.modal.open .modal-backdrop {
    opacity: 1;
}

.modal-content {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    width: min(90%, 600px);
    max-height: 80vh;
    border-radius: var(--radius-card);
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal.open .modal-content {
    opacity: 1;
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--clr-border);
}

.modal-company {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--clr-text-muted);
}

.mac-close-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #ff5f56;
    border: 1px solid #e0443e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: 0.2s;
}

.mac-close-btn .icon-x {
    font-size: 10px;
    color: #4d0000;
    opacity: 0;
    line-height: 1;
    font-weight: bold;
    display: block;
    margin-top: -1px; 
}

.mac-close-btn:hover {
    background-color: #ff5f56; 
}

.mac-close-btn:hover .icon-x {
    opacity: 0.6;
}

.modal-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.modal-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
}

.modal-tags li {
    font-size: 0.8rem;
    color: var(--clr-text-muted); 
    background: transparent;
    border: 1px solid var(--clr-border);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    list-style-type: none;
}

.modal-description {
    color: var(--clr-text-muted);
    font-size: 1rem;
    line-height: 1.7;
}

.modal-description p {
    margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-glow { display: none; }
}

.bg-grid {
    background-color: var(--clr-bg);
    background-image: radial-gradient(var(--clr-border) 1px, transparent 1px);
    background-size: 30px 30px; 
    position: relative;
}

.bg-grid::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, transparent 20%, var(--clr-bg) 90%);
    pointer-events: none;
}

.hero-404 {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.title-404 {
    font-family: var(--ff-primary);
    font-weight: 600;
    font-size: clamp(8rem, 25vw, 16rem);
    margin-bottom: 0;
    line-height: 0.9;
    letter-spacing: -5px;
    color: var(--clr-text-main);
}

.subtitle-404 {
    font-family: var(--ff-primary);
    font-weight: 300;
    font-size: clamp(2rem, 8vw, 6rem);
    margin-top: 0;
    margin-bottom: 3rem;
    line-height: 1;
    color: var(--clr-text-main);
}

.actions-404 {
    justify-content: center;
}