:root {
    /* Elegant Dark Blue Theme for Light Mode (Default) */
    --primary-color: #1e40af;
    /* Blue 800 */
    --secondary-color: #172554;
    /* Blue 950 */
    --accent-color: #3b82f6;
    /* Blue 500 */
    --text-dark: #1e293b;
    --text-light: #475569;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(30, 58, 138, 0.1);

    --hero-bg-start: #1e3a8a;
    /* Dark Blue */
    --hero-bg-end: #3b82f6;
    /* Bright Blue */
}

[data-theme="dark"] {
    --primary-color: #38bdf8;
    /* Cyan/Light Blue */
    --secondary-color: #818cf8;
    /* Indigo */
    --accent-color: #0ea5e9;
    --text-dark: #f0f9ff;
    --text-light: #94a3b8;
    --bg-light: #0f172a;
    /* Slate 900 - Deep Blue */
    --bg-white: #020617;
    /* Slate 950 - Even Deeper Blue */
    --border-color: #1e293b;
    --glass-bg: rgba(15, 23, 42, 0.7);
    /* Deep Blue Glass */
    --glass-border: rgba(56, 189, 248, 0.1);
    /* Cyan hint */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    --hero-bg-start: #0f172a;
    /* Match dark bg or slightly lighter */
    --hero-bg-end: #1e3a8a;
    /* Dark Blue */
}

/* Language Visibility Utilities */
/* Default (loading/no js): Show JP, Hide EN? Or handle via body class default */
/* We will assume body has data-lang="jp" by default or set by JS */

[data-lang="jp"] .lang-en {
    display: none !important;
}

[data-lang="en"] .lang-jp {
    display: none !important;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--bg-white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 5rem 0;
}

.section-alt {
    background-color: var(--bg-light);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* ===== Navigation ===== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

#navbar.scrolled {
    box-shadow: var(--shadow-md);
}

#navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

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

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-dark);
    transition: var(--transition);
    border-radius: 2px;
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
    color: white;
    text-align: center;
    padding: 8rem 2rem 4rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,144C960,149,1056,139,1152,122.7C1248,107,1344,85,1392,74.7L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.5;
}

.hero-image-container {
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease;
}

.hero-profile-img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

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

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease;
}

.highlight {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.95;
    animation: fadeInUp 1s ease 0.2s backwards;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    animation: fadeInUp 1s ease 0.4s backwards;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    animation: fadeInUp 1s ease 0.6s backwards;
}

.btn {
    padding: 0.875rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    display: inline-block;
    border: 2px solid transparent;
}

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

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: transparent;
    color: white;
    border-color: white;
}

.btn-secondary:hover {
    background-color: white;
    color: var(--primary-color);
    transform: translateY(-3px);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: bounce 2s infinite;
    color: white;
    opacity: 0.8;
}

.scroll-indicator span {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.arrow {
    width: 24px;
    height: 24px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg);
}

/* ===== About Section ===== */
.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.8;
}

.about-text strong {
    color: var(--text-dark);
    font-weight: 600;
}

.about-image {
    display: flex;
    justify-content: center;
}

.image-placeholder {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

.image-placeholder svg {
    width: 100%;
    height: 100%;
}

/* ===== Timeline (Education) ===== */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
}

.timeline-item {
    position: relative;
    padding-left: 60px;
    margin-bottom: 3rem;
}

.timeline-marker {
    position: absolute;
    left: 10px;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: 4px solid var(--bg-light);
    box-shadow: var(--shadow-md);
}

.timeline-content {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.timeline-content:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.timeline-content h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.timeline-content h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-style: italic;
}

.timeline-content p {
    color: var(--text-light);
    line-height: 1.7;
}

/* ===== Experience Section ===== */
.experience-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.experience-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-top: 4px solid var(--primary-color);
}

.experience-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.experience-card h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.experience-date {
    font-size: 0.875rem;
    color: var(--text-light);
    white-space: nowrap;
    background: var(--bg-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.experience-card h4 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

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

/* ===== Skills Section ===== */
.skills-content {
    max-width: 900px;
    margin: 0 auto;
}

.skill-category {
    margin-bottom: 3rem;
}

.skill-category h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.skill-item {
    margin-bottom: 1.5rem;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.skill-name {
    font-weight: 600;
    color: var(--text-dark);
}

.skill-level {
    color: var(--primary-color);
    font-weight: 600;
}

.skill-bar {
    height: 10px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 1s ease;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.skill-tag {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    transition: var(--transition);
}

.skill-tag:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.research-list {
    display: grid;
    gap: 1.5rem;
}

.research-item {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
}

.research-item h4 {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.research-item p {
    color: var(--text-light);
    line-height: 1.7;
}

/* ===== Contact Section ===== */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1000px;
    margin: 0 auto;
}

.contact-description {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    display: flex;
    gap: 1.5rem;
}

.contact-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.contact-icon svg {
    width: 24px;
    height: 24px;
}

.contact-text h4 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.contact-text p {
    color: var(--text-light);
    line-height: 1.6;
}

.hobbies-section h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.hobbies-grid {
    display: grid;
    gap: 1.5rem;
}

.hobby-card {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: var(--transition);
}

.hobby-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.hobby-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hobby-card h4 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.hobby-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===== Footer ===== */
.footer {
    background-color: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem;
}

.footer p {
    margin: 0.5rem 0;
    opacity: 0.8;
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.6);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lang-toggle {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.6);
}

.scroll-top-btn {
    right: 90px;
    /* Shift scroll top button to left of toggle */
}

/* ===== Animations ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes staggered-delay {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 1.5rem;
    }

    section {
        padding: 3rem 0;
    }

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

    /* Navigation */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-white);
        width: 100%;
        text-align: center;
        transition: var(--transition);
        box-shadow: var(--shadow-md);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    /* Hero */
    .hero {
        padding: 6rem 1.5rem 3rem;
    }

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

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    /* About */
    .about-content {
        grid-template-columns: 1fr;
    }

    .about-image {
        order: -1;
    }

    .image-placeholder {
        width: 200px;
        height: 200px;
    }

    /* Timeline */
    .timeline::before {
        left: 10px;
    }

    .timeline-item {
        padding-left: 45px;
    }

    .timeline-marker {
        left: 0;
    }

    /* Experience */
    .experience-grid {
        grid-template-columns: 1fr;
    }

    .experience-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Contact */
    .contact-content {
        grid-template-columns: 1fr;
    }
}

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

    .hero-subtitle {
        font-size: 1rem;
    }

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