/* --- デザインシステム（変数の定義） --- */
:root {
    /* ライトモード（水色中心の爽やかなパレット） */
    --bg-color: #f4f9fc;             /* ほんのり水色がかった清潔感のある背景 */
    --section-bg-white: #ffffff;
    --section-bg-gray: #eef7fc;       /* カードやAboutセクションの背景用（淡い水色グレー） */
    --text-primary: #1c2d3d;         /* 水色と相性の良い、少し青みがかった濃いグレー */
    --text-secondary: #5a6f85;       /* 控えめなテキスト用のブルーグレー */
    --text-muted: #7e95a3;
    --accent-color: #0099ff;         /* ★ メインの鮮やかな水色 */
    --card-bg: #ffffff;
    --card-border: #d4e7f5;          /* 水色に馴染む淡い境界線 */
    --card-shadow: rgba(0, 153, 255, 0.03);
    --card-shadow-hover: rgba(0, 153, 255, 0.12);
    --header-bg: rgba(255, 255, 255, 0.92);
    --tag-bg: #e1f2fe;               /* タグ用の薄い水色 */
    --tag-text: #0077cc;
    --hero-gradient: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); /* ヒーローエリアの美しい水色グラデーション */
}

[data-theme="dark"] {
    /* ダークモード（深海のようなネイビーとネオン水色） */
    --bg-color: #070c14;             /* 深みのあるダークネイビー */
    --section-bg-white: #0d1524;     /* やや明るめのダークブルー */
    --section-bg-gray: #121b2d;       /* カードやAbout背景用の深い紺色 */
    --text-primary: #e2f1fc;         /* 視認性の高い、極めて薄い水色ホワイト */
    --text-secondary: #8da2b5;       /* 落ち着いたブルーグレー */
    --text-muted: #62778a;
    --accent-color: #38bdf8;         /* ★ ダークモードで鮮やかに映えるサイバー水色 */
    --card-bg: #121b2d;
    --card-border: #1e293b;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --card-shadow-hover: rgba(56, 189, 248, 0.15); /* ホバー時に水色の光が漏れるようなエフェクト */
    --header-bg: rgba(13, 21, 36, 0.92);
    --tag-bg: #1e293b;
    --tag-text: #38bdf8;
    --hero-gradient: linear-gradient(135deg, #0f172a 0%, #0369a1 100%); /* 深みのあるテック感抜群のグラデーション */
}

/* --- リセット & ベーススタイル --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* ★ font-family の先頭に 'Zen Kurenaido' を指定 */
    font-family: 'Zen Kurenaido', 'Montserrat', 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
    line-height: 1.7; /* 独特なフォントの形状に合わせて、行間を少しだけ広げると読みやすくなります */
    color: var(--text-primary);
    background-color: var(--bg-color);
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease, opacity 0.3s ease;
}

li {
    list-style: none;
}

/* --- ヘッダー --- */
header {
    background-color: var(--header-bg);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
    transition: background-color 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

nav {
    margin-left: auto;
}

nav ul {
    display: flex;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

/* テーマ切り替えボタン */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: 25px;
    padding: 5px;
    transition: color 0.3s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

/* --- ローディング画面 --- */
#loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    background-color: var(--loader-bg, var(--bg-color));
    color: var(--text-primary);
    z-index: 3000;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-text {
    font-weight: 600;
    letter-spacing: 0.6px;
}

.loader-bar {
    width: 160px;
    height: 6px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(0,0,0,0.08), rgba(0,0,0,0.05));
    overflow: hidden;
    position: relative;
}

.loader-bar::after {
    content: '';
    position: absolute;
    left: -40%;
    top: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    animation: loaderMove 1.6s linear infinite;
}

@keyframes loaderMove {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* --- ヘッダのテーマメニュー --- */
.theme-wrapper {
    position: relative;
    display: inline-block;
}

.theme-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--section-bg-white);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--card-shadow);
    display: none;
    z-index: 2001;
    overflow: hidden;
    transform-origin: top right;
}

