/* Custom properties for theme */
:root {
    --bg-color: #fdfdfd;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #eee;
    --link-color: #333;
    --link-hover-color: #007bff;
    --button-bg: #333;
    --button-text: #fff;
    --secondary-text: #555;
    --footer-text: #888;
}

/* Dark mode styles */
body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --link-color: #f0f0f0;
    --link-hover-color: #4da6ff;
    --button-bg: #555;
    --button-text: #f0f0f0;
    --secondary-text: #bbb;
    --footer-text: #aaa;
}

/* Base Styles */
body {
    font-family: 'Noto Sans JP', 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.8;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: var(--link-color);
    transition: color 0.3s, transform 0.2s;
}

a:hover {
    color: var(--link-hover-color);
    transform: translateY(-1px);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    line-height: 1.5;
}

p {
    margin-top: 0;
    margin-bottom: 1em;
}

/* Container for main content to limit width */
main {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Card Style (for profile, about, links, works) */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    max-width: 1200px; /* Wider header */
    margin: 0 auto;
}

.logo a {
    font-weight: 700;
    font-size: 1.6rem;
    font-family: 'Roboto', sans-serif;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.main-nav li {
    margin-left: 25px;
}

.main-nav a {
    font-weight: 400;
    font-size: 1rem;
    position: relative;
}

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

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

/* Theme Toggle Button */
.theme-toggle-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 10px;
    padding: 5px;
    transition: color 0.3s;
}

.theme-toggle-button:hover {
    color: var(--link-hover-color);
}

/* Profile Card */
.profile-card {
    display: flex;
    flex-direction: column; /* Stacks items vertically on small screens */
    align-items: center;
    text-align: center;
}

.profile-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 2px solid var(--border-color);
}

.profile-info .name-jp {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin-bottom: 5px;
}

.profile-info .name-en {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.profile-info .title {
    font-size: 1rem;
    color: var(--secondary-text);
    margin-bottom: 25px;
}

.social-links a {
    font-size: 1.4rem;
    margin: 0 12px;
    color: var(--link-color);
}

.social-links a:hover {
    color: var(--link-hover-color);
    transform: translateY(-2px);
}

.nav-links {
    margin-top: 30px;
    display: flex;
    gap: 15px; /* Space between buttons */
    flex-wrap: wrap; /* Allows wrapping on small screens */
    justify-content: center;
}

.btn-link {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: transparent;
    color: var(--link-color);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.2s;
}

.btn-link:hover {
    background-color: var(--link-hover-color);
    color: var(--button-text);
    border-color: var(--link-hover-color);
    transform: translateY(-2px);
}

/* About Site Section */
.about-site h2 {
    font-size: 1.6rem;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.about-site p {
    color: var(--secondary-text);
}

/* Inter Links Section */
.inter-links h2 {
    font-size: 1.6rem;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.link-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.link-item {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    background-color: var(--card-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.link-item:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    transform: translateY(-3px);
}

.link-img {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    object-fit: cover;
    margin-right: 15px;
    border: 1px solid var(--border-color);
}

.link-text h3 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--text-color);
}

.link-text p {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin: 5px 0 0;
}


/* Works Page Specific */
.page-title {
    text-align: center;
    padding: 40px 0 20px;
}

.page-title h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.page-title p {
    color: var(--secondary-text);
    font-size: 1.1rem;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 40px;
}

.work-item {
    text-align: center;
    padding: 25px; /* Card padding already applied */
}

.work-item h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.work-item p {
    color: var(--secondary-text);
    margin-bottom: 20px;
}


/* Footer */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--footer-text);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 50px;
    transition: border-color 0.3s;
}

.footer-links {
    margin-bottom: 15px;
}

.footer-links a {
    margin: 0 15px;
    color: var(--footer-text);
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--link-hover-color);
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        padding: 15px 5%;
    }

    .main-nav {
        margin-top: 15px;
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-nav li {
        margin: 0 10px 10px;
    }

    .profile-card {
        padding: 20px;
    }

    .profile-info .name-en {
        font-size: 1.8rem;
    }

    .profile-info .title {
        font-size: 0.9rem;
    }

    .nav-links {
        flex-direction: column;
        gap: 10px;
    }

    .btn-link {
        width: 80%; /* Make buttons wider */
        max-width: 250px;
        margin: 0 auto;
    }

    .about-site h2, .inter-links h2 {
        font-size: 1.4rem;
    }

    .link-item {
        flex-direction: column;
        text-align: center;
    }

    .link-img {
        margin: 0 0 10px 0;
    }

    .works-grid {
        grid-template-columns: 1fr; /* Single column on small screens */
    }
}
/* SNS Links Section */
.sns-links h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.sns-grid {
    display: grid;
    /* 画面幅に応じて列数を自動調整 */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
    justify-content: center;
}

.sns-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: background-color 0.3s, transform 0.2s;
}

.sns-item:hover {
    background-color: var(--border-color);
    transform: translateY(-4px);
}

.sns-item i {
    font-size: 2.5rem; /* アイコンのサイズ */
    margin-bottom: 10px;
}

.sns-item span {
    font-size: 0.9rem;
    color: var(--secondary-text);
    transition: color 0.3s;
}

.sns-item:hover span {
    color: var(--text-color);
}
/* Create Page Specific Styles */
.create-grid {
    display: grid;
    grid-template-columns: 1fr; /* 1列に設定 */
    gap: 30px;
    padding-bottom: 40px;
}

