/* ===== CSS VARIABLES ===== */
:root {
    --bg: #f5f5f5;
    --primary: #c8c8c8;
    --primary-darker: #828282;
    --secondary: #505050;
    --red: #e62937;
    --cyan: #66bfff;
    --text-primary: #505050;
    --text-secondary: #828282;
    --text-light: #c8c8c8;
    --spacing: 24px;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    height: 100%;
    position: relative;
}

code,
.mono {
    font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
}

strong {
    color: var(--primary-darker);
}

/* ===== SIDE NAVIGATION ===== */
.side-nav {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 100;
    padding: 20px;
}

.side-nav a {
    position: relative;
    display: flex;
    align-items: center;
    width: 110px;
    height: 28px;
    margin: 20px 0;
    overflow: visible;
    text-decoration: none;
}

.kitty {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: url("./assets/kitty.webp") center / cover no-repeat;
    pointer-events: none;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.side-nav a .kitty {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: url("./assets/kitty.webp") center / cover no-repeat;
    pointer-events: auto;
    transform: scale(1) rotate(0deg);
}

.guitar {
    position: absolute;
    left: -12px;
    top: 0;
    width: 110px;
    height: 28px;
    background: url("./assets/guitar.webp") left center / auto 28px no-repeat;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.side-nav a.active .kitty {
    opacity: 0;
    transform: scale(0.8) rotate(-360deg);
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.side-nav a.active .guitar {
    opacity: 1;
    transform: scale(1);
}

/* ===== INFO SIDEBAR ===== */
.info-section {
    background: white;
    border: 2px solid var(--primary);
    padding: calc(var(--spacing) * 1.5);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.info-section h3 {
    color: var(--secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing);
    font-weight: 600;
}

.contact-icons {
    display: flex;
    gap: 24px;
    justify-content: flex-start;
}

.contact-icon {
    width: 60px;
    height: 60px;
    background: white;
    border: 5px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    transition: 0.125s;
    font-size: 1.3rem;
    cursor: pointer;
    flex-shrink: 0;
}

.contact-icon:hover {
    background: white;
    border: 5px solid #000 !important;
    color: var(--secondary);
}

.contact-icon:focus {
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
}

.location-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.location-link i {
    font-size: 1.2rem;
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--spacing) * 3);
    position: relative;
    overflow: hidden;
}

.hero-canvas-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.3;
    pointer-events: none;
}

.hero-canvas-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(to top,
            rgba(245, 245, 245, 1) 0%,
            rgba(245, 245, 245, 0) 30%);
    pointer-events: none;
    z-index: 2;
}

.hero-container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: calc(var(--spacing) * 3);
    align-items: start;
    position: relative;
    z-index: 3;
    padding: 0 var(--spacing);
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing) * 2);
    grid-column: 1;
    grid-row: 1;
    background: transparent;
    padding: calc(var(--spacing) * 2);
}

.hero-right {
    display: none;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--spacing) * 3);
    grid-column: 1 / -1;
    grid-row: 2;
}

.info-grid .info-section:first-child {
    grid-column: 1;
    align-self: start;
}

.info-grid .info-section:last-child {
    grid-column: 2;
    align-self: start;
}

.hero-name {
    font-size: 1rem;
    font-family: 'Acme 9', sans-serif;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(245, 245, 245, 0.8);
}

.hero-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    line-height: 1.1;
    color: var(--secondary);
    font-weight: 700;
    letter-spacing: -2px;
    text-shadow: 0 0 20px rgba(245, 245, 245, 0.9);
    word-wrap: break-word;
}

.hero-title .age {
    color: var(--red);
}

.hero-langs {
    font-family: "JetBrains Mono", monospace;
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    text-shadow: 0 0 10px rgba(245, 245, 245, 0.8);
}

.lang-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.lang-icon i {
    font-size: 1.2rem;
}

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

.btn {
    padding: 16px 40px;
    background: var(--red);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border: 5px solid var(--red);
    cursor: pointer;
    transition: 0.125s;
    font-size: 1rem;
    display: inline-block;
}

.btn:hover {
    border: 5px solid #000 !important;
}

.btn:focus {
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
}

.btn-secondary {
    background: transparent;
    border: 5px solid var(--cyan);
    color: var(--cyan);
}

.btn-secondary:hover {
    background: transparent;
    border: 5px solid #000 !important;
    color: var(--secondary);
}

.wasm-container {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing) * 2);
}

.wasm-canvas {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    display: block;
    /* allow default touch behavior so the page can scroll when the pointer is over the canvas */
    touch-action: auto;
}

.hero-canvas-background {
    /* Ensure decorative background canvas does not block pointer events */
    pointer-events: none;
}

/* ===== SECTION COMMON ===== */
section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--spacing) * 5) calc(var(--spacing) * 3);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing);
    margin-bottom: calc(var(--spacing) * 4);
}

.section-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    font-family: "JetBrains Mono", monospace;
}

.section-title {
    font-size: 2.5rem;
    color: var(--secondary);
    font-weight: 700;
    letter-spacing: -1px;
}

