/* --- CSS Variables --- */
:root {
    /* Colors defined in prompt */
    --color-main: #6495ed;      /* Cornflower Blue */
    --color-main-hover: #4169e1; /* Royal Blue */
    --color-accent: #daa520;    /* Gold */
    --color-bg: #f0f8ff;        /* Alice Blue */
    --color-text: #333333;
    --color-card-bg: #ffffff;
    --color-footer-bg: #000000;
    --color-footer-text: #f0f8ff;
    
    /* Typography */
    --font-sans: "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
    --font-serif: "DNP Shuei Nijimi Mincho Std L", "Zen Old Mincho", "Yu Mincho", serif;
    
    /* Spacing */
    --header-height: 70px;
}

/* Dark Mode Override */
[data-theme="dark"] {
    --color-bg: #1a1a2e;
    --color-text: #e0e0e0;
    --color-card-bg: #252a41;
    --color-main: #6495ed; /* Keep main color identity */
}

/* --- Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    /* 固定背景画像は style.css からではなく、footer.php または インラインスタイルで動的パスを出力して制御します */
    color: var(--color-text);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Utility Classes --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    font-family: var(--font-serif);
    color: var(--color-main);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--color-accent);
    margin: 10px auto 0;
}

section {
    padding: 80px 0;
}

/* --- Header --- */
header {
    background-color: var(--color-main);
    height: var(--header-height);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ナビゲーションエリアの高さをヘッダーに合わせる */
.header-container nav {
    height: 100%;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    font-family: var(--font-sans);
}

/* PC Navigation */
.nav-menu {
    display: flex;
    height: 100%;
}

.nav-item {
    display: block;
    height: 100%;
    width: 120px; /* Equal width blocks */
    text-align: center;
}

.nav-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    color: #fff;
    font-weight: 500;
    transition: background-color 0.3s ease;
    position: relative;
}

.nav-link span.en {
    font-size: 1rem;
    letter-spacing: 1px;
}

.nav-link span.ja {
    font-size: 0.75rem;
    opacity: 0.9;
}

.nav-link:hover {
    background-color: var(--color-main-hover);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 20px;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background-color: #fff;
    color: var(--color-main);
}

/* Hamburger Menu (Mobile) */
.hamburger {
    display: none;
    cursor: pointer;
    z-index: 1001;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: #fff;
    transition: all 0.3s ease-in-out;
}

/* --- Hero Section --- */
.hero {
    height: 100vh;
    /* 背景画像はPHPファイル側でstyle属性として指定します */
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: var(--header-height);
}

.hero-content {
    background-color: rgba(255, 255, 255, 0.85);
    padding: 3rem 4rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

[data-theme="dark"] .hero-content {
    background-color: rgba(26, 26, 46, 0.85);
    border: 1px solid var(--color-main);
}

.hero-title-main {
    font-family: var(--font-sans); /* Meiryo */
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.hero-title-sub {
    font-family: var(--font-serif); /* DNP Nijimi Mincho substitute */
    font-size: 3rem;
    color: var(--color-main);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--color-text);
    letter-spacing: 0.1em;
    border-top: 1px solid var(--color-accent);
    display: inline-block;
    padding-top: 1rem;
}

/* --- About Section --- */
/* 背景画像が入るため、読みやすさを確保 */
.about-text {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

[data-theme="dark"] .about-text {
    background-color: rgba(37, 42, 65, 0.9);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    align-items: center;
}

.profile-img-container {
    text-align: center;
}

.profile-img {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--color-main);
    margin: 0 auto;
    /* 画像パスはHTML側で制御 */
    background-size: cover;
    background-position: center;
}

.about-text h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-main);
}

.about-text p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.highlight {
    font-weight: bold;
    color: var(--color-main);
}

/* --- Skills Section --- */
.skills-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.skill-category {
    background-color: var(--color-card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-top: 4px solid var(--color-accent);
}

.skill-category h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--color-main);
    font-family: var(--font-serif);
    font-size: 1.5rem;
}

.skill-list li {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
}

.skill-list li::before {
    content: '\f00c'; /* FontAwesome check */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--color-main);
    position: absolute;
    left: 0;
    top: 2px;
}

.cert-name {
    font-size: 0.9rem;
    opacity: 0.8;
    display: block;
    margin-top: 2px;
}

/* --- Works Section --- */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.work-card {
    background-color: var(--color-card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.work-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.work-img {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.work-content {
    padding: 20px;
}

.work-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--color-main);
    border-bottom: 2px solid var(--color-bg);
    padding-bottom: 5px;
    display: inline-block;
}

.work-category {
    font-size: 0.8rem;
    color: var(--color-accent);
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.work-desc {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.work-feature {
    font-size: 0.85rem;
    color: var(--color-text);
    opacity: 0.8;
    background-color: var(--color-bg);
    padding: 8px;
    border-radius: 4px;
}

/* --- Contact Section --- */
#contact {
    background-color: #f0f8ff;
}

[data-theme="dark"] #contact {
    background-color: var(--color-bg);
}

.contact-content {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--color-card-bg);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.contact-text {
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin: 2px;
    padding: 0;
    font-weight: bold;
    color: var(--color-main);
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--color-bg);
    color: var(--color-text);
}

textarea.form-control {
    resize: vertical;
    height: 120px;
}

.submit-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--color-main);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background-color: var(--color-main-hover);
}

.sns-links {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 20px;
}

.sns-icon {
    width: 50px;
    height: 50px;
    background-color: var(--color-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-main);
    transition: all 0.3s;
}

.sns-icon:hover {
    background-color: var(--color-main);
    color: #fff;
    transform: scale(1.1);
}

/* --- Footer --- */
footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    text-align: center;
    padding: 30px 0;
    font-size: 0.9rem;
}

/* --- Back to Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--color-main);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--color-main-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

/* --- Animations --- */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

    .hamburger {
        display: block;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        flex-direction: column;
        background-color: var(--color-main);
        width: 100%;
        height: calc(100vh - var(--header-height));
        transition: 0.3s;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-item {
        width: 100%;
        height: auto;
        padding: 20px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .about-grid, .skills-container {
        grid-template-columns: 1fr;
    }

    .hero-title-sub {
        font-size: 2rem;
    }
    
    .hero-content {
        width: 90%;
        padding: 2rem;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}