/* Theme Variables */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #00ff00;
    --text-secondary: #ffffff;
    --accent-primary: #00ff00;
    --accent-secondary: rgba(0, 255, 0, 0.1);
    --nav-bg: rgba(0, 0, 0, 0.8);
    --card-bg: rgba(255, 255, 255, 0.05);
    --font-mono: 'Fira Code', monospace;
    --font-main: 'Noto Serif JP', serif;
    --terminal-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    --cursor-color: #00ff00;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f0f4;
    --text-primary: #ff8fab;
    --text-secondary: #333333;
    --accent-primary: #ff8fab;
    --accent-secondary: rgba(255, 143, 171, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.8);
    --card-bg: rgba(255, 143, 171, 0.05);
    --terminal-shadow: 0 0 15px rgba(255, 143, 171, 0.2);
    --cursor-color: #ff8fab;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    width: 40px;
    height: 40px;
    position: relative;
}

.theme-toggle:hover {
    transform: rotate(45deg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

[data-theme="light"] .theme-toggle-dark {
    display: none;
}

[data-theme="dark"] .theme-toggle-light {
    display: none;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

/* Keep nav font consistent regardless of theme */
nav {
    font-family: var(--font-main);
}

[data-theme="dark"] nav {
    font-family: var(--font-main);
}

/* Ensure consistent button appearance */
.cv-button {
    font-family: var(--font-main);
}

[data-theme="dark"] .cv-button {
    font-family: var(--font-main);
}

[data-theme="dark"] body {
    font-family: var(--font-mono);
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    z-index: -1;
}

/* Header and Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: var(--terminal-shadow);
}

nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 2rem;
    padding: 0;
    margin: 0;
}

nav ul li {
    display: flex;
    align-items: center;
}

nav ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: color 0.3s ease;
}

nav ul li a:hover {
    color: var(--text-primary);
}

.cv-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    min-width: 90px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.cv-button:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

.cv-button img {
    transition: transform 0.3s ease;
}

.cv-button:hover img {
    transform: scale(1.1);
}

/* Main Content */
main {
    padding-top: 80px;
}

section {
    padding: 4rem 2rem;
}

h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: var(--text-secondary);
}

/* Hero Section */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
}

.hero-container {
    display: flex;
    align-items: center;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.profile-section {
    flex: 1;
}

.profile-image {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-primary);
    box-shadow: var(--terminal-shadow);
}

.hero-content {
    flex: 1;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.typing-text {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links img {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.social-links img:hover {
    transform: scale(1.2);
}

/* About Section */
.about-container {
    max-width: 1200px;
    margin: 0 auto;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.about-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.about-avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
}

.about-title h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.subtitle {
    color: var(--accent-primary);
    font-size: 1.2rem;
}

.about-description {
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.about-description p {
    margin-bottom: 1rem;
}

.education-info {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.education-icon {
    width: 64px;
    height: 64px;
    padding: 12px;
    background: var(--accent-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.education-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

[data-theme="dark"] .education-icon img {
    filter: invert(1);
}

.education-details h3 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.education-details p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.about-highlights {
    display: grid;
    gap: 2rem;
}

.highlight-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    display: flex;
    gap: 1.5rem;
}

.highlight-icon {
    width: 64px;
    height: 64px;
    padding: 12px;
    background: var(--accent-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.highlight-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

[data-theme="dark"] .highlight-icon img {
    filter: invert(1);
}

.highlight-content h3 {
    margin-bottom: 1rem;
}

.highlight-content ul {
    list-style: none;
}

.highlight-content li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.highlight-content li::before {
    content: "•";
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

/* Stats Section */
#stats {
    background: var(--accent-secondary);
}

.stats-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.stat-item {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    padding: 12px;
    background: var(--accent-secondary);
    border-radius: 50%;
}

.stat-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Tech Stack Section */
.tech-slider {
    overflow: hidden;
    padding: 2rem 0;
}

.tech-track {
    display: flex;
    animation: slide 30s linear infinite;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    min-width: 150px;
}

.tech-item img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.tech-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@keyframes slide {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Experience Section */
.timeline {
    max-width: 1200px;
    margin: 0 auto;
}

.timeline-item {
    margin-bottom: 4rem;
}

.timeline-content {
    display: flex;
    gap: 2rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
}

.timeline-image {
    flex: 0 0 200px;
    position: relative;
}

.image-slider {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 10px;
}

.slider-container {
    width: 100%;
    height: 100%;
}

.slider-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.slider-container img.active {
    opacity: 1;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider-btn.prev {
    left: 0;
}

.slider-btn.next {
    right: 0;
}

.view-album-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s ease;
}

.view-album-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.timeline-text {
    flex: 1;
}

.timeline-text h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.company {
    color: var(--text-primary);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.date {
    color: var(--text-secondary);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.achievements {
    list-style: none;
}

.achievements li {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
    text-align: justify;
}

.achievements li::before {
    content: "•";
    color: var(--text-primary);
    position: absolute;
    left: 0;
}

/* Album Popup */
.album-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.album-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-content {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.album-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-album {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
}

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

.album-item {
    position: relative;
    padding-top: 75%;
    overflow: hidden;
    border-radius: 5px;
}

.album-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.album-item:hover img {
    transform: scale(1.05);
}

/* Skills Section */
.skills-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

.skill-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    padding: 12px;
    background: var(--accent-secondary);
    border-radius: 50%;
}

.skill-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.skill-card h3 {
    margin-bottom: 1rem;
}

.skill-card p {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Projects Section */
.projects-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
}

.project-image {
    position: relative;
    padding-top: 56.25%;
}

.project-image .image-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.project-content {
    padding: 1.5rem;
}

.project-content h3 {
    margin-bottom: 1rem;
}

.project-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tech span {
    background: var(--accent-secondary);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* Contact Section */
.contact-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.contact-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.contact-button {
    width: 60px;
    height: 60px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.contact-button:hover {
    background: var(--accent-secondary);
    transform: translateY(-5px);
}

.contact-button img {
    width: 24px;
    height: 24px;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--nav-bg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-container {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

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

    .stats-container {
        grid-template-columns: 1fr;
    }

    .timeline-content {
        flex-direction: column;
    }

    .timeline-image {
        flex: 0 0 auto;
    }

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

    .contact-buttons {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    nav ul {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

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

    .about-header {
        flex-direction: column;
        text-align: center;
    }

    .education-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .highlight-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Terminal Effect for Dark Mode */
[data-theme="dark"] {
    --cursor-color: var(--text-primary);
}

[data-theme="dark"] .typing-text::after {
    content: "_";
    color: var(--cursor-color);
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

[data-theme="dark"] .timeline-content,
[data-theme="dark"] .skill-card,
[data-theme="dark"] .project-card {
    border: 1px solid var(--accent-primary);
    box-shadow: var(--terminal-shadow);
}

/* Soft UI for Light Mode */
[data-theme="light"] .timeline-content,
[data-theme="light"] .skill-card,
[data-theme="light"] .project-card {
    box-shadow: 8px 8px 15px rgba(0, 0, 0, 0.1);
    border: none;
}

[data-theme="light"] .profile-image {
    box-shadow: 15px 15px 30px rgba(255, 105, 180, 0.2);
}

/* Mobile Navigation */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }

    nav ul {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--nav-bg);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: right 0.3s ease;
        padding: 2rem;
    }

    nav ul.active {
        right: 0;
    }

    nav ul li {
        width: 100%;
        text-align: center;
        padding: 1rem;
    }

    nav ul li a {
        font-size: 1.2rem;
        display: block;
        width: 100%;
    }

    .theme-toggle {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
    }

    /* Adjust other elements for mobile */
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

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

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

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .about-avatar img {
        width: 120px;
        height: 120px;
    }

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

    .project-card {
        padding: 1rem;
    }
}

/* Dark mode icon adjustments */
[data-theme="dark"] .social-links img,
[data-theme="dark"] .cv-button img,
[data-theme="dark"] .contact-button img,
[data-theme="dark"] .skill-icon img,
[data-theme="dark"] .stat-icon img,
[data-theme="dark"] .highlight-icon img,
[data-theme="dark"] .education-icon img {
    filter: invert(1);
}

/* Light mode icon adjustments */
[data-theme="light"] .social-links img,
[data-theme="light"] .cv-button img,
[data-theme="light"] .contact-button img,
[data-theme="light"] .skill-icon img,
[data-theme="light"] .stat-icon img,
[data-theme="light"] .highlight-icon img,
[data-theme="light"] .education-icon img {
    filter: none;
}