.theme-menu .theme-option {
    display: block;
    padding: 10px 14px;
    background: transparent;
    color: var(--text-primary);
    width: 160px;
    text-align: left;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.theme-menu .theme-option:hover {
    background: linear-gradient(90deg, rgba(0,0,0,0.03), rgba(0,0,0,0.02));
}

.theme-menu.show {
    display: block;
}

/* ==========================================
   モバイル専用 固定Contactタブ
========================================== */

/* デフォルト（PC画面）では完全に非表示 */
.mobile-contact-tab {
    display: none;
}

/* スマートフォン環境（画面幅768px以下）でのスタイル */
@media (max-width: 768px) {
    /* ★ 既存のヘッダーメニュー内のSNSアイコンを非表示にする（重複防止） */
    nav ul .nav-social {
        display: none !important;
    }

    /* 下部固定タブバーのスタイリング */
    .mobile-contact-tab {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: var(--header-bg); /* ヘッダーと同じ半透明の水色/ダークネイビー背景 */
        backdrop-filter: blur(10px);        /* おしゃれなすりガラスエフェクト */
        border-top: 1px solid var(--card-border);
        box-shadow: 0 -4px 12px rgba(0, 153, 255, 0.05);
        z-index: 2000;                      /* 最前面に固定 */
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom); /* iPhoneの画面下のバー（Home Indicator）との被り防止 */
    }

    /* 各タブボタン（アイコン＋文字） */
    .mobile-contact-tab a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        width: 33.33%;
        height: 100%;
        font-family: 'Zen Kurenaido', sans-serif;
        transition: color 0.2s ease;
    }

    /* アイコンのサイズ */
    .mobile-contact-tab a i {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }

    /* アイコンの下の小さな文字 */
    .mobile-contact-tab a span {
        font-size: 0.7rem;
        font-weight: 500;
        letter-spacing: 0.5px;
    }

    /* タップ（ホバー）した時に水色に光る */
    .mobile-contact-tab a:hover,
    .mobile-contact-tab a:active {
        color: var(--accent-color);
    }

    /* ★ 画面最下部がタブに被って隠れないよう、全体の最下部に余白を作る */
    body {
        padding-bottom: 60px;
    }
}

/* --- Hero Section --- */
.hero {
    height: 100vh;
    background: var(--hero-gradient);
    display: flex;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    transition: background 0.3s ease;
}

.hero-content {
    margin: 0 auto;
    max-width: 800px;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px; /* タイトルと下の文章の間隔を少し調整 */
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* ★ ヒーローセクションの文章（行間を最適化） */
.hero p {
    font-size: 1.25rem;       /* ほんの少しだけサイズを調整してスマートに */
    color: var(--text-secondary);
    margin-bottom: 35px;     /* 文章からボタンまでの余白 */
    font-weight: 300;
    line-height: 0.3;        /* ★ 全体の1.7から「1.4」に狭めて、改行時の間伸びを解消 */
    letter-spacing: 1px;     /* フォント特有の繊細さを活かすため、文字の間隔を少し広げて上品に */
}

/* --- Hero Section --- */
/* (既存の.hero や .hero-content のスタイルはそのまま維持) */

/* ボタンを並べるコンテナ */
.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ★ ボタン全体の共通スタイル（丸みを大幅に強化） */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--text-primary);
    color: var(--bg-color);
    width: 180px;            
    height: 50px;           /* 高さを少しだけ上げて、丸みが一番綺麗に見える黄金比に */
    margin: 10px;           
    border-radius: 25px;    /* ★ ここを「heightの半分」にすることで、完全に両端が半円の綺麗な丸みになります */
    font-weight: 500;
    letter-spacing: 0.5px;  /* 文字の間隔を少しあけてモダンに */
    transition: background-color 0.3s ease, transform 0.2s ease, color 0.3s ease, box-shadow 0.2s ease;
}

.btn:hover {
    background-color: var(--accent-color);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 118, 255, 0.2); /* ホバー時にうっすら影をつけて浮き出す演出を追加 */
}

/* デスクトップ表示の時はボタンを横並びにする */
@media (min-width: 576px) {
    .hero-content {
        display: block; 
    }
    .btn {
        margin: 0 12px; /* 横並びの時の左右の間隔を少しだけ広げてゆとりを持たせる */
    }
}

/* --- 共通セクションスタイル --- */
.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 15px;
    font-weight: 700;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background-color: var(--accent-color);
}

section {
    padding: 100px 0;
}

/* --- About Me セクション --- */
.about-section {
    background-color: var(--section-bg-white);
}

/* 左右のグリッド配置（上揃えで綺麗に並べる） */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    align-items: start;
}

