

:root {
    --bg: #FAFAFA;
    --text: #0F172A;
    --accent: #2DD4BF;
    --link: #0D9488;
    --font: 'Outfit', -apple-system, sans-serif;
    --ease: cubic-bezier(0.85, 0, 0.15, 1);
}

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

body, html {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background-color: #F4F4F4;
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    text-transform: lowercase;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.site-wrapper {
    max-width: 1366px;
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    position: relative;
    background-color: var(--bg);
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

.viewport {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.corner-nav {
    position: absolute;
    z-index: 100;
    font-size: 1.1rem;
    font-weight: 500;
}

.corner-nav a {
    color: var(--text);
    text-decoration: none;
    position: relative;
    padding: 10px;
}

.top-left { top: 2rem; left: 2rem; }
.top-right { top: 2rem; right: 2rem; }
.bottom-left { bottom: 2rem; left: 2rem; }
.bottom-right { bottom: 2rem; right: 2rem; }

.content-panel h2 a:not(.contact-link) {
    color: var(--link);
    text-decoration: none;
    position: relative;
    padding: 0 4px;
}

.content-panel h2 a:not(.contact-link)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 4px;
    width: 0;
    height: 2px;
    background-color: var(--link);
    transition: width 0.3s var(--ease);
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 10px;
    width: 0;
    height: 2px;
    background-color: var(--text);
    transition: width 0.3s var(--ease);
}

.content-panel h2 a:hover::after,
.hover-underline:hover::after {
    width: calc(100% - 8px);
}

.stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 1s var(--ease);
}

.hero-visual {
    position: relative;
    cursor: default;
    transition: transform 0.4s var(--ease);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-image {
    width: 180px;
    height: auto;
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    pointer-events: none;
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.hero-visual:hover {
    transform: scale(1.05);
}

.hero-text {
    position: relative;
    font-size: 4rem;
    font-family: 'Short Stack', cursive;
    font-weight: 400;
    line-height: 1.2;
    cursor: default;
    text-transform: lowercase;
    user-select: none;
    -webkit-user-select: none;
}

.hero-text .line {
    display: block;
    position: relative;
    white-space: nowrap;
}

.hero-text .char {
    display: inline-block;
    transition: transform 0.3s var(--ease), color 0.3s ease;
}

.hero-text:hover .char {
    animation: wave 0.6s ease infinite;
    animation-delay: calc(var(--char-index) * 0.05s);
}

@keyframes wave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.floating-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-dot {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
}

.floating-dot:nth-child(1) {
    width: 20px;
    height: 20px;
    background: #FF6B9D;
    animation: roam1 50s ease-in-out infinite;
}

.floating-dot:nth-child(2) {
    width: 12px;
    height: 12px;
    background: #4ECDC4;
    animation: roam2 60s ease-in-out infinite;
}

.floating-dot:nth-child(3) {
    width: 16px;
    height: 16px;
    background: #FFE66D;
    animation: roam3 45s ease-in-out infinite;
}

.floating-dot:nth-child(4) {
    width: 10px;
    height: 10px;
    background: #95E1D3;
    animation: roam4 55s ease-in-out infinite;
}

.floating-dot:nth-child(5) {
    width: 14px;
    height: 14px;
    background: #F38181;
    animation: roam5 65s ease-in-out infinite;
}

.floating-dot:nth-child(6) {
    width: 18px;
    height: 18px;
    background: #A8E6CF;
    animation: roam6 52s ease-in-out infinite;
}

.floating-dot:nth-child(7) {
    width: 8px;
    height: 8px;
    background: #FFD93D;
    animation: roam7 58s ease-in-out infinite;
}

.floating-dot:nth-child(8) {
    width: 22px;
    height: 22px;
    background: #C7CEEA;
    animation: roam8 48s ease-in-out infinite;
}

.floating-dot:nth-child(9) {
    width: 11px;
    height: 11px;
    background: #FFAAA5;
    animation: roam9 62s ease-in-out infinite;
}

@keyframes roam1 {
    0% { transform: translate(10vw, 20vh); }
    25% { transform: translate(70vw, 15vh); }
    50% { transform: translate(80vw, 70vh); }
    75% { transform: translate(20vw, 80vh); }
    100% { transform: translate(10vw, 20vh); }
}

@keyframes roam2 {
    0% { transform: translate(80vw, 60vh); }
    33% { transform: translate(15vw, 80vh); }
    66% { transform: translate(30vw, 10vh); }
    100% { transform: translate(80vw, 60vh); }
}

@keyframes roam3 {
    0% { transform: translate(50vw, 85vh); }
    20% { transform: translate(85vw, 40vh); }
    40% { transform: translate(60vw, 10vh); }
    60% { transform: translate(10vw, 30vh); }
    80% { transform: translate(25vw, 75vh); }
    100% { transform: translate(50vw, 85vh); }
}

@keyframes roam4 {
    0% { transform: translate(5vw, 50vh); }
    30% { transform: translate(40vw, 20vh); }
    60% { transform: translate(75vw, 50vh); }
    100% { transform: translate(5vw, 50vh); }
}

@keyframes roam5 {
    0% { transform: translate(90vw, 25vh); }
    25% { transform: translate(60vw, 75vh); }
    50% { transform: translate(20vw, 60vh); }
    75% { transform: translate(45vw, 15vh); }
    100% { transform: translate(90vw, 25vh); }
}

@keyframes roam6 {
    0% { transform: translate(35vw, 5vh); }
    20% { transform: translate(75vw, 35vh); }
    40% { transform: translate(65vw, 85vh); }
    60% { transform: translate(25vw, 65vh); }
    80% { transform: translate(15vw, 25vh); }
    100% { transform: translate(35vw, 5vh); }
}

@keyframes roam7 {
    0% { transform: translate(55vw, 90vh); }
    50% { transform: translate(45vw, 10vh); }
    100% { transform: translate(55vw, 90vh); }
}

@keyframes roam8 {
    0% { transform: translate(2vw, 15vh); }
    25% { transform: translate(88vw, 25vh); }
    50% { transform: translate(92vw, 85vh); }
    75% { transform: translate(8vw, 75vh); }
    100% { transform: translate(2vw, 15vh); }
}

@keyframes roam9 {
    0% { transform: translate(40vw, 45vh); }
    33% { transform: translate(70vw, 20vh); }
    66% { transform: translate(20vw, 70vh); }
    100% { transform: translate(40vw, 45vh); }
}

.hero-subtitle {
    margin-top: 1.5rem;
    font-size: 1.25rem;
    font-family: 'Short Stack', cursive;
    font-weight: 400;
    color: #64748B;
    letter-spacing: 0.5px;
    text-transform: lowercase;
}

.hero-tagline {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    font-family: 'Short Stack', cursive;
    font-weight: 400;
    color: #94A3B8;
    letter-spacing: 0.3px;
    text-transform: lowercase;
}

.hero-subtitle a {
    color: var(--link);
    text-decoration: none;
    position: relative;
}

.hero-subtitle a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--link);
    transition: width 0.3s var(--ease);
}

.hero-subtitle a:hover::after {
    width: 100%;
}

.panel-about .sub-text + .sub-text {
    margin-top: 1.5rem;
}

.inline-link {
    color: var(--link);
    text-decoration: none;
    position: relative;
}

.inline-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--link);
    transition: width 0.3s var(--ease);
}

