:root {
    --color-bg: #050A18;
    /* Deep Midnight Blue */
    --color-text: #F0F4F8;
    --color-accent: #4A90E2;
    --color-gradient-1: #00f260;
    /* Teal/Green */
    --color-gradient-2: #0575E6;
    /* Blue */
    --color-gradient-3: #e100ff;
    /* Magenta */
    --color-sub: #8B9BB4;
    --font-jp: 'Noto Sans JP', sans-serif;
    --font-en: 'Outfit', sans-serif;
    --cursor-size: 20px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    /* Offset for fixed header */
}

body {
    font-family: var(--font-jp);
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    cursor: none;
    /* Hide default cursor */
}

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

/* Custom Cursor */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--cursor-size);
    height: var(--cursor-size);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    transition: width 0.3s ease, height 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    mix-blend-mode: difference;
}

.cursor.active {
    width: 60px;
    height: 60px;
    background-color: #ffffff;
    border-color: rgba(255, 255, 255, 0.5);
    /* backdrop-filter: blur(4px); Removed for readability */
    mix-blend-mode: difference;
}

/* Education card as link */
.course-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* Canvas Background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 1;
    /* Increased opacity for colors */
    mix-blend-mode: screen;
    /* Blend with dark background */
}

/* Layout */
.wrapper {
    position: relative;
    z-index: 1;
    padding: 0 5%;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    mix-blend-mode: exclusion;
}

.logo {
    font-family: var(--font-en);
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.nav ul {
    display: flex;
    gap: 3rem;
    list-style: none;
}

.nav-link {
    font-family: var(--font-en);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    position: relative;
}

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

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

/* Hero Section */
.hero-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.hero-subtitle {
    font-family: var(--font-en);
    color: var(--color-sub);
    margin-bottom: 2rem;
    letter-spacing: 0.2em;
    font-size: 1rem;
    opacity: 0;
    animation: fadeUp 1s ease forwards 0.5s;
}

.hero-title {
    font-family: var(--font-en);
    font-size: clamp(3rem, 10vw, 8rem);
    line-height: 1.1;
    font-weight: 300;
    margin-bottom: 3rem;
    mix-blend-mode: overlay;
}

.reveal-text {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: textRelea 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-text:nth-child(2) {
    animation-delay: 0.2s;
}

.hero-name {
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    color: var(--color-sub);
    opacity: 0;
    animation: fadeUp 1s ease forwards 1s;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    right: 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.5s;
}

.scroll-indicator span {
    font-family: var(--font-en);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    writing-mode: vertical-rl;
}

.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background-color: var(--color-sub);
    position: relative;
    overflow: hidden;
}

.scroll-indicator .line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-text);
    transform: translateY(-100%);
    animation: scrollLine 2s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}

/* Sections General */
.section {
    padding: 10rem 0;
}

.section-header {
    margin-bottom: 5rem;
    display: flex;
    align-items: baseline;
    gap: 2rem;
}

.section-number {
    font-family: var(--font-en);
    color: var(--color-accent);
    font-size: 1.2rem;
    font-weight: 600;
}

.section-title {
    font-family: var(--font-en);
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #fff, var(--color-sub), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* About Section */
.content-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 5rem;
}

.text-block h3 {
    font-size: 2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    font-weight: 500;
}

.text-block p {
    color: var(--color-sub);
    line-height: 2;
    margin-bottom: 2rem;
}

/* About Dynamic Titles */
.dynamic-topic-title {
    font-family: var(--font-en);
    font-size: 1.2rem;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    letter-spacing: 0.1em;
    border-bottom: 1px solid rgba(74, 144, 226, 0.3);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Fade Transitions for Dynamic Content */
.fade-transition {
    transition: opacity 0.4s ease;
}

.fade-out {
    opacity: 0 !important;
}

.fade-in {
    opacity: 1 !important;
}

/* About Layout Refactor */
.about-wrapper {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.about-subnav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.subnav-btn {
    background: none;
    border: none;
    font-family: var(--font-en);
    color: var(--color-sub);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
    position: relative;
}

.subnav-btn:hover,
.subnav-btn.active {
    color: var(--color-accent);
}

.subnav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -17px;
    /* Align with border-bottom of ul */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-accent);
}

.about-dynamic-content {
    margin-top: 2rem;
    min-height: 200px;
}

.dynamic-section .bilingual-text {
    display: grid;
    gap: 1rem;
}

.dynamic-section .ja {
    font-size: 0.9rem;
    color: var(--color-sub);
    margin-top: 0.5rem;
}

.bilingual-container {
    position: relative;
    cursor: default;
    display: grid;
    grid-template-areas: "content";
}