/* 左カラム：プロフィール基本情報カード */
.profile-left {
    text-align: center;
    background-color: var(--section-bg-gray);
    padding: 40px 30px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 12px var(--card-shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* アバター画像 */
.about-avatar {
    width: 130px;
    height: 130px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border: 3px solid var(--section-bg-white);
}

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

/* プロフィールテキスト */
.profile-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.profile-title {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-weight: 500;
}

/* 左カラム内の個別項目（CORE FOCUS, LOCATION） */
.profile-left .profile-item {
    text-align: left;
    background-color: var(--card-bg);
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    margin-bottom: 15px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-left .profile-item:last-child {
    margin-bottom: 0;
}

.profile-left .profile-item h4 {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    color: var(--accent-color);
    margin-bottom: 6px;
    font-weight: 700;
}

.profile-left .profile-item p {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
}

/* ★ 右カラム：自己紹介本文を包むカード枠 */
.profile-right {
    background-color: var(--section-bg-gray);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 12px var(--card-shadow);
    min-height: 100%; /* 左のカードと視覚的な高さをブレにくくする */
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-right .profile-item p {
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap; /* 改行を適切に反映 */
    margin: 0;
}


/* --- レスポンシブ対応（スマートフォン閲覧時の最適化） --- */
@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-left, 
    .profile-right {
        padding: 30px 20px; /* スマホ時は余白をタイトにして画面を広く使う */
    }
    
    .profile-right .profile-item p {
        font-size: 0.95rem;
    }
}

/* --- Works (Products) セクション --- */
.works-section {
    background-color: var(--section-bg-gray);
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* カード全体のベース設定 */
.work-card {
    background-color: var(--card-bg);
    border-radius: 12px; /* 少し丸みを強めてカプセルボタンと調和 */
    overflow: hidden;
    box-shadow: 0 4px 12px var(--card-shadow);
    border: 1px solid var(--card-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* リンク付きカードのホバー効果 */
a.work-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px var(--card-shadow-hover);
    border-color: var(--accent-color);
}

.work-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--card-border);
    transition: border-color 0.3s ease;
}

/* ★ カード内のテキストエリア（読みやすさを大幅に向上） */
.work-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* カテゴリ・使用言語（一番上の小さな文字） */
.work-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color); /* 水色 */
    font-weight: 700;           /* しっかり太くして視認性を確保 */
    display: block;
    margin-bottom: 8px;
}

/* プロダクト名（タイトル） */
.work-card h3 {
    font-size: 1.4rem;          /* 少しサイズを大きく */
    margin-bottom: 12px;
    color: var(--text-primary); /* 一つ上の濃いブルーグレー */
    font-weight: 700;           /* ★ 線の細いZen Kurenaidoでもハッキリ読めるように太字化 */
    letter-spacing: 0.5px;
}

/* プロダクトの説明文（本文） */
.work-card p {
    font-size: 1rem;            /* 0.95remから1remへ拡大 */
    color: var(--text-primary); /* ★ var(--text-secondary)から、最も濃い【--text-primary】に変更してコントラストを強化 */
    line-height: 1.7;           /* 行間をゆったりさせて読みやすく */
    letter-spacing: 0.5px;      /* 文字同士の詰まりを解消 */
}

/* --- Contact セクション --- */
.contact-section {
    background-color: var(--section-bg-white);
    text-align: center;
}

.contact-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.social-links {
    display: flex;
    justify-content: center;
}

.social-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--text-primary);
    color: var(--bg-color);
    padding: 12px 32px;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.social-icon:hover {
    background-color: var(--accent-color);
    color: #ffffff;
    transform: translateY(-2px);
}

/* --- フッター --- */
footer {
    background-color: #111116; /* ダークモードでもライトモードでも暗い背景を維持 */
    color: #888888;
    padding: 30px 0;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid var(--card-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- レスポンシブ対応（スマートフォン対応） --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    nav {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--section-bg-white);
        transition: 0.3s;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }

    nav.active {
        left: 0;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        padding-top: 50px;
    }

    nav ul li {
        margin: 20px 0;
        margin-left: 0;
    }

    .theme-toggle {
        margin-left: auto;
    }

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

    .profile-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    /* ハンバーガーメニューがアクティブな時のクロスアニメーション */
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* ==========================================
   Loading Animation
   ========================================== */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #78c9ff; /* ライトモード背景 */
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px; /* テキストとバーの間隔 */
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* ダークモード時のローディング背景 */
@media (prefers-color-scheme: dark) {
    #loader {
        background-color: #0b0b0f;
    }
}

/* 読み込み中を消すためのクラス */
#loader.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Loadingテキストのスタイル */
.loader-text {
    font-family: 'Zen Kurenaido', sans-serif;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: 2px;
    animation: pulse 1.5s infinite ease-in-out;
}

/* プログレスバーの外枠（淡い水色） */
.loader-bar {
    width: 160px;
    height: 2px;
    background-color: var(--tag-bg);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

/* 動くインジケーター（鮮やかな水色） */
.loader-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 2px;
    animation: loading-scan 1.5s infinite ease-in-out;
}

/* アニメーション：バーの横移動 */
@keyframes loading-scan {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* アニメーション：テキストのなめらかな明滅 */
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}