.create-item {
    display: flex;
    flex-direction: column; /* スマホでは縦並び */
    padding: 0; /* カードの内側の余白をなくす */
    overflow: hidden; /* カードの角丸を画像に適用するため */
}

.create-img {
    width: 100%;
    height: 200px; /* 画像の高さを固定 */
    object-fit: cover; /* アスペクト比を保ちつつコンテナを埋める */
}

.create-info {
    padding: 25px; /* テキスト部分の余白 */
}

.create-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.create-desc {
    color: var(--secondary-text);
    margin-bottom: 20px;
    min-height: 50px; /* 説明文の高さをある程度揃える */
}

.create-tags {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.create-tags span {
    background-color: var(--border-color);
    color: var(--secondary-text);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* PC向けのスタイル (画面幅が768px以上の場合) */
@media (min-width: 768px) {
    .create-item {
        flex-direction: row; /* 横並びにする */
    }

    .create-img {
        width: 40%; /* 画像の幅 */
        height: auto; /* 高さは自動調整 */
    }

    .create-info {
        width: 60%; /* テキスト部分の幅 */
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}
/* プロフィールアイコンのアニメーション設定 */
.profile-icon {
    /* クリックしやすいようにカーソルをポインターに */
    cursor: pointer; 
}

/* アイコンに回転アニメーションを適用するためのクラス */
.profile-icon.is-flipping {
    animation: spin-flip 0.6s ease-in-out;
}

/* 360度回転するアニメーションの定義 */
@keyframes spin-flip {
    0% {
        /* 開始時：回転0度 */
        transform: rotateY(0deg);
    }
    50% {
        /* 中間：180度回転（ここで画像が切り替わる） */
        transform: rotateY(180deg);
    }
    100% {
        /* 終了時：360度回転して元の向きに戻る */
        transform: rotateY(360deg);
    }
}
/*
/* Blog/Works Filter & Grid Common Styles
/* ---------------------------------------------------------- */

/* フィルターセクション全体のコンテナ */
.filter-section {
    display: flex;
    justify-content: flex-end; /* 右寄せにする */
    margin-bottom: 20px;
    padding: 0;
}

.filter-toggle-wrapper {
    position: relative;
    display: inline-block;
}

/* 絞り込みボタン */
.filter-toggle {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.filter-toggle:hover {
    background-color: var(--border-color);
}
.filter-toggle i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

/* フィルターオプションが開いている時の矢印の向き */
.filter-toggle.open i {
    transform: rotate(180deg);
}


/* フィルター選択肢のドロップダウン */
.filter-options {
    display: none; /* 初期状態では非表示 */
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10;
    min-width: 150px;
    padding: 8px 0;
    margin-top: 5px;
}

.filter-options.show {
    display: block; /* 表示する */
}

.filter-btn {
    display: block;
    width: 100%;
    padding: 10px 20px;
    border: none;
    background: none;
    text-align: left;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-btn:hover {
    background-color: var(--border-color);
}

/* フィルターで非表示にするためのクラス */
.work-item.hidden {
    display: none;
}


/* Blog Grid Layout */
.blog-grid {
    display: grid;
    gap: 30px;
    /* モバイルでは1列 */
    grid-template-columns: 1fr;
}

/* 画面幅が600px以上で2列に */
@media (min-width: 600px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 画面幅が900px以上で3列に */
@media (min-width: 900px) {
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/*
/* Tags (Color Variable Style)
/* ---------------------------------------------------------- */
.work-tags {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 25px;
}

.tag-link {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 12px;
    border-radius: 15px;
    font-weight: 500;
    background-color: transparent;
    border: 1px solid;
    /* 色はHTMLのstyle属性で直接指定される */
    transition: background-color 0.3s, color 0.3s;
}

/* aタグのホバーエフェクトのみ指定 */
a.tag-link:hover {
    background-color: currentColor;
    color: var(--button-text);
    transform: none;
}

/* ダークモード時のホバー文字色を調整 */
body.dark-mode a.tag-link:hover {
    color: var(--bg-color);
}
/*
/* Note-style Card Layout
/* ---------------------------------------------------------- */
.note-style-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s, transform 0.3s;
}
.note-style-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.card-image-link .placeholder-image {
    display: block;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: var(--border-color);
}
.card-content {
    padding: 20px;
}
.card-title {
    font-size: 1.25rem;
    margin: 0 0 15px 0;
}
.card-title a {
    color: var(--text-color);
}
.card-meta {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin-bottom: 15px;
}
.author-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
}
.author-name {
    font-weight: 500;
    margin-right: 12px;
}
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 25px; /* 高さを確保 */
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 15px;
}
/* Note-style Card Layout & Image */
.note-style-card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.3s, transform 0.3s; }
.note-style-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.card-image-link .placeholder-image { display: block; width: 100%; padding-top: 56.25%; background-color: var(--border-color); }
img.card-image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.card-content { padding: 20px; }
.card-title { font-size: 1.25rem; margin: 0 0 15px 0; }
.card-title a { color: var(--text-color); }
.card-meta { display: flex; align-items: center; font-size: 0.9rem; color: var(--secondary-text); margin-bottom: 15px; }
.author-icon { width: 24px; height: 24px; border-radius: 50%; margin-right: 8px; }
.author-name { font-weight: 500; margin-right: 12px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; min-height: 25px; border-top: 1px solid var(--border-color); padding-top: 15px; margin-top: 15px; }
p.card-post-date {
    font-size: 0.9rem;
    color: var(--secondary-text);
    margin: -10px 0 15px 0;
}