.bilingual-container .lang-ja {
    grid-area: content;
    transition: opacity 0.4s ease;
}

.bilingual-container:hover .lang-ja {
    opacity: 0;
}

.bilingual-container .lang-en {
    grid-area: content;
    position: static;
    /* Reset absolute */
    opacity: 0;
    transition: opacity 0.4s ease;
    background-color: var(--color-bg);
    /* Ensure opaque background */
}

/* Ensure background color is defined securely if variable is missing, though var(--bg-color) is standard here */
.bilingual-container .lang-en {
    background-color: #050A18;
    /* Fallback/Safety in case var is actually called something else or transparent */
    background-color: var(--color-bg);
}

.bilingual-container:hover .lang-en {
    opacity: 1;
}

.profile-block {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 2rem;
}

.profile-block h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.profile-block .role {
    font-family: var(--font-en);
    color: var(--color-accent);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.timeline {
    list-style: none;
}

.timeline li {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--color-sub);
}

.timeline strong {
    color: var(--color-text);
    font-family: var(--font-en);
    margin-right: 1rem;
}

/* Research Section */
.research-list {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.category-header {
    font-family: var(--font-en);
    font-size: 1.5rem;
    color: var(--color-sub);
    margin-top: 4rem;
    margin-bottom: 2rem;
    padding-left: 1rem;
    border-left: 3px solid var(--color-accent);
}

.research-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 2rem;
    padding: 3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease;
    text-decoration: none;
    /* Ensure link underline is removed */
    color: inherit;
    /* Inherit text color */
    cursor: pointer;
}

.research-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.research-item .year {
    font-family: var(--font-en);
    color: var(--color-accent);
    align-self: flex-start;
    /* Prevent stretching */
    padding-top: 5px;
}

.research-info {
    display: flex;
    flex-direction: column;
}

.research-info h3 {
    font-family: var(--font-en);
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.research-item:hover .research-info h3 {
    color: var(--color-accent);
}

.research-info p {
    color: var(--color-sub);
    font-size: 0.9rem;
}

.research-info .subtitle {
    margin-bottom: 1rem;
}

/* Summary Hover Effect */
.research-summary {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.8;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: all 0.4s ease-in-out;
}

.research-item:hover .research-summary {
    max-height: 200px;
    /* Approximate max height */
    opacity: 1;
    margin-top: 1rem;
    padding: 1rem;
}

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

.activity-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.activity-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
}

.activity-date {
    font-family: var(--font-en);
    color: var(--color-accent);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    display: block;
}

.activity-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-weight: 500;
}

.activity-desc {
    font-size: 0.9rem;
    color: var(--color-sub);
    line-height: 1.8;
}

/* Members Section */
.members-group {
    margin-bottom: 5rem;
}

