@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Google+Sans+Flex:opsz,wght@6..144,1..1000&family=Noto+Color+Emoji&family=Noto+Sans+JP:wght@100..900&display=swap');

/* --- CSS変数（GitHub Dark Dimmed風の配色） --- */
:root {
    --color-bg: #0d1117;
    --color-text-main: #c9d1d9;
    --color-text-muted: #8b949e;
    --color-border: #30363d;
    --color-link: #58a6ff;
    --color-btn-bg: #21262d;
    --color-btn-hover: #30363d;
    --color-card-bg: #0d1117;
    --color-header-bg: #010409;
    --font-stack: "Google Sans Flex", "Noto Sans JP", "Noto Color Emoji", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: "Google Sans Code", "Noto Sans JP", "Noto Color Emoji", monospace;

    /* 言語カラー定義 */
    --lang-html: #e34c26;
    --lang-css: #563d7c;
    --lang-javascript: #f1e05a;
    --lang-python: #3572A5;
    --lang-default: #8b949e;
}

/* --- テーマ変数定義 --- */
/* デフォルト (Dark Mode) */
:root {
    --color-bg: #0d1117;
    --color-text-main: #c9d1d9;
    --color-text-muted: #8b949e;
    --color-border: #30363d;
    --color-link: #58a6ff;
    --color-btn-bg: #21262d;
    --color-btn-hover: #30363d;
    --color-card-bg: #0d1117;
    --color-header-bg: #010409;

    /* 言語カラーなどは共通 */
    --font-stack: "Google Sans Flex", "Noto Sans JP", "Noto Color Emoji", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: "Google Sans Code", "Noto Sans JP", "Noto Color Emoji", monospace;
    --lang-html: #e34c26;
    --lang-css: #563d7c;
    --lang-javascript: #f1e05a;
    --lang-python: #3572A5;
    --lang-default: #8b949e;
}

/* Light Mode (bodyにdata-theme="light"がある場合) */
body[data-theme="light"] {
    --color-bg: #ffffff;
    --color-text-main: #24292f;
    --color-text-muted: #57606a;
    --color-border: #d0d7de;
    --color-link: #0969da;
    --color-btn-bg: #f6f8fa;
    --color-btn-hover: #eaeef2;
    --color-card-bg: #ffffff;
    --color-header-bg: #f6f8fa;
}

/* ヘッダー内タイトルの色 (ダークモードは白、ライトモードは黒) */
.header-title {
    color: var(--color-text-main);
}

/* --- ヘッダーレイアウト調整 (PC/Mobile対応) --- */
.header-inner {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    /* PCは折り返さない */
    gap: 16px;
}

.header-branding {
    display: flex;
    align-items: center;
    margin-right: auto;
    /* 左寄せにして残りのスペースを埋める */
}

/* PCレイアウト */
.view-switcher {
    order: 2;
    /* 中央 */
}

.theme-switch-wrapper {
    order: 3;
    /* 右端 */
}

/* スマホレイアウト */
@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
        /* 折り返し許可 */
    }

    /* 1行目: ロゴ(左) --- テーマスイッチ(右) */
    .header-branding {
        order: 1;
    }

    .theme-switch-wrapper {
        order: 2;
    }

    /* 2行目: コンテンツスイッチ(全幅) */
    .view-switcher {
        order: 3;
        width: 100%;
        margin-top: 8px;
        /* 少し隙間を空ける */
        margin-right: 0;
    }
}

/* --- 提供されたトグルスイッチのCSS --- */
.switch {
    font-size: 17px;
    position: relative;
    display: inline-block;
    width: 4em;
    height: 2.2em;
    border-radius: 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a2a2a;
    transition: 0.4s;
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    /* 境界線が見えるように追加 */
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.2em;
    width: 1.2em;
    border-radius: 20px;
    left: 0.5em;
    bottom: 0.5em;
    transition: 0.4s;
    transition-timing-function: cubic-bezier(0.81, -0.04, 0.38, 1.5);
    box-shadow: inset 8px -4px 0px 0px #fff;
}

/* Checked = Light Mode (青空) */
.switch input:checked+.slider {
    background-color: #00a6ff;
}

.switch input:checked+.slider:before {
    transform: translateX(1.8em);
    box-shadow: inset 15px -4px 0px 15px #ffcf48;
    /* 太陽 */
}

.star {
    background-color: #fff;
    border-radius: 50%;
    position: absolute;
    width: 5px;
    transition: all 0.4s;
    height: 5px;
}