/* ===== PROJECTS GRID ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: calc(var(--spacing) * 2);
}

.project-card {
    background: white;
    border: 2px solid var(--primary);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.project-image {
    width: 100%;
    height: 240px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--primary);
    position: relative;
}

.project-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, var(--primary) 1px, transparent 1px),
        linear-gradient(0deg, var(--primary) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.2;
}

.project-content {
    padding: calc(var(--spacing) * 1.5);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-content h3 {
    color: var(--secondary);
    margin-bottom: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.project-content p {
    color: var(--text-secondary);
    margin-bottom: calc(var(--spacing) * 1.5);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
}

.project-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: calc(var(--spacing) * 1.5);
}

.btn-small {
    padding: 10px 24px;
    background: var(--red);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.125s;
    display: inline-block;
    border: 5px solid var(--red);
    cursor: pointer;
}

.btn-small:hover {
    border: 5px solid #000 !important;
}

.btn-small:focus {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.btn-small.secondary {
    background: transparent;
    border: 5px solid var(--cyan);
    color: var(--cyan);
}

.btn-small.secondary:hover {
    background: transparent;
    border: 5px solid #000 !important;
    color: var(--secondary);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--primary-darker);
    font-family: "JetBrains Mono", monospace;
}

/* ===== ABOUT SECTION ===== */
.about-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(var(--spacing) * 2);
}

.about-card {
    background: white;
    border: 2px solid var(--primary);
    padding: calc(var(--spacing) * 2);
    transition: all 0.3s ease;
}

.about-card:hover {
    border-color: var(--cyan);
}

.about-card-icon {
    width: 60px;
    height: 60px;
    background: var(--red);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Acme 9', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: var(--spacing);
}

.about-card h3 {
    color: var(--secondary);
    font-size: 1.3rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.about-card p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== CONTACT SECTION ===== */
.contact-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.contact-title {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: var(--spacing);
    font-weight: 700;
    letter-spacing: -1px;
}

.contact-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: calc(var(--spacing) * 3);
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: calc(var(--spacing) * 3);
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--spacing) * 1.5);
    background: white;
    border: 2px solid var(--primary);
    text-decoration: none;
    color: var(--secondary);
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.contact-link:hover {
    border-color: var(--cyan);
    transform: translateX(8px);
}

.contact-link strong {
    color: var(--cyan);
    font-weight: 600;
}

/* ===== EXPERIENCE 404 ===== */
.experience-404 {
    text-align: center;
    padding: calc(var(--spacing) * 4);
    font-family: 'JetBrains Mono', monospace;
}

.experience-404 h3 {
    font-size: 1.5rem;
    font-family: 'Acme 9', sans-serif;
    color: var(--red);
    margin-bottom: 16px;
}

.experience-404 p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ==== EXPERIENCE CONTRIBUTIONS ===== */
.contributions-graph {
    margin-top: var(--spacing);
    text-align: center;
}

.contact-link:focus {
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
}

.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--red);
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.location-badge:hover {
    background: var(--secondary);
}

.text_link {
    text-decoration: none;
    color: var(--primary-darker);
    /* font-weight: bold; */
}

.text_link:hover {
    color: var(--text-primary);
}

/* ===== FOOTER ===== */
footer {
    background: var(--secondary);
    color: white;
    padding: calc(var(--spacing) * 2);
    text-align: center;
    font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
    .side-nav {
        display: none;
    }

    .takanaka, .takanaka-hand {
        display: none;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: calc(var(--spacing) * 2);
        padding: 0;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing);
    }

    .info-grid .info-section:first-child {
        grid-column: 1;
    }

    .info-grid .info-section:last-child {
        grid-column: 1;
    }

    .section-number {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

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

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

    .hero {
        padding: calc(var(--spacing) * 2);
    }

    .wasm-canvas {
        height: 60vh;
    }

    .location-link {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .contact-title {
        font-size: 2rem;
    }

    section {
        min-height: auto;
        padding: calc(var(--spacing) * 2) var(--spacing);
    }

    #projects,
    #about {
        min-height: 0;
        padding: var(--spacing);
    }

    .section-container {
        margin: 0;
    }

    .hero {
        padding: var(--spacing);
        min-height: auto;
    }

    .hero-content {
        padding: 0;
    }

    /* Hide canvas on mobile */
    .hero-canvas-background {
        display: none;
    }

    .hero-canvas-fade {
        display: none;
    }

    .wasm-canvas {
        display: none;
    }

    .hero-langs {
        font-size: 0.85rem;
        gap: 12px;
    }

    .hero-name {
        font-size: 0.9rem;
    }

    /* Stack buttons vertically on mobile */
    .hero-cta {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .btn {
        width: 100%;
        text-align: center;
        padding: 14px 24px;
        font-size: 0.95rem;
    }

    /* Contact icons on mobile */
    .contact-icons {
        flex-direction: row;
        gap: 6px;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .contact-icon {
        width: 45px !important;
        height: 45px !important;
        min-width: 45px !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
    }

    .info-section {
        padding: var(--spacing);
    }

    .location-link {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .hero-langs {
        font-size: 0.75rem;
        gap: 8px;
    }

    .lang-icon i {
        font-size: 1rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .contact-icon {
        width: 100%;
        height: 45px;
        font-size: 1.1rem;
    }

    .info-section h3 {
        font-size: 0.85rem;
    }

    .location-link {
        font-size: 0.75rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-number {
        font-size: 1.5rem;
    }
}

.takanaka {
    position: absolute;
    left: -6px;
    width: 120px;
}

.takanaka-hand {
    position: absolute;
    left: 27.5px;
    width: 40px;
    z-index: 690;
}

/* ===== ACCESSIBILITY ===== */
:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

@font-face {
    font-family: 'Acme 9';
    src: url("Acme 9 Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

#contributions-section {
    display: none;
}