.group-title {
    font-family: var(--font-en);
    font-size: 1.5rem;
    color: var(--color-sub);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.current-members {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.member-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem;
    border-radius: 4px;
}

.member-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.member-thesis {
    display: block;
    font-size: 0.8rem;
    color: var(--color-sub);
}

.alumni-list {
    display: grid;
    grid-template-columns: 1fr;
}

.alumni-item {
    display: grid;
    grid-template-columns: 80px 150px 1fr;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    align-items: center;
}

.alumni-item .year {
    font-family: var(--font-en);
    color: var(--color-accent);
}

.alumni-item .name {
    font-weight: 500;
}

.alumni-item .thesis {
    color: var(--color-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Education Section */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.course-card {
    padding: 3rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.course-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
}

.course-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.course-card p {
    font-family: var(--font-en);
    color: var(--color-sub);
    font-size: 0.9rem;
}

/* Footer */
.footer {
    padding: 5rem 0;
    text-align: center;
    color: var(--color-sub);
    font-family: var(--font-en);
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Animations */
@keyframes textRelea {
    0% {
        transform: translateY(50px);
        opacity: 0;
    }

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

@keyframes fadeUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

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

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes scrollLine {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

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

/* Hamburger Menu (PC: Hidden) */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    cursor: pointer;
    z-index: 1001;
    padding: 15px;
    /* Increase tap area */
    margin: -15px;
    /* Compensate for padding to keep layout position */
}

/* Sub-nav Mobile (Default: Hidden on PC) */
.sub-nav-mobile {
    display: none;
}

.hamburger-menu span {
    width: 100%;
    height: 2px;
    background-color: var(--color-text);
    transition: all 0.3s ease;
}

/* Responsive */
/* Responsive */
@media (max-width: 768px) {

    /* Global Spacing */
    .section {
        padding: 5rem 0;
    }

    .wrapper {
        padding: 0 16px;
    }

    /* Header & Hamburger */
    .header {
        padding: 1.5rem 5%;
        background: rgba(5, 10, 24, 0.9);
        backdrop-filter: blur(10px);
    }

    .hamburger-menu {
        display: flex;
    }

    /* Hamburger Active State */
    .hamburger-menu.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

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

    .hamburger-menu.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Mobile Navigation Drawer */
    .nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: var(--color-bg);
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        pointer-events: none;
    }

    .nav.active {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav ul {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .nav-link {
        font-size: 1.5rem;
        /* Large text for mobile menu */
        display: block;
        padding: 10px;
    }

    /* Hero */
    .hero-title {
        font-size: 3rem;
    }

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

    .hero-section {
        height: auto;
        min-height: 100vh;
        padding-top: 80px;
    }

    .scroll-indicator {
        bottom: 1rem;
        right: 1rem;
    }

    /* Grids to Single Column */
    .content-grid,
    .activities-grid,
    .education-grid,
    .current-members {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    /* Typography */
    .section-title {
        font-size: 2.5rem;
    }

    .section-header {
        margin-bottom: 1.5rem;
        /* Reduced from 5rem for mobile */
    }

    .text-block h3 {
        font-size: 1.5rem;
    }

    .text-block p {
        font-size: 0.95rem;
        line-height: 1.8;
    }

    /* Research Section */
    .research-item {
        grid-template-columns: 1fr;
        /* Stack year and content */
        gap: 0.5rem;
        padding: 2rem 0;
    }

    .research-item .year {
        font-size: 0.9rem;
        opacity: 0.8;
    }

    /* Horizontal Scrolling Tabs (About & Research) */
    .about-subnav ul {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 1.5rem;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
        /* Hide scrollbar */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE 10+ */
    }

    .about-subnav ul::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .subnav-btn {
        font-size: 0.9rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Research Shortcuts (if they act as subnav) */
    /* Assuming a class exists or identifying by context. The user mentioned 'Research > Sub topic'. */
    /* If there are research shortcut buttons, same style applies. */

    /* Research List Item Stacking */
    .research-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 2rem 0;
    }

    /* Research Summary: Always visible on mobile */
    .research-summary {
        max-height: none;
        opacity: 1;
        margin-top: 1rem;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.05);
        /* Slightly lighter for visibility */
    }

    .research-item:hover .research-summary {
        /* Keep same as default mobile state */
        max-height: none;
        margin-top: 1rem;
        padding: 1rem;
    }

    /* About Subnav: Switch to Select */
    .about-subnav {
        display: none;
        /* Hide horizontal list */
    }

    .sub-nav-mobile {
        display: block;
        /* Show select */
        margin-bottom: 2rem;
    }

    .sub-nav-mobile select {
        width: 100%;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.1);
        color: var(--color-text);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        font-size: 1rem;
        font-family: var(--font-en);
    }

    .subnav-btn {
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Bilingual: Stack vertically */
    .bilingual-container .lang-ja,
    .bilingual-container .lang-en {
        grid-area: auto;
        /* Reset grid overlap */
        position: static;
        opacity: 1 !important;
        /* Force visible */
        transition: none;
    }

    .bilingual-container {
        grid-template-areas: none;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .bilingual-container .lang-en {
        color: var(--color-sub);
        font-size: 0.9em;
        /* Differentiate slightly */
    }

    /* Members */
    .alumni-item {
        grid-template-columns: 1fr;
        /* Stack alumni details */
        gap: 0.25rem;
        padding: 1rem 0;
    }

    .alumni-item .year,
    .alumni-item .name,
    .alumni-item .thesis {
        display: block;
    }

    /* Allow wrapping */
    grid-column: auto;
}
}

/* Hide Cursor on Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .cursor {
        display: none !important;
    }

    body,
    a,
    button {
        cursor: auto !important;
    }
}

/* Scroll to Top */
.scroll-top {
    position: fixed;
    bottom: 3rem;
    right: 5%;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    opacity: 0;
    pointer-events: none;
    border-radius: 50%;
    /* Optional circle shape, or keep square. User said 'Triangle button', text is triangle. Circle container usually looks best. */
}

.scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-top:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    transform: translateY(-5px);
}

/* View More Button */
.view-more-btn {
    display: block;
    margin: 3rem auto 0;
    padding: 0.8rem 2.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-sub);
    font-family: var(--font-en);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.1em;
}

.view-more-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(255, 255, 255, 0.05);
}

/* Ensure Research Shortcuts look good */
.research-shortcuts {
    margin-bottom: 3rem;
}

/* Ensure research items have consistent spacing when view more is used */
.research-category-group {
    margin-bottom: 5rem;
}