.star_1 {
    left: 2.5em;
    top: 0.5em;
}

.star_2 {
    left: 2.2em;
    top: 1.2em;
}

.star_3 {
    left: 3em;
    top: 0.9em;
}

.switch input:checked~.slider .star {
    opacity: 0;
}

.cloud {
    width: 3.5em;
    position: absolute;
    bottom: -1.4em;
    left: -1.1em;
    opacity: 0;
    transition: all 0.4s;
}

.switch input:checked~.slider .cloud {
    opacity: 1;
}

/* --- リセット & 基本設定 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-main);
    font-family: var(--font-stack);
    line-height: 1.5;
    font-size: 14px;
}

code,
pre,
kbd,
samp {
    font-family: var(--font-mono);
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul {
    list-style: none;
}

hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: 1rem 0;
}

/* --- ヘッダー（新規追加クラス） --- */
.site-header {
    background-color: var(--color-header-bg);
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.header-logo {
    width: auto;
    /* 高さはHTML属性で32px指定 */
}

.header-title {
    margin-left: 16px;
    font-weight: bold;
    color: var(--color-text-main);
}

/* --- レイアウト --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: row;
    gap: 24px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
}

/* --- 左カラム（プロフィールサイドバー） --- */
.sidebar {
    width: 296px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }
}

.avatar-container {
    width: 260px;
    height: 260px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--color-btn-bg);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.names {
    padding-bottom: 16px;
}

.fullname {
    font-size: 24px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--color-text-main);
    display: block;
}

.nickname {
    font-size: 20px;
    font-style: normal;
    font-weight: 300;
    line-height: 24px;
    color: var(--color-text-muted);
    display: block;
}

.follow-btn-container {
    margin-bottom: 16px;
}

.follow-btn {
    width: 100%;
    padding: 6px 16px;
    background-color: var(--color-btn-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.profile-details {
    margin-top: 16px;
}

.detail-item {
    display: flex;
    align-items: center;
    padding-top: 4px;
    color: var(--color-text-main);
}

/* アイコンのスタイル */
.detail-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    fill: var(--color-text-muted);
    text-align: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {

    /* 画像と名前を横並びにする */
    .sidebar-header {
        display: flex;
        align-items: center;
        /* 垂直方向の中央揃え */
        margin-bottom: 16px;
    }

    /* スマホ版のアイコンサイズ調整 */
    .avatar-container {
        width: 64px;
        /* アイコンの幅を小さく */
        height: 64px;
        /* アイコンの高さを小さく */
        margin-bottom: 0;
        /* 下の余白を削除 */
        margin-right: 16px;
        /* 右（名前側）に余白を追加 */
        flex-shrink: 0;
        /* 縮まないように固定 */
    }

    /* 名前の下の余白を調整 */
    .names {
        padding-bottom: 0;
    }

    /* 名前（大）のフォントサイズ調整 */
    .fullname {
        font-size: 26px;
        line-height: 1.1;
    }

    /* 名前（ID）のフォントサイズ調整 */
    .nickname {
        font-size: 20px;
    }
}

/* LINEアイコン等の特殊SVG用スタイル */
.icon-line-svg {
    fill-rule: evenodd;
    clip-rule: evenodd;
    stroke-linejoin: round;
    stroke-miterlimit: 2;
}

.social-link {
    color: var(--color-text-main);
}

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

/* --- 右カラム（メインコンテンツ） --- */
.main-content {
    flex-grow: 1;
    min-width: 0;
}

/* --- セクション: 自己紹介 (README風) --- */
.readme-section {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    margin-bottom: 24px;
}

.readme-header {
    background-color: var(--color-header-bg);
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 12px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    font-family: var(--font-mono);
}

.readme-body {
    padding: 24px;
}

.readme-body h2 {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.3em;
    margin-bottom: 16px;
    font-size: 2em;

    @media (max-width: 768px) {
        font-size: 1.5em;
    }
}

.readme-body p {
    margin-bottom: 16px;
}

.readme-body ul {
    list-style: disc;
    /* 黒丸（・）を表示 */
    padding-left: 2em;
    /* 左側にインデント（余白）を作って・が入る場所を確保 */
    margin-bottom: 16px;
    /* 下に余白 */
}

.readme-body li {
    line-height: 1.5;
    /* 行間 */
    margin-bottom: 4px;
    /* 項目ごとの隙間を少し空ける */
}

/* --- セクション: 作品一覧 (Pinned風) --- */
.section-title {
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 400;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.project-card {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 16px;
    background-color: var(--color-card-bg);
    display: flex;
    flex-direction: column;
}

.project-top {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.repo-icon {
    margin-right: 8px;
    fill: var(--color-text-muted);
}

.project-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-link);
}

.badge {
    border: 1px solid var(--color-border);
    border-radius: 2em;
    padding: 0 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 8px;
}

.project-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
}

.project-meta {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--color-text-muted);
}