.inline-link:hover::after {
    width: 100%;
}

.content-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s var(--ease);
    z-index: 20;
}

@media (max-width: 768px) {
    .content-panel {
        background-color: var(--bg);
    }
}

.panel-inner {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.8s var(--ease);
    -webkit-overflow-scrolling: touch;
    padding: 0px 1rem 0px 0px;

}

.panel-inner::-webkit-scrollbar {
    width: 4px;
}

.panel-inner::-webkit-scrollbar-track {
    background: transparent;
}

.panel-inner::-webkit-scrollbar-thumb {
    background: var(--text);
    border-radius: 2px;
}

.content-panel h2 {
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.sub-text {
    font-size: 1.25rem;
    color: #64748B;
    line-height: 1.5;
}

.minimal-works-list {
    list-style: none;
    border-top: 1px solid #E2E8F0;
}

.works-item {
    border-bottom: 1px solid #E2E8F0;
}

.works-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 0;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
    transition: color 0.3s ease;
}

.works-link:hover {
    color: var(--link);
}

.works-date {
    font-size: 0.9rem;
    color: #94A3B8;
    white-space: nowrap;
    flex-shrink: 0;
}

.back-link {
    display: inline-block;
    font-size: 0.95rem;
    color: #64748B;
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--accent);
}