.lang-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
}

/* --- セクション: 経歴 (Contribution Activity風) --- */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
}

.timeline-year {
    font-size: 12px;
    color: var(--color-text-muted);
}

.timeline-container {
    margin-left: 16px;
    border-left: 2px solid var(--color-border);
    padding-left: 24px;
    padding-bottom: 24px;
    position: relative;
}

.timeline-item {
    margin-bottom: 24px;
    position: relative;
}

/* タイムラインのアイコン（丸い部分） */
.timeline-icon-bg {
    position: absolute;
    left: -33px;
    top: 0;
    width: 16px;
    height: 16px;
    background-color: var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
}

/* JSで挿入されるSVG用のスタイル */
.timeline-svg {
    fill: #fff;
    transform: scale(0.6);
}

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

.timeline-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text-main);
}

.timeline-date {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.timeline-desc {
    color: var(--color-text-muted);
    font-size: 14px;
}

/* --- フッター --- */
footer {
    margin-top: 40px;
    border-top: 1px solid var(--color-border);
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* --- ヘッダーレイアウト調整 --- */
.header-inner {
    /* 既存のスタイルを上書きして左右配置にする */
    justify-content: space-between;
}

/* --- 表示切り替えスイッチ (左右対称・固定幅) --- */
.view-switcher {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    /* 丸い形状 */
    overflow: hidden;
    height: 40px;

    /* ▼ 変更点: 全体の幅を固定します（文字数に合わせて調整してください） */
    width: 320px;
    max-width: 100%;
    /* スマホ対策 */
}

.segment-btn {
    background: transparent;
    border: none;

    /* ▼ 変更点: 中身に関わらず常に左右を均等（50%:50%）に分割します */
    flex: 1 1 0px;

    /* ▼ 変更点: 中身を中央揃えにします */
    justify-content: center;
    padding: 0;
    /* 余計な隙間を削除 */

    font-family: var(--font-stack);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s, color 0.2s;
    position: relative;
}

/* ボタンの間の境界線 */
.segment-btn:not(:last-child) {
    border-right: 1px solid var(--color-border);
}

.segment-btn:hover {
    background-color: var(--color-btn-hover);
    color: var(--color-text-main);
}

/* アクティブ状態のデザイン */
.segment-btn.active {
    background-color: rgba(86, 61, 124, 0.4);
    color: var(--color-text-main);
}

.check-icon {
    width: 18px;
    height: 18px;
    display: none;
    /* 非アクティブ時は非表示 */
}

/* アクティブ時のみチェックマークを表示 */
.segment-btn.active .check-icon {
    display: block;
}

/* スマホ等で幅が狭い場合の調整 */
@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .view-switcher {
        width: 100%;
        /* スマホでは全幅に */
    }
}

/* スマホ等で幅が狭い場合の調整（style.cssの最下部を修正） */
@media (max-width: 600px) {
    .header-inner {
        /* 修正: 縦並び(column)から横並び(row)に変更し、折り返し(wrap)を許可 */
        flex-direction: row;
        flex-wrap: wrap;
        
        /* 左右に配置（ロゴは左、スイッチは右） */
        justify-content: space-between;
        align-items: center;
        
        /* 行間の余白 */
        gap: 16px 0; /* 縦の隙間16px, 横の隙間0 */
    }

    /* 1. ロゴ（左上） */
    .header-branding {
        order: 1;
        margin-right: 0; /* PC版の余白設定を解除 */
        /* 幅を自動にして左側に寄せる */
        flex: 0 1 auto;
    }

    /* 2. テーマ切り替えスイッチ（右上） */
    .theme-switch-wrapper {
        order: 2;
        /* 右側に配置される */
    }

    /* 3. University/HighSchool 切り替えボタン（下段） */
    .view-switcher {
        order: 3;
        width: 100%;     /* 幅を100%にして強制的に改行させる */
        margin-top: 0;   /* 余白は親要素(.header-inner)のgapで調整するため0に */
        margin-right: 0;
    }
}

body[data-theme="light"] .timeline-container {
    border-left-color: #576069;
}

body[data-theme="light"] .timeline-icon-bg {
    background-color: #576069;
}