.project-inner {
    max-width: 600px;
}

.project-client {
    font-size: 1rem;
    color: #94A3B8;
    margin-bottom: 1.5rem;
    margin-top: -1rem;
}

.client-link {
    color: var(--link);
    text-decoration: none;
    position: relative;
}

.client-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--link);
    transition: width 0.3s var(--ease);
}

.client-link:hover::after {
    width: 100%;
}

.project-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.project-description {
    margin-bottom: 1.5rem;
}

.project-description p,
.project-description li {
    font-size: 1.25rem;
    color: #64748B;
    line-height: 1.6;
}

.project-description p {
    margin-bottom: 1.5rem;
}

.project-description p:last-child {
    margin-bottom: 0;
}

.project-description h3 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.project-description ul,
.project-description ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.project-description ul {
    list-style: disc;
}

.project-description ol {
    list-style: decimal;
}

.project-description ul:last-child,
.project-description ol:last-child {
    margin-bottom: 0;
}

.project-description li {
    margin-bottom: 0.5rem;
}

.project-description a {
    color: var(--link);
    text-decoration: none;
    position: relative;
}

.project-description a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--link);
    transition: width 0.3s var(--ease);
}

.project-description a:hover::after {
    width: 100%;
}

.project-description strong {
    font-weight: 700;
    color: var(--text);
}

.project-description em {
    font-style: italic;
}

.project-description code {
    font-family: 'Courier New', Courier, monospace;
    background: #f1f5f9;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.project-description pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.project-description pre code {
    background: transparent;
    padding: 0;
    font-size: 1em;
    line-height: 1.4;
    font-family: 'VT323', monospace;
}

.hl-keyword { color: #d73a49; font-weight: 500; }
.hl-string { color: #032f62; }
.hl-number { color: #0969da; }
.hl-comment { color: #6a737d; font-style: italic; }
.hl-preprocessor { color: #953800; }
.hl-bracket { color: #24292f; }

.project-description img.markdown-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0 1.5rem 0;
    display: block;
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.project-link {
    display: inline-block;
    font-size: 1.1rem;
    color: var(--link);
    text-decoration: none;
    position: relative;
}

.project-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--link);
    transition: width 0.3s var(--ease);
}

.project-link:hover::after {
    width: 100%;
}

.works-item.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    border-bottom: none;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #E2E8F0;
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.contact-link {
    display: block;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text);
    text-decoration: none;
    margin-top: 1rem;
    position: relative;
    width: max-content;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--text);
    transition: width 0.3s var(--ease);
}

.panel-contact .contact-link::after {
    bottom: 5px;
}

.contact-link:hover::after {
    width: 100%;
}

.viewport[data-state="about"] .stage {
    transform: translate(-100%, -50%) scale(0.7);
}
.viewport[data-state="about"] .panel-about {
    opacity: 1;
    pointer-events: auto;
}
.viewport[data-state="about"] .panel-about .panel-inner {
    transform: translateY(0);
}

.viewport[data-state="works"] .stage {
    transform: translate(-100%, -50%) scale(0.7);
}
.viewport[data-state="works"] .panel-works {
    opacity: 1;
    pointer-events: auto;
}
.viewport[data-state="works"] .panel-works .panel-inner {
    transform: translateY(0);
}

.viewport[data-state="project"] .stage {
    transform: translate(-100%, -50%) scale(0.7);
}
.viewport[data-state="project"] .panel-project {
    opacity: 1;
    pointer-events: auto;
}
.viewport[data-state="project"] .panel-project .panel-inner {
    transform: translateY(0);
}

.viewport[data-state="contact"] .stage {
    transform: translate(-100%, -50%) scale(0.7);
}
.viewport[data-state="contact"] .panel-contact {
    opacity: 1;
    pointer-events: auto;
}
.viewport[data-state="contact"] .panel-contact .panel-inner {
    transform: translateY(0);
}

.viewport[data-state="writeups"] .stage {
    transform: translate(-100%, -50%) scale(0.7);
}
.viewport[data-state="writeups"] .panel-writeups {
    opacity: 1;
    pointer-events: auto;
}
.viewport[data-state="writeups"] .panel-writeups .panel-inner {
    transform: translateY(0);
}

.viewport[data-state="writeup"] .stage {
    transform: translate(-100%, -50%) scale(0.7);
}
.viewport[data-state="writeup"] .panel-writeup {
    opacity: 1;
    pointer-events: auto;
}
.viewport[data-state="writeup"] .panel-writeup .panel-inner {
    transform: translateY(0);
}

.viewport:not([data-state="home"]) .hero-subtitle,
.viewport:not([data-state="home"]) .hero-tagline {
    opacity: 0;
    transform: translateY(10px);
}

.viewport:not([data-state="home"]) .hero-image {
    opacity: 0;
    transform: translateY(10px);
}

.viewport[data-state="about"] .bottom-left a::after,
.viewport[data-state="works"] .bottom-right a::after,
.viewport[data-state="contact"] .top-right a::after,
.viewport[data-state="project"] .bottom-right a::after {
    width: calc(100% - 20px);
}

@media (max-width: 768px) {
    .hero-visual {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-image {
        position: static;
        transform: none;
        width: 120px;
        margin-top: 1.5rem;
    }

    .viewport:not([data-state="home"]) .hero-image {
        transform: translateY(10px);
    }

    .hero-text {
        font-size: 2.8rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-tagline {
        font-size: 0.85rem;
    }
    
    .content-panel {
        align-items: flex-start;
        justify-content: center;
        padding: 5rem 8%;
        overflow-y: auto;
    }
    
    .panel-inner {
        /* max-height: 70vh; */
        overflow-y: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    .panel-inner::-webkit-scrollbar {
        width: 3px;
    }
    
    .panel-inner::-webkit-scrollbar-thumb {
        background: var(--text);
        border-radius: 2px;
    }
    
    .panel-inner {
        scrollbar-width: thin;
        scrollbar-color: var(--text) transparent;
    }
    
    .viewport:not([data-state="home"]) .stage {
        transform: translate(-50%, -120%) scale(0.6);
    }
    
    .content-panel h2 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }
    
    .sub-text {
        font-size: 1.1rem;
    }
    
    .works-link {
        padding: 1.2rem 0;
        font-size: 1.25rem;
    }
    
    .project-inner {
        max-width: 100%;
    }
    
    .project-image {
        max-height: 300px;
    }
    
    .project-description p,
    .project-description li {
        font-size: 1.1rem;
    }
    
    .project-client {
        font-size: 0.9rem;
        margin-top: -0.5rem;
    }
    
    .panel-contact .contact-link {
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .floating-dots {
        display: none;
    }

    .hero-text:hover .char {
        animation: none !important;
    }

    .spinner {
        animation: none !important;
        border-top-color: #E2E8F0;
    }

    .stage {
        transition: none !important;
    }

    .content-panel {
        transition: none !important;
    }

    .panel-inner {
        transition: none !important;
    }

    .hero-visual {
        transition: none !important;
    }

    .hero-visual:hover {
        transform: none !important;
    }
}
